diff --git a/.changelog/c3a62c73ab624737a829d8c85167835e.json b/.changelog/c3a62c73ab624737a829d8c85167835e.json new file mode 100644 index 00000000000..ea50af800a4 --- /dev/null +++ b/.changelog/c3a62c73ab624737a829d8c85167835e.json @@ -0,0 +1,31 @@ +{ + "id": "c3a62c73-ab62-4737-a829-d8c85167835e", + "type": "dependency", + "description": "Upgrade smithy to 1.27.2 and correct empty query list serialization.", + "modules": [ + "internal/protocoltest/awsrestjson", + "internal/protocoltest/ec2query", + "internal/protocoltest/jsonrpc", + "internal/protocoltest/jsonrpc10", + "internal/protocoltest/query", + "internal/protocoltest/restxml", + "service/autoscaling", + "service/cloudformation", + "service/cloudsearch", + "service/cloudwatch", + "service/docdb", + "service/ec2", + "service/elasticache", + "service/elasticbeanstalk", + "service/elasticloadbalancing", + "service/elasticloadbalancingv2", + "service/iam", + "service/neptune", + "service/rds", + "service/redshift", + "service/ses", + "service/sns", + "service/sqs", + "service/sts" + ] +} diff --git a/aws/protocol/query/array.go b/aws/protocol/query/array.go index 9d7d3a0cb5e..47ebc0f5476 100644 --- a/aws/protocol/query/array.go +++ b/aws/protocol/query/array.go @@ -36,20 +36,31 @@ type Array struct { memberName string // Elements are stored in values, so we keep track of the list size here. size int32 + // Empty lists are encoded as "=", if we add a value later we will + // remove this encoding + emptyValue Value } func newArray(values url.Values, prefix string, flat bool, memberName string) *Array { + emptyValue := newValue(values, prefix, flat) + emptyValue.String("") + return &Array{ values: values, prefix: prefix, flat: flat, memberName: memberName, + emptyValue: emptyValue, } } // Value adds a new element to the Query Array. Returns a Value type used to // encode the array element. func (a *Array) Value() Value { + if a.size == 0 { + delete(a.values, a.emptyValue.key) + } + // Query lists start a 1, so adjust the size first a.size++ prefix := a.prefix diff --git a/aws/protocol/query/encoder_test.go b/aws/protocol/query/encoder_test.go index d0c21e537cb..8e668fc3f7f 100644 --- a/aws/protocol/query/encoder_test.go +++ b/aws/protocol/query/encoder_test.go @@ -3,8 +3,9 @@ package query import ( "bytes" "fmt" - smithytesting "github.com/aws/smithy-go/testing" "testing" + + smithytesting "github.com/aws/smithy-go/testing" ) func TestEncode(t *testing.T) { @@ -35,6 +36,13 @@ func TestEncode(t *testing.T) { }, Expect: []byte(`list.spam.1=spam&list.spam.2=eggs`), }, + "empty list": { + Encode: func(e *Encoder) error { + e.Object().Key("list").Array("spam") + return e.Encode() + }, + Expect: []byte(`list=`), + }, "flat list": { Encode: func(e *Encoder) error { list := e.Object().FlatKey("list").Array("spam") @@ -44,6 +52,13 @@ func TestEncode(t *testing.T) { }, Expect: []byte(`list.1=spam&list.2=eggs`), }, + "empty flat list": { + Encode: func(e *Encoder) error { + e.Object().FlatKey("list").Array("spam") + return e.Encode() + }, + Expect: []byte(`list=`), + }, "map": { Encode: func(e *Encoder) error { mapValue := e.Object().Key("map").Map("key", "value") diff --git a/codegen/gradle.properties b/codegen/gradle.properties index ea3fa73f7c5..04885b86c70 100644 --- a/codegen/gradle.properties +++ b/codegen/gradle.properties @@ -1,2 +1,2 @@ -smithyVersion=1.25.2 +smithyVersion=1.27.2 smithyGradleVersion=0.6.0 diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/QueryShapeSerVisitor.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/QueryShapeSerVisitor.java index bc0165ee36c..881f983012e 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/QueryShapeSerVisitor.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/QueryShapeSerVisitor.java @@ -75,9 +75,6 @@ protected void serializeCollection(GenerationContext context, CollectionShape sh MemberShape member = shape.getMember(); Shape target = context.getModel().expectShape(member.getTarget()); - // If the list is empty, exit early to avoid extra effort. - writer.write("if len(v) == 0 { return nil }"); - writer.write("array := value.Array($S)", getSerializedLocationName(member, "member")); writer.write(""); diff --git a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go index a6de0512596..1d861e7503c 100644 --- a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go +++ b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go @@ -46,6 +46,10 @@ type AllQueryStringTypesInput struct { QueryInteger *int32 + QueryIntegerEnum types.IntegerEnum + + QueryIntegerEnumList []types.IntegerEnum + QueryIntegerList []int32 QueryIntegerSet []int32 diff --git a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go index 2830a5dc7ef..931fc1b86f4 100644 --- a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go +++ b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go @@ -92,6 +92,92 @@ func TestClient_AllQueryStringTypes_awsRestjson1Serialize(t *testing.T) { types.FooEnum("Baz"), types.FooEnum("Bar"), }, + QueryIntegerEnum: 1, + QueryIntegerEnumList: []types.IntegerEnum{ + 1, + 2, + 3, + }, + QueryParamsMapOfStringList: map[string][]string{ + "String": { + "Hello there", + }, + "StringList": { + "a", + "b", + "c", + }, + "StringSet": { + "a", + "b", + "c", + }, + "Byte": { + "1", + }, + "Short": { + "2", + }, + "Integer": { + "3", + }, + "IntegerList": { + "1", + "2", + "3", + }, + "IntegerSet": { + "1", + "2", + "3", + }, + "Long": { + "4", + }, + "Float": { + "1.1", + }, + "Double": { + "1.1", + }, + "DoubleList": { + "1.1", + "2.1", + "3.1", + }, + "Boolean": { + "true", + }, + "BooleanList": { + "true", + "false", + "true", + }, + "Timestamp": { + "1970-01-01T00:00:01Z", + }, + "TimestampList": { + "1970-01-01T00:00:01Z", + "1970-01-01T00:00:02Z", + "1970-01-01T00:00:03Z", + }, + "Enum": { + "Foo", + }, + "EnumList": { + "Foo", + "Baz", + "Bar", + }, + "IntegerEnum": { + "1", + }, + "IntegerEnumList": { + "1", + "2", + "3", + }, + }, }, ExpectMethod: "GET", ExpectURIPath: "/AllQueryStringTypesInput", @@ -130,6 +216,10 @@ func TestClient_AllQueryStringTypes_awsRestjson1Serialize(t *testing.T) { {Key: "EnumList", Value: "Foo"}, {Key: "EnumList", Value: "Baz"}, {Key: "EnumList", Value: "Bar"}, + {Key: "IntegerEnum", Value: "1"}, + {Key: "IntegerEnumList", Value: "1"}, + {Key: "IntegerEnumList", Value: "2"}, + {Key: "IntegerEnumList", Value: "3"}, }, BodyAssert: func(actual io.Reader) error { return smithytesting.CompareReaderEmpty(actual) @@ -161,6 +251,11 @@ func TestClient_AllQueryStringTypes_awsRestjson1Serialize(t *testing.T) { "RestJsonQueryStringEscaping": { Params: &AllQueryStringTypesInput{ QueryString: ptr.String("%:/?#[]@!$&'()*+,;=😹"), + QueryParamsMapOfStringList: map[string][]string{ + "String": { + "%:/?#[]@!$&'()*+,;=😹", + }, + }, }, ExpectMethod: "GET", ExpectURIPath: "/AllQueryStringTypesInput", diff --git a/internal/protocoltest/awsrestjson/api_op_DatetimeOffsets.go b/internal/protocoltest/awsrestjson/api_op_DatetimeOffsets.go new file mode 100644 index 00000000000..58984f264f3 --- /dev/null +++ b/internal/protocoltest/awsrestjson/api_op_DatetimeOffsets.go @@ -0,0 +1,101 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awsrestjson + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +func (c *Client) DatetimeOffsets(ctx context.Context, params *DatetimeOffsetsInput, optFns ...func(*Options)) (*DatetimeOffsetsOutput, error) { + if params == nil { + params = &DatetimeOffsetsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DatetimeOffsets", params, optFns, c.addOperationDatetimeOffsetsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DatetimeOffsetsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DatetimeOffsetsInput struct { + noSmithyDocumentSerde +} + +type DatetimeOffsetsOutput struct { + Datetime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDatetimeOffsetsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDatetimeOffsets(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDatetimeOffsets(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DatetimeOffsets", + } +} diff --git a/internal/protocoltest/awsrestjson/api_op_DatetimeOffsets_test.go b/internal/protocoltest/awsrestjson/api_op_DatetimeOffsets_test.go new file mode 100644 index 00000000000..188dc7ebbcd --- /dev/null +++ b/internal/protocoltest/awsrestjson/api_op_DatetimeOffsets_test.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awsrestjson + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io/ioutil" + "math" + "net/http" + "testing" +) + +func TestClient_DatetimeOffsets_awsRestjson1Deserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *DatetimeOffsetsOutput + }{ + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "RestJsonDateTimeWithNegativeOffset": { + StatusCode: 200, + BodyMediaType: "application/json", + Body: []byte(` { + "datetime": "2019-12-16T22:48:18-01:00" + } + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "RestJsonDateTimeWithPositiveOffset": { + StatusCode: 200, + BodyMediaType: "application/json", + Body: []byte(` { + "datetime": "2019-12-17T00:48:18+01:00" + } + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params DatetimeOffsetsInput + result, err := client.DatetimeOffsets(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go index 164ae1815c0..afdff63011c 100644 --- a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go +++ b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go @@ -45,6 +45,10 @@ type InputAndOutputWithHeadersInput struct { HeaderInteger *int32 + HeaderIntegerEnum types.IntegerEnum + + HeaderIntegerEnumList []types.IntegerEnum + HeaderIntegerList []int32 HeaderLong *int64 @@ -81,6 +85,10 @@ type InputAndOutputWithHeadersOutput struct { HeaderInteger *int32 + HeaderIntegerEnum types.IntegerEnum + + HeaderIntegerEnumList []types.IntegerEnum + HeaderIntegerList []int32 HeaderLong *int64 diff --git a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go index da37eaebc09..f5e9b153a0b 100644 --- a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go +++ b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go @@ -182,6 +182,27 @@ func TestClient_InputAndOutputWithHeaders_awsRestjson1Serialize(t *testing.T) { return smithytesting.CompareReaderEmpty(actual) }, }, + // Tests requests with intEnum header bindings + "RestJsonInputAndOutputWithIntEnumHeaders": { + Params: &InputAndOutputWithHeadersInput{ + HeaderIntegerEnum: 1, + HeaderIntegerEnumList: []types.IntegerEnum{ + 1, + 2, + 3, + }, + }, + ExpectMethod: "POST", + ExpectURIPath: "/InputAndOutputWithHeaders", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "X-IntegerEnum": []string{"1"}, + "X-IntegerEnumList": []string{"1, 2, 3"}, + }, + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareReaderEmpty(actual) + }, + }, // Supports handling NaN float header values. "RestJsonSupportsNaNFloatHeaderInputs": { Params: &InputAndOutputWithHeadersInput{ @@ -428,6 +449,22 @@ func TestClient_InputAndOutputWithHeaders_awsRestjson1Deserialize(t *testing.T) }, }, }, + // Tests responses with intEnum header bindings + "RestJsonInputAndOutputWithIntEnumHeaders": { + StatusCode: 200, + Header: http.Header{ + "X-IntegerEnum": []string{"1"}, + "X-IntegerEnumList": []string{"1, 2, 3"}, + }, + ExpectResult: &InputAndOutputWithHeadersOutput{ + HeaderIntegerEnum: 1, + HeaderIntegerEnumList: []types.IntegerEnum{ + 1, + 2, + 3, + }, + }, + }, // Supports handling NaN float header values. "RestJsonSupportsNaNFloatHeaderOutputs": { StatusCode: 200, diff --git a/internal/protocoltest/awsrestjson/api_op_JsonIntEnums.go b/internal/protocoltest/awsrestjson/api_op_JsonIntEnums.go new file mode 100644 index 00000000000..9765589a244 --- /dev/null +++ b/internal/protocoltest/awsrestjson/api_op_JsonIntEnums.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awsrestjson + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/awsrestjson/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This example serializes intEnums as top level properties, in lists, sets, and +// maps. +func (c *Client) JsonIntEnums(ctx context.Context, params *JsonIntEnumsInput, optFns ...func(*Options)) (*JsonIntEnumsOutput, error) { + if params == nil { + params = &JsonIntEnumsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "JsonIntEnums", params, optFns, c.addOperationJsonIntEnumsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*JsonIntEnumsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type JsonIntEnumsInput struct { + IntegerEnum1 types.IntegerEnum + + IntegerEnum2 types.IntegerEnum + + IntegerEnum3 types.IntegerEnum + + IntegerEnumList []types.IntegerEnum + + IntegerEnumMap map[string]types.IntegerEnum + + IntegerEnumSet []types.IntegerEnum + + noSmithyDocumentSerde +} + +type JsonIntEnumsOutput struct { + IntegerEnum1 types.IntegerEnum + + IntegerEnum2 types.IntegerEnum + + IntegerEnum3 types.IntegerEnum + + IntegerEnumList []types.IntegerEnum + + IntegerEnumMap map[string]types.IntegerEnum + + IntegerEnumSet []types.IntegerEnum + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationJsonIntEnumsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpJsonIntEnums{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpJsonIntEnums{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opJsonIntEnums(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opJsonIntEnums(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "JsonIntEnums", + } +} diff --git a/internal/protocoltest/awsrestjson/api_op_JsonIntEnums_test.go b/internal/protocoltest/awsrestjson/api_op_JsonIntEnums_test.go new file mode 100644 index 00000000000..ee0dd733236 --- /dev/null +++ b/internal/protocoltest/awsrestjson/api_op_JsonIntEnums_test.go @@ -0,0 +1,290 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package awsrestjson + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/awsrestjson/types" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io" + "io/ioutil" + "math" + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "testing" +) + +func TestClient_JsonIntEnums_awsRestjson1Serialize(t *testing.T) { + cases := map[string]struct { + Params *JsonIntEnumsInput + ExpectMethod string + ExpectURIPath string + ExpectQuery []smithytesting.QueryItem + RequireQuery []string + ForbidQuery []string + ExpectHeader http.Header + RequireHeader []string + ForbidHeader []string + Host *url.URL + BodyMediaType string + BodyAssert func(io.Reader) error + }{ + // Serializes intEnums as integers + "RestJsonJsonIntEnums": { + Params: &JsonIntEnumsInput{ + IntegerEnum1: 1, + IntegerEnum2: 2, + IntegerEnum3: 3, + IntegerEnumList: []types.IntegerEnum{ + 1, + 2, + 3, + }, + IntegerEnumSet: []types.IntegerEnum{ + 1, + 2, + }, + IntegerEnumMap: map[string]types.IntegerEnum{ + "abc": 1, + "def": 2, + }, + }, + ExpectMethod: "PUT", + ExpectURIPath: "/JsonIntEnums", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ + "integerEnum1": 1, + "integerEnum2": 2, + "integerEnum3": 3, + "integerEnumList": [ + 1, + 2, + 3 + ], + "integerEnumSet": [ + 1, + 2 + ], + "integerEnumMap": { + "abc": 1, + "def": 2 + } + }`)) + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + var actualReq *http.Request + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + actualReq = r.Clone(r.Context()) + if len(actualReq.URL.RawPath) == 0 { + actualReq.URL.RawPath = actualReq.URL.Path + } + if v := actualReq.ContentLength; v != 0 { + actualReq.Header.Set("Content-Length", strconv.FormatInt(v, 10)) + } + var buf bytes.Buffer + if _, err := io.Copy(&buf, r.Body); err != nil { + t.Errorf("failed to read request body, %v", err) + } + actualReq.Body = ioutil.NopCloser(&buf) + + w.WriteHeader(200) + })) + defer server.Close() + serverURL := server.URL + if c.Host != nil { + u, err := url.Parse(serverURL) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + u.Path = c.Host.Path + u.RawPath = c.Host.RawPath + u.RawQuery = c.Host.RawQuery + serverURL = u.String() + } + client := New(Options{ + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + HTTPClient: awshttp.NewBuildableClient(), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + result, err := client.JsonIntEnums(context.Background(), c.Params) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + if e, a := c.ExpectMethod, actualReq.Method; e != a { + t.Errorf("expect %v method, got %v", e, a) + } + if e, a := c.ExpectURIPath, actualReq.URL.RawPath; e != a { + t.Errorf("expect %v path, got %v", e, a) + } + queryItems := smithytesting.ParseRawQuery(actualReq.URL.RawQuery) + smithytesting.AssertHasQuery(t, c.ExpectQuery, queryItems) + smithytesting.AssertHasQueryKeys(t, c.RequireQuery, queryItems) + smithytesting.AssertNotHaveQueryKeys(t, c.ForbidQuery, queryItems) + smithytesting.AssertHasHeader(t, c.ExpectHeader, actualReq.Header) + smithytesting.AssertHasHeaderKeys(t, c.RequireHeader, actualReq.Header) + smithytesting.AssertNotHaveHeaderKeys(t, c.ForbidHeader, actualReq.Header) + if c.BodyAssert != nil { + if err := c.BodyAssert(actualReq.Body); err != nil { + t.Errorf("expect body equal, got %v", err) + } + } + }) + } +} + +func TestClient_JsonIntEnums_awsRestjson1Deserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *JsonIntEnumsOutput + }{ + // Serializes intEnums as integers + "RestJsonJsonIntEnums": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + Body: []byte(`{ + "integerEnum1": 1, + "integerEnum2": 2, + "integerEnum3": 3, + "integerEnumList": [ + 1, + 2, + 3 + ], + "integerEnumSet": [ + 1, + 2 + ], + "integerEnumMap": { + "abc": 1, + "def": 2 + } + }`), + ExpectResult: &JsonIntEnumsOutput{ + IntegerEnum1: 1, + IntegerEnum2: 2, + IntegerEnum3: 3, + IntegerEnumList: []types.IntegerEnum{ + 1, + 2, + 3, + }, + IntegerEnumSet: []types.IntegerEnum{ + 1, + 2, + }, + IntegerEnumMap: map[string]types.IntegerEnum{ + "abc": 1, + "def": 2, + }, + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params JsonIntEnumsInput + result, err := client.JsonIntEnums(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/awsrestjson/api_op_JsonLists.go b/internal/protocoltest/awsrestjson/api_op_JsonLists.go index e38626dbe5b..23c04548eb2 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonLists.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonLists.go @@ -42,6 +42,8 @@ type JsonListsInput struct { EnumList []types.FooEnum + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. @@ -65,6 +67,8 @@ type JsonListsOutput struct { EnumList []types.FooEnum + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. diff --git a/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go b/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go index feee63afd92..8efdcd5590f 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go @@ -70,6 +70,10 @@ func TestClient_JsonLists_awsRestjson1Serialize(t *testing.T) { types.FooEnum("Foo"), types.FooEnum("0"), }, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, NestedStringList: [][]string{ { "foo", @@ -124,6 +128,10 @@ func TestClient_JsonLists_awsRestjson1Serialize(t *testing.T) { "Foo", "0" ], + "intEnumList": [ + 1, + 2 + ], "nestedStringList": [ [ "foo", @@ -307,6 +315,10 @@ func TestClient_JsonLists_awsRestjson1Deserialize(t *testing.T) { "Foo", "0" ], + "intEnumList": [ + 1, + 2 + ], "nestedStringList": [ [ "foo", @@ -353,6 +365,10 @@ func TestClient_JsonLists_awsRestjson1Deserialize(t *testing.T) { types.FooEnum("Foo"), types.FooEnum("0"), }, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, NestedStringList: [][]string{ { "foo", diff --git a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go index f6addd5befc..55b7b541bc3 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go @@ -30,10 +30,16 @@ func (c *Client) JsonTimestamps(ctx context.Context, params *JsonTimestampsInput type JsonTimestampsInput struct { DateTime *time.Time + DateTimeOnTarget *time.Time + EpochSeconds *time.Time + EpochSecondsOnTarget *time.Time + HttpDate *time.Time + HttpDateOnTarget *time.Time + Normal *time.Time noSmithyDocumentSerde @@ -42,10 +48,16 @@ type JsonTimestampsInput struct { type JsonTimestampsOutput struct { DateTime *time.Time + DateTimeOnTarget *time.Time + EpochSeconds *time.Time + EpochSecondsOnTarget *time.Time + HttpDate *time.Time + HttpDateOnTarget *time.Time + Normal *time.Time // Metadata pertaining to the operation's result. diff --git a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go index 84f2eb63985..2992b1a02d9 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go @@ -77,6 +77,25 @@ func TestClient_JsonTimestamps_awsRestjson1Serialize(t *testing.T) { }`)) }, }, + // Ensures that the timestampFormat of date-time on the target shape works like + // normal timestamps + "RestJsonJsonTimestampsWithDateTimeOnTargetFormat": { + Params: &JsonTimestampsInput{ + DateTimeOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + ExpectMethod: "POST", + ExpectURIPath: "/JsonTimestamps", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ + "dateTimeOnTarget": "2014-04-29T18:30:38Z" + }`)) + }, + }, // Ensures that the timestampFormat of epoch-seconds works "RestJsonJsonTimestampsWithEpochSecondsFormat": { Params: &JsonTimestampsInput{ @@ -95,6 +114,24 @@ func TestClient_JsonTimestamps_awsRestjson1Serialize(t *testing.T) { }`)) }, }, + // Ensures that the timestampFormat of epoch-seconds on the target shape works + "RestJsonJsonTimestampsWithEpochSecondsOnTargetFormat": { + Params: &JsonTimestampsInput{ + EpochSecondsOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + ExpectMethod: "POST", + ExpectURIPath: "/JsonTimestamps", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ + "epochSecondsOnTarget": 1398796238 + }`)) + }, + }, // Ensures that the timestampFormat of http-date works "RestJsonJsonTimestampsWithHttpDateFormat": { Params: &JsonTimestampsInput{ @@ -113,6 +150,24 @@ func TestClient_JsonTimestamps_awsRestjson1Serialize(t *testing.T) { }`)) }, }, + // Ensures that the timestampFormat of http-date on the target shape works + "RestJsonJsonTimestampsWithHttpDateOnTargetFormat": { + Params: &JsonTimestampsInput{ + HttpDateOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + ExpectMethod: "POST", + ExpectURIPath: "/JsonTimestamps", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ + "httpDateOnTarget": "Tue, 29 Apr 2014 18:30:38 GMT" + }`)) + }, + }, } for name, c := range cases { t.Run(name, func(t *testing.T) { @@ -227,6 +282,21 @@ func TestClient_JsonTimestamps_awsRestjson1Deserialize(t *testing.T) { DateTime: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of date-time on the target shape works like + // normal timestamps + "RestJsonJsonTimestampsWithDateTimeOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + Body: []byte(`{ + "dateTimeOnTarget": "2014-04-29T18:30:38Z" + }`), + ExpectResult: &JsonTimestampsOutput{ + DateTimeOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of epoch-seconds works "RestJsonJsonTimestampsWithEpochSecondsFormat": { StatusCode: 200, @@ -241,6 +311,20 @@ func TestClient_JsonTimestamps_awsRestjson1Deserialize(t *testing.T) { EpochSeconds: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of epoch-seconds on the target shape works + "RestJsonJsonTimestampsWithEpochSecondsOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + Body: []byte(`{ + "epochSecondsOnTarget": 1398796238 + }`), + ExpectResult: &JsonTimestampsOutput{ + EpochSecondsOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of http-date works "RestJsonJsonTimestampsWithHttpDateFormat": { StatusCode: 200, @@ -255,6 +339,20 @@ func TestClient_JsonTimestamps_awsRestjson1Deserialize(t *testing.T) { HttpDate: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of http-date on the target shape works + "RestJsonJsonTimestampsWithHttpDateOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/json"}, + }, + BodyMediaType: "application/json", + Body: []byte(`{ + "httpDateOnTarget": "Tue, 29 Apr 2014 18:30:38 GMT" + }`), + ExpectResult: &JsonTimestampsOutput{ + HttpDateOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, } for name, c := range cases { t.Run(name, func(t *testing.T) { diff --git a/internal/protocoltest/awsrestjson/deserializers.go b/internal/protocoltest/awsrestjson/deserializers.go index b61d403564f..69b827cd1b1 100644 --- a/internal/protocoltest/awsrestjson/deserializers.go +++ b/internal/protocoltest/awsrestjson/deserializers.go @@ -284,6 +284,158 @@ func awsRestjson1_deserializeOpErrorConstantQueryString(response *smithyhttp.Res } } +type awsRestjson1_deserializeOpDatetimeOffsets struct { +} + +func (*awsRestjson1_deserializeOpDatetimeOffsets) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDatetimeOffsets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorDatetimeOffsets(response, &metadata) + } + output := &DatetimeOffsetsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentDatetimeOffsetsOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDatetimeOffsets(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDatetimeOffsetsOutput(v **DatetimeOffsetsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DatetimeOffsetsOutput + if *v == nil { + sv = &DatetimeOffsetsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "datetime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTime to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.Datetime = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpDocumentType struct { } @@ -2840,6 +2992,35 @@ func awsRestjson1_deserializeOpHttpBindingsInputAndOutputWithHeadersOutput(v *In v.HeaderInteger = ptr.Int32(int32(vv)) } + if headerValues := response.Header.Values("X-IntegerEnum"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + vv, err := strconv.ParseInt(headerValues[0], 0, 32) + if err != nil { + return err + } + v.HeaderIntegerEnum = int32(vv) + } + + if headerValues := response.Header.Values("X-IntegerEnumList"); len(headerValues) != 0 { + { + var err error + headerValues, err = smithyhttp.SplitHeaderListValues(headerValues) + if err != nil { + return err + } + } + var list []types.IntegerEnum + for _, headerValuesVal := range headerValues { + headerValuesVal = strings.TrimSpace(headerValuesVal) + vv, err := strconv.ParseInt(headerValuesVal, 0, 32) + if err != nil { + return err + } + list = append(list, int32(vv)) + } + v.HeaderIntegerEnumList = list + } + if headerValues := response.Header.Values("X-IntegerList"); len(headerValues) != 0 { { var err error @@ -3280,6 +3461,199 @@ func awsRestjson1_deserializeOpDocumentJsonEnumsOutput(v **JsonEnumsOutput, valu return nil } +type awsRestjson1_deserializeOpJsonIntEnums struct { +} + +func (*awsRestjson1_deserializeOpJsonIntEnums) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpJsonIntEnums) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorJsonIntEnums(response, &metadata) + } + output := &JsonIntEnumsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentJsonIntEnumsOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorJsonIntEnums(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentJsonIntEnumsOutput(v **JsonIntEnumsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *JsonIntEnumsOutput + if *v == nil { + sv = &JsonIntEnumsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "integerEnum1": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.IntegerEnum1 = int32(i64) + } + + case "integerEnum2": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.IntegerEnum2 = int32(i64) + } + + case "integerEnum3": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.IntegerEnum3 = int32(i64) + } + + case "integerEnumList": + if err := awsRestjson1_deserializeDocumentIntegerEnumList(&sv.IntegerEnumList, value); err != nil { + return err + } + + case "integerEnumMap": + if err := awsRestjson1_deserializeDocumentIntegerEnumMap(&sv.IntegerEnumMap, value); err != nil { + return err + } + + case "integerEnumSet": + if err := awsRestjson1_deserializeDocumentIntegerEnumSet(&sv.IntegerEnumSet, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpJsonLists struct { } @@ -3425,6 +3799,11 @@ func awsRestjson1_deserializeOpDocumentJsonListsOutput(v **JsonListsOutput, valu return err } + case "intEnumList": + if err := awsRestjson1_deserializeDocumentIntegerEnumList(&sv.IntEnumList, value); err != nil { + return err + } + case "nestedStringList": if err := awsRestjson1_deserializeDocumentNestedStringList(&sv.NestedStringList, value); err != nil { return err @@ -3796,6 +4175,19 @@ func awsRestjson1_deserializeOpDocumentJsonTimestampsOutput(v **JsonTimestampsOu sv.DateTime = ptr.Time(t) } + case "dateTimeOnTarget": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTime to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.DateTimeOnTarget = ptr.Time(t) + } + case "epochSeconds": if value != nil { switch jtv := value.(type) { @@ -3812,6 +4204,22 @@ func awsRestjson1_deserializeOpDocumentJsonTimestampsOutput(v **JsonTimestampsOu } } + case "epochSecondsOnTarget": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.EpochSecondsOnTarget = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected EpochSeconds to be a JSON Number, got %T instead", value) + + } + } + case "httpDate": if value != nil { jtv, ok := value.(string) @@ -3825,6 +4233,19 @@ func awsRestjson1_deserializeOpDocumentJsonTimestampsOutput(v **JsonTimestampsOu sv.HttpDate = ptr.Time(t) } + case "httpDateOnTarget": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HttpDate to be of type string, got %T instead", value) + } + t, err := smithytime.ParseHTTPDate(jtv) + if err != nil { + return err + } + sv.HttpDateOnTarget = ptr.Time(t) + } + case "normal": if value != nil { switch jtv := value.(type) { @@ -10915,6 +11336,126 @@ func awsRestjson1_deserializeDocumentGreetingStruct(v **types.GreetingStruct, va return nil } +func awsRestjson1_deserializeDocumentIntegerEnumList(v *[]types.IntegerEnum, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.IntegerEnum + if *v == nil { + cv = []types.IntegerEnum{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.IntegerEnum + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + col = int32(i64) + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentIntegerEnumMap(v *map[string]types.IntegerEnum, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]types.IntegerEnum + if *v == nil { + mv = map[string]types.IntegerEnum{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal types.IntegerEnum + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + parsedVal = int32(i64) + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentIntegerEnumSet(v *[]types.IntegerEnum, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.IntegerEnum + if *v == nil { + cv = []types.IntegerEnum{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.IntegerEnum + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + col = int32(i64) + } + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentIntegerList(v *[]int32, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/internal/protocoltest/awsrestjson/generated.json b/internal/protocoltest/awsrestjson/generated.json index 1b63c91cc63..c0a091b9798 100644 --- a/internal/protocoltest/awsrestjson/generated.json +++ b/internal/protocoltest/awsrestjson/generated.json @@ -15,6 +15,8 @@ "api_op_ConstantAndVariableQueryString_test.go", "api_op_ConstantQueryString.go", "api_op_ConstantQueryString_test.go", + "api_op_DatetimeOffsets.go", + "api_op_DatetimeOffsets_test.go", "api_op_DocumentType.go", "api_op_DocumentTypeAsPayload.go", "api_op_DocumentTypeAsPayload_test.go", @@ -65,6 +67,8 @@ "api_op_JsonBlobs_test.go", "api_op_JsonEnums.go", "api_op_JsonEnums_test.go", + "api_op_JsonIntEnums.go", + "api_op_JsonIntEnums_test.go", "api_op_JsonLists.go", "api_op_JsonLists_test.go", "api_op_JsonMaps.go", diff --git a/internal/protocoltest/awsrestjson/serializers.go b/internal/protocoltest/awsrestjson/serializers.go index f05338439be..d689447349c 100644 --- a/internal/protocoltest/awsrestjson/serializers.go +++ b/internal/protocoltest/awsrestjson/serializers.go @@ -112,6 +112,16 @@ func awsRestjson1_serializeOpHttpBindingsAllQueryStringTypesInput(v *AllQueryStr encoder.SetQuery("Integer").Integer(*v.QueryInteger) } + if v.QueryIntegerEnum != 0 { + encoder.SetQuery("IntegerEnum").Integer(v.QueryIntegerEnum) + } + + if v.QueryIntegerEnumList != nil { + for i := range v.QueryIntegerEnumList { + encoder.AddQuery("IntegerEnumList").Integer(v.QueryIntegerEnumList[i]) + } + } + if v.QueryIntegerList != nil { for i := range v.QueryIntegerList { encoder.AddQuery("IntegerList").Integer(v.QueryIntegerList[i]) @@ -287,6 +297,51 @@ func awsRestjson1_serializeOpHttpBindingsConstantQueryStringInput(v *ConstantQue return nil } +type awsRestjson1_serializeOpDatetimeOffsets struct { +} + +func (*awsRestjson1_serializeOpDatetimeOffsets) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDatetimeOffsets) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DatetimeOffsetsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/DatetimeOffsets") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsDatetimeOffsetsInput(v *DatetimeOffsetsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + type awsRestjson1_serializeOpDocumentType struct { } @@ -1776,6 +1831,20 @@ func awsRestjson1_serializeOpHttpBindingsInputAndOutputWithHeadersInput(v *Input encoder.SetHeader(locationName).Integer(*v.HeaderInteger) } + if v.HeaderIntegerEnum != 0 { + locationName := "X-Integerenum" + encoder.SetHeader(locationName).Integer(v.HeaderIntegerEnum) + } + + if v.HeaderIntegerEnumList != nil { + locationName := "X-Integerenumlist" + for i := range v.HeaderIntegerEnumList { + { + encoder.AddHeader(locationName).Integer(v.HeaderIntegerEnumList[i]) + } + } + } + if v.HeaderIntegerList != nil { locationName := "X-Integerlist" for i := range v.HeaderIntegerList { @@ -2012,6 +2081,105 @@ func awsRestjson1_serializeOpDocumentJsonEnumsInput(v *JsonEnumsInput, value smi return nil } +type awsRestjson1_serializeOpJsonIntEnums struct { +} + +func (*awsRestjson1_serializeOpJsonIntEnums) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpJsonIntEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*JsonIntEnumsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/JsonIntEnums") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentJsonIntEnumsInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsJsonIntEnumsInput(v *JsonIntEnumsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentJsonIntEnumsInput(v *JsonIntEnumsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.IntegerEnum1 != 0 { + ok := object.Key("integerEnum1") + ok.Integer(v.IntegerEnum1) + } + + if v.IntegerEnum2 != 0 { + ok := object.Key("integerEnum2") + ok.Integer(v.IntegerEnum2) + } + + if v.IntegerEnum3 != 0 { + ok := object.Key("integerEnum3") + ok.Integer(v.IntegerEnum3) + } + + if v.IntegerEnumList != nil { + ok := object.Key("integerEnumList") + if err := awsRestjson1_serializeDocumentIntegerEnumList(v.IntegerEnumList, ok); err != nil { + return err + } + } + + if v.IntegerEnumMap != nil { + ok := object.Key("integerEnumMap") + if err := awsRestjson1_serializeDocumentIntegerEnumMap(v.IntegerEnumMap, ok); err != nil { + return err + } + } + + if v.IntegerEnumSet != nil { + ok := object.Key("integerEnumSet") + if err := awsRestjson1_serializeDocumentIntegerEnumSet(v.IntegerEnumSet, ok); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpJsonLists struct { } @@ -2093,6 +2261,13 @@ func awsRestjson1_serializeOpDocumentJsonListsInput(v *JsonListsInput, value smi } } + if v.IntEnumList != nil { + ok := object.Key("intEnumList") + if err := awsRestjson1_serializeDocumentIntegerEnumList(v.IntEnumList, ok); err != nil { + return err + } + } + if v.NestedStringList != nil { ok := object.Key("nestedStringList") if err := awsRestjson1_serializeDocumentNestedStringList(v.NestedStringList, ok); err != nil { @@ -2336,16 +2511,31 @@ func awsRestjson1_serializeOpDocumentJsonTimestampsInput(v *JsonTimestampsInput, ok.String(smithytime.FormatDateTime(*v.DateTime)) } + if v.DateTimeOnTarget != nil { + ok := object.Key("dateTimeOnTarget") + ok.String(smithytime.FormatDateTime(*v.DateTimeOnTarget)) + } + if v.EpochSeconds != nil { ok := object.Key("epochSeconds") ok.Double(smithytime.FormatEpochSeconds(*v.EpochSeconds)) } + if v.EpochSecondsOnTarget != nil { + ok := object.Key("epochSecondsOnTarget") + ok.Double(smithytime.FormatEpochSeconds(*v.EpochSecondsOnTarget)) + } + if v.HttpDate != nil { ok := object.Key("httpDate") ok.String(smithytime.FormatHTTPDate(*v.HttpDate)) } + if v.HttpDateOnTarget != nil { + ok := object.Key("httpDateOnTarget") + ok.String(smithytime.FormatHTTPDate(*v.HttpDateOnTarget)) + } + if v.Normal != nil { ok := object.Key("normal") ok.Double(smithytime.FormatEpochSeconds(*v.Normal)) @@ -6509,6 +6699,39 @@ func awsRestjson1_serializeDocumentGreetingStruct(v *types.GreetingStruct, value return nil } +func awsRestjson1_serializeDocumentIntegerEnumList(v []types.IntegerEnum, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.Integer(v[i]) + } + return nil +} + +func awsRestjson1_serializeDocumentIntegerEnumMap(v map[string]types.IntegerEnum, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + for key := range v { + om := object.Key(key) + om.Integer(v[key]) + } + return nil +} + +func awsRestjson1_serializeDocumentIntegerEnumSet(v []types.IntegerEnum, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.Integer(v[i]) + } + return nil +} + func awsRestjson1_serializeDocumentIntegerList(v []int32, value smithyjson.Value) error { array := value.Array() defer array.Close() diff --git a/internal/protocoltest/awsrestjson/types/enums.go b/internal/protocoltest/awsrestjson/types/enums.go index f0e5fd9bd56..a9a2312d5b7 100644 --- a/internal/protocoltest/awsrestjson/types/enums.go +++ b/internal/protocoltest/awsrestjson/types/enums.go @@ -41,3 +41,12 @@ func (FooEnum) Values() []FooEnum { "0", } } + +type IntegerEnum = int32 + +// Enum values for IntegerEnum +const ( + IntegerEnumA IntegerEnum = 1 + IntegerEnumB IntegerEnum = 2 + IntegerEnumC IntegerEnum = 3 +) diff --git a/internal/protocoltest/ec2query/api_op_DatetimeOffsets.go b/internal/protocoltest/ec2query/api_op_DatetimeOffsets.go new file mode 100644 index 00000000000..6c4284da381 --- /dev/null +++ b/internal/protocoltest/ec2query/api_op_DatetimeOffsets.go @@ -0,0 +1,101 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ec2query + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +func (c *Client) DatetimeOffsets(ctx context.Context, params *DatetimeOffsetsInput, optFns ...func(*Options)) (*DatetimeOffsetsOutput, error) { + if params == nil { + params = &DatetimeOffsetsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DatetimeOffsets", params, optFns, c.addOperationDatetimeOffsetsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DatetimeOffsetsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DatetimeOffsetsInput struct { + noSmithyDocumentSerde +} + +type DatetimeOffsetsOutput struct { + Datetime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDatetimeOffsetsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsEc2query_serializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsEc2query_deserializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDatetimeOffsets(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDatetimeOffsets(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DatetimeOffsets", + } +} diff --git a/internal/protocoltest/ec2query/api_op_DatetimeOffsets_test.go b/internal/protocoltest/ec2query/api_op_DatetimeOffsets_test.go new file mode 100644 index 00000000000..fe755613cb5 --- /dev/null +++ b/internal/protocoltest/ec2query/api_op_DatetimeOffsets_test.go @@ -0,0 +1,133 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ec2query + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io/ioutil" + "math" + "net/http" + "testing" +) + +func TestClient_DatetimeOffsets_awsEc2queryDeserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *DatetimeOffsetsOutput + }{ + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "Ec2QueryDateTimeWithNegativeOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml;charset=UTF-8"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 2019-12-16T22:48:18-01:00 + requestid + + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "Ec2QueryDateTimeWithPositiveOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml;charset=UTF-8"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 2019-12-17T00:48:18+01:00 + requestid + + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params DatetimeOffsetsInput + result, err := client.DatetimeOffsets(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/ec2query/api_op_QueryLists_test.go b/internal/protocoltest/ec2query/api_op_QueryLists_test.go index 74eea31327b..dfb16f873be 100644 --- a/internal/protocoltest/ec2query/api_op_QueryLists_test.go +++ b/internal/protocoltest/ec2query/api_op_QueryLists_test.go @@ -64,7 +64,7 @@ func TestClient_QueryLists_awsEc2querySerialize(t *testing.T) { return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=QueryLists&Version=2020-01-08&ListArg.1=foo&ListArg.2=bar&ListArg.3=baz&ComplexListArg.1.Hi=hello&ComplexListArg.2.Hi=hola`)) }, }, - // Does not serialize empty query lists + // Serializes empty query lists "Ec2EmptyQueryLists": { Params: &QueryListsInput{ ListArg: []string{}, @@ -77,7 +77,7 @@ func TestClient_QueryLists_awsEc2querySerialize(t *testing.T) { }, BodyMediaType: "application/x-www-form-urlencoded", BodyAssert: func(actual io.Reader) error { - return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=QueryLists&Version=2020-01-08`)) + return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=QueryLists&Version=2020-01-08&ListArg=`)) }, }, // An xmlName trait in the member of a list has no effect on the list diff --git a/internal/protocoltest/ec2query/api_op_XmlEmptyLists.go b/internal/protocoltest/ec2query/api_op_XmlEmptyLists.go index 95b72d2dbba..1662e0b5d0e 100644 --- a/internal/protocoltest/ec2query/api_op_XmlEmptyLists.go +++ b/internal/protocoltest/ec2query/api_op_XmlEmptyLists.go @@ -43,6 +43,8 @@ type XmlEmptyListsOutput struct { FlattenedListWithNamespace []string + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. diff --git a/internal/protocoltest/ec2query/api_op_XmlIntEnums.go b/internal/protocoltest/ec2query/api_op_XmlIntEnums.go new file mode 100644 index 00000000000..792043b611f --- /dev/null +++ b/internal/protocoltest/ec2query/api_op_XmlIntEnums.go @@ -0,0 +1,113 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ec2query + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/ec2query/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This example serializes intEnums as top level properties, in lists, sets, and +// maps. +func (c *Client) XmlIntEnums(ctx context.Context, params *XmlIntEnumsInput, optFns ...func(*Options)) (*XmlIntEnumsOutput, error) { + if params == nil { + params = &XmlIntEnumsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "XmlIntEnums", params, optFns, c.addOperationXmlIntEnumsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*XmlIntEnumsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type XmlIntEnumsInput struct { + noSmithyDocumentSerde +} + +type XmlIntEnumsOutput struct { + IntEnum1 types.IntegerEnum + + IntEnum2 types.IntegerEnum + + IntEnum3 types.IntegerEnum + + IntEnumList []types.IntegerEnum + + IntEnumMap map[string]types.IntegerEnum + + IntEnumSet []types.IntegerEnum + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationXmlIntEnumsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsEc2query_serializeOpXmlIntEnums{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsEc2query_deserializeOpXmlIntEnums{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opXmlIntEnums(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opXmlIntEnums(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "XmlIntEnums", + } +} diff --git a/internal/protocoltest/ec2query/api_op_XmlIntEnums_test.go b/internal/protocoltest/ec2query/api_op_XmlIntEnums_test.go new file mode 100644 index 00000000000..cc49246138c --- /dev/null +++ b/internal/protocoltest/ec2query/api_op_XmlIntEnums_test.go @@ -0,0 +1,150 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package ec2query + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/ec2query/types" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io/ioutil" + "math" + "net/http" + "testing" +) + +func TestClient_XmlIntEnums_awsEc2queryDeserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *XmlIntEnumsOutput + }{ + // Serializes simple scalar properties + "Ec2XmlIntEnums": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml;charset=UTF-8"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 1 + 2 + 3 + + 1 + 2 + + + 1 + 2 + + + + a + 1 + + + b + 2 + + + requestid + + `), + ExpectResult: &XmlIntEnumsOutput{ + IntEnum1: 1, + IntEnum2: 2, + IntEnum3: 3, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumSet: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumMap: map[string]types.IntegerEnum{ + "a": 1, + "b": 2, + }, + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params XmlIntEnumsInput + result, err := client.XmlIntEnums(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/ec2query/api_op_XmlLists.go b/internal/protocoltest/ec2query/api_op_XmlLists.go index c185bf8bb2e..ed72d427445 100644 --- a/internal/protocoltest/ec2query/api_op_XmlLists.go +++ b/internal/protocoltest/ec2query/api_op_XmlLists.go @@ -64,6 +64,8 @@ type XmlListsOutput struct { FlattenedListWithNamespace []string + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. diff --git a/internal/protocoltest/ec2query/api_op_XmlLists_test.go b/internal/protocoltest/ec2query/api_op_XmlLists_test.go index 23afca97165..297b88fc355 100644 --- a/internal/protocoltest/ec2query/api_op_XmlLists_test.go +++ b/internal/protocoltest/ec2query/api_op_XmlLists_test.go @@ -63,6 +63,10 @@ func TestClient_XmlLists_awsEc2queryDeserialize(t *testing.T) { Foo 0 + + 1 + 2 + foo @@ -123,6 +127,10 @@ func TestClient_XmlLists_awsEc2queryDeserialize(t *testing.T) { types.FooEnum("Foo"), types.FooEnum("0"), }, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, NestedStringList: [][]string{ { "foo", diff --git a/internal/protocoltest/ec2query/api_op_XmlTimestamps.go b/internal/protocoltest/ec2query/api_op_XmlTimestamps.go index 4b79b8490c2..ed573d10038 100644 --- a/internal/protocoltest/ec2query/api_op_XmlTimestamps.go +++ b/internal/protocoltest/ec2query/api_op_XmlTimestamps.go @@ -34,10 +34,16 @@ type XmlTimestampsInput struct { type XmlTimestampsOutput struct { DateTime *time.Time + DateTimeOnTarget *time.Time + EpochSeconds *time.Time + EpochSecondsOnTarget *time.Time + HttpDate *time.Time + HttpDateOnTarget *time.Time + Normal *time.Time // Metadata pertaining to the operation's result. diff --git a/internal/protocoltest/ec2query/api_op_XmlTimestamps_test.go b/internal/protocoltest/ec2query/api_op_XmlTimestamps_test.go index cda29ac8f21..d7fccfdf202 100644 --- a/internal/protocoltest/ec2query/api_op_XmlTimestamps_test.go +++ b/internal/protocoltest/ec2query/api_op_XmlTimestamps_test.go @@ -61,6 +61,23 @@ func TestClient_XmlTimestamps_awsEc2queryDeserialize(t *testing.T) { DateTime: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of date-time on the target shape works like + // normal timestamps + "Ec2XmlTimestampsWithDateTimeOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml;charset=UTF-8"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 2014-04-29T18:30:38Z + requestid + + `), + ExpectResult: &XmlTimestampsOutput{ + DateTimeOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of epoch-seconds works "Ec2XmlTimestampsWithEpochSecondsFormat": { StatusCode: 200, @@ -77,6 +94,22 @@ func TestClient_XmlTimestamps_awsEc2queryDeserialize(t *testing.T) { EpochSeconds: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of epoch-seconds on the target shape works + "Ec2XmlTimestampsWithEpochSecondsOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml;charset=UTF-8"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 1398796238 + requestid + + `), + ExpectResult: &XmlTimestampsOutput{ + EpochSecondsOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of http-date works "Ec2XmlTimestampsWithHttpDateFormat": { StatusCode: 200, @@ -93,6 +126,22 @@ func TestClient_XmlTimestamps_awsEc2queryDeserialize(t *testing.T) { HttpDate: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of http-date on the target shape works + "Ec2XmlTimestampsWithHttpDateOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml;charset=UTF-8"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + Tue, 29 Apr 2014 18:30:38 GMT + requestid + + `), + ExpectResult: &XmlTimestampsOutput{ + HttpDateOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, } for name, c := range cases { t.Run(name, func(t *testing.T) { diff --git a/internal/protocoltest/ec2query/deserializers.go b/internal/protocoltest/ec2query/deserializers.go index cc9dd18902f..826110efa26 100644 --- a/internal/protocoltest/ec2query/deserializers.go +++ b/internal/protocoltest/ec2query/deserializers.go @@ -25,6 +25,97 @@ import ( "time" ) +type awsEc2query_deserializeOpDatetimeOffsets struct { +} + +func (*awsEc2query_deserializeOpDatetimeOffsets) ID() string { + return "OperationDeserializer" +} + +func (m *awsEc2query_deserializeOpDatetimeOffsets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsEc2query_deserializeOpErrorDatetimeOffsets(response, &metadata) + } + output := &DatetimeOffsetsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + body := io.TeeReader(response.Body, ringBuffer) + rootDecoder := xml.NewDecoder(body) + t, err := smithyxml.FetchRootElement(rootDecoder) + if err == io.EOF { + return out, metadata, nil + } + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) + err = awsEc2query_deserializeOpDocumentDatetimeOffsetsOutput(&output, decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsEc2query_deserializeOpErrorDatetimeOffsets(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + errorComponents, err := ec2query.GetErrorResponseComponents(errorBody) + if err != nil { + return err + } + awsmiddleware.SetRequestIDMetadata(metadata, errorComponents.RequestID) + if len(errorComponents.Code) != 0 { + errorCode = errorComponents.Code + } + if len(errorComponents.Message) != 0 { + errorMessage = errorComponents.Message + } + errorBody.Seek(0, io.SeekStart) + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsEc2query_deserializeOpEmptyInputAndEmptyOutput struct { } @@ -1485,6 +1576,97 @@ func awsEc2query_deserializeOpErrorXmlEnums(response *smithyhttp.Response, metad } } +type awsEc2query_deserializeOpXmlIntEnums struct { +} + +func (*awsEc2query_deserializeOpXmlIntEnums) ID() string { + return "OperationDeserializer" +} + +func (m *awsEc2query_deserializeOpXmlIntEnums) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsEc2query_deserializeOpErrorXmlIntEnums(response, &metadata) + } + output := &XmlIntEnumsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + body := io.TeeReader(response.Body, ringBuffer) + rootDecoder := xml.NewDecoder(body) + t, err := smithyxml.FetchRootElement(rootDecoder) + if err == io.EOF { + return out, metadata, nil + } + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) + err = awsEc2query_deserializeOpDocumentXmlIntEnumsOutput(&output, decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsEc2query_deserializeOpErrorXmlIntEnums(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + errorComponents, err := ec2query.GetErrorResponseComponents(errorBody) + if err != nil { + return err + } + awsmiddleware.SetRequestIDMetadata(metadata, errorComponents.RequestID) + if len(errorComponents.Code) != 0 { + errorCode = errorComponents.Code + } + if len(errorComponents.Message) != 0 { + errorMessage = errorComponents.Message + } + errorBody.Seek(0, io.SeekStart) + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsEc2query_deserializeOpXmlLists struct { } @@ -2980,13 +3162,13 @@ func awsEc2query_deserializeDocumentFooEnumSetUnwrapped(v *[]types.FooEnum, deco *v = sv return nil } -func awsEc2query_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.NodeDecoder) error { +func awsEc2query_deserializeDocumentIntegerEnumList(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } - var sv []int32 + var sv []types.IntegerEnum if *v == nil { - sv = make([]int32, 0) + sv = make([]types.IntegerEnum, 0) } else { sv = *v } @@ -3004,7 +3186,7 @@ func awsEc2query_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.No decoder = memberDecoder switch { case strings.EqualFold("member", t.Name.Local): - var col int32 + var col types.IntegerEnum val, err := decoder.Value() if err != nil { return err @@ -3035,17 +3217,17 @@ func awsEc2query_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.No return nil } -func awsEc2query_deserializeDocumentIntegerListUnwrapped(v *[]int32, decoder smithyxml.NodeDecoder) error { - var sv []int32 +func awsEc2query_deserializeDocumentIntegerEnumListUnwrapped(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv []types.IntegerEnum if *v == nil { - sv = make([]int32, 0) + sv = make([]types.IntegerEnum, 0) } else { sv = *v } switch { default: - var mv int32 + var mv types.IntegerEnum t := decoder.StartEl _ = t val, err := decoder.Value() @@ -3068,18 +3250,17 @@ func awsEc2query_deserializeDocumentIntegerListUnwrapped(v *[]int32, decoder smi *v = sv return nil } -func awsEc2query_deserializeDocumentNestedStringList(v *[][]string, decoder smithyxml.NodeDecoder) error { +func awsEc2query_deserializeDocumentIntegerEnumMap(v *map[string]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } - var sv [][]string + var sv map[string]types.IntegerEnum if *v == nil { - sv = make([][]string, 0) + sv = make(map[string]types.IntegerEnum, 0) } else { sv = *v } - originalDecoder := decoder for { t, done, err := decoder.Token() if err != nil { @@ -3089,13 +3270,11 @@ func awsEc2query_deserializeDocumentNestedStringList(v *[][]string, decoder smit break } switch { - case strings.EqualFold("member", t.Name.Local): - var col []string - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsEc2query_deserializeDocumentStringList(&col, nodeDecoder); err != nil { + case strings.EqualFold("entry", t.Name.Local): + entryDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentIntegerEnumMapUnwrapped(&sv, entryDecoder); err != nil { return err } - sv = append(sv, col) default: err = decoder.Decoder.Skip() @@ -3104,59 +3283,34 @@ func awsEc2query_deserializeDocumentNestedStringList(v *[][]string, decoder smit } } - decoder = originalDecoder } *v = sv return nil } -func awsEc2query_deserializeDocumentNestedStringListUnwrapped(v *[][]string, decoder smithyxml.NodeDecoder) error { - var sv [][]string - if *v == nil { - sv = make([][]string, 0) - } else { - sv = *v - } - - switch { - default: - var mv []string - t := decoder.StartEl - _ = t - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsEc2query_deserializeDocumentStringList(&mv, nodeDecoder); err != nil { - return err - } - sv = append(sv, mv) - } - *v = sv - return nil -} -func awsEc2query_deserializeDocumentStringList(v *[]string, decoder smithyxml.NodeDecoder) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - var sv []string +func awsEc2query_deserializeDocumentIntegerEnumMapUnwrapped(v *map[string]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv map[string]types.IntegerEnum if *v == nil { - sv = make([]string, 0) + sv = make(map[string]types.IntegerEnum, 0) } else { sv = *v } - originalDecoder := decoder + var ek string + var ev types.IntegerEnum for { t, done, err := decoder.Token() if err != nil { return err } if done { + sv[ek] = ev break } - memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - decoder = memberDecoder + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) switch { - case strings.EqualFold("member", t.Name.Local): - var col string + case strings.EqualFold("key", t.Name.Local): val, err := decoder.Value() if err != nil { return err @@ -3166,9 +3320,25 @@ func awsEc2query_deserializeDocumentStringList(v *[]string, decoder smithyxml.No } { xtv := string(val) - col = xtv + ek = xtv + } + + case strings.EqualFold("value", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + ev = int32(i64) } - sv = append(sv, col) default: err = decoder.Decoder.Skip() @@ -3182,19 +3352,309 @@ func awsEc2query_deserializeDocumentStringList(v *[]string, decoder smithyxml.No *v = sv return nil } - -func awsEc2query_deserializeDocumentStringListUnwrapped(v *[]string, decoder smithyxml.NodeDecoder) error { - var sv []string +func awsEc2query_deserializeDocumentIntegerEnumSet(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []types.IntegerEnum if *v == nil { - sv = make([]string, 0) + sv = make([]types.IntegerEnum, 0) } else { sv = *v } - switch { - default: - var mv string - t := decoder.StartEl + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col types.IntegerEnum + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + col = int32(i64) + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsEc2query_deserializeDocumentIntegerEnumSetUnwrapped(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv []types.IntegerEnum + if *v == nil { + sv = make([]types.IntegerEnum, 0) + } else { + sv = *v + } + + switch { + default: + var mv types.IntegerEnum + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + mv = int32(i64) + } + sv = append(sv, mv) + } + *v = sv + return nil +} +func awsEc2query_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []int32 + if *v == nil { + sv = make([]int32, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col int32 + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + col = int32(i64) + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsEc2query_deserializeDocumentIntegerListUnwrapped(v *[]int32, decoder smithyxml.NodeDecoder) error { + var sv []int32 + if *v == nil { + sv = make([]int32, 0) + } else { + sv = *v + } + + switch { + default: + var mv int32 + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + mv = int32(i64) + } + sv = append(sv, mv) + } + *v = sv + return nil +} +func awsEc2query_deserializeDocumentNestedStringList(v *[][]string, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv [][]string + if *v == nil { + sv = make([][]string, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + switch { + case strings.EqualFold("member", t.Name.Local): + var col []string + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentStringList(&col, nodeDecoder); err != nil { + return err + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsEc2query_deserializeDocumentNestedStringListUnwrapped(v *[][]string, decoder smithyxml.NodeDecoder) error { + var sv [][]string + if *v == nil { + sv = make([][]string, 0) + } else { + sv = *v + } + + switch { + default: + var mv []string + t := decoder.StartEl + _ = t + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentStringList(&mv, nodeDecoder); err != nil { + return err + } + sv = append(sv, mv) + } + *v = sv + return nil +} +func awsEc2query_deserializeDocumentStringList(v *[]string, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []string + if *v == nil { + sv = make([]string, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col string + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + col = xtv + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsEc2query_deserializeDocumentStringListUnwrapped(v *[]string, decoder smithyxml.NodeDecoder) error { + var sv []string + if *v == nil { + sv = make([]string, 0) + } else { + sv = *v + } + + switch { + default: + var mv string + t := decoder.StartEl _ = t val, err := decoder.Value() if err != nil { @@ -3380,6 +3840,59 @@ func awsEc2query_deserializeDocumentTimestampListUnwrapped(v *[]time.Time, decod *v = sv return nil } +func awsEc2query_deserializeOpDocumentDatetimeOffsetsOutput(v **DatetimeOffsetsOutput, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *DatetimeOffsetsOutput + if *v == nil { + sv = &DatetimeOffsetsOutput{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("datetime", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseDateTime(xtv) + if err != nil { + return err + } + sv.Datetime = ptr.Time(t) + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + func awsEc2query_deserializeOpDocumentEmptyInputAndEmptyOutputOutput(v **EmptyInputAndEmptyOutputOutput, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -3960,6 +4473,12 @@ func awsEc2query_deserializeOpDocumentXmlEmptyListsOutput(v **XmlEmptyListsOutpu return err } + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + case strings.EqualFold("nestedStringList", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) if err := awsEc2query_deserializeDocumentNestedStringList(&sv.NestedStringList, nodeDecoder); err != nil { @@ -4103,6 +4622,111 @@ func awsEc2query_deserializeOpDocumentXmlEnumsOutput(v **XmlEnumsOutput, decoder return nil } +func awsEc2query_deserializeOpDocumentXmlIntEnumsOutput(v **XmlIntEnumsOutput, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *XmlIntEnumsOutput + if *v == nil { + sv = &XmlIntEnumsOutput{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("intEnum1", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum1 = int32(i64) + } + + case strings.EqualFold("intEnum2", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum2 = int32(i64) + } + + case strings.EqualFold("intEnum3", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum3 = int32(i64) + } + + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("intEnumMap", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentIntegerEnumMap(&sv.IntEnumMap, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("intEnumSet", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentIntegerEnumSet(&sv.IntEnumSet, nodeDecoder); err != nil { + return err + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + func awsEc2query_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -4167,6 +4791,12 @@ func awsEc2query_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder return err } + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsEc2query_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + case strings.EqualFold("nestedStringList", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) if err := awsEc2query_deserializeDocumentNestedStringList(&sv.NestedStringList, nodeDecoder); err != nil { @@ -4298,6 +4928,23 @@ func awsEc2query_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutpu sv.DateTime = ptr.Time(t) } + case strings.EqualFold("dateTimeOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseDateTime(xtv) + if err != nil { + return err + } + sv.DateTimeOnTarget = ptr.Time(t) + } + case strings.EqualFold("epochSeconds", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -4315,6 +4962,23 @@ func awsEc2query_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutpu sv.EpochSeconds = ptr.Time(smithytime.ParseEpochSeconds(f64)) } + case strings.EqualFold("epochSecondsOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + f64, err := strconv.ParseFloat(xtv, 64) + if err != nil { + return err + } + sv.EpochSecondsOnTarget = ptr.Time(smithytime.ParseEpochSeconds(f64)) + } + case strings.EqualFold("httpDate", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -4332,6 +4996,23 @@ func awsEc2query_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutpu sv.HttpDate = ptr.Time(t) } + case strings.EqualFold("httpDateOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseHTTPDate(xtv) + if err != nil { + return err + } + sv.HttpDateOnTarget = ptr.Time(t) + } + case strings.EqualFold("normal", t.Name.Local): val, err := decoder.Value() if err != nil { diff --git a/internal/protocoltest/ec2query/generated.json b/internal/protocoltest/ec2query/generated.json index c5ee7564b7b..24f9088a43a 100644 --- a/internal/protocoltest/ec2query/generated.json +++ b/internal/protocoltest/ec2query/generated.json @@ -9,6 +9,8 @@ "files": [ "api_client.go", "api_client_test.go", + "api_op_DatetimeOffsets.go", + "api_op_DatetimeOffsets_test.go", "api_op_EmptyInputAndEmptyOutput.go", "api_op_EmptyInputAndEmptyOutput_test.go", "api_op_EndpointOperation.go", @@ -45,6 +47,8 @@ "api_op_XmlEmptyLists_test.go", "api_op_XmlEnums.go", "api_op_XmlEnums_test.go", + "api_op_XmlIntEnums.go", + "api_op_XmlIntEnums_test.go", "api_op_XmlLists.go", "api_op_XmlLists_test.go", "api_op_XmlNamespaces.go", diff --git a/internal/protocoltest/ec2query/serializers.go b/internal/protocoltest/ec2query/serializers.go index 060f24b64e9..7937158a09b 100644 --- a/internal/protocoltest/ec2query/serializers.go +++ b/internal/protocoltest/ec2query/serializers.go @@ -17,6 +17,66 @@ import ( "path" ) +type awsEc2query_serializeOpDatetimeOffsets struct { +} + +func (*awsEc2query_serializeOpDatetimeOffsets) ID() string { + return "OperationSerializer" +} + +func (m *awsEc2query_serializeOpDatetimeOffsets) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DatetimeOffsetsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-www-form-urlencoded") + + bodyWriter := bytes.NewBuffer(nil) + bodyEncoder := query.NewEncoder(bodyWriter) + body := bodyEncoder.Object() + body.Key("Action").String("DatetimeOffsets") + body.Key("Version").String("2020-01-08") + + err = bodyEncoder.Encode() + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(bodyWriter.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsEc2query_serializeOpEmptyInputAndEmptyOutput struct { } @@ -1121,6 +1181,66 @@ func (m *awsEc2query_serializeOpXmlEnums) HandleSerialize(ctx context.Context, i return next.HandleSerialize(ctx, in) } +type awsEc2query_serializeOpXmlIntEnums struct { +} + +func (*awsEc2query_serializeOpXmlIntEnums) ID() string { + return "OperationSerializer" +} + +func (m *awsEc2query_serializeOpXmlIntEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*XmlIntEnumsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-www-form-urlencoded") + + bodyWriter := bytes.NewBuffer(nil) + bodyEncoder := query.NewEncoder(bodyWriter) + body := bodyEncoder.Object() + body.Key("Action").String("XmlIntEnums") + body.Key("Version").String("2020-01-08") + + err = bodyEncoder.Encode() + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(bodyWriter.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsEc2query_serializeOpXmlLists struct { } @@ -1301,9 +1421,6 @@ func (m *awsEc2query_serializeOpXmlTimestamps) HandleSerialize(ctx context.Conte return next.HandleSerialize(ctx, in) } func awsEc2query_serializeDocumentListWithXmlName(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -1352,9 +1469,6 @@ func awsEc2query_serializeDocumentStructArg(v *types.StructArg, value query.Valu } func awsEc2query_serializeDocumentGreetingList(v []types.GreetingStruct, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -1379,9 +1493,6 @@ func awsEc2query_serializeDocumentGreetingStruct(v *types.GreetingStruct, value } func awsEc2query_serializeDocumentStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { diff --git a/internal/protocoltest/ec2query/types/enums.go b/internal/protocoltest/ec2query/types/enums.go index a0088b218b8..6652e863c7a 100644 --- a/internal/protocoltest/ec2query/types/enums.go +++ b/internal/protocoltest/ec2query/types/enums.go @@ -25,3 +25,12 @@ func (FooEnum) Values() []FooEnum { "0", } } + +type IntegerEnum = int32 + +// Enum values for IntegerEnum +const ( + IntegerEnumA IntegerEnum = 1 + IntegerEnumB IntegerEnum = 2 + IntegerEnumC IntegerEnum = 3 +) diff --git a/internal/protocoltest/jsonrpc/api_op_DatetimeOffsets.go b/internal/protocoltest/jsonrpc/api_op_DatetimeOffsets.go new file mode 100644 index 00000000000..f90d9823076 --- /dev/null +++ b/internal/protocoltest/jsonrpc/api_op_DatetimeOffsets.go @@ -0,0 +1,109 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package jsonrpc + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +func (c *Client) DatetimeOffsets(ctx context.Context, params *DatetimeOffsetsInput, optFns ...func(*Options)) (*DatetimeOffsetsOutput, error) { + if params == nil { + params = &DatetimeOffsetsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DatetimeOffsets", params, optFns, c.addOperationDatetimeOffsetsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DatetimeOffsetsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DatetimeOffsetsInput struct { + noSmithyDocumentSerde +} + +type DatetimeOffsetsOutput struct { + Datetime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDatetimeOffsetsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsAwsjson11_serializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDatetimeOffsets(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDatetimeOffsets(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "foo", + OperationName: "DatetimeOffsets", + } +} diff --git a/internal/protocoltest/jsonrpc/api_op_DatetimeOffsets_test.go b/internal/protocoltest/jsonrpc/api_op_DatetimeOffsets_test.go new file mode 100644 index 00000000000..35ce3bef356 --- /dev/null +++ b/internal/protocoltest/jsonrpc/api_op_DatetimeOffsets_test.go @@ -0,0 +1,129 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package jsonrpc + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithytesting "github.com/aws/smithy-go/testing" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io/ioutil" + "math" + "net/http" + "testing" +) + +func TestClient_DatetimeOffsets_awsAwsjson11Deserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *DatetimeOffsetsOutput + }{ + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "AwsJson11DateTimeWithNegativeOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + BodyMediaType: "application/json", + Body: []byte(` { + "datetime": "2019-12-16T22:48:18-01:00" + } + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "AwsJson11DateTimeWithPositiveOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + BodyMediaType: "application/json", + Body: []byte(` { + "datetime": "2019-12-17T00:48:18+01:00" + } + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + Region: "us-west-2", + }) + var params DatetimeOffsetsInput + result, err := client.DatetimeOffsets(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go b/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go index 9b7764bbc1b..aa3c159cbf5 100644 --- a/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go @@ -44,6 +44,10 @@ func TestClient_EmptyOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.EmptyOperation"}, + }, }, // Includes X-Amz-Target header and Content-Type "includes_x_amz_target_and_content_type": { @@ -67,6 +71,7 @@ func TestClient_EmptyOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.EmptyOperation"}, }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { diff --git a/internal/protocoltest/jsonrpc/api_op_EndpointOperation_test.go b/internal/protocoltest/jsonrpc/api_op_EndpointOperation_test.go index fe9a29ac02e..bd3a08e3dc3 100644 --- a/internal/protocoltest/jsonrpc/api_op_EndpointOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_EndpointOperation_test.go @@ -39,6 +39,10 @@ func TestClient_EndpointOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.EndpointOperation"}, + }, Host: func() *url.URL { host := "https://example.com" if len(host) == 0 { diff --git a/internal/protocoltest/jsonrpc/api_op_EndpointWithHostLabelOperation_test.go b/internal/protocoltest/jsonrpc/api_op_EndpointWithHostLabelOperation_test.go index 94e7fb4642f..afa13c934a5 100644 --- a/internal/protocoltest/jsonrpc/api_op_EndpointWithHostLabelOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_EndpointWithHostLabelOperation_test.go @@ -44,6 +44,10 @@ func TestClient_EndpointWithHostLabelOperation_awsAwsjson11Serialize(t *testing. ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.EndpointWithHostLabelOperation"}, + }, Host: func() *url.URL { host := "https://example.com" if len(host) == 0 { diff --git a/internal/protocoltest/jsonrpc/api_op_HostWithPathOperation_test.go b/internal/protocoltest/jsonrpc/api_op_HostWithPathOperation_test.go index 1f35a44da29..f1f6851ca53 100644 --- a/internal/protocoltest/jsonrpc/api_op_HostWithPathOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_HostWithPathOperation_test.go @@ -39,6 +39,10 @@ func TestClient_HostWithPathOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/custom/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.HostWithPathOperation"}, + }, Host: func() *url.URL { host := "https://example.com/custom" if len(host) == 0 { diff --git a/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go b/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go index cd8eed9a9ec..03d3fe8bc64 100644 --- a/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go +++ b/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go @@ -63,6 +63,7 @@ func TestClient_JsonEnums_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.JsonEnums"}, }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { diff --git a/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go b/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go index 638b71bc990..c97468fb3b9 100644 --- a/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go @@ -51,6 +51,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -70,6 +71,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -89,6 +91,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -108,6 +111,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -127,6 +131,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -146,6 +151,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -165,6 +171,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -184,6 +191,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -203,6 +211,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -222,6 +231,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -241,6 +251,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -260,6 +271,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -279,6 +291,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -302,6 +315,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -321,6 +335,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -350,6 +365,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -379,6 +395,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -410,6 +427,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -432,6 +450,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -451,6 +470,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -479,6 +499,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -505,6 +526,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -536,6 +558,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -557,6 +580,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -578,6 +602,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -597,6 +622,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -616,6 +642,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", @@ -653,6 +680,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.KitchenSinkOperation"}, }, RequireHeader: []string{ "Content-Length", diff --git a/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go b/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go index 78e3fdb5ccb..6efb7e01c83 100644 --- a/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go @@ -48,6 +48,7 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.NullOperation"}, }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { @@ -66,6 +67,7 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.NullOperation"}, }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { @@ -88,6 +90,7 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.NullOperation"}, }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { diff --git a/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go b/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go index 3275c2ae590..62e31c757e2 100644 --- a/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go +++ b/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go @@ -51,6 +51,7 @@ func TestClient_PutAndGetInlineDocuments_awsAwsjson11Serialize(t *testing.T) { ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ "Content-Type": []string{"application/x-amz-json-1.1"}, + "X-Amz-Target": []string{"JsonProtocol.PutAndGetInlineDocuments"}, }, RequireHeader: []string{ "Content-Length", diff --git a/internal/protocoltest/jsonrpc/deserializers.go b/internal/protocoltest/jsonrpc/deserializers.go index 793ab5225e5..d2478e1e2d1 100644 --- a/internal/protocoltest/jsonrpc/deserializers.go +++ b/internal/protocoltest/jsonrpc/deserializers.go @@ -25,6 +25,114 @@ import ( "time" ) +type awsAwsjson11_deserializeOpDatetimeOffsets struct { +} + +func (*awsAwsjson11_deserializeOpDatetimeOffsets) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpDatetimeOffsets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson11_deserializeOpErrorDatetimeOffsets(response, &metadata) + } + output := &DatetimeOffsetsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson11_deserializeOpDocumentDatetimeOffsetsOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorDatetimeOffsets(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpEmptyOperation struct { } @@ -2885,6 +2993,50 @@ func awsAwsjson11_deserializeDocumentStringMap(v *map[string]string, value inter return nil } +func awsAwsjson11_deserializeOpDocumentDatetimeOffsetsOutput(v **DatetimeOffsetsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DatetimeOffsetsOutput + if *v == nil { + sv = &DatetimeOffsetsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "datetime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DateTime to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.Datetime = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentGreetingWithErrorsOutput(v **GreetingWithErrorsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/internal/protocoltest/jsonrpc/generated.json b/internal/protocoltest/jsonrpc/generated.json index f4c808f9349..0ebde3f67fe 100644 --- a/internal/protocoltest/jsonrpc/generated.json +++ b/internal/protocoltest/jsonrpc/generated.json @@ -9,6 +9,8 @@ "files": [ "api_client.go", "api_client_test.go", + "api_op_DatetimeOffsets.go", + "api_op_DatetimeOffsets_test.go", "api_op_EmptyOperation.go", "api_op_EmptyOperation_test.go", "api_op_EndpointOperation.go", diff --git a/internal/protocoltest/jsonrpc/serializers.go b/internal/protocoltest/jsonrpc/serializers.go index c288cb589cd..f4a400ea30f 100644 --- a/internal/protocoltest/jsonrpc/serializers.go +++ b/internal/protocoltest/jsonrpc/serializers.go @@ -20,6 +20,56 @@ import ( "strings" ) +type awsAwsjson11_serializeOpDatetimeOffsets struct { +} + +func (*awsAwsjson11_serializeOpDatetimeOffsets) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpDatetimeOffsets) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DatetimeOffsetsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("JsonProtocol.DatetimeOffsets") + + if request, err = request.SetStream(strings.NewReader(`{}`)); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsjson11_serializeOpEmptyOperation struct { } diff --git a/internal/protocoltest/jsonrpc10/api_op_JsonUnions_test.go b/internal/protocoltest/jsonrpc10/api_op_JsonUnions_test.go index c71f1ad4e08..9d7d9db62d0 100644 --- a/internal/protocoltest/jsonrpc10/api_op_JsonUnions_test.go +++ b/internal/protocoltest/jsonrpc10/api_op_JsonUnions_test.go @@ -167,6 +167,27 @@ func TestClient_JsonUnions_awsAwsjson10Serialize(t *testing.T) { }`)) }, }, + // Serializes an intEnum union value + "AwsJson10SerializeIntEnumUnionValue": { + Params: &JsonUnionsInput{ + Contents: &types.MyUnionMemberIntEnumValue{Value: 1}, + }, + ExpectMethod: "POST", + ExpectURIPath: "/", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.0"}, + "X-Amz-Target": []string{"JsonRpc10.JsonUnions"}, + }, + BodyMediaType: "application/json", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ + "contents": { + "intEnumValue": 1 + } + }`)) + }, + }, // Serializes a list union value "AwsJson10SerializeListUnionValue": { Params: &JsonUnionsInput{ @@ -424,6 +445,22 @@ func TestClient_JsonUnions_awsAwsjson10Deserialize(t *testing.T) { Contents: &types.MyUnionMemberEnumValue{Value: types.FooEnum("Foo")}, }, }, + // Deserializes an intEnum union value + "AwsJson10DeserializeIntEnumUnionValue": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.0"}, + }, + BodyMediaType: "application/json", + Body: []byte(`{ + "contents": { + "intEnumValue": 1 + } + }`), + ExpectResult: &JsonUnionsOutput{ + Contents: &types.MyUnionMemberIntEnumValue{Value: 1}, + }, + }, // Deserializes a list union value "AwsJson10DeserializeListUnionValue": { StatusCode: 200, diff --git a/internal/protocoltest/jsonrpc10/deserializers.go b/internal/protocoltest/jsonrpc10/deserializers.go index 4b2e241150f..9cc44be6b41 100644 --- a/internal/protocoltest/jsonrpc10/deserializers.go +++ b/internal/protocoltest/jsonrpc10/deserializers.go @@ -1237,6 +1237,22 @@ loop: uv = &types.MyUnionMemberEnumValue{Value: mv} break loop + case "intEnumValue": + var mv types.IntegerEnum + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + mv = int32(i64) + } + uv = &types.MyUnionMemberIntEnumValue{Value: mv} + break loop + case "listValue": var mv []string if err := awsAwsjson10_deserializeDocumentStringList(&mv, value); err != nil { diff --git a/internal/protocoltest/jsonrpc10/serializers.go b/internal/protocoltest/jsonrpc10/serializers.go index 9b973864546..d0cc6ef14c7 100644 --- a/internal/protocoltest/jsonrpc10/serializers.go +++ b/internal/protocoltest/jsonrpc10/serializers.go @@ -509,6 +509,10 @@ func awsAwsjson10_serializeDocumentMyUnion(v types.MyUnion, value smithyjson.Val av := object.Key("enumValue") av.String(string(uv.Value)) + case *types.MyUnionMemberIntEnumValue: + av := object.Key("intEnumValue") + av.Integer(uv.Value) + case *types.MyUnionMemberListValue: av := object.Key("listValue") if err := awsAwsjson10_serializeDocumentStringList(uv.Value, av); err != nil { diff --git a/internal/protocoltest/jsonrpc10/types/enums.go b/internal/protocoltest/jsonrpc10/types/enums.go index a0088b218b8..6652e863c7a 100644 --- a/internal/protocoltest/jsonrpc10/types/enums.go +++ b/internal/protocoltest/jsonrpc10/types/enums.go @@ -25,3 +25,12 @@ func (FooEnum) Values() []FooEnum { "0", } } + +type IntegerEnum = int32 + +// Enum values for IntegerEnum +const ( + IntegerEnumA IntegerEnum = 1 + IntegerEnumB IntegerEnum = 2 + IntegerEnumC IntegerEnum = 3 +) diff --git a/internal/protocoltest/jsonrpc10/types/types.go b/internal/protocoltest/jsonrpc10/types/types.go index aaed8ff80d3..e3ec082823d 100644 --- a/internal/protocoltest/jsonrpc10/types/types.go +++ b/internal/protocoltest/jsonrpc10/types/types.go @@ -20,6 +20,7 @@ type ComplexNestedErrorData struct { // MyUnionMemberBlobValue // MyUnionMemberBooleanValue // MyUnionMemberEnumValue +// MyUnionMemberIntEnumValue // MyUnionMemberListValue // MyUnionMemberMapValue // MyUnionMemberNumberValue @@ -54,6 +55,14 @@ type MyUnionMemberEnumValue struct { func (*MyUnionMemberEnumValue) isMyUnion() {} +type MyUnionMemberIntEnumValue struct { + Value IntegerEnum + + noSmithyDocumentSerde +} + +func (*MyUnionMemberIntEnumValue) isMyUnion() {} + type MyUnionMemberListValue struct { Value []string diff --git a/internal/protocoltest/jsonrpc10/types/types_exported_test.go b/internal/protocoltest/jsonrpc10/types/types_exported_test.go index c3352cb774d..71f18ef1dd7 100644 --- a/internal/protocoltest/jsonrpc10/types/types_exported_test.go +++ b/internal/protocoltest/jsonrpc10/types/types_exported_test.go @@ -21,6 +21,9 @@ func ExampleMyUnion_outputUsage() { case *types.MyUnionMemberEnumValue: _ = v.Value // Value is types.FooEnum + case *types.MyUnionMemberIntEnumValue: + _ = v.Value // Value is types.IntegerEnum + case *types.MyUnionMemberListValue: _ = v.Value // Value is []string @@ -50,6 +53,7 @@ func ExampleMyUnion_outputUsage() { var _ map[string]string var _ types.FooEnum +var _ types.IntegerEnum var _ []string var _ *string var _ *types.GreetingStruct diff --git a/internal/protocoltest/query/api_op_DatetimeOffsets.go b/internal/protocoltest/query/api_op_DatetimeOffsets.go new file mode 100644 index 00000000000..6ec8c0da149 --- /dev/null +++ b/internal/protocoltest/query/api_op_DatetimeOffsets.go @@ -0,0 +1,101 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package query + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +func (c *Client) DatetimeOffsets(ctx context.Context, params *DatetimeOffsetsInput, optFns ...func(*Options)) (*DatetimeOffsetsOutput, error) { + if params == nil { + params = &DatetimeOffsetsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DatetimeOffsets", params, optFns, c.addOperationDatetimeOffsetsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DatetimeOffsetsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DatetimeOffsetsInput struct { + noSmithyDocumentSerde +} + +type DatetimeOffsetsOutput struct { + Datetime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDatetimeOffsetsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsAwsquery_serializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDatetimeOffsets(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDatetimeOffsets(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DatetimeOffsets", + } +} diff --git a/internal/protocoltest/query/api_op_DatetimeOffsets_test.go b/internal/protocoltest/query/api_op_DatetimeOffsets_test.go new file mode 100644 index 00000000000..d90ba9bd8b1 --- /dev/null +++ b/internal/protocoltest/query/api_op_DatetimeOffsets_test.go @@ -0,0 +1,135 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package query + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io/ioutil" + "math" + "net/http" + "testing" +) + +func TestClient_DatetimeOffsets_awsAwsqueryDeserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *DatetimeOffsetsOutput + }{ + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "AwsQueryDateTimeWithNegativeOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + + 2019-12-16T22:48:18-01:00 + + + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "AwsQueryDateTimeWithPositiveOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + + 2019-12-17T00:48:18+01:00 + + + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params DatetimeOffsetsInput + result, err := client.DatetimeOffsets(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/query/api_op_QueryLists_test.go b/internal/protocoltest/query/api_op_QueryLists_test.go index e2541f68178..a7523fb2dff 100644 --- a/internal/protocoltest/query/api_op_QueryLists_test.go +++ b/internal/protocoltest/query/api_op_QueryLists_test.go @@ -64,7 +64,7 @@ func TestClient_QueryLists_awsAwsquerySerialize(t *testing.T) { return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=QueryLists&Version=2020-01-08&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&ComplexListArg.member.1.hi=hello&ComplexListArg.member.2.hi=hola`)) }, }, - // Does not serialize empty query lists + // Serializes empty query lists "EmptyQueryLists": { Params: &QueryListsInput{ ListArg: []string{}, @@ -77,7 +77,7 @@ func TestClient_QueryLists_awsAwsquerySerialize(t *testing.T) { }, BodyMediaType: "application/x-www-form-urlencoded", BodyAssert: func(actual io.Reader) error { - return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=QueryLists&Version=2020-01-08`)) + return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=QueryLists&Version=2020-01-08&ListArg=`)) }, }, // Flattens query lists by repeating the member name and removing the member diff --git a/internal/protocoltest/query/api_op_SimpleInputParams.go b/internal/protocoltest/query/api_op_SimpleInputParams.go index f6463807b8f..68a1cf35330 100644 --- a/internal/protocoltest/query/api_op_SimpleInputParams.go +++ b/internal/protocoltest/query/api_op_SimpleInputParams.go @@ -41,6 +41,8 @@ type SimpleInputParamsInput struct { FooEnum types.FooEnum + IntegerEnum types.IntegerEnum + Qux []byte noSmithyDocumentSerde diff --git a/internal/protocoltest/query/api_op_SimpleInputParams_test.go b/internal/protocoltest/query/api_op_SimpleInputParams_test.go index 981523c75a2..71d0ab2f75e 100644 --- a/internal/protocoltest/query/api_op_SimpleInputParams_test.go +++ b/internal/protocoltest/query/api_op_SimpleInputParams_test.go @@ -172,6 +172,25 @@ func TestClient_SimpleInputParams_awsAwsquerySerialize(t *testing.T) { return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=SimpleInputParams&Version=2020-01-08&FooEnum=Foo`)) }, }, + // Serializes intEnums in the query string + "QueryIntEnums": { + Params: &SimpleInputParamsInput{ + IntegerEnum: 1, + }, + ExpectMethod: "POST", + ExpectURIPath: "/", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-www-form-urlencoded"}, + }, + RequireHeader: []string{ + "Content-Length", + }, + BodyMediaType: "application/x-www-form-urlencoded", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareURLFormReaderBytes(actual, []byte(`Action=SimpleInputParams&Version=2020-01-08&IntegerEnum=1`)) + }, + }, // Supports handling NaN float values. "AwsQuerySupportsNaNFloatInputs": { Params: &SimpleInputParamsInput{ diff --git a/internal/protocoltest/query/api_op_XmlEmptyLists.go b/internal/protocoltest/query/api_op_XmlEmptyLists.go index f3451f719e7..e521ed78b0c 100644 --- a/internal/protocoltest/query/api_op_XmlEmptyLists.go +++ b/internal/protocoltest/query/api_op_XmlEmptyLists.go @@ -43,6 +43,8 @@ type XmlEmptyListsOutput struct { FlattenedListWithNamespace []string + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. diff --git a/internal/protocoltest/query/api_op_XmlIntEnums.go b/internal/protocoltest/query/api_op_XmlIntEnums.go new file mode 100644 index 00000000000..b929ee66aba --- /dev/null +++ b/internal/protocoltest/query/api_op_XmlIntEnums.go @@ -0,0 +1,112 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package query + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/query/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This example serializes enums as top level properties, in lists, sets, and maps. +func (c *Client) XmlIntEnums(ctx context.Context, params *XmlIntEnumsInput, optFns ...func(*Options)) (*XmlIntEnumsOutput, error) { + if params == nil { + params = &XmlIntEnumsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "XmlIntEnums", params, optFns, c.addOperationXmlIntEnumsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*XmlIntEnumsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type XmlIntEnumsInput struct { + noSmithyDocumentSerde +} + +type XmlIntEnumsOutput struct { + IntEnum1 types.IntegerEnum + + IntEnum2 types.IntegerEnum + + IntEnum3 types.IntegerEnum + + IntEnumList []types.IntegerEnum + + IntEnumMap map[string]types.IntegerEnum + + IntEnumSet []types.IntegerEnum + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationXmlIntEnumsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsAwsquery_serializeOpXmlIntEnums{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsquery_deserializeOpXmlIntEnums{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opXmlIntEnums(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opXmlIntEnums(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "XmlIntEnums", + } +} diff --git a/internal/protocoltest/query/api_op_XmlIntEnums_test.go b/internal/protocoltest/query/api_op_XmlIntEnums_test.go new file mode 100644 index 00000000000..e895f75af27 --- /dev/null +++ b/internal/protocoltest/query/api_op_XmlIntEnums_test.go @@ -0,0 +1,151 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package query + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/query/types" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io/ioutil" + "math" + "net/http" + "testing" +) + +func TestClient_XmlIntEnums_awsAwsqueryDeserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *XmlIntEnumsOutput + }{ + // Serializes simple scalar properties + "QueryXmlIntEnums": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + + 1 + 2 + 3 + + 1 + 2 + + + 1 + 2 + + + + a + 1 + + + b + 2 + + + + + `), + ExpectResult: &XmlIntEnumsOutput{ + IntEnum1: 1, + IntEnum2: 2, + IntEnum3: 3, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumSet: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumMap: map[string]types.IntegerEnum{ + "a": 1, + "b": 2, + }, + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params XmlIntEnumsInput + result, err := client.XmlIntEnums(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/query/api_op_XmlLists.go b/internal/protocoltest/query/api_op_XmlLists.go index 2d71be38e65..b00e312597e 100644 --- a/internal/protocoltest/query/api_op_XmlLists.go +++ b/internal/protocoltest/query/api_op_XmlLists.go @@ -61,6 +61,8 @@ type XmlListsOutput struct { FlattenedListWithNamespace []string + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. diff --git a/internal/protocoltest/query/api_op_XmlLists_test.go b/internal/protocoltest/query/api_op_XmlLists_test.go index 45317052708..a86b3d97f5c 100644 --- a/internal/protocoltest/query/api_op_XmlLists_test.go +++ b/internal/protocoltest/query/api_op_XmlLists_test.go @@ -64,6 +64,10 @@ func TestClient_XmlLists_awsAwsqueryDeserialize(t *testing.T) { Foo 0 + + 1 + 2 + foo @@ -124,6 +128,10 @@ func TestClient_XmlLists_awsAwsqueryDeserialize(t *testing.T) { types.FooEnum("Foo"), types.FooEnum("0"), }, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, NestedStringList: [][]string{ { "foo", diff --git a/internal/protocoltest/query/api_op_XmlTimestamps.go b/internal/protocoltest/query/api_op_XmlTimestamps.go index f39f245657c..3a5b33b614c 100644 --- a/internal/protocoltest/query/api_op_XmlTimestamps.go +++ b/internal/protocoltest/query/api_op_XmlTimestamps.go @@ -34,10 +34,16 @@ type XmlTimestampsInput struct { type XmlTimestampsOutput struct { DateTime *time.Time + DateTimeOnTarget *time.Time + EpochSeconds *time.Time + EpochSecondsOnTarget *time.Time + HttpDate *time.Time + HttpDateOnTarget *time.Time + Normal *time.Time // Metadata pertaining to the operation's result. diff --git a/internal/protocoltest/query/api_op_XmlTimestamps_test.go b/internal/protocoltest/query/api_op_XmlTimestamps_test.go index 344b9c58e0a..463c6cc9728 100644 --- a/internal/protocoltest/query/api_op_XmlTimestamps_test.go +++ b/internal/protocoltest/query/api_op_XmlTimestamps_test.go @@ -63,6 +63,24 @@ func TestClient_XmlTimestamps_awsAwsqueryDeserialize(t *testing.T) { DateTime: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of date-time on the target shape works like + // normal timestamps + "QueryXmlTimestampsWithDateTimeOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + + 2014-04-29T18:30:38Z + + + `), + ExpectResult: &XmlTimestampsOutput{ + DateTimeOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of epoch-seconds works "QueryXmlTimestampsWithEpochSecondsFormat": { StatusCode: 200, @@ -80,6 +98,23 @@ func TestClient_XmlTimestamps_awsAwsqueryDeserialize(t *testing.T) { EpochSeconds: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of epoch-seconds on the target shape works + "QueryXmlTimestampsWithEpochSecondsOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + + 1398796238 + + + `), + ExpectResult: &XmlTimestampsOutput{ + EpochSecondsOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of http-date works "QueryXmlTimestampsWithHttpDateFormat": { StatusCode: 200, @@ -97,6 +132,23 @@ func TestClient_XmlTimestamps_awsAwsqueryDeserialize(t *testing.T) { HttpDate: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of http-date on the target shape works + "QueryXmlTimestampsWithHttpDateOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"text/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + + Tue, 29 Apr 2014 18:30:38 GMT + + + `), + ExpectResult: &XmlTimestampsOutput{ + HttpDateOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, } for name, c := range cases { t.Run(name, func(t *testing.T) { diff --git a/internal/protocoltest/query/deserializers.go b/internal/protocoltest/query/deserializers.go index 5b075597335..e4f1cf9e72f 100644 --- a/internal/protocoltest/query/deserializers.go +++ b/internal/protocoltest/query/deserializers.go @@ -25,6 +25,111 @@ import ( "time" ) +type awsAwsquery_deserializeOpDatetimeOffsets struct { +} + +func (*awsAwsquery_deserializeOpDatetimeOffsets) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsquery_deserializeOpDatetimeOffsets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsquery_deserializeOpErrorDatetimeOffsets(response, &metadata) + } + output := &DatetimeOffsetsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + body := io.TeeReader(response.Body, ringBuffer) + rootDecoder := xml.NewDecoder(body) + t, err := smithyxml.FetchRootElement(rootDecoder) + if err == io.EOF { + return out, metadata, nil + } + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) + t, err = decoder.GetElement("DatetimeOffsetsResult") + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t) + err = awsAwsquery_deserializeOpDocumentDatetimeOffsetsOutput(&output, decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsquery_deserializeOpErrorDatetimeOffsets(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + errorComponents, err := awsxml.GetErrorResponseComponents(errorBody, false) + if err != nil { + return err + } + if reqID := errorComponents.RequestID; len(reqID) != 0 { + awsmiddleware.SetRequestIDMetadata(metadata, reqID) + } + if len(errorComponents.Code) != 0 { + errorCode = errorComponents.Code + } + if len(errorComponents.Message) != 0 { + errorMessage = errorComponents.Message + } + errorBody.Seek(0, io.SeekStart) + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsquery_deserializeOpEmptyInputAndEmptyOutput struct { } @@ -2204,6 +2309,111 @@ func awsAwsquery_deserializeOpErrorXmlEnums(response *smithyhttp.Response, metad } } +type awsAwsquery_deserializeOpXmlIntEnums struct { +} + +func (*awsAwsquery_deserializeOpXmlIntEnums) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsquery_deserializeOpXmlIntEnums) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsquery_deserializeOpErrorXmlIntEnums(response, &metadata) + } + output := &XmlIntEnumsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + body := io.TeeReader(response.Body, ringBuffer) + rootDecoder := xml.NewDecoder(body) + t, err := smithyxml.FetchRootElement(rootDecoder) + if err == io.EOF { + return out, metadata, nil + } + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) + t, err = decoder.GetElement("XmlIntEnumsResult") + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t) + err = awsAwsquery_deserializeOpDocumentXmlIntEnumsOutput(&output, decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsquery_deserializeOpErrorXmlIntEnums(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + errorComponents, err := awsxml.GetErrorResponseComponents(errorBody, false) + if err != nil { + return err + } + if reqID := errorComponents.RequestID; len(reqID) != 0 { + awsmiddleware.SetRequestIDMetadata(metadata, reqID) + } + if len(errorComponents.Code) != 0 { + errorCode = errorComponents.Code + } + if len(errorComponents.Message) != 0 { + errorMessage = errorComponents.Message + } + errorBody.Seek(0, io.SeekStart) + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsquery_deserializeOpXmlLists struct { } @@ -4455,13 +4665,13 @@ func awsAwsquery_deserializeDocumentGreetingStruct(v **types.GreetingStruct, dec return nil } -func awsAwsquery_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.NodeDecoder) error { +func awsAwsquery_deserializeDocumentIntegerEnumList(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } - var sv []int32 + var sv []types.IntegerEnum if *v == nil { - sv = make([]int32, 0) + sv = make([]types.IntegerEnum, 0) } else { sv = *v } @@ -4479,7 +4689,7 @@ func awsAwsquery_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.No decoder = memberDecoder switch { case strings.EqualFold("member", t.Name.Local): - var col int32 + var col types.IntegerEnum val, err := decoder.Value() if err != nil { return err @@ -4510,17 +4720,17 @@ func awsAwsquery_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.No return nil } -func awsAwsquery_deserializeDocumentIntegerListUnwrapped(v *[]int32, decoder smithyxml.NodeDecoder) error { - var sv []int32 +func awsAwsquery_deserializeDocumentIntegerEnumListUnwrapped(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv []types.IntegerEnum if *v == nil { - sv = make([]int32, 0) + sv = make([]types.IntegerEnum, 0) } else { sv = *v } switch { default: - var mv int32 + var mv types.IntegerEnum t := decoder.StartEl _ = t val, err := decoder.Value() @@ -4543,18 +4753,17 @@ func awsAwsquery_deserializeDocumentIntegerListUnwrapped(v *[]int32, decoder smi *v = sv return nil } -func awsAwsquery_deserializeDocumentNestedStringList(v *[][]string, decoder smithyxml.NodeDecoder) error { +func awsAwsquery_deserializeDocumentIntegerEnumMap(v *map[string]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } - var sv [][]string + var sv map[string]types.IntegerEnum if *v == nil { - sv = make([][]string, 0) + sv = make(map[string]types.IntegerEnum, 0) } else { sv = *v } - originalDecoder := decoder for { t, done, err := decoder.Token() if err != nil { @@ -4564,13 +4773,11 @@ func awsAwsquery_deserializeDocumentNestedStringList(v *[][]string, decoder smit break } switch { - case strings.EqualFold("member", t.Name.Local): - var col []string - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsAwsquery_deserializeDocumentStringList(&col, nodeDecoder); err != nil { + case strings.EqualFold("entry", t.Name.Local): + entryDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentIntegerEnumMapUnwrapped(&sv, entryDecoder); err != nil { return err } - sv = append(sv, col) default: err = decoder.Decoder.Skip() @@ -4579,59 +4786,34 @@ func awsAwsquery_deserializeDocumentNestedStringList(v *[][]string, decoder smit } } - decoder = originalDecoder } *v = sv return nil } -func awsAwsquery_deserializeDocumentNestedStringListUnwrapped(v *[][]string, decoder smithyxml.NodeDecoder) error { - var sv [][]string - if *v == nil { - sv = make([][]string, 0) - } else { - sv = *v - } - - switch { - default: - var mv []string - t := decoder.StartEl - _ = t - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsAwsquery_deserializeDocumentStringList(&mv, nodeDecoder); err != nil { - return err - } - sv = append(sv, mv) - } - *v = sv - return nil -} -func awsAwsquery_deserializeDocumentStringList(v *[]string, decoder smithyxml.NodeDecoder) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - var sv []string +func awsAwsquery_deserializeDocumentIntegerEnumMapUnwrapped(v *map[string]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv map[string]types.IntegerEnum if *v == nil { - sv = make([]string, 0) + sv = make(map[string]types.IntegerEnum, 0) } else { sv = *v } - originalDecoder := decoder + var ek string + var ev types.IntegerEnum for { t, done, err := decoder.Token() if err != nil { return err } if done { + sv[ek] = ev break } - memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - decoder = memberDecoder + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) switch { - case strings.EqualFold("member", t.Name.Local): - var col string + case strings.EqualFold("key", t.Name.Local): val, err := decoder.Value() if err != nil { return err @@ -4641,11 +4823,317 @@ func awsAwsquery_deserializeDocumentStringList(v *[]string, decoder smithyxml.No } { xtv := string(val) - col = xtv + ek = xtv } - sv = append(sv, col) - default: + case strings.EqualFold("value", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + ev = int32(i64) + } + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} +func awsAwsquery_deserializeDocumentIntegerEnumSet(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []types.IntegerEnum + if *v == nil { + sv = make([]types.IntegerEnum, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col types.IntegerEnum + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + col = int32(i64) + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsAwsquery_deserializeDocumentIntegerEnumSetUnwrapped(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv []types.IntegerEnum + if *v == nil { + sv = make([]types.IntegerEnum, 0) + } else { + sv = *v + } + + switch { + default: + var mv types.IntegerEnum + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + mv = int32(i64) + } + sv = append(sv, mv) + } + *v = sv + return nil +} +func awsAwsquery_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []int32 + if *v == nil { + sv = make([]int32, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col int32 + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + col = int32(i64) + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsAwsquery_deserializeDocumentIntegerListUnwrapped(v *[]int32, decoder smithyxml.NodeDecoder) error { + var sv []int32 + if *v == nil { + sv = make([]int32, 0) + } else { + sv = *v + } + + switch { + default: + var mv int32 + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + mv = int32(i64) + } + sv = append(sv, mv) + } + *v = sv + return nil +} +func awsAwsquery_deserializeDocumentNestedStringList(v *[][]string, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv [][]string + if *v == nil { + sv = make([][]string, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + switch { + case strings.EqualFold("member", t.Name.Local): + var col []string + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentStringList(&col, nodeDecoder); err != nil { + return err + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsAwsquery_deserializeDocumentNestedStringListUnwrapped(v *[][]string, decoder smithyxml.NodeDecoder) error { + var sv [][]string + if *v == nil { + sv = make([][]string, 0) + } else { + sv = *v + } + + switch { + default: + var mv []string + t := decoder.StartEl + _ = t + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentStringList(&mv, nodeDecoder); err != nil { + return err + } + sv = append(sv, mv) + } + *v = sv + return nil +} +func awsAwsquery_deserializeDocumentStringList(v *[]string, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []string + if *v == nil { + sv = make([]string, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col string + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + col = xtv + } + sv = append(sv, col) + + default: err = decoder.Decoder.Skip() if err != nil { return err @@ -4855,6 +5343,59 @@ func awsAwsquery_deserializeDocumentTimestampListUnwrapped(v *[]time.Time, decod *v = sv return nil } +func awsAwsquery_deserializeOpDocumentDatetimeOffsetsOutput(v **DatetimeOffsetsOutput, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *DatetimeOffsetsOutput + if *v == nil { + sv = &DatetimeOffsetsOutput{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("datetime", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseDateTime(xtv) + if err != nil { + return err + } + sv.Datetime = ptr.Time(t) + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + func awsAwsquery_deserializeOpDocumentEmptyInputAndEmptyOutputOutput(v **EmptyInputAndEmptyOutputOutput, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -5561,6 +6102,12 @@ func awsAwsquery_deserializeOpDocumentXmlEmptyListsOutput(v **XmlEmptyListsOutpu return err } + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + case strings.EqualFold("nestedStringList", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) if err := awsAwsquery_deserializeDocumentNestedStringList(&sv.NestedStringList, nodeDecoder); err != nil { @@ -5746,6 +6293,111 @@ func awsAwsquery_deserializeOpDocumentXmlEnumsOutput(v **XmlEnumsOutput, decoder return nil } +func awsAwsquery_deserializeOpDocumentXmlIntEnumsOutput(v **XmlIntEnumsOutput, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *XmlIntEnumsOutput + if *v == nil { + sv = &XmlIntEnumsOutput{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("intEnum1", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum1 = int32(i64) + } + + case strings.EqualFold("intEnum2", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum2 = int32(i64) + } + + case strings.EqualFold("intEnum3", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum3 = int32(i64) + } + + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("intEnumMap", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentIntegerEnumMap(&sv.IntEnumMap, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("intEnumSet", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentIntegerEnumSet(&sv.IntEnumSet, nodeDecoder); err != nil { + return err + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + func awsAwsquery_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -5810,6 +6462,12 @@ func awsAwsquery_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder return err } + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsAwsquery_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + case strings.EqualFold("nestedStringList", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) if err := awsAwsquery_deserializeDocumentNestedStringList(&sv.NestedStringList, nodeDecoder); err != nil { @@ -6025,6 +6683,23 @@ func awsAwsquery_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutpu sv.DateTime = ptr.Time(t) } + case strings.EqualFold("dateTimeOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseDateTime(xtv) + if err != nil { + return err + } + sv.DateTimeOnTarget = ptr.Time(t) + } + case strings.EqualFold("epochSeconds", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -6042,6 +6717,23 @@ func awsAwsquery_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutpu sv.EpochSeconds = ptr.Time(smithytime.ParseEpochSeconds(f64)) } + case strings.EqualFold("epochSecondsOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + f64, err := strconv.ParseFloat(xtv, 64) + if err != nil { + return err + } + sv.EpochSecondsOnTarget = ptr.Time(smithytime.ParseEpochSeconds(f64)) + } + case strings.EqualFold("httpDate", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -6059,6 +6751,23 @@ func awsAwsquery_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutpu sv.HttpDate = ptr.Time(t) } + case strings.EqualFold("httpDateOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseHTTPDate(xtv) + if err != nil { + return err + } + sv.HttpDateOnTarget = ptr.Time(t) + } + case strings.EqualFold("normal", t.Name.Local): val, err := decoder.Value() if err != nil { diff --git a/internal/protocoltest/query/generated.json b/internal/protocoltest/query/generated.json index 2bf4c3e9172..df8917391ff 100644 --- a/internal/protocoltest/query/generated.json +++ b/internal/protocoltest/query/generated.json @@ -9,6 +9,8 @@ "files": [ "api_client.go", "api_client_test.go", + "api_op_DatetimeOffsets.go", + "api_op_DatetimeOffsets_test.go", "api_op_EmptyInputAndEmptyOutput.go", "api_op_EmptyInputAndEmptyOutput_test.go", "api_op_EndpointOperation.go", @@ -57,6 +59,8 @@ "api_op_XmlEmptyMaps_test.go", "api_op_XmlEnums.go", "api_op_XmlEnums_test.go", + "api_op_XmlIntEnums.go", + "api_op_XmlIntEnums_test.go", "api_op_XmlLists.go", "api_op_XmlLists_test.go", "api_op_XmlMaps.go", diff --git a/internal/protocoltest/query/serializers.go b/internal/protocoltest/query/serializers.go index 77a58c01fb3..0a3468dd839 100644 --- a/internal/protocoltest/query/serializers.go +++ b/internal/protocoltest/query/serializers.go @@ -18,6 +18,66 @@ import ( "sort" ) +type awsAwsquery_serializeOpDatetimeOffsets struct { +} + +func (*awsAwsquery_serializeOpDatetimeOffsets) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsquery_serializeOpDatetimeOffsets) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DatetimeOffsetsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-www-form-urlencoded") + + bodyWriter := bytes.NewBuffer(nil) + bodyEncoder := query.NewEncoder(bodyWriter) + body := bodyEncoder.Object() + body.Key("Action").String("DatetimeOffsets") + body.Key("Version").String("2020-01-08") + + err = bodyEncoder.Encode() + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(bodyWriter.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsquery_serializeOpEmptyInputAndEmptyOutput struct { } @@ -1486,6 +1546,66 @@ func (m *awsAwsquery_serializeOpXmlEnums) HandleSerialize(ctx context.Context, i return next.HandleSerialize(ctx, in) } +type awsAwsquery_serializeOpXmlIntEnums struct { +} + +func (*awsAwsquery_serializeOpXmlIntEnums) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsquery_serializeOpXmlIntEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*XmlIntEnumsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-www-form-urlencoded") + + bodyWriter := bytes.NewBuffer(nil) + bodyEncoder := query.NewEncoder(bodyWriter) + body := bodyEncoder.Object() + body.Key("Action").String("XmlIntEnums") + body.Key("Version").String("2020-01-08") + + err = bodyEncoder.Encode() + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(bodyWriter.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsquery_serializeOpXmlLists struct { } @@ -1808,9 +1928,6 @@ func awsAwsquery_serializeDocumentComplexMap(v map[string]types.GreetingStruct, } func awsAwsquery_serializeDocumentListWithXmlName(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("item") for i := range v { @@ -1916,9 +2033,6 @@ func awsAwsquery_serializeDocumentStructArg(v *types.StructArg, value query.Valu } func awsAwsquery_serializeDocumentGreetingList(v []types.GreetingStruct, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1943,9 +2057,6 @@ func awsAwsquery_serializeDocumentGreetingStruct(v *types.GreetingStruct, value } func awsAwsquery_serializeDocumentStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2225,6 +2336,11 @@ func awsAwsquery_serializeOpDocumentSimpleInputParamsInput(v *SimpleInputParamsI objectKey.String(string(v.FooEnum)) } + if v.IntegerEnum != 0 { + objectKey := object.Key("IntegerEnum") + objectKey.Integer(v.IntegerEnum) + } + if v.Qux != nil { objectKey := object.Key("Qux") objectKey.Base64EncodeBytes(v.Qux) diff --git a/internal/protocoltest/query/types/enums.go b/internal/protocoltest/query/types/enums.go index a0088b218b8..6652e863c7a 100644 --- a/internal/protocoltest/query/types/enums.go +++ b/internal/protocoltest/query/types/enums.go @@ -25,3 +25,12 @@ func (FooEnum) Values() []FooEnum { "0", } } + +type IntegerEnum = int32 + +// Enum values for IntegerEnum +const ( + IntegerEnumA IntegerEnum = 1 + IntegerEnumB IntegerEnum = 2 + IntegerEnumC IntegerEnum = 3 +) diff --git a/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go b/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go index 29dc367146d..ee3c45bc96d 100644 --- a/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go +++ b/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go @@ -46,6 +46,10 @@ type AllQueryStringTypesInput struct { QueryInteger *int32 + QueryIntegerEnum types.IntegerEnum + + QueryIntegerEnumList []types.IntegerEnum + QueryIntegerList []int32 QueryIntegerSet []int32 diff --git a/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go b/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go index 3d83d7a477f..02aa082c197 100644 --- a/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go +++ b/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go @@ -92,6 +92,11 @@ func TestClient_AllQueryStringTypes_awsRestxmlSerialize(t *testing.T) { types.FooEnum("Baz"), types.FooEnum("Bar"), }, + QueryIntegerEnum: 1, + QueryIntegerEnumList: []types.IntegerEnum{ + 1, + 2, + }, }, ExpectMethod: "GET", ExpectURIPath: "/AllQueryStringTypesInput", @@ -130,6 +135,9 @@ func TestClient_AllQueryStringTypes_awsRestxmlSerialize(t *testing.T) { {Key: "EnumList", Value: "Foo"}, {Key: "EnumList", Value: "Baz"}, {Key: "EnumList", Value: "Bar"}, + {Key: "IntegerEnum", Value: "1"}, + {Key: "IntegerEnumList", Value: "1"}, + {Key: "IntegerEnumList", Value: "2"}, }, BodyAssert: func(actual io.Reader) error { return smithytesting.CompareReaderEmpty(actual) diff --git a/internal/protocoltest/restxml/api_op_DatetimeOffsets.go b/internal/protocoltest/restxml/api_op_DatetimeOffsets.go new file mode 100644 index 00000000000..cf27a0d7e77 --- /dev/null +++ b/internal/protocoltest/restxml/api_op_DatetimeOffsets.go @@ -0,0 +1,101 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package restxml + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "time" +) + +func (c *Client) DatetimeOffsets(ctx context.Context, params *DatetimeOffsetsInput, optFns ...func(*Options)) (*DatetimeOffsetsOutput, error) { + if params == nil { + params = &DatetimeOffsetsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DatetimeOffsets", params, optFns, c.addOperationDatetimeOffsetsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DatetimeOffsetsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DatetimeOffsetsInput struct { + noSmithyDocumentSerde +} + +type DatetimeOffsetsOutput struct { + Datetime *time.Time + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDatetimeOffsetsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestxml_serializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestxml_deserializeOpDatetimeOffsets{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDatetimeOffsets(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDatetimeOffsets(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DatetimeOffsets", + } +} diff --git a/internal/protocoltest/restxml/api_op_DatetimeOffsets_test.go b/internal/protocoltest/restxml/api_op_DatetimeOffsets_test.go new file mode 100644 index 00000000000..6356435c0dc --- /dev/null +++ b/internal/protocoltest/restxml/api_op_DatetimeOffsets_test.go @@ -0,0 +1,131 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package restxml + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io/ioutil" + "math" + "net/http" + "testing" +) + +func TestClient_DatetimeOffsets_awsRestxmlDeserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *DatetimeOffsetsOutput + }{ + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "RestXmlDateTimeWithNegativeOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 2019-12-16T22:48:18-01:00 + + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + // Ensures that clients can correctly parse datetime (timestamps) with offsets + "RestXmlDateTimeWithPositiveOffset": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 2019-12-17T00:48:18+01:00 + + `), + ExpectResult: &DatetimeOffsetsOutput{ + Datetime: ptr.Time(smithytime.ParseEpochSeconds(1576540098)), + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params DatetimeOffsetsInput + result, err := client.DatetimeOffsets(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/restxml/api_op_XmlEmptyLists.go b/internal/protocoltest/restxml/api_op_XmlEmptyLists.go index 0d68bbca3ee..29d7129ba1f 100644 --- a/internal/protocoltest/restxml/api_op_XmlEmptyLists.go +++ b/internal/protocoltest/restxml/api_op_XmlEmptyLists.go @@ -41,6 +41,8 @@ type XmlEmptyListsInput struct { FlattenedStructureList []types.StructureListMember + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. @@ -74,6 +76,8 @@ type XmlEmptyListsOutput struct { FlattenedStructureList []types.StructureListMember + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. diff --git a/internal/protocoltest/restxml/api_op_XmlIntEnums.go b/internal/protocoltest/restxml/api_op_XmlIntEnums.go new file mode 100644 index 00000000000..01092f3c7db --- /dev/null +++ b/internal/protocoltest/restxml/api_op_XmlIntEnums.go @@ -0,0 +1,124 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package restxml + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/restxml/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This example serializes enums as top level properties, in lists, sets, and maps. +func (c *Client) XmlIntEnums(ctx context.Context, params *XmlIntEnumsInput, optFns ...func(*Options)) (*XmlIntEnumsOutput, error) { + if params == nil { + params = &XmlIntEnumsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "XmlIntEnums", params, optFns, c.addOperationXmlIntEnumsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*XmlIntEnumsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type XmlIntEnumsInput struct { + IntEnum1 types.IntegerEnum + + IntEnum2 types.IntegerEnum + + IntEnum3 types.IntegerEnum + + IntEnumList []types.IntegerEnum + + IntEnumMap map[string]types.IntegerEnum + + IntEnumSet []types.IntegerEnum + + noSmithyDocumentSerde +} + +type XmlIntEnumsOutput struct { + IntEnum1 types.IntegerEnum + + IntEnum2 types.IntegerEnum + + IntEnum3 types.IntegerEnum + + IntEnumList []types.IntegerEnum + + IntEnumMap map[string]types.IntegerEnum + + IntEnumSet []types.IntegerEnum + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationXmlIntEnumsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestxml_serializeOpXmlIntEnums{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestxml_deserializeOpXmlIntEnums{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opXmlIntEnums(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opXmlIntEnums(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "XmlIntEnums", + } +} diff --git a/internal/protocoltest/restxml/api_op_XmlIntEnums_test.go b/internal/protocoltest/restxml/api_op_XmlIntEnums_test.go new file mode 100644 index 00000000000..e166c3fdc76 --- /dev/null +++ b/internal/protocoltest/restxml/api_op_XmlIntEnums_test.go @@ -0,0 +1,300 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package restxml + +import ( + "bytes" + "context" + "github.com/aws/aws-sdk-go-v2/aws" + awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + "github.com/aws/aws-sdk-go-v2/internal/protocoltest/restxml/types" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/middleware" + smithyrand "github.com/aws/smithy-go/rand" + smithytesting "github.com/aws/smithy-go/testing" + smithyhttp "github.com/aws/smithy-go/transport/http" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "io" + "io/ioutil" + "math" + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "testing" +) + +func TestClient_XmlIntEnums_awsRestxmlSerialize(t *testing.T) { + cases := map[string]struct { + Params *XmlIntEnumsInput + ExpectMethod string + ExpectURIPath string + ExpectQuery []smithytesting.QueryItem + RequireQuery []string + ForbidQuery []string + ExpectHeader http.Header + RequireHeader []string + ForbidHeader []string + Host *url.URL + BodyMediaType string + BodyAssert func(io.Reader) error + }{ + // Serializes simple scalar properties + "XmlIntEnums": { + Params: &XmlIntEnumsInput{ + IntEnum1: 1, + IntEnum2: 2, + IntEnum3: 3, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumSet: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumMap: map[string]types.IntegerEnum{ + "a": 1, + "b": 2, + }, + }, + ExpectMethod: "PUT", + ExpectURIPath: "/XmlIntEnums", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareXMLReaderBytes(actual, []byte(` + 1 + 2 + 3 + + 1 + 2 + + + 1 + 2 + + + + a + 1 + + + b + 2 + + + + `)) + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + var actualReq *http.Request + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + actualReq = r.Clone(r.Context()) + if len(actualReq.URL.RawPath) == 0 { + actualReq.URL.RawPath = actualReq.URL.Path + } + if v := actualReq.ContentLength; v != 0 { + actualReq.Header.Set("Content-Length", strconv.FormatInt(v, 10)) + } + var buf bytes.Buffer + if _, err := io.Copy(&buf, r.Body); err != nil { + t.Errorf("failed to read request body, %v", err) + } + actualReq.Body = ioutil.NopCloser(&buf) + + w.WriteHeader(200) + })) + defer server.Close() + serverURL := server.URL + if c.Host != nil { + u, err := url.Parse(serverURL) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + u.Path = c.Host.Path + u.RawPath = c.Host.RawPath + u.RawQuery = c.Host.RawQuery + serverURL = u.String() + } + client := New(Options{ + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + HTTPClient: awshttp.NewBuildableClient(), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + result, err := client.XmlIntEnums(context.Background(), c.Params) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + if e, a := c.ExpectMethod, actualReq.Method; e != a { + t.Errorf("expect %v method, got %v", e, a) + } + if e, a := c.ExpectURIPath, actualReq.URL.RawPath; e != a { + t.Errorf("expect %v path, got %v", e, a) + } + queryItems := smithytesting.ParseRawQuery(actualReq.URL.RawQuery) + smithytesting.AssertHasQuery(t, c.ExpectQuery, queryItems) + smithytesting.AssertHasQueryKeys(t, c.RequireQuery, queryItems) + smithytesting.AssertNotHaveQueryKeys(t, c.ForbidQuery, queryItems) + smithytesting.AssertHasHeader(t, c.ExpectHeader, actualReq.Header) + smithytesting.AssertHasHeaderKeys(t, c.RequireHeader, actualReq.Header) + smithytesting.AssertNotHaveHeaderKeys(t, c.ForbidHeader, actualReq.Header) + if c.BodyAssert != nil { + if err := c.BodyAssert(actualReq.Body); err != nil { + t.Errorf("expect body equal, got %v", err) + } + } + }) + } +} + +func TestClient_XmlIntEnums_awsRestxmlDeserialize(t *testing.T) { + cases := map[string]struct { + StatusCode int + Header http.Header + BodyMediaType string + Body []byte + ExpectResult *XmlIntEnumsOutput + }{ + // Serializes simple scalar properties + "XmlIntEnums": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 1 + 2 + 3 + + 1 + 2 + + + 1 + 2 + + + + a + 1 + + + b + 2 + + + + `), + ExpectResult: &XmlIntEnumsOutput{ + IntEnum1: 1, + IntEnum2: 2, + IntEnum3: 3, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumSet: []types.IntegerEnum{ + 1, + 2, + }, + IntEnumMap: map[string]types.IntegerEnum{ + "a": 1, + "b": 2, + }, + }, + }, + } + for name, c := range cases { + t.Run(name, func(t *testing.T) { + serverURL := "http://localhost:8888/" + client := New(Options{ + HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) { + headers := http.Header{} + for k, vs := range c.Header { + for _, v := range vs { + headers.Add(k, v) + } + } + if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 { + headers.Set("Content-Type", c.BodyMediaType) + } + response := &http.Response{ + StatusCode: c.StatusCode, + Header: headers, + Request: r, + } + if len(c.Body) != 0 { + response.ContentLength = int64(len(c.Body)) + response.Body = ioutil.NopCloser(bytes.NewReader(c.Body)) + } else { + + response.Body = http.NoBody + } + return response, nil + }), + APIOptions: []func(*middleware.Stack) error{ + func(s *middleware.Stack) error { + s.Finalize.Clear() + s.Initialize.Remove(`OperationInputValidation`) + return nil + }, + }, + EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) { + e.URL = serverURL + e.SigningRegion = "us-west-2" + return e, err + }), + IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}), + Region: "us-west-2", + }) + var params XmlIntEnumsInput + result, err := client.XmlIntEnums(context.Background(), ¶ms) + if err != nil { + t.Fatalf("expect nil err, got %v", err) + } + if result == nil { + t.Fatalf("expect not nil result") + } + opts := cmp.Options{ + cmpopts.IgnoreUnexported( + middleware.Metadata{}, + ), + cmp.FilterValues(func(x, y float64) bool { + return math.IsNaN(x) && math.IsNaN(y) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmp.FilterValues(func(x, y float32) bool { + return math.IsNaN(float64(x)) && math.IsNaN(float64(y)) + }, cmp.Comparer(func(_, _ interface{}) bool { return true })), + cmpopts.IgnoreTypes(smithydocument.NoSerde{}), + } + if err := smithytesting.CompareValues(c.ExpectResult, result, opts...); err != nil { + t.Errorf("expect c.ExpectResult value match:\n%v", err) + } + }) + } +} diff --git a/internal/protocoltest/restxml/api_op_XmlLists.go b/internal/protocoltest/restxml/api_op_XmlLists.go index ffaacec9665..062016bd47e 100644 --- a/internal/protocoltest/restxml/api_op_XmlLists.go +++ b/internal/protocoltest/restxml/api_op_XmlLists.go @@ -64,6 +64,8 @@ type XmlListsInput struct { FlattenedStructureList []types.StructureListMember + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. @@ -97,6 +99,8 @@ type XmlListsOutput struct { FlattenedStructureList []types.StructureListMember + IntEnumList []types.IntegerEnum + IntegerList []int32 // A list of lists of strings. diff --git a/internal/protocoltest/restxml/api_op_XmlLists_test.go b/internal/protocoltest/restxml/api_op_XmlLists_test.go index 311719c6c5d..ff5b8707a44 100644 --- a/internal/protocoltest/restxml/api_op_XmlLists_test.go +++ b/internal/protocoltest/restxml/api_op_XmlLists_test.go @@ -70,6 +70,10 @@ func TestClient_XmlLists_awsRestxmlSerialize(t *testing.T) { types.FooEnum("Foo"), types.FooEnum("0"), }, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, NestedStringList: [][]string{ { "foo", @@ -146,6 +150,10 @@ func TestClient_XmlLists_awsRestxmlSerialize(t *testing.T) { Foo 0 + + 1 + 2 + foo @@ -304,6 +312,10 @@ func TestClient_XmlLists_awsRestxmlDeserialize(t *testing.T) { Foo 0 + + 1 + 2 + foo @@ -371,6 +383,10 @@ func TestClient_XmlLists_awsRestxmlDeserialize(t *testing.T) { types.FooEnum("Foo"), types.FooEnum("0"), }, + IntEnumList: []types.IntegerEnum{ + 1, + 2, + }, NestedStringList: [][]string{ { "foo", diff --git a/internal/protocoltest/restxml/api_op_XmlTimestamps.go b/internal/protocoltest/restxml/api_op_XmlTimestamps.go index 18aa2f598f5..a0a9e4fc9a3 100644 --- a/internal/protocoltest/restxml/api_op_XmlTimestamps.go +++ b/internal/protocoltest/restxml/api_op_XmlTimestamps.go @@ -30,10 +30,16 @@ func (c *Client) XmlTimestamps(ctx context.Context, params *XmlTimestampsInput, type XmlTimestampsInput struct { DateTime *time.Time + DateTimeOnTarget *time.Time + EpochSeconds *time.Time + EpochSecondsOnTarget *time.Time + HttpDate *time.Time + HttpDateOnTarget *time.Time + Normal *time.Time noSmithyDocumentSerde @@ -42,10 +48,16 @@ type XmlTimestampsInput struct { type XmlTimestampsOutput struct { DateTime *time.Time + DateTimeOnTarget *time.Time + EpochSeconds *time.Time + EpochSecondsOnTarget *time.Time + HttpDate *time.Time + HttpDateOnTarget *time.Time + Normal *time.Time // Metadata pertaining to the operation's result. diff --git a/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go b/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go index 9e0cbae5a54..300e12e72af 100644 --- a/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go +++ b/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go @@ -79,6 +79,26 @@ func TestClient_XmlTimestamps_awsRestxmlSerialize(t *testing.T) { `)) }, }, + // Ensures that the timestampFormat of date-time on the target shape works like + // normal timestamps + "XmlTimestampsWithDateTimeOnTargetFormat": { + Params: &XmlTimestampsInput{ + DateTimeOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + ExpectMethod: "POST", + ExpectURIPath: "/XmlTimestamps", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareXMLReaderBytes(actual, []byte(` + 2014-04-29T18:30:38Z + + `)) + }, + }, // Ensures that the timestampFormat of epoch-seconds works "XmlTimestampsWithEpochSecondsFormat": { Params: &XmlTimestampsInput{ @@ -98,6 +118,25 @@ func TestClient_XmlTimestamps_awsRestxmlSerialize(t *testing.T) { `)) }, }, + // Ensures that the timestampFormat of epoch-seconds on the target shape works + "XmlTimestampsWithEpochSecondsOnTargetFormat": { + Params: &XmlTimestampsInput{ + EpochSecondsOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + ExpectMethod: "POST", + ExpectURIPath: "/XmlTimestamps", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareXMLReaderBytes(actual, []byte(` + 1398796238 + + `)) + }, + }, // Ensures that the timestampFormat of http-date works "XmlTimestampsWithHttpDateFormat": { Params: &XmlTimestampsInput{ @@ -117,6 +156,25 @@ func TestClient_XmlTimestamps_awsRestxmlSerialize(t *testing.T) { `)) }, }, + // Ensures that the timestampFormat of http-date on the target shape works + "XmlTimestampsWithHttpDateOnTargetFormat": { + Params: &XmlTimestampsInput{ + HttpDateOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + ExpectMethod: "POST", + ExpectURIPath: "/XmlTimestamps", + ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + BodyAssert: func(actual io.Reader) error { + return smithytesting.CompareXMLReaderBytes(actual, []byte(` + Tue, 29 Apr 2014 18:30:38 GMT + + `)) + }, + }, } for name, c := range cases { t.Run(name, func(t *testing.T) { @@ -233,6 +291,22 @@ func TestClient_XmlTimestamps_awsRestxmlDeserialize(t *testing.T) { DateTime: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of date-time on the target shape works like + // normal timestamps + "XmlTimestampsWithDateTimeOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 2014-04-29T18:30:38Z + + `), + ExpectResult: &XmlTimestampsOutput{ + DateTimeOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of epoch-seconds works "XmlTimestampsWithEpochSecondsFormat": { StatusCode: 200, @@ -248,6 +322,21 @@ func TestClient_XmlTimestamps_awsRestxmlDeserialize(t *testing.T) { EpochSeconds: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of epoch-seconds on the target shape works + "XmlTimestampsWithEpochSecondsOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + 1398796238 + + `), + ExpectResult: &XmlTimestampsOutput{ + EpochSecondsOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, // Ensures that the timestampFormat of http-date works "XmlTimestampsWithHttpDateFormat": { StatusCode: 200, @@ -263,6 +352,21 @@ func TestClient_XmlTimestamps_awsRestxmlDeserialize(t *testing.T) { HttpDate: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), }, }, + // Ensures that the timestampFormat of http-date on the target shape works + "XmlTimestampsWithHttpDateOnTargetFormat": { + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/xml"}, + }, + BodyMediaType: "application/xml", + Body: []byte(` + Tue, 29 Apr 2014 18:30:38 GMT + + `), + ExpectResult: &XmlTimestampsOutput{ + HttpDateOnTarget: ptr.Time(smithytime.ParseEpochSeconds(1398796238)), + }, + }, } for name, c := range cases { t.Run(name, func(t *testing.T) { diff --git a/internal/protocoltest/restxml/deserializers.go b/internal/protocoltest/restxml/deserializers.go index 4a8cc0e147e..aecd5dbfb94 100644 --- a/internal/protocoltest/restxml/deserializers.go +++ b/internal/protocoltest/restxml/deserializers.go @@ -369,6 +369,151 @@ func awsRestxml_deserializeOpErrorConstantQueryString(response *smithyhttp.Respo } } +type awsRestxml_deserializeOpDatetimeOffsets struct { +} + +func (*awsRestxml_deserializeOpDatetimeOffsets) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpDatetimeOffsets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestxml_deserializeOpErrorDatetimeOffsets(response, &metadata) + } + output := &DatetimeOffsetsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + body := io.TeeReader(response.Body, ringBuffer) + rootDecoder := xml.NewDecoder(body) + t, err := smithyxml.FetchRootElement(rootDecoder) + if err == io.EOF { + return out, metadata, nil + } + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) + err = awsRestxml_deserializeOpDocumentDatetimeOffsetsOutput(&output, decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestxml_deserializeOpErrorDatetimeOffsets(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + errorComponents, err := awsxml.GetErrorResponseComponents(errorBody, false) + if err != nil { + return err + } + if reqID := errorComponents.RequestID; len(reqID) != 0 { + awsmiddleware.SetRequestIDMetadata(metadata, reqID) + } + if len(errorComponents.Code) != 0 { + errorCode = errorComponents.Code + } + if len(errorComponents.Message) != 0 { + errorMessage = errorComponents.Message + } + errorBody.Seek(0, io.SeekStart) + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestxml_deserializeOpDocumentDatetimeOffsetsOutput(v **DatetimeOffsetsOutput, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *DatetimeOffsetsOutput + if *v == nil { + sv = &DatetimeOffsetsOutput{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("datetime", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseDateTime(xtv) + if err != nil { + return err + } + sv.Datetime = ptr.Time(t) + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + type awsRestxml_deserializeOpEmptyInputAndEmptyOutput struct { } @@ -4948,6 +5093,12 @@ func awsRestxml_deserializeOpDocumentXmlEmptyListsOutput(v **XmlEmptyListsOutput return err } + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + case strings.EqualFold("nestedStringList", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) if err := awsRestxml_deserializeDocumentNestedStringList(&sv.NestedStringList, nodeDecoder); err != nil { @@ -5458,14 +5609,14 @@ func awsRestxml_deserializeOpDocumentXmlEnumsOutput(v **XmlEnumsOutput, decoder return nil } -type awsRestxml_deserializeOpXmlLists struct { +type awsRestxml_deserializeOpXmlIntEnums struct { } -func (*awsRestxml_deserializeOpXmlLists) ID() string { +func (*awsRestxml_deserializeOpXmlIntEnums) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlLists) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpXmlIntEnums) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -5479,9 +5630,9 @@ func (m *awsRestxml_deserializeOpXmlLists) HandleDeserialize(ctx context.Context } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestxml_deserializeOpErrorXmlLists(response, &metadata) + return out, metadata, awsRestxml_deserializeOpErrorXmlIntEnums(response, &metadata) } - output := &XmlListsOutput{} + output := &XmlIntEnumsOutput{} out.Result = output var buff [1024]byte @@ -5502,7 +5653,7 @@ func (m *awsRestxml_deserializeOpXmlLists) HandleDeserialize(ctx context.Context } decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) - err = awsRestxml_deserializeOpDocumentXmlListsOutput(&output, decoder) + err = awsRestxml_deserializeOpDocumentXmlIntEnumsOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -5515,7 +5666,7 @@ func (m *awsRestxml_deserializeOpXmlLists) HandleDeserialize(ctx context.Context return out, metadata, err } -func awsRestxml_deserializeOpErrorXmlLists(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestxml_deserializeOpErrorXmlIntEnums(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -5550,13 +5701,13 @@ func awsRestxml_deserializeOpErrorXmlLists(response *smithyhttp.Response, metada } } -func awsRestxml_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder smithyxml.NodeDecoder) error { +func awsRestxml_deserializeOpDocumentXmlIntEnumsOutput(v **XmlIntEnumsOutput, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } - var sv *XmlListsOutput + var sv *XmlIntEnumsOutput if *v == nil { - sv = &XmlListsOutput{} + sv = &XmlIntEnumsOutput{} } else { sv = *v } @@ -5572,87 +5723,72 @@ func awsRestxml_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder originalDecoder := decoder decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) switch { - case strings.EqualFold("booleanList", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentBooleanList(&sv.BooleanList, nodeDecoder); err != nil { - return err - } - - case strings.EqualFold("enumList", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentFooEnumList(&sv.EnumList, nodeDecoder); err != nil { - return err - } - - case strings.EqualFold("flattenedList", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentRenamedListMembersUnwrapped(&sv.FlattenedList, nodeDecoder); err != nil { + case strings.EqualFold("intEnum1", t.Name.Local): + val, err := decoder.Value() + if err != nil { return err } - - case strings.EqualFold("customName", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentRenamedListMembersUnwrapped(&sv.FlattenedList2, nodeDecoder); err != nil { - return err + if val == nil { + break } - - case strings.EqualFold("flattenedListWithMemberNamespace", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentListWithMemberNamespaceUnwrapped(&sv.FlattenedListWithMemberNamespace, nodeDecoder); err != nil { - return err + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum1 = int32(i64) } - case strings.EqualFold("flattenedListWithNamespace", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentListWithNamespaceUnwrapped(&sv.FlattenedListWithNamespace, nodeDecoder); err != nil { + case strings.EqualFold("intEnum2", t.Name.Local): + val, err := decoder.Value() + if err != nil { return err } - - case strings.EqualFold("flattenedStructureList", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentStructureListUnwrapped(&sv.FlattenedStructureList, nodeDecoder); err != nil { - return err + if val == nil { + break } - - case strings.EqualFold("integerList", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentIntegerList(&sv.IntegerList, nodeDecoder); err != nil { - return err + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum2 = int32(i64) } - case strings.EqualFold("nestedStringList", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentNestedStringList(&sv.NestedStringList, nodeDecoder); err != nil { + case strings.EqualFold("intEnum3", t.Name.Local): + val, err := decoder.Value() + if err != nil { return err } - - case strings.EqualFold("renamed", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentRenamedListMembers(&sv.RenamedListMembers, nodeDecoder); err != nil { - return err + if val == nil { + break } - - case strings.EqualFold("stringList", t.Name.Local): - nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentStringList(&sv.StringList, nodeDecoder); err != nil { - return err + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.IntEnum3 = int32(i64) } - case strings.EqualFold("stringSet", t.Name.Local): + case strings.EqualFold("intEnumList", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentStringSet(&sv.StringSet, nodeDecoder); err != nil { + if err := awsRestxml_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { return err } - case strings.EqualFold("myStructureList", t.Name.Local): + case strings.EqualFold("intEnumMap", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentStructureList(&sv.StructureList, nodeDecoder); err != nil { + if err := awsRestxml_deserializeDocumentIntegerEnumMap(&sv.IntEnumMap, nodeDecoder); err != nil { return err } - case strings.EqualFold("timestampList", t.Name.Local): + case strings.EqualFold("intEnumSet", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) - if err := awsRestxml_deserializeDocumentTimestampList(&sv.TimestampList, nodeDecoder); err != nil { + if err := awsRestxml_deserializeDocumentIntegerEnumSet(&sv.IntEnumSet, nodeDecoder); err != nil { return err } @@ -5670,14 +5806,14 @@ func awsRestxml_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder return nil } -type awsRestxml_deserializeOpXmlMaps struct { +type awsRestxml_deserializeOpXmlLists struct { } -func (*awsRestxml_deserializeOpXmlMaps) ID() string { +func (*awsRestxml_deserializeOpXmlLists) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlMaps) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpXmlLists) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { out, metadata, err = next.HandleDeserialize(ctx, in) @@ -5691,9 +5827,9 @@ func (m *awsRestxml_deserializeOpXmlMaps) HandleDeserialize(ctx context.Context, } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestxml_deserializeOpErrorXmlMaps(response, &metadata) + return out, metadata, awsRestxml_deserializeOpErrorXmlLists(response, &metadata) } - output := &XmlMapsOutput{} + output := &XmlListsOutput{} out.Result = output var buff [1024]byte @@ -5714,7 +5850,7 @@ func (m *awsRestxml_deserializeOpXmlMaps) HandleDeserialize(ctx context.Context, } decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) - err = awsRestxml_deserializeOpDocumentXmlMapsOutput(&output, decoder) + err = awsRestxml_deserializeOpDocumentXmlListsOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -5727,7 +5863,7 @@ func (m *awsRestxml_deserializeOpXmlMaps) HandleDeserialize(ctx context.Context, return out, metadata, err } -func awsRestxml_deserializeOpErrorXmlMaps(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestxml_deserializeOpErrorXmlLists(response *smithyhttp.Response, metadata *middleware.Metadata) error { var errorBuffer bytes.Buffer if _, err := io.Copy(&errorBuffer, response.Body); err != nil { return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} @@ -5762,13 +5898,13 @@ func awsRestxml_deserializeOpErrorXmlMaps(response *smithyhttp.Response, metadat } } -func awsRestxml_deserializeOpDocumentXmlMapsOutput(v **XmlMapsOutput, decoder smithyxml.NodeDecoder) error { +func awsRestxml_deserializeOpDocumentXmlListsOutput(v **XmlListsOutput, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } - var sv *XmlMapsOutput + var sv *XmlListsOutput if *v == nil { - sv = &XmlMapsOutput{} + sv = &XmlListsOutput{} } else { sv = *v } @@ -5784,7 +5920,225 @@ func awsRestxml_deserializeOpDocumentXmlMapsOutput(v **XmlMapsOutput, decoder sm originalDecoder := decoder decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) switch { - case strings.EqualFold("myMap", t.Name.Local): + case strings.EqualFold("booleanList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentBooleanList(&sv.BooleanList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("enumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentFooEnumList(&sv.EnumList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("flattenedList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentRenamedListMembersUnwrapped(&sv.FlattenedList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("customName", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentRenamedListMembersUnwrapped(&sv.FlattenedList2, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("flattenedListWithMemberNamespace", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentListWithMemberNamespaceUnwrapped(&sv.FlattenedListWithMemberNamespace, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("flattenedListWithNamespace", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentListWithNamespaceUnwrapped(&sv.FlattenedListWithNamespace, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("flattenedStructureList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentStructureListUnwrapped(&sv.FlattenedStructureList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("integerList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentIntegerList(&sv.IntegerList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("intEnumList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentIntegerEnumList(&sv.IntEnumList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("nestedStringList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentNestedStringList(&sv.NestedStringList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("renamed", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentRenamedListMembers(&sv.RenamedListMembers, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("stringList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentStringList(&sv.StringList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("stringSet", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentStringSet(&sv.StringSet, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("myStructureList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentStructureList(&sv.StructureList, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("timestampList", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentTimestampList(&sv.TimestampList, nodeDecoder); err != nil { + return err + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +type awsRestxml_deserializeOpXmlMaps struct { +} + +func (*awsRestxml_deserializeOpXmlMaps) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpXmlMaps) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestxml_deserializeOpErrorXmlMaps(response, &metadata) + } + output := &XmlMapsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + body := io.TeeReader(response.Body, ringBuffer) + rootDecoder := xml.NewDecoder(body) + t, err := smithyxml.FetchRootElement(rootDecoder) + if err == io.EOF { + return out, metadata, nil + } + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + decoder := smithyxml.WrapNodeDecoder(rootDecoder, t) + err = awsRestxml_deserializeOpDocumentXmlMapsOutput(&output, decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestxml_deserializeOpErrorXmlMaps(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + errorComponents, err := awsxml.GetErrorResponseComponents(errorBody, false) + if err != nil { + return err + } + if reqID := errorComponents.RequestID; len(reqID) != 0 { + awsmiddleware.SetRequestIDMetadata(metadata, reqID) + } + if len(errorComponents.Code) != 0 { + errorCode = errorComponents.Code + } + if len(errorComponents.Message) != 0 { + errorMessage = errorComponents.Message + } + errorBody.Seek(0, io.SeekStart) + switch { + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestxml_deserializeOpDocumentXmlMapsOutput(v **XmlMapsOutput, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *XmlMapsOutput + if *v == nil { + sv = &XmlMapsOutput{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("myMap", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) if err := awsRestxml_deserializeDocumentXmlMapsInputOutputMap(&sv.MyMap, nodeDecoder); err != nil { return err @@ -6203,6 +6557,23 @@ func awsRestxml_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutput sv.DateTime = ptr.Time(t) } + case strings.EqualFold("dateTimeOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseDateTime(xtv) + if err != nil { + return err + } + sv.DateTimeOnTarget = ptr.Time(t) + } + case strings.EqualFold("epochSeconds", t.Name.Local): val, err := decoder.Value() if err != nil { @@ -6220,7 +6591,41 @@ func awsRestxml_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutput sv.EpochSeconds = ptr.Time(smithytime.ParseEpochSeconds(f64)) } - case strings.EqualFold("httpDate", t.Name.Local): + case strings.EqualFold("epochSecondsOnTarget", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + f64, err := strconv.ParseFloat(xtv, 64) + if err != nil { + return err + } + sv.EpochSecondsOnTarget = ptr.Time(smithytime.ParseEpochSeconds(f64)) + } + + case strings.EqualFold("httpDate", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + t, err := smithytime.ParseHTTPDate(xtv) + if err != nil { + return err + } + sv.HttpDate = ptr.Time(t) + } + + case strings.EqualFold("httpDateOnTarget", t.Name.Local): val, err := decoder.Value() if err != nil { return err @@ -6234,7 +6639,7 @@ func awsRestxml_deserializeOpDocumentXmlTimestampsOutput(v **XmlTimestampsOutput if err != nil { return err } - sv.HttpDate = ptr.Time(t) + sv.HttpDateOnTarget = ptr.Time(t) } case strings.EqualFold("normal", t.Name.Local): @@ -8804,6 +9209,284 @@ func awsRestxml_deserializeDocumentGreetingStruct(v **types.GreetingStruct, deco return nil } +func awsRestxml_deserializeDocumentIntegerEnumList(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []types.IntegerEnum + if *v == nil { + sv = make([]types.IntegerEnum, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col types.IntegerEnum + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + col = int32(i64) + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsRestxml_deserializeDocumentIntegerEnumListUnwrapped(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv []types.IntegerEnum + if *v == nil { + sv = make([]types.IntegerEnum, 0) + } else { + sv = *v + } + + switch { + default: + var mv types.IntegerEnum + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + mv = int32(i64) + } + sv = append(sv, mv) + } + *v = sv + return nil +} +func awsRestxml_deserializeDocumentIntegerEnumMap(v *map[string]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv map[string]types.IntegerEnum + if *v == nil { + sv = make(map[string]types.IntegerEnum, 0) + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + switch { + case strings.EqualFold("entry", t.Name.Local): + entryDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentIntegerEnumMapUnwrapped(&sv, entryDecoder); err != nil { + return err + } + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + } + *v = sv + return nil +} + +func awsRestxml_deserializeDocumentIntegerEnumMapUnwrapped(v *map[string]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv map[string]types.IntegerEnum + if *v == nil { + sv = make(map[string]types.IntegerEnum, 0) + } else { + sv = *v + } + + var ek string + var ev types.IntegerEnum + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + sv[ek] = ev + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("key", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + ek = xtv + } + + case strings.EqualFold("value", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + ev = int32(i64) + } + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} +func awsRestxml_deserializeDocumentIntegerEnumSet(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []types.IntegerEnum + if *v == nil { + sv = make([]types.IntegerEnum, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col types.IntegerEnum + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + col = int32(i64) + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsRestxml_deserializeDocumentIntegerEnumSetUnwrapped(v *[]types.IntegerEnum, decoder smithyxml.NodeDecoder) error { + var sv []types.IntegerEnum + if *v == nil { + sv = make([]types.IntegerEnum, 0) + } else { + sv = *v + } + + switch { + default: + var mv types.IntegerEnum + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + mv = int32(i64) + } + sv = append(sv, mv) + } + *v = sv + return nil +} func awsRestxml_deserializeDocumentIntegerList(v *[]int32, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/internal/protocoltest/restxml/generated.json b/internal/protocoltest/restxml/generated.json index df2805b90b3..04d6f8566c8 100644 --- a/internal/protocoltest/restxml/generated.json +++ b/internal/protocoltest/restxml/generated.json @@ -17,6 +17,8 @@ "api_op_ConstantAndVariableQueryString_test.go", "api_op_ConstantQueryString.go", "api_op_ConstantQueryString_test.go", + "api_op_DatetimeOffsets.go", + "api_op_DatetimeOffsets_test.go", "api_op_EmptyInputAndEmptyOutput.go", "api_op_EmptyInputAndEmptyOutput_test.go", "api_op_EndpointOperation.go", @@ -102,6 +104,8 @@ "api_op_XmlEmptyStrings_test.go", "api_op_XmlEnums.go", "api_op_XmlEnums_test.go", + "api_op_XmlIntEnums.go", + "api_op_XmlIntEnums_test.go", "api_op_XmlLists.go", "api_op_XmlLists_test.go", "api_op_XmlMaps.go", diff --git a/internal/protocoltest/restxml/serializers.go b/internal/protocoltest/restxml/serializers.go index 4a48ff28ebf..165968d66ba 100644 --- a/internal/protocoltest/restxml/serializers.go +++ b/internal/protocoltest/restxml/serializers.go @@ -108,6 +108,16 @@ func awsRestxml_serializeOpHttpBindingsAllQueryStringTypesInput(v *AllQueryStrin encoder.SetQuery("Integer").Integer(*v.QueryInteger) } + if v.QueryIntegerEnum != 0 { + encoder.SetQuery("IntegerEnum").Integer(v.QueryIntegerEnum) + } + + if v.QueryIntegerEnumList != nil { + for i := range v.QueryIntegerEnumList { + encoder.AddQuery("IntegerEnumList").Integer(v.QueryIntegerEnumList[i]) + } + } + if v.QueryIntegerList != nil { for i := range v.QueryIntegerList { encoder.AddQuery("IntegerList").Integer(v.QueryIntegerList[i]) @@ -361,6 +371,51 @@ func awsRestxml_serializeOpHttpBindingsConstantQueryStringInput(v *ConstantQuery return nil } +type awsRestxml_serializeOpDatetimeOffsets struct { +} + +func (*awsRestxml_serializeOpDatetimeOffsets) ID() string { + return "OperationSerializer" +} + +func (m *awsRestxml_serializeOpDatetimeOffsets) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DatetimeOffsetsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/DatetimeOffsets") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestxml_serializeOpHttpBindingsDatetimeOffsetsInput(v *DatetimeOffsetsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + type awsRestxml_serializeOpEmptyInputAndEmptyOutput struct { } @@ -3405,6 +3460,19 @@ func awsRestxml_serializeOpDocumentXmlEmptyListsInput(v *XmlEmptyListsInput, val return err } } + if v.IntEnumList != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnumList", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentIntegerEnumList(v.IntEnumList, el); err != nil { + return err + } + } if v.NestedStringList != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ @@ -3783,6 +3851,145 @@ func awsRestxml_serializeOpDocumentXmlEnumsInput(v *XmlEnumsInput, value smithyx return nil } +type awsRestxml_serializeOpXmlIntEnums struct { +} + +func (*awsRestxml_serializeOpXmlIntEnums) ID() string { + return "OperationSerializer" +} + +func (m *awsRestxml_serializeOpXmlIntEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*XmlIntEnumsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/XmlIntEnums") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/xml") + + xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "XmlIntEnumsInputOutput", + }, + Attr: rootAttr, + } + if err := awsRestxml_serializeOpDocumentXmlIntEnumsInput(input, xmlEncoder.RootElement(root)); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestxml_serializeOpHttpBindingsXmlIntEnumsInput(v *XmlIntEnumsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestxml_serializeOpDocumentXmlIntEnumsInput(v *XmlIntEnumsInput, value smithyxml.Value) error { + defer value.Close() + if v.IntEnum1 != 0 { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnum1", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.Integer(v.IntEnum1) + } + if v.IntEnum2 != 0 { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnum2", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.Integer(v.IntEnum2) + } + if v.IntEnum3 != 0 { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnum3", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.Integer(v.IntEnum3) + } + if v.IntEnumList != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnumList", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentIntegerEnumList(v.IntEnumList, el); err != nil { + return err + } + } + if v.IntEnumMap != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnumMap", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentIntegerEnumMap(v.IntEnumMap, el); err != nil { + return err + } + } + if v.IntEnumSet != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnumSet", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentIntegerEnumSet(v.IntEnumSet, el); err != nil { + return err + } + } + return nil +} + type awsRestxml_serializeOpXmlLists struct { } @@ -3951,6 +4158,19 @@ func awsRestxml_serializeOpDocumentXmlListsInput(v *XmlListsInput, value smithyx return err } } + if v.IntEnumList != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "intEnumList", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentIntegerEnumList(v.IntEnumList, el); err != nil { + return err + } + } if v.NestedStringList != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ @@ -4348,6 +4568,17 @@ func awsRestxml_serializeOpDocumentXmlTimestampsInput(v *XmlTimestampsInput, val el := value.MemberElement(root) el.String(smithytime.FormatDateTime(*v.DateTime)) } + if v.DateTimeOnTarget != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "dateTimeOnTarget", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.String(smithytime.FormatDateTime(*v.DateTimeOnTarget)) + } if v.EpochSeconds != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ @@ -4359,6 +4590,17 @@ func awsRestxml_serializeOpDocumentXmlTimestampsInput(v *XmlTimestampsInput, val el := value.MemberElement(root) el.Double(smithytime.FormatEpochSeconds(*v.EpochSeconds)) } + if v.EpochSecondsOnTarget != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "epochSecondsOnTarget", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.Double(smithytime.FormatEpochSeconds(*v.EpochSecondsOnTarget)) + } if v.HttpDate != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ @@ -4370,6 +4612,17 @@ func awsRestxml_serializeOpDocumentXmlTimestampsInput(v *XmlTimestampsInput, val el := value.MemberElement(root) el.String(smithytime.FormatHTTPDate(*v.HttpDate)) } + if v.HttpDateOnTarget != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "httpDateOnTarget", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.String(smithytime.FormatHTTPDate(*v.HttpDateOnTarget)) + } if v.Normal != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ @@ -5244,6 +5497,60 @@ func awsRestxml_serializeDocumentGreetingStruct(v *types.GreetingStruct, value s return nil } +func awsRestxml_serializeDocumentIntegerEnumList(v []types.IntegerEnum, value smithyxml.Value) error { + var array *smithyxml.Array + if !value.IsFlattened() { + defer value.Close() + } + array = value.Array() + for i := range v { + am := array.Member() + am.Integer(v[i]) + } + return nil +} + +func awsRestxml_serializeDocumentIntegerEnumMap(v map[string]types.IntegerEnum, value smithyxml.Value) error { + if !value.IsFlattened() { + defer value.Close() + } + m := value.Map() + for key := range v { + entry := m.Entry() + keyElementAttr := []smithyxml.Attr{} + keyElement := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "key", + }, + Attr: keyElementAttr, + } + entry.MemberElement(keyElement).String(key) + valueElementAttr := []smithyxml.Attr{} + valueElement := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "value", + }, + Attr: valueElementAttr, + } + entry.MemberElement(valueElement).Integer(v[key]) + entry.Close() + } + return nil +} + +func awsRestxml_serializeDocumentIntegerEnumSet(v []types.IntegerEnum, value smithyxml.Value) error { + var array *smithyxml.Array + if !value.IsFlattened() { + defer value.Close() + } + array = value.Array() + for i := range v { + am := array.Member() + am.Integer(v[i]) + } + return nil +} + func awsRestxml_serializeDocumentIntegerList(v []int32, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { diff --git a/internal/protocoltest/restxml/types/enums.go b/internal/protocoltest/restxml/types/enums.go index a0088b218b8..6652e863c7a 100644 --- a/internal/protocoltest/restxml/types/enums.go +++ b/internal/protocoltest/restxml/types/enums.go @@ -25,3 +25,12 @@ func (FooEnum) Values() []FooEnum { "0", } } + +type IntegerEnum = int32 + +// Enum values for IntegerEnum +const ( + IntegerEnumA IntegerEnum = 1 + IntegerEnumB IntegerEnum = 2 + IntegerEnumC IntegerEnum = 3 +) diff --git a/service/autoscaling/serializers.go b/service/autoscaling/serializers.go index cebc3013e31..0c78ad3f172 100644 --- a/service/autoscaling/serializers.go +++ b/service/autoscaling/serializers.go @@ -4102,9 +4102,6 @@ func awsAwsquery_serializeDocumentAcceleratorCountRequest(v *types.AcceleratorCo } func awsAwsquery_serializeDocumentAcceleratorManufacturers(v []types.AcceleratorManufacturer, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4115,9 +4112,6 @@ func awsAwsquery_serializeDocumentAcceleratorManufacturers(v []types.Accelerator } func awsAwsquery_serializeDocumentAcceleratorNames(v []types.AcceleratorName, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4145,9 +4139,6 @@ func awsAwsquery_serializeDocumentAcceleratorTotalMemoryMiBRequest(v *types.Acce } func awsAwsquery_serializeDocumentAcceleratorTypes(v []types.AcceleratorType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4158,9 +4149,6 @@ func awsAwsquery_serializeDocumentAcceleratorTypes(v []types.AcceleratorType, va } func awsAwsquery_serializeDocumentActivityIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4171,9 +4159,6 @@ func awsAwsquery_serializeDocumentActivityIds(v []string, value query.Value) err } func awsAwsquery_serializeDocumentAllowedInstanceTypes(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4184,9 +4169,6 @@ func awsAwsquery_serializeDocumentAllowedInstanceTypes(v []string, value query.V } func awsAwsquery_serializeDocumentAutoScalingGroupNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4197,9 +4179,6 @@ func awsAwsquery_serializeDocumentAutoScalingGroupNames(v []string, value query. } func awsAwsquery_serializeDocumentAutoScalingNotificationTypes(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4210,9 +4189,6 @@ func awsAwsquery_serializeDocumentAutoScalingNotificationTypes(v []string, value } func awsAwsquery_serializeDocumentAvailabilityZones(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4269,9 +4245,6 @@ func awsAwsquery_serializeDocumentBlockDeviceMapping(v *types.BlockDeviceMapping } func awsAwsquery_serializeDocumentBlockDeviceMappings(v []types.BlockDeviceMapping, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4284,9 +4257,6 @@ func awsAwsquery_serializeDocumentBlockDeviceMappings(v []types.BlockDeviceMappi } func awsAwsquery_serializeDocumentCheckpointPercentages(v []int32, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4297,9 +4267,6 @@ func awsAwsquery_serializeDocumentCheckpointPercentages(v []int32, value query.V } func awsAwsquery_serializeDocumentClassicLinkVPCSecurityGroups(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4310,9 +4277,6 @@ func awsAwsquery_serializeDocumentClassicLinkVPCSecurityGroups(v []string, value } func awsAwsquery_serializeDocumentCpuManufacturers(v []types.CpuManufacturer, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4427,9 +4391,6 @@ func awsAwsquery_serializeDocumentEbs(v *types.Ebs, value query.Value) error { } func awsAwsquery_serializeDocumentExcludedInstanceTypes(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4459,9 +4420,6 @@ func awsAwsquery_serializeDocumentFilter(v *types.Filter, value query.Value) err } func awsAwsquery_serializeDocumentFilters(v []types.Filter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4474,9 +4432,6 @@ func awsAwsquery_serializeDocumentFilters(v []types.Filter, value query.Value) e } func awsAwsquery_serializeDocumentInstanceGenerations(v []types.InstanceGeneration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4487,9 +4442,6 @@ func awsAwsquery_serializeDocumentInstanceGenerations(v []types.InstanceGenerati } func awsAwsquery_serializeDocumentInstanceIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4534,9 +4486,6 @@ func awsAwsquery_serializeDocumentInstanceMonitoring(v *types.InstanceMonitoring } func awsAwsquery_serializeDocumentInstanceRefreshIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4752,9 +4701,6 @@ func awsAwsquery_serializeDocumentInstancesDistribution(v *types.InstancesDistri } func awsAwsquery_serializeDocumentLaunchConfigurationNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4839,9 +4785,6 @@ func awsAwsquery_serializeDocumentLaunchTemplateSpecification(v *types.LaunchTem } func awsAwsquery_serializeDocumentLifecycleHookNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4894,9 +4837,6 @@ func awsAwsquery_serializeDocumentLifecycleHookSpecification(v *types.LifecycleH } func awsAwsquery_serializeDocumentLifecycleHookSpecifications(v []types.LifecycleHookSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4909,9 +4849,6 @@ func awsAwsquery_serializeDocumentLifecycleHookSpecifications(v []types.Lifecycl } func awsAwsquery_serializeDocumentLoadBalancerNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4922,9 +4859,6 @@ func awsAwsquery_serializeDocumentLoadBalancerNames(v []string, value query.Valu } func awsAwsquery_serializeDocumentLocalStorageTypes(v []types.LocalStorageType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5019,9 +4953,6 @@ func awsAwsquery_serializeDocumentMetric(v *types.Metric, value query.Value) err } func awsAwsquery_serializeDocumentMetricDataQueries(v []types.MetricDataQuery, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5085,9 +5016,6 @@ func awsAwsquery_serializeDocumentMetricDimension(v *types.MetricDimension, valu } func awsAwsquery_serializeDocumentMetricDimensions(v []types.MetricDimension, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5100,9 +5028,6 @@ func awsAwsquery_serializeDocumentMetricDimensions(v []types.MetricDimension, va } func awsAwsquery_serializeDocumentMetrics(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5218,9 +5143,6 @@ func awsAwsquery_serializeDocumentNetworkInterfaceCountRequest(v *types.NetworkI } func awsAwsquery_serializeDocumentOverrides(v []types.LaunchTemplateOverrides, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5233,9 +5155,6 @@ func awsAwsquery_serializeDocumentOverrides(v []types.LaunchTemplateOverrides, v } func awsAwsquery_serializeDocumentPolicyNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5246,9 +5165,6 @@ func awsAwsquery_serializeDocumentPolicyNames(v []string, value query.Value) err } func awsAwsquery_serializeDocumentPolicyTypes(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5419,9 +5335,6 @@ func awsAwsquery_serializeDocumentPredictiveScalingMetricSpecification(v *types. } func awsAwsquery_serializeDocumentPredictiveScalingMetricSpecifications(v []types.PredictiveScalingMetricSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5485,9 +5398,6 @@ func awsAwsquery_serializeDocumentPredictiveScalingPredefinedScalingMetric(v *ty } func awsAwsquery_serializeDocumentProcessNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5532,9 +5442,6 @@ func awsAwsquery_serializeDocumentRefreshPreferences(v *types.RefreshPreferences } func awsAwsquery_serializeDocumentScheduledActionNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5592,9 +5499,6 @@ func awsAwsquery_serializeDocumentScheduledUpdateGroupActionRequest(v *types.Sch } func awsAwsquery_serializeDocumentScheduledUpdateGroupActionRequests(v []types.ScheduledUpdateGroupActionRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5607,9 +5511,6 @@ func awsAwsquery_serializeDocumentScheduledUpdateGroupActionRequests(v []types.S } func awsAwsquery_serializeDocumentSecurityGroups(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5668,9 +5569,6 @@ func awsAwsquery_serializeDocumentStepAdjustment(v *types.StepAdjustment, value } func awsAwsquery_serializeDocumentStepAdjustments(v []types.StepAdjustment, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5715,9 +5613,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTags(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5730,9 +5625,6 @@ func awsAwsquery_serializeDocumentTags(v []types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTargetGroupARNs(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5787,9 +5679,6 @@ func awsAwsquery_serializeDocumentTargetTrackingConfiguration(v *types.TargetTra } func awsAwsquery_serializeDocumentTargetTrackingMetricDataQueries(v []types.TargetTrackingMetricDataQuery, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5860,9 +5749,6 @@ func awsAwsquery_serializeDocumentTargetTrackingMetricStat(v *types.TargetTracki } func awsAwsquery_serializeDocumentTerminationPolicies(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5928,9 +5814,6 @@ func awsAwsquery_serializeDocumentTrafficSourceIdentifier(v *types.TrafficSource } func awsAwsquery_serializeDocumentTrafficSources(v []types.TrafficSourceIdentifier, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5943,9 +5826,6 @@ func awsAwsquery_serializeDocumentTrafficSources(v []types.TrafficSourceIdentifi } func awsAwsquery_serializeDocumentValues(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/cloudformation/serializers.go b/service/cloudformation/serializers.go index c8533d69612..e9272eb1a1d 100644 --- a/service/cloudformation/serializers.go +++ b/service/cloudformation/serializers.go @@ -4240,9 +4240,6 @@ func (m *awsAwsquery_serializeOpValidateTemplate) HandleSerialize(ctx context.Co return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentAccountList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4270,9 +4267,6 @@ func awsAwsquery_serializeDocumentAutoDeployment(v *types.AutoDeployment, value } func awsAwsquery_serializeDocumentCapabilities(v []types.Capability, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4331,9 +4325,6 @@ func awsAwsquery_serializeDocumentLoggingConfig(v *types.LoggingConfig, value qu } func awsAwsquery_serializeDocumentLogicalResourceIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4356,9 +4347,6 @@ func awsAwsquery_serializeDocumentManagedExecution(v *types.ManagedExecution, va } func awsAwsquery_serializeDocumentNotificationARNs(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4386,9 +4374,6 @@ func awsAwsquery_serializeDocumentOperationResultFilter(v *types.OperationResult } func awsAwsquery_serializeDocumentOperationResultFilters(v []types.OperationResultFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4401,9 +4386,6 @@ func awsAwsquery_serializeDocumentOperationResultFilters(v []types.OperationResu } func awsAwsquery_serializeDocumentOrganizationalUnitIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4441,9 +4423,6 @@ func awsAwsquery_serializeDocumentParameter(v *types.Parameter, value query.Valu } func awsAwsquery_serializeDocumentParameters(v []types.Parameter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4456,9 +4435,6 @@ func awsAwsquery_serializeDocumentParameters(v []types.Parameter, value query.Va } func awsAwsquery_serializeDocumentRegionList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4488,9 +4464,6 @@ func awsAwsquery_serializeDocumentResourceIdentifierProperties(v map[string]stri } func awsAwsquery_serializeDocumentResourcesToImport(v []types.ResourceToImport, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4503,9 +4476,6 @@ func awsAwsquery_serializeDocumentResourcesToImport(v []types.ResourceToImport, } func awsAwsquery_serializeDocumentResourcesToSkip(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4540,9 +4510,6 @@ func awsAwsquery_serializeDocumentResourceToImport(v *types.ResourceToImport, va } func awsAwsquery_serializeDocumentResourceTypes(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4553,9 +4520,6 @@ func awsAwsquery_serializeDocumentResourceTypes(v []string, value query.Value) e } func awsAwsquery_serializeDocumentRetainResources(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4602,9 +4566,6 @@ func awsAwsquery_serializeDocumentRollbackTrigger(v *types.RollbackTrigger, valu } func awsAwsquery_serializeDocumentRollbackTriggers(v []types.RollbackTrigger, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4617,9 +4578,6 @@ func awsAwsquery_serializeDocumentRollbackTriggers(v []types.RollbackTrigger, va } func awsAwsquery_serializeDocumentStackIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4647,9 +4605,6 @@ func awsAwsquery_serializeDocumentStackInstanceFilter(v *types.StackInstanceFilt } func awsAwsquery_serializeDocumentStackInstanceFilters(v []types.StackInstanceFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4662,9 +4617,6 @@ func awsAwsquery_serializeDocumentStackInstanceFilters(v []types.StackInstanceFi } func awsAwsquery_serializeDocumentStackResourceDriftStatusFilters(v []types.StackResourceDriftStatus, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4714,9 +4666,6 @@ func awsAwsquery_serializeDocumentStackSetOperationPreferences(v *types.StackSet } func awsAwsquery_serializeDocumentStackStatusFilter(v []types.StackStatus, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4744,9 +4693,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTags(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4791,9 +4737,6 @@ func awsAwsquery_serializeDocumentTypeConfigurationIdentifier(v *types.TypeConfi } func awsAwsquery_serializeDocumentTypeConfigurationIdentifiers(v []types.TypeConfigurationIdentifier, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/cloudsearch/serializers.go b/service/cloudsearch/serializers.go index 680d7cec79f..3e2ec1fa289 100644 --- a/service/cloudsearch/serializers.go +++ b/service/cloudsearch/serializers.go @@ -1840,9 +1840,6 @@ func awsAwsquery_serializeDocumentDomainEndpointOptions(v *types.DomainEndpointO } func awsAwsquery_serializeDocumentDomainNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1948,9 +1945,6 @@ func awsAwsquery_serializeDocumentDoubleOptions(v *types.DoubleOptions, value qu } func awsAwsquery_serializeDocumentDynamicFieldNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2269,9 +2263,6 @@ func awsAwsquery_serializeDocumentScalingParameters(v *types.ScalingParameters, } func awsAwsquery_serializeDocumentStandardNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/cloudwatch/serializers.go b/service/cloudwatch/serializers.go index 3f73228eaf5..24a07c01829 100644 --- a/service/cloudwatch/serializers.go +++ b/service/cloudwatch/serializers.go @@ -2449,9 +2449,6 @@ func (m *awsAwsquery_serializeOpUntagResource) HandleSerialize(ctx context.Conte return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentAlarmNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2462,9 +2459,6 @@ func awsAwsquery_serializeDocumentAlarmNames(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentAlarmTypes(v []types.AlarmType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2494,9 +2488,6 @@ func awsAwsquery_serializeDocumentAnomalyDetectorConfiguration(v *types.AnomalyD } func awsAwsquery_serializeDocumentAnomalyDetectorExcludedTimeRanges(v []types.Range, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2509,9 +2500,6 @@ func awsAwsquery_serializeDocumentAnomalyDetectorExcludedTimeRanges(v []types.Ra } func awsAwsquery_serializeDocumentAnomalyDetectorTypes(v []types.AnomalyDetectorType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2522,9 +2510,6 @@ func awsAwsquery_serializeDocumentAnomalyDetectorTypes(v []types.AnomalyDetector } func awsAwsquery_serializeDocumentCounts(v []float64, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2548,9 +2533,6 @@ func awsAwsquery_serializeDocumentCounts(v []float64, value query.Value) error { } func awsAwsquery_serializeDocumentDashboardNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2595,9 +2577,6 @@ func awsAwsquery_serializeDocumentDimensionFilter(v *types.DimensionFilter, valu } func awsAwsquery_serializeDocumentDimensionFilters(v []types.DimensionFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2610,9 +2589,6 @@ func awsAwsquery_serializeDocumentDimensionFilters(v []types.DimensionFilter, va } func awsAwsquery_serializeDocumentDimensions(v []types.Dimension, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2625,9 +2601,6 @@ func awsAwsquery_serializeDocumentDimensions(v []types.Dimension, value query.Va } func awsAwsquery_serializeDocumentExtendedStatistics(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2638,9 +2611,6 @@ func awsAwsquery_serializeDocumentExtendedStatistics(v []string, value query.Val } func awsAwsquery_serializeDocumentInsightRuleMetricList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2651,9 +2621,6 @@ func awsAwsquery_serializeDocumentInsightRuleMetricList(v []string, value query. } func awsAwsquery_serializeDocumentInsightRuleNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2700,9 +2667,6 @@ func awsAwsquery_serializeDocumentManagedRule(v *types.ManagedRule, value query. } func awsAwsquery_serializeDocumentManagedRules(v []types.ManagedRule, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2739,9 +2703,6 @@ func awsAwsquery_serializeDocumentMetric(v *types.Metric, value query.Value) err } func awsAwsquery_serializeDocumentMetricData(v []types.MetricDatum, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2754,9 +2715,6 @@ func awsAwsquery_serializeDocumentMetricData(v []types.MetricDatum, value query. } func awsAwsquery_serializeDocumentMetricDataQueries(v []types.MetricDataQuery, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2941,9 +2899,6 @@ func awsAwsquery_serializeDocumentMetricStreamFilter(v *types.MetricStreamFilter } func awsAwsquery_serializeDocumentMetricStreamFilters(v []types.MetricStreamFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2956,9 +2911,6 @@ func awsAwsquery_serializeDocumentMetricStreamFilters(v []types.MetricStreamFilt } func awsAwsquery_serializeDocumentMetricStreamNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2969,9 +2921,6 @@ func awsAwsquery_serializeDocumentMetricStreamNames(v []string, value query.Valu } func awsAwsquery_serializeDocumentMetricStreamStatisticsAdditionalStatistics(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3003,9 +2952,6 @@ func awsAwsquery_serializeDocumentMetricStreamStatisticsConfiguration(v *types.M } func awsAwsquery_serializeDocumentMetricStreamStatisticsConfigurations(v []types.MetricStreamStatisticsConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3018,9 +2964,6 @@ func awsAwsquery_serializeDocumentMetricStreamStatisticsConfigurations(v []types } func awsAwsquery_serializeDocumentMetricStreamStatisticsIncludeMetrics(v []types.MetricStreamStatisticsMetric, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3067,9 +3010,6 @@ func awsAwsquery_serializeDocumentRange(v *types.Range, value query.Value) error } func awsAwsquery_serializeDocumentResourceList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3109,9 +3049,6 @@ func awsAwsquery_serializeDocumentSingleMetricAnomalyDetector(v *types.SingleMet } func awsAwsquery_serializeDocumentStatistics(v []types.Statistic, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3218,9 +3155,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3231,9 +3165,6 @@ func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3246,9 +3177,6 @@ func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) erro } func awsAwsquery_serializeDocumentValues(v []float64, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/docdb/serializers.go b/service/docdb/serializers.go index cc25d9a5d87..24bdb114e48 100644 --- a/service/docdb/serializers.go +++ b/service/docdb/serializers.go @@ -3408,9 +3408,6 @@ func (m *awsAwsquery_serializeOpStopDBCluster) HandleSerialize(ctx context.Conte return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentAttributeValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AttributeValue") for i := range v { @@ -3421,9 +3418,6 @@ func awsAwsquery_serializeDocumentAttributeValueList(v []string, value query.Val } func awsAwsquery_serializeDocumentAvailabilityZones(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AvailabilityZone") for i := range v { @@ -3455,9 +3449,6 @@ func awsAwsquery_serializeDocumentCloudwatchLogsExportConfiguration(v *types.Clo } func awsAwsquery_serializeDocumentEventCategoriesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("EventCategory") for i := range v { @@ -3487,9 +3478,6 @@ func awsAwsquery_serializeDocumentFilter(v *types.Filter, value query.Value) err } func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Filter") for i := range v { @@ -3502,9 +3490,6 @@ func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value } func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Value") for i := range v { @@ -3515,9 +3500,6 @@ func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) } func awsAwsquery_serializeDocumentKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3528,9 +3510,6 @@ func awsAwsquery_serializeDocumentKeyList(v []string, value query.Value) error { } func awsAwsquery_serializeDocumentLogTypeList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3598,9 +3577,6 @@ func awsAwsquery_serializeDocumentParameter(v *types.Parameter, value query.Valu } func awsAwsquery_serializeDocumentParametersList(v []types.Parameter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Parameter") for i := range v { @@ -3613,9 +3589,6 @@ func awsAwsquery_serializeDocumentParametersList(v []types.Parameter, value quer } func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SourceId") for i := range v { @@ -3626,9 +3599,6 @@ func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) e } func awsAwsquery_serializeDocumentSubnetIdentifierList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SubnetIdentifier") for i := range v { @@ -3656,9 +3626,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Tag") for i := range v { @@ -3671,9 +3638,6 @@ func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) erro } func awsAwsquery_serializeDocumentVpcSecurityGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpcSecurityGroupId") for i := range v { diff --git a/service/ec2/serializers.go b/service/ec2/serializers.go index faf61fda1ec..7d019214006 100644 --- a/service/ec2/serializers.go +++ b/service/ec2/serializers.go @@ -37747,9 +37747,6 @@ func awsEc2query_serializeDocumentAcceleratorCountRequest(v *types.AcceleratorCo } func awsEc2query_serializeDocumentAcceleratorManufacturerSet(v []types.AcceleratorManufacturer, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -37760,9 +37757,6 @@ func awsEc2query_serializeDocumentAcceleratorManufacturerSet(v []types.Accelerat } func awsEc2query_serializeDocumentAcceleratorNameSet(v []types.AcceleratorName, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -37807,9 +37801,6 @@ func awsEc2query_serializeDocumentAcceleratorTotalMemoryMiBRequest(v *types.Acce } func awsEc2query_serializeDocumentAcceleratorTypeSet(v []types.AcceleratorType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -37820,9 +37811,6 @@ func awsEc2query_serializeDocumentAcceleratorTypeSet(v []types.AcceleratorType, } func awsEc2query_serializeDocumentAccessScopePathListRequest(v []types.AccessScopePathRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -37863,9 +37851,6 @@ func awsEc2query_serializeDocumentAccessScopePathRequest(v *types.AccessScopePat } func awsEc2query_serializeDocumentAccountAttributeNameStringList(v []types.AccountAttributeName, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AttributeName") for i := range v { @@ -37888,9 +37873,6 @@ func awsEc2query_serializeDocumentAddIpamOperatingRegion(v *types.AddIpamOperati } func awsEc2query_serializeDocumentAddIpamOperatingRegionSet(v []types.AddIpamOperatingRegion, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -37903,9 +37885,6 @@ func awsEc2query_serializeDocumentAddIpamOperatingRegionSet(v []types.AddIpamOpe } func awsEc2query_serializeDocumentAddPrefixListEntries(v []types.AddPrefixListEntry, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -37935,9 +37914,6 @@ func awsEc2query_serializeDocumentAddPrefixListEntry(v *types.AddPrefixListEntry } func awsEc2query_serializeDocumentAllocationIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AllocationId") for i := range v { @@ -37948,9 +37924,6 @@ func awsEc2query_serializeDocumentAllocationIdList(v []string, value query.Value } func awsEc2query_serializeDocumentAllocationIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -37961,9 +37934,6 @@ func awsEc2query_serializeDocumentAllocationIds(v []string, value query.Value) e } func awsEc2query_serializeDocumentAllowedInstanceTypeSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -37974,9 +37944,6 @@ func awsEc2query_serializeDocumentAllowedInstanceTypeSet(v []string, value query } func awsEc2query_serializeDocumentArchitectureTypeSet(v []types.ArchitectureType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -37987,9 +37954,6 @@ func awsEc2query_serializeDocumentArchitectureTypeSet(v []types.ArchitectureType } func awsEc2query_serializeDocumentArnList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38000,9 +37964,6 @@ func awsEc2query_serializeDocumentArnList(v []string, value query.Value) error { } func awsEc2query_serializeDocumentAssociationIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AssociationId") for i := range v { @@ -38040,9 +38001,6 @@ func awsEc2query_serializeDocumentAthenaIntegration(v *types.AthenaIntegration, } func awsEc2query_serializeDocumentAthenaIntegrationsSet(v []types.AthenaIntegration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38079,9 +38037,6 @@ func awsEc2query_serializeDocumentAttributeValue(v *types.AttributeValue, value } func awsEc2query_serializeDocumentAvailabilityZoneStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AvailabilityZone") for i := range v { @@ -38126,9 +38081,6 @@ func awsEc2query_serializeDocumentBaselineEbsBandwidthMbpsRequest(v *types.Basel } func awsEc2query_serializeDocumentBillingProductList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38180,9 +38132,6 @@ func awsEc2query_serializeDocumentBlockDeviceMapping(v *types.BlockDeviceMapping } func awsEc2query_serializeDocumentBlockDeviceMappingList(v []types.BlockDeviceMapping, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38195,9 +38144,6 @@ func awsEc2query_serializeDocumentBlockDeviceMappingList(v []types.BlockDeviceMa } func awsEc2query_serializeDocumentBlockDeviceMappingRequestList(v []types.BlockDeviceMapping, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("BlockDeviceMapping") for i := range v { @@ -38210,9 +38156,6 @@ func awsEc2query_serializeDocumentBlockDeviceMappingRequestList(v []types.BlockD } func awsEc2query_serializeDocumentBundleIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("BundleId") for i := range v { @@ -38223,9 +38166,6 @@ func awsEc2query_serializeDocumentBundleIdStringList(v []string, value query.Val } func awsEc2query_serializeDocumentCapacityReservationFleetIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38236,9 +38176,6 @@ func awsEc2query_serializeDocumentCapacityReservationFleetIdSet(v []string, valu } func awsEc2query_serializeDocumentCapacityReservationIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38297,9 +38234,6 @@ func awsEc2query_serializeDocumentCapacityReservationTarget(v *types.CapacityRes } func awsEc2query_serializeDocumentCarrierGatewayIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -38351,9 +38285,6 @@ func awsEc2query_serializeDocumentClassicLoadBalancer(v *types.ClassicLoadBalanc } func awsEc2query_serializeDocumentClassicLoadBalancers(v []types.ClassicLoadBalancer, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38487,9 +38418,6 @@ func awsEc2query_serializeDocumentClientVpnAuthenticationRequest(v *types.Client } func awsEc2query_serializeDocumentClientVpnAuthenticationRequestList(v []types.ClientVpnAuthenticationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -38502,9 +38430,6 @@ func awsEc2query_serializeDocumentClientVpnAuthenticationRequestList(v []types.C } func awsEc2query_serializeDocumentClientVpnEndpointIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38515,9 +38440,6 @@ func awsEc2query_serializeDocumentClientVpnEndpointIdList(v []string, value quer } func awsEc2query_serializeDocumentClientVpnSecurityGroupIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38550,9 +38472,6 @@ func awsEc2query_serializeDocumentCloudWatchLogOptionsSpecification(v *types.Clo } func awsEc2query_serializeDocumentCoipPoolIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38585,9 +38504,6 @@ func awsEc2query_serializeDocumentConnectionLogOptions(v *types.ConnectionLogOpt } func awsEc2query_serializeDocumentConnectionNotificationIdsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38598,9 +38514,6 @@ func awsEc2query_serializeDocumentConnectionNotificationIdsList(v []string, valu } func awsEc2query_serializeDocumentConversionIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38611,9 +38524,6 @@ func awsEc2query_serializeDocumentConversionIdStringList(v []string, value query } func awsEc2query_serializeDocumentCpuManufacturerSet(v []types.CpuManufacturer, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38760,9 +38670,6 @@ func awsEc2query_serializeDocumentCreateVerifiedAccessEndpointLoadBalancerOption } func awsEc2query_serializeDocumentCreateVerifiedAccessEndpointSubnetIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38844,9 +38751,6 @@ func awsEc2query_serializeDocumentCreateVolumePermission(v *types.CreateVolumePe } func awsEc2query_serializeDocumentCreateVolumePermissionList(v []types.CreateVolumePermission, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38892,9 +38796,6 @@ func awsEc2query_serializeDocumentCreditSpecificationRequest(v *types.CreditSpec } func awsEc2query_serializeDocumentCustomerGatewayIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("CustomerGatewayId") for i := range v { @@ -38905,9 +38806,6 @@ func awsEc2query_serializeDocumentCustomerGatewayIdStringList(v []string, value } func awsEc2query_serializeDocumentDataQueries(v []types.DataQuery, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -38957,9 +38855,6 @@ func awsEc2query_serializeDocumentDataQuery(v *types.DataQuery, value query.Valu } func awsEc2query_serializeDocumentDedicatedHostIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -38970,9 +38865,6 @@ func awsEc2query_serializeDocumentDedicatedHostIdList(v []string, value query.Va } func awsEc2query_serializeDocumentDeleteQueuedReservedInstancesIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39024,9 +38916,6 @@ func awsEc2query_serializeDocumentDestinationOptionsRequest(v *types.Destination } func awsEc2query_serializeDocumentDhcpOptionsIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("DhcpOptionsId") for i := range v { @@ -39097,9 +38986,6 @@ func awsEc2query_serializeDocumentDiskImageDetail(v *types.DiskImageDetail, valu } func awsEc2query_serializeDocumentDiskImageList(v []types.DiskImage, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -39212,9 +39098,6 @@ func awsEc2query_serializeDocumentEbsInstanceBlockDeviceSpecification(v *types.E } func awsEc2query_serializeDocumentEgressOnlyInternetGatewayIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39225,9 +39108,6 @@ func awsEc2query_serializeDocumentEgressOnlyInternetGatewayIdList(v []string, va } func awsEc2query_serializeDocumentEipAssociationIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39238,9 +39118,6 @@ func awsEc2query_serializeDocumentEipAssociationIdList(v []string, value query.V } func awsEc2query_serializeDocumentElasticGpuIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39263,9 +39140,6 @@ func awsEc2query_serializeDocumentElasticGpuSpecification(v *types.ElasticGpuSpe } func awsEc2query_serializeDocumentElasticGpuSpecificationList(v []types.ElasticGpuSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ElasticGpuSpecification") for i := range v { @@ -39278,9 +39152,6 @@ func awsEc2query_serializeDocumentElasticGpuSpecificationList(v []types.ElasticG } func awsEc2query_serializeDocumentElasticGpuSpecifications(v []types.ElasticGpuSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39310,9 +39181,6 @@ func awsEc2query_serializeDocumentElasticInferenceAccelerator(v *types.ElasticIn } func awsEc2query_serializeDocumentElasticInferenceAccelerators(v []types.ElasticInferenceAccelerator, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39368,9 +39236,6 @@ func awsEc2query_serializeDocumentEnclaveOptionsRequest(v *types.EnclaveOptionsR } func awsEc2query_serializeDocumentExcludedInstanceTypeSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39381,9 +39246,6 @@ func awsEc2query_serializeDocumentExcludedInstanceTypeSet(v []string, value quer } func awsEc2query_serializeDocumentExecutableByStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ExecutableBy") for i := range v { @@ -39394,9 +39256,6 @@ func awsEc2query_serializeDocumentExecutableByStringList(v []string, value query } func awsEc2query_serializeDocumentExportImageTaskIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ExportImageTaskId") for i := range v { @@ -39407,9 +39266,6 @@ func awsEc2query_serializeDocumentExportImageTaskIdList(v []string, value query. } func awsEc2query_serializeDocumentExportTaskIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ExportTaskId") for i := range v { @@ -39464,9 +39320,6 @@ func awsEc2query_serializeDocumentExportToS3TaskSpecification(v *types.ExportToS } func awsEc2query_serializeDocumentFastLaunchImageIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ImageId") for i := range v { @@ -39547,9 +39400,6 @@ func awsEc2query_serializeDocumentFilter(v *types.Filter, value query.Value) err } func awsEc2query_serializeDocumentFilterList(v []types.Filter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Filter") for i := range v { @@ -39562,9 +39412,6 @@ func awsEc2query_serializeDocumentFilterList(v []types.Filter, value query.Value } func awsEc2query_serializeDocumentFleetIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -39575,9 +39422,6 @@ func awsEc2query_serializeDocumentFleetIdSet(v []string, value query.Value) erro } func awsEc2query_serializeDocumentFleetLaunchTemplateConfigListRequest(v []types.FleetLaunchTemplateConfigRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39611,9 +39455,6 @@ func awsEc2query_serializeDocumentFleetLaunchTemplateConfigRequest(v *types.Flee } func awsEc2query_serializeDocumentFleetLaunchTemplateOverridesListRequest(v []types.FleetLaunchTemplateOverridesRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39783,9 +39624,6 @@ func awsEc2query_serializeDocumentFleetSpotMaintenanceStrategiesRequest(v *types } func awsEc2query_serializeDocumentFlowLogIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39796,9 +39634,6 @@ func awsEc2query_serializeDocumentFlowLogIdList(v []string, value query.Value) e } func awsEc2query_serializeDocumentFlowLogResourceIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39809,9 +39644,6 @@ func awsEc2query_serializeDocumentFlowLogResourceIds(v []string, value query.Val } func awsEc2query_serializeDocumentFpgaImageIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39839,9 +39671,6 @@ func awsEc2query_serializeDocumentGroupIdentifier(v *types.GroupIdentifier, valu } func awsEc2query_serializeDocumentGroupIdentifierList(v []types.GroupIdentifier, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39854,9 +39683,6 @@ func awsEc2query_serializeDocumentGroupIdentifierList(v []types.GroupIdentifier, } func awsEc2query_serializeDocumentGroupIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39867,9 +39693,6 @@ func awsEc2query_serializeDocumentGroupIds(v []string, value query.Value) error } func awsEc2query_serializeDocumentGroupIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("GroupId") for i := range v { @@ -39880,9 +39703,6 @@ func awsEc2query_serializeDocumentGroupIdStringList(v []string, value query.Valu } func awsEc2query_serializeDocumentGroupNameStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("GroupName") for i := range v { @@ -39905,9 +39725,6 @@ func awsEc2query_serializeDocumentHibernationOptionsRequest(v *types.Hibernation } func awsEc2query_serializeDocumentHostReservationIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -39952,9 +39769,6 @@ func awsEc2query_serializeDocumentIcmpTypeCode(v *types.IcmpTypeCode, value quer } func awsEc2query_serializeDocumentIKEVersionsRequestList(v []types.IKEVersionsRequestListValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40018,9 +39832,6 @@ func awsEc2query_serializeDocumentImageDiskContainer(v *types.ImageDiskContainer } func awsEc2query_serializeDocumentImageDiskContainerList(v []types.ImageDiskContainer, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40033,9 +39844,6 @@ func awsEc2query_serializeDocumentImageDiskContainerList(v []types.ImageDiskCont } func awsEc2query_serializeDocumentImageIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40046,9 +39854,6 @@ func awsEc2query_serializeDocumentImageIdList(v []string, value query.Value) err } func awsEc2query_serializeDocumentImageIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ImageId") for i := range v { @@ -40071,9 +39876,6 @@ func awsEc2query_serializeDocumentImportImageLicenseConfigurationRequest(v *type } func awsEc2query_serializeDocumentImportImageLicenseSpecificationListRequest(v []types.ImportImageLicenseConfigurationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40156,9 +39958,6 @@ func awsEc2query_serializeDocumentImportInstanceLaunchSpecification(v *types.Imp } func awsEc2query_serializeDocumentImportSnapshotTaskIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ImportTaskId") for i := range v { @@ -40169,9 +39968,6 @@ func awsEc2query_serializeDocumentImportSnapshotTaskIdList(v []string, value que } func awsEc2query_serializeDocumentImportTaskIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ImportTaskId") for i := range v { @@ -40182,9 +39978,6 @@ func awsEc2query_serializeDocumentImportTaskIdList(v []string, value query.Value } func awsEc2query_serializeDocumentInsideCidrBlocksStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40224,9 +40017,6 @@ func awsEc2query_serializeDocumentInstanceBlockDeviceMappingSpecification(v *typ } func awsEc2query_serializeDocumentInstanceBlockDeviceMappingSpecificationList(v []types.InstanceBlockDeviceMappingSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40239,9 +40029,6 @@ func awsEc2query_serializeDocumentInstanceBlockDeviceMappingSpecificationList(v } func awsEc2query_serializeDocumentInstanceCreditSpecificationListRequest(v []types.InstanceCreditSpecificationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40327,9 +40114,6 @@ func awsEc2query_serializeDocumentInstanceEventWindowDisassociationRequest(v *ty } func awsEc2query_serializeDocumentInstanceEventWindowIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("InstanceEventWindowId") for i := range v { @@ -40367,9 +40151,6 @@ func awsEc2query_serializeDocumentInstanceEventWindowTimeRangeRequest(v *types.I } func awsEc2query_serializeDocumentInstanceEventWindowTimeRangeRequestSet(v []types.InstanceEventWindowTimeRangeRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -40382,9 +40163,6 @@ func awsEc2query_serializeDocumentInstanceEventWindowTimeRangeRequestSet(v []typ } func awsEc2query_serializeDocumentInstanceGenerationSet(v []types.InstanceGeneration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40395,9 +40173,6 @@ func awsEc2query_serializeDocumentInstanceGenerationSet(v []types.InstanceGenera } func awsEc2query_serializeDocumentInstanceIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40408,9 +40183,6 @@ func awsEc2query_serializeDocumentInstanceIdList(v []string, value query.Value) } func awsEc2query_serializeDocumentInstanceIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("InstanceId") for i := range v { @@ -40433,9 +40205,6 @@ func awsEc2query_serializeDocumentInstanceIpv6Address(v *types.InstanceIpv6Addre } func awsEc2query_serializeDocumentInstanceIpv6AddressList(v []types.InstanceIpv6Address, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -40448,9 +40217,6 @@ func awsEc2query_serializeDocumentInstanceIpv6AddressList(v []types.InstanceIpv6 } func awsEc2query_serializeDocumentInstanceIpv6AddressListRequest(v []types.InstanceIpv6AddressRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("InstanceIpv6Address") for i := range v { @@ -40650,9 +40416,6 @@ func awsEc2query_serializeDocumentInstanceNetworkInterfaceSpecification(v *types } func awsEc2query_serializeDocumentInstanceNetworkInterfaceSpecificationList(v []types.InstanceNetworkInterfaceSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41029,9 +40792,6 @@ func awsEc2query_serializeDocumentInstanceSpecification(v *types.InstanceSpecifi } func awsEc2query_serializeDocumentInstanceTagKeySet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41042,9 +40802,6 @@ func awsEc2query_serializeDocumentInstanceTagKeySet(v []string, value query.Valu } func awsEc2query_serializeDocumentInstanceTypeList(v []types.InstanceType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -41055,9 +40812,6 @@ func awsEc2query_serializeDocumentInstanceTypeList(v []types.InstanceType, value } func awsEc2query_serializeDocumentInstanceTypes(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -41082,9 +40836,6 @@ func awsEc2query_serializeDocumentIntegrateServices(v *types.IntegrateServices, } func awsEc2query_serializeDocumentInternetGatewayIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41112,9 +40863,6 @@ func awsEc2query_serializeDocumentIpamCidrAuthorizationContext(v *types.IpamCidr } func awsEc2query_serializeDocumentIpamPoolAllocationDisallowedCidrs(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41125,9 +40873,6 @@ func awsEc2query_serializeDocumentIpamPoolAllocationDisallowedCidrs(v []string, } func awsEc2query_serializeDocumentIpList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41188,9 +40933,6 @@ func awsEc2query_serializeDocumentIpPermission(v *types.IpPermission, value quer } func awsEc2query_serializeDocumentIpPermissionList(v []types.IpPermission, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41203,9 +40945,6 @@ func awsEc2query_serializeDocumentIpPermissionList(v []types.IpPermission, value } func awsEc2query_serializeDocumentIpPrefixList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41233,9 +40972,6 @@ func awsEc2query_serializeDocumentIpRange(v *types.IpRange, value query.Value) e } func awsEc2query_serializeDocumentIpRangeList(v []types.IpRange, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41248,9 +40984,6 @@ func awsEc2query_serializeDocumentIpRangeList(v []types.IpRange, value query.Val } func awsEc2query_serializeDocumentIpv4PrefixList(v []types.Ipv4PrefixSpecificationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41275,9 +41008,6 @@ func awsEc2query_serializeDocumentIpv4PrefixSpecificationRequest(v *types.Ipv4Pr } func awsEc2query_serializeDocumentIpv6AddressList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41288,9 +41018,6 @@ func awsEc2query_serializeDocumentIpv6AddressList(v []string, value query.Value) } func awsEc2query_serializeDocumentIpv6PoolIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41301,9 +41028,6 @@ func awsEc2query_serializeDocumentIpv6PoolIdList(v []string, value query.Value) } func awsEc2query_serializeDocumentIpv6PrefixList(v []types.Ipv6PrefixSpecificationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41345,9 +41069,6 @@ func awsEc2query_serializeDocumentIpv6Range(v *types.Ipv6Range, value query.Valu } func awsEc2query_serializeDocumentIpv6RangeList(v []types.Ipv6Range, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41360,9 +41081,6 @@ func awsEc2query_serializeDocumentIpv6RangeList(v []types.Ipv6Range, value query } func awsEc2query_serializeDocumentKeyNameStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("KeyName") for i := range v { @@ -41373,9 +41091,6 @@ func awsEc2query_serializeDocumentKeyNameStringList(v []string, value query.Valu } func awsEc2query_serializeDocumentKeyPairIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("KeyPairId") for i := range v { @@ -41413,9 +41128,6 @@ func awsEc2query_serializeDocumentLaunchPermission(v *types.LaunchPermission, va } func awsEc2query_serializeDocumentLaunchPermissionList(v []types.LaunchPermission, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41449,9 +41161,6 @@ func awsEc2query_serializeDocumentLaunchPermissionModifications(v *types.LaunchP } func awsEc2query_serializeDocumentLaunchSpecsList(v []types.SpotFleetLaunchSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41493,9 +41202,6 @@ func awsEc2query_serializeDocumentLaunchTemplateBlockDeviceMappingRequest(v *typ } func awsEc2query_serializeDocumentLaunchTemplateBlockDeviceMappingRequestList(v []types.LaunchTemplateBlockDeviceMappingRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("BlockDeviceMapping") for i := range v { @@ -41548,9 +41254,6 @@ func awsEc2query_serializeDocumentLaunchTemplateConfig(v *types.LaunchTemplateCo } func awsEc2query_serializeDocumentLaunchTemplateConfigList(v []types.LaunchTemplateConfig, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41644,9 +41347,6 @@ func awsEc2query_serializeDocumentLaunchTemplateElasticInferenceAccelerator(v *t } func awsEc2query_serializeDocumentLaunchTemplateElasticInferenceAcceleratorList(v []types.LaunchTemplateElasticInferenceAccelerator, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41700,9 +41400,6 @@ func awsEc2query_serializeDocumentLaunchTemplateIamInstanceProfileSpecificationR } func awsEc2query_serializeDocumentLaunchTemplateIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41888,9 +41585,6 @@ func awsEc2query_serializeDocumentLaunchTemplateInstanceNetworkInterfaceSpecific } func awsEc2query_serializeDocumentLaunchTemplateInstanceNetworkInterfaceSpecificationRequestList(v []types.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("InstanceNetworkInterfaceSpecification") for i := range v { @@ -41915,9 +41609,6 @@ func awsEc2query_serializeDocumentLaunchTemplateLicenseConfigurationRequest(v *t } func awsEc2query_serializeDocumentLaunchTemplateLicenseSpecificationListRequest(v []types.LaunchTemplateLicenseConfigurationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -41930,9 +41621,6 @@ func awsEc2query_serializeDocumentLaunchTemplateLicenseSpecificationListRequest( } func awsEc2query_serializeDocumentLaunchTemplateNameStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42013,9 +41701,6 @@ func awsEc2query_serializeDocumentLaunchTemplateOverrides(v *types.LaunchTemplat } func awsEc2query_serializeDocumentLaunchTemplateOverridesList(v []types.LaunchTemplateOverrides, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42187,9 +41872,6 @@ func awsEc2query_serializeDocumentLaunchTemplateTagSpecificationRequest(v *types } func awsEc2query_serializeDocumentLaunchTemplateTagSpecificationRequestList(v []types.LaunchTemplateTagSpecificationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("LaunchTemplateTagSpecificationRequest") for i := range v { @@ -42214,9 +41896,6 @@ func awsEc2query_serializeDocumentLicenseConfigurationRequest(v *types.LicenseCo } func awsEc2query_serializeDocumentLicenseSpecificationListRequest(v []types.LicenseConfigurationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42250,9 +41929,6 @@ func awsEc2query_serializeDocumentLoadBalancersConfig(v *types.LoadBalancersConf } func awsEc2query_serializeDocumentLoadPermissionListRequest(v []types.LoadPermissionRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42303,9 +41979,6 @@ func awsEc2query_serializeDocumentLoadPermissionRequest(v *types.LoadPermissionR } func awsEc2query_serializeDocumentLocalGatewayIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42316,9 +41989,6 @@ func awsEc2query_serializeDocumentLocalGatewayIdSet(v []string, value query.Valu } func awsEc2query_serializeDocumentLocalGatewayRouteTableIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42329,9 +41999,6 @@ func awsEc2query_serializeDocumentLocalGatewayRouteTableIdSet(v []string, value } func awsEc2query_serializeDocumentLocalGatewayRouteTableVirtualInterfaceGroupAssociationIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42342,9 +42009,6 @@ func awsEc2query_serializeDocumentLocalGatewayRouteTableVirtualInterfaceGroupAss } func awsEc2query_serializeDocumentLocalGatewayRouteTableVpcAssociationIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42355,9 +42019,6 @@ func awsEc2query_serializeDocumentLocalGatewayRouteTableVpcAssociationIdSet(v [] } func awsEc2query_serializeDocumentLocalGatewayVirtualInterfaceGroupIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42368,9 +42029,6 @@ func awsEc2query_serializeDocumentLocalGatewayVirtualInterfaceGroupIdSet(v []str } func awsEc2query_serializeDocumentLocalGatewayVirtualInterfaceIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42381,9 +42039,6 @@ func awsEc2query_serializeDocumentLocalGatewayVirtualInterfaceIdSet(v []string, } func awsEc2query_serializeDocumentLocalStorageTypeSet(v []types.LocalStorageType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42638,9 +42293,6 @@ func awsEc2query_serializeDocumentModifyVerifiedAccessEndpointLoadBalancerOption } func awsEc2query_serializeDocumentModifyVerifiedAccessEndpointSubnetIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42781,9 +42433,6 @@ func awsEc2query_serializeDocumentModifyVpnTunnelOptionsSpecification(v *types.M } func awsEc2query_serializeDocumentNatGatewayIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42794,9 +42443,6 @@ func awsEc2query_serializeDocumentNatGatewayIdStringList(v []string, value query } func awsEc2query_serializeDocumentNetworkAclIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42893,9 +42539,6 @@ func awsEc2query_serializeDocumentNetworkBandwidthGbpsRequest(v *types.NetworkBa } func awsEc2query_serializeDocumentNetworkInsightsAccessScopeAnalysisIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42906,9 +42549,6 @@ func awsEc2query_serializeDocumentNetworkInsightsAccessScopeAnalysisIdList(v []s } func awsEc2query_serializeDocumentNetworkInsightsAccessScopeIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42919,9 +42559,6 @@ func awsEc2query_serializeDocumentNetworkInsightsAccessScopeIdList(v []string, v } func awsEc2query_serializeDocumentNetworkInsightsAnalysisIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42932,9 +42569,6 @@ func awsEc2query_serializeDocumentNetworkInsightsAnalysisIdList(v []string, valu } func awsEc2query_serializeDocumentNetworkInsightsPathIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -42996,9 +42630,6 @@ func awsEc2query_serializeDocumentNetworkInterfaceCountRequest(v *types.NetworkI } func awsEc2query_serializeDocumentNetworkInterfaceIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43009,9 +42640,6 @@ func awsEc2query_serializeDocumentNetworkInterfaceIdList(v []string, value query } func awsEc2query_serializeDocumentNetworkInterfacePermissionIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -43041,9 +42669,6 @@ func awsEc2query_serializeDocumentNewDhcpConfiguration(v *types.NewDhcpConfigura } func awsEc2query_serializeDocumentNewDhcpConfigurationList(v []types.NewDhcpConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43056,9 +42681,6 @@ func awsEc2query_serializeDocumentNewDhcpConfigurationList(v []types.NewDhcpConf } func awsEc2query_serializeDocumentOccurrenceDayRequestSet(v []int32, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("OccurenceDay") for i := range v { @@ -43108,9 +42730,6 @@ func awsEc2query_serializeDocumentOnDemandOptionsRequest(v *types.OnDemandOption } func awsEc2query_serializeDocumentOrganizationalUnitArnStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("OrganizationalUnitArn") for i := range v { @@ -43121,9 +42740,6 @@ func awsEc2query_serializeDocumentOrganizationalUnitArnStringList(v []string, va } func awsEc2query_serializeDocumentOrganizationArnStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("OrganizationArn") for i := range v { @@ -43134,9 +42750,6 @@ func awsEc2query_serializeDocumentOrganizationArnStringList(v []string, value qu } func awsEc2query_serializeDocumentOwnerStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Owner") for i := range v { @@ -43246,9 +42859,6 @@ func awsEc2query_serializeDocumentPeeringConnectionOptionsRequest(v *types.Peeri } func awsEc2query_serializeDocumentPhase1DHGroupNumbersRequestList(v []types.Phase1DHGroupNumbersRequestListValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43273,9 +42883,6 @@ func awsEc2query_serializeDocumentPhase1DHGroupNumbersRequestListValue(v *types. } func awsEc2query_serializeDocumentPhase1EncryptionAlgorithmsRequestList(v []types.Phase1EncryptionAlgorithmsRequestListValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43300,9 +42907,6 @@ func awsEc2query_serializeDocumentPhase1EncryptionAlgorithmsRequestListValue(v * } func awsEc2query_serializeDocumentPhase1IntegrityAlgorithmsRequestList(v []types.Phase1IntegrityAlgorithmsRequestListValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43327,9 +42931,6 @@ func awsEc2query_serializeDocumentPhase1IntegrityAlgorithmsRequestListValue(v *t } func awsEc2query_serializeDocumentPhase2DHGroupNumbersRequestList(v []types.Phase2DHGroupNumbersRequestListValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43354,9 +42955,6 @@ func awsEc2query_serializeDocumentPhase2DHGroupNumbersRequestListValue(v *types. } func awsEc2query_serializeDocumentPhase2EncryptionAlgorithmsRequestList(v []types.Phase2EncryptionAlgorithmsRequestListValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43381,9 +42979,6 @@ func awsEc2query_serializeDocumentPhase2EncryptionAlgorithmsRequestListValue(v * } func awsEc2query_serializeDocumentPhase2IntegrityAlgorithmsRequestList(v []types.Phase2IntegrityAlgorithmsRequestListValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43460,9 +43055,6 @@ func awsEc2query_serializeDocumentPlacement(v *types.Placement, value query.Valu } func awsEc2query_serializeDocumentPlacementGroupIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("GroupId") for i := range v { @@ -43473,9 +43065,6 @@ func awsEc2query_serializeDocumentPlacementGroupIdStringList(v []string, value q } func awsEc2query_serializeDocumentPlacementGroupStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -43520,9 +43109,6 @@ func awsEc2query_serializeDocumentPrefixListId(v *types.PrefixListId, value quer } func awsEc2query_serializeDocumentPrefixListIdList(v []types.PrefixListId, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43535,9 +43121,6 @@ func awsEc2query_serializeDocumentPrefixListIdList(v []types.PrefixListId, value } func awsEc2query_serializeDocumentPrefixListResourceIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43583,9 +43166,6 @@ func awsEc2query_serializeDocumentPriceScheduleSpecification(v *types.PriceSched } func awsEc2query_serializeDocumentPriceScheduleSpecificationList(v []types.PriceScheduleSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43620,9 +43200,6 @@ func awsEc2query_serializeDocumentPrivateDnsNameOptionsRequest(v *types.PrivateD } func awsEc2query_serializeDocumentPrivateIpAddressConfigSet(v []types.ScheduledInstancesPrivateIpAddressConfig, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("PrivateIpAddressConfigSet") for i := range v { @@ -43652,9 +43229,6 @@ func awsEc2query_serializeDocumentPrivateIpAddressSpecification(v *types.Private } func awsEc2query_serializeDocumentPrivateIpAddressSpecificationList(v []types.PrivateIpAddressSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43667,9 +43241,6 @@ func awsEc2query_serializeDocumentPrivateIpAddressSpecificationList(v []types.Pr } func awsEc2query_serializeDocumentPrivateIpAddressStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("PrivateIpAddress") for i := range v { @@ -43680,9 +43251,6 @@ func awsEc2query_serializeDocumentPrivateIpAddressStringList(v []string, value q } func awsEc2query_serializeDocumentProductCodeStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ProductCode") for i := range v { @@ -43693,9 +43261,6 @@ func awsEc2query_serializeDocumentProductCodeStringList(v []string, value query. } func awsEc2query_serializeDocumentProductDescriptionList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -43706,9 +43271,6 @@ func awsEc2query_serializeDocumentProductDescriptionList(v []string, value query } func awsEc2query_serializeDocumentProtocolList(v []types.Protocol, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43719,9 +43281,6 @@ func awsEc2query_serializeDocumentProtocolList(v []types.Protocol, value query.V } func awsEc2query_serializeDocumentPublicIpStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("PublicIp") for i := range v { @@ -43732,9 +43291,6 @@ func awsEc2query_serializeDocumentPublicIpStringList(v []string, value query.Val } func awsEc2query_serializeDocumentPublicIpv4PoolIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43762,9 +43318,6 @@ func awsEc2query_serializeDocumentPurchaseRequest(v *types.PurchaseRequest, valu } func awsEc2query_serializeDocumentPurchaseRequestSet(v []types.PurchaseRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("PurchaseRequest") for i := range v { @@ -43777,9 +43330,6 @@ func awsEc2query_serializeDocumentPurchaseRequestSet(v []types.PurchaseRequest, } func awsEc2query_serializeDocumentReasonCodesList(v []types.ReportInstanceReasonCodes, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43790,9 +43340,6 @@ func awsEc2query_serializeDocumentReasonCodesList(v []types.ReportInstanceReason } func awsEc2query_serializeDocumentRegionNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -43803,9 +43350,6 @@ func awsEc2query_serializeDocumentRegionNames(v []string, value query.Value) err } func awsEc2query_serializeDocumentRegionNameStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("RegionName") for i := range v { @@ -43847,9 +43391,6 @@ func awsEc2query_serializeDocumentRemoveIpamOperatingRegion(v *types.RemoveIpamO } func awsEc2query_serializeDocumentRemoveIpamOperatingRegionSet(v []types.RemoveIpamOperatingRegion, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -43862,9 +43403,6 @@ func awsEc2query_serializeDocumentRemoveIpamOperatingRegionSet(v []types.RemoveI } func awsEc2query_serializeDocumentRemovePrefixListEntries(v []types.RemovePrefixListEntry, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -43889,9 +43427,6 @@ func awsEc2query_serializeDocumentRemovePrefixListEntry(v *types.RemovePrefixLis } func awsEc2query_serializeDocumentReplaceRootVolumeTaskIds(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ReplaceRootVolumeTaskId") for i := range v { @@ -43902,9 +43437,6 @@ func awsEc2query_serializeDocumentReplaceRootVolumeTaskIds(v []string, value que } func awsEc2query_serializeDocumentRequestHostIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43915,9 +43447,6 @@ func awsEc2query_serializeDocumentRequestHostIdList(v []string, value query.Valu } func awsEc2query_serializeDocumentRequestHostIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -43928,9 +43457,6 @@ func awsEc2query_serializeDocumentRequestHostIdSet(v []string, value query.Value } func awsEc2query_serializeDocumentRequestInstanceTypeList(v []types.InstanceType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -43958,9 +43484,6 @@ func awsEc2query_serializeDocumentRequestIpamResourceTag(v *types.RequestIpamRes } func awsEc2query_serializeDocumentRequestIpamResourceTagList(v []types.RequestIpamResourceTag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -44278,9 +43801,6 @@ func awsEc2query_serializeDocumentRequestSpotLaunchSpecification(v *types.Reques } func awsEc2query_serializeDocumentRequestSpotLaunchSpecificationSecurityGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -44291,9 +43811,6 @@ func awsEc2query_serializeDocumentRequestSpotLaunchSpecificationSecurityGroupIdL } func awsEc2query_serializeDocumentRequestSpotLaunchSpecificationSecurityGroupList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -44359,9 +43876,6 @@ func awsEc2query_serializeDocumentReservationFleetInstanceSpecification(v *types } func awsEc2query_serializeDocumentReservationFleetInstanceSpecificationList(v []types.ReservationFleetInstanceSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -44374,9 +43888,6 @@ func awsEc2query_serializeDocumentReservationFleetInstanceSpecificationList(v [] } func awsEc2query_serializeDocumentReservedInstanceIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ReservedInstanceId") for i := range v { @@ -44449,9 +43960,6 @@ func awsEc2query_serializeDocumentReservedInstancesConfiguration(v *types.Reserv } func awsEc2query_serializeDocumentReservedInstancesConfigurationList(v []types.ReservedInstancesConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -44464,9 +43972,6 @@ func awsEc2query_serializeDocumentReservedInstancesConfigurationList(v []types.R } func awsEc2query_serializeDocumentReservedInstancesIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ReservedInstancesId") for i := range v { @@ -44477,9 +43982,6 @@ func awsEc2query_serializeDocumentReservedInstancesIdStringList(v []string, valu } func awsEc2query_serializeDocumentReservedInstancesModificationIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ReservedInstancesModificationId") for i := range v { @@ -44490,9 +43992,6 @@ func awsEc2query_serializeDocumentReservedInstancesModificationIdStringList(v [] } func awsEc2query_serializeDocumentReservedInstancesOfferingIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -44503,9 +44002,6 @@ func awsEc2query_serializeDocumentReservedInstancesOfferingIdStringList(v []stri } func awsEc2query_serializeDocumentResourceIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -44516,9 +44012,6 @@ func awsEc2query_serializeDocumentResourceIdList(v []string, value query.Value) } func awsEc2query_serializeDocumentResourceList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -44550,9 +44043,6 @@ func awsEc2query_serializeDocumentResourceStatementRequest(v *types.ResourceStat } func awsEc2query_serializeDocumentRestorableByStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -44563,9 +44053,6 @@ func awsEc2query_serializeDocumentRestorableByStringList(v []string, value query } func awsEc2query_serializeDocumentRouteTableIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -44605,9 +44092,6 @@ func awsEc2query_serializeDocumentS3ObjectTag(v *types.S3ObjectTag, value query. } func awsEc2query_serializeDocumentS3ObjectTagList(v []types.S3ObjectTag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -44652,9 +44136,6 @@ func awsEc2query_serializeDocumentS3Storage(v *types.S3Storage, value query.Valu } func awsEc2query_serializeDocumentScheduledInstanceIdRequestSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ScheduledInstanceId") for i := range v { @@ -44728,9 +44209,6 @@ func awsEc2query_serializeDocumentScheduledInstancesBlockDeviceMapping(v *types. } func awsEc2query_serializeDocumentScheduledInstancesBlockDeviceMappingSet(v []types.ScheduledInstancesBlockDeviceMapping, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("BlockDeviceMapping") for i := range v { @@ -44809,9 +44287,6 @@ func awsEc2query_serializeDocumentScheduledInstancesIpv6Address(v *types.Schedul } func awsEc2query_serializeDocumentScheduledInstancesIpv6AddressList(v []types.ScheduledInstancesIpv6Address, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Ipv6Address") for i := range v { @@ -44998,9 +44473,6 @@ func awsEc2query_serializeDocumentScheduledInstancesNetworkInterface(v *types.Sc } func awsEc2query_serializeDocumentScheduledInstancesNetworkInterfaceSet(v []types.ScheduledInstancesNetworkInterface, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("NetworkInterface") for i := range v { @@ -45047,9 +44519,6 @@ func awsEc2query_serializeDocumentScheduledInstancesPrivateIpAddressConfig(v *ty } func awsEc2query_serializeDocumentScheduledInstancesSecurityGroupIdSet(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SecurityGroupId") for i := range v { @@ -45060,9 +44529,6 @@ func awsEc2query_serializeDocumentScheduledInstancesSecurityGroupIdSet(v []strin } func awsEc2query_serializeDocumentSecurityGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45073,9 +44539,6 @@ func awsEc2query_serializeDocumentSecurityGroupIdList(v []string, value query.Va } func awsEc2query_serializeDocumentSecurityGroupIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SecurityGroupId") for i := range v { @@ -45103,9 +44566,6 @@ func awsEc2query_serializeDocumentSecurityGroupRuleDescription(v *types.Security } func awsEc2query_serializeDocumentSecurityGroupRuleDescriptionList(v []types.SecurityGroupRuleDescription, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45118,9 +44578,6 @@ func awsEc2query_serializeDocumentSecurityGroupRuleDescriptionList(v []types.Sec } func awsEc2query_serializeDocumentSecurityGroupRuleIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45197,9 +44654,6 @@ func awsEc2query_serializeDocumentSecurityGroupRuleUpdate(v *types.SecurityGroup } func awsEc2query_serializeDocumentSecurityGroupRuleUpdateList(v []types.SecurityGroupRuleUpdate, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45212,9 +44666,6 @@ func awsEc2query_serializeDocumentSecurityGroupRuleUpdateList(v []types.Security } func awsEc2query_serializeDocumentSecurityGroupStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SecurityGroup") for i := range v { @@ -45288,9 +44739,6 @@ func awsEc2query_serializeDocumentSnapshotDiskContainer(v *types.SnapshotDiskCon } func awsEc2query_serializeDocumentSnapshotIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SnapshotId") for i := range v { @@ -45634,9 +45082,6 @@ func awsEc2query_serializeDocumentSpotFleetRequestConfigData(v *types.SpotFleetR } func awsEc2query_serializeDocumentSpotFleetRequestIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45666,9 +45111,6 @@ func awsEc2query_serializeDocumentSpotFleetTagSpecification(v *types.SpotFleetTa } func awsEc2query_serializeDocumentSpotFleetTagSpecificationList(v []types.SpotFleetTagSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45681,9 +45123,6 @@ func awsEc2query_serializeDocumentSpotFleetTagSpecificationList(v []types.SpotFl } func awsEc2query_serializeDocumentSpotInstanceRequestIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SpotInstanceRequestId") for i := range v { @@ -45842,9 +45281,6 @@ func awsEc2query_serializeDocumentStorageLocation(v *types.StorageLocation, valu } func awsEc2query_serializeDocumentSubnetIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SubnetId") for i := range v { @@ -45872,9 +45308,6 @@ func awsEc2query_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsEc2query_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45906,9 +45339,6 @@ func awsEc2query_serializeDocumentTagSpecification(v *types.TagSpecification, va } func awsEc2query_serializeDocumentTagSpecificationList(v []types.TagSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -45970,9 +45400,6 @@ func awsEc2query_serializeDocumentTargetConfigurationRequest(v *types.TargetConf } func awsEc2query_serializeDocumentTargetConfigurationRequestSet(v []types.TargetConfigurationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("TargetConfigurationRequest") for i := range v { @@ -45997,9 +45424,6 @@ func awsEc2query_serializeDocumentTargetGroup(v *types.TargetGroup, value query. } func awsEc2query_serializeDocumentTargetGroups(v []types.TargetGroup, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46040,9 +45464,6 @@ func awsEc2query_serializeDocumentThroughResourcesStatementRequest(v *types.Thro } func awsEc2query_serializeDocumentThroughResourcesStatementRequestList(v []types.ThroughResourcesStatementRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46141,9 +45562,6 @@ func awsEc2query_serializeDocumentTotalLocalStorageGBRequest(v *types.TotalLocal } func awsEc2query_serializeDocumentTrafficMirrorFilterIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46154,9 +45572,6 @@ func awsEc2query_serializeDocumentTrafficMirrorFilterIdList(v []string, value qu } func awsEc2query_serializeDocumentTrafficMirrorFilterRuleFieldList(v []types.TrafficMirrorFilterRuleField, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -46167,9 +45582,6 @@ func awsEc2query_serializeDocumentTrafficMirrorFilterRuleFieldList(v []types.Tra } func awsEc2query_serializeDocumentTrafficMirrorNetworkServiceList(v []types.TrafficMirrorNetworkService, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46197,9 +45609,6 @@ func awsEc2query_serializeDocumentTrafficMirrorPortRangeRequest(v *types.Traffic } func awsEc2query_serializeDocumentTrafficMirrorSessionFieldList(v []types.TrafficMirrorSessionField, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -46210,9 +45619,6 @@ func awsEc2query_serializeDocumentTrafficMirrorSessionFieldList(v []types.Traffi } func awsEc2query_serializeDocumentTrafficMirrorSessionIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46223,9 +45629,6 @@ func awsEc2query_serializeDocumentTrafficMirrorSessionIdList(v []string, value q } func awsEc2query_serializeDocumentTrafficMirrorTargetIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46236,9 +45639,6 @@ func awsEc2query_serializeDocumentTrafficMirrorTargetIdList(v []string, value qu } func awsEc2query_serializeDocumentTransitGatewayAttachmentIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -46249,9 +45649,6 @@ func awsEc2query_serializeDocumentTransitGatewayAttachmentIdStringList(v []strin } func awsEc2query_serializeDocumentTransitGatewayCidrBlockStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46262,9 +45659,6 @@ func awsEc2query_serializeDocumentTransitGatewayCidrBlockStringList(v []string, } func awsEc2query_serializeDocumentTransitGatewayConnectPeerIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46287,9 +45681,6 @@ func awsEc2query_serializeDocumentTransitGatewayConnectRequestBgpOptions(v *type } func awsEc2query_serializeDocumentTransitGatewayIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46300,9 +45691,6 @@ func awsEc2query_serializeDocumentTransitGatewayIdStringList(v []string, value q } func awsEc2query_serializeDocumentTransitGatewayMulticastDomainIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46313,9 +45701,6 @@ func awsEc2query_serializeDocumentTransitGatewayMulticastDomainIdStringList(v [] } func awsEc2query_serializeDocumentTransitGatewayNetworkInterfaceIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46326,9 +45711,6 @@ func awsEc2query_serializeDocumentTransitGatewayNetworkInterfaceIdList(v []strin } func awsEc2query_serializeDocumentTransitGatewayPolicyTableIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46388,9 +45770,6 @@ func awsEc2query_serializeDocumentTransitGatewayRequestOptions(v *types.TransitG } func awsEc2query_serializeDocumentTransitGatewayRouteTableAnnouncementIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46401,9 +45780,6 @@ func awsEc2query_serializeDocumentTransitGatewayRouteTableAnnouncementIdStringLi } func awsEc2query_serializeDocumentTransitGatewayRouteTableIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46414,9 +45790,6 @@ func awsEc2query_serializeDocumentTransitGatewayRouteTableIdStringList(v []strin } func awsEc2query_serializeDocumentTransitGatewaySubnetIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46427,9 +45800,6 @@ func awsEc2query_serializeDocumentTransitGatewaySubnetIdList(v []string, value q } func awsEc2query_serializeDocumentTrunkInterfaceAssociationIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46469,9 +45839,6 @@ func awsEc2query_serializeDocumentUserData(v *types.UserData, value query.Value) } func awsEc2query_serializeDocumentUserGroupStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("UserGroup") for i := range v { @@ -46524,9 +45891,6 @@ func awsEc2query_serializeDocumentUserIdGroupPair(v *types.UserIdGroupPair, valu } func awsEc2query_serializeDocumentUserIdGroupPairList(v []types.UserIdGroupPair, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46539,9 +45903,6 @@ func awsEc2query_serializeDocumentUserIdGroupPairList(v []types.UserIdGroupPair, } func awsEc2query_serializeDocumentUserIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("UserId") for i := range v { @@ -46552,9 +45913,6 @@ func awsEc2query_serializeDocumentUserIdStringList(v []string, value query.Value } func awsEc2query_serializeDocumentValueStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46599,9 +45957,6 @@ func awsEc2query_serializeDocumentVCpuCountRangeRequest(v *types.VCpuCountRangeR } func awsEc2query_serializeDocumentVerifiedAccessEndpointIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46612,9 +45967,6 @@ func awsEc2query_serializeDocumentVerifiedAccessEndpointIdList(v []string, value } func awsEc2query_serializeDocumentVerifiedAccessGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46625,9 +45977,6 @@ func awsEc2query_serializeDocumentVerifiedAccessGroupIdList(v []string, value qu } func awsEc2query_serializeDocumentVerifiedAccessInstanceIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46727,9 +46076,6 @@ func awsEc2query_serializeDocumentVerifiedAccessLogS3DestinationOptions(v *types } func awsEc2query_serializeDocumentVerifiedAccessTrustProviderIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46740,9 +46086,6 @@ func awsEc2query_serializeDocumentVerifiedAccessTrustProviderIdList(v []string, } func awsEc2query_serializeDocumentVersionStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46753,9 +46096,6 @@ func awsEc2query_serializeDocumentVersionStringList(v []string, value query.Valu } func awsEc2query_serializeDocumentVirtualizationTypeSet(v []types.VirtualizationType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46778,9 +46118,6 @@ func awsEc2query_serializeDocumentVolumeDetail(v *types.VolumeDetail, value quer } func awsEc2query_serializeDocumentVolumeIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VolumeId") for i := range v { @@ -46791,9 +46128,6 @@ func awsEc2query_serializeDocumentVolumeIdStringList(v []string, value query.Val } func awsEc2query_serializeDocumentVpcClassicLinkIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpcId") for i := range v { @@ -46804,9 +46138,6 @@ func awsEc2query_serializeDocumentVpcClassicLinkIdList(v []string, value query.V } func awsEc2query_serializeDocumentVpcEndpointIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46817,9 +46148,6 @@ func awsEc2query_serializeDocumentVpcEndpointIdList(v []string, value query.Valu } func awsEc2query_serializeDocumentVpcEndpointRouteTableIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46830,9 +46158,6 @@ func awsEc2query_serializeDocumentVpcEndpointRouteTableIdList(v []string, value } func awsEc2query_serializeDocumentVpcEndpointSecurityGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46843,9 +46168,6 @@ func awsEc2query_serializeDocumentVpcEndpointSecurityGroupIdList(v []string, val } func awsEc2query_serializeDocumentVpcEndpointServiceIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46856,9 +46178,6 @@ func awsEc2query_serializeDocumentVpcEndpointServiceIdList(v []string, value que } func awsEc2query_serializeDocumentVpcEndpointSubnetIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46869,9 +46188,6 @@ func awsEc2query_serializeDocumentVpcEndpointSubnetIdList(v []string, value quer } func awsEc2query_serializeDocumentVpcIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpcId") for i := range v { @@ -46882,9 +46198,6 @@ func awsEc2query_serializeDocumentVpcIdStringList(v []string, value query.Value) } func awsEc2query_serializeDocumentVpcPeeringConnectionIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Item") for i := range v { @@ -46895,9 +46208,6 @@ func awsEc2query_serializeDocumentVpcPeeringConnectionIdList(v []string, value q } func awsEc2query_serializeDocumentVpnConnectionIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpnConnectionId") for i := range v { @@ -46967,9 +46277,6 @@ func awsEc2query_serializeDocumentVpnConnectionOptionsSpecification(v *types.Vpn } func awsEc2query_serializeDocumentVpnGatewayIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpnGatewayId") for i := range v { @@ -47112,9 +46419,6 @@ func awsEc2query_serializeDocumentVpnTunnelOptionsSpecification(v *types.VpnTunn } func awsEc2query_serializeDocumentVpnTunnelOptionsSpecificationsList(v []types.VpnTunnelOptionsSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Member") for i := range v { @@ -47127,9 +46431,6 @@ func awsEc2query_serializeDocumentVpnTunnelOptionsSpecificationsList(v []types.V } func awsEc2query_serializeDocumentZoneIdStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ZoneId") for i := range v { @@ -47140,9 +46441,6 @@ func awsEc2query_serializeDocumentZoneIdStringList(v []string, value query.Value } func awsEc2query_serializeDocumentZoneNameStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ZoneName") for i := range v { diff --git a/service/elasticache/serializers.go b/service/elasticache/serializers.go index 03ee0b005c5..f0f6088ba9c 100644 --- a/service/elasticache/serializers.go +++ b/service/elasticache/serializers.go @@ -4195,9 +4195,6 @@ func awsAwsquery_serializeDocumentAuthenticationMode(v *types.AuthenticationMode } func awsAwsquery_serializeDocumentAvailabilityZonesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AvailabilityZone") for i := range v { @@ -4208,9 +4205,6 @@ func awsAwsquery_serializeDocumentAvailabilityZonesList(v []string, value query. } func awsAwsquery_serializeDocumentCacheClusterIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4221,9 +4215,6 @@ func awsAwsquery_serializeDocumentCacheClusterIdList(v []string, value query.Val } func awsAwsquery_serializeDocumentCacheNodeIdsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("CacheNodeId") for i := range v { @@ -4234,9 +4225,6 @@ func awsAwsquery_serializeDocumentCacheNodeIdsList(v []string, value query.Value } func awsAwsquery_serializeDocumentCacheSecurityGroupNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("CacheSecurityGroupName") for i := range v { @@ -4307,9 +4295,6 @@ func awsAwsquery_serializeDocumentCustomerNodeEndpoint(v *types.CustomerNodeEndp } func awsAwsquery_serializeDocumentCustomerNodeEndpointList(v []types.CustomerNodeEndpoint, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4362,9 +4347,6 @@ func awsAwsquery_serializeDocumentFilter(v *types.Filter, value query.Value) err } func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4377,9 +4359,6 @@ func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value } func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4390,9 +4369,6 @@ func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) } func awsAwsquery_serializeDocumentGlobalNodeGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("GlobalNodeGroupId") for i := range v { @@ -4403,9 +4379,6 @@ func awsAwsquery_serializeDocumentGlobalNodeGroupIdList(v []string, value query. } func awsAwsquery_serializeDocumentKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4462,9 +4435,6 @@ func awsAwsquery_serializeDocumentLogDeliveryConfigurationRequest(v *types.LogDe } func awsAwsquery_serializeDocumentLogDeliveryConfigurationRequestList(v []types.LogDeliveryConfigurationRequest, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("LogDeliveryConfigurationRequest") for i := range v { @@ -4523,9 +4493,6 @@ func awsAwsquery_serializeDocumentNodeGroupConfiguration(v *types.NodeGroupConfi } func awsAwsquery_serializeDocumentNodeGroupConfigurationList(v []types.NodeGroupConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("NodeGroupConfiguration") for i := range v { @@ -4538,9 +4505,6 @@ func awsAwsquery_serializeDocumentNodeGroupConfigurationList(v []types.NodeGroup } func awsAwsquery_serializeDocumentNodeGroupsToRemoveList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("NodeGroupToRemove") for i := range v { @@ -4551,9 +4515,6 @@ func awsAwsquery_serializeDocumentNodeGroupsToRemoveList(v []string, value query } func awsAwsquery_serializeDocumentNodeGroupsToRetainList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("NodeGroupToRetain") for i := range v { @@ -4564,9 +4525,6 @@ func awsAwsquery_serializeDocumentNodeGroupsToRetainList(v []string, value query } func awsAwsquery_serializeDocumentOutpostArnsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("OutpostArn") for i := range v { @@ -4594,9 +4552,6 @@ func awsAwsquery_serializeDocumentParameterNameValue(v *types.ParameterNameValue } func awsAwsquery_serializeDocumentParameterNameValueList(v []types.ParameterNameValue, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ParameterNameValue") for i := range v { @@ -4609,9 +4564,6 @@ func awsAwsquery_serializeDocumentParameterNameValueList(v []types.ParameterName } func awsAwsquery_serializeDocumentPasswordListInput(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4622,9 +4574,6 @@ func awsAwsquery_serializeDocumentPasswordListInput(v []string, value query.Valu } func awsAwsquery_serializeDocumentPreferredAvailabilityZoneList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("PreferredAvailabilityZone") for i := range v { @@ -4635,9 +4584,6 @@ func awsAwsquery_serializeDocumentPreferredAvailabilityZoneList(v []string, valu } func awsAwsquery_serializeDocumentPreferredOutpostArnList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("PreferredOutpostArn") for i := range v { @@ -4672,9 +4618,6 @@ func awsAwsquery_serializeDocumentRegionalConfiguration(v *types.RegionalConfigu } func awsAwsquery_serializeDocumentRegionalConfigurationList(v []types.RegionalConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("RegionalConfiguration") for i := range v { @@ -4687,9 +4630,6 @@ func awsAwsquery_serializeDocumentRegionalConfigurationList(v []types.RegionalCo } func awsAwsquery_serializeDocumentRemoveReplicasList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4700,9 +4640,6 @@ func awsAwsquery_serializeDocumentRemoveReplicasList(v []string, value query.Val } func awsAwsquery_serializeDocumentReplicaConfigurationList(v []types.ConfigureShard, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ConfigureShard") for i := range v { @@ -4715,9 +4652,6 @@ func awsAwsquery_serializeDocumentReplicaConfigurationList(v []types.ConfigureSh } func awsAwsquery_serializeDocumentReplicationGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4747,9 +4681,6 @@ func awsAwsquery_serializeDocumentReshardingConfiguration(v *types.ReshardingCon } func awsAwsquery_serializeDocumentReshardingConfigurationList(v []types.ReshardingConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ReshardingConfiguration") for i := range v { @@ -4762,9 +4693,6 @@ func awsAwsquery_serializeDocumentReshardingConfigurationList(v []types.Reshardi } func awsAwsquery_serializeDocumentSecurityGroupIdsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SecurityGroupId") for i := range v { @@ -4775,9 +4703,6 @@ func awsAwsquery_serializeDocumentSecurityGroupIdsList(v []string, value query.V } func awsAwsquery_serializeDocumentServiceUpdateStatusList(v []types.ServiceUpdateStatus, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4788,9 +4713,6 @@ func awsAwsquery_serializeDocumentServiceUpdateStatusList(v []types.ServiceUpdat } func awsAwsquery_serializeDocumentSnapshotArnsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SnapshotArn") for i := range v { @@ -4801,9 +4723,6 @@ func awsAwsquery_serializeDocumentSnapshotArnsList(v []string, value query.Value } func awsAwsquery_serializeDocumentSubnetIdentifierList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SubnetIdentifier") for i := range v { @@ -4831,9 +4750,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Tag") for i := range v { @@ -4863,9 +4779,6 @@ func awsAwsquery_serializeDocumentTimeRangeFilter(v *types.TimeRangeFilter, valu } func awsAwsquery_serializeDocumentUpdateActionStatusList(v []types.UpdateActionStatus, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4876,9 +4789,6 @@ func awsAwsquery_serializeDocumentUpdateActionStatusList(v []types.UpdateActionS } func awsAwsquery_serializeDocumentUserGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4889,9 +4799,6 @@ func awsAwsquery_serializeDocumentUserGroupIdList(v []string, value query.Value) } func awsAwsquery_serializeDocumentUserGroupIdListInput(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4902,9 +4809,6 @@ func awsAwsquery_serializeDocumentUserGroupIdListInput(v []string, value query.V } func awsAwsquery_serializeDocumentUserIdListInput(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/elasticbeanstalk/serializers.go b/service/elasticbeanstalk/serializers.go index f5707f6d612..5969b76b1ad 100644 --- a/service/elasticbeanstalk/serializers.go +++ b/service/elasticbeanstalk/serializers.go @@ -3012,9 +3012,6 @@ func (m *awsAwsquery_serializeOpValidateConfigurationSettings) HandleSerialize(c return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentApplicationNamesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3124,9 +3121,6 @@ func awsAwsquery_serializeDocumentConfigurationOptionSetting(v *types.Configurat } func awsAwsquery_serializeDocumentConfigurationOptionSettingsList(v []types.ConfigurationOptionSetting, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3139,9 +3133,6 @@ func awsAwsquery_serializeDocumentConfigurationOptionSettingsList(v []types.Conf } func awsAwsquery_serializeDocumentEnvironmentHealthAttributes(v []types.EnvironmentHealthAttribute, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3152,9 +3143,6 @@ func awsAwsquery_serializeDocumentEnvironmentHealthAttributes(v []types.Environm } func awsAwsquery_serializeDocumentEnvironmentIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3165,9 +3153,6 @@ func awsAwsquery_serializeDocumentEnvironmentIdList(v []string, value query.Valu } func awsAwsquery_serializeDocumentEnvironmentNamesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3200,9 +3185,6 @@ func awsAwsquery_serializeDocumentEnvironmentTier(v *types.EnvironmentTier, valu } func awsAwsquery_serializeDocumentInstancesHealthAttributes(v []types.InstancesHealthAttribute, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3279,9 +3261,6 @@ func awsAwsquery_serializeDocumentOptionSpecification(v *types.OptionSpecificati } func awsAwsquery_serializeDocumentOptionsSpecifierList(v []types.OptionSpecification, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3318,9 +3297,6 @@ func awsAwsquery_serializeDocumentPlatformFilter(v *types.PlatformFilter, value } func awsAwsquery_serializeDocumentPlatformFilters(v []types.PlatformFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3333,9 +3309,6 @@ func awsAwsquery_serializeDocumentPlatformFilters(v []types.PlatformFilter, valu } func awsAwsquery_serializeDocumentPlatformFilterValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3387,9 +3360,6 @@ func awsAwsquery_serializeDocumentSearchFilter(v *types.SearchFilter, value quer } func awsAwsquery_serializeDocumentSearchFilters(v []types.SearchFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3402,9 +3372,6 @@ func awsAwsquery_serializeDocumentSearchFilters(v []types.SearchFilter, value qu } func awsAwsquery_serializeDocumentSearchFilterValues(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3471,9 +3438,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3484,9 +3448,6 @@ func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3499,9 +3460,6 @@ func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) erro } func awsAwsquery_serializeDocumentTags(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3514,9 +3472,6 @@ func awsAwsquery_serializeDocumentTags(v []types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentVersionLabels(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3527,9 +3482,6 @@ func awsAwsquery_serializeDocumentVersionLabels(v []string, value query.Value) e } func awsAwsquery_serializeDocumentVersionLabelsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/elasticloadbalancing/serializers.go b/service/elasticloadbalancing/serializers.go index 8da07965b28..1a52ea3dab1 100644 --- a/service/elasticloadbalancing/serializers.go +++ b/service/elasticloadbalancing/serializers.go @@ -1915,9 +1915,6 @@ func awsAwsquery_serializeDocumentAdditionalAttribute(v *types.AdditionalAttribu } func awsAwsquery_serializeDocumentAdditionalAttributes(v []types.AdditionalAttribute, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1930,9 +1927,6 @@ func awsAwsquery_serializeDocumentAdditionalAttributes(v []types.AdditionalAttri } func awsAwsquery_serializeDocumentAvailabilityZones(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2028,9 +2022,6 @@ func awsAwsquery_serializeDocumentInstance(v *types.Instance, value query.Value) } func awsAwsquery_serializeDocumentInstances(v []types.Instance, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2075,9 +2066,6 @@ func awsAwsquery_serializeDocumentListener(v *types.Listener, value query.Value) } func awsAwsquery_serializeDocumentListeners(v []types.Listener, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2132,9 +2120,6 @@ func awsAwsquery_serializeDocumentLoadBalancerAttributes(v *types.LoadBalancerAt } func awsAwsquery_serializeDocumentLoadBalancerNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2145,9 +2130,6 @@ func awsAwsquery_serializeDocumentLoadBalancerNames(v []string, value query.Valu } func awsAwsquery_serializeDocumentLoadBalancerNamesMax20(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2175,9 +2157,6 @@ func awsAwsquery_serializeDocumentPolicyAttribute(v *types.PolicyAttribute, valu } func awsAwsquery_serializeDocumentPolicyAttributes(v []types.PolicyAttribute, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2190,9 +2169,6 @@ func awsAwsquery_serializeDocumentPolicyAttributes(v []types.PolicyAttribute, va } func awsAwsquery_serializeDocumentPolicyNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2203,9 +2179,6 @@ func awsAwsquery_serializeDocumentPolicyNames(v []string, value query.Value) err } func awsAwsquery_serializeDocumentPolicyTypeNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2216,9 +2189,6 @@ func awsAwsquery_serializeDocumentPolicyTypeNames(v []string, value query.Value) } func awsAwsquery_serializeDocumentPorts(v []int32, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2229,9 +2199,6 @@ func awsAwsquery_serializeDocumentPorts(v []int32, value query.Value) error { } func awsAwsquery_serializeDocumentSecurityGroups(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2242,9 +2209,6 @@ func awsAwsquery_serializeDocumentSecurityGroups(v []string, value query.Value) } func awsAwsquery_serializeDocumentSubnets(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2272,9 +2236,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeyList(v []types.TagKeyOnly, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2299,9 +2260,6 @@ func awsAwsquery_serializeDocumentTagKeyOnly(v *types.TagKeyOnly, value query.Va } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/elasticloadbalancingv2/serializers.go b/service/elasticloadbalancingv2/serializers.go index 3b4c67c7acc..b20ff8b99be 100644 --- a/service/elasticloadbalancingv2/serializers.go +++ b/service/elasticloadbalancingv2/serializers.go @@ -2249,9 +2249,6 @@ func awsAwsquery_serializeDocumentAction(v *types.Action, value query.Value) err } func awsAwsquery_serializeDocumentActions(v []types.Action, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2264,9 +2261,6 @@ func awsAwsquery_serializeDocumentActions(v []types.Action, value query.Value) e } func awsAwsquery_serializeDocumentAlpnPolicyName(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2450,9 +2444,6 @@ func awsAwsquery_serializeDocumentCertificate(v *types.Certificate, value query. } func awsAwsquery_serializeDocumentCertificateList(v []types.Certificate, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2555,9 +2546,6 @@ func awsAwsquery_serializeDocumentHttpRequestMethodConditionConfig(v *types.Http } func awsAwsquery_serializeDocumentListenerArns(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2568,9 +2556,6 @@ func awsAwsquery_serializeDocumentListenerArns(v []string, value query.Value) er } func awsAwsquery_serializeDocumentListOfString(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2581,9 +2566,6 @@ func awsAwsquery_serializeDocumentListOfString(v []string, value query.Value) er } func awsAwsquery_serializeDocumentLoadBalancerArns(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2611,9 +2593,6 @@ func awsAwsquery_serializeDocumentLoadBalancerAttribute(v *types.LoadBalancerAtt } func awsAwsquery_serializeDocumentLoadBalancerAttributes(v []types.LoadBalancerAttribute, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2626,9 +2605,6 @@ func awsAwsquery_serializeDocumentLoadBalancerAttributes(v []types.LoadBalancerA } func awsAwsquery_serializeDocumentLoadBalancerNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2701,9 +2677,6 @@ func awsAwsquery_serializeDocumentQueryStringKeyValuePair(v *types.QueryStringKe } func awsAwsquery_serializeDocumentQueryStringKeyValuePairList(v []types.QueryStringKeyValuePair, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2753,9 +2726,6 @@ func awsAwsquery_serializeDocumentRedirectActionConfig(v *types.RedirectActionCo } func awsAwsquery_serializeDocumentResourceArns(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2766,9 +2736,6 @@ func awsAwsquery_serializeDocumentResourceArns(v []string, value query.Value) er } func awsAwsquery_serializeDocumentRuleArns(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2840,9 +2807,6 @@ func awsAwsquery_serializeDocumentRuleCondition(v *types.RuleCondition, value qu } func awsAwsquery_serializeDocumentRuleConditionList(v []types.RuleCondition, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2855,9 +2819,6 @@ func awsAwsquery_serializeDocumentRuleConditionList(v []types.RuleCondition, val } func awsAwsquery_serializeDocumentRulePriorityList(v []types.RulePriorityPair, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2887,9 +2848,6 @@ func awsAwsquery_serializeDocumentRulePriorityPair(v *types.RulePriorityPair, va } func awsAwsquery_serializeDocumentSecurityGroups(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2914,9 +2872,6 @@ func awsAwsquery_serializeDocumentSourceIpConditionConfig(v *types.SourceIpCondi } func awsAwsquery_serializeDocumentSslPolicyNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2954,9 +2909,6 @@ func awsAwsquery_serializeDocumentSubnetMapping(v *types.SubnetMapping, value qu } func awsAwsquery_serializeDocumentSubnetMappings(v []types.SubnetMapping, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2969,9 +2921,6 @@ func awsAwsquery_serializeDocumentSubnetMappings(v []types.SubnetMapping, value } func awsAwsquery_serializeDocumentSubnets(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2999,9 +2948,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeys(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3012,9 +2958,6 @@ func awsAwsquery_serializeDocumentTagKeys(v []string, value query.Value) error { } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3049,9 +2992,6 @@ func awsAwsquery_serializeDocumentTargetDescription(v *types.TargetDescription, } func awsAwsquery_serializeDocumentTargetDescriptions(v []types.TargetDescription, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3064,9 +3004,6 @@ func awsAwsquery_serializeDocumentTargetDescriptions(v []types.TargetDescription } func awsAwsquery_serializeDocumentTargetGroupArns(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3094,9 +3031,6 @@ func awsAwsquery_serializeDocumentTargetGroupAttribute(v *types.TargetGroupAttri } func awsAwsquery_serializeDocumentTargetGroupAttributes(v []types.TargetGroupAttribute, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3109,9 +3043,6 @@ func awsAwsquery_serializeDocumentTargetGroupAttributes(v []types.TargetGroupAtt } func awsAwsquery_serializeDocumentTargetGroupList(v []types.TargetGroupTuple, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -3124,9 +3055,6 @@ func awsAwsquery_serializeDocumentTargetGroupList(v []types.TargetGroupTuple, va } func awsAwsquery_serializeDocumentTargetGroupNames(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/iam/serializers.go b/service/iam/serializers.go index bce2b67a448..6b545841637 100644 --- a/service/iam/serializers.go +++ b/service/iam/serializers.go @@ -10099,9 +10099,6 @@ func (m *awsAwsquery_serializeOpUploadSSHPublicKey) HandleSerialize(ctx context. return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentActionNameListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10112,9 +10109,6 @@ func awsAwsquery_serializeDocumentActionNameListType(v []string, value query.Val } func awsAwsquery_serializeDocumentClientIDListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10149,9 +10143,6 @@ func awsAwsquery_serializeDocumentContextEntry(v *types.ContextEntry, value quer } func awsAwsquery_serializeDocumentContextEntryListType(v []types.ContextEntry, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10164,9 +10155,6 @@ func awsAwsquery_serializeDocumentContextEntryListType(v []types.ContextEntry, v } func awsAwsquery_serializeDocumentContextKeyValueListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10177,9 +10165,6 @@ func awsAwsquery_serializeDocumentContextKeyValueListType(v []string, value quer } func awsAwsquery_serializeDocumentEntityListType(v []types.EntityType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10190,9 +10175,6 @@ func awsAwsquery_serializeDocumentEntityListType(v []types.EntityType, value que } func awsAwsquery_serializeDocumentResourceNameListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10203,9 +10185,6 @@ func awsAwsquery_serializeDocumentResourceNameListType(v []string, value query.V } func awsAwsquery_serializeDocumentServiceNamespaceListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10216,9 +10195,6 @@ func awsAwsquery_serializeDocumentServiceNamespaceListType(v []string, value que } func awsAwsquery_serializeDocumentSimulationPolicyListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10246,9 +10222,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeyListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10259,9 +10232,6 @@ func awsAwsquery_serializeDocumentTagKeyListType(v []string, value query.Value) } func awsAwsquery_serializeDocumentTagListType(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -10274,9 +10244,6 @@ func awsAwsquery_serializeDocumentTagListType(v []types.Tag, value query.Value) } func awsAwsquery_serializeDocumentThumbprintListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/neptune/serializers.go b/service/neptune/serializers.go index 5d6ee7a23a6..45f73406071 100644 --- a/service/neptune/serializers.go +++ b/service/neptune/serializers.go @@ -4433,9 +4433,6 @@ func (m *awsAwsquery_serializeOpStopDBCluster) HandleSerialize(ctx context.Conte return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentAttributeValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AttributeValue") for i := range v { @@ -4446,9 +4443,6 @@ func awsAwsquery_serializeDocumentAttributeValueList(v []string, value query.Val } func awsAwsquery_serializeDocumentAvailabilityZones(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AvailabilityZone") for i := range v { @@ -4480,9 +4474,6 @@ func awsAwsquery_serializeDocumentCloudwatchLogsExportConfiguration(v *types.Clo } func awsAwsquery_serializeDocumentDBSecurityGroupNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("DBSecurityGroupName") for i := range v { @@ -4493,9 +4484,6 @@ func awsAwsquery_serializeDocumentDBSecurityGroupNameList(v []string, value quer } func awsAwsquery_serializeDocumentEventCategoriesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("EventCategory") for i := range v { @@ -4525,9 +4513,6 @@ func awsAwsquery_serializeDocumentFilter(v *types.Filter, value query.Value) err } func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Filter") for i := range v { @@ -4540,9 +4525,6 @@ func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value } func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Value") for i := range v { @@ -4553,9 +4535,6 @@ func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) } func awsAwsquery_serializeDocumentKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4566,9 +4545,6 @@ func awsAwsquery_serializeDocumentKeyList(v []string, value query.Value) error { } func awsAwsquery_serializeDocumentLogTypeList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4636,9 +4612,6 @@ func awsAwsquery_serializeDocumentParameter(v *types.Parameter, value query.Valu } func awsAwsquery_serializeDocumentParametersList(v []types.Parameter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Parameter") for i := range v { @@ -4694,9 +4667,6 @@ func awsAwsquery_serializeDocumentServerlessV2ScalingConfiguration(v *types.Serv } func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SourceId") for i := range v { @@ -4707,9 +4677,6 @@ func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) e } func awsAwsquery_serializeDocumentStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4720,9 +4687,6 @@ func awsAwsquery_serializeDocumentStringList(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentSubnetIdentifierList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SubnetIdentifier") for i := range v { @@ -4750,9 +4714,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Tag") for i := range v { @@ -4765,9 +4726,6 @@ func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) erro } func awsAwsquery_serializeDocumentVpcSecurityGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpcSecurityGroupId") for i := range v { diff --git a/service/rds/serializers.go b/service/rds/serializers.go index 7b2ca8158bb..d258040cf7a 100644 --- a/service/rds/serializers.go +++ b/service/rds/serializers.go @@ -9037,9 +9037,6 @@ func (m *awsAwsquery_serializeOpSwitchoverReadReplica) HandleSerialize(ctx conte return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentAttributeValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AttributeValue") for i := range v { @@ -9050,9 +9047,6 @@ func awsAwsquery_serializeDocumentAttributeValueList(v []string, value query.Val } func awsAwsquery_serializeDocumentAvailabilityZones(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AvailabilityZone") for i := range v { @@ -9118,9 +9112,6 @@ func awsAwsquery_serializeDocumentConnectionPoolConfiguration(v *types.Connectio } func awsAwsquery_serializeDocumentDBSecurityGroupNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("DBSecurityGroupName") for i := range v { @@ -9131,9 +9122,6 @@ func awsAwsquery_serializeDocumentDBSecurityGroupNameList(v []string, value quer } func awsAwsquery_serializeDocumentEngineModeList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -9144,9 +9132,6 @@ func awsAwsquery_serializeDocumentEngineModeList(v []string, value query.Value) } func awsAwsquery_serializeDocumentEventCategoriesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("EventCategory") for i := range v { @@ -9176,9 +9161,6 @@ func awsAwsquery_serializeDocumentFilter(v *types.Filter, value query.Value) err } func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Filter") for i := range v { @@ -9191,9 +9173,6 @@ func awsAwsquery_serializeDocumentFilterList(v []types.Filter, value query.Value } func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Value") for i := range v { @@ -9204,9 +9183,6 @@ func awsAwsquery_serializeDocumentFilterValueList(v []string, value query.Value) } func awsAwsquery_serializeDocumentKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -9217,9 +9193,6 @@ func awsAwsquery_serializeDocumentKeyList(v []string, value query.Value) error { } func awsAwsquery_serializeDocumentLogTypeList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -9273,9 +9246,6 @@ func awsAwsquery_serializeDocumentOptionConfiguration(v *types.OptionConfigurati } func awsAwsquery_serializeDocumentOptionConfigurationList(v []types.OptionConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("OptionConfiguration") for i := range v { @@ -9288,9 +9258,6 @@ func awsAwsquery_serializeDocumentOptionConfigurationList(v []types.OptionConfig } func awsAwsquery_serializeDocumentOptionNamesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -9353,9 +9320,6 @@ func awsAwsquery_serializeDocumentOptionSetting(v *types.OptionSetting, value qu } func awsAwsquery_serializeDocumentOptionSettingsList(v []types.OptionSetting, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("OptionSetting") for i := range v { @@ -9432,9 +9396,6 @@ func awsAwsquery_serializeDocumentParameter(v *types.Parameter, value query.Valu } func awsAwsquery_serializeDocumentParametersList(v []types.Parameter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Parameter") for i := range v { @@ -9464,9 +9425,6 @@ func awsAwsquery_serializeDocumentProcessorFeature(v *types.ProcessorFeature, va } func awsAwsquery_serializeDocumentProcessorFeatureList(v []types.ProcessorFeature, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ProcessorFeature") for i := range v { @@ -9559,9 +9517,6 @@ func awsAwsquery_serializeDocumentServerlessV2ScalingConfiguration(v *types.Serv } func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SourceId") for i := range v { @@ -9572,9 +9527,6 @@ func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) e } func awsAwsquery_serializeDocumentStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -9585,9 +9537,6 @@ func awsAwsquery_serializeDocumentStringList(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentSubnetIdentifierList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SubnetIdentifier") for i := range v { @@ -9615,9 +9564,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Tag") for i := range v { @@ -9667,9 +9613,6 @@ func awsAwsquery_serializeDocumentUserAuthConfig(v *types.UserAuthConfig, value } func awsAwsquery_serializeDocumentUserAuthConfigList(v []types.UserAuthConfig, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -9682,9 +9625,6 @@ func awsAwsquery_serializeDocumentUserAuthConfigList(v []types.UserAuthConfig, v } func awsAwsquery_serializeDocumentVpcSecurityGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpcSecurityGroupId") for i := range v { diff --git a/service/redshift/serializers.go b/service/redshift/serializers.go index 5086f661e2e..18a728274f5 100644 --- a/service/redshift/serializers.go +++ b/service/redshift/serializers.go @@ -7628,9 +7628,6 @@ func (m *awsAwsquery_serializeOpUpdatePartnerStatus) HandleSerialize(ctx context return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentAttributeNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("AttributeName") for i := range v { @@ -7641,9 +7638,6 @@ func awsAwsquery_serializeDocumentAttributeNameList(v []string, value query.Valu } func awsAwsquery_serializeDocumentClusterSecurityGroupNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ClusterSecurityGroupName") for i := range v { @@ -7654,9 +7648,6 @@ func awsAwsquery_serializeDocumentClusterSecurityGroupNameList(v []string, value } func awsAwsquery_serializeDocumentDbGroupList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("DbGroup") for i := range v { @@ -7684,9 +7675,6 @@ func awsAwsquery_serializeDocumentDeleteClusterSnapshotMessage(v *types.DeleteCl } func awsAwsquery_serializeDocumentDeleteClusterSnapshotMessageList(v []types.DeleteClusterSnapshotMessage, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("DeleteClusterSnapshotMessage") for i := range v { @@ -7699,9 +7687,6 @@ func awsAwsquery_serializeDocumentDeleteClusterSnapshotMessageList(v []types.Del } func awsAwsquery_serializeDocumentEventCategoriesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("EventCategory") for i := range v { @@ -7712,9 +7697,6 @@ func awsAwsquery_serializeDocumentEventCategoriesList(v []string, value query.Va } func awsAwsquery_serializeDocumentIamRoleArnList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("IamRoleArn") for i := range v { @@ -7725,9 +7707,6 @@ func awsAwsquery_serializeDocumentIamRoleArnList(v []string, value query.Value) } func awsAwsquery_serializeDocumentLogTypeList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -7762,9 +7741,6 @@ func awsAwsquery_serializeDocumentNodeConfigurationOptionsFilter(v *types.NodeCo } func awsAwsquery_serializeDocumentNodeConfigurationOptionsFilterList(v []types.NodeConfigurationOptionsFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("NodeConfigurationOptionsFilter") for i := range v { @@ -7829,9 +7805,6 @@ func awsAwsquery_serializeDocumentParameter(v *types.Parameter, value query.Valu } func awsAwsquery_serializeDocumentParametersList(v []types.Parameter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Parameter") for i := range v { @@ -7929,9 +7902,6 @@ func awsAwsquery_serializeDocumentScheduledActionFilter(v *types.ScheduledAction } func awsAwsquery_serializeDocumentScheduledActionFilterList(v []types.ScheduledActionFilter, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ScheduledActionFilter") for i := range v { @@ -7972,9 +7942,6 @@ func awsAwsquery_serializeDocumentScheduledActionType(v *types.ScheduledActionTy } func awsAwsquery_serializeDocumentScheduleDefinitionList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("ScheduleDefinition") for i := range v { @@ -7985,9 +7952,6 @@ func awsAwsquery_serializeDocumentScheduleDefinitionList(v []string, value query } func awsAwsquery_serializeDocumentSnapshotIdentifierList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("String") for i := range v { @@ -8015,9 +7979,6 @@ func awsAwsquery_serializeDocumentSnapshotSortingEntity(v *types.SnapshotSorting } func awsAwsquery_serializeDocumentSnapshotSortingEntityList(v []types.SnapshotSortingEntity, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SnapshotSortingEntity") for i := range v { @@ -8030,9 +7991,6 @@ func awsAwsquery_serializeDocumentSnapshotSortingEntityList(v []types.SnapshotSo } func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SourceId") for i := range v { @@ -8043,9 +8001,6 @@ func awsAwsquery_serializeDocumentSourceIdsList(v []string, value query.Value) e } func awsAwsquery_serializeDocumentSubnetIdentifierList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("SubnetIdentifier") for i := range v { @@ -8073,9 +8028,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("TagKey") for i := range v { @@ -8086,9 +8038,6 @@ func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("Tag") for i := range v { @@ -8101,9 +8050,6 @@ func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) erro } func awsAwsquery_serializeDocumentTagValueList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("TagValue") for i := range v { @@ -8114,9 +8060,6 @@ func awsAwsquery_serializeDocumentTagValueList(v []string, value query.Value) er } func awsAwsquery_serializeDocumentValueStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("item") for i := range v { @@ -8127,9 +8070,6 @@ func awsAwsquery_serializeDocumentValueStringList(v []string, value query.Value) } func awsAwsquery_serializeDocumentVpcIdentifierList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpcIdentifier") for i := range v { @@ -8140,9 +8080,6 @@ func awsAwsquery_serializeDocumentVpcIdentifierList(v []string, value query.Valu } func awsAwsquery_serializeDocumentVpcSecurityGroupIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("VpcSecurityGroupId") for i := range v { diff --git a/service/ses/serializers.go b/service/ses/serializers.go index 74019462d1e..486f6ba78cf 100644 --- a/service/ses/serializers.go +++ b/service/ses/serializers.go @@ -4553,9 +4553,6 @@ func awsAwsquery_serializeDocumentAddHeaderAction(v *types.AddHeaderAction, valu } func awsAwsquery_serializeDocumentAddressList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4648,9 +4645,6 @@ func awsAwsquery_serializeDocumentBouncedRecipientInfo(v *types.BouncedRecipient } func awsAwsquery_serializeDocumentBouncedRecipientInfoList(v []types.BouncedRecipientInfo, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4689,9 +4683,6 @@ func awsAwsquery_serializeDocumentBulkEmailDestination(v *types.BulkEmailDestina } func awsAwsquery_serializeDocumentBulkEmailDestinationList(v []types.BulkEmailDestination, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4740,9 +4731,6 @@ func awsAwsquery_serializeDocumentCloudWatchDimensionConfiguration(v *types.Clou } func awsAwsquery_serializeDocumentCloudWatchDimensionConfigurations(v []types.CloudWatchDimensionConfiguration, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4767,9 +4755,6 @@ func awsAwsquery_serializeDocumentConfigurationSet(v *types.ConfigurationSet, va } func awsAwsquery_serializeDocumentConfigurationSetAttributeList(v []types.ConfigurationSetAttribute, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4882,9 +4867,6 @@ func awsAwsquery_serializeDocumentEventDestination(v *types.EventDestination, va } func awsAwsquery_serializeDocumentEventTypes(v []types.EventType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4912,9 +4894,6 @@ func awsAwsquery_serializeDocumentExtensionField(v *types.ExtensionField, value } func awsAwsquery_serializeDocumentExtensionFieldList(v []types.ExtensionField, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -4927,9 +4906,6 @@ func awsAwsquery_serializeDocumentExtensionFieldList(v []types.ExtensionField, v } func awsAwsquery_serializeDocumentIdentityList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5041,9 +5017,6 @@ func awsAwsquery_serializeDocumentMessageTag(v *types.MessageTag, value query.Va } func awsAwsquery_serializeDocumentMessageTagList(v []types.MessageTag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5056,9 +5029,6 @@ func awsAwsquery_serializeDocumentMessageTagList(v []types.MessageTag, value que } func awsAwsquery_serializeDocumentPolicyNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5137,9 +5107,6 @@ func awsAwsquery_serializeDocumentReceiptAction(v *types.ReceiptAction, value qu } func awsAwsquery_serializeDocumentReceiptActionsList(v []types.ReceiptAction, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5229,9 +5196,6 @@ func awsAwsquery_serializeDocumentReceiptRule(v *types.ReceiptRule, value query. } func awsAwsquery_serializeDocumentReceiptRuleNamesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -5286,9 +5250,6 @@ func awsAwsquery_serializeDocumentRecipientDsnFields(v *types.RecipientDsnFields } func awsAwsquery_serializeDocumentRecipientsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/sns/serializers.go b/service/sns/serializers.go index 5c804c83a91..f5424f42e34 100644 --- a/service/sns/serializers.go +++ b/service/sns/serializers.go @@ -2700,9 +2700,6 @@ func (m *awsAwsquery_serializeOpVerifySMSSandboxPhoneNumber) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentActionsList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2713,9 +2710,6 @@ func awsAwsquery_serializeDocumentActionsList(v []string, value query.Value) err } func awsAwsquery_serializeDocumentDelegatesList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2726,9 +2720,6 @@ func awsAwsquery_serializeDocumentDelegatesList(v []string, value query.Value) e } func awsAwsquery_serializeDocumentListString(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2846,9 +2837,6 @@ func awsAwsquery_serializeDocumentPublishBatchRequestEntry(v *types.PublishBatch } func awsAwsquery_serializeDocumentPublishBatchRequestEntryList(v []types.PublishBatchRequestEntry, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2897,9 +2885,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -2910,9 +2895,6 @@ func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentTagList(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/sqs/serializers.go b/service/sqs/serializers.go index c8426da449e..114073aaef7 100644 --- a/service/sqs/serializers.go +++ b/service/sqs/serializers.go @@ -1296,9 +1296,6 @@ func (m *awsAwsquery_serializeOpUntagQueue) HandleSerialize(ctx context.Context, return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentActionNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1309,9 +1306,6 @@ func awsAwsquery_serializeDocumentActionNameList(v []string, value query.Value) } func awsAwsquery_serializeDocumentAttributeNameList(v []types.QueueAttributeName, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1322,9 +1316,6 @@ func awsAwsquery_serializeDocumentAttributeNameList(v []types.QueueAttributeName } func awsAwsquery_serializeDocumentAWSAccountIdList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1335,9 +1326,6 @@ func awsAwsquery_serializeDocumentAWSAccountIdList(v []string, value query.Value } func awsAwsquery_serializeDocumentBinaryList(v [][]byte, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("BinaryListValue") for i := range v { @@ -1373,9 +1361,6 @@ func awsAwsquery_serializeDocumentChangeMessageVisibilityBatchRequestEntry(v *ty } func awsAwsquery_serializeDocumentChangeMessageVisibilityBatchRequestEntryList(v []types.ChangeMessageVisibilityBatchRequestEntry, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1405,9 +1390,6 @@ func awsAwsquery_serializeDocumentDeleteMessageBatchRequestEntry(v *types.Delete } func awsAwsquery_serializeDocumentDeleteMessageBatchRequestEntryList(v []types.DeleteMessageBatchRequestEntry, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1420,9 +1402,6 @@ func awsAwsquery_serializeDocumentDeleteMessageBatchRequestEntryList(v []types.D } func awsAwsquery_serializeDocumentMessageAttributeNameList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1614,9 +1593,6 @@ func awsAwsquery_serializeDocumentSendMessageBatchRequestEntry(v *types.SendMess } func awsAwsquery_serializeDocumentSendMessageBatchRequestEntryList(v []types.SendMessageBatchRequestEntry, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -1629,9 +1605,6 @@ func awsAwsquery_serializeDocumentSendMessageBatchRequestEntryList(v []types.Sen } func awsAwsquery_serializeDocumentStringList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("StringListValue") for i := range v { @@ -1642,9 +1615,6 @@ func awsAwsquery_serializeDocumentStringList(v []string, value query.Value) erro } func awsAwsquery_serializeDocumentTagKeyList(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { diff --git a/service/sts/serializers.go b/service/sts/serializers.go index 05531d36959..eb60f61b16a 100644 --- a/service/sts/serializers.go +++ b/service/sts/serializers.go @@ -523,9 +523,6 @@ func (m *awsAwsquery_serializeOpGetSessionToken) HandleSerialize(ctx context.Con return next.HandleSerialize(ctx, in) } func awsAwsquery_serializeDocumentPolicyDescriptorListType(v []types.PolicyDescriptorType, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -567,9 +564,6 @@ func awsAwsquery_serializeDocumentTag(v *types.Tag, value query.Value) error { } func awsAwsquery_serializeDocumentTagKeyListType(v []string, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v { @@ -580,9 +574,6 @@ func awsAwsquery_serializeDocumentTagKeyListType(v []string, value query.Value) } func awsAwsquery_serializeDocumentTagListType(v []types.Tag, value query.Value) error { - if len(v) == 0 { - return nil - } array := value.Array("member") for i := range v {