diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AssembleMiddlewareStack.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AssembleMiddlewareStack.java index 27a97ae3091..34a19c66f16 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AssembleMiddlewareStack.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AssembleMiddlewareStack.java @@ -4,6 +4,7 @@ import java.util.Map; import software.amazon.smithy.aws.traits.auth.SigV4Trait; import software.amazon.smithy.aws.traits.auth.UnsignedPayloadTrait; +import software.amazon.smithy.go.codegen.SmithyGoDependency; import software.amazon.smithy.go.codegen.SymbolUtils; import software.amazon.smithy.go.codegen.integration.GoIntegration; import software.amazon.smithy.go.codegen.integration.MiddlewareRegistrar; @@ -43,6 +44,16 @@ public List getClientPlugins() { ) .build(), + // Add ContentLengthMiddleware to operation stack + RuntimeClientPlugin.builder() + .registerMiddleware(MiddlewareRegistrar.builder() + .resolvedFunction(SymbolUtils.createValueSymbolBuilder( + "AddContentLengthMiddleware", SmithyGoDependency.SMITHY_HTTP_TRANSPORT) + .build()) + .build() + ) + .build(), + // Add endpoint serialize middleware to operation stack RuntimeClientPlugin.builder() .registerMiddleware(MiddlewareRegistrar.builder() diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java index edcfa2631cd..39257730d37 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java @@ -76,7 +76,6 @@ static void generateHttpProtocolTests(GenerationContext context) { writer.addUseImports(SmithyGoDependency.SMITHY_MIDDLEWARE); writer.openBlock("[]APIOptionFunc{", "},", () -> { writer.openBlock("func(s *middleware.Stack) error {", "},", () -> { - writer.write("s.Build.Clear()"); writer.write("s.Finalize.Clear()"); writer.write("return nil"); }); diff --git a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go index c1aa800acb1..0b9f43d10d2 100644 --- a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go +++ b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes.go @@ -20,6 +20,7 @@ func (c *Client) AllQueryStringTypes(ctx context.Context, params *AllQueryString fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go index 59097635ea1..e0d624a624d 100644 --- a/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go +++ b/internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go @@ -15,6 +15,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" "time" ) @@ -138,6 +139,9 @@ func TestClient_AllQueryStringTypes_awsRestjson1Serialize(t *testing.T) { 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) @@ -150,7 +154,6 @@ func TestClient_AllQueryStringTypes_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString.go b/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString.go index 33a36d9b71c..771fa1ad65a 100644 --- a/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString.go +++ b/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString.go @@ -20,6 +20,7 @@ func (c *Client) ConstantAndVariableQueryString(ctx context.Context, params *Con fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString_test.go b/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString_test.go index 6baa601bde2..f7cd4dbd4d7 100644 --- a/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString_test.go +++ b/internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -74,6 +75,9 @@ func TestClient_ConstantAndVariableQueryString_awsRestjson1Serialize(t *testing. 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) @@ -86,7 +90,6 @@ func TestClient_ConstantAndVariableQueryString_awsRestjson1Serialize(t *testing. client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_ConstantQueryString.go b/internal/protocoltest/awsrestjson/api_op_ConstantQueryString.go index 34a001bf5e2..01b8b25c136 100644 --- a/internal/protocoltest/awsrestjson/api_op_ConstantQueryString.go +++ b/internal/protocoltest/awsrestjson/api_op_ConstantQueryString.go @@ -21,6 +21,7 @@ func (c *Client) ConstantQueryString(ctx context.Context, params *ConstantQueryS fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_ConstantQueryString_test.go b/internal/protocoltest/awsrestjson/api_op_ConstantQueryString_test.go index 692ba3b717c..fc8cb62fbc1 100644 --- a/internal/protocoltest/awsrestjson/api_op_ConstantQueryString_test.go +++ b/internal/protocoltest/awsrestjson/api_op_ConstantQueryString_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -54,6 +55,9 @@ func TestClient_ConstantQueryString_awsRestjson1Serialize(t *testing.T) { 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) @@ -66,7 +70,6 @@ func TestClient_ConstantQueryString_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput.go b/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput.go index db14d5bef01..8fb4cdde872 100644 --- a/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput.go +++ b/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput.go @@ -21,6 +21,7 @@ func (c *Client) EmptyInputAndEmptyOutput(ctx context.Context, params *EmptyInpu fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput_test.go b/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput_test.go index 597b4785f12..8a6a90037ae 100644 --- a/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput_test.go +++ b/internal/protocoltest/awsrestjson/api_op_EmptyInputAndEmptyOutput_test.go @@ -52,6 +52,9 @@ func TestClient_EmptyInputAndEmptyOutput_awsRestjson1Serialize(t *testing.T) { 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) @@ -64,7 +67,6 @@ func TestClient_EmptyInputAndEmptyOutput_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -158,7 +160,6 @@ func TestClient_EmptyInputAndEmptyOutput_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors.go b/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors.go index 2707af5f29d..4e4334479d0 100644 --- a/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors.go +++ b/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors.go @@ -32,6 +32,7 @@ func (c *Client) GreetingWithErrors(ctx context.Context, params *GreetingWithErr fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors_test.go b/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors_test.go index 84d0b7e774c..f2c98e9cf71 100644 --- a/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors_test.go +++ b/internal/protocoltest/awsrestjson/api_op_GreetingWithErrors_test.go @@ -70,7 +70,6 @@ func TestClient_GreetingWithErrors_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -247,7 +246,6 @@ func TestClient_GreetingWithErrors_FooError_awsRestjson1Deserialize(t *testing.T client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -360,7 +358,6 @@ func TestClient_GreetingWithErrors_ComplexError_awsRestjson1Deserialize(t *testi client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -455,7 +452,6 @@ func TestClient_GreetingWithErrors_InvalidGreeting_awsRestjson1Deserialize(t *te client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits.go b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits.go index 3639f58e3a9..9ca6d7b582e 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits.go @@ -19,6 +19,7 @@ func (c *Client) HttpPayloadTraits(ctx context.Context, params *HttpPayloadTrait fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType.go b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType.go index 1d00c633c11..c533e5a5de6 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType.go @@ -19,6 +19,7 @@ func (c *Client) HttpPayloadTraitsWithMediaType(ctx context.Context, params *Htt fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType_test.go b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType_test.go index 076a6c74c8d..6ddc643a557 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType_test.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraitsWithMediaType_test.go @@ -46,6 +46,9 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestjson1Serialize(t *testing. "Content-Type": []string{"text/plain"}, "X-Foo": []string{"Foo"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyAssert: func(actual io.Reader) error { return smithytesting.CompareReaderBytes(actual, []byte(`blobby blob blob`)) }, @@ -59,6 +62,9 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestjson1Serialize(t *testing. 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) @@ -71,7 +77,6 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestjson1Serialize(t *testing. client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -164,7 +169,6 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestjson1Deserialize(t *testin client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits_test.go b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits_test.go index cf13e0a6cf6..8b9b3aa931d 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits_test.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPayloadTraits_test.go @@ -45,6 +45,9 @@ func TestClient_HttpPayloadTraits_awsRestjson1Serialize(t *testing.T) { ExpectHeader: http.Header{ "X-Foo": []string{"Foo"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyAssert: func(actual io.Reader) error { return smithytesting.CompareReaderBytes(actual, []byte(`blobby blob blob`)) }, @@ -73,6 +76,9 @@ func TestClient_HttpPayloadTraits_awsRestjson1Serialize(t *testing.T) { 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) @@ -85,7 +91,6 @@ func TestClient_HttpPayloadTraits_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -188,7 +193,6 @@ func TestClient_HttpPayloadTraits_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure.go b/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure.go index 2467dde1488..6e62d116998 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure.go @@ -20,6 +20,7 @@ func (c *Client) HttpPayloadWithStructure(ctx context.Context, params *HttpPaylo fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure_test.go b/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure_test.go index da345336561..e34689f9ae1 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure_test.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPayloadWithStructure_test.go @@ -48,6 +48,9 @@ func TestClient_HttpPayloadWithStructure_awsRestjson1Serialize(t *testing.T) { ExpectHeader: http.Header{ "Content-Type": []string{"application/json"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ @@ -65,6 +68,9 @@ func TestClient_HttpPayloadWithStructure_awsRestjson1Serialize(t *testing.T) { 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) @@ -77,7 +83,6 @@ func TestClient_HttpPayloadWithStructure_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -175,7 +180,6 @@ func TestClient_HttpPayloadWithStructure_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders.go b/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders.go index 7948430770e..524e33e5a76 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders.go @@ -18,6 +18,7 @@ func (c *Client) HttpPrefixHeaders(ctx context.Context, params *HttpPrefixHeader fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go b/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go index 31864cdd1a6..268917f5d43 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go @@ -79,6 +79,9 @@ func TestClient_HttpPrefixHeaders_awsRestjson1Serialize(t *testing.T) { 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) @@ -91,7 +94,6 @@ func TestClient_HttpPrefixHeaders_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -188,7 +190,6 @@ func TestClient_HttpPrefixHeaders_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath.go b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath.go index 8b4123e08a3..ef2e9f26ed3 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath.go @@ -17,6 +17,7 @@ func (c *Client) HttpRequestWithGreedyLabelInPath(ctx context.Context, params *H fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath_test.go b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath_test.go index 7f3fb7cf66d..eac5e3b5ca3 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath_test.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithGreedyLabelInPath_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -52,6 +53,9 @@ func TestClient_HttpRequestWithGreedyLabelInPath_awsRestjson1Serialize(t *testin 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) @@ -64,7 +68,6 @@ func TestClient_HttpRequestWithGreedyLabelInPath_awsRestjson1Serialize(t *testin client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels.go b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels.go index 95f49b0b0e8..543b8ca4ba7 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels.go @@ -20,6 +20,7 @@ func (c *Client) HttpRequestWithLabels(ctx context.Context, params *HttpRequestW fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat.go b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat.go index b67e2c53933..ed83f7070f6 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat.go @@ -20,6 +20,7 @@ func (c *Client) HttpRequestWithLabelsAndTimestampFormat(ctx context.Context, pa fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go index da8450785b5..075e4b48d9f 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go @@ -14,6 +14,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -58,6 +59,9 @@ func TestClient_HttpRequestWithLabelsAndTimestampFormat_awsRestjson1Serialize(t 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) @@ -70,7 +74,6 @@ func TestClient_HttpRequestWithLabelsAndTimestampFormat_awsRestjson1Serialize(t client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels_test.go b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels_test.go index 778c5c79990..2117dd36643 100644 --- a/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels_test.go +++ b/internal/protocoltest/awsrestjson/api_op_HttpRequestWithLabels_test.go @@ -14,6 +14,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -59,6 +60,9 @@ func TestClient_HttpRequestWithLabels_awsRestjson1Serialize(t *testing.T) { 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) @@ -71,7 +75,6 @@ func TestClient_HttpRequestWithLabels_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse.go b/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse.go index e3d38ec0c36..9b391a43971 100644 --- a/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse.go +++ b/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse.go @@ -20,6 +20,7 @@ func (c *Client) IgnoreQueryParamsInResponse(ctx context.Context, params *Ignore fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse_test.go b/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse_test.go index 98534f413e4..26eed797e65 100644 --- a/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse_test.go +++ b/internal/protocoltest/awsrestjson/api_op_IgnoreQueryParamsInResponse_test.go @@ -61,7 +61,6 @@ func TestClient_IgnoreQueryParamsInResponse_awsRestjson1Deserialize(t *testing.T client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_InlineDocument.go b/internal/protocoltest/awsrestjson/api_op_InlineDocument.go index 06f86179cbb..0f06db16846 100644 --- a/internal/protocoltest/awsrestjson/api_op_InlineDocument.go +++ b/internal/protocoltest/awsrestjson/api_op_InlineDocument.go @@ -18,6 +18,7 @@ func (c *Client) InlineDocument(ctx context.Context, params *InlineDocumentInput fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload.go b/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload.go index 8c5e67a59c4..6af1e29f70f 100644 --- a/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload.go +++ b/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload.go @@ -18,6 +18,7 @@ func (c *Client) InlineDocumentAsPayload(ctx context.Context, params *InlineDocu fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload_test.go b/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload_test.go index 928c12e10ae..652c09a44e5 100644 --- a/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload_test.go +++ b/internal/protocoltest/awsrestjson/api_op_InlineDocumentAsPayload_test.go @@ -59,6 +59,9 @@ func TestClient_InlineDocumentAsPayload_awsRestjson1Serialize(t *testing.T) { 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) @@ -71,7 +74,6 @@ func TestClient_InlineDocumentAsPayload_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -165,7 +167,6 @@ func TestClient_InlineDocumentAsPayload_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_InlineDocument_test.go b/internal/protocoltest/awsrestjson/api_op_InlineDocument_test.go index 72236076500..a320094b124 100644 --- a/internal/protocoltest/awsrestjson/api_op_InlineDocument_test.go +++ b/internal/protocoltest/awsrestjson/api_op_InlineDocument_test.go @@ -65,6 +65,9 @@ func TestClient_InlineDocument_awsRestjson1Serialize(t *testing.T) { 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) @@ -77,7 +80,6 @@ func TestClient_InlineDocument_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -176,7 +178,6 @@ func TestClient_InlineDocument_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go index 95a312584d0..6e7575c6429 100644 --- a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go +++ b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders.go @@ -21,6 +21,7 @@ func (c *Client) InputAndOutputWithHeaders(ctx context.Context, params *InputAnd fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go index 760a88cf89d..36ce3042422 100644 --- a/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go +++ b/internal/protocoltest/awsrestjson/api_op_InputAndOutputWithHeaders_test.go @@ -165,6 +165,9 @@ func TestClient_InputAndOutputWithHeaders_awsRestjson1Serialize(t *testing.T) { 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) @@ -177,7 +180,6 @@ func TestClient_InputAndOutputWithHeaders_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -357,7 +359,6 @@ func TestClient_InputAndOutputWithHeaders_awsRestjson1Deserialize(t *testing.T) client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_JsonBlobs.go b/internal/protocoltest/awsrestjson/api_op_JsonBlobs.go index 0587c936483..5694809c283 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonBlobs.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonBlobs.go @@ -18,6 +18,7 @@ func (c *Client) JsonBlobs(ctx context.Context, params *JsonBlobsInput, optFns . fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_JsonBlobs_test.go b/internal/protocoltest/awsrestjson/api_op_JsonBlobs_test.go index b6782be3454..a63b91398c8 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonBlobs_test.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonBlobs_test.go @@ -59,6 +59,9 @@ func TestClient_JsonBlobs_awsRestjson1Serialize(t *testing.T) { 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) @@ -71,7 +74,6 @@ func TestClient_JsonBlobs_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -165,7 +167,6 @@ func TestClient_JsonBlobs_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_JsonEnums.go b/internal/protocoltest/awsrestjson/api_op_JsonEnums.go index 6453b73cf54..2c615fe4ae0 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonEnums.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonEnums.go @@ -19,6 +19,7 @@ func (c *Client) JsonEnums(ctx context.Context, params *JsonEnumsInput, optFns . fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_JsonEnums_test.go b/internal/protocoltest/awsrestjson/api_op_JsonEnums_test.go index 9dfcebaff83..4123e437d02 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonEnums_test.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonEnums_test.go @@ -88,6 +88,9 @@ func TestClient_JsonEnums_awsRestjson1Serialize(t *testing.T) { 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) @@ -100,7 +103,6 @@ func TestClient_JsonEnums_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -222,7 +224,6 @@ func TestClient_JsonEnums_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_JsonLists.go b/internal/protocoltest/awsrestjson/api_op_JsonLists.go index 4494f6d772a..7c048afce11 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonLists.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonLists.go @@ -30,6 +30,7 @@ func (c *Client) JsonLists(ctx context.Context, params *JsonListsInput, optFns . fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go b/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go index 86c193ee70b..9f06838483e 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonLists_test.go @@ -189,6 +189,9 @@ func TestClient_JsonLists_awsRestjson1Serialize(t *testing.T) { 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) @@ -201,7 +204,6 @@ func TestClient_JsonLists_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -413,7 +415,6 @@ func TestClient_JsonLists_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_JsonMaps.go b/internal/protocoltest/awsrestjson/api_op_JsonMaps.go index 74848751739..e1376c7629a 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonMaps.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonMaps.go @@ -19,6 +19,7 @@ func (c *Client) JsonMaps(ctx context.Context, params *JsonMapsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_JsonMaps_test.go b/internal/protocoltest/awsrestjson/api_op_JsonMaps_test.go index 8f8a43df580..79c609da6d9 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonMaps_test.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonMaps_test.go @@ -97,6 +97,9 @@ func TestClient_JsonMaps_awsRestjson1Serialize(t *testing.T) { 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) @@ -109,7 +112,6 @@ func TestClient_JsonMaps_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -235,7 +237,6 @@ func TestClient_JsonMaps_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go index d955523491c..271626f196b 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps.go @@ -20,6 +20,7 @@ func (c *Client) JsonTimestamps(ctx context.Context, params *JsonTimestampsInput fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go index f53ced1b08b..dfad5120c5c 100644 --- a/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go +++ b/internal/protocoltest/awsrestjson/api_op_JsonTimestamps_test.go @@ -115,6 +115,9 @@ func TestClient_JsonTimestamps_awsRestjson1Serialize(t *testing.T) { 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) @@ -127,7 +130,6 @@ func TestClient_JsonTimestamps_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -263,7 +265,6 @@ func TestClient_JsonTimestamps_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput.go b/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput.go index 006c455ca03..5f050ab1ca9 100644 --- a/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput.go +++ b/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput.go @@ -20,6 +20,7 @@ func (c *Client) NoInputAndNoOutput(ctx context.Context, params *NoInputAndNoOut fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput_test.go b/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput_test.go index 2b76a8c4639..64ccc379463 100644 --- a/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput_test.go +++ b/internal/protocoltest/awsrestjson/api_op_NoInputAndNoOutput_test.go @@ -48,6 +48,9 @@ func TestClient_NoInputAndNoOutput_awsRestjson1Serialize(t *testing.T) { 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) @@ -60,7 +63,6 @@ func TestClient_NoInputAndNoOutput_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -145,7 +147,6 @@ func TestClient_NoInputAndNoOutput_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput.go b/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput.go index 02ba1d3e5df..b1efeab5b69 100644 --- a/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput.go +++ b/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput.go @@ -20,6 +20,7 @@ func (c *Client) NoInputAndOutput(ctx context.Context, params *NoInputAndOutputI fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput_test.go b/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput_test.go index f2225c22f6e..652def8512f 100644 --- a/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput_test.go +++ b/internal/protocoltest/awsrestjson/api_op_NoInputAndOutput_test.go @@ -48,6 +48,9 @@ func TestClient_NoInputAndOutput_awsRestjson1Serialize(t *testing.T) { 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) @@ -60,7 +63,6 @@ func TestClient_NoInputAndOutput_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -145,7 +147,6 @@ func TestClient_NoInputAndOutput_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient.go b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient.go index 5ed9fbcb2a4..2adef1bff4b 100644 --- a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient.go +++ b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient.go @@ -18,6 +18,7 @@ func (c *Client) NullAndEmptyHeadersClient(ctx context.Context, params *NullAndE fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go index 417ab9cf225..c354d92ff99 100644 --- a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go +++ b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -58,6 +59,9 @@ func TestClient_NullAndEmptyHeadersClient_awsRestjson1Serialize(t *testing.T) { 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) @@ -70,7 +74,6 @@ func TestClient_NullAndEmptyHeadersClient_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersServer.go b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersServer.go index d78681a9320..3314120f7c8 100644 --- a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersServer.go +++ b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersServer.go @@ -18,6 +18,7 @@ func (c *Client) NullAndEmptyHeadersServer(ctx context.Context, params *NullAndE fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString.go b/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString.go index b8cfadb38e2..86351da6b86 100644 --- a/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString.go +++ b/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString.go @@ -18,6 +18,7 @@ func (c *Client) OmitsNullSerializesEmptyString(ctx context.Context, params *Omi fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString_test.go b/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString_test.go index 8d0b60d17a1..077d66fee19 100644 --- a/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString_test.go +++ b/internal/protocoltest/awsrestjson/api_op_OmitsNullSerializesEmptyString_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -54,6 +55,9 @@ func TestClient_OmitsNullSerializesEmptyString_awsRestjson1Serialize(t *testing. 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) @@ -66,7 +70,6 @@ func TestClient_OmitsNullSerializesEmptyString_awsRestjson1Serialize(t *testing. client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill.go b/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill.go index fadac0db269..d34c1540585 100644 --- a/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill.go +++ b/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill.go @@ -19,6 +19,7 @@ func (c *Client) QueryIdempotencyTokenAutoFill(ctx context.Context, params *Quer fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill_test.go b/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill_test.go index 78336096870..1600de76689 100644 --- a/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill_test.go +++ b/internal/protocoltest/awsrestjson/api_op_QueryIdempotencyTokenAutoFill_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -65,6 +66,9 @@ func TestClient_QueryIdempotencyTokenAutoFill_awsRestjson1Serialize(t *testing.T 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) @@ -77,7 +81,6 @@ func TestClient_QueryIdempotencyTokenAutoFill_awsRestjson1Serialize(t *testing.T client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_RecursiveShapes.go b/internal/protocoltest/awsrestjson/api_op_RecursiveShapes.go index 0fd3ad05478..2d3bc18a357 100644 --- a/internal/protocoltest/awsrestjson/api_op_RecursiveShapes.go +++ b/internal/protocoltest/awsrestjson/api_op_RecursiveShapes.go @@ -19,6 +19,7 @@ func (c *Client) RecursiveShapes(ctx context.Context, params *RecursiveShapesInp fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_RecursiveShapes_test.go b/internal/protocoltest/awsrestjson/api_op_RecursiveShapes_test.go index e177ddb49ef..2a763f51962 100644 --- a/internal/protocoltest/awsrestjson/api_op_RecursiveShapes_test.go +++ b/internal/protocoltest/awsrestjson/api_op_RecursiveShapes_test.go @@ -83,6 +83,9 @@ func TestClient_RecursiveShapes_awsRestjson1Serialize(t *testing.T) { 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) @@ -95,7 +98,6 @@ func TestClient_RecursiveShapes_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -211,7 +213,6 @@ func TestClient_RecursiveShapes_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties.go b/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties.go index 232b83c8d25..7c1a6e86a12 100644 --- a/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties.go +++ b/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties.go @@ -17,6 +17,7 @@ func (c *Client) SimpleScalarProperties(ctx context.Context, params *SimpleScala fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties_test.go b/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties_test.go index a30a735b093..7d03a28376c 100644 --- a/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties_test.go +++ b/internal/protocoltest/awsrestjson/api_op_SimpleScalarProperties_test.go @@ -93,6 +93,9 @@ func TestClient_SimpleScalarProperties_awsRestjson1Serialize(t *testing.T) { 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) @@ -105,7 +108,6 @@ func TestClient_SimpleScalarProperties_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -228,7 +230,6 @@ func TestClient_SimpleScalarProperties_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders.go b/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders.go index 219528f8171..af808e8d951 100644 --- a/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders.go +++ b/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders.go @@ -19,6 +19,7 @@ func (c *Client) TimestampFormatHeaders(ctx context.Context, params *TimestampFo fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders_test.go b/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders_test.go index 57a0d9e0b07..7864ddf91e9 100644 --- a/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders_test.go +++ b/internal/protocoltest/awsrestjson/api_op_TimestampFormatHeaders_test.go @@ -70,6 +70,9 @@ func TestClient_TimestampFormatHeaders_awsRestjson1Serialize(t *testing.T) { 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) @@ -82,7 +85,6 @@ func TestClient_TimestampFormatHeaders_awsRestjson1Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -185,7 +187,6 @@ func TestClient_TimestampFormatHeaders_awsRestjson1Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/awsrestjson/deserializers.go b/internal/protocoltest/awsrestjson/deserializers.go index 1140fce77f9..2be2e392301 100644 --- a/internal/protocoltest/awsrestjson/deserializers.go +++ b/internal/protocoltest/awsrestjson/deserializers.go @@ -21,14 +21,14 @@ import ( "time" ) -type awsRestjson1_deserializeOpJsonEnums struct { +type awsRestjson1_deserializeOpInlineDocument struct { } -func (*awsRestjson1_deserializeOpJsonEnums) ID() string { +func (*awsRestjson1_deserializeOpInlineDocument) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpJsonEnums) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpInlineDocument) 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) @@ -56,7 +56,7 @@ func (m *awsRestjson1_deserializeOpJsonEnums) HandleDeserialize(ctx context.Cont return out, metadata, genericError } - output := &JsonEnumsOutput{} + output := &InlineDocumentOutput{} out.Result = output buff := make([]byte, 1024) @@ -68,7 +68,7 @@ func (m *awsRestjson1_deserializeOpJsonEnums) HandleDeserialize(ctx context.Cont decoder := json.NewDecoder(body) decoder.UseNumber() - err = awsRestjson1_deserializeDocumentJsonEnumsOutput(&output, decoder) + err = awsRestjson1_deserializeDocumentInlineDocumentOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -81,7 +81,7 @@ func (m *awsRestjson1_deserializeOpJsonEnums) HandleDeserialize(ctx context.Cont return out, metadata, err } -func awsRestjson1_deserializeDocumentJsonEnumsOutput(v **JsonEnumsOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeDocumentInlineDocumentOutput(v **InlineDocumentOutput, decoder *json.Decoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -99,9 +99,9 @@ func awsRestjson1_deserializeDocumentJsonEnumsOutput(v **JsonEnumsOutput, decode return fmt.Errorf("expect `{` as start token") } - var sv *JsonEnumsOutput + var sv *InlineDocumentOutput if *v == nil { - sv = &JsonEnumsOutput{} + sv = &InlineDocumentOutput{} } else { sv = *v } @@ -112,33 +112,12 @@ func awsRestjson1_deserializeDocumentJsonEnumsOutput(v **JsonEnumsOutput, decode return err } switch t { - case "fooEnum1": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected FooEnum to be of type string, got %T instead", val) - } - sv.FooEnum1 = types.FooEnum(jtv) - } - - case "fooEnum2": - val, err := decoder.Token() - if err != nil { + case "documentValue": + if err := awsRestjson1_deserializeDocumentDocument(&sv.DocumentValue, decoder); err != nil { return err } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected FooEnum to be of type string, got %T instead", val) - } - sv.FooEnum2 = types.FooEnum(jtv) - } - case "fooEnum3": + case "stringValue": val, err := decoder.Token() if err != nil { return err @@ -146,24 +125,9 @@ func awsRestjson1_deserializeDocumentJsonEnumsOutput(v **JsonEnumsOutput, decode if val != nil { jtv, ok := val.(string) if !ok { - return fmt.Errorf("expected FooEnum to be of type string, got %T instead", val) + return fmt.Errorf("expected String to be of type string, got %T instead", val) } - sv.FooEnum3 = types.FooEnum(jtv) - } - - case "fooEnumList": - if err := awsRestjson1_deserializeDocumentFooEnumList(&sv.FooEnumList, decoder); err != nil { - return err - } - - case "fooEnumMap": - if err := awsRestjson1_deserializeDocumentFooEnumMap(&sv.FooEnumMap, decoder); err != nil { - return err - } - - case "fooEnumSet": - if err := awsRestjson1_deserializeDocumentFooEnumSet(&sv.FooEnumSet, decoder); err != nil { - return err + sv.StringValue = &jtv } default: @@ -186,14 +150,14 @@ func awsRestjson1_deserializeDocumentJsonEnumsOutput(v **JsonEnumsOutput, decode return nil } -type awsRestjson1_deserializeOpJsonBlobs struct { +type awsRestjson1_deserializeOpInlineDocumentAsPayload struct { } -func (*awsRestjson1_deserializeOpJsonBlobs) ID() string { +func (*awsRestjson1_deserializeOpInlineDocumentAsPayload) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpJsonBlobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpInlineDocumentAsPayload) 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) @@ -221,7 +185,7 @@ func (m *awsRestjson1_deserializeOpJsonBlobs) HandleDeserialize(ctx context.Cont return out, metadata, genericError } - output := &JsonBlobsOutput{} + output := &InlineDocumentAsPayloadOutput{} out.Result = output buff := make([]byte, 1024) @@ -233,7 +197,7 @@ func (m *awsRestjson1_deserializeOpJsonBlobs) HandleDeserialize(ctx context.Cont decoder := json.NewDecoder(body) decoder.UseNumber() - err = awsRestjson1_deserializeDocumentJsonBlobsOutput(&output, decoder) + err = awsRestjson1_deserializeDocumentDocument(&output.DocumentValue, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -246,7 +210,7 @@ func (m *awsRestjson1_deserializeOpJsonBlobs) HandleDeserialize(ctx context.Cont return out, metadata, err } -func awsRestjson1_deserializeDocumentJsonBlobsOutput(v **JsonBlobsOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeDocumentInlineDocumentAsPayloadOutput(v **InlineDocumentAsPayloadOutput, decoder *json.Decoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -264,9 +228,9 @@ func awsRestjson1_deserializeDocumentJsonBlobsOutput(v **JsonBlobsOutput, decode return fmt.Errorf("expect `{` as start token") } - var sv *JsonBlobsOutput + var sv *InlineDocumentAsPayloadOutput if *v == nil { - sv = &JsonBlobsOutput{} + sv = &InlineDocumentAsPayloadOutput{} } else { sv = *v } @@ -277,9 +241,8 @@ func awsRestjson1_deserializeDocumentJsonBlobsOutput(v **JsonBlobsOutput, decode return err } switch t { - case "data": - err := decoder.Decode(&sv.Data) - if err != nil { + case "documentValue": + if err := awsRestjson1_deserializeDocumentDocument(&sv.DocumentValue, decoder); err != nil { return err } @@ -303,14 +266,14 @@ func awsRestjson1_deserializeDocumentJsonBlobsOutput(v **JsonBlobsOutput, decode return nil } -type awsRestjson1_deserializeOpTimestampFormatHeaders struct { +type awsRestjson1_deserializeOpJsonLists struct { } -func (*awsRestjson1_deserializeOpTimestampFormatHeaders) ID() string { +func (*awsRestjson1_deserializeOpJsonLists) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpTimestampFormatHeaders) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpJsonLists) 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) @@ -338,97 +301,130 @@ func (m *awsRestjson1_deserializeOpTimestampFormatHeaders) HandleDeserialize(ctx return out, metadata, genericError } - output := &TimestampFormatHeadersOutput{} + output := &JsonListsOutput{} out.Result = output - err = awsRestjson1_deserializeHttpBindingsTimestampFormatHeadersOutput(output, response) + buff := make([]byte, 1024) + ringBuffer := smithyio.NewRingBuffer(buff) + + body := io.TeeReader(response.Body, ringBuffer) + defer response.Body.Close() + + decoder := json.NewDecoder(body) + decoder.UseNumber() + + err = awsRestjson1_deserializeDocumentJsonListsOutput(&output, decoder) if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + 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_deserializeHttpBindingsTimestampFormatHeadersOutput(v *TimestampFormatHeadersOutput, response *smithyhttp.Response) error { +func awsRestjson1_deserializeDocumentJsonListsOutput(v **JsonListsOutput, decoder *json.Decoder) error { if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) + return fmt.Errorf("unexpected nil of type %T", v) } - - if headerValues := response.Header.Values("X-defaultFormat"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err - } - v.DefaultFormat = ptr.Time(t) + startToken, err := decoder.Token() + if err == io.EOF { + return nil } - - if headerValues := response.Header.Values("X-memberDateTime"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err - } - v.MemberDateTime = ptr.Time(t) + if err != nil { + return err } - - if headerValues := response.Header.Values("X-memberEpochSeconds"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err - } - v.MemberEpochSeconds = ptr.Time(t) + if startToken == nil { + return nil } - - if headerValues := response.Header.Values("X-memberHttpDate"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err - } - v.MemberHttpDate = ptr.Time(t) + if t, ok := startToken.(json.Delim); !ok || t != '{' { + return fmt.Errorf("expect `{` as start token") } - if headerValues := response.Header.Values("X-targetDateTime"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseDateTime(headerValues[0]) - if err != nil { - return err - } - v.TargetDateTime = ptr.Time(t) + var sv *JsonListsOutput + if *v == nil { + sv = &JsonListsOutput{} + } else { + sv = *v } - if headerValues := response.Header.Values("X-targetEpochSeconds"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - f, err := strconv.ParseFloat(headerValues[0], 64) + for decoder.More() { + t, err := decoder.Token() if err != nil { return err } - t := smithytime.ParseEpochSeconds(f) - v.TargetEpochSeconds = ptr.Time(t) - } + switch t { + case "booleanList": + if err := awsRestjson1_deserializeDocumentBooleanList(&sv.BooleanList, decoder); err != nil { + return err + } + + case "enumList": + if err := awsRestjson1_deserializeDocumentFooEnumList(&sv.EnumList, decoder); err != nil { + return err + } + + case "integerList": + if err := awsRestjson1_deserializeDocumentIntegerList(&sv.IntegerList, decoder); err != nil { + return err + } + + case "nestedStringList": + if err := awsRestjson1_deserializeDocumentNestedStringList(&sv.NestedStringList, decoder); err != nil { + return err + } + + case "stringList": + if err := awsRestjson1_deserializeDocumentStringList(&sv.StringList, decoder); err != nil { + return err + } + + case "stringSet": + if err := awsRestjson1_deserializeDocumentStringSet(&sv.StringSet, decoder); err != nil { + return err + } + + case "myStructureList": + if err := awsRestjson1_deserializeDocumentStructureList(&sv.StructureList, decoder); err != nil { + return err + } + + case "timestampList": + if err := awsRestjson1_deserializeDocumentTimestampList(&sv.TimestampList, decoder); err != nil { + return err + } + + default: + err := restjson.DiscardUnknownField(decoder) + if err != nil { + return err + } - if headerValues := response.Header.Values("X-targetHttpDate"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err } - v.TargetHttpDate = ptr.Time(t) + } + endToken, err := decoder.Token() + if err != nil { + return err + } + if t, ok := endToken.(json.Delim); !ok || t != '}' { + return fmt.Errorf("expect `}` as end token") } + *v = sv return nil } -type awsRestjson1_deserializeOpNoInputAndOutput struct { +type awsRestjson1_deserializeOpHttpPayloadWithStructure struct { } -func (*awsRestjson1_deserializeOpNoInputAndOutput) ID() string { +func (*awsRestjson1_deserializeOpHttpPayloadWithStructure) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpNoInputAndOutput) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpHttpPayloadWithStructure) 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) @@ -456,20 +452,95 @@ func (m *awsRestjson1_deserializeOpNoInputAndOutput) HandleDeserialize(ctx conte return out, metadata, genericError } - output := &NoInputAndOutputOutput{} + output := &HttpPayloadWithStructureOutput{} out.Result = output - return out, metadata, err -} + buff := make([]byte, 1024) + ringBuffer := smithyio.NewRingBuffer(buff) -type awsRestjson1_deserializeOpNoInputAndNoOutput struct { -} + body := io.TeeReader(response.Body, ringBuffer) + defer response.Body.Close() -func (*awsRestjson1_deserializeOpNoInputAndNoOutput) ID() string { - return "OperationDeserializer" -} + decoder := json.NewDecoder(body) + decoder.UseNumber() -func (m *awsRestjson1_deserializeOpNoInputAndNoOutput) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + err = awsRestjson1_deserializeDocumentNestedPayload(&output.Nested, 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 with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeDocumentHttpPayloadWithStructureOutput(v **HttpPayloadWithStructureOutput, decoder *json.Decoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + startToken, err := decoder.Token() + if err == io.EOF { + return nil + } + if err != nil { + return err + } + if startToken == nil { + return nil + } + if t, ok := startToken.(json.Delim); !ok || t != '{' { + return fmt.Errorf("expect `{` as start token") + } + + var sv *HttpPayloadWithStructureOutput + if *v == nil { + sv = &HttpPayloadWithStructureOutput{} + } else { + sv = *v + } + + for decoder.More() { + t, err := decoder.Token() + if err != nil { + return err + } + switch t { + case "nested": + if err := awsRestjson1_deserializeDocumentNestedPayload(&sv.Nested, decoder); err != nil { + return err + } + + default: + err := restjson.DiscardUnknownField(decoder) + if err != nil { + return err + } + + } + } + endToken, err := decoder.Token() + if err != nil { + return err + } + if t, ok := endToken.(json.Delim); !ok || t != '}' { + return fmt.Errorf("expect `}` as end token") + } + + *v = sv + return nil +} + +type awsRestjson1_deserializeOpConstantAndVariableQueryString struct { +} + +func (*awsRestjson1_deserializeOpConstantAndVariableQueryString) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpConstantAndVariableQueryString) 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) @@ -497,20 +568,20 @@ func (m *awsRestjson1_deserializeOpNoInputAndNoOutput) HandleDeserialize(ctx con return out, metadata, genericError } - output := &NoInputAndNoOutputOutput{} + output := &ConstantAndVariableQueryStringOutput{} out.Result = output return out, metadata, err } -type awsRestjson1_deserializeOpGreetingWithErrors struct { +type awsRestjson1_deserializeOpNullAndEmptyHeadersServer struct { } -func (*awsRestjson1_deserializeOpGreetingWithErrors) ID() string { +func (*awsRestjson1_deserializeOpNullAndEmptyHeadersServer) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGreetingWithErrors) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpNullAndEmptyHeadersServer) 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) @@ -527,120 +598,21 @@ func (m *awsRestjson1_deserializeOpGreetingWithErrors) HandleDeserialize(ctx con errorType := response.Header.Get("X-Amzn-Errortype") errorType = restjson.SanitizeErrorCode(errorType) - buff := make([]byte, 1024) - ringBuffer := smithyio.NewRingBuffer(buff) - - var errorBuffer bytes.Buffer - defer response.Body.Close() - _, err := io.Copy(&errorBuffer, response.Body) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - - errorBody := bytes.NewReader(errorBuffer.Bytes()) - decoder := json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) - decoder.UseNumber() - - var errorMessage string - if len(errorType) == 0 { - errorType, errorMessage, err = restjson.GetErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - return out, metadata, &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response error with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - } - - if len(errorType) == 0 { - switch response.StatusCode { - case 500: - errorType = "FooError" - case 403: - errorType = "ComplexError" - case 400: - errorType = "InvalidGreeting" - } - } - - // reset the ring buffer - ringBuffer.Reset() - // seek start of error body - errorBody.Seek(0, io.SeekStart) - - decoder = json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) + decoder := json.NewDecoder(response.Body) decoder.UseNumber() - - if errorType == "FooError" { - errResult := &types.FooError{} - output := errResult - _ = output - - return out, metadata, errResult - } - - if errorType == "ComplexError" { - errResult := &types.ComplexError{} - output := errResult - _ = output - - err = awsRestjson1_deserializeHttpBindingsComplexError(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid Http bindings, %w", err)} - } - - err = awsRestjson1_deserializeDocumentComplexError(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - - if errorType == "InvalidGreeting" { - errResult := &types.InvalidGreeting{} - output := errResult - _ = output - - err = awsRestjson1_deserializeDocumentInvalidGreeting(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - - if len(errorMessage) != 0 { - genericError := &smithy.GenericAPIError{ - Code: errorType, - Message: errorMessage, - } - - return out, metadata, genericError - } + defer response.Body.Close() genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) if err != nil { return out, metadata, &smithy.DeserializationError{Err: err} } - return out, metadata, genericError } - output := &GreetingWithErrorsOutput{} + output := &NullAndEmptyHeadersServerOutput{} out.Result = output - err = awsRestjson1_deserializeHttpBindingsGreetingWithErrorsOutput(output, response) + err = awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(output, response) if err != nil { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } @@ -648,68 +620,43 @@ func (m *awsRestjson1_deserializeOpGreetingWithErrors) HandleDeserialize(ctx con return out, metadata, err } -func awsRestjson1_deserializeHttpBindingsGreetingWithErrorsOutput(v *GreetingWithErrorsOutput, response *smithyhttp.Response) error { +func awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(v *NullAndEmptyHeadersServerOutput, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) } - if headerValues := response.Header.Values("X-Greeting"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Greeting = ptr.String(headerValues[0]) - } - - return nil -} - -type awsRestjson1_deserializeOpOmitsNullSerializesEmptyString struct { -} - -func (*awsRestjson1_deserializeOpOmitsNullSerializesEmptyString) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpOmitsNullSerializesEmptyString) 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 + v.A = ptr.String(headerValues[0]) } - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.B = ptr.String(headerValues[0]) } - if response.StatusCode < 200 || response.StatusCode >= 300 { - errorType := response.Header.Get("X-Amzn-Errortype") - errorType = restjson.SanitizeErrorCode(errorType) - - decoder := json.NewDecoder(response.Body) - decoder.UseNumber() - defer response.Body.Close() - - genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: err} + if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { + var list []*string + for _, headerValuesVal := range headerValues { + for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { + headerValuesValPart = strings.TrimSpace(headerValuesValPart) + list = append(list, ptr.String(headerValuesValPart)) + } } - return out, metadata, genericError + v.C = list } - output := &OmitsNullSerializesEmptyStringOutput{} - out.Result = output - - return out, metadata, err + return nil } -type awsRestjson1_deserializeOpJsonMaps struct { +type awsRestjson1_deserializeOpRecursiveShapes struct { } -func (*awsRestjson1_deserializeOpJsonMaps) ID() string { +func (*awsRestjson1_deserializeOpRecursiveShapes) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpJsonMaps) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpRecursiveShapes) 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) @@ -737,7 +684,7 @@ func (m *awsRestjson1_deserializeOpJsonMaps) HandleDeserialize(ctx context.Conte return out, metadata, genericError } - output := &JsonMapsOutput{} + output := &RecursiveShapesOutput{} out.Result = output buff := make([]byte, 1024) @@ -749,7 +696,7 @@ func (m *awsRestjson1_deserializeOpJsonMaps) HandleDeserialize(ctx context.Conte decoder := json.NewDecoder(body) decoder.UseNumber() - err = awsRestjson1_deserializeDocumentJsonMapsOutput(&output, decoder) + err = awsRestjson1_deserializeDocumentRecursiveShapesOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -762,7 +709,7 @@ func (m *awsRestjson1_deserializeOpJsonMaps) HandleDeserialize(ctx context.Conte return out, metadata, err } -func awsRestjson1_deserializeDocumentJsonMapsOutput(v **JsonMapsOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeDocumentRecursiveShapesOutput(v **RecursiveShapesOutput, decoder *json.Decoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -780,9 +727,9 @@ func awsRestjson1_deserializeDocumentJsonMapsOutput(v **JsonMapsOutput, decoder return fmt.Errorf("expect `{` as start token") } - var sv *JsonMapsOutput + var sv *RecursiveShapesOutput if *v == nil { - sv = &JsonMapsOutput{} + sv = &RecursiveShapesOutput{} } else { sv = *v } @@ -793,8 +740,8 @@ func awsRestjson1_deserializeDocumentJsonMapsOutput(v **JsonMapsOutput, decoder return err } switch t { - case "myMap": - if err := awsRestjson1_deserializeDocumentJsonMapsInputOutputMap(&sv.MyMap, decoder); err != nil { + case "nested": + if err := awsRestjson1_deserializeDocumentRecursiveShapesInputOutputNested1(&sv.Nested, decoder); err != nil { return err } @@ -818,14 +765,14 @@ func awsRestjson1_deserializeDocumentJsonMapsOutput(v **JsonMapsOutput, decoder return nil } -type awsRestjson1_deserializeOpRecursiveShapes struct { +type awsRestjson1_deserializeOpHttpPrefixHeaders struct { } -func (*awsRestjson1_deserializeOpRecursiveShapes) ID() string { +func (*awsRestjson1_deserializeOpHttpPrefixHeaders) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpRecursiveShapes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpHttpPrefixHeaders) 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) @@ -853,85 +800,157 @@ func (m *awsRestjson1_deserializeOpRecursiveShapes) HandleDeserialize(ctx contex return out, metadata, genericError } - output := &RecursiveShapesOutput{} + output := &HttpPrefixHeadersOutput{} out.Result = output - buff := make([]byte, 1024) - ringBuffer := smithyio.NewRingBuffer(buff) + err = awsRestjson1_deserializeHttpBindingsHttpPrefixHeadersOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } - body := io.TeeReader(response.Body, ringBuffer) - defer response.Body.Close() + return out, metadata, err +} - decoder := json.NewDecoder(body) - decoder.UseNumber() +func awsRestjson1_deserializeHttpBindingsHttpPrefixHeadersOutput(v *HttpPrefixHeadersOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } - err = awsRestjson1_deserializeDocumentRecursiveShapesOutput(&output, decoder) + if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Foo = ptr.String(headerValues[0]) + } + + for headerKey, headerValues := range response.Header { + if lenPrefix := len("X-Foo-"); len(headerKey) >= lenPrefix && strings.EqualFold(headerKey[:lenPrefix], "X-Foo-") { + if v.FooMap == nil { + v.FooMap = map[string]*string{} + } + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.FooMap[headerKey[lenPrefix:]] = ptr.String(headerValues[0]) + } + } + + return nil +} + +type awsRestjson1_deserializeOpHttpPayloadTraits struct { +} + +func (*awsRestjson1_deserializeOpHttpPayloadTraits) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpHttpPayloadTraits) 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 { - 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 + } + + 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 { + errorType := response.Header.Get("X-Amzn-Errortype") + errorType = restjson.SanitizeErrorCode(errorType) + + decoder := json.NewDecoder(response.Body) + decoder.UseNumber() + defer response.Body.Close() + + genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: err} } + return out, metadata, genericError + } + + output := &HttpPayloadTraitsOutput{} + out.Result = output + + err = awsRestjson1_deserializeHttpBindingsHttpPayloadTraitsOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + + err = awsRestjson1_deserializeDocumentHttpPayloadTraitsOutput(output, response.Body) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} } return out, metadata, err } -func awsRestjson1_deserializeDocumentRecursiveShapesOutput(v **RecursiveShapesOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeHttpBindingsHttpPayloadTraitsOutput(v *HttpPayloadTraitsOutput, response *smithyhttp.Response) error { if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) + return fmt.Errorf("unsupported deserialization for nil %T", v) } - startToken, err := decoder.Token() - if err == io.EOF { - return nil + + if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Foo = ptr.String(headerValues[0]) } + + return nil +} +func awsRestjson1_deserializeDocumentHttpPayloadTraitsOutput(v *HttpPayloadTraitsOutput, body io.ReadCloser) error { + if v == nil { + return fmt.Errorf("unsupported deserialization of nil %T", v) + } + + bs, err := ioutil.ReadAll(body) + if err != nil { + return err + } + if len(bs) > 0 { + v.Blob = bs + } + return nil +} + +type awsRestjson1_deserializeOpNoInputAndOutput struct { +} + +func (*awsRestjson1_deserializeOpNoInputAndOutput) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpNoInputAndOutput) 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 err - } - if startToken == nil { - return nil - } - if t, ok := startToken.(json.Delim); !ok || t != '{' { - return fmt.Errorf("expect `{` as start token") + return out, metadata, err } - var sv *RecursiveShapesOutput - if *v == nil { - sv = &RecursiveShapesOutput{} - } else { - sv = *v + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} } - for decoder.More() { - t, err := decoder.Token() - if err != nil { - return err - } - switch t { - case "nested": - if err := awsRestjson1_deserializeDocumentRecursiveShapesInputOutputNested1(&sv.Nested, decoder); err != nil { - return err - } + if response.StatusCode < 200 || response.StatusCode >= 300 { + errorType := response.Header.Get("X-Amzn-Errortype") + errorType = restjson.SanitizeErrorCode(errorType) - default: - err := restjson.DiscardUnknownField(decoder) - if err != nil { - return err - } + decoder := json.NewDecoder(response.Body) + decoder.UseNumber() + defer response.Body.Close() + genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: err} } - } - endToken, err := decoder.Token() - if err != nil { - return err - } - if t, ok := endToken.(json.Delim); !ok || t != '}' { - return fmt.Errorf("expect `}` as end token") + return out, metadata, genericError } - *v = sv - return nil + output := &NoInputAndOutputOutput{} + out.Result = output + + return out, metadata, err } type awsRestjson1_deserializeOpHttpRequestWithLabelsAndTimestampFormat struct { @@ -1313,14 +1332,14 @@ func awsRestjson1_deserializeDocumentIgnoreQueryParamsInResponseOutput(v **Ignor return nil } -type awsRestjson1_deserializeOpAllQueryStringTypes struct { +type awsRestjson1_deserializeOpHttpRequestWithLabels struct { } -func (*awsRestjson1_deserializeOpAllQueryStringTypes) ID() string { +func (*awsRestjson1_deserializeOpHttpRequestWithLabels) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpAllQueryStringTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpHttpRequestWithLabels) 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) @@ -1348,20 +1367,20 @@ func (m *awsRestjson1_deserializeOpAllQueryStringTypes) HandleDeserialize(ctx co return out, metadata, genericError } - output := &AllQueryStringTypesOutput{} + output := &HttpRequestWithLabelsOutput{} out.Result = output return out, metadata, err } -type awsRestjson1_deserializeOpJsonTimestamps struct { +type awsRestjson1_deserializeOpAllQueryStringTypes struct { } -func (*awsRestjson1_deserializeOpJsonTimestamps) ID() string { +func (*awsRestjson1_deserializeOpAllQueryStringTypes) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpJsonTimestamps) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpAllQueryStringTypes) 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) @@ -1389,158 +1408,219 @@ func (m *awsRestjson1_deserializeOpJsonTimestamps) HandleDeserialize(ctx context return out, metadata, genericError } - output := &JsonTimestampsOutput{} + output := &AllQueryStringTypesOutput{} out.Result = output - buff := make([]byte, 1024) - ringBuffer := smithyio.NewRingBuffer(buff) + return out, metadata, err +} - body := io.TeeReader(response.Body, ringBuffer) - defer response.Body.Close() +type awsRestjson1_deserializeOpEmptyInputAndEmptyOutput struct { +} - decoder := json.NewDecoder(body) - decoder.UseNumber() +func (*awsRestjson1_deserializeOpEmptyInputAndEmptyOutput) ID() string { + return "OperationDeserializer" +} - err = awsRestjson1_deserializeDocumentJsonTimestampsOutput(&output, decoder) +func (m *awsRestjson1_deserializeOpEmptyInputAndEmptyOutput) 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 { - 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 + } + + 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 { + errorType := response.Header.Get("X-Amzn-Errortype") + errorType = restjson.SanitizeErrorCode(errorType) + + decoder := json.NewDecoder(response.Body) + decoder.UseNumber() + defer response.Body.Close() + + genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: err} } + return out, metadata, genericError } + output := &EmptyInputAndEmptyOutputOutput{} + out.Result = output + return out, metadata, err } -func awsRestjson1_deserializeDocumentJsonTimestampsOutput(v **JsonTimestampsOutput, decoder *json.Decoder) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - startToken, err := decoder.Token() - if err == io.EOF { - return nil - } +type awsRestjson1_deserializeOpGreetingWithErrors struct { +} + +func (*awsRestjson1_deserializeOpGreetingWithErrors) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGreetingWithErrors) 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 err - } - if startToken == nil { - return nil - } - if t, ok := startToken.(json.Delim); !ok || t != '{' { - return fmt.Errorf("expect `{` as start token") + return out, metadata, err } - var sv *JsonTimestampsOutput - if *v == nil { - sv = &JsonTimestampsOutput{} - } else { - sv = *v + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} } - for decoder.More() { - t, err := decoder.Token() + if response.StatusCode < 200 || response.StatusCode >= 300 { + errorType := response.Header.Get("X-Amzn-Errortype") + errorType = restjson.SanitizeErrorCode(errorType) + + buff := make([]byte, 1024) + ringBuffer := smithyio.NewRingBuffer(buff) + + var errorBuffer bytes.Buffer + defer response.Body.Close() + _, err := io.Copy(&errorBuffer, response.Body) if err != nil { - return err + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} } - switch t { - case "dateTime": - val, err := decoder.Token() + + errorBody := bytes.NewReader(errorBuffer.Bytes()) + decoder := json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) + decoder.UseNumber() + + var errorMessage string + if len(errorType) == 0 { + errorType, errorMessage, err = restjson.GetErrorInfo(decoder) if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected Timestamp to be of type string, got %T instead", val) - } - t, err := smithytime.ParseDateTime(jtv) - if err != nil { - return err + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response error with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } - sv.DateTime = &t } + } - case "epochSeconds": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(json.Number) - if !ok { - return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", val) - } - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.EpochSeconds = ptr.Time(smithytime.ParseEpochSeconds(f64)) + if len(errorType) == 0 { + switch response.StatusCode { + case 500: + errorType = "FooError" + case 403: + errorType = "ComplexError" + case 400: + errorType = "InvalidGreeting" } + } - case "httpDate": - val, err := decoder.Token() + // reset the ring buffer + ringBuffer.Reset() + // seek start of error body + errorBody.Seek(0, io.SeekStart) + + decoder = json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) + decoder.UseNumber() + + if errorType == "FooError" { + errResult := &types.FooError{} + output := errResult + _ = output + + return out, metadata, errResult + } + + if errorType == "ComplexError" { + errResult := &types.ComplexError{} + output := errResult + _ = output + + err = awsRestjson1_deserializeHttpBindingsComplexError(output, response) if err != nil { - return err + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid Http bindings, %w", err)} } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected Timestamp to be of type string, got %T instead", val) - } - t, err := smithytime.ParseHTTPDate(jtv) - if err != nil { - return err + + err = awsRestjson1_deserializeDocumentComplexError(&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 with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } - sv.HttpDate = &t } + return out, metadata, errResult + } - case "normal": - val, err := decoder.Token() + if errorType == "InvalidGreeting" { + errResult := &types.InvalidGreeting{} + output := errResult + _ = output + + err = awsRestjson1_deserializeDocumentInvalidGreeting(&output, decoder) if err != nil { - return err - } - if val != nil { - jtv, ok := val.(json.Number) - if !ok { - return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", val) - } - f64, err := jtv.Float64() - if err != nil { - return err + 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(), } - sv.Normal = ptr.Time(smithytime.ParseEpochSeconds(f64)) } + return out, metadata, errResult + } - default: - err := restjson.DiscardUnknownField(decoder) - if err != nil { - return err + if len(errorMessage) != 0 { + genericError := &smithy.GenericAPIError{ + Code: errorType, + Message: errorMessage, } + return out, metadata, genericError + } + + genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: err} } + + return out, metadata, genericError } - endToken, err := decoder.Token() + + output := &GreetingWithErrorsOutput{} + out.Result = output + + err = awsRestjson1_deserializeHttpBindingsGreetingWithErrorsOutput(output, response) if err != nil { - return err + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } - if t, ok := endToken.(json.Delim); !ok || t != '}' { - return fmt.Errorf("expect `}` as end token") + + return out, metadata, err +} + +func awsRestjson1_deserializeHttpBindingsGreetingWithErrorsOutput(v *GreetingWithErrorsOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + if headerValues := response.Header.Values("X-Greeting"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Greeting = ptr.String(headerValues[0]) } - *v = sv return nil } -type awsRestjson1_deserializeOpNullAndEmptyHeadersClient struct { +type awsRestjson1_deserializeOpOmitsNullSerializesEmptyString struct { } -func (*awsRestjson1_deserializeOpNullAndEmptyHeadersClient) ID() string { +func (*awsRestjson1_deserializeOpOmitsNullSerializesEmptyString) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpNullAndEmptyHeadersClient) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpOmitsNullSerializesEmptyString) 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) @@ -1568,10 +1648,51 @@ func (m *awsRestjson1_deserializeOpNullAndEmptyHeadersClient) HandleDeserialize( return out, metadata, genericError } - output := &NullAndEmptyHeadersClientOutput{} + output := &OmitsNullSerializesEmptyStringOutput{} out.Result = output - err = awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(output, response) + return out, metadata, err +} + +type awsRestjson1_deserializeOpTimestampFormatHeaders struct { +} + +func (*awsRestjson1_deserializeOpTimestampFormatHeaders) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpTimestampFormatHeaders) 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 { + errorType := response.Header.Get("X-Amzn-Errortype") + errorType = restjson.SanitizeErrorCode(errorType) + + decoder := json.NewDecoder(response.Body) + decoder.UseNumber() + defer response.Body.Close() + + genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: err} + } + return out, metadata, genericError + } + + output := &TimestampFormatHeadersOutput{} + out.Result = output + + err = awsRestjson1_deserializeHttpBindingsTimestampFormatHeadersOutput(output, response) if err != nil { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } @@ -1579,43 +1700,86 @@ func (m *awsRestjson1_deserializeOpNullAndEmptyHeadersClient) HandleDeserialize( return out, metadata, err } -func awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(v *NullAndEmptyHeadersClientOutput, response *smithyhttp.Response) error { +func awsRestjson1_deserializeHttpBindingsTimestampFormatHeadersOutput(v *TimestampFormatHeadersOutput, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) } - if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-defaultFormat"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - v.A = ptr.String(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.DefaultFormat = ptr.Time(t) } - if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-memberDateTime"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - v.B = ptr.String(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.MemberDateTime = ptr.Time(t) } - if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { - var list []*string - for _, headerValuesVal := range headerValues { - for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { - headerValuesValPart = strings.TrimSpace(headerValuesValPart) - list = append(list, ptr.String(headerValuesValPart)) - } + if headerValues := response.Header.Values("X-memberEpochSeconds"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err } - v.C = list + v.MemberEpochSeconds = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-memberHttpDate"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.MemberHttpDate = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-targetDateTime"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseDateTime(headerValues[0]) + if err != nil { + return err + } + v.TargetDateTime = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-targetEpochSeconds"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + f, err := strconv.ParseFloat(headerValues[0], 64) + if err != nil { + return err + } + t := smithytime.ParseEpochSeconds(f) + v.TargetEpochSeconds = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-targetHttpDate"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.TargetHttpDate = ptr.Time(t) } return nil } -type awsRestjson1_deserializeOpJsonLists struct { +type awsRestjson1_deserializeOpJsonEnums struct { } -func (*awsRestjson1_deserializeOpJsonLists) ID() string { +func (*awsRestjson1_deserializeOpJsonEnums) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpJsonLists) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpJsonEnums) 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) @@ -1643,7 +1807,7 @@ func (m *awsRestjson1_deserializeOpJsonLists) HandleDeserialize(ctx context.Cont return out, metadata, genericError } - output := &JsonListsOutput{} + output := &JsonEnumsOutput{} out.Result = output buff := make([]byte, 1024) @@ -1655,7 +1819,7 @@ func (m *awsRestjson1_deserializeOpJsonLists) HandleDeserialize(ctx context.Cont decoder := json.NewDecoder(body) decoder.UseNumber() - err = awsRestjson1_deserializeDocumentJsonListsOutput(&output, decoder) + err = awsRestjson1_deserializeDocumentJsonEnumsOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -1668,7 +1832,7 @@ func (m *awsRestjson1_deserializeOpJsonLists) HandleDeserialize(ctx context.Cont return out, metadata, err } -func awsRestjson1_deserializeDocumentJsonListsOutput(v **JsonListsOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeDocumentJsonEnumsOutput(v **JsonEnumsOutput, decoder *json.Decoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -1686,9 +1850,9 @@ func awsRestjson1_deserializeDocumentJsonListsOutput(v **JsonListsOutput, decode return fmt.Errorf("expect `{` as start token") } - var sv *JsonListsOutput + var sv *JsonEnumsOutput if *v == nil { - sv = &JsonListsOutput{} + sv = &JsonEnumsOutput{} } else { sv = *v } @@ -1699,43 +1863,57 @@ func awsRestjson1_deserializeDocumentJsonListsOutput(v **JsonListsOutput, decode return err } switch t { - case "booleanList": - if err := awsRestjson1_deserializeDocumentBooleanList(&sv.BooleanList, decoder); err != nil { + case "fooEnum1": + val, err := decoder.Token() + if err != nil { return err } - - case "enumList": - if err := awsRestjson1_deserializeDocumentFooEnumList(&sv.EnumList, decoder); err != nil { - return err + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected FooEnum to be of type string, got %T instead", val) + } + sv.FooEnum1 = types.FooEnum(jtv) } - case "integerList": - if err := awsRestjson1_deserializeDocumentIntegerList(&sv.IntegerList, decoder); err != nil { + case "fooEnum2": + val, err := decoder.Token() + if err != nil { return err } - - case "nestedStringList": - if err := awsRestjson1_deserializeDocumentNestedStringList(&sv.NestedStringList, decoder); err != nil { - return err + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected FooEnum to be of type string, got %T instead", val) + } + sv.FooEnum2 = types.FooEnum(jtv) } - case "stringList": - if err := awsRestjson1_deserializeDocumentStringList(&sv.StringList, decoder); err != nil { + case "fooEnum3": + val, err := decoder.Token() + if err != nil { return err } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected FooEnum to be of type string, got %T instead", val) + } + sv.FooEnum3 = types.FooEnum(jtv) + } - case "stringSet": - if err := awsRestjson1_deserializeDocumentStringSet(&sv.StringSet, decoder); err != nil { + case "fooEnumList": + if err := awsRestjson1_deserializeDocumentFooEnumList(&sv.FooEnumList, decoder); err != nil { return err } - case "myStructureList": - if err := awsRestjson1_deserializeDocumentStructureList(&sv.StructureList, decoder); err != nil { + case "fooEnumMap": + if err := awsRestjson1_deserializeDocumentFooEnumMap(&sv.FooEnumMap, decoder); err != nil { return err } - case "timestampList": - if err := awsRestjson1_deserializeDocumentTimestampList(&sv.TimestampList, decoder); err != nil { + case "fooEnumSet": + if err := awsRestjson1_deserializeDocumentFooEnumSet(&sv.FooEnumSet, decoder); err != nil { return err } @@ -1759,14 +1937,14 @@ func awsRestjson1_deserializeDocumentJsonListsOutput(v **JsonListsOutput, decode return nil } -type awsRestjson1_deserializeOpInlineDocumentAsPayload struct { +type awsRestjson1_deserializeOpHttpRequestWithGreedyLabelInPath struct { } -func (*awsRestjson1_deserializeOpInlineDocumentAsPayload) ID() string { +func (*awsRestjson1_deserializeOpHttpRequestWithGreedyLabelInPath) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpInlineDocumentAsPayload) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpHttpRequestWithGreedyLabelInPath) 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) @@ -1794,95 +1972,20 @@ func (m *awsRestjson1_deserializeOpInlineDocumentAsPayload) HandleDeserialize(ct return out, metadata, genericError } - output := &InlineDocumentAsPayloadOutput{} + output := &HttpRequestWithGreedyLabelInPathOutput{} out.Result = output - buff := make([]byte, 1024) - ringBuffer := smithyio.NewRingBuffer(buff) - - body := io.TeeReader(response.Body, ringBuffer) - defer response.Body.Close() - - decoder := json.NewDecoder(body) - decoder.UseNumber() - - err = awsRestjson1_deserializeDocumentDocument(&output.DocumentValue, 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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, err } -func awsRestjson1_deserializeDocumentInlineDocumentAsPayloadOutput(v **InlineDocumentAsPayloadOutput, decoder *json.Decoder) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - startToken, err := decoder.Token() - if err == io.EOF { - return nil - } - if err != nil { - return err - } - if startToken == nil { - return nil - } - if t, ok := startToken.(json.Delim); !ok || t != '{' { - return fmt.Errorf("expect `{` as start token") - } - - var sv *InlineDocumentAsPayloadOutput - if *v == nil { - sv = &InlineDocumentAsPayloadOutput{} - } else { - sv = *v - } - - for decoder.More() { - t, err := decoder.Token() - if err != nil { - return err - } - switch t { - case "documentValue": - if err := awsRestjson1_deserializeDocumentDocument(&sv.DocumentValue, decoder); err != nil { - return err - } - - default: - err := restjson.DiscardUnknownField(decoder) - if err != nil { - return err - } - - } - } - endToken, err := decoder.Token() - if err != nil { - return err - } - if t, ok := endToken.(json.Delim); !ok || t != '}' { - return fmt.Errorf("expect `}` as end token") - } - - *v = sv - return nil -} - -type awsRestjson1_deserializeOpEmptyInputAndEmptyOutput struct { +type awsRestjson1_deserializeOpNullAndEmptyHeadersClient struct { } -func (*awsRestjson1_deserializeOpEmptyInputAndEmptyOutput) ID() string { +func (*awsRestjson1_deserializeOpNullAndEmptyHeadersClient) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpEmptyInputAndEmptyOutput) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpNullAndEmptyHeadersClient) 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) @@ -1910,20 +2013,54 @@ func (m *awsRestjson1_deserializeOpEmptyInputAndEmptyOutput) HandleDeserialize(c return out, metadata, genericError } - output := &EmptyInputAndEmptyOutputOutput{} + output := &NullAndEmptyHeadersClientOutput{} out.Result = output + err = awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + return out, metadata, err } -type awsRestjson1_deserializeOpConstantAndVariableQueryString struct { +func awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(v *NullAndEmptyHeadersClientOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.A = ptr.String(headerValues[0]) + } + + if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.B = ptr.String(headerValues[0]) + } + + if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { + var list []*string + for _, headerValuesVal := range headerValues { + for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { + headerValuesValPart = strings.TrimSpace(headerValuesValPart) + list = append(list, ptr.String(headerValuesValPart)) + } + } + v.C = list + } + + return nil } -func (*awsRestjson1_deserializeOpConstantAndVariableQueryString) ID() string { +type awsRestjson1_deserializeOpQueryIdempotencyTokenAutoFill struct { +} + +func (*awsRestjson1_deserializeOpQueryIdempotencyTokenAutoFill) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpConstantAndVariableQueryString) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpQueryIdempotencyTokenAutoFill) 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) @@ -1951,20 +2088,20 @@ func (m *awsRestjson1_deserializeOpConstantAndVariableQueryString) HandleDeseria return out, metadata, genericError } - output := &ConstantAndVariableQueryStringOutput{} + output := &QueryIdempotencyTokenAutoFillOutput{} out.Result = output return out, metadata, err } -type awsRestjson1_deserializeOpHttpPayloadTraitsWithMediaType struct { +type awsRestjson1_deserializeOpJsonTimestamps struct { } -func (*awsRestjson1_deserializeOpHttpPayloadTraitsWithMediaType) ID() string { +func (*awsRestjson1_deserializeOpJsonTimestamps) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpHttpPayloadTraitsWithMediaType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpJsonTimestamps) 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) @@ -1992,88 +2129,148 @@ func (m *awsRestjson1_deserializeOpHttpPayloadTraitsWithMediaType) HandleDeseria return out, metadata, genericError } - output := &HttpPayloadTraitsWithMediaTypeOutput{} + output := &JsonTimestampsOutput{} out.Result = output - err = awsRestjson1_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } + buff := make([]byte, 1024) + ringBuffer := smithyio.NewRingBuffer(buff) - err = awsRestjson1_deserializeDocumentHttpPayloadTraitsWithMediaTypeOutput(output, response.Body) + body := io.TeeReader(response.Body, ringBuffer) + defer response.Body.Close() + + decoder := json.NewDecoder(body) + decoder.UseNumber() + + err = awsRestjson1_deserializeDocumentJsonTimestampsOutput(&output, decoder) if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} + 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_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(v *HttpPayloadTraitsWithMediaTypeOutput, response *smithyhttp.Response) error { +func awsRestjson1_deserializeDocumentJsonTimestampsOutput(v **JsonTimestampsOutput, decoder *json.Decoder) error { if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) + return fmt.Errorf("unexpected nil of type %T", v) + } + startToken, err := decoder.Token() + if err == io.EOF { + return nil + } + if err != nil { + return err + } + if startToken == nil { + return nil + } + if t, ok := startToken.(json.Delim); !ok || t != '{' { + return fmt.Errorf("expect `{` as start token") + } + + var sv *JsonTimestampsOutput + if *v == nil { + sv = &JsonTimestampsOutput{} + } else { + sv = *v } - if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Foo = ptr.String(headerValues[0]) - } + for decoder.More() { + t, err := decoder.Token() + if err != nil { + return err + } + switch t { + case "dateTime": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", val) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.DateTime = &t + } + + case "epochSeconds": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(json.Number) + if !ok { + return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", val) + } + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.EpochSeconds = ptr.Time(smithytime.ParseEpochSeconds(f64)) + } + + case "httpDate": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", val) + } + t, err := smithytime.ParseHTTPDate(jtv) + if err != nil { + return err + } + sv.HttpDate = &t + } + + case "normal": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(json.Number) + if !ok { + return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", val) + } + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.Normal = ptr.Time(smithytime.ParseEpochSeconds(f64)) + } + + default: + err := restjson.DiscardUnknownField(decoder) + if err != nil { + return err + } - return nil -} -func awsRestjson1_deserializeDocumentHttpPayloadTraitsWithMediaTypeOutput(v *HttpPayloadTraitsWithMediaTypeOutput, body io.ReadCloser) error { - if v == nil { - return fmt.Errorf("unsupported deserialization of nil %T", v) + } } - - bs, err := ioutil.ReadAll(body) + endToken, err := decoder.Token() if err != nil { return err } - if len(bs) > 0 { - v.Blob = bs - } - return nil -} - -type awsRestjson1_deserializeOpConstantQueryString struct { -} - -func (*awsRestjson1_deserializeOpConstantQueryString) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpConstantQueryString) 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 { - errorType := response.Header.Get("X-Amzn-Errortype") - errorType = restjson.SanitizeErrorCode(errorType) - - decoder := json.NewDecoder(response.Body) - decoder.UseNumber() - defer response.Body.Close() - - genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: err} - } - return out, metadata, genericError + if t, ok := endToken.(json.Delim); !ok || t != '}' { + return fmt.Errorf("expect `}` as end token") } - output := &ConstantQueryStringOutput{} - out.Result = output - - return out, metadata, err + *v = sv + return nil } type awsRestjson1_deserializeOpSimpleScalarProperties struct { @@ -2299,220 +2496,60 @@ func awsRestjson1_deserializeDocumentSimpleScalarPropertiesOutput(v **SimpleScal sv.ShortValue = ptr.Int16(int16(i64)) } - case "stringValue": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", val) - } - sv.StringValue = &jtv - } - - case "trueBooleanValue": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(bool) - if !ok { - return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", val) - } - sv.TrueBooleanValue = &jtv - } - - default: - err := restjson.DiscardUnknownField(decoder) - if err != nil { - return err - } - - } - } - endToken, err := decoder.Token() - if err != nil { - return err - } - if t, ok := endToken.(json.Delim); !ok || t != '}' { - return fmt.Errorf("expect `}` as end token") - } - - *v = sv - return nil -} - -type awsRestjson1_deserializeOpHttpRequestWithLabels struct { -} - -func (*awsRestjson1_deserializeOpHttpRequestWithLabels) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpHttpRequestWithLabels) 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 { - errorType := response.Header.Get("X-Amzn-Errortype") - errorType = restjson.SanitizeErrorCode(errorType) - - decoder := json.NewDecoder(response.Body) - decoder.UseNumber() - defer response.Body.Close() - - genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: err} - } - return out, metadata, genericError - } - - output := &HttpRequestWithLabelsOutput{} - out.Result = output - - return out, metadata, err -} - -type awsRestjson1_deserializeOpQueryIdempotencyTokenAutoFill struct { -} - -func (*awsRestjson1_deserializeOpQueryIdempotencyTokenAutoFill) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpQueryIdempotencyTokenAutoFill) 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 { - errorType := response.Header.Get("X-Amzn-Errortype") - errorType = restjson.SanitizeErrorCode(errorType) - - decoder := json.NewDecoder(response.Body) - decoder.UseNumber() - defer response.Body.Close() - - genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: err} - } - return out, metadata, genericError - } - - output := &QueryIdempotencyTokenAutoFillOutput{} - out.Result = output - - return out, metadata, err -} - -type awsRestjson1_deserializeOpHttpPayloadTraits struct { -} - -func (*awsRestjson1_deserializeOpHttpPayloadTraits) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpHttpPayloadTraits) 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 { - errorType := response.Header.Get("X-Amzn-Errortype") - errorType = restjson.SanitizeErrorCode(errorType) - - decoder := json.NewDecoder(response.Body) - decoder.UseNumber() - defer response.Body.Close() - - genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: err} - } - return out, metadata, genericError - } - - output := &HttpPayloadTraitsOutput{} - out.Result = output - - err = awsRestjson1_deserializeHttpBindingsHttpPayloadTraitsOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } - - err = awsRestjson1_deserializeDocumentHttpPayloadTraitsOutput(output, response.Body) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} - } - - return out, metadata, err -} - -func awsRestjson1_deserializeHttpBindingsHttpPayloadTraitsOutput(v *HttpPayloadTraitsOutput, response *smithyhttp.Response) error { - if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) - } + case "stringValue": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", val) + } + sv.StringValue = &jtv + } - if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Foo = ptr.String(headerValues[0]) - } + case "trueBooleanValue": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", val) + } + sv.TrueBooleanValue = &jtv + } - return nil -} -func awsRestjson1_deserializeDocumentHttpPayloadTraitsOutput(v *HttpPayloadTraitsOutput, body io.ReadCloser) error { - if v == nil { - return fmt.Errorf("unsupported deserialization of nil %T", v) - } + default: + err := restjson.DiscardUnknownField(decoder) + if err != nil { + return err + } - bs, err := ioutil.ReadAll(body) + } + } + endToken, err := decoder.Token() if err != nil { return err } - if len(bs) > 0 { - v.Blob = bs + if t, ok := endToken.(json.Delim); !ok || t != '}' { + return fmt.Errorf("expect `}` as end token") } + + *v = sv return nil } -type awsRestjson1_deserializeOpInlineDocument struct { +type awsRestjson1_deserializeOpJsonBlobs struct { } -func (*awsRestjson1_deserializeOpInlineDocument) ID() string { +func (*awsRestjson1_deserializeOpJsonBlobs) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpInlineDocument) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpJsonBlobs) 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) @@ -2540,7 +2577,7 @@ func (m *awsRestjson1_deserializeOpInlineDocument) HandleDeserialize(ctx context return out, metadata, genericError } - output := &InlineDocumentOutput{} + output := &JsonBlobsOutput{} out.Result = output buff := make([]byte, 1024) @@ -2552,7 +2589,7 @@ func (m *awsRestjson1_deserializeOpInlineDocument) HandleDeserialize(ctx context decoder := json.NewDecoder(body) decoder.UseNumber() - err = awsRestjson1_deserializeDocumentInlineDocumentOutput(&output, decoder) + err = awsRestjson1_deserializeDocumentJsonBlobsOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -2565,7 +2602,7 @@ func (m *awsRestjson1_deserializeOpInlineDocument) HandleDeserialize(ctx context return out, metadata, err } -func awsRestjson1_deserializeDocumentInlineDocumentOutput(v **InlineDocumentOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeDocumentJsonBlobsOutput(v **JsonBlobsOutput, decoder *json.Decoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -2583,9 +2620,9 @@ func awsRestjson1_deserializeDocumentInlineDocumentOutput(v **InlineDocumentOutp return fmt.Errorf("expect `{` as start token") } - var sv *InlineDocumentOutput + var sv *JsonBlobsOutput if *v == nil { - sv = &InlineDocumentOutput{} + sv = &JsonBlobsOutput{} } else { sv = *v } @@ -2596,23 +2633,11 @@ func awsRestjson1_deserializeDocumentInlineDocumentOutput(v **InlineDocumentOutp return err } switch t { - case "documentValue": - if err := awsRestjson1_deserializeDocumentDocument(&sv.DocumentValue, decoder); err != nil { - return err - } - - case "stringValue": - val, err := decoder.Token() + case "data": + err := decoder.Decode(&sv.Data) if err != nil { return err } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", val) - } - sv.StringValue = &jtv - } default: err := restjson.DiscardUnknownField(decoder) @@ -2634,14 +2659,14 @@ func awsRestjson1_deserializeDocumentInlineDocumentOutput(v **InlineDocumentOutp return nil } -type awsRestjson1_deserializeOpHttpRequestWithGreedyLabelInPath struct { +type awsRestjson1_deserializeOpConstantQueryString struct { } -func (*awsRestjson1_deserializeOpHttpRequestWithGreedyLabelInPath) ID() string { +func (*awsRestjson1_deserializeOpConstantQueryString) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpHttpRequestWithGreedyLabelInPath) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpConstantQueryString) 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) @@ -2669,20 +2694,20 @@ func (m *awsRestjson1_deserializeOpHttpRequestWithGreedyLabelInPath) HandleDeser return out, metadata, genericError } - output := &HttpRequestWithGreedyLabelInPathOutput{} + output := &ConstantQueryStringOutput{} out.Result = output return out, metadata, err } -type awsRestjson1_deserializeOpHttpPrefixHeaders struct { +type awsRestjson1_deserializeOpHttpPayloadTraitsWithMediaType struct { } -func (*awsRestjson1_deserializeOpHttpPrefixHeaders) ID() string { +func (*awsRestjson1_deserializeOpHttpPayloadTraitsWithMediaType) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpHttpPrefixHeaders) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpHttpPayloadTraitsWithMediaType) 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) @@ -2710,18 +2735,23 @@ func (m *awsRestjson1_deserializeOpHttpPrefixHeaders) HandleDeserialize(ctx cont return out, metadata, genericError } - output := &HttpPrefixHeadersOutput{} + output := &HttpPayloadTraitsWithMediaTypeOutput{} out.Result = output - err = awsRestjson1_deserializeHttpBindingsHttpPrefixHeadersOutput(output, response) + err = awsRestjson1_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(output, response) if err != nil { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } + err = awsRestjson1_deserializeDocumentHttpPayloadTraitsWithMediaTypeOutput(output, response.Body) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} + } + return out, metadata, err } -func awsRestjson1_deserializeHttpBindingsHttpPrefixHeadersOutput(v *HttpPrefixHeadersOutput, response *smithyhttp.Response) error { +func awsRestjson1_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(v *HttpPayloadTraitsWithMediaTypeOutput, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) } @@ -2731,102 +2761,31 @@ func awsRestjson1_deserializeHttpBindingsHttpPrefixHeadersOutput(v *HttpPrefixHe v.Foo = ptr.String(headerValues[0]) } - for headerKey, headerValues := range response.Header { - if lenPrefix := len("X-Foo-"); len(headerKey) >= lenPrefix && strings.EqualFold(headerKey[:lenPrefix], "X-Foo-") { - if v.FooMap == nil { - v.FooMap = map[string]*string{} - } - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.FooMap[headerKey[lenPrefix:]] = ptr.String(headerValues[0]) - } - } - return nil } - -type awsRestjson1_deserializeOpNullAndEmptyHeadersServer struct { -} - -func (*awsRestjson1_deserializeOpNullAndEmptyHeadersServer) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpNullAndEmptyHeadersServer) 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 { - errorType := response.Header.Get("X-Amzn-Errortype") - errorType = restjson.SanitizeErrorCode(errorType) - - decoder := json.NewDecoder(response.Body) - decoder.UseNumber() - defer response.Body.Close() - - genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: err} - } - return out, metadata, genericError - } - - output := &NullAndEmptyHeadersServerOutput{} - out.Result = output - - err = awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } - - return out, metadata, err -} - -func awsRestjson1_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(v *NullAndEmptyHeadersServerOutput, response *smithyhttp.Response) error { +func awsRestjson1_deserializeDocumentHttpPayloadTraitsWithMediaTypeOutput(v *HttpPayloadTraitsWithMediaTypeOutput, body io.ReadCloser) error { if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) - } - - if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.A = ptr.String(headerValues[0]) + return fmt.Errorf("unsupported deserialization of nil %T", v) } - if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.B = ptr.String(headerValues[0]) + bs, err := ioutil.ReadAll(body) + if err != nil { + return err } - - if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { - var list []*string - for _, headerValuesVal := range headerValues { - for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { - headerValuesValPart = strings.TrimSpace(headerValuesValPart) - list = append(list, ptr.String(headerValuesValPart)) - } - } - v.C = list + if len(bs) > 0 { + v.Blob = bs } - return nil } -type awsRestjson1_deserializeOpHttpPayloadWithStructure struct { +type awsRestjson1_deserializeOpJsonMaps struct { } -func (*awsRestjson1_deserializeOpHttpPayloadWithStructure) ID() string { +func (*awsRestjson1_deserializeOpJsonMaps) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpHttpPayloadWithStructure) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpJsonMaps) 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) @@ -2854,7 +2813,7 @@ func (m *awsRestjson1_deserializeOpHttpPayloadWithStructure) HandleDeserialize(c return out, metadata, genericError } - output := &HttpPayloadWithStructureOutput{} + output := &JsonMapsOutput{} out.Result = output buff := make([]byte, 1024) @@ -2866,7 +2825,7 @@ func (m *awsRestjson1_deserializeOpHttpPayloadWithStructure) HandleDeserialize(c decoder := json.NewDecoder(body) decoder.UseNumber() - err = awsRestjson1_deserializeDocumentNestedPayload(&output.Nested, decoder) + err = awsRestjson1_deserializeDocumentJsonMapsOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -2879,7 +2838,7 @@ func (m *awsRestjson1_deserializeOpHttpPayloadWithStructure) HandleDeserialize(c return out, metadata, err } -func awsRestjson1_deserializeDocumentHttpPayloadWithStructureOutput(v **HttpPayloadWithStructureOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeDocumentJsonMapsOutput(v **JsonMapsOutput, decoder *json.Decoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -2897,9 +2856,9 @@ func awsRestjson1_deserializeDocumentHttpPayloadWithStructureOutput(v **HttpPayl return fmt.Errorf("expect `{` as start token") } - var sv *HttpPayloadWithStructureOutput + var sv *JsonMapsOutput if *v == nil { - sv = &HttpPayloadWithStructureOutput{} + sv = &JsonMapsOutput{} } else { sv = *v } @@ -2910,8 +2869,8 @@ func awsRestjson1_deserializeDocumentHttpPayloadWithStructureOutput(v **HttpPayl return err } switch t { - case "nested": - if err := awsRestjson1_deserializeDocumentNestedPayload(&sv.Nested, decoder); err != nil { + case "myMap": + if err := awsRestjson1_deserializeDocumentJsonMapsInputOutputMap(&sv.MyMap, decoder); err != nil { return err } @@ -2935,6 +2894,47 @@ func awsRestjson1_deserializeDocumentHttpPayloadWithStructureOutput(v **HttpPayl return nil } +type awsRestjson1_deserializeOpNoInputAndNoOutput struct { +} + +func (*awsRestjson1_deserializeOpNoInputAndNoOutput) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpNoInputAndNoOutput) 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 { + errorType := response.Header.Get("X-Amzn-Errortype") + errorType = restjson.SanitizeErrorCode(errorType) + + decoder := json.NewDecoder(response.Body) + decoder.UseNumber() + defer response.Body.Close() + + genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: err} + } + return out, metadata, genericError + } + + output := &NoInputAndNoOutputOutput{} + out.Result = output + + return out, metadata, err +} + func awsRestjson1_deserializeHttpBindingsComplexError(v *types.ComplexError, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) diff --git a/internal/protocoltest/awsrestjson/go.mod b/internal/protocoltest/awsrestjson/go.mod index e09a098e528..4516eb94c9d 100644 --- a/internal/protocoltest/awsrestjson/go.mod +++ b/internal/protocoltest/awsrestjson/go.mod @@ -4,6 +4,6 @@ go 1.14 require ( github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03 - github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13 + github.com/awslabs/smithy-go v0.0.0-20200715183807-623301001f0d github.com/google/go-cmp v0.4.1 ) diff --git a/internal/protocoltest/awsrestjson/serializers.go b/internal/protocoltest/awsrestjson/serializers.go index 6b89c2e92ea..626b92f1878 100644 --- a/internal/protocoltest/awsrestjson/serializers.go +++ b/internal/protocoltest/awsrestjson/serializers.go @@ -15,14 +15,14 @@ import ( "time" ) -type awsRestjson1_serializeOpJsonEnums struct { +type awsRestjson1_serializeOpInlineDocument struct { } -func (*awsRestjson1_serializeOpJsonEnums) ID() string { +func (*awsRestjson1_serializeOpInlineDocument) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpJsonEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpInlineDocument) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -30,13 +30,13 @@ func (m *awsRestjson1_serializeOpJsonEnums) HandleSerialize(ctx context.Context, return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*JsonEnumsInput) + input, ok := in.Parameters.(*InlineDocumentInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/JsonEnums") + opPath, opQuery := httpbinding.SplitURI("/InlineDocument") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -53,7 +53,7 @@ func (m *awsRestjson1_serializeOpJsonEnums) HandleSerialize(ctx context.Context, restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentJsonEnumsInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeDocumentInlineDocumentInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -68,7 +68,7 @@ func (m *awsRestjson1_serializeOpJsonEnums) HandleSerialize(ctx context.Context, return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsJsonEnumsInput(v *JsonEnumsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsInlineDocumentInput(v *InlineDocumentInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -76,57 +76,33 @@ func awsRestjson1_serializeHttpBindingsJsonEnumsInput(v *JsonEnumsInput, encoder return nil } -func awsRestjson1_serializeDocumentJsonEnumsInput(v *JsonEnumsInput, value smithyjson.Value) error { +func awsRestjson1_serializeDocumentInlineDocumentInput(v *InlineDocumentInput, value smithyjson.Value) error { object := value.Object() defer object.Close() - if len(v.FooEnum1) > 0 { - ok := object.Key("fooEnum1") - ok.String(string(v.FooEnum1)) - } - - if len(v.FooEnum2) > 0 { - ok := object.Key("fooEnum2") - ok.String(string(v.FooEnum2)) - } - - if len(v.FooEnum3) > 0 { - ok := object.Key("fooEnum3") - ok.String(string(v.FooEnum3)) - } - - if v.FooEnumList != nil { - ok := object.Key("fooEnumList") - if err := awsRestjson1_serializeDocumentFooEnumList(v.FooEnumList, ok); err != nil { - return err - } - } - - if v.FooEnumMap != nil { - ok := object.Key("fooEnumMap") - if err := awsRestjson1_serializeDocumentFooEnumMap(v.FooEnumMap, ok); err != nil { + if v.DocumentValue != nil { + ok := object.Key("documentValue") + if err := awsRestjson1_serializeDocumentDocument(v.DocumentValue, ok); err != nil { return err } } - if v.FooEnumSet != nil { - ok := object.Key("fooEnumSet") - if err := awsRestjson1_serializeDocumentFooEnumSet(v.FooEnumSet, ok); err != nil { - return err - } + if v.StringValue != nil { + ok := object.Key("stringValue") + ok.String(*v.StringValue) } return nil } -type awsRestjson1_serializeOpJsonBlobs struct { +type awsRestjson1_serializeOpInlineDocumentAsPayload struct { } -func (*awsRestjson1_serializeOpJsonBlobs) ID() string { +func (*awsRestjson1_serializeOpInlineDocumentAsPayload) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpJsonBlobs) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpInlineDocumentAsPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -134,13 +110,13 @@ func (m *awsRestjson1_serializeOpJsonBlobs) HandleSerialize(ctx context.Context, return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*JsonBlobsInput) + input, ok := in.Parameters.(*InlineDocumentAsPayloadInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/JsonBlobs") + opPath, opQuery := httpbinding.SplitURI("/InlineDocumentAsPayload") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -148,21 +124,25 @@ func (m *awsRestjson1_serializeOpJsonBlobs) HandleSerialize(ctx context.Context, request.URL.RawQuery = opQuery } - request.Method = "POST" + 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_serializeDocumentJsonBlobsInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } + if input.DocumentValue != nil { + if !restEncoder.HasHeader("Content-Type") { + restEncoder.SetHeader("Content-Type").String("application/json") + } - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentDocument(input.DocumentValue, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + payload := bytes.NewReader(jsonEncoder.Bytes()) + if request, err = request.SetStream(payload); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } } if request.Request, err = restEncoder.Encode(request.Request); err != nil { @@ -172,7 +152,7 @@ func (m *awsRestjson1_serializeOpJsonBlobs) HandleSerialize(ctx context.Context, return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsJsonBlobsInput(v *JsonBlobsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsInlineDocumentAsPayloadInput(v *InlineDocumentAsPayloadInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -180,26 +160,14 @@ func awsRestjson1_serializeHttpBindingsJsonBlobsInput(v *JsonBlobsInput, encoder return nil } -func awsRestjson1_serializeDocumentJsonBlobsInput(v *JsonBlobsInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Data != nil { - ok := object.Key("data") - ok.Base64EncodeBytes(v.Data) - } - - return nil -} - -type awsRestjson1_serializeOpTimestampFormatHeaders struct { +type awsRestjson1_serializeOpJsonLists struct { } -func (*awsRestjson1_serializeOpTimestampFormatHeaders) ID() string { +func (*awsRestjson1_serializeOpJsonLists) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpTimestampFormatHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpJsonLists) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -207,13 +175,13 @@ func (m *awsRestjson1_serializeOpTimestampFormatHeaders) HandleSerialize(ctx con return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*TimestampFormatHeadersInput) + input, ok := in.Parameters.(*JsonListsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/TimestampFormatHeaders") + opPath, opQuery := httpbinding.SplitURI("/JsonLists") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -221,13 +189,20 @@ func (m *awsRestjson1_serializeOpTimestampFormatHeaders) HandleSerialize(ctx con request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} } - if err := awsRestjson1_serializeHttpBindingsTimestampFormatHeadersInput(input, restEncoder); err != nil { + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentJsonListsInput(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} } @@ -238,50 +213,85 @@ func (m *awsRestjson1_serializeOpTimestampFormatHeaders) HandleSerialize(ctx con return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsTimestampFormatHeadersInput(v *TimestampFormatHeadersInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsJsonListsInput(v *JsonListsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.DefaultFormat != nil { - encoder.SetHeader("X-defaultFormat").String(smithytime.FormatHTTPDate(*v.DefaultFormat)) + return nil +} + +func awsRestjson1_serializeDocumentJsonListsInput(v *JsonListsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BooleanList != nil { + ok := object.Key("booleanList") + if err := awsRestjson1_serializeDocumentBooleanList(v.BooleanList, ok); err != nil { + return err + } } - if v.MemberDateTime != nil { - encoder.SetHeader("X-memberDateTime").String(smithytime.FormatDateTime(*v.MemberDateTime)) + if v.EnumList != nil { + ok := object.Key("enumList") + if err := awsRestjson1_serializeDocumentFooEnumList(v.EnumList, ok); err != nil { + return err + } } - if v.MemberEpochSeconds != nil { - encoder.SetHeader("X-memberEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)) + if v.IntegerList != nil { + ok := object.Key("integerList") + if err := awsRestjson1_serializeDocumentIntegerList(v.IntegerList, ok); err != nil { + return err + } } - if v.MemberHttpDate != nil { - encoder.SetHeader("X-memberHttpDate").String(smithytime.FormatHTTPDate(*v.MemberHttpDate)) + if v.NestedStringList != nil { + ok := object.Key("nestedStringList") + if err := awsRestjson1_serializeDocumentNestedStringList(v.NestedStringList, ok); err != nil { + return err + } } - if v.TargetDateTime != nil { - encoder.SetHeader("X-targetDateTime").String(smithytime.FormatDateTime(*v.TargetDateTime)) + if v.StringList != nil { + ok := object.Key("stringList") + if err := awsRestjson1_serializeDocumentStringList(v.StringList, ok); err != nil { + return err + } } - if v.TargetEpochSeconds != nil { - encoder.SetHeader("X-targetEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)) + if v.StringSet != nil { + ok := object.Key("stringSet") + if err := awsRestjson1_serializeDocumentStringSet(v.StringSet, ok); err != nil { + return err + } } - if v.TargetHttpDate != nil { - encoder.SetHeader("X-targetHttpDate").String(smithytime.FormatHTTPDate(*v.TargetHttpDate)) + if v.StructureList != nil { + ok := object.Key("myStructureList") + if err := awsRestjson1_serializeDocumentStructureList(v.StructureList, ok); err != nil { + return err + } + } + + if v.TimestampList != nil { + ok := object.Key("timestampList") + if err := awsRestjson1_serializeDocumentTimestampList(v.TimestampList, ok); err != nil { + return err + } } return nil } -type awsRestjson1_serializeOpNoInputAndOutput struct { +type awsRestjson1_serializeOpHttpPayloadWithStructure struct { } -func (*awsRestjson1_serializeOpNoInputAndOutput) ID() string { +func (*awsRestjson1_serializeOpHttpPayloadWithStructure) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpNoInputAndOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -289,13 +299,13 @@ func (m *awsRestjson1_serializeOpNoInputAndOutput) HandleSerialize(ctx context.C return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NoInputAndOutputInput) + input, ok := in.Parameters.(*HttpPayloadWithStructureInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NoInputAndOutputOutput") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithStructure") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -303,12 +313,27 @@ func (m *awsRestjson1_serializeOpNoInputAndOutput) HandleSerialize(ctx context.C request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} } + if input.Nested != nil { + if !restEncoder.HasHeader("Content-Type") { + restEncoder.SetHeader("Content-Type").String("application/json") + } + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentNestedPayload(input.Nested, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + payload := bytes.NewReader(jsonEncoder.Bytes()) + if request, err = request.SetStream(payload); 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} } @@ -316,7 +341,7 @@ func (m *awsRestjson1_serializeOpNoInputAndOutput) HandleSerialize(ctx context.C return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsNoInputAndOutputInput(v *NoInputAndOutputInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsHttpPayloadWithStructureInput(v *HttpPayloadWithStructureInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -324,14 +349,14 @@ func awsRestjson1_serializeHttpBindingsNoInputAndOutputInput(v *NoInputAndOutput return nil } -type awsRestjson1_serializeOpNoInputAndNoOutput struct { +type awsRestjson1_serializeOpConstantAndVariableQueryString struct { } -func (*awsRestjson1_serializeOpNoInputAndNoOutput) ID() string { +func (*awsRestjson1_serializeOpConstantAndVariableQueryString) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpConstantAndVariableQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -339,13 +364,13 @@ func (m *awsRestjson1_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NoInputAndNoOutputInput) + input, ok := in.Parameters.(*ConstantAndVariableQueryStringInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NoInputAndNoOutput") + opPath, opQuery := httpbinding.SplitURI("/ConstantAndVariableQueryString?foo=bar") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -353,12 +378,16 @@ func (m *awsRestjson1_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context request.URL.RawQuery = opQuery } - request.Method = "POST" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestjson1_serializeHttpBindingsConstantAndVariableQueryStringInput(input, restEncoder); 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} } @@ -366,22 +395,30 @@ func (m *awsRestjson1_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsNoInputAndNoOutputInput(v *NoInputAndNoOutputInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsConstantAndVariableQueryStringInput(v *ConstantAndVariableQueryStringInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Baz != nil { + encoder.SetQuery("baz").String(*v.Baz) + } + + if v.MaybeSet != nil { + encoder.SetQuery("maybeSet").String(*v.MaybeSet) + } + return nil } -type awsRestjson1_serializeOpGreetingWithErrors struct { +type awsRestjson1_serializeOpNullAndEmptyHeadersServer struct { } -func (*awsRestjson1_serializeOpGreetingWithErrors) ID() string { +func (*awsRestjson1_serializeOpNullAndEmptyHeadersServer) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpGreetingWithErrors) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -389,13 +426,13 @@ func (m *awsRestjson1_serializeOpGreetingWithErrors) HandleSerialize(ctx context return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*GreetingWithErrorsInput) + input, ok := in.Parameters.(*NullAndEmptyHeadersServerInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/GreetingWithErrors") + opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersServer") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -403,12 +440,16 @@ func (m *awsRestjson1_serializeOpGreetingWithErrors) HandleSerialize(ctx context request.URL.RawQuery = opQuery } - request.Method = "PUT" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersServerInput(input, restEncoder); 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} } @@ -416,22 +457,42 @@ func (m *awsRestjson1_serializeOpGreetingWithErrors) HandleSerialize(ctx context return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsGreetingWithErrorsInput(v *GreetingWithErrorsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersServerInput(v *NullAndEmptyHeadersServerInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.A != nil { + if len(*v.A) > 0 { + encoder.SetHeader("X-A").String(*v.A) + } + } + + if v.B != nil { + if len(*v.B) > 0 { + encoder.SetHeader("X-B").String(*v.B) + } + } + + if v.C != nil { + for i := range v.C { + if v.C[i] != nil && len(*v.C[i]) > 0 { + encoder.AddHeader("X-C").String(*v.C[i]) + } + } + } + return nil } -type awsRestjson1_serializeOpOmitsNullSerializesEmptyString struct { +type awsRestjson1_serializeOpRecursiveShapes struct { } -func (*awsRestjson1_serializeOpOmitsNullSerializesEmptyString) ID() string { +func (*awsRestjson1_serializeOpRecursiveShapes) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpRecursiveShapes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -439,13 +500,13 @@ func (m *awsRestjson1_serializeOpOmitsNullSerializesEmptyString) HandleSerialize return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*OmitsNullSerializesEmptyStringInput) + input, ok := in.Parameters.(*RecursiveShapesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/OmitsNullSerializesEmptyString") + opPath, opQuery := httpbinding.SplitURI("/RecursiveShapes") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -453,13 +514,20 @@ func (m *awsRestjson1_serializeOpOmitsNullSerializesEmptyString) HandleSerialize request.URL.RawQuery = opQuery } - request.Method = "GET" + 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} } - if err := awsRestjson1_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(input, restEncoder); err != nil { + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentRecursiveShapesInput(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} } @@ -470,30 +538,36 @@ func (m *awsRestjson1_serializeOpOmitsNullSerializesEmptyString) HandleSerialize return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(v *OmitsNullSerializesEmptyStringInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsRecursiveShapesInput(v *RecursiveShapesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.EmptyString != nil { - encoder.SetQuery("Empty").String(*v.EmptyString) - } + return nil +} - if v.NullValue != nil { - encoder.SetQuery("Null").String(*v.NullValue) +func awsRestjson1_serializeDocumentRecursiveShapesInput(v *RecursiveShapesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Nested != nil { + ok := object.Key("nested") + if err := awsRestjson1_serializeDocumentRecursiveShapesInputOutputNested1(v.Nested, ok); err != nil { + return err + } } return nil } -type awsRestjson1_serializeOpJsonMaps struct { +type awsRestjson1_serializeOpHttpPrefixHeaders struct { } -func (*awsRestjson1_serializeOpJsonMaps) ID() string { +func (*awsRestjson1_serializeOpHttpPrefixHeaders) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpJsonMaps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -501,13 +575,13 @@ func (m *awsRestjson1_serializeOpJsonMaps) HandleSerialize(ctx context.Context, return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*JsonMapsInput) + input, ok := in.Parameters.(*HttpPrefixHeadersInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/JsonMaps") + opPath, opQuery := httpbinding.SplitURI("/HttpPrefixHeaders") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -515,20 +589,13 @@ func (m *awsRestjson1_serializeOpJsonMaps) HandleSerialize(ctx context.Context, request.URL.RawQuery = opQuery } - request.Method = "POST" + request.Method = "GET" 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_serializeDocumentJsonMapsInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + if err := awsRestjson1_serializeHttpBindingsHttpPrefixHeadersInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -539,36 +606,37 @@ func (m *awsRestjson1_serializeOpJsonMaps) HandleSerialize(ctx context.Context, return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsJsonMapsInput(v *JsonMapsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsHttpPrefixHeadersInput(v *HttpPrefixHeadersInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - return nil -} - -func awsRestjson1_serializeDocumentJsonMapsInput(v *JsonMapsInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() + if v.Foo != nil { + if len(*v.Foo) > 0 { + encoder.SetHeader("X-Foo").String(*v.Foo) + } + } - if v.MyMap != nil { - ok := object.Key("myMap") - if err := awsRestjson1_serializeDocumentJsonMapsInputOutputMap(v.MyMap, ok); err != nil { - return err + if v.FooMap != nil { + hv := encoder.Headers("X-Foo-") + for mapKey, mapVal := range v.FooMap { + if mapVal != nil && len(*mapVal) > 0 { + hv.AddHeader(mapKey).String(*mapVal) + } } } return nil } -type awsRestjson1_serializeOpRecursiveShapes struct { +type awsRestjson1_serializeOpHttpPayloadTraits struct { } -func (*awsRestjson1_serializeOpRecursiveShapes) ID() string { +func (*awsRestjson1_serializeOpHttpPayloadTraits) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpRecursiveShapes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -576,13 +644,13 @@ func (m *awsRestjson1_serializeOpRecursiveShapes) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*RecursiveShapesInput) + input, ok := in.Parameters.(*HttpPayloadTraitsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/RecursiveShapes") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraits") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -590,21 +658,25 @@ func (m *awsRestjson1_serializeOpRecursiveShapes) HandleSerialize(ctx context.Co request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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} } - restEncoder.SetHeader("Content-Type").String("application/json") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentRecursiveShapesInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeHttpBindingsHttpPayloadTraitsInput(input, restEncoder); 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 input.Blob != nil { + if !restEncoder.HasHeader("Content-Type") { + restEncoder.SetHeader("Content-Type").String("application/octet-stream") + } + + payload := bytes.NewReader(input.Blob) + if request, err = request.SetStream(payload); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } } if request.Request, err = restEncoder.Encode(request.Request); err != nil { @@ -614,23 +686,65 @@ func (m *awsRestjson1_serializeOpRecursiveShapes) HandleSerialize(ctx context.Co return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsRecursiveShapesInput(v *RecursiveShapesInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsHttpPayloadTraitsInput(v *HttpPayloadTraitsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Foo != nil { + if len(*v.Foo) > 0 { + encoder.SetHeader("X-Foo").String(*v.Foo) + } + } + return nil } -func awsRestjson1_serializeDocumentRecursiveShapesInput(v *RecursiveShapesInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() +type awsRestjson1_serializeOpNoInputAndOutput struct { +} - if v.Nested != nil { - ok := object.Key("nested") - if err := awsRestjson1_serializeDocumentRecursiveShapesInputOutputNested1(v.Nested, ok); err != nil { - return err - } +func (*awsRestjson1_serializeOpNoInputAndOutput) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpNoInputAndOutput) 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.(*NoInputAndOutputInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/NoInputAndOutputOutput") + request.URL.Path = opPath + if len(request.URL.RawQuery) > 0 { + request.URL.RawQuery = "&" + opQuery + } else { + 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_serializeHttpBindingsNoInputAndOutputInput(v *NoInputAndOutputInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) } return nil @@ -926,14 +1040,14 @@ func awsRestjson1_serializeHttpBindingsIgnoreQueryParamsInResponseInput(v *Ignor return nil } -type awsRestjson1_serializeOpAllQueryStringTypes struct { +type awsRestjson1_serializeOpHttpRequestWithLabels struct { } -func (*awsRestjson1_serializeOpAllQueryStringTypes) ID() string { +func (*awsRestjson1_serializeOpHttpRequestWithLabels) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpAllQueryStringTypes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpHttpRequestWithLabels) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -941,13 +1055,13 @@ func (m *awsRestjson1_serializeOpAllQueryStringTypes) HandleSerialize(ctx contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*AllQueryStringTypesInput) + input, ok := in.Parameters.(*HttpRequestWithLabelsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/AllQueryStringTypesInput") + opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -961,7 +1075,7 @@ func (m *awsRestjson1_serializeOpAllQueryStringTypes) HandleSerialize(ctx contex return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsAllQueryStringTypesInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsHttpRequestWithLabelsInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -972,53 +1086,155 @@ func (m *awsRestjson1_serializeOpAllQueryStringTypes) HandleSerialize(ctx contex return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsAllQueryStringTypesInput(v *AllQueryStringTypesInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsHttpRequestWithLabelsInput(v *HttpRequestWithLabelsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.QueryBoolean != nil { - encoder.SetQuery("Boolean").Boolean(*v.QueryBoolean) + if v.Boolean != nil { + if err := encoder.SetURI("boolean").Boolean(*v.Boolean); err != nil { + return err + } } - if v.QueryBooleanList != nil { - for i := range v.QueryBooleanList { - if v.QueryBooleanList[i] == nil { - continue - } - encoder.AddQuery("BooleanList").Boolean(*v.QueryBooleanList[i]) + if v.Double != nil { + if err := encoder.SetURI("double").Double(*v.Double); err != nil { + return err } } - if v.QueryByte != nil { - encoder.SetQuery("Byte").Byte(*v.QueryByte) + if v.Float != nil { + if err := encoder.SetURI("float").Float(*v.Float); err != nil { + return err + } } - if v.QueryDouble != nil { - encoder.SetQuery("Double").Double(*v.QueryDouble) + if v.Integer != nil { + if err := encoder.SetURI("integer").Integer(*v.Integer); err != nil { + return err + } } - if v.QueryDoubleList != nil { - for i := range v.QueryDoubleList { - if v.QueryDoubleList[i] == nil { - continue - } - encoder.AddQuery("DoubleList").Double(*v.QueryDoubleList[i]) + if v.Long != nil { + if err := encoder.SetURI("long").Long(*v.Long); err != nil { + return err } } - if len(v.QueryEnum) > 0 { - encoder.SetQuery("Enum").String(string(v.QueryEnum)) + if v.Short != nil { + if err := encoder.SetURI("short").Short(*v.Short); err != nil { + return err + } } - if v.QueryEnumList != nil { - for i := range v.QueryEnumList { - encoder.AddQuery("EnumList").String(string(v.QueryEnumList[i])) + if v.String_ != nil { + if err := encoder.SetURI("string").String(*v.String_); err != nil { + return err } } - if v.QueryFloat != nil { - encoder.SetQuery("Float").Float(*v.QueryFloat) + if v.Timestamp != nil { + if err := encoder.SetURI("timestamp").String(smithytime.FormatDateTime(*v.Timestamp)); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpAllQueryStringTypes struct { +} + +func (*awsRestjson1_serializeOpAllQueryStringTypes) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpAllQueryStringTypes) 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.(*AllQueryStringTypesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/AllQueryStringTypesInput") + request.URL.Path = opPath + if len(request.URL.RawQuery) > 0 { + request.URL.RawQuery = "&" + opQuery + } else { + request.URL.RawQuery = opQuery + } + + request.Method = "GET" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeHttpBindingsAllQueryStringTypesInput(input, restEncoder); 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_serializeHttpBindingsAllQueryStringTypesInput(v *AllQueryStringTypesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.QueryBoolean != nil { + encoder.SetQuery("Boolean").Boolean(*v.QueryBoolean) + } + + if v.QueryBooleanList != nil { + for i := range v.QueryBooleanList { + if v.QueryBooleanList[i] == nil { + continue + } + encoder.AddQuery("BooleanList").Boolean(*v.QueryBooleanList[i]) + } + } + + if v.QueryByte != nil { + encoder.SetQuery("Byte").Byte(*v.QueryByte) + } + + if v.QueryDouble != nil { + encoder.SetQuery("Double").Double(*v.QueryDouble) + } + + if v.QueryDoubleList != nil { + for i := range v.QueryDoubleList { + if v.QueryDoubleList[i] == nil { + continue + } + encoder.AddQuery("DoubleList").Double(*v.QueryDoubleList[i]) + } + } + + if len(v.QueryEnum) > 0 { + encoder.SetQuery("Enum").String(string(v.QueryEnum)) + } + + if v.QueryEnumList != nil { + for i := range v.QueryEnumList { + encoder.AddQuery("EnumList").String(string(v.QueryEnumList[i])) + } + } + + if v.QueryFloat != nil { + encoder.SetQuery("Float").Float(*v.QueryFloat) } if v.QueryInteger != nil { @@ -1089,14 +1305,14 @@ func awsRestjson1_serializeHttpBindingsAllQueryStringTypesInput(v *AllQueryStrin return nil } -type awsRestjson1_serializeOpJsonTimestamps struct { +type awsRestjson1_serializeOpEmptyInputAndEmptyOutput struct { } -func (*awsRestjson1_serializeOpJsonTimestamps) ID() string { +func (*awsRestjson1_serializeOpEmptyInputAndEmptyOutput) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpJsonTimestamps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpEmptyInputAndEmptyOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1104,13 +1320,13 @@ func (m *awsRestjson1_serializeOpJsonTimestamps) HandleSerialize(ctx context.Con return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*JsonTimestampsInput) + input, ok := in.Parameters.(*EmptyInputAndEmptyOutputInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/JsonTimestamps") + opPath, opQuery := httpbinding.SplitURI("/EmptyInputAndEmptyOutput") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1124,17 +1340,6 @@ func (m *awsRestjson1_serializeOpJsonTimestamps) HandleSerialize(ctx context.Con return out, metadata, &smithy.SerializationError{Err: err} } - restEncoder.SetHeader("Content-Type").String("application/json") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentJsonTimestampsInput(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} } @@ -1142,7 +1347,7 @@ func (m *awsRestjson1_serializeOpJsonTimestamps) HandleSerialize(ctx context.Con return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsJsonTimestampsInput(v *JsonTimestampsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsEmptyInputAndEmptyOutputInput(v *EmptyInputAndEmptyOutputInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1150,41 +1355,64 @@ func awsRestjson1_serializeHttpBindingsJsonTimestampsInput(v *JsonTimestampsInpu return nil } -func awsRestjson1_serializeDocumentJsonTimestampsInput(v *JsonTimestampsInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() +type awsRestjson1_serializeOpGreetingWithErrors struct { +} - if v.DateTime != nil { - ok := object.Key("dateTime") - ok.String(smithytime.FormatDateTime(*v.DateTime)) +func (*awsRestjson1_serializeOpGreetingWithErrors) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGreetingWithErrors) 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)} } - if v.EpochSeconds != nil { - ok := object.Key("epochSeconds") - ok.Double(smithytime.FormatEpochSeconds(*v.EpochSeconds)) + input, ok := in.Parameters.(*GreetingWithErrorsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - if v.HttpDate != nil { - ok := object.Key("httpDate") - ok.String(smithytime.FormatHTTPDate(*v.HttpDate)) + opPath, opQuery := httpbinding.SplitURI("/GreetingWithErrors") + request.URL.Path = opPath + if len(request.URL.RawQuery) > 0 { + request.URL.RawQuery = "&" + opQuery + } else { + request.URL.RawQuery = opQuery } - if v.Normal != nil { - ok := object.Key("normal") - ok.Double(smithytime.FormatEpochSeconds(*v.Normal)) + 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} + } + + 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_serializeHttpBindingsGreetingWithErrorsInput(v *GreetingWithErrorsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) } return nil } -type awsRestjson1_serializeOpNullAndEmptyHeadersClient struct { +type awsRestjson1_serializeOpOmitsNullSerializesEmptyString struct { } -func (*awsRestjson1_serializeOpNullAndEmptyHeadersClient) ID() string { +func (*awsRestjson1_serializeOpOmitsNullSerializesEmptyString) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1192,13 +1420,13 @@ func (m *awsRestjson1_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NullAndEmptyHeadersClientInput) + input, ok := in.Parameters.(*OmitsNullSerializesEmptyStringInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersClient") + opPath, opQuery := httpbinding.SplitURI("/OmitsNullSerializesEmptyString") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1212,7 +1440,7 @@ func (m *awsRestjson1_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersClientInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1223,42 +1451,30 @@ func (m *awsRestjson1_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersClientInput(v *NullAndEmptyHeadersClientInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(v *OmitsNullSerializesEmptyStringInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.A != nil { - if len(*v.A) > 0 { - encoder.SetHeader("X-A").String(*v.A) - } - } - - if v.B != nil { - if len(*v.B) > 0 { - encoder.SetHeader("X-B").String(*v.B) - } + if v.EmptyString != nil { + encoder.SetQuery("Empty").String(*v.EmptyString) } - if v.C != nil { - for i := range v.C { - if v.C[i] != nil && len(*v.C[i]) > 0 { - encoder.AddHeader("X-C").String(*v.C[i]) - } - } + if v.NullValue != nil { + encoder.SetQuery("Null").String(*v.NullValue) } return nil } -type awsRestjson1_serializeOpJsonLists struct { +type awsRestjson1_serializeOpTimestampFormatHeaders struct { } -func (*awsRestjson1_serializeOpJsonLists) ID() string { +func (*awsRestjson1_serializeOpTimestampFormatHeaders) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpJsonLists) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpTimestampFormatHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1266,13 +1482,13 @@ func (m *awsRestjson1_serializeOpJsonLists) HandleSerialize(ctx context.Context, return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*JsonListsInput) + input, ok := in.Parameters.(*TimestampFormatHeadersInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/JsonLists") + opPath, opQuery := httpbinding.SplitURI("/TimestampFormatHeaders") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1280,20 +1496,13 @@ func (m *awsRestjson1_serializeOpJsonLists) HandleSerialize(ctx context.Context, request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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} } - restEncoder.SetHeader("Content-Type").String("application/json") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentJsonListsInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + if err := awsRestjson1_serializeHttpBindingsTimestampFormatHeadersInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1304,85 +1513,50 @@ func (m *awsRestjson1_serializeOpJsonLists) HandleSerialize(ctx context.Context, return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsJsonListsInput(v *JsonListsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsTimestampFormatHeadersInput(v *TimestampFormatHeadersInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - return nil -} - -func awsRestjson1_serializeDocumentJsonListsInput(v *JsonListsInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.BooleanList != nil { - ok := object.Key("booleanList") - if err := awsRestjson1_serializeDocumentBooleanList(v.BooleanList, ok); err != nil { - return err - } + if v.DefaultFormat != nil { + encoder.SetHeader("X-defaultFormat").String(smithytime.FormatHTTPDate(*v.DefaultFormat)) } - if v.EnumList != nil { - ok := object.Key("enumList") - if err := awsRestjson1_serializeDocumentFooEnumList(v.EnumList, ok); err != nil { - return err - } + if v.MemberDateTime != nil { + encoder.SetHeader("X-memberDateTime").String(smithytime.FormatDateTime(*v.MemberDateTime)) } - if v.IntegerList != nil { - ok := object.Key("integerList") - if err := awsRestjson1_serializeDocumentIntegerList(v.IntegerList, ok); err != nil { - return err - } - } - - if v.NestedStringList != nil { - ok := object.Key("nestedStringList") - if err := awsRestjson1_serializeDocumentNestedStringList(v.NestedStringList, ok); err != nil { - return err - } + if v.MemberEpochSeconds != nil { + encoder.SetHeader("X-memberEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)) } - if v.StringList != nil { - ok := object.Key("stringList") - if err := awsRestjson1_serializeDocumentStringList(v.StringList, ok); err != nil { - return err - } + if v.MemberHttpDate != nil { + encoder.SetHeader("X-memberHttpDate").String(smithytime.FormatHTTPDate(*v.MemberHttpDate)) } - if v.StringSet != nil { - ok := object.Key("stringSet") - if err := awsRestjson1_serializeDocumentStringSet(v.StringSet, ok); err != nil { - return err - } + if v.TargetDateTime != nil { + encoder.SetHeader("X-targetDateTime").String(smithytime.FormatDateTime(*v.TargetDateTime)) } - if v.StructureList != nil { - ok := object.Key("myStructureList") - if err := awsRestjson1_serializeDocumentStructureList(v.StructureList, ok); err != nil { - return err - } + if v.TargetEpochSeconds != nil { + encoder.SetHeader("X-targetEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)) } - if v.TimestampList != nil { - ok := object.Key("timestampList") - if err := awsRestjson1_serializeDocumentTimestampList(v.TimestampList, ok); err != nil { - return err - } + if v.TargetHttpDate != nil { + encoder.SetHeader("X-targetHttpDate").String(smithytime.FormatHTTPDate(*v.TargetHttpDate)) } return nil } -type awsRestjson1_serializeOpInlineDocumentAsPayload struct { +type awsRestjson1_serializeOpJsonEnums struct { } -func (*awsRestjson1_serializeOpInlineDocumentAsPayload) ID() string { +func (*awsRestjson1_serializeOpJsonEnums) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpInlineDocumentAsPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpJsonEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1390,13 +1564,13 @@ func (m *awsRestjson1_serializeOpInlineDocumentAsPayload) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*InlineDocumentAsPayloadInput) + input, ok := in.Parameters.(*JsonEnumsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/InlineDocumentAsPayload") + opPath, opQuery := httpbinding.SplitURI("/JsonEnums") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1410,19 +1584,15 @@ func (m *awsRestjson1_serializeOpInlineDocumentAsPayload) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: err} } - if input.DocumentValue != nil { - if !restEncoder.HasHeader("Content-Type") { - restEncoder.SetHeader("Content-Type").String("application/json") - } + restEncoder.SetHeader("Content-Type").String("application/json") - jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentDocument(input.DocumentValue, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - payload := bytes.NewReader(jsonEncoder.Bytes()) - if request, err = request.SetStream(payload); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentJsonEnumsInput(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 { @@ -1432,7 +1602,7 @@ func (m *awsRestjson1_serializeOpInlineDocumentAsPayload) HandleSerialize(ctx co return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsInlineDocumentAsPayloadInput(v *InlineDocumentAsPayloadInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsJsonEnumsInput(v *JsonEnumsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1440,64 +1610,57 @@ func awsRestjson1_serializeHttpBindingsInlineDocumentAsPayloadInput(v *InlineDoc return nil } -type awsRestjson1_serializeOpEmptyInputAndEmptyOutput struct { -} - -func (*awsRestjson1_serializeOpEmptyInputAndEmptyOutput) ID() string { - return "OperationSerializer" -} +func awsRestjson1_serializeDocumentJsonEnumsInput(v *JsonEnumsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() -func (m *awsRestjson1_serializeOpEmptyInputAndEmptyOutput) 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)} + if len(v.FooEnum1) > 0 { + ok := object.Key("fooEnum1") + ok.String(string(v.FooEnum1)) } - input, ok := in.Parameters.(*EmptyInputAndEmptyOutputInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + if len(v.FooEnum2) > 0 { + ok := object.Key("fooEnum2") + ok.String(string(v.FooEnum2)) } - opPath, opQuery := httpbinding.SplitURI("/EmptyInputAndEmptyOutput") - request.URL.Path = opPath - if len(request.URL.RawQuery) > 0 { - request.URL.RawQuery = "&" + opQuery - } else { - request.URL.RawQuery = opQuery + if len(v.FooEnum3) > 0 { + ok := object.Key("fooEnum3") + ok.String(string(v.FooEnum3)) } - 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 v.FooEnumList != nil { + ok := object.Key("fooEnumList") + if err := awsRestjson1_serializeDocumentFooEnumList(v.FooEnumList, ok); err != nil { + return err + } } - if request.Request, err = restEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} + if v.FooEnumMap != nil { + ok := object.Key("fooEnumMap") + if err := awsRestjson1_serializeDocumentFooEnumMap(v.FooEnumMap, ok); err != nil { + return err + } } - in.Request = request - return next.HandleSerialize(ctx, in) -} -func awsRestjson1_serializeHttpBindingsEmptyInputAndEmptyOutputInput(v *EmptyInputAndEmptyOutputInput, encoder *httpbinding.Encoder) error { - if v == nil { - return fmt.Errorf("unsupported serialization of nil %T", v) + if v.FooEnumSet != nil { + ok := object.Key("fooEnumSet") + if err := awsRestjson1_serializeDocumentFooEnumSet(v.FooEnumSet, ok); err != nil { + return err + } } return nil } -type awsRestjson1_serializeOpConstantAndVariableQueryString struct { +type awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath struct { } -func (*awsRestjson1_serializeOpConstantAndVariableQueryString) ID() string { +func (*awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpConstantAndVariableQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1505,13 +1668,13 @@ func (m *awsRestjson1_serializeOpConstantAndVariableQueryString) HandleSerialize return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*ConstantAndVariableQueryStringInput) + input, ok := in.Parameters.(*HttpRequestWithGreedyLabelInPathInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/ConstantAndVariableQueryString?foo=bar") + opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1525,7 +1688,7 @@ func (m *awsRestjson1_serializeOpConstantAndVariableQueryString) HandleSerialize return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsConstantAndVariableQueryStringInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1536,30 +1699,34 @@ func (m *awsRestjson1_serializeOpConstantAndVariableQueryString) HandleSerialize return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsConstantAndVariableQueryStringInput(v *ConstantAndVariableQueryStringInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(v *HttpRequestWithGreedyLabelInPathInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Baz != nil { - encoder.SetQuery("baz").String(*v.Baz) + if err := encoder.SetURI("baz").String(*v.Baz); err != nil { + return err + } } - if v.MaybeSet != nil { - encoder.SetQuery("maybeSet").String(*v.MaybeSet) + if v.Foo != nil { + if err := encoder.SetURI("foo").String(*v.Foo); err != nil { + return err + } } return nil } -type awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType struct { +type awsRestjson1_serializeOpNullAndEmptyHeadersClient struct { } -func (*awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType) ID() string { +func (*awsRestjson1_serializeOpNullAndEmptyHeadersClient) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1567,13 +1734,13 @@ func (m *awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadTraitsWithMediaTypeInput) + input, ok := in.Parameters.(*NullAndEmptyHeadersClientInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraitsWithMediaType") + opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersClient") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1581,27 +1748,16 @@ func (m *awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize request.URL.RawQuery = opQuery } - request.Method = "POST" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersClientInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } - if input.Blob != nil { - if !restEncoder.HasHeader("Content-Type") { - restEncoder.SetHeader("Content-Type").String("text/plain") - } - - payload := bytes.NewReader(input.Blob) - if request, err = request.SetStream(payload); 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} } @@ -1609,28 +1765,42 @@ func (m *awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(v *HttpPayloadTraitsWithMediaTypeInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersClientInput(v *NullAndEmptyHeadersClientInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Foo != nil { - if len(*v.Foo) > 0 { - encoder.SetHeader("X-Foo").String(*v.Foo) + if v.A != nil { + if len(*v.A) > 0 { + encoder.SetHeader("X-A").String(*v.A) + } + } + + if v.B != nil { + if len(*v.B) > 0 { + encoder.SetHeader("X-B").String(*v.B) + } + } + + if v.C != nil { + for i := range v.C { + if v.C[i] != nil && len(*v.C[i]) > 0 { + encoder.AddHeader("X-C").String(*v.C[i]) + } } } return nil } -type awsRestjson1_serializeOpConstantQueryString struct { +type awsRestjson1_serializeOpQueryIdempotencyTokenAutoFill struct { } -func (*awsRestjson1_serializeOpConstantQueryString) ID() string { +func (*awsRestjson1_serializeOpQueryIdempotencyTokenAutoFill) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpConstantQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpQueryIdempotencyTokenAutoFill) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1638,13 +1808,13 @@ func (m *awsRestjson1_serializeOpConstantQueryString) HandleSerialize(ctx contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*ConstantQueryStringInput) + input, ok := in.Parameters.(*QueryIdempotencyTokenAutoFillInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/ConstantQueryString/{hello}?foo=bar&hello") + opPath, opQuery := httpbinding.SplitURI("/QueryIdempotencyTokenAutoFill") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1652,13 +1822,13 @@ func (m *awsRestjson1_serializeOpConstantQueryString) HandleSerialize(ctx contex request.URL.RawQuery = opQuery } - request.Method = "GET" + 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 err := awsRestjson1_serializeHttpBindingsConstantQueryStringInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1669,28 +1839,26 @@ func (m *awsRestjson1_serializeOpConstantQueryString) HandleSerialize(ctx contex return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsConstantQueryStringInput(v *ConstantQueryStringInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(v *QueryIdempotencyTokenAutoFillInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Hello != nil { - if err := encoder.SetURI("hello").String(*v.Hello); err != nil { - return err - } + if v.Token != nil { + encoder.SetQuery("token").String(*v.Token) } return nil } -type awsRestjson1_serializeOpSimpleScalarProperties struct { +type awsRestjson1_serializeOpJsonTimestamps struct { } -func (*awsRestjson1_serializeOpSimpleScalarProperties) ID() string { +func (*awsRestjson1_serializeOpJsonTimestamps) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpSimpleScalarProperties) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpJsonTimestamps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1698,13 +1866,13 @@ func (m *awsRestjson1_serializeOpSimpleScalarProperties) HandleSerialize(ctx con return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*SimpleScalarPropertiesInput) + input, ok := in.Parameters.(*JsonTimestampsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/SimpleScalarProperties") + opPath, opQuery := httpbinding.SplitURI("/JsonTimestamps") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1712,20 +1880,16 @@ func (m *awsRestjson1_serializeOpSimpleScalarProperties) HandleSerialize(ctx con request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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 err := awsRestjson1_serializeHttpBindingsSimpleScalarPropertiesInput(input, restEncoder); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentSimpleScalarPropertiesInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeDocumentJsonTimestampsInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1740,240 +1904,49 @@ func (m *awsRestjson1_serializeOpSimpleScalarProperties) HandleSerialize(ctx con return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsJsonTimestampsInput(v *JsonTimestampsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Foo != nil { - if len(*v.Foo) > 0 { - encoder.SetHeader("X-Foo").String(*v.Foo) - } - } - return nil } -func awsRestjson1_serializeDocumentSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, value smithyjson.Value) error { +func awsRestjson1_serializeDocumentJsonTimestampsInput(v *JsonTimestampsInput, value smithyjson.Value) error { object := value.Object() defer object.Close() - if v.ByteValue != nil { - ok := object.Key("byteValue") - ok.Byte(*v.ByteValue) - } - - if v.DoubleValue != nil { - ok := object.Key("DoubleDribble") - ok.Double(*v.DoubleValue) - } - - if v.FalseBooleanValue != nil { - ok := object.Key("falseBooleanValue") - ok.Boolean(*v.FalseBooleanValue) - } - - if v.FloatValue != nil { - ok := object.Key("floatValue") - ok.Float(*v.FloatValue) - } - - if v.IntegerValue != nil { - ok := object.Key("integerValue") - ok.Integer(*v.IntegerValue) - } - - if v.LongValue != nil { - ok := object.Key("longValue") - ok.Long(*v.LongValue) - } - - if v.ShortValue != nil { - ok := object.Key("shortValue") - ok.Short(*v.ShortValue) - } - - if v.StringValue != nil { - ok := object.Key("stringValue") - ok.String(*v.StringValue) - } - - if v.TrueBooleanValue != nil { - ok := object.Key("trueBooleanValue") - ok.Boolean(*v.TrueBooleanValue) - } - - return nil -} - -type awsRestjson1_serializeOpHttpRequestWithLabels struct { -} - -func (*awsRestjson1_serializeOpHttpRequestWithLabels) ID() string { - return "OperationSerializer" -} - -func (m *awsRestjson1_serializeOpHttpRequestWithLabels) 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.(*HttpRequestWithLabelsInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}") - request.URL.Path = opPath - if len(request.URL.RawQuery) > 0 { - request.URL.RawQuery = "&" + opQuery - } else { - request.URL.RawQuery = opQuery - } - - request.Method = "GET" - restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if err := awsRestjson1_serializeHttpBindingsHttpRequestWithLabelsInput(input, restEncoder); 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_serializeHttpBindingsHttpRequestWithLabelsInput(v *HttpRequestWithLabelsInput, encoder *httpbinding.Encoder) error { - if v == nil { - return fmt.Errorf("unsupported serialization of nil %T", v) - } - - if v.Boolean != nil { - if err := encoder.SetURI("boolean").Boolean(*v.Boolean); err != nil { - return err - } - } - - if v.Double != nil { - if err := encoder.SetURI("double").Double(*v.Double); err != nil { - return err - } - } - - if v.Float != nil { - if err := encoder.SetURI("float").Float(*v.Float); err != nil { - return err - } - } - - if v.Integer != nil { - if err := encoder.SetURI("integer").Integer(*v.Integer); err != nil { - return err - } - } - - if v.Long != nil { - if err := encoder.SetURI("long").Long(*v.Long); err != nil { - return err - } - } - - if v.Short != nil { - if err := encoder.SetURI("short").Short(*v.Short); err != nil { - return err - } - } - - if v.String_ != nil { - if err := encoder.SetURI("string").String(*v.String_); err != nil { - return err - } - } - - if v.Timestamp != nil { - if err := encoder.SetURI("timestamp").String(smithytime.FormatDateTime(*v.Timestamp)); err != nil { - return err - } - } - - return nil -} - -type awsRestjson1_serializeOpQueryIdempotencyTokenAutoFill struct { -} - -func (*awsRestjson1_serializeOpQueryIdempotencyTokenAutoFill) ID() string { - return "OperationSerializer" -} - -func (m *awsRestjson1_serializeOpQueryIdempotencyTokenAutoFill) 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.(*QueryIdempotencyTokenAutoFillInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - opPath, opQuery := httpbinding.SplitURI("/QueryIdempotencyTokenAutoFill") - request.URL.Path = opPath - if len(request.URL.RawQuery) > 0 { - request.URL.RawQuery = "&" + opQuery - } else { - 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 err := awsRestjson1_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(input, restEncoder); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} + if v.DateTime != nil { + ok := object.Key("dateTime") + ok.String(smithytime.FormatDateTime(*v.DateTime)) } - if request.Request, err = restEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} + if v.EpochSeconds != nil { + ok := object.Key("epochSeconds") + ok.Double(smithytime.FormatEpochSeconds(*v.EpochSeconds)) } - in.Request = request - return next.HandleSerialize(ctx, in) -} -func awsRestjson1_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(v *QueryIdempotencyTokenAutoFillInput, encoder *httpbinding.Encoder) error { - if v == nil { - return fmt.Errorf("unsupported serialization of nil %T", v) + if v.HttpDate != nil { + ok := object.Key("httpDate") + ok.String(smithytime.FormatHTTPDate(*v.HttpDate)) } - if v.Token != nil { - encoder.SetQuery("token").String(*v.Token) + if v.Normal != nil { + ok := object.Key("normal") + ok.Double(smithytime.FormatEpochSeconds(*v.Normal)) } return nil } -type awsRestjson1_serializeOpHttpPayloadTraits struct { +type awsRestjson1_serializeOpSimpleScalarProperties struct { } -func (*awsRestjson1_serializeOpHttpPayloadTraits) ID() string { +func (*awsRestjson1_serializeOpSimpleScalarProperties) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpSimpleScalarProperties) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1981,13 +1954,13 @@ func (m *awsRestjson1_serializeOpHttpPayloadTraits) HandleSerialize(ctx context. return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadTraitsInput) + input, ok := in.Parameters.(*SimpleScalarPropertiesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraits") + opPath, opQuery := httpbinding.SplitURI("/SimpleScalarProperties") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1995,25 +1968,25 @@ func (m *awsRestjson1_serializeOpHttpPayloadTraits) HandleSerialize(ctx context. request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} } - if err := awsRestjson1_serializeHttpBindingsHttpPayloadTraitsInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsSimpleScalarPropertiesInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } - if input.Blob != nil { - if !restEncoder.HasHeader("Content-Type") { - restEncoder.SetHeader("Content-Type").String("application/octet-stream") - } + restEncoder.SetHeader("Content-Type").String("application/json") - payload := bytes.NewReader(input.Blob) - if request, err = request.SetStream(payload); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentSimpleScalarPropertiesInput(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 { @@ -2023,7 +1996,7 @@ func (m *awsRestjson1_serializeOpHttpPayloadTraits) HandleSerialize(ctx context. return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsHttpPayloadTraitsInput(v *HttpPayloadTraitsInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -2037,14 +2010,66 @@ func awsRestjson1_serializeHttpBindingsHttpPayloadTraitsInput(v *HttpPayloadTrai return nil } -type awsRestjson1_serializeOpInlineDocument struct { +func awsRestjson1_serializeDocumentSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ByteValue != nil { + ok := object.Key("byteValue") + ok.Byte(*v.ByteValue) + } + + if v.DoubleValue != nil { + ok := object.Key("DoubleDribble") + ok.Double(*v.DoubleValue) + } + + if v.FalseBooleanValue != nil { + ok := object.Key("falseBooleanValue") + ok.Boolean(*v.FalseBooleanValue) + } + + if v.FloatValue != nil { + ok := object.Key("floatValue") + ok.Float(*v.FloatValue) + } + + if v.IntegerValue != nil { + ok := object.Key("integerValue") + ok.Integer(*v.IntegerValue) + } + + if v.LongValue != nil { + ok := object.Key("longValue") + ok.Long(*v.LongValue) + } + + if v.ShortValue != nil { + ok := object.Key("shortValue") + ok.Short(*v.ShortValue) + } + + if v.StringValue != nil { + ok := object.Key("stringValue") + ok.String(*v.StringValue) + } + + if v.TrueBooleanValue != nil { + ok := object.Key("trueBooleanValue") + ok.Boolean(*v.TrueBooleanValue) + } + + return nil } -func (*awsRestjson1_serializeOpInlineDocument) ID() string { +type awsRestjson1_serializeOpJsonBlobs struct { +} + +func (*awsRestjson1_serializeOpJsonBlobs) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpInlineDocument) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpJsonBlobs) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2052,13 +2077,13 @@ func (m *awsRestjson1_serializeOpInlineDocument) HandleSerialize(ctx context.Con return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*InlineDocumentInput) + input, ok := in.Parameters.(*JsonBlobsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/InlineDocument") + opPath, opQuery := httpbinding.SplitURI("/JsonBlobs") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2066,7 +2091,7 @@ func (m *awsRestjson1_serializeOpInlineDocument) HandleSerialize(ctx context.Con request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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} @@ -2075,7 +2100,7 @@ func (m *awsRestjson1_serializeOpInlineDocument) HandleSerialize(ctx context.Con restEncoder.SetHeader("Content-Type").String("application/json") jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentInlineDocumentInput(input, jsonEncoder.Value); err != nil { + if err := awsRestjson1_serializeDocumentJsonBlobsInput(input, jsonEncoder.Value); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -2090,7 +2115,7 @@ func (m *awsRestjson1_serializeOpInlineDocument) HandleSerialize(ctx context.Con return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsInlineDocumentInput(v *InlineDocumentInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsJsonBlobsInput(v *JsonBlobsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -2098,33 +2123,26 @@ func awsRestjson1_serializeHttpBindingsInlineDocumentInput(v *InlineDocumentInpu return nil } -func awsRestjson1_serializeDocumentInlineDocumentInput(v *InlineDocumentInput, value smithyjson.Value) error { +func awsRestjson1_serializeDocumentJsonBlobsInput(v *JsonBlobsInput, value smithyjson.Value) error { object := value.Object() defer object.Close() - if v.DocumentValue != nil { - ok := object.Key("documentValue") - if err := awsRestjson1_serializeDocumentDocument(v.DocumentValue, ok); err != nil { - return err - } - } - - if v.StringValue != nil { - ok := object.Key("stringValue") - ok.String(*v.StringValue) + if v.Data != nil { + ok := object.Key("data") + ok.Base64EncodeBytes(v.Data) } return nil } -type awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath struct { +type awsRestjson1_serializeOpConstantQueryString struct { } -func (*awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath) ID() string { +func (*awsRestjson1_serializeOpConstantQueryString) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpConstantQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2132,13 +2150,13 @@ func (m *awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath) HandleSeriali return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpRequestWithGreedyLabelInPathInput) + input, ok := in.Parameters.(*ConstantQueryStringInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}") + opPath, opQuery := httpbinding.SplitURI("/ConstantQueryString/{hello}?foo=bar&hello") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2152,7 +2170,7 @@ func (m *awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath) HandleSeriali return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsConstantQueryStringInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -2163,19 +2181,13 @@ func (m *awsRestjson1_serializeOpHttpRequestWithGreedyLabelInPath) HandleSeriali return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(v *HttpRequestWithGreedyLabelInPathInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsConstantQueryStringInput(v *ConstantQueryStringInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Baz != nil { - if err := encoder.SetURI("baz").String(*v.Baz); err != nil { - return err - } - } - - if v.Foo != nil { - if err := encoder.SetURI("foo").String(*v.Foo); err != nil { + if v.Hello != nil { + if err := encoder.SetURI("hello").String(*v.Hello); err != nil { return err } } @@ -2183,14 +2195,14 @@ func awsRestjson1_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(v * return nil } -type awsRestjson1_serializeOpHttpPrefixHeaders struct { +type awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType struct { } -func (*awsRestjson1_serializeOpHttpPrefixHeaders) ID() string { +func (*awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2198,13 +2210,13 @@ func (m *awsRestjson1_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context. return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPrefixHeadersInput) + input, ok := in.Parameters.(*HttpPayloadTraitsWithMediaTypeInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPrefixHeaders") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraitsWithMediaType") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2212,16 +2224,27 @@ func (m *awsRestjson1_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context. request.URL.RawQuery = opQuery } - request.Method = "GET" + 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 err := awsRestjson1_serializeHttpBindingsHttpPrefixHeadersInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if input.Blob != nil { + if !restEncoder.HasHeader("Content-Type") { + restEncoder.SetHeader("Content-Type").String("text/plain") + } + + payload := bytes.NewReader(input.Blob) + if request, err = request.SetStream(payload); 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} } @@ -2229,7 +2252,7 @@ func (m *awsRestjson1_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context. return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsHttpPrefixHeadersInput(v *HttpPrefixHeadersInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(v *HttpPayloadTraitsWithMediaTypeInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -2240,26 +2263,17 @@ func awsRestjson1_serializeHttpBindingsHttpPrefixHeadersInput(v *HttpPrefixHeade } } - if v.FooMap != nil { - hv := encoder.Headers("X-Foo-") - for mapKey, mapVal := range v.FooMap { - if mapVal != nil && len(*mapVal) > 0 { - hv.AddHeader(mapKey).String(*mapVal) - } - } - } - return nil } -type awsRestjson1_serializeOpNullAndEmptyHeadersServer struct { +type awsRestjson1_serializeOpJsonMaps struct { } -func (*awsRestjson1_serializeOpNullAndEmptyHeadersServer) ID() string { +func (*awsRestjson1_serializeOpJsonMaps) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpJsonMaps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2267,13 +2281,13 @@ func (m *awsRestjson1_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NullAndEmptyHeadersServerInput) + input, ok := in.Parameters.(*JsonMapsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersServer") + opPath, opQuery := httpbinding.SplitURI("/JsonMaps") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2281,13 +2295,20 @@ func (m *awsRestjson1_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx request.URL.RawQuery = opQuery } - request.Method = "GET" + 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 err := awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersServerInput(input, restEncoder); err != nil { + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentJsonMapsInput(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} } @@ -2298,42 +2319,36 @@ func (m *awsRestjson1_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsNullAndEmptyHeadersServerInput(v *NullAndEmptyHeadersServerInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsJsonMapsInput(v *JsonMapsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.A != nil { - if len(*v.A) > 0 { - encoder.SetHeader("X-A").String(*v.A) - } - } + return nil +} - if v.B != nil { - if len(*v.B) > 0 { - encoder.SetHeader("X-B").String(*v.B) - } - } +func awsRestjson1_serializeDocumentJsonMapsInput(v *JsonMapsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() - if v.C != nil { - for i := range v.C { - if v.C[i] != nil && len(*v.C[i]) > 0 { - encoder.AddHeader("X-C").String(*v.C[i]) - } + if v.MyMap != nil { + ok := object.Key("myMap") + if err := awsRestjson1_serializeDocumentJsonMapsInputOutputMap(v.MyMap, ok); err != nil { + return err } } return nil } -type awsRestjson1_serializeOpHttpPayloadWithStructure struct { +type awsRestjson1_serializeOpNoInputAndNoOutput struct { } -func (*awsRestjson1_serializeOpHttpPayloadWithStructure) ID() string { +func (*awsRestjson1_serializeOpNoInputAndNoOutput) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2341,13 +2356,13 @@ func (m *awsRestjson1_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx c return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadWithStructureInput) + input, ok := in.Parameters.(*NoInputAndNoOutputInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithStructure") + opPath, opQuery := httpbinding.SplitURI("/NoInputAndNoOutput") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2355,27 +2370,12 @@ func (m *awsRestjson1_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx c request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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 input.Nested != nil { - if !restEncoder.HasHeader("Content-Type") { - restEncoder.SetHeader("Content-Type").String("application/json") - } - - jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentNestedPayload(input.Nested, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - payload := bytes.NewReader(jsonEncoder.Bytes()) - if request, err = request.SetStream(payload); 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} } @@ -2383,7 +2383,7 @@ func (m *awsRestjson1_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx c return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsHttpPayloadWithStructureInput(v *HttpPayloadWithStructureInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsNoInputAndNoOutputInput(v *NoInputAndNoOutputInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } diff --git a/internal/protocoltest/ec2query/api_op_EmptyInputAndEmptyOutput.go b/internal/protocoltest/ec2query/api_op_EmptyInputAndEmptyOutput.go index 4d48ac86005..e1d47cb7fb6 100644 --- a/internal/protocoltest/ec2query/api_op_EmptyInputAndEmptyOutput.go +++ b/internal/protocoltest/ec2query/api_op_EmptyInputAndEmptyOutput.go @@ -20,6 +20,7 @@ func (c *Client) EmptyInputAndEmptyOutput(ctx context.Context, params *EmptyInpu fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_GreetingWithErrors.go b/internal/protocoltest/ec2query/api_op_GreetingWithErrors.go index c764c169c8a..04becfb90fe 100644 --- a/internal/protocoltest/ec2query/api_op_GreetingWithErrors.go +++ b/internal/protocoltest/ec2query/api_op_GreetingWithErrors.go @@ -26,6 +26,7 @@ func (c *Client) GreetingWithErrors(ctx context.Context, params *GreetingWithErr fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_IgnoresWrappingXmlName.go b/internal/protocoltest/ec2query/api_op_IgnoresWrappingXmlName.go index 7144b22a4b9..5475fc0f050 100644 --- a/internal/protocoltest/ec2query/api_op_IgnoresWrappingXmlName.go +++ b/internal/protocoltest/ec2query/api_op_IgnoresWrappingXmlName.go @@ -19,6 +19,7 @@ func (c *Client) IgnoresWrappingXmlName(ctx context.Context, params *IgnoresWrap fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_NestedStructures.go b/internal/protocoltest/ec2query/api_op_NestedStructures.go index b60c13eab77..f114937ebc3 100644 --- a/internal/protocoltest/ec2query/api_op_NestedStructures.go +++ b/internal/protocoltest/ec2query/api_op_NestedStructures.go @@ -19,6 +19,7 @@ func (c *Client) NestedStructures(ctx context.Context, params *NestedStructuresI fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_NoInputAndOutput.go b/internal/protocoltest/ec2query/api_op_NoInputAndOutput.go index 152e029ccf8..7526a660306 100644 --- a/internal/protocoltest/ec2query/api_op_NoInputAndOutput.go +++ b/internal/protocoltest/ec2query/api_op_NoInputAndOutput.go @@ -20,6 +20,7 @@ func (c *Client) NoInputAndOutput(ctx context.Context, params *NoInputAndOutputI fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_QueryIdempotencyTokenAutoFill.go b/internal/protocoltest/ec2query/api_op_QueryIdempotencyTokenAutoFill.go index 81899032006..449c3f113e0 100644 --- a/internal/protocoltest/ec2query/api_op_QueryIdempotencyTokenAutoFill.go +++ b/internal/protocoltest/ec2query/api_op_QueryIdempotencyTokenAutoFill.go @@ -19,6 +19,7 @@ func (c *Client) QueryIdempotencyTokenAutoFill(ctx context.Context, params *Quer fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_QueryLists.go b/internal/protocoltest/ec2query/api_op_QueryLists.go index 08e2df66304..b431031f438 100644 --- a/internal/protocoltest/ec2query/api_op_QueryLists.go +++ b/internal/protocoltest/ec2query/api_op_QueryLists.go @@ -19,6 +19,7 @@ func (c *Client) QueryLists(ctx context.Context, params *QueryListsInput, optFns fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_QueryTimestamps.go b/internal/protocoltest/ec2query/api_op_QueryTimestamps.go index 252f9ad65f2..9555d69f223 100644 --- a/internal/protocoltest/ec2query/api_op_QueryTimestamps.go +++ b/internal/protocoltest/ec2query/api_op_QueryTimestamps.go @@ -28,6 +28,7 @@ func (c *Client) QueryTimestamps(ctx context.Context, params *QueryTimestampsInp fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_RecursiveXmlShapes.go b/internal/protocoltest/ec2query/api_op_RecursiveXmlShapes.go index b6f772e6a40..be44cfd4441 100644 --- a/internal/protocoltest/ec2query/api_op_RecursiveXmlShapes.go +++ b/internal/protocoltest/ec2query/api_op_RecursiveXmlShapes.go @@ -19,6 +19,7 @@ func (c *Client) RecursiveXmlShapes(ctx context.Context, params *RecursiveXmlSha fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_SimpleInputParams.go b/internal/protocoltest/ec2query/api_op_SimpleInputParams.go index 908aa1120bd..b479f38c051 100644 --- a/internal/protocoltest/ec2query/api_op_SimpleInputParams.go +++ b/internal/protocoltest/ec2query/api_op_SimpleInputParams.go @@ -19,6 +19,7 @@ func (c *Client) SimpleInputParams(ctx context.Context, params *SimpleInputParam fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_SimpleScalarXmlProperties.go b/internal/protocoltest/ec2query/api_op_SimpleScalarXmlProperties.go index 8c5b52a7590..a88656052cc 100644 --- a/internal/protocoltest/ec2query/api_op_SimpleScalarXmlProperties.go +++ b/internal/protocoltest/ec2query/api_op_SimpleScalarXmlProperties.go @@ -17,6 +17,7 @@ func (c *Client) SimpleScalarXmlProperties(ctx context.Context, params *SimpleSc fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_XmlBlobs.go b/internal/protocoltest/ec2query/api_op_XmlBlobs.go index 3928c12ec5c..a8909a5419f 100644 --- a/internal/protocoltest/ec2query/api_op_XmlBlobs.go +++ b/internal/protocoltest/ec2query/api_op_XmlBlobs.go @@ -18,6 +18,7 @@ func (c *Client) XmlBlobs(ctx context.Context, params *XmlBlobsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_XmlEnums.go b/internal/protocoltest/ec2query/api_op_XmlEnums.go index 066a3bc5ac3..af0bc361be5 100644 --- a/internal/protocoltest/ec2query/api_op_XmlEnums.go +++ b/internal/protocoltest/ec2query/api_op_XmlEnums.go @@ -19,6 +19,7 @@ func (c *Client) XmlEnums(ctx context.Context, params *XmlEnumsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_XmlLists.go b/internal/protocoltest/ec2query/api_op_XmlLists.go index 6e58a88e5e0..88b928bffc8 100644 --- a/internal/protocoltest/ec2query/api_op_XmlLists.go +++ b/internal/protocoltest/ec2query/api_op_XmlLists.go @@ -37,6 +37,7 @@ func (c *Client) XmlLists(ctx context.Context, params *XmlListsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_XmlNamespaces.go b/internal/protocoltest/ec2query/api_op_XmlNamespaces.go index 746dcf9267c..ff1177e305d 100644 --- a/internal/protocoltest/ec2query/api_op_XmlNamespaces.go +++ b/internal/protocoltest/ec2query/api_op_XmlNamespaces.go @@ -18,6 +18,7 @@ func (c *Client) XmlNamespaces(ctx context.Context, params *XmlNamespacesInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/api_op_XmlTimestamps.go b/internal/protocoltest/ec2query/api_op_XmlTimestamps.go index bfa1c56b7a9..83c014e5646 100644 --- a/internal/protocoltest/ec2query/api_op_XmlTimestamps.go +++ b/internal/protocoltest/ec2query/api_op_XmlTimestamps.go @@ -20,6 +20,7 @@ func (c *Client) XmlTimestamps(ctx context.Context, params *XmlTimestampsInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/ec2query/go.mod b/internal/protocoltest/ec2query/go.mod index c6a49bcdfa1..c139b2900be 100644 --- a/internal/protocoltest/ec2query/go.mod +++ b/internal/protocoltest/ec2query/go.mod @@ -4,5 +4,5 @@ go 1.14 require ( github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03 - github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13 + github.com/awslabs/smithy-go v0.0.0-20200715183807-623301001f0d ) diff --git a/internal/protocoltest/jsonrpc/api_op_EmptyOperation.go b/internal/protocoltest/jsonrpc/api_op_EmptyOperation.go index 1147788f930..44246892708 100644 --- a/internal/protocoltest/jsonrpc/api_op_EmptyOperation.go +++ b/internal/protocoltest/jsonrpc/api_op_EmptyOperation.go @@ -18,6 +18,7 @@ func (c *Client) EmptyOperation(ctx context.Context, params *EmptyOperationInput fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go b/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go index 6edf66ff440..3624ce0cf14 100644 --- a/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_EmptyOperation_test.go @@ -58,6 +58,9 @@ func TestClient_EmptyOperation_awsAwsjson11Serialize(t *testing.T) { 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) @@ -70,7 +73,6 @@ func TestClient_EmptyOperation_awsAwsjson11Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -159,7 +161,6 @@ func TestClient_EmptyOperation_awsAwsjson11Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors.go b/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors.go index 59728386ddc..c40be28da7a 100644 --- a/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors.go +++ b/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors.go @@ -30,6 +30,7 @@ func (c *Client) GreetingWithErrors(ctx context.Context, params *GreetingWithErr fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors_test.go b/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors_test.go index c752b32d47b..df437549a43 100644 --- a/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors_test.go +++ b/internal/protocoltest/jsonrpc/api_op_GreetingWithErrors_test.go @@ -64,7 +64,6 @@ func TestClient_GreetingWithErrors_InvalidGreeting_awsAwsjson11Deserialize(t *te client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -170,7 +169,6 @@ func TestClient_GreetingWithErrors_ComplexError_awsAwsjson11Deserialize(t *testi client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -363,7 +361,6 @@ func TestClient_GreetingWithErrors_FooError_awsAwsjson11Deserialize(t *testing.T client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/jsonrpc/api_op_JsonEnums.go b/internal/protocoltest/jsonrpc/api_op_JsonEnums.go index 8c51cec4a88..196407f0af7 100644 --- a/internal/protocoltest/jsonrpc/api_op_JsonEnums.go +++ b/internal/protocoltest/jsonrpc/api_op_JsonEnums.go @@ -20,6 +20,7 @@ func (c *Client) JsonEnums(ctx context.Context, params *JsonEnumsInput, optFns . fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go b/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go index d81300ac973..79500677ffe 100644 --- a/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go +++ b/internal/protocoltest/jsonrpc/api_op_JsonEnums_test.go @@ -54,6 +54,9 @@ func TestClient_JsonEnums_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ @@ -84,6 +87,9 @@ func TestClient_JsonEnums_awsAwsjson11Serialize(t *testing.T) { 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) @@ -96,7 +102,6 @@ func TestClient_JsonEnums_awsAwsjson11Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -151,7 +156,10 @@ func TestClient_JsonEnums_awsAwsjson11Deserialize(t *testing.T) { }{ // Serializes simple scalar properties "AwsJson11Enums": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{ "fooEnum1": "Foo", @@ -214,7 +222,6 @@ func TestClient_JsonEnums_awsAwsjson11Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation.go b/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation.go index 58068148b08..662659ea1db 100644 --- a/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation.go +++ b/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation.go @@ -20,6 +20,7 @@ func (c *Client) KitchenSinkOperation(ctx context.Context, params *KitchenSinkOp fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go b/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go index ccc225e52c8..a53ce0b7878 100644 --- a/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_KitchenSinkOperation_test.go @@ -42,6 +42,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"String":"abc xyz"}`)) @@ -55,6 +61,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"JsonValue":"{\"string\":\"value\",\"number\":1234.5,\"boolTrue\":true,\"boolFalse\":false,\"array\":[1,2,3,4],\"object\":{\"key\":\"value\"},\"null\":null}"}`)) @@ -68,6 +80,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Integer":1234}`)) @@ -81,6 +99,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Long":999999999999}`)) @@ -94,6 +118,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Float":1234.5}`)) @@ -107,6 +137,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Double":1234.5}`)) @@ -120,6 +156,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Blob":"YmluYXJ5LXZhbHVl"}`)) @@ -133,6 +175,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Boolean":true}`)) @@ -146,6 +194,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Boolean":false}`)) @@ -159,6 +213,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Timestamp":946845296}`)) @@ -172,6 +232,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"Iso8601Timestamp":"2000-01-02T20:34:56Z"}`)) @@ -185,6 +251,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"HttpdateTimestamp":"Sun, 02 Jan 2000 20:34:56 GMT"}`)) @@ -198,6 +270,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"UnixTimestamp":946845296}`)) @@ -215,6 +293,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"ListOfStrings":["abc","mno","xyz"]}`)) @@ -228,6 +312,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"ListOfStrings":[]}`)) @@ -251,6 +341,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"ListOfMapsOfStrings":[{"foo":"bar"},{"abc":"xyz"},{"red":"blue"}]}`)) @@ -274,6 +370,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"ListOfStructs":[{"Value":"abc"},{"Value":"mno"},{"Value":"xyz"}]}`)) @@ -299,6 +401,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"RecursiveList":[{"RecursiveList":[{"RecursiveList":[{"Integer":123}]}]}]}`)) @@ -315,6 +423,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"MapOfStrings":{"abc":"xyz","mno":"hjk"}}`)) @@ -328,6 +442,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"MapOfStrings":{}}`)) @@ -350,6 +470,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"MapOfListsOfStrings":{"abc":["abc","xyz"],"mno":["xyz","abc"]}}`)) @@ -370,6 +496,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"MapOfStructs":{"key1":{"Value":"value-1"},"key2":{"Value":"value-2"}}}`)) @@ -395,6 +527,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"RecursiveMap":{"key1":{"RecursiveMap":{"key2":{"RecursiveMap":{"key3":{"Boolean":false}}}}}}}`)) @@ -410,6 +548,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"SimpleStruct":{"Value":"abc"}}`)) @@ -425,6 +569,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"StructWithLocationName":{"RenamedMember":"some-value"}}`)) @@ -438,6 +588,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"SimpleStruct":{}}`)) @@ -451,6 +607,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"EmptyStruct":{}}`)) @@ -482,6 +644,12 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{"String":"top-value","Boolean":false,"RecursiveStruct":{"String":"nested-value","Boolean":true,"RecursiveList":[{"String":"string-only"},{"RecursiveStruct":{"MapOfStrings":{"color":"red","size":"large"}}}]}}`)) @@ -496,6 +664,9 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { 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) @@ -508,7 +679,6 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -563,14 +733,20 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }{ // Parses operations with empty JSON bodies "parses_operations_with_empty_json_bodies": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{}`), ExpectResult: &KitchenSinkOperationOutput{}, }, // Parses string shapes "parses_string_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"String":"string-value"}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -579,7 +755,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses integer shapes "parses_integer_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Integer":1234}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -588,7 +767,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses long shapes "parses_long_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Long":1234567890123456789}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -597,7 +779,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses float shapes "parses_float_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Float":1234.5}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -606,7 +791,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses double shapes "parses_double_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Double":123456789.12345679}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -615,7 +803,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses boolean shapes (true) "parses_boolean_shapes_true": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Boolean":true}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -624,7 +815,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses boolean (false) "parses_boolean_false": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Boolean":false}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -633,7 +827,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses blob shapes "parses_blob_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Blob":"YmluYXJ5LXZhbHVl"}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -642,7 +839,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses timestamp shapes "parses_timestamp_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Timestamp":946845296}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -651,7 +851,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses iso8601 timestamps "parses_iso8601_timestamps": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"Iso8601Timestamp":"2000-01-02T20:34:56.000Z"}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -660,7 +863,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses httpdate timestamps "parses_httpdate_timestamps": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"HttpdateTimestamp":"Sun, 02 Jan 2000 20:34:56.000 GMT"}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -669,7 +875,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses list shapes "parses_list_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"ListOfStrings":["abc","mno","xyz"]}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -682,7 +891,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses list of map shapes "parses_list_of_map_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"ListOfMapsOfStrings":[{"size":"large"},{"color":"red"}]}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -698,7 +910,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses list of list shapes "parses_list_of_list_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"ListOfLists":[["abc","mno","xyz"],["hjk","qrs","tuv"]]}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -718,7 +933,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses list of structure shapes "parses_list_of_structure_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"ListOfStructs":[{"Value":"value-1"},{"Value":"value-2"}]}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -734,7 +952,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses list of recursive structure shapes "parses_list_of_recursive_structure_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"RecursiveList":[{"RecursiveList":[{"RecursiveList":[{"String":"value"}]}]}]}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -755,7 +976,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses map shapes "parses_map_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"MapOfStrings":{"size":"large","color":"red"}}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -767,7 +991,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses map of list shapes "parses_map_of_list_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"MapOfListsOfStrings":{"sizes":["large","small"],"colors":["red","green"]}}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -785,7 +1012,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses map of map shapes "parses_map_of_map_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"MapOfMaps":{"sizes":{"large":"L","medium":"M"},"colors":{"red":"R","blue":"B"}}}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -803,7 +1033,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses map of structure shapes "parses_map_of_structure_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"MapOfStructs":{"size":{"Value":"small"},"color":{"Value":"red"}}}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -819,7 +1052,10 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Parses map of recursive structure shapes "parses_map_of_recursive_structure_shapes": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{"RecursiveMap":{"key-1":{"RecursiveMap":{"key-2":{"RecursiveMap":{"key-3":{"String":"value"}}}}}}}`), ExpectResult: &KitchenSinkOperationOutput{ @@ -842,6 +1078,7 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { "parses_the_request_id_from_the_response": { StatusCode: 200, Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, "X-Amzn-Requestid": []string{"amazon-uniq-request-id"}, }, BodyMediaType: "application/json", @@ -874,7 +1111,6 @@ func TestClient_KitchenSinkOperation_awsAwsjson11Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/jsonrpc/api_op_NullOperation.go b/internal/protocoltest/jsonrpc/api_op_NullOperation.go index 93f05b1486b..9f0b7b73433 100644 --- a/internal/protocoltest/jsonrpc/api_op_NullOperation.go +++ b/internal/protocoltest/jsonrpc/api_op_NullOperation.go @@ -18,6 +18,7 @@ func (c *Client) NullOperation(ctx context.Context, params *NullOperationInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go b/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go index 5ec0b7d1b61..b4fc47aaff3 100644 --- a/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go +++ b/internal/protocoltest/jsonrpc/api_op_NullOperation_test.go @@ -39,6 +39,9 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{}`)) @@ -54,6 +57,9 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ @@ -73,6 +79,9 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { ExpectMethod: "POST", ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, + ExpectHeader: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareJSONReaderBytes(actual, []byte(`{ @@ -91,6 +100,9 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { 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) @@ -103,7 +115,6 @@ func TestClient_NullOperation_awsAwsjson11Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -158,7 +169,10 @@ func TestClient_NullOperation_awsAwsjson11Deserialize(t *testing.T) { }{ // Null structure values are dropped "AwsJson11StructuresDontDeserializeNullValues": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{ "string": null @@ -167,7 +181,10 @@ func TestClient_NullOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Deserializes null values in maps "AwsJson11MapsDeserializeNullValues": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{ "stringMap": { @@ -182,7 +199,10 @@ func TestClient_NullOperation_awsAwsjson11Deserialize(t *testing.T) { }, // Deserializes null values in lists "AwsJson11ListsDeserializeNull": { - StatusCode: 200, + StatusCode: 200, + Header: http.Header{ + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, BodyMediaType: "application/json", Body: []byte(`{ "stringList": [ @@ -221,7 +241,6 @@ func TestClient_NullOperation_awsAwsjson11Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput.go b/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput.go index 0e8ff209f6c..c18c6f3ed07 100644 --- a/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput.go +++ b/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput.go @@ -18,6 +18,7 @@ func (c *Client) OperationWithOptionalInputOutput(ctx context.Context, params *O fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput_test.go b/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput_test.go index ba28cef3231..f7a7dc28f7b 100644 --- a/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput_test.go +++ b/internal/protocoltest/jsonrpc/api_op_OperationWithOptionalInputOutput_test.go @@ -12,6 +12,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -70,6 +71,9 @@ func TestClient_OperationWithOptionalInputOutput_awsAwsjson11Serialize(t *testin 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) @@ -82,7 +86,6 @@ func TestClient_OperationWithOptionalInputOutput_awsAwsjson11Serialize(t *testin client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments.go b/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments.go index f751b0dbeee..12eab0b708d 100644 --- a/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments.go +++ b/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments.go @@ -19,6 +19,7 @@ func (c *Client) PutAndGetInlineDocuments(ctx context.Context, params *PutAndGet fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go b/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go index 85124db8158..18ef257249b 100644 --- a/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go +++ b/internal/protocoltest/jsonrpc/api_op_PutAndGetInlineDocuments_test.go @@ -40,7 +40,10 @@ func TestClient_PutAndGetInlineDocuments_awsAwsjson11Serialize(t *testing.T) { ExpectURIPath: "/", ExpectQuery: []smithytesting.QueryItem{}, ExpectHeader: http.Header{ - "Content-Type": []string{"application/json"}, + "Content-Type": []string{"application/x-amz-json-1.1"}, + }, + RequireHeader: []string{ + "Content-Length", }, BodyMediaType: "application/json", BodyAssert: func(actual io.Reader) error { @@ -58,6 +61,9 @@ func TestClient_PutAndGetInlineDocuments_awsAwsjson11Serialize(t *testing.T) { 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) @@ -70,7 +76,6 @@ func TestClient_PutAndGetInlineDocuments_awsAwsjson11Serialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -127,7 +132,7 @@ func TestClient_PutAndGetInlineDocuments_awsAwsjson11Deserialize(t *testing.T) { "PutAndGetInlineDocumentsInput": { StatusCode: 200, Header: http.Header{ - "Content-Type": []string{"application/json"}, + "Content-Type": []string{"application/x-amz-json-1.1"}, }, BodyMediaType: "application/json", Body: []byte(`{ @@ -163,7 +168,6 @@ func TestClient_PutAndGetInlineDocuments_awsAwsjson11Deserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/jsonrpc/go.mod b/internal/protocoltest/jsonrpc/go.mod index fdb35f93897..38e3530d7e0 100644 --- a/internal/protocoltest/jsonrpc/go.mod +++ b/internal/protocoltest/jsonrpc/go.mod @@ -4,6 +4,6 @@ go 1.14 require ( github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03 - github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13 + github.com/awslabs/smithy-go v0.0.0-20200715183807-623301001f0d github.com/google/go-cmp v0.4.1 ) diff --git a/internal/protocoltest/jsonrpc/go.sum b/internal/protocoltest/jsonrpc/go.sum deleted file mode 100644 index 4a8c58f201d..00000000000 --- a/internal/protocoltest/jsonrpc/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03 h1:2bzIzRfORaOqta8Sgj5ZA5onx5dOZ1OEFBzNO0fAWWI= -github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03/go.mod h1:4pVqQk1zf8gdDZt6lzN4pC8UdJFERj5St6QeWx+BK0Q= -github.com/awslabs/smithy-go v0.0.0-20200626165807-d2e64072bf43/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI= -github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13 h1:YfjQNH1IJhR1SLM1Mme/7G5i1hHMNsJFBjY9nPsbAcg= -github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13/go.mod h1:hPOQwnmBLHsUphH13tVSjQhTAFma0/0XoZGbBcOuABI= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/google/go-cmp v0.4.1 h1:/exdXoGamhu5ONeUJH0deniYLWYvQwW66yvlfiiKTu0= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/protocoltest/query/api_op_EmptyInputAndEmptyOutput.go b/internal/protocoltest/query/api_op_EmptyInputAndEmptyOutput.go index 0777f1f68fd..56759a904a3 100644 --- a/internal/protocoltest/query/api_op_EmptyInputAndEmptyOutput.go +++ b/internal/protocoltest/query/api_op_EmptyInputAndEmptyOutput.go @@ -20,6 +20,7 @@ func (c *Client) EmptyInputAndEmptyOutput(ctx context.Context, params *EmptyInpu fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_FlattenedXmlMap.go b/internal/protocoltest/query/api_op_FlattenedXmlMap.go index 649018f7f1e..8ee099ffafc 100644 --- a/internal/protocoltest/query/api_op_FlattenedXmlMap.go +++ b/internal/protocoltest/query/api_op_FlattenedXmlMap.go @@ -19,6 +19,7 @@ func (c *Client) FlattenedXmlMap(ctx context.Context, params *FlattenedXmlMapInp fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_FlattenedXmlMapWithXmlName.go b/internal/protocoltest/query/api_op_FlattenedXmlMapWithXmlName.go index 57d16d64ace..50f8bfce08f 100644 --- a/internal/protocoltest/query/api_op_FlattenedXmlMapWithXmlName.go +++ b/internal/protocoltest/query/api_op_FlattenedXmlMapWithXmlName.go @@ -18,6 +18,7 @@ func (c *Client) FlattenedXmlMapWithXmlName(ctx context.Context, params *Flatten fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_GreetingWithErrors.go b/internal/protocoltest/query/api_op_GreetingWithErrors.go index 8a2d4922e0b..1a913b02bfa 100644 --- a/internal/protocoltest/query/api_op_GreetingWithErrors.go +++ b/internal/protocoltest/query/api_op_GreetingWithErrors.go @@ -26,6 +26,7 @@ func (c *Client) GreetingWithErrors(ctx context.Context, params *GreetingWithErr fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_IgnoresWrappingXmlName.go b/internal/protocoltest/query/api_op_IgnoresWrappingXmlName.go index 6a7f0c3c22a..2485c5b0dde 100644 --- a/internal/protocoltest/query/api_op_IgnoresWrappingXmlName.go +++ b/internal/protocoltest/query/api_op_IgnoresWrappingXmlName.go @@ -20,6 +20,7 @@ func (c *Client) IgnoresWrappingXmlName(ctx context.Context, params *IgnoresWrap fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_NestedStructures.go b/internal/protocoltest/query/api_op_NestedStructures.go index f034fd6c1f8..122530f147e 100644 --- a/internal/protocoltest/query/api_op_NestedStructures.go +++ b/internal/protocoltest/query/api_op_NestedStructures.go @@ -19,6 +19,7 @@ func (c *Client) NestedStructures(ctx context.Context, params *NestedStructuresI fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_NoInputAndNoOutput.go b/internal/protocoltest/query/api_op_NoInputAndNoOutput.go index f336e63b3eb..e902a3c54fe 100644 --- a/internal/protocoltest/query/api_op_NoInputAndNoOutput.go +++ b/internal/protocoltest/query/api_op_NoInputAndNoOutput.go @@ -20,6 +20,7 @@ func (c *Client) NoInputAndNoOutput(ctx context.Context, params *NoInputAndNoOut fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_NoInputAndOutput.go b/internal/protocoltest/query/api_op_NoInputAndOutput.go index 0a03cdcd93d..2fc48b2be18 100644 --- a/internal/protocoltest/query/api_op_NoInputAndOutput.go +++ b/internal/protocoltest/query/api_op_NoInputAndOutput.go @@ -20,6 +20,7 @@ func (c *Client) NoInputAndOutput(ctx context.Context, params *NoInputAndOutputI fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_QueryIdempotencyTokenAutoFill.go b/internal/protocoltest/query/api_op_QueryIdempotencyTokenAutoFill.go index cd79d519b64..d1629fbbaec 100644 --- a/internal/protocoltest/query/api_op_QueryIdempotencyTokenAutoFill.go +++ b/internal/protocoltest/query/api_op_QueryIdempotencyTokenAutoFill.go @@ -19,6 +19,7 @@ func (c *Client) QueryIdempotencyTokenAutoFill(ctx context.Context, params *Quer fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_QueryLists.go b/internal/protocoltest/query/api_op_QueryLists.go index d67f9a113dc..baf78939f1d 100644 --- a/internal/protocoltest/query/api_op_QueryLists.go +++ b/internal/protocoltest/query/api_op_QueryLists.go @@ -19,6 +19,7 @@ func (c *Client) QueryLists(ctx context.Context, params *QueryListsInput, optFns fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_QueryMaps.go b/internal/protocoltest/query/api_op_QueryMaps.go index 19d46a6f513..906e3ec2f1c 100644 --- a/internal/protocoltest/query/api_op_QueryMaps.go +++ b/internal/protocoltest/query/api_op_QueryMaps.go @@ -19,6 +19,7 @@ func (c *Client) QueryMaps(ctx context.Context, params *QueryMapsInput, optFns . fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_QueryTimestamps.go b/internal/protocoltest/query/api_op_QueryTimestamps.go index 82f6c3513ec..10d70792fca 100644 --- a/internal/protocoltest/query/api_op_QueryTimestamps.go +++ b/internal/protocoltest/query/api_op_QueryTimestamps.go @@ -28,6 +28,7 @@ func (c *Client) QueryTimestamps(ctx context.Context, params *QueryTimestampsInp fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_RecursiveXmlShapes.go b/internal/protocoltest/query/api_op_RecursiveXmlShapes.go index b2fcfd4a245..f6b782e59ab 100644 --- a/internal/protocoltest/query/api_op_RecursiveXmlShapes.go +++ b/internal/protocoltest/query/api_op_RecursiveXmlShapes.go @@ -19,6 +19,7 @@ func (c *Client) RecursiveXmlShapes(ctx context.Context, params *RecursiveXmlSha fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_SimpleInputParams.go b/internal/protocoltest/query/api_op_SimpleInputParams.go index 8caad06c6fd..867fbbc1ceb 100644 --- a/internal/protocoltest/query/api_op_SimpleInputParams.go +++ b/internal/protocoltest/query/api_op_SimpleInputParams.go @@ -19,6 +19,7 @@ func (c *Client) SimpleInputParams(ctx context.Context, params *SimpleInputParam fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_SimpleScalarXmlProperties.go b/internal/protocoltest/query/api_op_SimpleScalarXmlProperties.go index 1e76ac41900..9b1a339cb5c 100644 --- a/internal/protocoltest/query/api_op_SimpleScalarXmlProperties.go +++ b/internal/protocoltest/query/api_op_SimpleScalarXmlProperties.go @@ -17,6 +17,7 @@ func (c *Client) SimpleScalarXmlProperties(ctx context.Context, params *SimpleSc fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_XmlBlobs.go b/internal/protocoltest/query/api_op_XmlBlobs.go index acf71624f46..043030438da 100644 --- a/internal/protocoltest/query/api_op_XmlBlobs.go +++ b/internal/protocoltest/query/api_op_XmlBlobs.go @@ -18,6 +18,7 @@ func (c *Client) XmlBlobs(ctx context.Context, params *XmlBlobsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_XmlEnums.go b/internal/protocoltest/query/api_op_XmlEnums.go index 3f4a1253161..d45ed706143 100644 --- a/internal/protocoltest/query/api_op_XmlEnums.go +++ b/internal/protocoltest/query/api_op_XmlEnums.go @@ -19,6 +19,7 @@ func (c *Client) XmlEnums(ctx context.Context, params *XmlEnumsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_XmlLists.go b/internal/protocoltest/query/api_op_XmlLists.go index 0fa833519f1..8d3fec53741 100644 --- a/internal/protocoltest/query/api_op_XmlLists.go +++ b/internal/protocoltest/query/api_op_XmlLists.go @@ -37,6 +37,7 @@ func (c *Client) XmlLists(ctx context.Context, params *XmlListsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_XmlMaps.go b/internal/protocoltest/query/api_op_XmlMaps.go index 728e3e329b9..4ded0744dbe 100644 --- a/internal/protocoltest/query/api_op_XmlMaps.go +++ b/internal/protocoltest/query/api_op_XmlMaps.go @@ -19,6 +19,7 @@ func (c *Client) XmlMaps(ctx context.Context, params *XmlMapsInput, optFns ...fu fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_XmlMapsXmlName.go b/internal/protocoltest/query/api_op_XmlMapsXmlName.go index 0a98b6989d5..ce293151ddc 100644 --- a/internal/protocoltest/query/api_op_XmlMapsXmlName.go +++ b/internal/protocoltest/query/api_op_XmlMapsXmlName.go @@ -18,6 +18,7 @@ func (c *Client) XmlMapsXmlName(ctx context.Context, params *XmlMapsXmlNameInput fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_XmlNamespaces.go b/internal/protocoltest/query/api_op_XmlNamespaces.go index 17cffe45a7d..83feca078d3 100644 --- a/internal/protocoltest/query/api_op_XmlNamespaces.go +++ b/internal/protocoltest/query/api_op_XmlNamespaces.go @@ -18,6 +18,7 @@ func (c *Client) XmlNamespaces(ctx context.Context, params *XmlNamespacesInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/api_op_XmlTimestamps.go b/internal/protocoltest/query/api_op_XmlTimestamps.go index 865b8094a0f..c85e2ba83a7 100644 --- a/internal/protocoltest/query/api_op_XmlTimestamps.go +++ b/internal/protocoltest/query/api_op_XmlTimestamps.go @@ -20,6 +20,7 @@ func (c *Client) XmlTimestamps(ctx context.Context, params *XmlTimestampsInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/query/go.mod b/internal/protocoltest/query/go.mod index 73c60445452..ab7643558fa 100644 --- a/internal/protocoltest/query/go.mod +++ b/internal/protocoltest/query/go.mod @@ -4,5 +4,5 @@ go 1.14 require ( github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03 - github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13 + github.com/awslabs/smithy-go v0.0.0-20200715183807-623301001f0d ) diff --git a/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go b/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go index 1c1aaace4a3..02a4718fcdb 100644 --- a/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go +++ b/internal/protocoltest/restxml/api_op_AllQueryStringTypes.go @@ -20,6 +20,7 @@ func (c *Client) AllQueryStringTypes(ctx context.Context, params *AllQueryString fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go b/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go index 8d30ee268e7..da08760bbe3 100644 --- a/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go +++ b/internal/protocoltest/restxml/api_op_AllQueryStringTypes_test.go @@ -15,6 +15,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" "time" ) @@ -138,6 +139,9 @@ func TestClient_AllQueryStringTypes_awsRestxmlSerialize(t *testing.T) { 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) @@ -150,7 +154,6 @@ func TestClient_AllQueryStringTypes_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString.go b/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString.go index 9ad58cad832..12cd5c98936 100644 --- a/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString.go +++ b/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString.go @@ -20,6 +20,7 @@ func (c *Client) ConstantAndVariableQueryString(ctx context.Context, params *Con fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString_test.go b/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString_test.go index 9c702f2e042..77d1fe76bb6 100644 --- a/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString_test.go +++ b/internal/protocoltest/restxml/api_op_ConstantAndVariableQueryString_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -74,6 +75,9 @@ func TestClient_ConstantAndVariableQueryString_awsRestxmlSerialize(t *testing.T) 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) @@ -86,7 +90,6 @@ func TestClient_ConstantAndVariableQueryString_awsRestxmlSerialize(t *testing.T) client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_ConstantQueryString.go b/internal/protocoltest/restxml/api_op_ConstantQueryString.go index 70e673e5478..4b9da4b3759 100644 --- a/internal/protocoltest/restxml/api_op_ConstantQueryString.go +++ b/internal/protocoltest/restxml/api_op_ConstantQueryString.go @@ -21,6 +21,7 @@ func (c *Client) ConstantQueryString(ctx context.Context, params *ConstantQueryS fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_ConstantQueryString_test.go b/internal/protocoltest/restxml/api_op_ConstantQueryString_test.go index 4a6d04fd919..505386807c1 100644 --- a/internal/protocoltest/restxml/api_op_ConstantQueryString_test.go +++ b/internal/protocoltest/restxml/api_op_ConstantQueryString_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -54,6 +55,9 @@ func TestClient_ConstantQueryString_awsRestxmlSerialize(t *testing.T) { 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) @@ -66,7 +70,6 @@ func TestClient_ConstantQueryString_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput.go b/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput.go index 28c10157186..3d98f0c61ec 100644 --- a/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput.go +++ b/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput.go @@ -21,6 +21,7 @@ func (c *Client) EmptyInputAndEmptyOutput(ctx context.Context, params *EmptyInpu fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput_test.go b/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput_test.go index ddd8d2fbe8c..af2ecc970b1 100644 --- a/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput_test.go +++ b/internal/protocoltest/restxml/api_op_EmptyInputAndEmptyOutput_test.go @@ -51,6 +51,9 @@ func TestClient_EmptyInputAndEmptyOutput_awsRestxmlSerialize(t *testing.T) { 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) @@ -63,7 +66,6 @@ func TestClient_EmptyInputAndEmptyOutput_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -149,7 +151,6 @@ func TestClient_EmptyInputAndEmptyOutput_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_FlattenedXmlMap.go b/internal/protocoltest/restxml/api_op_FlattenedXmlMap.go index 7d5aaa273c6..95536c4ca31 100644 --- a/internal/protocoltest/restxml/api_op_FlattenedXmlMap.go +++ b/internal/protocoltest/restxml/api_op_FlattenedXmlMap.go @@ -19,6 +19,7 @@ func (c *Client) FlattenedXmlMap(ctx context.Context, params *FlattenedXmlMapInp fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName.go b/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName.go index cac316894d8..39983770cc1 100644 --- a/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName.go +++ b/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName.go @@ -18,6 +18,7 @@ func (c *Client) FlattenedXmlMapWithXmlName(ctx context.Context, params *Flatten fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName_test.go b/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName_test.go index 0f954f988e8..a47f5a0aec9 100644 --- a/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName_test.go +++ b/internal/protocoltest/restxml/api_op_FlattenedXmlMapWithXmlName_test.go @@ -70,6 +70,9 @@ func TestClient_FlattenedXmlMapWithXmlName_awsRestxmlSerialize(t *testing.T) { 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) @@ -82,7 +85,6 @@ func TestClient_FlattenedXmlMapWithXmlName_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -186,7 +188,6 @@ func TestClient_FlattenedXmlMapWithXmlName_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_FlattenedXmlMap_test.go b/internal/protocoltest/restxml/api_op_FlattenedXmlMap_test.go index 1a1223f1de6..1b05ce30776 100644 --- a/internal/protocoltest/restxml/api_op_FlattenedXmlMap_test.go +++ b/internal/protocoltest/restxml/api_op_FlattenedXmlMap_test.go @@ -70,6 +70,9 @@ func TestClient_FlattenedXmlMap_awsRestxmlSerialize(t *testing.T) { 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) @@ -82,7 +85,6 @@ func TestClient_FlattenedXmlMap_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -186,7 +188,6 @@ func TestClient_FlattenedXmlMap_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_GreetingWithErrors.go b/internal/protocoltest/restxml/api_op_GreetingWithErrors.go index 41bd1011cdd..1e4d60504fd 100644 --- a/internal/protocoltest/restxml/api_op_GreetingWithErrors.go +++ b/internal/protocoltest/restxml/api_op_GreetingWithErrors.go @@ -30,6 +30,7 @@ func (c *Client) GreetingWithErrors(ctx context.Context, params *GreetingWithErr fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_GreetingWithErrors_test.go b/internal/protocoltest/restxml/api_op_GreetingWithErrors_test.go index 7583f671951..45466df2009 100644 --- a/internal/protocoltest/restxml/api_op_GreetingWithErrors_test.go +++ b/internal/protocoltest/restxml/api_op_GreetingWithErrors_test.go @@ -66,7 +66,6 @@ func TestClient_GreetingWithErrors_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -150,7 +149,6 @@ func TestClient_GreetingWithErrors_InvalidGreeting_awsRestxmlDeserialize(t *test client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -258,7 +256,6 @@ func TestClient_GreetingWithErrors_ComplexError_awsRestxmlDeserialize(t *testing client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadTraits.go b/internal/protocoltest/restxml/api_op_HttpPayloadTraits.go index f593aaa9947..6c4c23d3295 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadTraits.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadTraits.go @@ -19,6 +19,7 @@ func (c *Client) HttpPayloadTraits(ctx context.Context, params *HttpPayloadTrait fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType.go b/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType.go index 3b4efaabb14..d186486628b 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType.go @@ -19,6 +19,7 @@ func (c *Client) HttpPayloadTraitsWithMediaType(ctx context.Context, params *Htt fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType_test.go b/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType_test.go index e09340dfa4a..d7db005cd5c 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType_test.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadTraitsWithMediaType_test.go @@ -46,6 +46,9 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestxmlSerialize(t *testing.T) "Content-Type": []string{"text/plain"}, "X-Foo": []string{"Foo"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyAssert: func(actual io.Reader) error { return smithytesting.CompareReaderBytes(actual, []byte(`blobby blob blob`)) }, @@ -59,6 +62,9 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestxmlSerialize(t *testing.T) 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) @@ -71,7 +77,6 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestxmlSerialize(t *testing.T) client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -164,7 +169,6 @@ func TestClient_HttpPayloadTraitsWithMediaType_awsRestxmlDeserialize(t *testing. client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadTraits_test.go b/internal/protocoltest/restxml/api_op_HttpPayloadTraits_test.go index da9b8527bda..eb9d9c7c33a 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadTraits_test.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadTraits_test.go @@ -45,6 +45,9 @@ func TestClient_HttpPayloadTraits_awsRestxmlSerialize(t *testing.T) { ExpectHeader: http.Header{ "X-Foo": []string{"Foo"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyAssert: func(actual io.Reader) error { return smithytesting.CompareReaderBytes(actual, []byte(`blobby blob blob`)) }, @@ -73,6 +76,9 @@ func TestClient_HttpPayloadTraits_awsRestxmlSerialize(t *testing.T) { 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) @@ -85,7 +91,6 @@ func TestClient_HttpPayloadTraits_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -188,7 +193,6 @@ func TestClient_HttpPayloadTraits_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure.go index 5230e429d6f..0f05168ff91 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure.go @@ -20,6 +20,7 @@ func (c *Client) HttpPayloadWithStructure(ctx context.Context, params *HttpPaylo fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure_test.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure_test.go index 06c4952f1ad..8c77faf234e 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure_test.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithStructure_test.go @@ -48,6 +48,9 @@ func TestClient_HttpPayloadWithStructure_awsRestxmlSerialize(t *testing.T) { ExpectHeader: http.Header{ "Content-Type": []string{"application/xml"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/xml", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareXMLReaderBytes(actual, []byte(` @@ -66,6 +69,9 @@ func TestClient_HttpPayloadWithStructure_awsRestxmlSerialize(t *testing.T) { 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) @@ -78,7 +84,6 @@ func TestClient_HttpPayloadWithStructure_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -177,7 +182,6 @@ func TestClient_HttpPayloadWithStructure_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName.go index 3327852819d..d2db10924ad 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName.go @@ -20,6 +20,7 @@ func (c *Client) HttpPayloadWithXmlName(ctx context.Context, params *HttpPayload fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName_test.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName_test.go index 47b80480c24..6b7cf458848 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName_test.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlName_test.go @@ -47,6 +47,9 @@ func TestClient_HttpPayloadWithXmlName_awsRestxmlSerialize(t *testing.T) { ExpectHeader: http.Header{ "Content-Type": []string{"application/xml"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/xml", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareXMLReaderBytes(actual, []byte(`Phreddy`)) @@ -61,6 +64,9 @@ func TestClient_HttpPayloadWithXmlName_awsRestxmlSerialize(t *testing.T) { 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) @@ -73,7 +79,6 @@ func TestClient_HttpPayloadWithXmlName_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -167,7 +172,6 @@ func TestClient_HttpPayloadWithXmlName_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace.go index 86dbd12e75d..cdb33d4b982 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace.go @@ -19,6 +19,7 @@ func (c *Client) HttpPayloadWithXmlNamespace(ctx context.Context, params *HttpPa fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix.go index e138c4c3fe7..bad6ef0d0a5 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix.go @@ -19,6 +19,7 @@ func (c *Client) HttpPayloadWithXmlNamespaceAndPrefix(ctx context.Context, param fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix_test.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix_test.go index 709be6d024c..8218334ebee 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix_test.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespaceAndPrefix_test.go @@ -47,6 +47,9 @@ func TestClient_HttpPayloadWithXmlNamespaceAndPrefix_awsRestxmlSerialize(t *test ExpectHeader: http.Header{ "Content-Type": []string{"application/xml"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/xml", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareXMLReaderBytes(actual, []byte(` @@ -63,6 +66,9 @@ func TestClient_HttpPayloadWithXmlNamespaceAndPrefix_awsRestxmlSerialize(t *test 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) @@ -75,7 +81,6 @@ func TestClient_HttpPayloadWithXmlNamespaceAndPrefix_awsRestxmlSerialize(t *test client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -171,7 +176,6 @@ func TestClient_HttpPayloadWithXmlNamespaceAndPrefix_awsRestxmlDeserialize(t *te client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace_test.go b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace_test.go index 881f70102ff..7db65d69f13 100644 --- a/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace_test.go +++ b/internal/protocoltest/restxml/api_op_HttpPayloadWithXmlNamespace_test.go @@ -47,6 +47,9 @@ func TestClient_HttpPayloadWithXmlNamespace_awsRestxmlSerialize(t *testing.T) { ExpectHeader: http.Header{ "Content-Type": []string{"application/xml"}, }, + RequireHeader: []string{ + "Content-Length", + }, BodyMediaType: "application/xml", BodyAssert: func(actual io.Reader) error { return smithytesting.CompareXMLReaderBytes(actual, []byte(` @@ -63,6 +66,9 @@ func TestClient_HttpPayloadWithXmlNamespace_awsRestxmlSerialize(t *testing.T) { 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) @@ -75,7 +81,6 @@ func TestClient_HttpPayloadWithXmlNamespace_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -171,7 +176,6 @@ func TestClient_HttpPayloadWithXmlNamespace_awsRestxmlDeserialize(t *testing.T) client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpPrefixHeaders.go b/internal/protocoltest/restxml/api_op_HttpPrefixHeaders.go index 861dac472f0..d7c6dd1d735 100644 --- a/internal/protocoltest/restxml/api_op_HttpPrefixHeaders.go +++ b/internal/protocoltest/restxml/api_op_HttpPrefixHeaders.go @@ -18,6 +18,7 @@ func (c *Client) HttpPrefixHeaders(ctx context.Context, params *HttpPrefixHeader fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go b/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go index 916c7811c9f..ad347fc095c 100644 --- a/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go +++ b/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go @@ -79,6 +79,9 @@ func TestClient_HttpPrefixHeaders_awsRestxmlSerialize(t *testing.T) { 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) @@ -91,7 +94,6 @@ func TestClient_HttpPrefixHeaders_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -200,7 +202,6 @@ func TestClient_HttpPrefixHeaders_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath.go b/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath.go index 37e6d2a9d87..173b20de1cf 100644 --- a/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath.go +++ b/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath.go @@ -17,6 +17,7 @@ func (c *Client) HttpRequestWithGreedyLabelInPath(ctx context.Context, params *H fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath_test.go b/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath_test.go index e07abc5a7fd..ae955932924 100644 --- a/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath_test.go +++ b/internal/protocoltest/restxml/api_op_HttpRequestWithGreedyLabelInPath_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -52,6 +53,9 @@ func TestClient_HttpRequestWithGreedyLabelInPath_awsRestxmlSerialize(t *testing. 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) @@ -64,7 +68,6 @@ func TestClient_HttpRequestWithGreedyLabelInPath_awsRestxmlSerialize(t *testing. client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpRequestWithLabels.go b/internal/protocoltest/restxml/api_op_HttpRequestWithLabels.go index 76da2802f18..4be20b6dc1e 100644 --- a/internal/protocoltest/restxml/api_op_HttpRequestWithLabels.go +++ b/internal/protocoltest/restxml/api_op_HttpRequestWithLabels.go @@ -20,6 +20,7 @@ func (c *Client) HttpRequestWithLabels(ctx context.Context, params *HttpRequestW fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat.go b/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat.go index c12d68a775c..496afbfbd7b 100644 --- a/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat.go +++ b/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat.go @@ -20,6 +20,7 @@ func (c *Client) HttpRequestWithLabelsAndTimestampFormat(ctx context.Context, pa fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go b/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go index 87a139b7502..8b12bae8025 100644 --- a/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go +++ b/internal/protocoltest/restxml/api_op_HttpRequestWithLabelsAndTimestampFormat_test.go @@ -14,6 +14,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -58,6 +59,9 @@ func TestClient_HttpRequestWithLabelsAndTimestampFormat_awsRestxmlSerialize(t *t 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) @@ -70,7 +74,6 @@ func TestClient_HttpRequestWithLabelsAndTimestampFormat_awsRestxmlSerialize(t *t client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_HttpRequestWithLabels_test.go b/internal/protocoltest/restxml/api_op_HttpRequestWithLabels_test.go index b88640f5de0..f87da81f18f 100644 --- a/internal/protocoltest/restxml/api_op_HttpRequestWithLabels_test.go +++ b/internal/protocoltest/restxml/api_op_HttpRequestWithLabels_test.go @@ -14,6 +14,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -59,6 +60,9 @@ func TestClient_HttpRequestWithLabels_awsRestxmlSerialize(t *testing.T) { 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) @@ -71,7 +75,6 @@ func TestClient_HttpRequestWithLabels_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse.go b/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse.go index 42847685584..b24ae4102d3 100644 --- a/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse.go +++ b/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse.go @@ -20,6 +20,7 @@ func (c *Client) IgnoreQueryParamsInResponse(ctx context.Context, params *Ignore fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse_test.go b/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse_test.go index 63e499b5dea..672660f91cc 100644 --- a/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse_test.go +++ b/internal/protocoltest/restxml/api_op_IgnoreQueryParamsInResponse_test.go @@ -64,7 +64,6 @@ func TestClient_IgnoreQueryParamsInResponse_awsRestxmlDeserialize(t *testing.T) client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders.go b/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders.go index 0593b5fc2bd..f8c07aab47d 100644 --- a/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders.go +++ b/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders.go @@ -21,6 +21,7 @@ func (c *Client) InputAndOutputWithHeaders(ctx context.Context, params *InputAnd fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders_test.go b/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders_test.go index d5521caa035..7752a48caf4 100644 --- a/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders_test.go +++ b/internal/protocoltest/restxml/api_op_InputAndOutputWithHeaders_test.go @@ -165,6 +165,9 @@ func TestClient_InputAndOutputWithHeaders_awsRestxmlSerialize(t *testing.T) { 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) @@ -177,7 +180,6 @@ func TestClient_InputAndOutputWithHeaders_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -357,7 +359,6 @@ func TestClient_InputAndOutputWithHeaders_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_NoInputAndNoOutput.go b/internal/protocoltest/restxml/api_op_NoInputAndNoOutput.go index 434dbefdad2..02c774ae9a7 100644 --- a/internal/protocoltest/restxml/api_op_NoInputAndNoOutput.go +++ b/internal/protocoltest/restxml/api_op_NoInputAndNoOutput.go @@ -20,6 +20,7 @@ func (c *Client) NoInputAndNoOutput(ctx context.Context, params *NoInputAndNoOut fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_NoInputAndNoOutput_test.go b/internal/protocoltest/restxml/api_op_NoInputAndNoOutput_test.go index 3e85732a5ce..ec03ebc798a 100644 --- a/internal/protocoltest/restxml/api_op_NoInputAndNoOutput_test.go +++ b/internal/protocoltest/restxml/api_op_NoInputAndNoOutput_test.go @@ -51,6 +51,9 @@ func TestClient_NoInputAndNoOutput_awsRestxmlSerialize(t *testing.T) { 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) @@ -63,7 +66,6 @@ func TestClient_NoInputAndNoOutput_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -149,7 +151,6 @@ func TestClient_NoInputAndNoOutput_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_NoInputAndOutput.go b/internal/protocoltest/restxml/api_op_NoInputAndOutput.go index be62be46e8b..ccee941693d 100644 --- a/internal/protocoltest/restxml/api_op_NoInputAndOutput.go +++ b/internal/protocoltest/restxml/api_op_NoInputAndOutput.go @@ -20,6 +20,7 @@ func (c *Client) NoInputAndOutput(ctx context.Context, params *NoInputAndOutputI fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_NoInputAndOutput_test.go b/internal/protocoltest/restxml/api_op_NoInputAndOutput_test.go index f341b72c9e4..06a714b21df 100644 --- a/internal/protocoltest/restxml/api_op_NoInputAndOutput_test.go +++ b/internal/protocoltest/restxml/api_op_NoInputAndOutput_test.go @@ -51,6 +51,9 @@ func TestClient_NoInputAndOutput_awsRestxmlSerialize(t *testing.T) { 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) @@ -63,7 +66,6 @@ func TestClient_NoInputAndOutput_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -149,7 +151,6 @@ func TestClient_NoInputAndOutput_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient.go b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient.go index 8fd8c4e0071..2fc2261fd55 100644 --- a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient.go +++ b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient.go @@ -18,6 +18,7 @@ func (c *Client) NullAndEmptyHeadersClient(ctx context.Context, params *NullAndE fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go index 1b978c3d29f..3f5d1680b83 100644 --- a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go +++ b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -58,6 +59,9 @@ func TestClient_NullAndEmptyHeadersClient_awsRestxmlSerialize(t *testing.T) { 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) @@ -70,7 +74,6 @@ func TestClient_NullAndEmptyHeadersClient_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersServer.go b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersServer.go index 7ad35a73547..66c2aa4cadc 100644 --- a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersServer.go +++ b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersServer.go @@ -18,6 +18,7 @@ func (c *Client) NullAndEmptyHeadersServer(ctx context.Context, params *NullAndE fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString.go b/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString.go index f0c8fb87494..7bbaeb3eefd 100644 --- a/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString.go +++ b/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString.go @@ -18,6 +18,7 @@ func (c *Client) OmitsNullSerializesEmptyString(ctx context.Context, params *Omi fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString_test.go b/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString_test.go index f8cfcc1bf59..447a8811691 100644 --- a/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString_test.go +++ b/internal/protocoltest/restxml/api_op_OmitsNullSerializesEmptyString_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -54,6 +55,9 @@ func TestClient_OmitsNullSerializesEmptyString_awsRestxmlSerialize(t *testing.T) 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) @@ -66,7 +70,6 @@ func TestClient_OmitsNullSerializesEmptyString_awsRestxmlSerialize(t *testing.T) client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill.go b/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill.go index fb87c91ba7e..164c25c1de5 100644 --- a/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill.go +++ b/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill.go @@ -19,6 +19,7 @@ func (c *Client) QueryIdempotencyTokenAutoFill(ctx context.Context, params *Quer fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill_test.go b/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill_test.go index 9f3a8c10db0..b6d626f19a6 100644 --- a/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill_test.go +++ b/internal/protocoltest/restxml/api_op_QueryIdempotencyTokenAutoFill_test.go @@ -13,6 +13,7 @@ import ( "io/ioutil" "net/http" "net/http/httptest" + "strconv" "testing" ) @@ -65,6 +66,9 @@ func TestClient_QueryIdempotencyTokenAutoFill_awsRestxmlSerialize(t *testing.T) 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) @@ -77,7 +81,6 @@ func TestClient_QueryIdempotencyTokenAutoFill_awsRestxmlSerialize(t *testing.T) client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_RecursiveShapes.go b/internal/protocoltest/restxml/api_op_RecursiveShapes.go index 554416d959d..6d889bc2ac3 100644 --- a/internal/protocoltest/restxml/api_op_RecursiveShapes.go +++ b/internal/protocoltest/restxml/api_op_RecursiveShapes.go @@ -19,6 +19,7 @@ func (c *Client) RecursiveShapes(ctx context.Context, params *RecursiveShapesInp fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_RecursiveShapes_test.go b/internal/protocoltest/restxml/api_op_RecursiveShapes_test.go index 46672c8f83b..ceb7f54ff98 100644 --- a/internal/protocoltest/restxml/api_op_RecursiveShapes_test.go +++ b/internal/protocoltest/restxml/api_op_RecursiveShapes_test.go @@ -84,6 +84,9 @@ func TestClient_RecursiveShapes_awsRestxmlSerialize(t *testing.T) { 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) @@ -96,7 +99,6 @@ func TestClient_RecursiveShapes_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -213,7 +215,6 @@ func TestClient_RecursiveShapes_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_SimpleScalarProperties.go b/internal/protocoltest/restxml/api_op_SimpleScalarProperties.go index c0d20cdaed3..936ed7e8bdd 100644 --- a/internal/protocoltest/restxml/api_op_SimpleScalarProperties.go +++ b/internal/protocoltest/restxml/api_op_SimpleScalarProperties.go @@ -17,6 +17,7 @@ func (c *Client) SimpleScalarProperties(ctx context.Context, params *SimpleScala fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_SimpleScalarProperties_test.go b/internal/protocoltest/restxml/api_op_SimpleScalarProperties_test.go index 0cf86f486c1..e5bf95283c3 100644 --- a/internal/protocoltest/restxml/api_op_SimpleScalarProperties_test.go +++ b/internal/protocoltest/restxml/api_op_SimpleScalarProperties_test.go @@ -79,6 +79,9 @@ func TestClient_SimpleScalarProperties_awsRestxmlSerialize(t *testing.T) { 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) @@ -91,7 +94,6 @@ func TestClient_SimpleScalarProperties_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -204,7 +206,6 @@ func TestClient_SimpleScalarProperties_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_TimestampFormatHeaders.go b/internal/protocoltest/restxml/api_op_TimestampFormatHeaders.go index 3dd2af92222..81387a3d194 100644 --- a/internal/protocoltest/restxml/api_op_TimestampFormatHeaders.go +++ b/internal/protocoltest/restxml/api_op_TimestampFormatHeaders.go @@ -19,6 +19,7 @@ func (c *Client) TimestampFormatHeaders(ctx context.Context, params *TimestampFo fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_TimestampFormatHeaders_test.go b/internal/protocoltest/restxml/api_op_TimestampFormatHeaders_test.go index 763f2f30bb8..cb62a314545 100644 --- a/internal/protocoltest/restxml/api_op_TimestampFormatHeaders_test.go +++ b/internal/protocoltest/restxml/api_op_TimestampFormatHeaders_test.go @@ -70,6 +70,9 @@ func TestClient_TimestampFormatHeaders_awsRestxmlSerialize(t *testing.T) { 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) @@ -82,7 +85,6 @@ func TestClient_TimestampFormatHeaders_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -185,7 +187,6 @@ func TestClient_TimestampFormatHeaders_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlAttributes.go b/internal/protocoltest/restxml/api_op_XmlAttributes.go index 425e2dd7980..43f7207f50d 100644 --- a/internal/protocoltest/restxml/api_op_XmlAttributes.go +++ b/internal/protocoltest/restxml/api_op_XmlAttributes.go @@ -18,6 +18,7 @@ func (c *Client) XmlAttributes(ctx context.Context, params *XmlAttributesInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload.go b/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload.go index 3fefb5f4586..17b58407d29 100644 --- a/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload.go +++ b/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload.go @@ -19,6 +19,7 @@ func (c *Client) XmlAttributesOnPayload(ctx context.Context, params *XmlAttribut fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload_test.go b/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload_test.go index 1f376fc8209..751b1afc04a 100644 --- a/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload_test.go +++ b/internal/protocoltest/restxml/api_op_XmlAttributesOnPayload_test.go @@ -65,6 +65,9 @@ func TestClient_XmlAttributesOnPayload_awsRestxmlSerialize(t *testing.T) { 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) @@ -77,7 +80,6 @@ func TestClient_XmlAttributesOnPayload_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -175,7 +177,6 @@ func TestClient_XmlAttributesOnPayload_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlAttributes_test.go b/internal/protocoltest/restxml/api_op_XmlAttributes_test.go index 33d45cec0ca..0e3ae09e127 100644 --- a/internal/protocoltest/restxml/api_op_XmlAttributes_test.go +++ b/internal/protocoltest/restxml/api_op_XmlAttributes_test.go @@ -62,6 +62,9 @@ func TestClient_XmlAttributes_awsRestxmlSerialize(t *testing.T) { 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) @@ -74,7 +77,6 @@ func TestClient_XmlAttributes_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -170,7 +172,6 @@ func TestClient_XmlAttributes_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlBlobs.go b/internal/protocoltest/restxml/api_op_XmlBlobs.go index e501654fe50..21dee5ce565 100644 --- a/internal/protocoltest/restxml/api_op_XmlBlobs.go +++ b/internal/protocoltest/restxml/api_op_XmlBlobs.go @@ -18,6 +18,7 @@ func (c *Client) XmlBlobs(ctx context.Context, params *XmlBlobsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlBlobs_test.go b/internal/protocoltest/restxml/api_op_XmlBlobs_test.go index 2343c6a3f80..a37e223cc30 100644 --- a/internal/protocoltest/restxml/api_op_XmlBlobs_test.go +++ b/internal/protocoltest/restxml/api_op_XmlBlobs_test.go @@ -60,6 +60,9 @@ func TestClient_XmlBlobs_awsRestxmlSerialize(t *testing.T) { 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) @@ -72,7 +75,6 @@ func TestClient_XmlBlobs_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -167,7 +169,6 @@ func TestClient_XmlBlobs_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlEnums.go b/internal/protocoltest/restxml/api_op_XmlEnums.go index d0c5edf3dbd..58efb047b08 100644 --- a/internal/protocoltest/restxml/api_op_XmlEnums.go +++ b/internal/protocoltest/restxml/api_op_XmlEnums.go @@ -19,6 +19,7 @@ func (c *Client) XmlEnums(ctx context.Context, params *XmlEnumsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlEnums_test.go b/internal/protocoltest/restxml/api_op_XmlEnums_test.go index 478b1579179..951756cc273 100644 --- a/internal/protocoltest/restxml/api_op_XmlEnums_test.go +++ b/internal/protocoltest/restxml/api_op_XmlEnums_test.go @@ -95,6 +95,9 @@ func TestClient_XmlEnums_awsRestxmlSerialize(t *testing.T) { 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) @@ -107,7 +110,6 @@ func TestClient_XmlEnums_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -236,7 +238,6 @@ func TestClient_XmlEnums_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlLists.go b/internal/protocoltest/restxml/api_op_XmlLists.go index 201ef6d4826..cf5f219efae 100644 --- a/internal/protocoltest/restxml/api_op_XmlLists.go +++ b/internal/protocoltest/restxml/api_op_XmlLists.go @@ -37,6 +37,7 @@ func (c *Client) XmlLists(ctx context.Context, params *XmlListsInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlLists_test.go b/internal/protocoltest/restxml/api_op_XmlLists_test.go index 5fe57ee34c9..7a42921cd38 100644 --- a/internal/protocoltest/restxml/api_op_XmlLists_test.go +++ b/internal/protocoltest/restxml/api_op_XmlLists_test.go @@ -170,6 +170,9 @@ func TestClient_XmlLists_awsRestxmlSerialize(t *testing.T) { 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) @@ -182,7 +185,6 @@ func TestClient_XmlLists_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -383,7 +385,6 @@ func TestClient_XmlLists_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlMaps.go b/internal/protocoltest/restxml/api_op_XmlMaps.go index 46fb44c06f9..9362aa785f5 100644 --- a/internal/protocoltest/restxml/api_op_XmlMaps.go +++ b/internal/protocoltest/restxml/api_op_XmlMaps.go @@ -19,6 +19,7 @@ func (c *Client) XmlMaps(ctx context.Context, params *XmlMapsInput, optFns ...fu fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlMapsXmlName.go b/internal/protocoltest/restxml/api_op_XmlMapsXmlName.go index 7f2610b5ab2..b27e65a1f73 100644 --- a/internal/protocoltest/restxml/api_op_XmlMapsXmlName.go +++ b/internal/protocoltest/restxml/api_op_XmlMapsXmlName.go @@ -18,6 +18,7 @@ func (c *Client) XmlMapsXmlName(ctx context.Context, params *XmlMapsXmlNameInput fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlMapsXmlName_test.go b/internal/protocoltest/restxml/api_op_XmlMapsXmlName_test.go index 3e427b68899..567cfef006e 100644 --- a/internal/protocoltest/restxml/api_op_XmlMapsXmlName_test.go +++ b/internal/protocoltest/restxml/api_op_XmlMapsXmlName_test.go @@ -82,6 +82,9 @@ func TestClient_XmlMapsXmlName_awsRestxmlSerialize(t *testing.T) { 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) @@ -94,7 +97,6 @@ func TestClient_XmlMapsXmlName_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -209,7 +211,6 @@ func TestClient_XmlMapsXmlName_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlMaps_test.go b/internal/protocoltest/restxml/api_op_XmlMaps_test.go index 182685fdb9b..54748a82e11 100644 --- a/internal/protocoltest/restxml/api_op_XmlMaps_test.go +++ b/internal/protocoltest/restxml/api_op_XmlMaps_test.go @@ -82,6 +82,9 @@ func TestClient_XmlMaps_awsRestxmlSerialize(t *testing.T) { 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) @@ -94,7 +97,6 @@ func TestClient_XmlMaps_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -209,7 +211,6 @@ func TestClient_XmlMaps_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlNamespaces.go b/internal/protocoltest/restxml/api_op_XmlNamespaces.go index 7dc4a91aa28..4496a5cf644 100644 --- a/internal/protocoltest/restxml/api_op_XmlNamespaces.go +++ b/internal/protocoltest/restxml/api_op_XmlNamespaces.go @@ -18,6 +18,7 @@ func (c *Client) XmlNamespaces(ctx context.Context, params *XmlNamespacesInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlNamespaces_test.go b/internal/protocoltest/restxml/api_op_XmlNamespaces_test.go index acad9fce368..9785011c2f6 100644 --- a/internal/protocoltest/restxml/api_op_XmlNamespaces_test.go +++ b/internal/protocoltest/restxml/api_op_XmlNamespaces_test.go @@ -74,6 +74,9 @@ func TestClient_XmlNamespaces_awsRestxmlSerialize(t *testing.T) { 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) @@ -86,7 +89,6 @@ func TestClient_XmlNamespaces_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -193,7 +195,6 @@ func TestClient_XmlNamespaces_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/api_op_XmlTimestamps.go b/internal/protocoltest/restxml/api_op_XmlTimestamps.go index 9a4f50da09e..2fb28a3f6c0 100644 --- a/internal/protocoltest/restxml/api_op_XmlTimestamps.go +++ b/internal/protocoltest/restxml/api_op_XmlTimestamps.go @@ -20,6 +20,7 @@ func (c *Client) XmlTimestamps(ctx context.Context, params *XmlTimestampsInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) retry.AddRetryMiddlewares(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) diff --git a/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go b/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go index 574048af9e0..9949330e116 100644 --- a/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go +++ b/internal/protocoltest/restxml/api_op_XmlTimestamps_test.go @@ -119,6 +119,9 @@ func TestClient_XmlTimestamps_awsRestxmlSerialize(t *testing.T) { 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) @@ -131,7 +134,6 @@ func TestClient_XmlTimestamps_awsRestxmlSerialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, @@ -271,7 +273,6 @@ func TestClient_XmlTimestamps_awsRestxmlDeserialize(t *testing.T) { client := New(Options{ APIOptions: []APIOptionFunc{ func(s *middleware.Stack) error { - s.Build.Clear() s.Finalize.Clear() return nil }, diff --git a/internal/protocoltest/restxml/deserializers.go b/internal/protocoltest/restxml/deserializers.go index d323a5cae9f..5be2b55e8b4 100644 --- a/internal/protocoltest/restxml/deserializers.go +++ b/internal/protocoltest/restxml/deserializers.go @@ -15,14 +15,14 @@ import ( "time" ) -type awsRestxml_deserializeOpHttpRequestWithLabels struct { +type awsRestxml_deserializeOpSimpleScalarProperties struct { } -func (*awsRestxml_deserializeOpHttpRequestWithLabels) ID() string { +func (*awsRestxml_deserializeOpSimpleScalarProperties) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpRequestWithLabels) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpSimpleScalarProperties) 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) @@ -38,20 +38,38 @@ func (m *awsRestxml_deserializeOpHttpRequestWithLabels) HandleDeserialize(ctx co if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpRequestWithLabelsOutput{} + output := &SimpleScalarPropertiesOutput{} out.Result = output + err = awsRestxml_deserializeHttpBindingsSimpleScalarPropertiesOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + return out, metadata, err } -type awsRestxml_deserializeOpHttpPayloadWithXmlNamespaceAndPrefix struct { +func awsRestxml_deserializeHttpBindingsSimpleScalarPropertiesOutput(v *SimpleScalarPropertiesOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Foo = ptr.String(headerValues[0]) + } + + return nil } -func (*awsRestxml_deserializeOpHttpPayloadWithXmlNamespaceAndPrefix) ID() string { +type awsRestxml_deserializeOpFlattenedXmlMap struct { +} + +func (*awsRestxml_deserializeOpFlattenedXmlMap) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpFlattenedXmlMap) 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) @@ -67,20 +85,20 @@ func (m *awsRestxml_deserializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleDes if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpPayloadWithXmlNamespaceAndPrefixOutput{} + output := &FlattenedXmlMapOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpHttpPayloadWithXmlNamespace struct { +type awsRestxml_deserializeOpHttpRequestWithGreedyLabelInPath struct { } -func (*awsRestxml_deserializeOpHttpPayloadWithXmlNamespace) ID() string { +func (*awsRestxml_deserializeOpHttpRequestWithGreedyLabelInPath) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpPayloadWithXmlNamespace) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpRequestWithGreedyLabelInPath) 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) @@ -96,20 +114,20 @@ func (m *awsRestxml_deserializeOpHttpPayloadWithXmlNamespace) HandleDeserialize( if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpPayloadWithXmlNamespaceOutput{} + output := &HttpRequestWithGreedyLabelInPathOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpXmlAttributes struct { +type awsRestxml_deserializeOpXmlLists struct { } -func (*awsRestxml_deserializeOpXmlAttributes) ID() string { +func (*awsRestxml_deserializeOpXmlLists) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlAttributes) 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) @@ -125,20 +143,20 @@ func (m *awsRestxml_deserializeOpXmlAttributes) HandleDeserialize(ctx context.Co if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &XmlAttributesOutput{} + output := &XmlListsOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpXmlNamespaces struct { +type awsRestxml_deserializeOpConstantAndVariableQueryString struct { } -func (*awsRestxml_deserializeOpXmlNamespaces) ID() string { +func (*awsRestxml_deserializeOpConstantAndVariableQueryString) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlNamespaces) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpConstantAndVariableQueryString) 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) @@ -154,20 +172,20 @@ func (m *awsRestxml_deserializeOpXmlNamespaces) HandleDeserialize(ctx context.Co if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &XmlNamespacesOutput{} + output := &ConstantAndVariableQueryStringOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpRecursiveShapes struct { +type awsRestxml_deserializeOpXmlMapsXmlName struct { } -func (*awsRestxml_deserializeOpRecursiveShapes) ID() string { +func (*awsRestxml_deserializeOpXmlMapsXmlName) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpRecursiveShapes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpXmlMapsXmlName) 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) @@ -183,20 +201,20 @@ func (m *awsRestxml_deserializeOpRecursiveShapes) HandleDeserialize(ctx context. if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &RecursiveShapesOutput{} + output := &XmlMapsXmlNameOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpNoInputAndOutput struct { +type awsRestxml_deserializeOpHttpPayloadWithStructure struct { } -func (*awsRestxml_deserializeOpNoInputAndOutput) ID() string { +func (*awsRestxml_deserializeOpHttpPayloadWithStructure) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpNoInputAndOutput) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpPayloadWithStructure) 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) @@ -212,20 +230,20 @@ func (m *awsRestxml_deserializeOpNoInputAndOutput) HandleDeserialize(ctx context if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &NoInputAndOutputOutput{} + output := &HttpPayloadWithStructureOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpHttpRequestWithLabelsAndTimestampFormat struct { +type awsRestxml_deserializeOpConstantQueryString struct { } -func (*awsRestxml_deserializeOpHttpRequestWithLabelsAndTimestampFormat) ID() string { +func (*awsRestxml_deserializeOpConstantQueryString) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpRequestWithLabelsAndTimestampFormat) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpConstantQueryString) 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) @@ -241,20 +259,20 @@ func (m *awsRestxml_deserializeOpHttpRequestWithLabelsAndTimestampFormat) Handle if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpRequestWithLabelsAndTimestampFormatOutput{} + output := &ConstantQueryStringOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpIgnoreQueryParamsInResponse struct { +type awsRestxml_deserializeOpHttpPayloadTraits struct { } -func (*awsRestxml_deserializeOpIgnoreQueryParamsInResponse) ID() string { +func (*awsRestxml_deserializeOpHttpPayloadTraits) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpIgnoreQueryParamsInResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpPayloadTraits) 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) @@ -270,20 +288,38 @@ func (m *awsRestxml_deserializeOpIgnoreQueryParamsInResponse) HandleDeserialize( if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &IgnoreQueryParamsInResponseOutput{} + output := &HttpPayloadTraitsOutput{} out.Result = output + err = awsRestxml_deserializeHttpBindingsHttpPayloadTraitsOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + return out, metadata, err } -type awsRestxml_deserializeOpXmlEnums struct { +func awsRestxml_deserializeHttpBindingsHttpPayloadTraitsOutput(v *HttpPayloadTraitsOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Foo = ptr.String(headerValues[0]) + } + + return nil } -func (*awsRestxml_deserializeOpXmlEnums) ID() string { +type awsRestxml_deserializeOpXmlTimestamps struct { +} + +func (*awsRestxml_deserializeOpXmlTimestamps) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlEnums) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpXmlTimestamps) 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) @@ -299,20 +335,20 @@ func (m *awsRestxml_deserializeOpXmlEnums) HandleDeserialize(ctx context.Context if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &XmlEnumsOutput{} + output := &XmlTimestampsOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpHttpPayloadWithXmlName struct { +type awsRestxml_deserializeOpXmlAttributesOnPayload struct { } -func (*awsRestxml_deserializeOpHttpPayloadWithXmlName) ID() string { +func (*awsRestxml_deserializeOpXmlAttributesOnPayload) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpPayloadWithXmlName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpXmlAttributesOnPayload) 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) @@ -328,20 +364,20 @@ func (m *awsRestxml_deserializeOpHttpPayloadWithXmlName) HandleDeserialize(ctx c if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpPayloadWithXmlNameOutput{} + output := &XmlAttributesOnPayloadOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpHttpPayloadTraitsWithMediaType struct { +type awsRestxml_deserializeOpEmptyInputAndEmptyOutput struct { } -func (*awsRestxml_deserializeOpHttpPayloadTraitsWithMediaType) ID() string { +func (*awsRestxml_deserializeOpEmptyInputAndEmptyOutput) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpPayloadTraitsWithMediaType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpEmptyInputAndEmptyOutput) 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) @@ -357,38 +393,20 @@ func (m *awsRestxml_deserializeOpHttpPayloadTraitsWithMediaType) HandleDeseriali if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpPayloadTraitsWithMediaTypeOutput{} + output := &EmptyInputAndEmptyOutputOutput{} out.Result = output - err = awsRestxml_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } - return out, metadata, err } -func awsRestxml_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(v *HttpPayloadTraitsWithMediaTypeOutput, response *smithyhttp.Response) error { - if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) - } - - if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Foo = ptr.String(headerValues[0]) - } - - return nil -} - -type awsRestxml_deserializeOpNoInputAndNoOutput struct { +type awsRestxml_deserializeOpHttpRequestWithLabels struct { } -func (*awsRestxml_deserializeOpNoInputAndNoOutput) ID() string { +func (*awsRestxml_deserializeOpHttpRequestWithLabels) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpNoInputAndNoOutput) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpRequestWithLabels) 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) @@ -404,20 +422,20 @@ func (m *awsRestxml_deserializeOpNoInputAndNoOutput) HandleDeserialize(ctx conte if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &NoInputAndNoOutputOutput{} + output := &HttpRequestWithLabelsOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpConstantAndVariableQueryString struct { +type awsRestxml_deserializeOpNullAndEmptyHeadersClient struct { } -func (*awsRestxml_deserializeOpConstantAndVariableQueryString) ID() string { +func (*awsRestxml_deserializeOpNullAndEmptyHeadersClient) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpConstantAndVariableQueryString) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpNullAndEmptyHeadersClient) 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) @@ -433,49 +451,54 @@ func (m *awsRestxml_deserializeOpConstantAndVariableQueryString) HandleDeseriali if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &ConstantAndVariableQueryStringOutput{} + output := &NullAndEmptyHeadersClientOutput{} out.Result = output - return out, metadata, err -} + err = awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } -type awsRestxml_deserializeOpEmptyInputAndEmptyOutput struct { + return out, metadata, err } -func (*awsRestxml_deserializeOpEmptyInputAndEmptyOutput) ID() string { - return "OperationDeserializer" -} +func awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(v *NullAndEmptyHeadersClientOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } -func (m *awsRestxml_deserializeOpEmptyInputAndEmptyOutput) 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 + if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.A = ptr.String(headerValues[0]) } - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.B = ptr.String(headerValues[0]) } - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { + var list []*string + for _, headerValuesVal := range headerValues { + for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { + headerValuesValPart = strings.TrimSpace(headerValuesValPart) + list = append(list, ptr.String(headerValuesValPart)) + } + } + v.C = list } - output := &EmptyInputAndEmptyOutputOutput{} - out.Result = output - return out, metadata, err + return nil } -type awsRestxml_deserializeOpXmlAttributesOnPayload struct { +type awsRestxml_deserializeOpXmlBlobs struct { } -func (*awsRestxml_deserializeOpXmlAttributesOnPayload) ID() string { +func (*awsRestxml_deserializeOpXmlBlobs) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlAttributesOnPayload) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpXmlBlobs) 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) @@ -491,20 +514,20 @@ func (m *awsRestxml_deserializeOpXmlAttributesOnPayload) HandleDeserialize(ctx c if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &XmlAttributesOnPayloadOutput{} + output := &XmlBlobsOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpConstantQueryString struct { +type awsRestxml_deserializeOpHttpPayloadWithXmlNamespaceAndPrefix struct { } -func (*awsRestxml_deserializeOpConstantQueryString) ID() string { +func (*awsRestxml_deserializeOpHttpPayloadWithXmlNamespaceAndPrefix) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpConstantQueryString) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpPayloadWithXmlNamespaceAndPrefix) 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) @@ -520,20 +543,20 @@ func (m *awsRestxml_deserializeOpConstantQueryString) HandleDeserialize(ctx cont if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &ConstantQueryStringOutput{} + output := &HttpPayloadWithXmlNamespaceAndPrefixOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpAllQueryStringTypes struct { +type awsRestxml_deserializeOpHttpRequestWithLabelsAndTimestampFormat struct { } -func (*awsRestxml_deserializeOpAllQueryStringTypes) ID() string { +func (*awsRestxml_deserializeOpHttpRequestWithLabelsAndTimestampFormat) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpAllQueryStringTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpRequestWithLabelsAndTimestampFormat) 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) @@ -549,20 +572,20 @@ func (m *awsRestxml_deserializeOpAllQueryStringTypes) HandleDeserialize(ctx cont if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &AllQueryStringTypesOutput{} + output := &HttpRequestWithLabelsAndTimestampFormatOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpFlattenedXmlMap struct { +type awsRestxml_deserializeOpInputAndOutputWithHeaders struct { } -func (*awsRestxml_deserializeOpFlattenedXmlMap) ID() string { +func (*awsRestxml_deserializeOpInputAndOutputWithHeaders) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpFlattenedXmlMap) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpInputAndOutputWithHeaders) 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) @@ -578,247 +601,21 @@ func (m *awsRestxml_deserializeOpFlattenedXmlMap) HandleDeserialize(ctx context. if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &FlattenedXmlMapOutput{} + output := &InputAndOutputWithHeadersOutput{} out.Result = output + err = awsRestxml_deserializeHttpBindingsInputAndOutputWithHeadersOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + return out, metadata, err } -type awsRestxml_deserializeOpHttpRequestWithGreedyLabelInPath struct { -} - -func (*awsRestxml_deserializeOpHttpRequestWithGreedyLabelInPath) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestxml_deserializeOpHttpRequestWithGreedyLabelInPath) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} - } - output := &HttpRequestWithGreedyLabelInPathOutput{} - out.Result = output - - return out, metadata, err -} - -type awsRestxml_deserializeOpQueryIdempotencyTokenAutoFill struct { -} - -func (*awsRestxml_deserializeOpQueryIdempotencyTokenAutoFill) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestxml_deserializeOpQueryIdempotencyTokenAutoFill) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} - } - output := &QueryIdempotencyTokenAutoFillOutput{} - out.Result = output - - return out, metadata, err -} - -type awsRestxml_deserializeOpNullAndEmptyHeadersClient struct { -} - -func (*awsRestxml_deserializeOpNullAndEmptyHeadersClient) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestxml_deserializeOpNullAndEmptyHeadersClient) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} - } - output := &NullAndEmptyHeadersClientOutput{} - out.Result = output - - err = awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } - - return out, metadata, err -} - -func awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersClientOutput(v *NullAndEmptyHeadersClientOutput, response *smithyhttp.Response) error { - if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) - } - - if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.A = ptr.String(headerValues[0]) - } - - if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.B = ptr.String(headerValues[0]) - } - - if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { - var list []*string - for _, headerValuesVal := range headerValues { - for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { - headerValuesValPart = strings.TrimSpace(headerValuesValPart) - list = append(list, ptr.String(headerValuesValPart)) - } - } - v.C = list - } - - return nil -} - -type awsRestxml_deserializeOpXmlLists struct { -} - -func (*awsRestxml_deserializeOpXmlLists) ID() string { - return "OperationDeserializer" -} - -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) - 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} - } - output := &XmlListsOutput{} - out.Result = output - - return out, metadata, err -} - -type awsRestxml_deserializeOpSimpleScalarProperties struct { -} - -func (*awsRestxml_deserializeOpSimpleScalarProperties) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestxml_deserializeOpSimpleScalarProperties) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} - } - output := &SimpleScalarPropertiesOutput{} - out.Result = output - - err = awsRestxml_deserializeHttpBindingsSimpleScalarPropertiesOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } - - return out, metadata, err -} - -func awsRestxml_deserializeHttpBindingsSimpleScalarPropertiesOutput(v *SimpleScalarPropertiesOutput, response *smithyhttp.Response) error { - if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) - } - - if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Foo = ptr.String(headerValues[0]) - } - - return nil -} - -type awsRestxml_deserializeOpInputAndOutputWithHeaders struct { -} - -func (*awsRestxml_deserializeOpInputAndOutputWithHeaders) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestxml_deserializeOpInputAndOutputWithHeaders) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} - } - output := &InputAndOutputWithHeadersOutput{} - out.Result = output - - err = awsRestxml_deserializeHttpBindingsInputAndOutputWithHeadersOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } - - return out, metadata, err -} - -func awsRestxml_deserializeHttpBindingsInputAndOutputWithHeadersOutput(v *InputAndOutputWithHeadersOutput, response *smithyhttp.Response) error { - if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) - } +func awsRestxml_deserializeHttpBindingsInputAndOutputWithHeadersOutput(v *InputAndOutputWithHeadersOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } if headerValues := response.Header.Values("X-BooleanList"); len(headerValues) != 0 { var list []*bool @@ -983,14 +780,14 @@ func awsRestxml_deserializeHttpBindingsInputAndOutputWithHeadersOutput(v *InputA return nil } -type awsRestxml_deserializeOpGreetingWithErrors struct { +type awsRestxml_deserializeOpNoInputAndOutput struct { } -func (*awsRestxml_deserializeOpGreetingWithErrors) ID() string { +func (*awsRestxml_deserializeOpNoInputAndOutput) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpGreetingWithErrors) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpNoInputAndOutput) 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) @@ -1006,28 +803,68 @@ func (m *awsRestxml_deserializeOpGreetingWithErrors) HandleDeserialize(ctx conte if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &GreetingWithErrorsOutput{} + output := &NoInputAndOutputOutput{} out.Result = output - err = awsRestxml_deserializeHttpBindingsGreetingWithErrorsOutput(output, response) + return out, metadata, err +} + +type awsRestxml_deserializeOpIgnoreQueryParamsInResponse struct { +} + +func (*awsRestxml_deserializeOpIgnoreQueryParamsInResponse) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpIgnoreQueryParamsInResponse) 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, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + } + output := &IgnoreQueryParamsInResponseOutput{} + out.Result = output + return out, metadata, err } -func awsRestxml_deserializeHttpBindingsGreetingWithErrorsOutput(v *GreetingWithErrorsOutput, response *smithyhttp.Response) error { - if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) +type awsRestxml_deserializeOpXmlEnums struct { +} + +func (*awsRestxml_deserializeOpXmlEnums) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpXmlEnums) 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 } - if headerValues := response.Header.Values("X-Greeting"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Greeting = ptr.String(headerValues[0]) + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} } - return nil + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + } + output := &XmlEnumsOutput{} + out.Result = output + + return out, metadata, err } type awsRestxml_deserializeOpOmitsNullSerializesEmptyString struct { @@ -1059,14 +896,14 @@ func (m *awsRestxml_deserializeOpOmitsNullSerializesEmptyString) HandleDeseriali return out, metadata, err } -type awsRestxml_deserializeOpTimestampFormatHeaders struct { +type awsRestxml_deserializeOpXmlNamespaces struct { } -func (*awsRestxml_deserializeOpTimestampFormatHeaders) ID() string { +func (*awsRestxml_deserializeOpXmlNamespaces) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpTimestampFormatHeaders) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpXmlNamespaces) 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) @@ -1082,10 +919,126 @@ func (m *awsRestxml_deserializeOpTimestampFormatHeaders) HandleDeserialize(ctx c if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &TimestampFormatHeadersOutput{} + output := &XmlNamespacesOutput{} out.Result = output - err = awsRestxml_deserializeHttpBindingsTimestampFormatHeadersOutput(output, response) + return out, metadata, err +} + +type awsRestxml_deserializeOpRecursiveShapes struct { +} + +func (*awsRestxml_deserializeOpRecursiveShapes) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpRecursiveShapes) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + } + output := &RecursiveShapesOutput{} + out.Result = output + + return out, metadata, err +} + +type awsRestxml_deserializeOpXmlAttributes struct { +} + +func (*awsRestxml_deserializeOpXmlAttributes) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpXmlAttributes) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + } + output := &XmlAttributesOutput{} + out.Result = output + + return out, metadata, err +} + +type awsRestxml_deserializeOpHttpPayloadWithXmlNamespace struct { +} + +func (*awsRestxml_deserializeOpHttpPayloadWithXmlNamespace) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpHttpPayloadWithXmlNamespace) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + } + output := &HttpPayloadWithXmlNamespaceOutput{} + out.Result = output + + return out, metadata, err +} + +type awsRestxml_deserializeOpHttpPrefixHeaders struct { +} + +func (*awsRestxml_deserializeOpHttpPrefixHeaders) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpHttpPrefixHeaders) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + } + output := &HttpPrefixHeadersOutput{} + out.Result = output + + err = awsRestxml_deserializeHttpBindingsHttpPrefixHeadersOutput(output, response) if err != nil { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } @@ -1093,86 +1046,100 @@ func (m *awsRestxml_deserializeOpTimestampFormatHeaders) HandleDeserialize(ctx c return out, metadata, err } -func awsRestxml_deserializeHttpBindingsTimestampFormatHeadersOutput(v *TimestampFormatHeadersOutput, response *smithyhttp.Response) error { +func awsRestxml_deserializeHttpBindingsHttpPrefixHeadersOutput(v *HttpPrefixHeadersOutput, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) } - if headerValues := response.Header.Values("X-defaultFormat"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err - } - v.DefaultFormat = ptr.Time(t) + v.Foo = ptr.String(headerValues[0]) } - if headerValues := response.Header.Values("X-memberDateTime"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err + for headerKey, headerValues := range response.Header { + if lenPrefix := len("X-Foo-"); len(headerKey) >= lenPrefix && strings.EqualFold(headerKey[:lenPrefix], "X-Foo-") { + if v.FooMap == nil { + v.FooMap = map[string]*string{} + } + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.FooMap[headerKey[lenPrefix:]] = ptr.String(headerValues[0]) } - v.MemberDateTime = ptr.Time(t) } - if headerValues := response.Header.Values("X-memberEpochSeconds"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err - } - v.MemberEpochSeconds = ptr.Time(t) + return nil +} + +type awsRestxml_deserializeOpNullAndEmptyHeadersServer struct { +} + +func (*awsRestxml_deserializeOpNullAndEmptyHeadersServer) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpNullAndEmptyHeadersServer) 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, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + } + output := &NullAndEmptyHeadersServerOutput{} + out.Result = output + + err = awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } - if headerValues := response.Header.Values("X-memberHttpDate"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err - } - v.MemberHttpDate = ptr.Time(t) + return out, metadata, err +} + +func awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(v *NullAndEmptyHeadersServerOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) } - if headerValues := response.Header.Values("X-targetDateTime"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseDateTime(headerValues[0]) - if err != nil { - return err - } - v.TargetDateTime = ptr.Time(t) + v.A = ptr.String(headerValues[0]) } - if headerValues := response.Header.Values("X-targetEpochSeconds"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - f, err := strconv.ParseFloat(headerValues[0], 64) - if err != nil { - return err - } - t := smithytime.ParseEpochSeconds(f) - v.TargetEpochSeconds = ptr.Time(t) + v.B = ptr.String(headerValues[0]) } - if headerValues := response.Header.Values("X-targetHttpDate"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - t, err := smithytime.ParseHTTPDate(headerValues[0]) - if err != nil { - return err + if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { + var list []*string + for _, headerValuesVal := range headerValues { + for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { + headerValuesValPart = strings.TrimSpace(headerValuesValPart) + list = append(list, ptr.String(headerValuesValPart)) + } } - v.TargetHttpDate = ptr.Time(t) + v.C = list } return nil } -type awsRestxml_deserializeOpXmlBlobs struct { +type awsRestxml_deserializeOpXmlMaps struct { } -func (*awsRestxml_deserializeOpXmlBlobs) ID() string { +func (*awsRestxml_deserializeOpXmlMaps) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlBlobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +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) @@ -1188,20 +1155,20 @@ func (m *awsRestxml_deserializeOpXmlBlobs) HandleDeserialize(ctx context.Context if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &XmlBlobsOutput{} + output := &XmlMapsOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpHttpPayloadWithStructure struct { +type awsRestxml_deserializeOpAllQueryStringTypes struct { } -func (*awsRestxml_deserializeOpHttpPayloadWithStructure) ID() string { +func (*awsRestxml_deserializeOpAllQueryStringTypes) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpPayloadWithStructure) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpAllQueryStringTypes) 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) @@ -1217,7 +1184,7 @@ func (m *awsRestxml_deserializeOpHttpPayloadWithStructure) HandleDeserialize(ctx if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpPayloadWithStructureOutput{} + output := &AllQueryStringTypesOutput{} out.Result = output return out, metadata, err @@ -1252,14 +1219,14 @@ func (m *awsRestxml_deserializeOpFlattenedXmlMapWithXmlName) HandleDeserialize(c return out, metadata, err } -type awsRestxml_deserializeOpHttpPrefixHeaders struct { +type awsRestxml_deserializeOpNoInputAndNoOutput struct { } -func (*awsRestxml_deserializeOpHttpPrefixHeaders) ID() string { +func (*awsRestxml_deserializeOpNoInputAndNoOutput) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpPrefixHeaders) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpNoInputAndNoOutput) 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) @@ -1275,48 +1242,49 @@ func (m *awsRestxml_deserializeOpHttpPrefixHeaders) HandleDeserialize(ctx contex if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpPrefixHeadersOutput{} + output := &NoInputAndNoOutputOutput{} out.Result = output - err = awsRestxml_deserializeHttpBindingsHttpPrefixHeadersOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } - return out, metadata, err } -func awsRestxml_deserializeHttpBindingsHttpPrefixHeadersOutput(v *HttpPrefixHeadersOutput, response *smithyhttp.Response) error { - if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) +type awsRestxml_deserializeOpQueryIdempotencyTokenAutoFill struct { +} + +func (*awsRestxml_deserializeOpQueryIdempotencyTokenAutoFill) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestxml_deserializeOpQueryIdempotencyTokenAutoFill) 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 } - if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Foo = ptr.String(headerValues[0]) + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} } - for headerKey, headerValues := range response.Header { - if lenPrefix := len("X-Foo-"); len(headerKey) >= lenPrefix && strings.EqualFold(headerKey[:lenPrefix], "X-Foo-") { - if v.FooMap == nil { - v.FooMap = map[string]*string{} - } - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.FooMap[headerKey[lenPrefix:]] = ptr.String(headerValues[0]) - } + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } + output := &QueryIdempotencyTokenAutoFillOutput{} + out.Result = output - return nil + return out, metadata, err } -type awsRestxml_deserializeOpNullAndEmptyHeadersServer struct { +type awsRestxml_deserializeOpTimestampFormatHeaders struct { } -func (*awsRestxml_deserializeOpNullAndEmptyHeadersServer) ID() string { +func (*awsRestxml_deserializeOpTimestampFormatHeaders) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpNullAndEmptyHeadersServer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpTimestampFormatHeaders) 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) @@ -1332,10 +1300,10 @@ func (m *awsRestxml_deserializeOpNullAndEmptyHeadersServer) HandleDeserialize(ct if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &NullAndEmptyHeadersServerOutput{} + output := &TimestampFormatHeadersOutput{} out.Result = output - err = awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(output, response) + err = awsRestxml_deserializeHttpBindingsTimestampFormatHeadersOutput(output, response) if err != nil { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } @@ -1343,43 +1311,86 @@ func (m *awsRestxml_deserializeOpNullAndEmptyHeadersServer) HandleDeserialize(ct return out, metadata, err } -func awsRestxml_deserializeHttpBindingsNullAndEmptyHeadersServerOutput(v *NullAndEmptyHeadersServerOutput, response *smithyhttp.Response) error { +func awsRestxml_deserializeHttpBindingsTimestampFormatHeadersOutput(v *TimestampFormatHeadersOutput, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) } - if headerValues := response.Header.Values("X-A"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-defaultFormat"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - v.A = ptr.String(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.DefaultFormat = ptr.Time(t) } - if headerValues := response.Header.Values("X-B"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-memberDateTime"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - v.B = ptr.String(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.MemberDateTime = ptr.Time(t) } - if headerValues := response.Header.Values("X-C"); len(headerValues) != 0 { - var list []*string - for _, headerValuesVal := range headerValues { - for _, headerValuesValPart := range strings.Split(headerValuesVal, ",") { - headerValuesValPart = strings.TrimSpace(headerValuesValPart) - list = append(list, ptr.String(headerValuesValPart)) - } + if headerValues := response.Header.Values("X-memberEpochSeconds"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err } - v.C = list + v.MemberEpochSeconds = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-memberHttpDate"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.MemberHttpDate = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-targetDateTime"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseDateTime(headerValues[0]) + if err != nil { + return err + } + v.TargetDateTime = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-targetEpochSeconds"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + f, err := strconv.ParseFloat(headerValues[0], 64) + if err != nil { + return err + } + t := smithytime.ParseEpochSeconds(f) + v.TargetEpochSeconds = ptr.Time(t) + } + + if headerValues := response.Header.Values("X-targetHttpDate"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + t, err := smithytime.ParseHTTPDate(headerValues[0]) + if err != nil { + return err + } + v.TargetHttpDate = ptr.Time(t) } return nil } -type awsRestxml_deserializeOpHttpPayloadTraits struct { +type awsRestxml_deserializeOpGreetingWithErrors struct { } -func (*awsRestxml_deserializeOpHttpPayloadTraits) ID() string { +func (*awsRestxml_deserializeOpGreetingWithErrors) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpHttpPayloadTraits) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpGreetingWithErrors) 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) @@ -1395,10 +1406,10 @@ func (m *awsRestxml_deserializeOpHttpPayloadTraits) HandleDeserialize(ctx contex if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &HttpPayloadTraitsOutput{} + output := &GreetingWithErrorsOutput{} out.Result = output - err = awsRestxml_deserializeHttpBindingsHttpPayloadTraitsOutput(output, response) + err = awsRestxml_deserializeHttpBindingsGreetingWithErrorsOutput(output, response) if err != nil { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } @@ -1406,27 +1417,27 @@ func (m *awsRestxml_deserializeOpHttpPayloadTraits) HandleDeserialize(ctx contex return out, metadata, err } -func awsRestxml_deserializeHttpBindingsHttpPayloadTraitsOutput(v *HttpPayloadTraitsOutput, response *smithyhttp.Response) error { +func awsRestxml_deserializeHttpBindingsGreetingWithErrorsOutput(v *GreetingWithErrorsOutput, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) } - if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { + if headerValues := response.Header.Values("X-Greeting"); len(headerValues) != 0 { headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Foo = ptr.String(headerValues[0]) + v.Greeting = ptr.String(headerValues[0]) } return nil } -type awsRestxml_deserializeOpXmlMaps struct { +type awsRestxml_deserializeOpHttpPayloadWithXmlName struct { } -func (*awsRestxml_deserializeOpXmlMaps) ID() string { +func (*awsRestxml_deserializeOpHttpPayloadWithXmlName) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlMaps) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpPayloadWithXmlName) 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) @@ -1442,20 +1453,20 @@ func (m *awsRestxml_deserializeOpXmlMaps) HandleDeserialize(ctx context.Context, if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &XmlMapsOutput{} + output := &HttpPayloadWithXmlNameOutput{} out.Result = output return out, metadata, err } -type awsRestxml_deserializeOpXmlTimestamps struct { +type awsRestxml_deserializeOpHttpPayloadTraitsWithMediaType struct { } -func (*awsRestxml_deserializeOpXmlTimestamps) ID() string { +func (*awsRestxml_deserializeOpHttpPayloadTraitsWithMediaType) ID() string { return "OperationDeserializer" } -func (m *awsRestxml_deserializeOpXmlTimestamps) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestxml_deserializeOpHttpPayloadTraitsWithMediaType) 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) @@ -1471,41 +1482,29 @@ func (m *awsRestxml_deserializeOpXmlTimestamps) HandleDeserialize(ctx context.Co if response.StatusCode < 200 || response.StatusCode >= 300 { return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} } - output := &XmlTimestampsOutput{} + output := &HttpPayloadTraitsWithMediaTypeOutput{} out.Result = output - return out, metadata, err -} - -type awsRestxml_deserializeOpXmlMapsXmlName struct { -} - -func (*awsRestxml_deserializeOpXmlMapsXmlName) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestxml_deserializeOpXmlMapsXmlName) 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) + err = awsRestxml_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(output, response) if err != nil { - return out, metadata, err + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} } - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + return out, metadata, err +} + +func awsRestxml_deserializeHttpBindingsHttpPayloadTraitsWithMediaTypeOutput(v *HttpPayloadTraitsWithMediaTypeOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) } - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("TODO: Implement error deserializer delegators")} + if headerValues := response.Header.Values("X-Foo"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Foo = ptr.String(headerValues[0]) } - output := &XmlMapsXmlNameOutput{} - out.Result = output - return out, metadata, err + return nil } - func awsRestxml_deserializeHttpBindingsComplexError(v *types.ComplexError, response *smithyhttp.Response) error { if v == nil { return fmt.Errorf("unsupported deserialization for nil %T", v) diff --git a/internal/protocoltest/restxml/go.mod b/internal/protocoltest/restxml/go.mod index f97a05c6c97..7357dd33716 100644 --- a/internal/protocoltest/restxml/go.mod +++ b/internal/protocoltest/restxml/go.mod @@ -4,6 +4,6 @@ go 1.14 require ( github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03 - github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13 + github.com/awslabs/smithy-go v0.0.0-20200715183807-623301001f0d github.com/google/go-cmp v0.4.1 ) diff --git a/internal/protocoltest/restxml/serializers.go b/internal/protocoltest/restxml/serializers.go index 6bf4045c05b..0541fc52df4 100644 --- a/internal/protocoltest/restxml/serializers.go +++ b/internal/protocoltest/restxml/serializers.go @@ -11,14 +11,14 @@ import ( smithyhttp "github.com/awslabs/smithy-go/transport/http" ) -type awsRestxml_serializeOpHttpRequestWithLabels struct { +type awsRestxml_serializeOpSimpleScalarProperties struct { } -func (*awsRestxml_serializeOpHttpRequestWithLabels) ID() string { +func (*awsRestxml_serializeOpSimpleScalarProperties) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpRequestWithLabels) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpSimpleScalarProperties) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -26,13 +26,13 @@ func (m *awsRestxml_serializeOpHttpRequestWithLabels) HandleSerialize(ctx contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpRequestWithLabelsInput) + input, ok := in.Parameters.(*SimpleScalarPropertiesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}") + opPath, opQuery := httpbinding.SplitURI("/SimpleScalarProperties") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -40,13 +40,13 @@ func (m *awsRestxml_serializeOpHttpRequestWithLabels) HandleSerialize(ctx contex request.URL.RawQuery = opQuery } - request.Method = "GET" + 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} } - if err := awsRestxml_serializeHttpBindingsHttpRequestWithLabelsInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsSimpleScalarPropertiesInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -57,70 +57,28 @@ func (m *awsRestxml_serializeOpHttpRequestWithLabels) HandleSerialize(ctx contex return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpRequestWithLabelsInput(v *HttpRequestWithLabelsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Boolean != nil { - if err := encoder.SetURI("boolean").Boolean(*v.Boolean); err != nil { - return err - } - } - - if v.Double != nil { - if err := encoder.SetURI("double").Double(*v.Double); err != nil { - return err - } - } - - if v.Float != nil { - if err := encoder.SetURI("float").Float(*v.Float); err != nil { - return err - } - } - - if v.Integer != nil { - if err := encoder.SetURI("integer").Integer(*v.Integer); err != nil { - return err - } - } - - if v.Long != nil { - if err := encoder.SetURI("long").Long(*v.Long); err != nil { - return err - } - } - - if v.Short != nil { - if err := encoder.SetURI("short").Short(*v.Short); err != nil { - return err - } - } - - if v.String_ != nil { - if err := encoder.SetURI("string").String(*v.String_); err != nil { - return err - } - } - - if v.Timestamp != nil { - if err := encoder.SetURI("timestamp").String(smithytime.FormatDateTime(*v.Timestamp)); err != nil { - return err + if v.Foo != nil { + if len(*v.Foo) > 0 { + encoder.SetHeader("X-Foo").String(*v.Foo) } } return nil } -type awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix struct { +type awsRestxml_serializeOpFlattenedXmlMap struct { } -func (*awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) ID() string { +func (*awsRestxml_serializeOpFlattenedXmlMap) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpFlattenedXmlMap) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -128,13 +86,13 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleSeria return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadWithXmlNamespaceAndPrefixInput) + input, ok := in.Parameters.(*FlattenedXmlMapInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlNamespaceAndPrefix") + opPath, opQuery := httpbinding.SplitURI("/FlattenedXmlMap") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -142,7 +100,7 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleSeria request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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} @@ -155,7 +113,7 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleSeria return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNamespaceAndPrefixInput(v *HttpPayloadWithXmlNamespaceAndPrefixInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsFlattenedXmlMapInput(v *FlattenedXmlMapInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -163,14 +121,14 @@ func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNamespaceAndPrefixInput(v return nil } -type awsRestxml_serializeOpHttpPayloadWithXmlNamespace struct { +type awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath struct { } -func (*awsRestxml_serializeOpHttpPayloadWithXmlNamespace) ID() string { +func (*awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespace) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -178,13 +136,13 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespace) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadWithXmlNamespaceInput) + input, ok := in.Parameters.(*HttpRequestWithGreedyLabelInPathInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlNamespace") + opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -192,12 +150,16 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespace) HandleSerialize(ctx request.URL.RawQuery = opQuery } - request.Method = "PUT" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestxml_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(input, restEncoder); 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} } @@ -205,22 +167,34 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespace) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNamespaceInput(v *HttpPayloadWithXmlNamespaceInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(v *HttpRequestWithGreedyLabelInPathInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Baz != nil { + if err := encoder.SetURI("baz").String(*v.Baz); err != nil { + return err + } + } + + if v.Foo != nil { + if err := encoder.SetURI("foo").String(*v.Foo); err != nil { + return err + } + } + return nil } -type awsRestxml_serializeOpXmlAttributes struct { +type awsRestxml_serializeOpXmlLists struct { } -func (*awsRestxml_serializeOpXmlAttributes) ID() string { +func (*awsRestxml_serializeOpXmlLists) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlAttributes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlLists) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -228,13 +202,13 @@ func (m *awsRestxml_serializeOpXmlAttributes) HandleSerialize(ctx context.Contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlAttributesInput) + input, ok := in.Parameters.(*XmlListsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlAttributes") + opPath, opQuery := httpbinding.SplitURI("/XmlLists") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -255,7 +229,7 @@ func (m *awsRestxml_serializeOpXmlAttributes) HandleSerialize(ctx context.Contex return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlAttributesInput(v *XmlAttributesInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlListsInput(v *XmlListsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -263,14 +237,14 @@ func awsRestxml_serializeHttpBindingsXmlAttributesInput(v *XmlAttributesInput, e return nil } -type awsRestxml_serializeOpXmlNamespaces struct { +type awsRestxml_serializeOpConstantAndVariableQueryString struct { } -func (*awsRestxml_serializeOpXmlNamespaces) ID() string { +func (*awsRestxml_serializeOpConstantAndVariableQueryString) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlNamespaces) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpConstantAndVariableQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -278,13 +252,13 @@ func (m *awsRestxml_serializeOpXmlNamespaces) HandleSerialize(ctx context.Contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlNamespacesInput) + input, ok := in.Parameters.(*ConstantAndVariableQueryStringInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlNamespaces") + opPath, opQuery := httpbinding.SplitURI("/ConstantAndVariableQueryString?foo=bar") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -292,12 +266,16 @@ func (m *awsRestxml_serializeOpXmlNamespaces) HandleSerialize(ctx context.Contex request.URL.RawQuery = opQuery } - request.Method = "POST" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestxml_serializeHttpBindingsConstantAndVariableQueryStringInput(input, restEncoder); 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} } @@ -305,22 +283,30 @@ func (m *awsRestxml_serializeOpXmlNamespaces) HandleSerialize(ctx context.Contex return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlNamespacesInput(v *XmlNamespacesInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsConstantAndVariableQueryStringInput(v *ConstantAndVariableQueryStringInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Baz != nil { + encoder.SetQuery("baz").String(*v.Baz) + } + + if v.MaybeSet != nil { + encoder.SetQuery("maybeSet").String(*v.MaybeSet) + } + return nil } -type awsRestxml_serializeOpRecursiveShapes struct { +type awsRestxml_serializeOpXmlMapsXmlName struct { } -func (*awsRestxml_serializeOpRecursiveShapes) ID() string { +func (*awsRestxml_serializeOpXmlMapsXmlName) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpRecursiveShapes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlMapsXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -328,13 +314,13 @@ func (m *awsRestxml_serializeOpRecursiveShapes) HandleSerialize(ctx context.Cont return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*RecursiveShapesInput) + input, ok := in.Parameters.(*XmlMapsXmlNameInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/RecursiveShapes") + opPath, opQuery := httpbinding.SplitURI("/XmlMapsXmlName") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -342,7 +328,7 @@ func (m *awsRestxml_serializeOpRecursiveShapes) HandleSerialize(ctx context.Cont request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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} @@ -355,7 +341,7 @@ func (m *awsRestxml_serializeOpRecursiveShapes) HandleSerialize(ctx context.Cont return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsRecursiveShapesInput(v *RecursiveShapesInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlMapsXmlNameInput(v *XmlMapsXmlNameInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -363,14 +349,14 @@ func awsRestxml_serializeHttpBindingsRecursiveShapesInput(v *RecursiveShapesInpu return nil } -type awsRestxml_serializeOpNoInputAndOutput struct { +type awsRestxml_serializeOpHttpPayloadWithStructure struct { } -func (*awsRestxml_serializeOpNoInputAndOutput) ID() string { +func (*awsRestxml_serializeOpHttpPayloadWithStructure) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpNoInputAndOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -378,13 +364,13 @@ func (m *awsRestxml_serializeOpNoInputAndOutput) HandleSerialize(ctx context.Con return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NoInputAndOutputInput) + input, ok := in.Parameters.(*HttpPayloadWithStructureInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NoInputAndOutputOutput") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithStructure") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -392,7 +378,7 @@ func (m *awsRestxml_serializeOpNoInputAndOutput) HandleSerialize(ctx context.Con request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} @@ -405,7 +391,7 @@ func (m *awsRestxml_serializeOpNoInputAndOutput) HandleSerialize(ctx context.Con return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsNoInputAndOutputInput(v *NoInputAndOutputInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpPayloadWithStructureInput(v *HttpPayloadWithStructureInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -413,14 +399,14 @@ func awsRestxml_serializeHttpBindingsNoInputAndOutputInput(v *NoInputAndOutputIn return nil } -type awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat struct { +type awsRestxml_serializeOpConstantQueryString struct { } -func (*awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) ID() string { +func (*awsRestxml_serializeOpConstantQueryString) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpConstantQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -428,13 +414,13 @@ func (m *awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) HandleSe return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpRequestWithLabelsAndTimestampFormatInput) + input, ok := in.Parameters.(*ConstantQueryStringInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}") + opPath, opQuery := httpbinding.SplitURI("/ConstantQueryString/{hello}?foo=bar&hello") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -448,7 +434,7 @@ func (m *awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) HandleSe return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsHttpRequestWithLabelsAndTimestampFormatInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsConstantQueryStringInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -459,49 +445,13 @@ func (m *awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) HandleSe return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpRequestWithLabelsAndTimestampFormatInput(v *HttpRequestWithLabelsAndTimestampFormatInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsConstantQueryStringInput(v *ConstantQueryStringInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.DefaultFormat != nil { - if err := encoder.SetURI("defaultFormat").String(smithytime.FormatDateTime(*v.DefaultFormat)); err != nil { - return err - } - } - - if v.MemberDateTime != nil { - if err := encoder.SetURI("memberDateTime").String(smithytime.FormatDateTime(*v.MemberDateTime)); err != nil { - return err - } - } - - if v.MemberEpochSeconds != nil { - if err := encoder.SetURI("memberEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)); err != nil { - return err - } - } - - if v.MemberHttpDate != nil { - if err := encoder.SetURI("memberHttpDate").String(smithytime.FormatHTTPDate(*v.MemberHttpDate)); err != nil { - return err - } - } - - if v.TargetDateTime != nil { - if err := encoder.SetURI("targetDateTime").String(smithytime.FormatDateTime(*v.TargetDateTime)); err != nil { - return err - } - } - - if v.TargetEpochSeconds != nil { - if err := encoder.SetURI("targetEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)); err != nil { - return err - } - } - - if v.TargetHttpDate != nil { - if err := encoder.SetURI("targetHttpDate").String(smithytime.FormatHTTPDate(*v.TargetHttpDate)); err != nil { + if v.Hello != nil { + if err := encoder.SetURI("hello").String(*v.Hello); err != nil { return err } } @@ -509,14 +459,14 @@ func awsRestxml_serializeHttpBindingsHttpRequestWithLabelsAndTimestampFormatInpu return nil } -type awsRestxml_serializeOpIgnoreQueryParamsInResponse struct { +type awsRestxml_serializeOpHttpPayloadTraits struct { } -func (*awsRestxml_serializeOpIgnoreQueryParamsInResponse) ID() string { +func (*awsRestxml_serializeOpHttpPayloadTraits) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpIgnoreQueryParamsInResponse) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -524,13 +474,13 @@ func (m *awsRestxml_serializeOpIgnoreQueryParamsInResponse) HandleSerialize(ctx return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*IgnoreQueryParamsInResponseInput) + input, ok := in.Parameters.(*HttpPayloadTraitsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/IgnoreQueryParamsInResponse") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraits") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -538,12 +488,16 @@ func (m *awsRestxml_serializeOpIgnoreQueryParamsInResponse) HandleSerialize(ctx request.URL.RawQuery = opQuery } - request.Method = "GET" + 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 err := awsRestxml_serializeHttpBindingsHttpPayloadTraitsInput(input, restEncoder); 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} } @@ -551,22 +505,28 @@ func (m *awsRestxml_serializeOpIgnoreQueryParamsInResponse) HandleSerialize(ctx return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsIgnoreQueryParamsInResponseInput(v *IgnoreQueryParamsInResponseInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpPayloadTraitsInput(v *HttpPayloadTraitsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Foo != nil { + if len(*v.Foo) > 0 { + encoder.SetHeader("X-Foo").String(*v.Foo) + } + } + return nil } -type awsRestxml_serializeOpXmlEnums struct { +type awsRestxml_serializeOpXmlTimestamps struct { } -func (*awsRestxml_serializeOpXmlEnums) ID() string { +func (*awsRestxml_serializeOpXmlTimestamps) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlTimestamps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -574,13 +534,13 @@ func (m *awsRestxml_serializeOpXmlEnums) HandleSerialize(ctx context.Context, in return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlEnumsInput) + input, ok := in.Parameters.(*XmlTimestampsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlEnums") + opPath, opQuery := httpbinding.SplitURI("/XmlTimestamps") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -588,7 +548,7 @@ func (m *awsRestxml_serializeOpXmlEnums) HandleSerialize(ctx context.Context, in request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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} @@ -601,7 +561,7 @@ func (m *awsRestxml_serializeOpXmlEnums) HandleSerialize(ctx context.Context, in return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlEnumsInput(v *XmlEnumsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlTimestampsInput(v *XmlTimestampsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -609,14 +569,14 @@ func awsRestxml_serializeHttpBindingsXmlEnumsInput(v *XmlEnumsInput, encoder *ht return nil } -type awsRestxml_serializeOpHttpPayloadWithXmlName struct { +type awsRestxml_serializeOpXmlAttributesOnPayload struct { } -func (*awsRestxml_serializeOpHttpPayloadWithXmlName) ID() string { +func (*awsRestxml_serializeOpXmlAttributesOnPayload) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpPayloadWithXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlAttributesOnPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -624,13 +584,13 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlName) HandleSerialize(ctx conte return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadWithXmlNameInput) + input, ok := in.Parameters.(*XmlAttributesOnPayloadInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlName") + opPath, opQuery := httpbinding.SplitURI("/XmlAttributesOnPayload") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -651,7 +611,7 @@ func (m *awsRestxml_serializeOpHttpPayloadWithXmlName) HandleSerialize(ctx conte return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNameInput(v *HttpPayloadWithXmlNameInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlAttributesOnPayloadInput(v *XmlAttributesOnPayloadInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -659,14 +619,14 @@ func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNameInput(v *HttpPayloadW return nil } -type awsRestxml_serializeOpHttpPayloadTraitsWithMediaType struct { +type awsRestxml_serializeOpEmptyInputAndEmptyOutput struct { } -func (*awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) ID() string { +func (*awsRestxml_serializeOpEmptyInputAndEmptyOutput) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpEmptyInputAndEmptyOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -674,13 +634,13 @@ func (m *awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(c return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadTraitsWithMediaTypeInput) + input, ok := in.Parameters.(*EmptyInputAndEmptyOutputInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraitsWithMediaType") + opPath, opQuery := httpbinding.SplitURI("/EmptyInputAndEmptyOutput") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -694,10 +654,6 @@ func (m *awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(c return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(input, restEncoder); 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} } @@ -705,28 +661,22 @@ func (m *awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(c return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(v *HttpPayloadTraitsWithMediaTypeInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsEmptyInputAndEmptyOutputInput(v *EmptyInputAndEmptyOutputInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Foo != nil { - if len(*v.Foo) > 0 { - encoder.SetHeader("X-Foo").String(*v.Foo) - } - } - return nil } -type awsRestxml_serializeOpNoInputAndNoOutput struct { +type awsRestxml_serializeOpHttpRequestWithLabels struct { } -func (*awsRestxml_serializeOpNoInputAndNoOutput) ID() string { +func (*awsRestxml_serializeOpHttpRequestWithLabels) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpRequestWithLabels) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -734,13 +684,13 @@ func (m *awsRestxml_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.C return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NoInputAndNoOutputInput) + input, ok := in.Parameters.(*HttpRequestWithLabelsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NoInputAndNoOutput") + opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabels/{string}/{short}/{integer}/{long}/{float}/{double}/{boolean}/{timestamp}") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -748,12 +698,16 @@ func (m *awsRestxml_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.C request.URL.RawQuery = opQuery } - request.Method = "POST" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestxml_serializeHttpBindingsHttpRequestWithLabelsInput(input, restEncoder); 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} } @@ -761,22 +715,70 @@ func (m *awsRestxml_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.C return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsNoInputAndNoOutputInput(v *NoInputAndNoOutputInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpRequestWithLabelsInput(v *HttpRequestWithLabelsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Boolean != nil { + if err := encoder.SetURI("boolean").Boolean(*v.Boolean); err != nil { + return err + } + } + + if v.Double != nil { + if err := encoder.SetURI("double").Double(*v.Double); err != nil { + return err + } + } + + if v.Float != nil { + if err := encoder.SetURI("float").Float(*v.Float); err != nil { + return err + } + } + + if v.Integer != nil { + if err := encoder.SetURI("integer").Integer(*v.Integer); err != nil { + return err + } + } + + if v.Long != nil { + if err := encoder.SetURI("long").Long(*v.Long); err != nil { + return err + } + } + + if v.Short != nil { + if err := encoder.SetURI("short").Short(*v.Short); err != nil { + return err + } + } + + if v.String_ != nil { + if err := encoder.SetURI("string").String(*v.String_); err != nil { + return err + } + } + + if v.Timestamp != nil { + if err := encoder.SetURI("timestamp").String(smithytime.FormatDateTime(*v.Timestamp)); err != nil { + return err + } + } + return nil } -type awsRestxml_serializeOpConstantAndVariableQueryString struct { +type awsRestxml_serializeOpNullAndEmptyHeadersClient struct { } -func (*awsRestxml_serializeOpConstantAndVariableQueryString) ID() string { +func (*awsRestxml_serializeOpNullAndEmptyHeadersClient) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpConstantAndVariableQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -784,13 +786,13 @@ func (m *awsRestxml_serializeOpConstantAndVariableQueryString) HandleSerialize(c return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*ConstantAndVariableQueryStringInput) + input, ok := in.Parameters.(*NullAndEmptyHeadersClientInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/ConstantAndVariableQueryString?foo=bar") + opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersClient") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -804,7 +806,7 @@ func (m *awsRestxml_serializeOpConstantAndVariableQueryString) HandleSerialize(c return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsConstantAndVariableQueryStringInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsNullAndEmptyHeadersClientInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -815,30 +817,42 @@ func (m *awsRestxml_serializeOpConstantAndVariableQueryString) HandleSerialize(c return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsConstantAndVariableQueryStringInput(v *ConstantAndVariableQueryStringInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsNullAndEmptyHeadersClientInput(v *NullAndEmptyHeadersClientInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Baz != nil { - encoder.SetQuery("baz").String(*v.Baz) + if v.A != nil { + if len(*v.A) > 0 { + encoder.SetHeader("X-A").String(*v.A) + } } - if v.MaybeSet != nil { - encoder.SetQuery("maybeSet").String(*v.MaybeSet) + if v.B != nil { + if len(*v.B) > 0 { + encoder.SetHeader("X-B").String(*v.B) + } + } + + if v.C != nil { + for i := range v.C { + if v.C[i] != nil && len(*v.C[i]) > 0 { + encoder.AddHeader("X-C").String(*v.C[i]) + } + } } return nil } -type awsRestxml_serializeOpEmptyInputAndEmptyOutput struct { +type awsRestxml_serializeOpXmlBlobs struct { } -func (*awsRestxml_serializeOpEmptyInputAndEmptyOutput) ID() string { +func (*awsRestxml_serializeOpXmlBlobs) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpEmptyInputAndEmptyOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlBlobs) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -846,13 +860,13 @@ func (m *awsRestxml_serializeOpEmptyInputAndEmptyOutput) HandleSerialize(ctx con return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*EmptyInputAndEmptyOutputInput) + input, ok := in.Parameters.(*XmlBlobsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/EmptyInputAndEmptyOutput") + opPath, opQuery := httpbinding.SplitURI("/XmlBlobs") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -873,7 +887,7 @@ func (m *awsRestxml_serializeOpEmptyInputAndEmptyOutput) HandleSerialize(ctx con return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsEmptyInputAndEmptyOutputInput(v *EmptyInputAndEmptyOutputInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlBlobsInput(v *XmlBlobsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -881,14 +895,14 @@ func awsRestxml_serializeHttpBindingsEmptyInputAndEmptyOutputInput(v *EmptyInput return nil } -type awsRestxml_serializeOpXmlAttributesOnPayload struct { +type awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix struct { } -func (*awsRestxml_serializeOpXmlAttributesOnPayload) ID() string { +func (*awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlAttributesOnPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespaceAndPrefix) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -896,13 +910,13 @@ func (m *awsRestxml_serializeOpXmlAttributesOnPayload) HandleSerialize(ctx conte return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlAttributesOnPayloadInput) + input, ok := in.Parameters.(*HttpPayloadWithXmlNamespaceAndPrefixInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlAttributesOnPayload") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlNamespaceAndPrefix") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -923,7 +937,7 @@ func (m *awsRestxml_serializeOpXmlAttributesOnPayload) HandleSerialize(ctx conte return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlAttributesOnPayloadInput(v *XmlAttributesOnPayloadInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNamespaceAndPrefixInput(v *HttpPayloadWithXmlNamespaceAndPrefixInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -931,14 +945,14 @@ func awsRestxml_serializeHttpBindingsXmlAttributesOnPayloadInput(v *XmlAttribute return nil } -type awsRestxml_serializeOpConstantQueryString struct { +type awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat struct { } -func (*awsRestxml_serializeOpConstantQueryString) ID() string { +func (*awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpConstantQueryString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpRequestWithLabelsAndTimestampFormat) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -946,13 +960,13 @@ func (m *awsRestxml_serializeOpConstantQueryString) HandleSerialize(ctx context. return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*ConstantQueryStringInput) + input, ok := in.Parameters.(*HttpRequestWithLabelsAndTimestampFormatInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/ConstantQueryString/{hello}?foo=bar&hello") + opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -966,7 +980,7 @@ func (m *awsRestxml_serializeOpConstantQueryString) HandleSerialize(ctx context. return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsConstantQueryStringInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsHttpRequestWithLabelsAndTimestampFormatInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -977,13 +991,49 @@ func (m *awsRestxml_serializeOpConstantQueryString) HandleSerialize(ctx context. return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsConstantQueryStringInput(v *ConstantQueryStringInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpRequestWithLabelsAndTimestampFormatInput(v *HttpRequestWithLabelsAndTimestampFormatInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Hello != nil { - if err := encoder.SetURI("hello").String(*v.Hello); err != nil { + if v.DefaultFormat != nil { + if err := encoder.SetURI("defaultFormat").String(smithytime.FormatDateTime(*v.DefaultFormat)); err != nil { + return err + } + } + + if v.MemberDateTime != nil { + if err := encoder.SetURI("memberDateTime").String(smithytime.FormatDateTime(*v.MemberDateTime)); err != nil { + return err + } + } + + if v.MemberEpochSeconds != nil { + if err := encoder.SetURI("memberEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)); err != nil { + return err + } + } + + if v.MemberHttpDate != nil { + if err := encoder.SetURI("memberHttpDate").String(smithytime.FormatHTTPDate(*v.MemberHttpDate)); err != nil { + return err + } + } + + if v.TargetDateTime != nil { + if err := encoder.SetURI("targetDateTime").String(smithytime.FormatDateTime(*v.TargetDateTime)); err != nil { + return err + } + } + + if v.TargetEpochSeconds != nil { + if err := encoder.SetURI("targetEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)); err != nil { + return err + } + } + + if v.TargetHttpDate != nil { + if err := encoder.SetURI("targetHttpDate").String(smithytime.FormatHTTPDate(*v.TargetHttpDate)); err != nil { return err } } @@ -991,14 +1041,14 @@ func awsRestxml_serializeHttpBindingsConstantQueryStringInput(v *ConstantQuerySt return nil } -type awsRestxml_serializeOpAllQueryStringTypes struct { +type awsRestxml_serializeOpInputAndOutputWithHeaders struct { } -func (*awsRestxml_serializeOpAllQueryStringTypes) ID() string { +func (*awsRestxml_serializeOpInputAndOutputWithHeaders) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpAllQueryStringTypes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpInputAndOutputWithHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1006,13 +1056,13 @@ func (m *awsRestxml_serializeOpAllQueryStringTypes) HandleSerialize(ctx context. return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*AllQueryStringTypesInput) + input, ok := in.Parameters.(*InputAndOutputWithHeadersInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/AllQueryStringTypesInput") + opPath, opQuery := httpbinding.SplitURI("/InputAndOutputWithHeaders") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1020,13 +1070,13 @@ func (m *awsRestxml_serializeOpAllQueryStringTypes) HandleSerialize(ctx context. request.URL.RawQuery = opQuery } - request.Method = "GET" + 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 err := awsRestxml_serializeHttpBindingsAllQueryStringTypesInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsInputAndOutputWithHeadersInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1037,131 +1087,112 @@ func (m *awsRestxml_serializeOpAllQueryStringTypes) HandleSerialize(ctx context. return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsAllQueryStringTypesInput(v *AllQueryStringTypesInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsInputAndOutputWithHeadersInput(v *InputAndOutputWithHeadersInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.QueryBoolean != nil { - encoder.SetQuery("Boolean").Boolean(*v.QueryBoolean) - } - - if v.QueryBooleanList != nil { - for i := range v.QueryBooleanList { - if v.QueryBooleanList[i] == nil { - continue + if v.HeaderBooleanList != nil { + for i := range v.HeaderBooleanList { + if v.HeaderBooleanList[i] != nil { + encoder.AddHeader("X-BooleanList").Boolean(*v.HeaderBooleanList[i]) } - encoder.AddQuery("BooleanList").Boolean(*v.QueryBooleanList[i]) } } - if v.QueryByte != nil { - encoder.SetQuery("Byte").Byte(*v.QueryByte) + if v.HeaderByte != nil { + encoder.SetHeader("X-Byte").Byte(*v.HeaderByte) } - if v.QueryDouble != nil { - encoder.SetQuery("Double").Double(*v.QueryDouble) - } - - if v.QueryDoubleList != nil { - for i := range v.QueryDoubleList { - if v.QueryDoubleList[i] == nil { - continue - } - encoder.AddQuery("DoubleList").Double(*v.QueryDoubleList[i]) - } + if v.HeaderDouble != nil { + encoder.SetHeader("X-Double").Double(*v.HeaderDouble) } - if len(v.QueryEnum) > 0 { - encoder.SetQuery("Enum").String(string(v.QueryEnum)) + if len(v.HeaderEnum) > 0 { + encoder.SetHeader("X-Enum").String(string(v.HeaderEnum)) } - if v.QueryEnumList != nil { - for i := range v.QueryEnumList { - encoder.AddQuery("EnumList").String(string(v.QueryEnumList[i])) + if v.HeaderEnumList != nil { + for i := range v.HeaderEnumList { + if len(v.HeaderEnumList[i]) > 0 { + encoder.AddHeader("X-EnumList").String(string(v.HeaderEnumList[i])) + } } } - if v.QueryFloat != nil { - encoder.SetQuery("Float").Float(*v.QueryFloat) + if v.HeaderFalseBool != nil { + encoder.SetHeader("X-Boolean2").Boolean(*v.HeaderFalseBool) } - if v.QueryInteger != nil { - encoder.SetQuery("Integer").Integer(*v.QueryInteger) + if v.HeaderFloat != nil { + encoder.SetHeader("X-Float").Float(*v.HeaderFloat) } - if v.QueryIntegerList != nil { - for i := range v.QueryIntegerList { - if v.QueryIntegerList[i] == nil { - continue - } - encoder.AddQuery("IntegerList").Integer(*v.QueryIntegerList[i]) - } + if v.HeaderInteger != nil { + encoder.SetHeader("X-Integer").Integer(*v.HeaderInteger) } - if v.QueryIntegerSet != nil { - for i := range v.QueryIntegerSet { - if v.QueryIntegerSet[i] == nil { - continue + if v.HeaderIntegerList != nil { + for i := range v.HeaderIntegerList { + if v.HeaderIntegerList[i] != nil { + encoder.AddHeader("X-IntegerList").Integer(*v.HeaderIntegerList[i]) } - encoder.AddQuery("IntegerSet").Integer(*v.QueryIntegerSet[i]) } } - if v.QueryLong != nil { - encoder.SetQuery("Long").Long(*v.QueryLong) + if v.HeaderLong != nil { + encoder.SetHeader("X-Long").Long(*v.HeaderLong) } - if v.QueryShort != nil { - encoder.SetQuery("Short").Short(*v.QueryShort) + if v.HeaderShort != nil { + encoder.SetHeader("X-Short").Short(*v.HeaderShort) } - if v.QueryString != nil { - encoder.SetQuery("String").String(*v.QueryString) + if v.HeaderString != nil { + if len(*v.HeaderString) > 0 { + encoder.SetHeader("X-String").String(*v.HeaderString) + } } - if v.QueryStringList != nil { - for i := range v.QueryStringList { - if v.QueryStringList[i] == nil { - continue + if v.HeaderStringList != nil { + for i := range v.HeaderStringList { + if v.HeaderStringList[i] != nil && len(*v.HeaderStringList[i]) > 0 { + encoder.AddHeader("X-StringList").String(*v.HeaderStringList[i]) } - encoder.AddQuery("StringList").String(*v.QueryStringList[i]) } } - if v.QueryStringSet != nil { - for i := range v.QueryStringSet { - if v.QueryStringSet[i] == nil { - continue + if v.HeaderStringSet != nil { + for i := range v.HeaderStringSet { + if v.HeaderStringSet[i] != nil && len(*v.HeaderStringSet[i]) > 0 { + encoder.AddHeader("X-StringSet").String(*v.HeaderStringSet[i]) } - encoder.AddQuery("StringSet").String(*v.QueryStringSet[i]) } } - if v.QueryTimestamp != nil { - encoder.SetQuery("Timestamp").String(smithytime.FormatDateTime(*v.QueryTimestamp)) - } - - if v.QueryTimestampList != nil { - for i := range v.QueryTimestampList { - if v.QueryTimestampList[i] == nil { - continue + if v.HeaderTimestampList != nil { + for i := range v.HeaderTimestampList { + if v.HeaderTimestampList[i] != nil { + encoder.AddHeader("X-TimestampList").String(smithytime.FormatHTTPDate(*v.HeaderTimestampList[i])) } - encoder.AddQuery("TimestampList").String(smithytime.FormatDateTime(*v.QueryTimestampList[i])) } } + if v.HeaderTrueBool != nil { + encoder.SetHeader("X-Boolean1").Boolean(*v.HeaderTrueBool) + } + return nil } -type awsRestxml_serializeOpFlattenedXmlMap struct { +type awsRestxml_serializeOpNoInputAndOutput struct { } -func (*awsRestxml_serializeOpFlattenedXmlMap) ID() string { +func (*awsRestxml_serializeOpNoInputAndOutput) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpFlattenedXmlMap) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpNoInputAndOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1169,13 +1200,13 @@ func (m *awsRestxml_serializeOpFlattenedXmlMap) HandleSerialize(ctx context.Cont return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*FlattenedXmlMapInput) + input, ok := in.Parameters.(*NoInputAndOutputInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/FlattenedXmlMap") + opPath, opQuery := httpbinding.SplitURI("/NoInputAndOutputOutput") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1196,7 +1227,7 @@ func (m *awsRestxml_serializeOpFlattenedXmlMap) HandleSerialize(ctx context.Cont return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsFlattenedXmlMapInput(v *FlattenedXmlMapInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsNoInputAndOutputInput(v *NoInputAndOutputInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1204,14 +1235,14 @@ func awsRestxml_serializeHttpBindingsFlattenedXmlMapInput(v *FlattenedXmlMapInpu return nil } -type awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath struct { +type awsRestxml_serializeOpIgnoreQueryParamsInResponse struct { } -func (*awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) ID() string { +func (*awsRestxml_serializeOpIgnoreQueryParamsInResponse) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpIgnoreQueryParamsInResponse) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1219,13 +1250,13 @@ func (m *awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpRequestWithGreedyLabelInPathInput) + input, ok := in.Parameters.(*IgnoreQueryParamsInResponseInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpRequestWithGreedyLabelInPath/foo/{foo}/baz/{baz+}") + opPath, opQuery := httpbinding.SplitURI("/IgnoreQueryParamsInResponse") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1239,10 +1270,6 @@ func (m *awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(input, restEncoder); 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} } @@ -1250,34 +1277,22 @@ func (m *awsRestxml_serializeOpHttpRequestWithGreedyLabelInPath) HandleSerialize return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpRequestWithGreedyLabelInPathInput(v *HttpRequestWithGreedyLabelInPathInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsIgnoreQueryParamsInResponseInput(v *IgnoreQueryParamsInResponseInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Baz != nil { - if err := encoder.SetURI("baz").String(*v.Baz); err != nil { - return err - } - } - - if v.Foo != nil { - if err := encoder.SetURI("foo").String(*v.Foo); err != nil { - return err - } - } - return nil } -type awsRestxml_serializeOpQueryIdempotencyTokenAutoFill struct { +type awsRestxml_serializeOpXmlEnums struct { } -func (*awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) ID() string { +func (*awsRestxml_serializeOpXmlEnums) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1285,13 +1300,13 @@ func (m *awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) HandleSerialize(ct return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*QueryIdempotencyTokenAutoFillInput) + input, ok := in.Parameters.(*XmlEnumsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/QueryIdempotencyTokenAutoFill") + opPath, opQuery := httpbinding.SplitURI("/XmlEnums") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1299,16 +1314,12 @@ func (m *awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) HandleSerialize(ct request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} } - if err := awsRestxml_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(input, restEncoder); 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} } @@ -1316,26 +1327,22 @@ func (m *awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) HandleSerialize(ct return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(v *QueryIdempotencyTokenAutoFillInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlEnumsInput(v *XmlEnumsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Token != nil { - encoder.SetQuery("token").String(*v.Token) - } - return nil } -type awsRestxml_serializeOpNullAndEmptyHeadersClient struct { +type awsRestxml_serializeOpOmitsNullSerializesEmptyString struct { } -func (*awsRestxml_serializeOpNullAndEmptyHeadersClient) ID() string { +func (*awsRestxml_serializeOpOmitsNullSerializesEmptyString) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1343,13 +1350,13 @@ func (m *awsRestxml_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NullAndEmptyHeadersClientInput) + input, ok := in.Parameters.(*OmitsNullSerializesEmptyStringInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersClient") + opPath, opQuery := httpbinding.SplitURI("/OmitsNullSerializesEmptyString") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1363,7 +1370,7 @@ func (m *awsRestxml_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsNullAndEmptyHeadersClientInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1374,42 +1381,30 @@ func (m *awsRestxml_serializeOpNullAndEmptyHeadersClient) HandleSerialize(ctx co return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsNullAndEmptyHeadersClientInput(v *NullAndEmptyHeadersClientInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(v *OmitsNullSerializesEmptyStringInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.A != nil { - if len(*v.A) > 0 { - encoder.SetHeader("X-A").String(*v.A) - } - } - - if v.B != nil { - if len(*v.B) > 0 { - encoder.SetHeader("X-B").String(*v.B) - } + if v.EmptyString != nil { + encoder.SetQuery("Empty").String(*v.EmptyString) } - if v.C != nil { - for i := range v.C { - if v.C[i] != nil && len(*v.C[i]) > 0 { - encoder.AddHeader("X-C").String(*v.C[i]) - } - } + if v.NullValue != nil { + encoder.SetQuery("Null").String(*v.NullValue) } return nil } -type awsRestxml_serializeOpXmlLists struct { +type awsRestxml_serializeOpXmlNamespaces struct { } -func (*awsRestxml_serializeOpXmlLists) ID() string { +func (*awsRestxml_serializeOpXmlNamespaces) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlLists) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlNamespaces) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1417,13 +1412,13 @@ func (m *awsRestxml_serializeOpXmlLists) HandleSerialize(ctx context.Context, in return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlListsInput) + input, ok := in.Parameters.(*XmlNamespacesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlLists") + opPath, opQuery := httpbinding.SplitURI("/XmlNamespaces") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1431,7 +1426,7 @@ func (m *awsRestxml_serializeOpXmlLists) HandleSerialize(ctx context.Context, in request.URL.RawQuery = opQuery } - request.Method = "PUT" + 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} @@ -1444,7 +1439,7 @@ func (m *awsRestxml_serializeOpXmlLists) HandleSerialize(ctx context.Context, in return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlListsInput(v *XmlListsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlNamespacesInput(v *XmlNamespacesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1452,14 +1447,14 @@ func awsRestxml_serializeHttpBindingsXmlListsInput(v *XmlListsInput, encoder *ht return nil } -type awsRestxml_serializeOpSimpleScalarProperties struct { +type awsRestxml_serializeOpRecursiveShapes struct { } -func (*awsRestxml_serializeOpSimpleScalarProperties) ID() string { +func (*awsRestxml_serializeOpRecursiveShapes) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpSimpleScalarProperties) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpRecursiveShapes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1467,13 +1462,13 @@ func (m *awsRestxml_serializeOpSimpleScalarProperties) HandleSerialize(ctx conte return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*SimpleScalarPropertiesInput) + input, ok := in.Parameters.(*RecursiveShapesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/SimpleScalarProperties") + opPath, opQuery := httpbinding.SplitURI("/RecursiveShapes") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1487,10 +1482,6 @@ func (m *awsRestxml_serializeOpSimpleScalarProperties) HandleSerialize(ctx conte return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsSimpleScalarPropertiesInput(input, restEncoder); 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} } @@ -1498,28 +1489,22 @@ func (m *awsRestxml_serializeOpSimpleScalarProperties) HandleSerialize(ctx conte return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsSimpleScalarPropertiesInput(v *SimpleScalarPropertiesInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsRecursiveShapesInput(v *RecursiveShapesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Foo != nil { - if len(*v.Foo) > 0 { - encoder.SetHeader("X-Foo").String(*v.Foo) - } - } - return nil } -type awsRestxml_serializeOpInputAndOutputWithHeaders struct { +type awsRestxml_serializeOpXmlAttributes struct { } -func (*awsRestxml_serializeOpInputAndOutputWithHeaders) ID() string { +func (*awsRestxml_serializeOpXmlAttributes) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpInputAndOutputWithHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlAttributes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1527,13 +1512,13 @@ func (m *awsRestxml_serializeOpInputAndOutputWithHeaders) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*InputAndOutputWithHeadersInput) + input, ok := in.Parameters.(*XmlAttributesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/InputAndOutputWithHeaders") + opPath, opQuery := httpbinding.SplitURI("/XmlAttributes") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1541,16 +1526,12 @@ func (m *awsRestxml_serializeOpInputAndOutputWithHeaders) HandleSerialize(ctx co request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} } - if err := awsRestxml_serializeHttpBindingsInputAndOutputWithHeadersInput(input, restEncoder); 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} } @@ -1558,112 +1539,22 @@ func (m *awsRestxml_serializeOpInputAndOutputWithHeaders) HandleSerialize(ctx co return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsInputAndOutputWithHeadersInput(v *InputAndOutputWithHeadersInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlAttributesInput(v *XmlAttributesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.HeaderBooleanList != nil { - for i := range v.HeaderBooleanList { - if v.HeaderBooleanList[i] != nil { - encoder.AddHeader("X-BooleanList").Boolean(*v.HeaderBooleanList[i]) - } - } - } - - if v.HeaderByte != nil { - encoder.SetHeader("X-Byte").Byte(*v.HeaderByte) - } - - if v.HeaderDouble != nil { - encoder.SetHeader("X-Double").Double(*v.HeaderDouble) - } - - if len(v.HeaderEnum) > 0 { - encoder.SetHeader("X-Enum").String(string(v.HeaderEnum)) - } - - if v.HeaderEnumList != nil { - for i := range v.HeaderEnumList { - if len(v.HeaderEnumList[i]) > 0 { - encoder.AddHeader("X-EnumList").String(string(v.HeaderEnumList[i])) - } - } - } - - if v.HeaderFalseBool != nil { - encoder.SetHeader("X-Boolean2").Boolean(*v.HeaderFalseBool) - } - - if v.HeaderFloat != nil { - encoder.SetHeader("X-Float").Float(*v.HeaderFloat) - } - - if v.HeaderInteger != nil { - encoder.SetHeader("X-Integer").Integer(*v.HeaderInteger) - } - - if v.HeaderIntegerList != nil { - for i := range v.HeaderIntegerList { - if v.HeaderIntegerList[i] != nil { - encoder.AddHeader("X-IntegerList").Integer(*v.HeaderIntegerList[i]) - } - } - } - - if v.HeaderLong != nil { - encoder.SetHeader("X-Long").Long(*v.HeaderLong) - } - - if v.HeaderShort != nil { - encoder.SetHeader("X-Short").Short(*v.HeaderShort) - } - - if v.HeaderString != nil { - if len(*v.HeaderString) > 0 { - encoder.SetHeader("X-String").String(*v.HeaderString) - } - } - - if v.HeaderStringList != nil { - for i := range v.HeaderStringList { - if v.HeaderStringList[i] != nil && len(*v.HeaderStringList[i]) > 0 { - encoder.AddHeader("X-StringList").String(*v.HeaderStringList[i]) - } - } - } - - if v.HeaderStringSet != nil { - for i := range v.HeaderStringSet { - if v.HeaderStringSet[i] != nil && len(*v.HeaderStringSet[i]) > 0 { - encoder.AddHeader("X-StringSet").String(*v.HeaderStringSet[i]) - } - } - } - - if v.HeaderTimestampList != nil { - for i := range v.HeaderTimestampList { - if v.HeaderTimestampList[i] != nil { - encoder.AddHeader("X-TimestampList").String(smithytime.FormatHTTPDate(*v.HeaderTimestampList[i])) - } - } - } - - if v.HeaderTrueBool != nil { - encoder.SetHeader("X-Boolean1").Boolean(*v.HeaderTrueBool) - } - return nil } -type awsRestxml_serializeOpGreetingWithErrors struct { +type awsRestxml_serializeOpHttpPayloadWithXmlNamespace struct { } -func (*awsRestxml_serializeOpGreetingWithErrors) ID() string { +func (*awsRestxml_serializeOpHttpPayloadWithXmlNamespace) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpGreetingWithErrors) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpPayloadWithXmlNamespace) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1671,13 +1562,13 @@ func (m *awsRestxml_serializeOpGreetingWithErrors) HandleSerialize(ctx context.C return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*GreetingWithErrorsInput) + input, ok := in.Parameters.(*HttpPayloadWithXmlNamespaceInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/GreetingWithErrors") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlNamespace") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1698,7 +1589,7 @@ func (m *awsRestxml_serializeOpGreetingWithErrors) HandleSerialize(ctx context.C return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsGreetingWithErrorsInput(v *GreetingWithErrorsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNamespaceInput(v *HttpPayloadWithXmlNamespaceInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1706,14 +1597,14 @@ func awsRestxml_serializeHttpBindingsGreetingWithErrorsInput(v *GreetingWithErro return nil } -type awsRestxml_serializeOpOmitsNullSerializesEmptyString struct { +type awsRestxml_serializeOpHttpPrefixHeaders struct { } -func (*awsRestxml_serializeOpOmitsNullSerializesEmptyString) ID() string { +func (*awsRestxml_serializeOpHttpPrefixHeaders) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1721,13 +1612,13 @@ func (m *awsRestxml_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(c return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*OmitsNullSerializesEmptyStringInput) + input, ok := in.Parameters.(*HttpPrefixHeadersInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/OmitsNullSerializesEmptyString") + opPath, opQuery := httpbinding.SplitURI("/HttpPrefixHeaders") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1741,7 +1632,7 @@ func (m *awsRestxml_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(c return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsHttpPrefixHeadersInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1752,30 +1643,37 @@ func (m *awsRestxml_serializeOpOmitsNullSerializesEmptyString) HandleSerialize(c return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsOmitsNullSerializesEmptyStringInput(v *OmitsNullSerializesEmptyStringInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpPrefixHeadersInput(v *HttpPrefixHeadersInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.EmptyString != nil { - encoder.SetQuery("Empty").String(*v.EmptyString) + if v.Foo != nil { + if len(*v.Foo) > 0 { + encoder.SetHeader("X-Foo").String(*v.Foo) + } } - if v.NullValue != nil { - encoder.SetQuery("Null").String(*v.NullValue) + if v.FooMap != nil { + hv := encoder.Headers("X-Foo-") + for mapKey, mapVal := range v.FooMap { + if mapVal != nil && len(*mapVal) > 0 { + hv.AddHeader(mapKey).String(*mapVal) + } + } } return nil } -type awsRestxml_serializeOpTimestampFormatHeaders struct { +type awsRestxml_serializeOpNullAndEmptyHeadersServer struct { } -func (*awsRestxml_serializeOpTimestampFormatHeaders) ID() string { +func (*awsRestxml_serializeOpNullAndEmptyHeadersServer) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpTimestampFormatHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1783,13 +1681,13 @@ func (m *awsRestxml_serializeOpTimestampFormatHeaders) HandleSerialize(ctx conte return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*TimestampFormatHeadersInput) + input, ok := in.Parameters.(*NullAndEmptyHeadersServerInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/TimestampFormatHeaders") + opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersServer") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1797,13 +1695,13 @@ func (m *awsRestxml_serializeOpTimestampFormatHeaders) HandleSerialize(ctx conte request.URL.RawQuery = opQuery } - request.Method = "POST" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsTimestampFormatHeadersInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsNullAndEmptyHeadersServerInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -1814,50 +1712,42 @@ func (m *awsRestxml_serializeOpTimestampFormatHeaders) HandleSerialize(ctx conte return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsTimestampFormatHeadersInput(v *TimestampFormatHeadersInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsNullAndEmptyHeadersServerInput(v *NullAndEmptyHeadersServerInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.DefaultFormat != nil { - encoder.SetHeader("X-defaultFormat").String(smithytime.FormatHTTPDate(*v.DefaultFormat)) - } - - if v.MemberDateTime != nil { - encoder.SetHeader("X-memberDateTime").String(smithytime.FormatDateTime(*v.MemberDateTime)) - } - - if v.MemberEpochSeconds != nil { - encoder.SetHeader("X-memberEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)) - } - - if v.MemberHttpDate != nil { - encoder.SetHeader("X-memberHttpDate").String(smithytime.FormatHTTPDate(*v.MemberHttpDate)) - } - - if v.TargetDateTime != nil { - encoder.SetHeader("X-targetDateTime").String(smithytime.FormatDateTime(*v.TargetDateTime)) + if v.A != nil { + if len(*v.A) > 0 { + encoder.SetHeader("X-A").String(*v.A) + } } - if v.TargetEpochSeconds != nil { - encoder.SetHeader("X-targetEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)) + if v.B != nil { + if len(*v.B) > 0 { + encoder.SetHeader("X-B").String(*v.B) + } } - if v.TargetHttpDate != nil { - encoder.SetHeader("X-targetHttpDate").String(smithytime.FormatHTTPDate(*v.TargetHttpDate)) + if v.C != nil { + for i := range v.C { + if v.C[i] != nil && len(*v.C[i]) > 0 { + encoder.AddHeader("X-C").String(*v.C[i]) + } + } } return nil } -type awsRestxml_serializeOpXmlBlobs struct { +type awsRestxml_serializeOpXmlMaps struct { } -func (*awsRestxml_serializeOpXmlBlobs) ID() string { +func (*awsRestxml_serializeOpXmlMaps) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlBlobs) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpXmlMaps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1865,13 +1755,13 @@ func (m *awsRestxml_serializeOpXmlBlobs) HandleSerialize(ctx context.Context, in return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlBlobsInput) + input, ok := in.Parameters.(*XmlMapsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlBlobs") + opPath, opQuery := httpbinding.SplitURI("/XmlMaps") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1892,7 +1782,7 @@ func (m *awsRestxml_serializeOpXmlBlobs) HandleSerialize(ctx context.Context, in return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlBlobsInput(v *XmlBlobsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsXmlMapsInput(v *XmlMapsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -1900,14 +1790,14 @@ func awsRestxml_serializeHttpBindingsXmlBlobsInput(v *XmlBlobsInput, encoder *ht return nil } -type awsRestxml_serializeOpHttpPayloadWithStructure struct { +type awsRestxml_serializeOpAllQueryStringTypes struct { } -func (*awsRestxml_serializeOpHttpPayloadWithStructure) ID() string { +func (*awsRestxml_serializeOpAllQueryStringTypes) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpAllQueryStringTypes) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -1915,13 +1805,13 @@ func (m *awsRestxml_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx con return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadWithStructureInput) + input, ok := in.Parameters.(*AllQueryStringTypesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithStructure") + opPath, opQuery := httpbinding.SplitURI("/AllQueryStringTypesInput") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -1929,12 +1819,16 @@ func (m *awsRestxml_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx con request.URL.RawQuery = opQuery } - request.Method = "PUT" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestxml_serializeHttpBindingsAllQueryStringTypesInput(input, restEncoder); 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} } @@ -1942,11 +1836,120 @@ func (m *awsRestxml_serializeOpHttpPayloadWithStructure) HandleSerialize(ctx con return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpPayloadWithStructureInput(v *HttpPayloadWithStructureInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsAllQueryStringTypesInput(v *AllQueryStringTypesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.QueryBoolean != nil { + encoder.SetQuery("Boolean").Boolean(*v.QueryBoolean) + } + + if v.QueryBooleanList != nil { + for i := range v.QueryBooleanList { + if v.QueryBooleanList[i] == nil { + continue + } + encoder.AddQuery("BooleanList").Boolean(*v.QueryBooleanList[i]) + } + } + + if v.QueryByte != nil { + encoder.SetQuery("Byte").Byte(*v.QueryByte) + } + + if v.QueryDouble != nil { + encoder.SetQuery("Double").Double(*v.QueryDouble) + } + + if v.QueryDoubleList != nil { + for i := range v.QueryDoubleList { + if v.QueryDoubleList[i] == nil { + continue + } + encoder.AddQuery("DoubleList").Double(*v.QueryDoubleList[i]) + } + } + + if len(v.QueryEnum) > 0 { + encoder.SetQuery("Enum").String(string(v.QueryEnum)) + } + + if v.QueryEnumList != nil { + for i := range v.QueryEnumList { + encoder.AddQuery("EnumList").String(string(v.QueryEnumList[i])) + } + } + + if v.QueryFloat != nil { + encoder.SetQuery("Float").Float(*v.QueryFloat) + } + + if v.QueryInteger != nil { + encoder.SetQuery("Integer").Integer(*v.QueryInteger) + } + + if v.QueryIntegerList != nil { + for i := range v.QueryIntegerList { + if v.QueryIntegerList[i] == nil { + continue + } + encoder.AddQuery("IntegerList").Integer(*v.QueryIntegerList[i]) + } + } + + if v.QueryIntegerSet != nil { + for i := range v.QueryIntegerSet { + if v.QueryIntegerSet[i] == nil { + continue + } + encoder.AddQuery("IntegerSet").Integer(*v.QueryIntegerSet[i]) + } + } + + if v.QueryLong != nil { + encoder.SetQuery("Long").Long(*v.QueryLong) + } + + if v.QueryShort != nil { + encoder.SetQuery("Short").Short(*v.QueryShort) + } + + if v.QueryString != nil { + encoder.SetQuery("String").String(*v.QueryString) + } + + if v.QueryStringList != nil { + for i := range v.QueryStringList { + if v.QueryStringList[i] == nil { + continue + } + encoder.AddQuery("StringList").String(*v.QueryStringList[i]) + } + } + + if v.QueryStringSet != nil { + for i := range v.QueryStringSet { + if v.QueryStringSet[i] == nil { + continue + } + encoder.AddQuery("StringSet").String(*v.QueryStringSet[i]) + } + } + + if v.QueryTimestamp != nil { + encoder.SetQuery("Timestamp").String(smithytime.FormatDateTime(*v.QueryTimestamp)) + } + + if v.QueryTimestampList != nil { + for i := range v.QueryTimestampList { + if v.QueryTimestampList[i] == nil { + continue + } + encoder.AddQuery("TimestampList").String(smithytime.FormatDateTime(*v.QueryTimestampList[i])) + } + } + return nil } @@ -2000,14 +2003,14 @@ func awsRestxml_serializeHttpBindingsFlattenedXmlMapWithXmlNameInput(v *Flattene return nil } -type awsRestxml_serializeOpHttpPrefixHeaders struct { +type awsRestxml_serializeOpNoInputAndNoOutput struct { } -func (*awsRestxml_serializeOpHttpPrefixHeaders) ID() string { +func (*awsRestxml_serializeOpNoInputAndNoOutput) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpNoInputAndNoOutput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2015,13 +2018,13 @@ func (m *awsRestxml_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPrefixHeadersInput) + input, ok := in.Parameters.(*NoInputAndNoOutputInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPrefixHeaders") + opPath, opQuery := httpbinding.SplitURI("/NoInputAndNoOutput") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2029,16 +2032,12 @@ func (m *awsRestxml_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Co request.URL.RawQuery = opQuery } - request.Method = "GET" + 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 err := awsRestxml_serializeHttpBindingsHttpPrefixHeadersInput(input, restEncoder); 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} } @@ -2046,37 +2045,22 @@ func (m *awsRestxml_serializeOpHttpPrefixHeaders) HandleSerialize(ctx context.Co return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpPrefixHeadersInput(v *HttpPrefixHeadersInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsNoInputAndNoOutputInput(v *NoInputAndNoOutputInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Foo != nil { - if len(*v.Foo) > 0 { - encoder.SetHeader("X-Foo").String(*v.Foo) - } - } - - if v.FooMap != nil { - hv := encoder.Headers("X-Foo-") - for mapKey, mapVal := range v.FooMap { - if mapVal != nil && len(*mapVal) > 0 { - hv.AddHeader(mapKey).String(*mapVal) - } - } - } - return nil } -type awsRestxml_serializeOpNullAndEmptyHeadersServer struct { +type awsRestxml_serializeOpQueryIdempotencyTokenAutoFill struct { } -func (*awsRestxml_serializeOpNullAndEmptyHeadersServer) ID() string { +func (*awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpQueryIdempotencyTokenAutoFill) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2084,13 +2068,13 @@ func (m *awsRestxml_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*NullAndEmptyHeadersServerInput) + input, ok := in.Parameters.(*QueryIdempotencyTokenAutoFillInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/NullAndEmptyHeadersServer") + opPath, opQuery := httpbinding.SplitURI("/QueryIdempotencyTokenAutoFill") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2098,13 +2082,13 @@ func (m *awsRestxml_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx co request.URL.RawQuery = opQuery } - request.Method = "GET" + 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 err := awsRestxml_serializeHttpBindingsNullAndEmptyHeadersServerInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -2115,42 +2099,26 @@ func (m *awsRestxml_serializeOpNullAndEmptyHeadersServer) HandleSerialize(ctx co return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsNullAndEmptyHeadersServerInput(v *NullAndEmptyHeadersServerInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsQueryIdempotencyTokenAutoFillInput(v *QueryIdempotencyTokenAutoFillInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.A != nil { - if len(*v.A) > 0 { - encoder.SetHeader("X-A").String(*v.A) - } - } - - if v.B != nil { - if len(*v.B) > 0 { - encoder.SetHeader("X-B").String(*v.B) - } - } - - if v.C != nil { - for i := range v.C { - if v.C[i] != nil && len(*v.C[i]) > 0 { - encoder.AddHeader("X-C").String(*v.C[i]) - } - } + if v.Token != nil { + encoder.SetQuery("token").String(*v.Token) } return nil } -type awsRestxml_serializeOpHttpPayloadTraits struct { +type awsRestxml_serializeOpTimestampFormatHeaders struct { } -func (*awsRestxml_serializeOpHttpPayloadTraits) ID() string { +func (*awsRestxml_serializeOpTimestampFormatHeaders) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpTimestampFormatHeaders) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2158,13 +2126,13 @@ func (m *awsRestxml_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*HttpPayloadTraitsInput) + input, ok := in.Parameters.(*TimestampFormatHeadersInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraits") + opPath, opQuery := httpbinding.SplitURI("/TimestampFormatHeaders") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2178,7 +2146,7 @@ func (m *awsRestxml_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Co return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestxml_serializeHttpBindingsHttpPayloadTraitsInput(input, restEncoder); err != nil { + if err := awsRestxml_serializeHttpBindingsTimestampFormatHeadersInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -2189,28 +2157,50 @@ func (m *awsRestxml_serializeOpHttpPayloadTraits) HandleSerialize(ctx context.Co return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsHttpPayloadTraitsInput(v *HttpPayloadTraitsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsTimestampFormatHeadersInput(v *TimestampFormatHeadersInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Foo != nil { - if len(*v.Foo) > 0 { - encoder.SetHeader("X-Foo").String(*v.Foo) - } + if v.DefaultFormat != nil { + encoder.SetHeader("X-defaultFormat").String(smithytime.FormatHTTPDate(*v.DefaultFormat)) + } + + if v.MemberDateTime != nil { + encoder.SetHeader("X-memberDateTime").String(smithytime.FormatDateTime(*v.MemberDateTime)) + } + + if v.MemberEpochSeconds != nil { + encoder.SetHeader("X-memberEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.MemberEpochSeconds)) + } + + if v.MemberHttpDate != nil { + encoder.SetHeader("X-memberHttpDate").String(smithytime.FormatHTTPDate(*v.MemberHttpDate)) + } + + if v.TargetDateTime != nil { + encoder.SetHeader("X-targetDateTime").String(smithytime.FormatDateTime(*v.TargetDateTime)) + } + + if v.TargetEpochSeconds != nil { + encoder.SetHeader("X-targetEpochSeconds").Double(smithytime.FormatEpochSeconds(*v.TargetEpochSeconds)) + } + + if v.TargetHttpDate != nil { + encoder.SetHeader("X-targetHttpDate").String(smithytime.FormatHTTPDate(*v.TargetHttpDate)) } return nil } -type awsRestxml_serializeOpXmlMaps struct { +type awsRestxml_serializeOpGreetingWithErrors struct { } -func (*awsRestxml_serializeOpXmlMaps) ID() string { +func (*awsRestxml_serializeOpGreetingWithErrors) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlMaps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpGreetingWithErrors) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2218,13 +2208,13 @@ func (m *awsRestxml_serializeOpXmlMaps) HandleSerialize(ctx context.Context, in return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlMapsInput) + input, ok := in.Parameters.(*GreetingWithErrorsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlMaps") + opPath, opQuery := httpbinding.SplitURI("/GreetingWithErrors") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2232,7 +2222,7 @@ func (m *awsRestxml_serializeOpXmlMaps) HandleSerialize(ctx context.Context, in request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} @@ -2245,7 +2235,7 @@ func (m *awsRestxml_serializeOpXmlMaps) HandleSerialize(ctx context.Context, in return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlMapsInput(v *XmlMapsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsGreetingWithErrorsInput(v *GreetingWithErrorsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -2253,14 +2243,14 @@ func awsRestxml_serializeHttpBindingsXmlMapsInput(v *XmlMapsInput, encoder *http return nil } -type awsRestxml_serializeOpXmlTimestamps struct { +type awsRestxml_serializeOpHttpPayloadWithXmlName struct { } -func (*awsRestxml_serializeOpXmlTimestamps) ID() string { +func (*awsRestxml_serializeOpHttpPayloadWithXmlName) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlTimestamps) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpPayloadWithXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2268,13 +2258,13 @@ func (m *awsRestxml_serializeOpXmlTimestamps) HandleSerialize(ctx context.Contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlTimestampsInput) + input, ok := in.Parameters.(*HttpPayloadWithXmlNameInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlTimestamps") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadWithXmlName") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2282,7 +2272,7 @@ func (m *awsRestxml_serializeOpXmlTimestamps) HandleSerialize(ctx context.Contex request.URL.RawQuery = opQuery } - request.Method = "POST" + 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} @@ -2295,7 +2285,7 @@ func (m *awsRestxml_serializeOpXmlTimestamps) HandleSerialize(ctx context.Contex return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlTimestampsInput(v *XmlTimestampsInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpPayloadWithXmlNameInput(v *HttpPayloadWithXmlNameInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -2303,14 +2293,14 @@ func awsRestxml_serializeHttpBindingsXmlTimestampsInput(v *XmlTimestampsInput, e return nil } -type awsRestxml_serializeOpXmlMapsXmlName struct { +type awsRestxml_serializeOpHttpPayloadTraitsWithMediaType struct { } -func (*awsRestxml_serializeOpXmlMapsXmlName) ID() string { +func (*awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) ID() string { return "OperationSerializer" } -func (m *awsRestxml_serializeOpXmlMapsXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestxml_serializeOpHttpPayloadTraitsWithMediaType) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -2318,13 +2308,13 @@ func (m *awsRestxml_serializeOpXmlMapsXmlName) HandleSerialize(ctx context.Conte return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*XmlMapsXmlNameInput) + input, ok := in.Parameters.(*HttpPayloadTraitsWithMediaTypeInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/XmlMapsXmlName") + opPath, opQuery := httpbinding.SplitURI("/HttpPayloadTraitsWithMediaType") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -2338,6 +2328,10 @@ func (m *awsRestxml_serializeOpXmlMapsXmlName) HandleSerialize(ctx context.Conte return out, metadata, &smithy.SerializationError{Err: err} } + if err := awsRestxml_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(input, restEncoder); 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} } @@ -2345,10 +2339,16 @@ func (m *awsRestxml_serializeOpXmlMapsXmlName) HandleSerialize(ctx context.Conte return next.HandleSerialize(ctx, in) } -func awsRestxml_serializeHttpBindingsXmlMapsXmlNameInput(v *XmlMapsXmlNameInput, encoder *httpbinding.Encoder) error { +func awsRestxml_serializeHttpBindingsHttpPayloadTraitsWithMediaTypeInput(v *HttpPayloadTraitsWithMediaTypeInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Foo != nil { + if len(*v.Foo) > 0 { + encoder.SetHeader("X-Foo").String(*v.Foo) + } + } + return nil } diff --git a/service/lexruntimeservice/api_op_DeleteSession.go b/service/lexruntimeservice/api_op_DeleteSession.go index 7e9ff8016e2..320f0ebc234 100644 --- a/service/lexruntimeservice/api_op_DeleteSession.go +++ b/service/lexruntimeservice/api_op_DeleteSession.go @@ -19,6 +19,7 @@ func (c *Client) DeleteSession(ctx context.Context, params *DeleteSessionInput, fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/service/lexruntimeservice/api_op_GetSession.go b/service/lexruntimeservice/api_op_GetSession.go index f9bf7af3d53..a58ceb66667 100644 --- a/service/lexruntimeservice/api_op_GetSession.go +++ b/service/lexruntimeservice/api_op_GetSession.go @@ -20,6 +20,7 @@ func (c *Client) GetSession(ctx context.Context, params *GetSessionInput, optFns fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/service/lexruntimeservice/api_op_PostContent.go b/service/lexruntimeservice/api_op_PostContent.go index 41e75e23307..0f30711d267 100644 --- a/service/lexruntimeservice/api_op_PostContent.go +++ b/service/lexruntimeservice/api_op_PostContent.go @@ -77,6 +77,7 @@ func (c *Client) PostContent(ctx context.Context, params *PostContentInput, optF fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddUnsignedPayloadMiddleware(stack) v4.AddContentSHA256HeaderMiddleware(stack) diff --git a/service/lexruntimeservice/api_op_PostText.go b/service/lexruntimeservice/api_op_PostText.go index 959878c7e48..fe90d0a68cb 100644 --- a/service/lexruntimeservice/api_op_PostText.go +++ b/service/lexruntimeservice/api_op_PostText.go @@ -62,6 +62,7 @@ func (c *Client) PostText(ctx context.Context, params *PostTextInput, optFns ... fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/service/lexruntimeservice/api_op_PutSession.go b/service/lexruntimeservice/api_op_PutSession.go index f7603d2b2f1..2428358332b 100644 --- a/service/lexruntimeservice/api_op_PutSession.go +++ b/service/lexruntimeservice/api_op_PutSession.go @@ -24,6 +24,7 @@ func (c *Client) PutSession(ctx context.Context, params *PutSessionInput, optFns fn(&options) } awsmiddleware.AddRequestInvocationIDMiddleware(stack) + smithyhttp.AddContentLengthMiddleware(stack) awsmiddleware.AddResolveServiceEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) retry.AddRetryMiddlewares(stack, options) diff --git a/service/lexruntimeservice/deserializers.go b/service/lexruntimeservice/deserializers.go index bac83b81ee0..0d900a9aa8c 100644 --- a/service/lexruntimeservice/deserializers.go +++ b/service/lexruntimeservice/deserializers.go @@ -332,14 +332,14 @@ func awsRestjson1_deserializeDocumentPutSessionOutput(v *PutSessionOutput, body return nil } -type awsRestjson1_deserializeOpDeleteSession struct { +type awsRestjson1_deserializeOpPostContent struct { } -func (*awsRestjson1_deserializeOpDeleteSession) ID() string { +func (*awsRestjson1_deserializeOpPostContent) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpDeleteSession) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpPostContent) 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) @@ -393,8 +393,20 @@ func (m *awsRestjson1_deserializeOpDeleteSession) HandleDeserialize(ctx context. errorType = "InternalFailureException" case 429: errorType = "LimitExceededException" + case 406: + errorType = "NotAcceptableException" case 404: errorType = "NotFoundException" + case 408: + errorType = "RequestTimeoutException" + case 415: + errorType = "UnsupportedMediaTypeException" + case 502: + errorType = "BadGatewayException" + case 424: + errorType = "DependencyFailedException" + case 508: + errorType = "LoopDetectedException" } } @@ -479,12 +491,12 @@ func (m *awsRestjson1_deserializeOpDeleteSession) HandleDeserialize(ctx context. return out, metadata, errResult } - if errorType == "NotFoundException" { - errResult := &types.NotFoundException{} + if errorType == "NotAcceptableException" { + errResult := &types.NotAcceptableException{} output := errResult _ = output - err = awsRestjson1_deserializeDocumentNotFoundException(&output, decoder) + err = awsRestjson1_deserializeDocumentNotAcceptableException(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -496,229 +508,46 @@ func (m *awsRestjson1_deserializeOpDeleteSession) HandleDeserialize(ctx context. return out, metadata, errResult } - if len(errorMessage) != 0 { - genericError := &smithy.GenericAPIError{ - Code: errorType, - Message: errorMessage, - } - - return out, metadata, genericError - } - - genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: err} - } - - return out, metadata, genericError - } - - output := &DeleteSessionOutput{} - out.Result = output - - buff := make([]byte, 1024) - ringBuffer := smithyio.NewRingBuffer(buff) - - body := io.TeeReader(response.Body, ringBuffer) - defer response.Body.Close() - - decoder := json.NewDecoder(body) - decoder.UseNumber() - - err = awsRestjson1_deserializeDocumentDeleteSessionOutput(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - - return out, metadata, err -} - -func awsRestjson1_deserializeDocumentDeleteSessionOutput(v **DeleteSessionOutput, decoder *json.Decoder) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - startToken, err := decoder.Token() - if err == io.EOF { - return nil - } - if err != nil { - return err - } - if startToken == nil { - return nil - } - if t, ok := startToken.(json.Delim); !ok || t != '{' { - return fmt.Errorf("expect `{` as start token") - } - - var sv *DeleteSessionOutput - if *v == nil { - sv = &DeleteSessionOutput{} - } else { - sv = *v - } - - for decoder.More() { - t, err := decoder.Token() - if err != nil { - return err - } - switch t { - case "botAlias": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected BotAlias to be of type string, got %T instead", val) - } - sv.BotAlias = &jtv - } - - case "botName": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected BotName to be of type string, got %T instead", val) - } - sv.BotName = &jtv - } - - case "sessionId": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", val) - } - sv.SessionId = &jtv - } + if errorType == "NotFoundException" { + errResult := &types.NotFoundException{} + output := errResult + _ = output - case "userId": - val, err := decoder.Token() + err = awsRestjson1_deserializeDocumentNotFoundException(&output, decoder) if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected UserId to be of type string, got %T instead", val) + 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(), } - sv.UserId = &jtv - } - - default: - err := restjson.DiscardUnknownField(decoder) - if err != nil { - return err } - - } - } - endToken, err := decoder.Token() - if err != nil { - return err - } - if t, ok := endToken.(json.Delim); !ok || t != '}' { - return fmt.Errorf("expect `}` as end token") - } - - *v = sv - return nil -} - -type awsRestjson1_deserializeOpGetSession struct { -} - -func (*awsRestjson1_deserializeOpGetSession) ID() string { - return "OperationDeserializer" -} - -func (m *awsRestjson1_deserializeOpGetSession) 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 { - errorType := response.Header.Get("X-Amzn-Errortype") - errorType = restjson.SanitizeErrorCode(errorType) - - buff := make([]byte, 1024) - ringBuffer := smithyio.NewRingBuffer(buff) - - var errorBuffer bytes.Buffer - defer response.Body.Close() - _, err := io.Copy(&errorBuffer, response.Body) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + return out, metadata, errResult } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - decoder := json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) - decoder.UseNumber() + if errorType == "RequestTimeoutException" { + errResult := &types.RequestTimeoutException{} + output := errResult + _ = output - var errorMessage string - if len(errorType) == 0 { - errorType, errorMessage, err = restjson.GetErrorInfo(decoder) + err = awsRestjson1_deserializeDocumentRequestTimeoutException(&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 error with invalid JSON, %w", err), + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), Snapshot: snapshot.Bytes(), } } + return out, metadata, errResult } - if len(errorType) == 0 { - switch response.StatusCode { - case 400: - errorType = "BadRequestException" - case 500: - errorType = "InternalFailureException" - case 429: - errorType = "LimitExceededException" - case 404: - errorType = "NotFoundException" - } - } - - // reset the ring buffer - ringBuffer.Reset() - // seek start of error body - errorBody.Seek(0, io.SeekStart) - - decoder = json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) - decoder.UseNumber() - - if errorType == "BadRequestException" { - errResult := &types.BadRequestException{} + if errorType == "UnsupportedMediaTypeException" { + errResult := &types.UnsupportedMediaTypeException{} output := errResult _ = output - err = awsRestjson1_deserializeDocumentBadRequestException(&output, decoder) + err = awsRestjson1_deserializeDocumentUnsupportedMediaTypeException(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -730,12 +559,12 @@ func (m *awsRestjson1_deserializeOpGetSession) HandleDeserialize(ctx context.Con return out, metadata, errResult } - if errorType == "InternalFailureException" { - errResult := &types.InternalFailureException{} + if errorType == "BadGatewayException" { + errResult := &types.BadGatewayException{} output := errResult _ = output - err = awsRestjson1_deserializeDocumentInternalFailureException(&output, decoder) + err = awsRestjson1_deserializeDocumentBadGatewayException(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -747,17 +576,12 @@ func (m *awsRestjson1_deserializeOpGetSession) HandleDeserialize(ctx context.Con return out, metadata, errResult } - if errorType == "LimitExceededException" { - errResult := &types.LimitExceededException{} + if errorType == "DependencyFailedException" { + errResult := &types.DependencyFailedException{} output := errResult _ = output - err = awsRestjson1_deserializeHttpBindingsLimitExceededException(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid Http bindings, %w", err)} - } - - err = awsRestjson1_deserializeDocumentLimitExceededException(&output, decoder) + err = awsRestjson1_deserializeDocumentDependencyFailedException(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -769,12 +593,12 @@ func (m *awsRestjson1_deserializeOpGetSession) HandleDeserialize(ctx context.Con return out, metadata, errResult } - if errorType == "NotFoundException" { - errResult := &types.NotFoundException{} + if errorType == "LoopDetectedException" { + errResult := &types.LoopDetectedException{} output := errResult _ = output - err = awsRestjson1_deserializeDocumentNotFoundException(&output, decoder) + err = awsRestjson1_deserializeDocumentLoopDetectedException(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -803,118 +627,101 @@ func (m *awsRestjson1_deserializeOpGetSession) HandleDeserialize(ctx context.Con return out, metadata, genericError } - output := &GetSessionOutput{} + output := &PostContentOutput{} out.Result = output - buff := make([]byte, 1024) - ringBuffer := smithyio.NewRingBuffer(buff) - - body := io.TeeReader(response.Body, ringBuffer) - defer response.Body.Close() - - decoder := json.NewDecoder(body) - decoder.UseNumber() + err = awsRestjson1_deserializeHttpBindingsPostContentOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } - err = awsRestjson1_deserializeDocumentGetSessionOutput(&output, decoder) + err = awsRestjson1_deserializeDocumentPostContentOutput(output, response.Body) 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, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} } return out, metadata, err } -func awsRestjson1_deserializeDocumentGetSessionOutput(v **GetSessionOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeHttpBindingsPostContentOutput(v *PostContentOutput, response *smithyhttp.Response) error { if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - startToken, err := decoder.Token() - if err == io.EOF { - return nil + return fmt.Errorf("unsupported deserialization for nil %T", v) } - if err != nil { - return err + + if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.ContentType = ptr.String(headerValues[0]) } - if startToken == nil { - return nil + + if headerValues := response.Header.Values("x-amz-lex-dialog-state"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.DialogState = types.DialogState(headerValues[0]) } - if t, ok := startToken.(json.Delim); !ok || t != '{' { - return fmt.Errorf("expect `{` as start token") + + if headerValues := response.Header.Values("x-amz-lex-input-transcript"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.InputTranscript = ptr.String(headerValues[0]) } - var sv *GetSessionOutput - if *v == nil { - sv = &GetSessionOutput{} - } else { - sv = *v + if headerValues := response.Header.Values("x-amz-lex-intent-name"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.IntentName = ptr.String(headerValues[0]) } - for decoder.More() { - t, err := decoder.Token() - if err != nil { - return err - } - switch t { - case "dialogAction": - if err := awsRestjson1_deserializeDocumentDialogAction(&sv.DialogAction, decoder); err != nil { - return err - } + if headerValues := response.Header.Values("x-amz-lex-message"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Message = ptr.String(headerValues[0]) + } - case "recentIntentSummaryView": - if err := awsRestjson1_deserializeDocumentIntentSummaryList(&sv.RecentIntentSummaryView, decoder); err != nil { - return err - } + if headerValues := response.Header.Values("x-amz-lex-message-format"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.MessageFormat = types.MessageFormatType(headerValues[0]) + } - case "sessionAttributes": - if err := awsRestjson1_deserializeDocumentStringMap(&sv.SessionAttributes, decoder); err != nil { - return err - } + if headerValues := response.Header.Values("x-amz-lex-sentiment"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.SentimentResponse = ptr.String(headerValues[0]) + } - case "sessionId": - val, err := decoder.Token() - if err != nil { - return err - } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", val) - } - sv.SessionId = &jtv - } + if headerValues := response.Header.Values("x-amz-lex-session-attributes"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.SessionAttributes = ptr.String(headerValues[0]) + } - default: - err := restjson.DiscardUnknownField(decoder) - if err != nil { - return err - } + if headerValues := response.Header.Values("x-amz-lex-session-id"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.SessionId = ptr.String(headerValues[0]) + } - } + if headerValues := response.Header.Values("x-amz-lex-slot-to-elicit"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.SlotToElicit = ptr.String(headerValues[0]) } - endToken, err := decoder.Token() - if err != nil { - return err + + if headerValues := response.Header.Values("x-amz-lex-slots"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.Slots = ptr.String(headerValues[0]) } - if t, ok := endToken.(json.Delim); !ok || t != '}' { - return fmt.Errorf("expect `}` as end token") + + return nil +} +func awsRestjson1_deserializeDocumentPostContentOutput(v *PostContentOutput, body io.ReadCloser) error { + if v == nil { + return fmt.Errorf("unsupported deserialization of nil %T", v) } - *v = sv + v.AudioStream = body return nil } -type awsRestjson1_deserializeOpPostText struct { +type awsRestjson1_deserializeOpDeleteSession struct { } -func (*awsRestjson1_deserializeOpPostText) ID() string { +func (*awsRestjson1_deserializeOpDeleteSession) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpPostText) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpDeleteSession) 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) @@ -970,12 +777,6 @@ func (m *awsRestjson1_deserializeOpPostText) HandleDeserialize(ctx context.Conte errorType = "LimitExceededException" case 404: errorType = "NotFoundException" - case 502: - errorType = "BadGatewayException" - case 424: - errorType = "DependencyFailedException" - case 508: - errorType = "LoopDetectedException" } } @@ -1077,57 +878,6 @@ func (m *awsRestjson1_deserializeOpPostText) HandleDeserialize(ctx context.Conte return out, metadata, errResult } - if errorType == "BadGatewayException" { - errResult := &types.BadGatewayException{} - output := errResult - _ = output - - err = awsRestjson1_deserializeDocumentBadGatewayException(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - - if errorType == "DependencyFailedException" { - errResult := &types.DependencyFailedException{} - output := errResult - _ = output - - err = awsRestjson1_deserializeDocumentDependencyFailedException(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - - if errorType == "LoopDetectedException" { - errResult := &types.LoopDetectedException{} - output := errResult - _ = output - - err = awsRestjson1_deserializeDocumentLoopDetectedException(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - if len(errorMessage) != 0 { genericError := &smithy.GenericAPIError{ Code: errorType, @@ -1145,7 +895,7 @@ func (m *awsRestjson1_deserializeOpPostText) HandleDeserialize(ctx context.Conte return out, metadata, genericError } - output := &PostTextOutput{} + output := &DeleteSessionOutput{} out.Result = output buff := make([]byte, 1024) @@ -1157,7 +907,7 @@ func (m *awsRestjson1_deserializeOpPostText) HandleDeserialize(ctx context.Conte decoder := json.NewDecoder(body) decoder.UseNumber() - err = awsRestjson1_deserializeDocumentPostTextOutput(&output, decoder) + err = awsRestjson1_deserializeDocumentDeleteSessionOutput(&output, decoder) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -1170,7 +920,7 @@ func (m *awsRestjson1_deserializeOpPostText) HandleDeserialize(ctx context.Conte return out, metadata, err } -func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder *json.Decoder) error { +func awsRestjson1_deserializeDocumentDeleteSessionOutput(v **DeleteSessionOutput, decoder *json.Decoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -1188,9 +938,9 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder return fmt.Errorf("expect `{` as start token") } - var sv *PostTextOutput + var sv *DeleteSessionOutput if *v == nil { - sv = &PostTextOutput{} + sv = &DeleteSessionOutput{} } else { sv = *v } @@ -1201,7 +951,7 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder return err } switch t { - case "dialogState": + case "botAlias": val, err := decoder.Token() if err != nil { return err @@ -1209,12 +959,12 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder if val != nil { jtv, ok := val.(string) if !ok { - return fmt.Errorf("expected DialogState to be of type string, got %T instead", val) + return fmt.Errorf("expected BotAlias to be of type string, got %T instead", val) } - sv.DialogState = types.DialogState(jtv) + sv.BotAlias = &jtv } - case "intentName": + case "botName": val, err := decoder.Token() if err != nil { return err @@ -1222,12 +972,12 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder if val != nil { jtv, ok := val.(string) if !ok { - return fmt.Errorf("expected IntentName to be of type string, got %T instead", val) + return fmt.Errorf("expected BotName to be of type string, got %T instead", val) } - sv.IntentName = &jtv + sv.BotName = &jtv } - case "message": + case "sessionId": val, err := decoder.Token() if err != nil { return err @@ -1235,12 +985,12 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder if val != nil { jtv, ok := val.(string) if !ok { - return fmt.Errorf("expected Text to be of type string, got %T instead", val) + return fmt.Errorf("expected String to be of type string, got %T instead", val) } - sv.Message = &jtv + sv.SessionId = &jtv } - case "messageFormat": + case "userId": val, err := decoder.Token() if err != nil { return err @@ -1248,45 +998,265 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder if val != nil { jtv, ok := val.(string) if !ok { - return fmt.Errorf("expected MessageFormatType to be of type string, got %T instead", val) + return fmt.Errorf("expected UserId to be of type string, got %T instead", val) } - sv.MessageFormat = types.MessageFormatType(jtv) - } - - case "responseCard": - if err := awsRestjson1_deserializeDocumentResponseCard(&sv.ResponseCard, decoder); err != nil { - return err + sv.UserId = &jtv } - case "sentimentResponse": - if err := awsRestjson1_deserializeDocumentSentimentResponse(&sv.SentimentResponse, decoder); err != nil { + default: + err := restjson.DiscardUnknownField(decoder) + if err != nil { return err } - case "sessionAttributes": - if err := awsRestjson1_deserializeDocumentStringMap(&sv.SessionAttributes, decoder); err != nil { - return err + } + } + endToken, err := decoder.Token() + if err != nil { + return err + } + if t, ok := endToken.(json.Delim); !ok || t != '}' { + return fmt.Errorf("expect `}` as end token") + } + + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetSession struct { +} + +func (*awsRestjson1_deserializeOpGetSession) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetSession) 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 { + errorType := response.Header.Get("X-Amzn-Errortype") + errorType = restjson.SanitizeErrorCode(errorType) + + buff := make([]byte, 1024) + ringBuffer := smithyio.NewRingBuffer(buff) + + var errorBuffer bytes.Buffer + defer response.Body.Close() + _, err := io.Copy(&errorBuffer, response.Body) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + + errorBody := bytes.NewReader(errorBuffer.Bytes()) + decoder := json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) + decoder.UseNumber() + + var errorMessage string + if len(errorType) == 0 { + errorType, errorMessage, err = restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response error with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } } + } - case "sessionId": - val, err := decoder.Token() + if len(errorType) == 0 { + switch response.StatusCode { + case 400: + errorType = "BadRequestException" + case 500: + errorType = "InternalFailureException" + case 429: + errorType = "LimitExceededException" + case 404: + errorType = "NotFoundException" + } + } + + // reset the ring buffer + ringBuffer.Reset() + // seek start of error body + errorBody.Seek(0, io.SeekStart) + + decoder = json.NewDecoder(io.TeeReader(errorBody, ringBuffer)) + decoder.UseNumber() + + if errorType == "BadRequestException" { + errResult := &types.BadRequestException{} + output := errResult + _ = output + + err = awsRestjson1_deserializeDocumentBadRequestException(&output, decoder) if err != nil { - return err + 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(), + } } - if val != nil { - jtv, ok := val.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", val) + return out, metadata, errResult + } + + if errorType == "InternalFailureException" { + errResult := &types.InternalFailureException{} + output := errResult + _ = output + + err = awsRestjson1_deserializeDocumentInternalFailureException(&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 with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), } - sv.SessionId = &jtv } + return out, metadata, errResult + } - case "slots": - if err := awsRestjson1_deserializeDocumentStringMap(&sv.Slots, decoder); err != nil { + if errorType == "LimitExceededException" { + errResult := &types.LimitExceededException{} + output := errResult + _ = output + + err = awsRestjson1_deserializeHttpBindingsLimitExceededException(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid Http bindings, %w", err)} + } + + err = awsRestjson1_deserializeDocumentLimitExceededException(&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 with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + return out, metadata, errResult + } + + if errorType == "NotFoundException" { + errResult := &types.NotFoundException{} + output := errResult + _ = output + + err = awsRestjson1_deserializeDocumentNotFoundException(&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 with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + return out, metadata, errResult + } + + if len(errorMessage) != 0 { + genericError := &smithy.GenericAPIError{ + Code: errorType, + Message: errorMessage, + } + + return out, metadata, genericError + } + + genericError, err := restjson.GetSmithyGenericAPIError(decoder, errorType) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: err} + } + + return out, metadata, genericError + } + + output := &GetSessionOutput{} + out.Result = output + + buff := make([]byte, 1024) + ringBuffer := smithyio.NewRingBuffer(buff) + + body := io.TeeReader(response.Body, ringBuffer) + defer response.Body.Close() + + decoder := json.NewDecoder(body) + decoder.UseNumber() + + err = awsRestjson1_deserializeDocumentGetSessionOutput(&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 with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeDocumentGetSessionOutput(v **GetSessionOutput, decoder *json.Decoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + startToken, err := decoder.Token() + if err == io.EOF { + return nil + } + if err != nil { + return err + } + if startToken == nil { + return nil + } + if t, ok := startToken.(json.Delim); !ok || t != '{' { + return fmt.Errorf("expect `{` as start token") + } + + var sv *GetSessionOutput + if *v == nil { + sv = &GetSessionOutput{} + } else { + sv = *v + } + + for decoder.More() { + t, err := decoder.Token() + if err != nil { + return err + } + switch t { + case "dialogAction": + if err := awsRestjson1_deserializeDocumentDialogAction(&sv.DialogAction, decoder); err != nil { return err } - case "slotToElicit": + case "recentIntentSummaryView": + if err := awsRestjson1_deserializeDocumentIntentSummaryList(&sv.RecentIntentSummaryView, decoder); err != nil { + return err + } + + case "sessionAttributes": + if err := awsRestjson1_deserializeDocumentStringMap(&sv.SessionAttributes, decoder); err != nil { + return err + } + + case "sessionId": val, err := decoder.Token() if err != nil { return err @@ -1296,7 +1266,7 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", val) } - sv.SlotToElicit = &jtv + sv.SessionId = &jtv } default: @@ -1319,14 +1289,14 @@ func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder return nil } -type awsRestjson1_deserializeOpPostContent struct { +type awsRestjson1_deserializeOpPostText struct { } -func (*awsRestjson1_deserializeOpPostContent) ID() string { +func (*awsRestjson1_deserializeOpPostText) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpPostContent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpPostText) 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) @@ -1380,14 +1350,8 @@ func (m *awsRestjson1_deserializeOpPostContent) HandleDeserialize(ctx context.Co errorType = "InternalFailureException" case 429: errorType = "LimitExceededException" - case 406: - errorType = "NotAcceptableException" - case 404: - errorType = "NotFoundException" - case 408: - errorType = "RequestTimeoutException" - case 415: - errorType = "UnsupportedMediaTypeException" + case 404: + errorType = "NotFoundException" case 502: errorType = "BadGatewayException" case 424: @@ -1478,23 +1442,6 @@ func (m *awsRestjson1_deserializeOpPostContent) HandleDeserialize(ctx context.Co return out, metadata, errResult } - if errorType == "NotAcceptableException" { - errResult := &types.NotAcceptableException{} - output := errResult - _ = output - - err = awsRestjson1_deserializeDocumentNotAcceptableException(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - if errorType == "NotFoundException" { errResult := &types.NotFoundException{} output := errResult @@ -1512,40 +1459,6 @@ func (m *awsRestjson1_deserializeOpPostContent) HandleDeserialize(ctx context.Co return out, metadata, errResult } - if errorType == "RequestTimeoutException" { - errResult := &types.RequestTimeoutException{} - output := errResult - _ = output - - err = awsRestjson1_deserializeDocumentRequestTimeoutException(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - - if errorType == "UnsupportedMediaTypeException" { - errResult := &types.UnsupportedMediaTypeException{} - output := errResult - _ = output - - err = awsRestjson1_deserializeDocumentUnsupportedMediaTypeException(&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 with invalid JSON, %w", err), - Snapshot: snapshot.Bytes(), - } - } - return out, metadata, errResult - } - if errorType == "BadGatewayException" { errResult := &types.BadGatewayException{} output := errResult @@ -1614,90 +1527,177 @@ func (m *awsRestjson1_deserializeOpPostContent) HandleDeserialize(ctx context.Co return out, metadata, genericError } - output := &PostContentOutput{} + output := &PostTextOutput{} out.Result = output - err = awsRestjson1_deserializeHttpBindingsPostContentOutput(output, response) - if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} - } + buff := make([]byte, 1024) + ringBuffer := smithyio.NewRingBuffer(buff) - err = awsRestjson1_deserializeDocumentPostContentOutput(output, response.Body) + body := io.TeeReader(response.Body, ringBuffer) + defer response.Body.Close() + + decoder := json.NewDecoder(body) + decoder.UseNumber() + + err = awsRestjson1_deserializeDocumentPostTextOutput(&output, decoder) if err != nil { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} + 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_deserializeHttpBindingsPostContentOutput(v *PostContentOutput, response *smithyhttp.Response) error { +func awsRestjson1_deserializeDocumentPostTextOutput(v **PostTextOutput, decoder *json.Decoder) error { if v == nil { - return fmt.Errorf("unsupported deserialization for nil %T", v) + return fmt.Errorf("unexpected nil of type %T", v) } - - if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.ContentType = ptr.String(headerValues[0]) + startToken, err := decoder.Token() + if err == io.EOF { + return nil } - - if headerValues := response.Header.Values("x-amz-lex-dialog-state"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.DialogState = types.DialogState(headerValues[0]) + if err != nil { + return err } - - if headerValues := response.Header.Values("x-amz-lex-input-transcript"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.InputTranscript = ptr.String(headerValues[0]) + if startToken == nil { + return nil } - - if headerValues := response.Header.Values("x-amz-lex-intent-name"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.IntentName = ptr.String(headerValues[0]) + if t, ok := startToken.(json.Delim); !ok || t != '{' { + return fmt.Errorf("expect `{` as start token") } - if headerValues := response.Header.Values("x-amz-lex-message"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Message = ptr.String(headerValues[0]) + var sv *PostTextOutput + if *v == nil { + sv = &PostTextOutput{} + } else { + sv = *v } - if headerValues := response.Header.Values("x-amz-lex-message-format"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.MessageFormat = types.MessageFormatType(headerValues[0]) - } + for decoder.More() { + t, err := decoder.Token() + if err != nil { + return err + } + switch t { + case "dialogState": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected DialogState to be of type string, got %T instead", val) + } + sv.DialogState = types.DialogState(jtv) + } - if headerValues := response.Header.Values("x-amz-lex-sentiment"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.SentimentResponse = ptr.String(headerValues[0]) - } + case "intentName": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected IntentName to be of type string, got %T instead", val) + } + sv.IntentName = &jtv + } - if headerValues := response.Header.Values("x-amz-lex-session-attributes"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.SessionAttributes = ptr.String(headerValues[0]) - } + case "message": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected Text to be of type string, got %T instead", val) + } + sv.Message = &jtv + } - if headerValues := response.Header.Values("x-amz-lex-session-id"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.SessionId = ptr.String(headerValues[0]) - } + case "messageFormat": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected MessageFormatType to be of type string, got %T instead", val) + } + sv.MessageFormat = types.MessageFormatType(jtv) + } - if headerValues := response.Header.Values("x-amz-lex-slot-to-elicit"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.SlotToElicit = ptr.String(headerValues[0]) - } + case "responseCard": + if err := awsRestjson1_deserializeDocumentResponseCard(&sv.ResponseCard, decoder); err != nil { + return err + } - if headerValues := response.Header.Values("x-amz-lex-slots"); len(headerValues) != 0 { - headerValues[0] = strings.TrimSpace(headerValues[0]) - v.Slots = ptr.String(headerValues[0]) - } + case "sentimentResponse": + if err := awsRestjson1_deserializeDocumentSentimentResponse(&sv.SentimentResponse, decoder); err != nil { + return err + } - return nil -} -func awsRestjson1_deserializeDocumentPostContentOutput(v *PostContentOutput, body io.ReadCloser) error { - if v == nil { - return fmt.Errorf("unsupported deserialization of nil %T", v) + case "sessionAttributes": + if err := awsRestjson1_deserializeDocumentStringMap(&sv.SessionAttributes, decoder); err != nil { + return err + } + + case "sessionId": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", val) + } + sv.SessionId = &jtv + } + + case "slots": + if err := awsRestjson1_deserializeDocumentStringMap(&sv.Slots, decoder); err != nil { + return err + } + + case "slotToElicit": + val, err := decoder.Token() + if err != nil { + return err + } + if val != nil { + jtv, ok := val.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", val) + } + sv.SlotToElicit = &jtv + } + + default: + err := restjson.DiscardUnknownField(decoder) + if err != nil { + return err + } + + } + } + endToken, err := decoder.Token() + if err != nil { + return err + } + if t, ok := endToken.(json.Delim); !ok || t != '}' { + return fmt.Errorf("expect `}` as end token") } - v.AudioStream = body + *v = sv return nil } diff --git a/service/lexruntimeservice/go.mod b/service/lexruntimeservice/go.mod index fb8892bbfa8..e7ed63c8eb9 100644 --- a/service/lexruntimeservice/go.mod +++ b/service/lexruntimeservice/go.mod @@ -4,5 +4,5 @@ go 1.14 require ( github.com/aws/aws-sdk-go-v2 v0.0.0-20200630225515-ddc322369f03 - github.com/awslabs/smithy-go v0.0.0-20200702221640-b1c2d4088d13 + github.com/awslabs/smithy-go v0.0.0-20200715183807-623301001f0d ) diff --git a/service/lexruntimeservice/serializers.go b/service/lexruntimeservice/serializers.go index 62380d2cbf8..5b16dd54c11 100644 --- a/service/lexruntimeservice/serializers.go +++ b/service/lexruntimeservice/serializers.go @@ -130,14 +130,14 @@ func awsRestjson1_serializeDocumentPutSessionInput(v *PutSessionInput, value smi return nil } -type awsRestjson1_serializeOpDeleteSession struct { +type awsRestjson1_serializeOpPostContent struct { } -func (*awsRestjson1_serializeOpDeleteSession) ID() string { +func (*awsRestjson1_serializeOpPostContent) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpDeleteSession) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpPostContent) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -145,13 +145,13 @@ func (m *awsRestjson1_serializeOpDeleteSession) HandleSerialize(ctx context.Cont return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*DeleteSessionInput) + input, ok := in.Parameters.(*PostContentInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/bot/{botName}/alias/{botAlias}/user/{userId}/session") + opPath, opQuery := httpbinding.SplitURI("/bot/{botName}/alias/{botAlias}/user/{userId}/content") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -159,16 +159,27 @@ func (m *awsRestjson1_serializeOpDeleteSession) HandleSerialize(ctx context.Cont request.URL.RawQuery = opQuery } - request.Method = "DELETE" + 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 err := awsRestjson1_serializeHttpBindingsDeleteSessionInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsPostContentInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } + if input.InputStream != nil { + if !restEncoder.HasHeader("Content-Type") { + restEncoder.SetHeader("Content-Type").String("application/octet-stream") + } + + payload := input.InputStream + if request, err = request.SetStream(payload); 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} } @@ -176,11 +187,17 @@ func (m *awsRestjson1_serializeOpDeleteSession) HandleSerialize(ctx context.Cont return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsDeleteSessionInput(v *DeleteSessionInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsPostContentInput(v *PostContentInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } + if v.Accept != nil { + if len(*v.Accept) > 0 { + encoder.SetHeader("Accept").String(*v.Accept) + } + } + if v.BotAlias != nil { if err := encoder.SetURI("botAlias").String(*v.BotAlias); err != nil { return err @@ -193,6 +210,24 @@ func awsRestjson1_serializeHttpBindingsDeleteSessionInput(v *DeleteSessionInput, } } + if v.ContentType != nil { + if len(*v.ContentType) > 0 { + encoder.SetHeader("Content-Type").String(*v.ContentType) + } + } + + if v.RequestAttributes != nil { + if len(*v.RequestAttributes) > 0 { + encoder.SetHeader("x-amz-lex-request-attributes").String(*v.RequestAttributes) + } + } + + if v.SessionAttributes != nil { + if len(*v.SessionAttributes) > 0 { + encoder.SetHeader("x-amz-lex-session-attributes").String(*v.SessionAttributes) + } + } + if v.UserId != nil { if err := encoder.SetURI("userId").String(*v.UserId); err != nil { return err @@ -202,14 +237,14 @@ func awsRestjson1_serializeHttpBindingsDeleteSessionInput(v *DeleteSessionInput, return nil } -type awsRestjson1_serializeOpGetSession struct { +type awsRestjson1_serializeOpDeleteSession struct { } -func (*awsRestjson1_serializeOpGetSession) ID() string { +func (*awsRestjson1_serializeOpDeleteSession) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpGetSession) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpDeleteSession) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -217,7 +252,7 @@ func (m *awsRestjson1_serializeOpGetSession) HandleSerialize(ctx context.Context return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*GetSessionInput) + input, ok := in.Parameters.(*DeleteSessionInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} @@ -231,13 +266,13 @@ func (m *awsRestjson1_serializeOpGetSession) HandleSerialize(ctx context.Context request.URL.RawQuery = opQuery } - request.Method = "GET" + request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsGetSessionInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsDeleteSessionInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -248,7 +283,7 @@ func (m *awsRestjson1_serializeOpGetSession) HandleSerialize(ctx context.Context return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsGetSessionInput(v *GetSessionInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsDeleteSessionInput(v *DeleteSessionInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -265,10 +300,6 @@ func awsRestjson1_serializeHttpBindingsGetSessionInput(v *GetSessionInput, encod } } - if v.CheckpointLabelFilter != nil { - encoder.SetQuery("checkpointLabelFilter").String(*v.CheckpointLabelFilter) - } - if v.UserId != nil { if err := encoder.SetURI("userId").String(*v.UserId); err != nil { return err @@ -278,14 +309,14 @@ func awsRestjson1_serializeHttpBindingsGetSessionInput(v *GetSessionInput, encod return nil } -type awsRestjson1_serializeOpPostText struct { +type awsRestjson1_serializeOpGetSession struct { } -func (*awsRestjson1_serializeOpPostText) ID() string { +func (*awsRestjson1_serializeOpGetSession) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpPostText) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpGetSession) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -293,13 +324,13 @@ func (m *awsRestjson1_serializeOpPostText) HandleSerialize(ctx context.Context, return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*PostTextInput) + input, ok := in.Parameters.(*GetSessionInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/bot/{botName}/alias/{botAlias}/user/{userId}/text") + opPath, opQuery := httpbinding.SplitURI("/bot/{botName}/alias/{botAlias}/user/{userId}/session") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -307,24 +338,13 @@ func (m *awsRestjson1_serializeOpPostText) HandleSerialize(ctx context.Context, request.URL.RawQuery = opQuery } - request.Method = "POST" + request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsPostTextInput(input, restEncoder); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - restEncoder.SetHeader("Content-Type").String("application/json") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsRestjson1_serializeDocumentPostTextInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + if err := awsRestjson1_serializeHttpBindingsGetSessionInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } @@ -335,7 +355,7 @@ func (m *awsRestjson1_serializeOpPostText) HandleSerialize(ctx context.Context, return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsPostTextInput(v *PostTextInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsGetSessionInput(v *GetSessionInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } @@ -352,34 +372,12 @@ func awsRestjson1_serializeHttpBindingsPostTextInput(v *PostTextInput, encoder * } } - if v.UserId != nil { - if err := encoder.SetURI("userId").String(*v.UserId); err != nil { - return err - } - } - - return nil -} - -func awsRestjson1_serializeDocumentPostTextInput(v *PostTextInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.InputText != nil { - ok := object.Key("inputText") - ok.String(*v.InputText) - } - - if v.RequestAttributes != nil { - ok := object.Key("requestAttributes") - if err := awsRestjson1_serializeDocumentStringMap(v.RequestAttributes, ok); err != nil { - return err - } + if v.CheckpointLabelFilter != nil { + encoder.SetQuery("checkpointLabelFilter").String(*v.CheckpointLabelFilter) } - if v.SessionAttributes != nil { - ok := object.Key("sessionAttributes") - if err := awsRestjson1_serializeDocumentStringMap(v.SessionAttributes, ok); err != nil { + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { return err } } @@ -387,14 +385,14 @@ func awsRestjson1_serializeDocumentPostTextInput(v *PostTextInput, value smithyj return nil } -type awsRestjson1_serializeOpPostContent struct { +type awsRestjson1_serializeOpPostText struct { } -func (*awsRestjson1_serializeOpPostContent) ID() string { +func (*awsRestjson1_serializeOpPostText) ID() string { return "OperationSerializer" } -func (m *awsRestjson1_serializeOpPostContent) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( +func (m *awsRestjson1_serializeOpPostText) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { request, ok := in.Request.(*smithyhttp.Request) @@ -402,13 +400,13 @@ func (m *awsRestjson1_serializeOpPostContent) HandleSerialize(ctx context.Contex return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} } - input, ok := in.Parameters.(*PostContentInput) + input, ok := in.Parameters.(*PostTextInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } - opPath, opQuery := httpbinding.SplitURI("/bot/{botName}/alias/{botAlias}/user/{userId}/content") + opPath, opQuery := httpbinding.SplitURI("/bot/{botName}/alias/{botAlias}/user/{userId}/text") request.URL.Path = opPath if len(request.URL.RawQuery) > 0 { request.URL.RawQuery = "&" + opQuery @@ -422,19 +420,19 @@ func (m *awsRestjson1_serializeOpPostContent) HandleSerialize(ctx context.Contex return out, metadata, &smithy.SerializationError{Err: err} } - if err := awsRestjson1_serializeHttpBindingsPostContentInput(input, restEncoder); err != nil { + if err := awsRestjson1_serializeHttpBindingsPostTextInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } - if input.InputStream != nil { - if !restEncoder.HasHeader("Content-Type") { - restEncoder.SetHeader("Content-Type").String("application/octet-stream") - } + restEncoder.SetHeader("Content-Type").String("application/json") - payload := input.InputStream - if request, err = request.SetStream(payload); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeDocumentPostTextInput(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 { @@ -444,17 +442,11 @@ func (m *awsRestjson1_serializeOpPostContent) HandleSerialize(ctx context.Contex return next.HandleSerialize(ctx, in) } -func awsRestjson1_serializeHttpBindingsPostContentInput(v *PostContentInput, encoder *httpbinding.Encoder) error { +func awsRestjson1_serializeHttpBindingsPostTextInput(v *PostTextInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } - if v.Accept != nil { - if len(*v.Accept) > 0 { - encoder.SetHeader("Accept").String(*v.Accept) - } - } - if v.BotAlias != nil { if err := encoder.SetURI("botAlias").String(*v.BotAlias); err != nil { return err @@ -467,26 +459,34 @@ func awsRestjson1_serializeHttpBindingsPostContentInput(v *PostContentInput, enc } } - if v.ContentType != nil { - if len(*v.ContentType) > 0 { - encoder.SetHeader("Content-Type").String(*v.ContentType) + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + return err } } - if v.RequestAttributes != nil { - if len(*v.RequestAttributes) > 0 { - encoder.SetHeader("x-amz-lex-request-attributes").String(*v.RequestAttributes) - } + return nil +} + +func awsRestjson1_serializeDocumentPostTextInput(v *PostTextInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.InputText != nil { + ok := object.Key("inputText") + ok.String(*v.InputText) } - if v.SessionAttributes != nil { - if len(*v.SessionAttributes) > 0 { - encoder.SetHeader("x-amz-lex-session-attributes").String(*v.SessionAttributes) + if v.RequestAttributes != nil { + ok := object.Key("requestAttributes") + if err := awsRestjson1_serializeDocumentStringMap(v.RequestAttributes, ok); err != nil { + return err } } - if v.UserId != nil { - if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + if v.SessionAttributes != nil { + ok := object.Key("sessionAttributes") + if err := awsRestjson1_serializeDocumentStringMap(v.SessionAttributes, ok); err != nil { return err } }