diff --git a/.DS_Store b/.DS_Store
deleted file mode 100644
index 43cddbbf63d..00000000000
Binary files a/.DS_Store and /dev/null differ
diff --git a/.changelog/f2df419d89d44856b08d3e5afb013b83.json b/.changelog/f2df419d89d44856b08d3e5afb013b83.json
new file mode 100644
index 00000000000..35b8f658b91
--- /dev/null
+++ b/.changelog/f2df419d89d44856b08d3e5afb013b83.json
@@ -0,0 +1,12 @@
+{
+ "id": "f2df419d-89d4-4856-b08d-3e5afb013b83",
+ "type": "dependency",
+ "description": "Update Smithy to 1.52.1 and update tests",
+ "modules": [
+ "internal/protocoltest/awsrestjson",
+ "internal/protocoltest/jsonrpc",
+ "internal/protocoltest/jsonrpc10",
+ "internal/protocoltest/restxml",
+ "internal/protocoltest/smithyrpcv2cbor"
+ ]
+}
diff --git a/SMITHY_GO_CODEGEN_VERSION b/SMITHY_GO_CODEGEN_VERSION
index 411665b7e88..2ac8fe2b8d4 100644
--- a/SMITHY_GO_CODEGEN_VERSION
+++ b/SMITHY_GO_CODEGEN_VERSION
@@ -1 +1 @@
-e6338ca9b5ee30c6317ea908173a369a9d3eb236
+a4c9efcda6aa54c75d1a130d1320a2709eebf51d
diff --git a/codegen/gradle.properties b/codegen/gradle.properties
index 8292229afef..52c54c82c5b 100644
--- a/codegen/gradle.properties
+++ b/codegen/gradle.properties
@@ -1,2 +1,2 @@
-smithyVersion=1.50.0
+smithyVersion=1.52.1
smithyGradleVersion=0.7.0
diff --git a/codegen/protocol-test-codegen/smithy-build.json b/codegen/protocol-test-codegen/smithy-build.json
index e6865907216..4daf90ef5e7 100644
--- a/codegen/protocol-test-codegen/smithy-build.json
+++ b/codegen/protocol-test-codegen/smithy-build.json
@@ -8,6 +8,8 @@
"args": {
"services": ["aws.protocoltests.ec2#AwsEc2"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
@@ -24,6 +26,8 @@
"args": {
"services": ["aws.protocoltests.json#JsonProtocol"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
@@ -40,6 +44,8 @@
"args": {
"services": ["aws.protocoltests.json10#JsonRpc10"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
@@ -56,6 +62,8 @@
"args": {
"services": ["aws.protocoltests.query#AwsQuery"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
@@ -72,6 +80,8 @@
"args": {
"services": ["aws.protocoltests.restjson#RestJson"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
@@ -88,6 +98,8 @@
"args": {
"services": ["aws.protocoltests.restxml#RestXml"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
@@ -104,6 +116,8 @@
"args": {
"services": ["aws.protocoltests.restxml.xmlns#RestXmlWithNamespace"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
@@ -120,6 +134,8 @@
"args": {
"services": ["smithy.protocoltests.rpcv2Cbor#RpcV2Protocol"]
}
+ },{
+ "name": "removeUnusedShapes"
}
],
"plugins": {
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 bda7e42ef4d..d4a65175244 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
@@ -150,18 +150,6 @@ public static void generateHttpProtocolTests(GenerationContext context) {
.service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
.operation(ShapeId.from("aws.protocoltests.json10#OperationWithNestedStructure"))
.addTestName("AwsJson10ClientPopulatesNestedDefaultValuesWhenMissing")
- .build(),
-
- // TODO these tests are currently failing due to tests not being updated, see #2825
- HttpProtocolUnitTestGenerator.SkipTest.builder()
- .service(ShapeId.from("aws.protocoltests.restjson#RestJson"))
- .operation(ShapeId.from("aws.protocoltests.restjson#NullAndEmptyHeadersClient"))
- .addTestName("RestJsonNullAndEmptyHeaders")
- .build(),
- HttpProtocolUnitTestGenerator.SkipTest.builder()
- .service(ShapeId.from("aws.protocoltests.restxml#RestXml"))
- .operation(ShapeId.from("aws.protocoltests.restxml#NullAndEmptyHeadersClient"))
- .addTestName("NullAndEmptyHeaders")
.build()
));
@@ -227,6 +215,7 @@ public static void generateHttpProtocolTests(GenerationContext context) {
.addTestName("AwsJson10ClientPopulatesDefaultsValuesWhenMissingInResponse")
.addTestName("AwsJson10ClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse")
.build(),
+ // We don't populate default values if none are sent by the server
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
.operation(ShapeId.from("aws.protocoltests.json10#OperationWithNestedStructure"))
@@ -236,6 +225,11 @@ public static void generateHttpProtocolTests(GenerationContext context) {
.service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
.operation(ShapeId.from("aws.protocoltests.json10#OperationWithRequiredMembers"))
.addTestName("AwsJson10ClientErrorCorrectsWhenServerFailsToSerializeRequiredValues")
+ .build(),
+ HttpProtocolUnitTestGenerator.SkipTest.builder()
+ .service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
+ .operation(ShapeId.from("aws.protocoltests.json10#OperationWithRequiredMembersWithDefaults"))
+ .addTestName("AwsJson10ClientErrorCorrectsWithDefaultValuesWhenServerFailsToSerializeRequiredValues")
.build()
));
diff --git a/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go b/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go
index c28b977e8a0..e65f159f7bf 100644
--- a/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go
+++ b/internal/protocoltest/awsrestjson/api_op_HttpPrefixHeaders_test.go
@@ -56,7 +56,7 @@ func TestClient_HttpPrefixHeaders_awsRestjson1Serialize(t *testing.T) {
return smithytesting.CompareReaderEmpty(actual)
},
},
- // No prefix headers are serialized because the value is empty
+ // No prefix headers are serialized because the value is not present
"RestJsonHttpPrefixHeadersAreNotPresent": {
Params: &HttpPrefixHeadersInput{
Foo: ptr.String("Foo"),
@@ -72,6 +72,23 @@ func TestClient_HttpPrefixHeaders_awsRestjson1Serialize(t *testing.T) {
return smithytesting.CompareReaderEmpty(actual)
},
},
+ // Serialize prefix headers were the value is present but empty
+ "RestJsonHttpPrefixEmptyHeaders": {
+ Params: &HttpPrefixHeadersInput{
+ FooMap: map[string]string{
+ "Abc": "",
+ },
+ },
+ ExpectMethod: "GET",
+ ExpectURIPath: "/HttpPrefixHeaders",
+ ExpectQuery: []smithytesting.QueryItem{},
+ ExpectHeader: http.Header{
+ "X-Foo-Abc": []string{""},
+ },
+ BodyAssert: func(actual io.Reader) error {
+ return smithytesting.CompareReaderEmpty(actual)
+ },
+ },
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
diff --git a/internal/protocoltest/awsrestjson/api_op_MalformedContentTypeWithoutBodyEmptyInput.go b/internal/protocoltest/awsrestjson/api_op_MalformedContentTypeWithoutBodyEmptyInput.go
new file mode 100644
index 00000000000..7483359acd1
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_MalformedContentTypeWithoutBodyEmptyInput.go
@@ -0,0 +1,144 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+func (c *Client) MalformedContentTypeWithoutBodyEmptyInput(ctx context.Context, params *MalformedContentTypeWithoutBodyEmptyInputInput, optFns ...func(*Options)) (*MalformedContentTypeWithoutBodyEmptyInputOutput, error) {
+ if params == nil {
+ params = &MalformedContentTypeWithoutBodyEmptyInputInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "MalformedContentTypeWithoutBodyEmptyInput", params, optFns, c.addOperationMalformedContentTypeWithoutBodyEmptyInputMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*MalformedContentTypeWithoutBodyEmptyInputOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type MalformedContentTypeWithoutBodyEmptyInputInput struct {
+ Header *string
+
+ noSmithyDocumentSerde
+}
+
+type MalformedContentTypeWithoutBodyEmptyInputOutput struct {
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationMalformedContentTypeWithoutBodyEmptyInputMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpMalformedContentTypeWithoutBodyEmptyInput{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpMalformedContentTypeWithoutBodyEmptyInput{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "MalformedContentTypeWithoutBodyEmptyInput"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opMalformedContentTypeWithoutBodyEmptyInput(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opMalformedContentTypeWithoutBodyEmptyInput(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "MalformedContentTypeWithoutBodyEmptyInput",
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go
index a70134de621..cdee6a885d9 100644
--- a/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go
+++ b/internal/protocoltest/awsrestjson/api_op_NullAndEmptyHeadersClient_test.go
@@ -32,7 +32,8 @@ func TestClient_NullAndEmptyHeadersClient_awsRestjson1Serialize(t *testing.T) {
BodyMediaType string
BodyAssert func(io.Reader) error
}{
- // Do not send null values, empty strings, or empty lists over the wire in headers
+ // Do not send null values, but do send empty strings and empty lists over the
+ // wire in headers
"RestJsonNullAndEmptyHeaders": {
Params: &NullAndEmptyHeadersClientInput{
A: nil,
@@ -42,10 +43,12 @@ func TestClient_NullAndEmptyHeadersClient_awsRestjson1Serialize(t *testing.T) {
ExpectMethod: "GET",
ExpectURIPath: "/NullAndEmptyHeadersClient",
ExpectQuery: []smithytesting.QueryItem{},
+ ExpectHeader: http.Header{
+ "X-B": []string{""},
+ "X-C": []string{""},
+ },
ForbidHeader: []string{
"X-A",
- "X-B",
- "X-C",
},
BodyAssert: func(actual io.Reader) error {
return smithytesting.CompareReaderEmpty(actual)
@@ -54,10 +57,6 @@ func TestClient_NullAndEmptyHeadersClient_awsRestjson1Serialize(t *testing.T) {
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
- if name == "RestJsonNullAndEmptyHeaders" {
- t.Skip("disabled test aws.protocoltests.restjson#RestJson aws.protocoltests.restjson#NullAndEmptyHeadersClient")
- }
-
actualReq := &http.Request{}
serverURL := "http://localhost:8888/"
if c.Host != nil {
diff --git a/internal/protocoltest/awsrestjson/api_op_OperationWithDefaults_test.go b/internal/protocoltest/awsrestjson/api_op_OperationWithDefaults_test.go
index ab95fd402ae..d1400a179d8 100644
--- a/internal/protocoltest/awsrestjson/api_op_OperationWithDefaults_test.go
+++ b/internal/protocoltest/awsrestjson/api_op_OperationWithDefaults_test.go
@@ -394,7 +394,7 @@ func TestClient_OperationWithDefaults_awsRestjson1Deserialize(t *testing.T) {
"b",
}),
DefaultNullDocument: document.NewLazyDocument("notNull"),
- DefaultTimestamp: ptr.Time(smithytime.ParseEpochSeconds(1)),
+ DefaultTimestamp: ptr.Time(smithytime.ParseEpochSeconds(2)),
DefaultBlob: []byte("hi"),
DefaultByte: ptr.Int8(2),
DefaultShort: ptr.Int16(2),
diff --git a/internal/protocoltest/awsrestjson/api_op_ResponseCodeHttpFallback.go b/internal/protocoltest/awsrestjson/api_op_ResponseCodeHttpFallback.go
new file mode 100644
index 00000000000..6dbd9a31c3b
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_ResponseCodeHttpFallback.go
@@ -0,0 +1,142 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+func (c *Client) ResponseCodeHttpFallback(ctx context.Context, params *ResponseCodeHttpFallbackInput, optFns ...func(*Options)) (*ResponseCodeHttpFallbackOutput, error) {
+ if params == nil {
+ params = &ResponseCodeHttpFallbackInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "ResponseCodeHttpFallback", params, optFns, c.addOperationResponseCodeHttpFallbackMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*ResponseCodeHttpFallbackOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type ResponseCodeHttpFallbackInput struct {
+ noSmithyDocumentSerde
+}
+
+type ResponseCodeHttpFallbackOutput struct {
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationResponseCodeHttpFallbackMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpResponseCodeHttpFallback{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpResponseCodeHttpFallback{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "ResponseCodeHttpFallback"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opResponseCodeHttpFallback(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opResponseCodeHttpFallback(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "ResponseCodeHttpFallback",
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_ResponseCodeHttpFallback_test.go b/internal/protocoltest/awsrestjson/api_op_ResponseCodeHttpFallback_test.go
new file mode 100644
index 00000000000..96c87b6791b
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_ResponseCodeHttpFallback_test.go
@@ -0,0 +1,82 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "bytes"
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/smithy-go/middleware"
+ smithyrand "github.com/aws/smithy-go/rand"
+ smithytesting "github.com/aws/smithy-go/testing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "io/ioutil"
+ "net/http"
+ "testing"
+)
+
+func TestClient_ResponseCodeHttpFallback_awsRestjson1Deserialize(t *testing.T) {
+ cases := map[string]struct {
+ StatusCode int
+ Header http.Header
+ BodyMediaType string
+ Body []byte
+ ExpectResult *ResponseCodeHttpFallbackOutput
+ }{}
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ serverURL := "http://localhost:8888/"
+ client := New(Options{
+ HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
+ headers := http.Header{}
+ for k, vs := range c.Header {
+ for _, v := range vs {
+ headers.Add(k, v)
+ }
+ }
+ if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 {
+ headers.Set("Content-Type", c.BodyMediaType)
+ }
+ response := &http.Response{
+ StatusCode: c.StatusCode,
+ Header: headers,
+ Request: r,
+ }
+ if len(c.Body) != 0 {
+ response.ContentLength = int64(len(c.Body))
+ response.Body = ioutil.NopCloser(bytes.NewReader(c.Body))
+ } else {
+
+ response.Body = http.NoBody
+ }
+ return response, nil
+ }),
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
+ Region: "us-west-2",
+ })
+ var params ResponseCodeHttpFallbackInput
+ result, err := client.ResponseCodeHttpFallback(context.Background(), ¶ms)
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if err := smithytesting.CompareValues(c.ExpectResult, result); err != nil {
+ t.Errorf("expect c.ExpectResult value match:\n%v", err)
+ }
+ })
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_ResponseCodeRequired.go b/internal/protocoltest/awsrestjson/api_op_ResponseCodeRequired.go
new file mode 100644
index 00000000000..4cc20aa577f
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_ResponseCodeRequired.go
@@ -0,0 +1,146 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+func (c *Client) ResponseCodeRequired(ctx context.Context, params *ResponseCodeRequiredInput, optFns ...func(*Options)) (*ResponseCodeRequiredOutput, error) {
+ if params == nil {
+ params = &ResponseCodeRequiredInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "ResponseCodeRequired", params, optFns, c.addOperationResponseCodeRequiredMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*ResponseCodeRequiredOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type ResponseCodeRequiredInput struct {
+ noSmithyDocumentSerde
+}
+
+type ResponseCodeRequiredOutput struct {
+
+ // This member is required.
+ ResponseCode *int32
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationResponseCodeRequiredMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpResponseCodeRequired{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpResponseCodeRequired{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "ResponseCodeRequired"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opResponseCodeRequired(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opResponseCodeRequired(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "ResponseCodeRequired",
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_ResponseCodeRequired_test.go b/internal/protocoltest/awsrestjson/api_op_ResponseCodeRequired_test.go
new file mode 100644
index 00000000000..bc6c2faea1f
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_ResponseCodeRequired_test.go
@@ -0,0 +1,82 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "bytes"
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/smithy-go/middleware"
+ smithyrand "github.com/aws/smithy-go/rand"
+ smithytesting "github.com/aws/smithy-go/testing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "io/ioutil"
+ "net/http"
+ "testing"
+)
+
+func TestClient_ResponseCodeRequired_awsRestjson1Deserialize(t *testing.T) {
+ cases := map[string]struct {
+ StatusCode int
+ Header http.Header
+ BodyMediaType string
+ Body []byte
+ ExpectResult *ResponseCodeRequiredOutput
+ }{}
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ serverURL := "http://localhost:8888/"
+ client := New(Options{
+ HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
+ headers := http.Header{}
+ for k, vs := range c.Header {
+ for _, v := range vs {
+ headers.Add(k, v)
+ }
+ }
+ if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 {
+ headers.Set("Content-Type", c.BodyMediaType)
+ }
+ response := &http.Response{
+ StatusCode: c.StatusCode,
+ Header: headers,
+ Request: r,
+ }
+ if len(c.Body) != 0 {
+ response.ContentLength = int64(len(c.Body))
+ response.Body = ioutil.NopCloser(bytes.NewReader(c.Body))
+ } else {
+
+ response.Body = http.NoBody
+ }
+ return response, nil
+ }),
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
+ Region: "us-west-2",
+ })
+ var params ResponseCodeRequiredInput
+ result, err := client.ResponseCodeRequired(context.Background(), ¶ms)
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if err := smithytesting.CompareValues(c.ExpectResult, result); err != nil {
+ t.Errorf("expect c.ExpectResult value match:\n%v", err)
+ }
+ })
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_SparseJsonLists.go b/internal/protocoltest/awsrestjson/api_op_SparseJsonLists.go
index 37768796c89..77717a362e3 100644
--- a/internal/protocoltest/awsrestjson/api_op_SparseJsonLists.go
+++ b/internal/protocoltest/awsrestjson/api_op_SparseJsonLists.go
@@ -26,12 +26,16 @@ func (c *Client) SparseJsonLists(ctx context.Context, params *SparseJsonListsInp
}
type SparseJsonListsInput struct {
+ SparseShortList []*int16
+
SparseStringList []*string
noSmithyDocumentSerde
}
type SparseJsonListsOutput struct {
+ SparseShortList []*int16
+
SparseStringList []*string
// Metadata pertaining to the operation's result.
diff --git a/internal/protocoltest/awsrestjson/api_op_SparseJsonLists_test.go b/internal/protocoltest/awsrestjson/api_op_SparseJsonLists_test.go
index 83a7747ef44..91804e426e7 100644
--- a/internal/protocoltest/awsrestjson/api_op_SparseJsonLists_test.go
+++ b/internal/protocoltest/awsrestjson/api_op_SparseJsonLists_test.go
@@ -42,6 +42,10 @@ func TestClient_SparseJsonLists_awsRestjson1Serialize(t *testing.T) {
nil,
ptr.String("hi"),
},
+ SparseShortList: []*int16{
+ nil,
+ ptr.Int16(2),
+ },
},
ExpectMethod: "PUT",
ExpectURIPath: "/SparseJsonLists",
@@ -55,6 +59,10 @@ func TestClient_SparseJsonLists_awsRestjson1Serialize(t *testing.T) {
"sparseStringList": [
null,
"hi"
+ ],
+ "sparseShortList": [
+ null,
+ 2
]
}`))
},
@@ -143,6 +151,10 @@ func TestClient_SparseJsonLists_awsRestjson1Deserialize(t *testing.T) {
"sparseStringList": [
null,
"hi"
+ ],
+ "sparseShortList": [
+ null,
+ 2
]
}`),
ExpectResult: &SparseJsonListsOutput{
@@ -150,6 +162,10 @@ func TestClient_SparseJsonLists_awsRestjson1Deserialize(t *testing.T) {
nil,
ptr.String("hi"),
},
+ SparseShortList: []*int16{
+ nil,
+ ptr.Int16(2),
+ },
},
},
}
diff --git a/internal/protocoltest/awsrestjson/api_op_TestNoInputNoPayload.go b/internal/protocoltest/awsrestjson/api_op_TestGetNoInputNoPayload.go
similarity index 72%
rename from internal/protocoltest/awsrestjson/api_op_TestNoInputNoPayload.go
rename to internal/protocoltest/awsrestjson/api_op_TestGetNoInputNoPayload.go
index 9ab842512f6..fa30ecbe9ad 100644
--- a/internal/protocoltest/awsrestjson/api_op_TestNoInputNoPayload.go
+++ b/internal/protocoltest/awsrestjson/api_op_TestGetNoInputNoPayload.go
@@ -10,32 +10,32 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
-// This example operation has no input and serializes a request without an HTTP
+// This example GET operation has no input and serializes a request without a HTTP
// body.
//
// These tests are to ensure we do not attach a body or related headers
// (Content-Length, Content-Type) to operations that semantically cannot produce an
// HTTP body.
-func (c *Client) TestNoInputNoPayload(ctx context.Context, params *TestNoInputNoPayloadInput, optFns ...func(*Options)) (*TestNoInputNoPayloadOutput, error) {
+func (c *Client) TestGetNoInputNoPayload(ctx context.Context, params *TestGetNoInputNoPayloadInput, optFns ...func(*Options)) (*TestGetNoInputNoPayloadOutput, error) {
if params == nil {
- params = &TestNoInputNoPayloadInput{}
+ params = &TestGetNoInputNoPayloadInput{}
}
- result, metadata, err := c.invokeOperation(ctx, "TestNoInputNoPayload", params, optFns, c.addOperationTestNoInputNoPayloadMiddlewares)
+ result, metadata, err := c.invokeOperation(ctx, "TestGetNoInputNoPayload", params, optFns, c.addOperationTestGetNoInputNoPayloadMiddlewares)
if err != nil {
return nil, err
}
- out := result.(*TestNoInputNoPayloadOutput)
+ out := result.(*TestGetNoInputNoPayloadOutput)
out.ResultMetadata = metadata
return out, nil
}
-type TestNoInputNoPayloadInput struct {
+type TestGetNoInputNoPayloadInput struct {
noSmithyDocumentSerde
}
-type TestNoInputNoPayloadOutput struct {
+type TestGetNoInputNoPayloadOutput struct {
TestId *string
// Metadata pertaining to the operation's result.
@@ -44,19 +44,19 @@ type TestNoInputNoPayloadOutput struct {
noSmithyDocumentSerde
}
-func (c *Client) addOperationTestNoInputNoPayloadMiddlewares(stack *middleware.Stack, options Options) (err error) {
+func (c *Client) addOperationTestGetNoInputNoPayloadMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
- err = stack.Serialize.Add(&awsRestjson1_serializeOpTestNoInputNoPayload{}, middleware.After)
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpTestGetNoInputNoPayload{}, middleware.After)
if err != nil {
return err
}
- err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTestNoInputNoPayload{}, middleware.After)
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTestGetNoInputNoPayload{}, middleware.After)
if err != nil {
return err
}
- if err := addProtocolFinalizerMiddlewares(stack, options, "TestNoInputNoPayload"); err != nil {
+ if err := addProtocolFinalizerMiddlewares(stack, options, "TestGetNoInputNoPayload"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
@@ -108,7 +108,7 @@ func (c *Client) addOperationTestNoInputNoPayloadMiddlewares(stack *middleware.S
if err = addUserAgentRetryMode(stack, options); err != nil {
return err
}
- if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestNoInputNoPayload(options.Region), middleware.Before); err != nil {
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestGetNoInputNoPayload(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
@@ -141,10 +141,10 @@ func (c *Client) addOperationTestNoInputNoPayloadMiddlewares(stack *middleware.S
return nil
}
-func newServiceMetadataMiddleware_opTestNoInputNoPayload(region string) *awsmiddleware.RegisterServiceMetadata {
+func newServiceMetadataMiddleware_opTestGetNoInputNoPayload(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
- OperationName: "TestNoInputNoPayload",
+ OperationName: "TestGetNoInputNoPayload",
}
}
diff --git a/internal/protocoltest/awsrestjson/api_op_TestNoInputNoPayload_test.go b/internal/protocoltest/awsrestjson/api_op_TestGetNoInputNoPayload_test.go
similarity index 91%
rename from internal/protocoltest/awsrestjson/api_op_TestNoInputNoPayload_test.go
rename to internal/protocoltest/awsrestjson/api_op_TestGetNoInputNoPayload_test.go
index 19e57ca174a..7a141490ee5 100644
--- a/internal/protocoltest/awsrestjson/api_op_TestNoInputNoPayload_test.go
+++ b/internal/protocoltest/awsrestjson/api_op_TestGetNoInputNoPayload_test.go
@@ -16,9 +16,9 @@ import (
"testing"
)
-func TestClient_TestNoInputNoPayload_awsRestjson1Serialize(t *testing.T) {
+func TestClient_TestGetNoInputNoPayload_awsRestjson1Serialize(t *testing.T) {
cases := map[string]struct {
- Params *TestNoInputNoPayloadInput
+ Params *TestGetNoInputNoPayloadInput
ExpectMethod string
ExpectURIPath string
ExpectQuery []smithytesting.QueryItem
@@ -33,14 +33,14 @@ func TestClient_TestNoInputNoPayload_awsRestjson1Serialize(t *testing.T) {
}{
// Serializes a GET request for an operation with no input, and therefore no
// modeled body
- "RestJsonHttpWithNoInput": {
- Params: &TestNoInputNoPayloadInput{},
+ "RestJsonHttpGetWithNoInput": {
+ Params: &TestGetNoInputNoPayloadInput{},
ExpectMethod: "GET",
ExpectURIPath: "/no_input_no_payload",
ExpectQuery: []smithytesting.QueryItem{},
ForbidHeader: []string{
- "Content-Length",
"Content-Type",
+ "Content-Length",
},
BodyAssert: func(actual io.Reader) error {
return smithytesting.CompareReaderEmpty(actual)
@@ -78,7 +78,7 @@ func TestClient_TestNoInputNoPayload_awsRestjson1Serialize(t *testing.T) {
IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
Region: "us-west-2",
})
- result, err := client.TestNoInputNoPayload(context.Background(), c.Params, func(options *Options) {
+ result, err := client.TestGetNoInputNoPayload(context.Background(), c.Params, func(options *Options) {
options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error {
return smithyprivateprotocol.AddCaptureRequestMiddleware(stack, actualReq)
})
diff --git a/internal/protocoltest/awsrestjson/api_op_TestNoPayload.go b/internal/protocoltest/awsrestjson/api_op_TestGetNoPayload.go
similarity index 74%
rename from internal/protocoltest/awsrestjson/api_op_TestNoPayload.go
rename to internal/protocoltest/awsrestjson/api_op_TestGetNoPayload.go
index 61e864baf8d..7b5e7e0d210 100644
--- a/internal/protocoltest/awsrestjson/api_op_TestNoPayload.go
+++ b/internal/protocoltest/awsrestjson/api_op_TestGetNoPayload.go
@@ -10,33 +10,33 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)
-// This example operation serializes a request without an HTTP body.
+// This example GET operation serializes a request without a modeled HTTP body.
//
// These tests are to ensure we do not attach a body or related headers
// (Content-Length, Content-Type) to operations that semantically cannot produce an
// HTTP body.
-func (c *Client) TestNoPayload(ctx context.Context, params *TestNoPayloadInput, optFns ...func(*Options)) (*TestNoPayloadOutput, error) {
+func (c *Client) TestGetNoPayload(ctx context.Context, params *TestGetNoPayloadInput, optFns ...func(*Options)) (*TestGetNoPayloadOutput, error) {
if params == nil {
- params = &TestNoPayloadInput{}
+ params = &TestGetNoPayloadInput{}
}
- result, metadata, err := c.invokeOperation(ctx, "TestNoPayload", params, optFns, c.addOperationTestNoPayloadMiddlewares)
+ result, metadata, err := c.invokeOperation(ctx, "TestGetNoPayload", params, optFns, c.addOperationTestGetNoPayloadMiddlewares)
if err != nil {
return nil, err
}
- out := result.(*TestNoPayloadOutput)
+ out := result.(*TestGetNoPayloadOutput)
out.ResultMetadata = metadata
return out, nil
}
-type TestNoPayloadInput struct {
+type TestGetNoPayloadInput struct {
TestId *string
noSmithyDocumentSerde
}
-type TestNoPayloadOutput struct {
+type TestGetNoPayloadOutput struct {
TestId *string
// Metadata pertaining to the operation's result.
@@ -45,19 +45,19 @@ type TestNoPayloadOutput struct {
noSmithyDocumentSerde
}
-func (c *Client) addOperationTestNoPayloadMiddlewares(stack *middleware.Stack, options Options) (err error) {
+func (c *Client) addOperationTestGetNoPayloadMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
- err = stack.Serialize.Add(&awsRestjson1_serializeOpTestNoPayload{}, middleware.After)
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpTestGetNoPayload{}, middleware.After)
if err != nil {
return err
}
- err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTestNoPayload{}, middleware.After)
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTestGetNoPayload{}, middleware.After)
if err != nil {
return err
}
- if err := addProtocolFinalizerMiddlewares(stack, options, "TestNoPayload"); err != nil {
+ if err := addProtocolFinalizerMiddlewares(stack, options, "TestGetNoPayload"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
@@ -109,7 +109,7 @@ func (c *Client) addOperationTestNoPayloadMiddlewares(stack *middleware.Stack, o
if err = addUserAgentRetryMode(stack, options); err != nil {
return err
}
- if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestNoPayload(options.Region), middleware.Before); err != nil {
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestGetNoPayload(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
@@ -142,10 +142,10 @@ func (c *Client) addOperationTestNoPayloadMiddlewares(stack *middleware.Stack, o
return nil
}
-func newServiceMetadataMiddleware_opTestNoPayload(region string) *awsmiddleware.RegisterServiceMetadata {
+func newServiceMetadataMiddleware_opTestGetNoPayload(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
- OperationName: "TestNoPayload",
+ OperationName: "TestGetNoPayload",
}
}
diff --git a/internal/protocoltest/awsrestjson/api_op_TestNoPayload_test.go b/internal/protocoltest/awsrestjson/api_op_TestGetNoPayload_test.go
similarity index 90%
rename from internal/protocoltest/awsrestjson/api_op_TestNoPayload_test.go
rename to internal/protocoltest/awsrestjson/api_op_TestGetNoPayload_test.go
index 4b2b6f855f2..0af41555704 100644
--- a/internal/protocoltest/awsrestjson/api_op_TestNoPayload_test.go
+++ b/internal/protocoltest/awsrestjson/api_op_TestGetNoPayload_test.go
@@ -17,9 +17,9 @@ import (
"testing"
)
-func TestClient_TestNoPayload_awsRestjson1Serialize(t *testing.T) {
+func TestClient_TestGetNoPayload_awsRestjson1Serialize(t *testing.T) {
cases := map[string]struct {
- Params *TestNoPayloadInput
+ Params *TestGetNoPayloadInput
ExpectMethod string
ExpectURIPath string
ExpectQuery []smithytesting.QueryItem
@@ -33,8 +33,8 @@ func TestClient_TestNoPayload_awsRestjson1Serialize(t *testing.T) {
BodyAssert func(io.Reader) error
}{
// Serializes a GET request with no modeled body
- "RestJsonHttpWithNoModeledBody": {
- Params: &TestNoPayloadInput{},
+ "RestJsonHttpGetWithNoModeledBody": {
+ Params: &TestGetNoPayloadInput{},
ExpectMethod: "GET",
ExpectURIPath: "/no_payload",
ExpectQuery: []smithytesting.QueryItem{},
@@ -47,8 +47,8 @@ func TestClient_TestNoPayload_awsRestjson1Serialize(t *testing.T) {
},
},
// Serializes a GET request with header member but no modeled body
- "RestJsonHttpWithHeaderMemberNoModeledBody": {
- Params: &TestNoPayloadInput{
+ "RestJsonHttpGetWithHeaderMemberNoModeledBody": {
+ Params: &TestGetNoPayloadInput{
TestId: ptr.String("t-12345"),
},
ExpectMethod: "GET",
@@ -97,7 +97,7 @@ func TestClient_TestNoPayload_awsRestjson1Serialize(t *testing.T) {
IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
Region: "us-west-2",
})
- result, err := client.TestNoPayload(context.Background(), c.Params, func(options *Options) {
+ result, err := client.TestGetNoPayload(context.Background(), c.Params, func(options *Options) {
options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error {
return smithyprivateprotocol.AddCaptureRequestMiddleware(stack, actualReq)
})
diff --git a/internal/protocoltest/awsrestjson/api_op_TestPayloadBlob_test.go b/internal/protocoltest/awsrestjson/api_op_TestPayloadBlob_test.go
index 9b9bbcef614..30ef9709140 100644
--- a/internal/protocoltest/awsrestjson/api_op_TestPayloadBlob_test.go
+++ b/internal/protocoltest/awsrestjson/api_op_TestPayloadBlob_test.go
@@ -38,9 +38,6 @@ func TestClient_TestPayloadBlob_awsRestjson1Serialize(t *testing.T) {
ExpectMethod: "POST",
ExpectURIPath: "/blob_payload",
ExpectQuery: []smithytesting.QueryItem{},
- ExpectHeader: http.Header{
- "Content-Type": []string{"application/octet-stream"},
- },
BodyMediaType: "application/octet-stream",
BodyAssert: func(actual io.Reader) error {
return smithytesting.CompareReaderEmpty(actual)
diff --git a/internal/protocoltest/awsrestjson/api_op_TestPostNoInputNoPayload.go b/internal/protocoltest/awsrestjson/api_op_TestPostNoInputNoPayload.go
new file mode 100644
index 00000000000..756b2df24ab
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_TestPostNoInputNoPayload.go
@@ -0,0 +1,149 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// This example POST operation has no input and serializes a request without a
+// HTTP body.
+//
+// These tests are to ensure we do not attach a body or related headers
+// (Content-Type) to a POST operation with no modeled input.
+func (c *Client) TestPostNoInputNoPayload(ctx context.Context, params *TestPostNoInputNoPayloadInput, optFns ...func(*Options)) (*TestPostNoInputNoPayloadOutput, error) {
+ if params == nil {
+ params = &TestPostNoInputNoPayloadInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "TestPostNoInputNoPayload", params, optFns, c.addOperationTestPostNoInputNoPayloadMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*TestPostNoInputNoPayloadOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type TestPostNoInputNoPayloadInput struct {
+ noSmithyDocumentSerde
+}
+
+type TestPostNoInputNoPayloadOutput struct {
+ TestId *string
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationTestPostNoInputNoPayloadMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpTestPostNoInputNoPayload{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTestPostNoInputNoPayload{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "TestPostNoInputNoPayload"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestPostNoInputNoPayload(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opTestPostNoInputNoPayload(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "TestPostNoInputNoPayload",
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_TestPostNoInputNoPayload_test.go b/internal/protocoltest/awsrestjson/api_op_TestPostNoInputNoPayload_test.go
new file mode 100644
index 00000000000..528ed41ca35
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_TestPostNoInputNoPayload_test.go
@@ -0,0 +1,111 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ protocoltesthttp "github.com/aws/aws-sdk-go-v2/internal/protocoltest"
+ "github.com/aws/smithy-go/middleware"
+ smithyprivateprotocol "github.com/aws/smithy-go/private/protocol"
+ smithyrand "github.com/aws/smithy-go/rand"
+ smithytesting "github.com/aws/smithy-go/testing"
+ "io"
+ "net/http"
+ "net/url"
+ "testing"
+)
+
+func TestClient_TestPostNoInputNoPayload_awsRestjson1Serialize(t *testing.T) {
+ cases := map[string]struct {
+ Params *TestPostNoInputNoPayloadInput
+ ExpectMethod string
+ ExpectURIPath string
+ ExpectQuery []smithytesting.QueryItem
+ RequireQuery []string
+ ForbidQuery []string
+ ExpectHeader http.Header
+ RequireHeader []string
+ ForbidHeader []string
+ Host *url.URL
+ BodyMediaType string
+ BodyAssert func(io.Reader) error
+ }{
+ // Serializes a POST request for an operation with no input, and therefore no
+ // modeled body
+ "RestJsonHttpPostWithNoInput": {
+ Params: &TestPostNoInputNoPayloadInput{},
+ ExpectMethod: "POST",
+ ExpectURIPath: "/no_input_no_payload",
+ ExpectQuery: []smithytesting.QueryItem{},
+ ForbidHeader: []string{
+ "Content-Type",
+ },
+ BodyAssert: func(actual io.Reader) error {
+ return smithytesting.CompareReaderEmpty(actual)
+ },
+ },
+ }
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ actualReq := &http.Request{}
+ serverURL := "http://localhost:8888/"
+ if c.Host != nil {
+ u, err := url.Parse(serverURL)
+ if err != nil {
+ t.Fatalf("expect no error, got %v", err)
+ }
+ u.Path = c.Host.Path
+ u.RawPath = c.Host.RawPath
+ u.RawQuery = c.Host.RawQuery
+ serverURL = u.String()
+ }
+ client := New(Options{
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ HTTPClient: protocoltesthttp.NewClient(),
+ IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
+ Region: "us-west-2",
+ })
+ result, err := client.TestPostNoInputNoPayload(context.Background(), c.Params, func(options *Options) {
+ options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error {
+ return smithyprivateprotocol.AddCaptureRequestMiddleware(stack, actualReq)
+ })
+ })
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if e, a := c.ExpectMethod, actualReq.Method; e != a {
+ t.Errorf("expect %v method, got %v", e, a)
+ }
+ if e, a := c.ExpectURIPath, actualReq.URL.RawPath; e != a {
+ t.Errorf("expect %v path, got %v", e, a)
+ }
+ queryItems := smithytesting.ParseRawQuery(actualReq.URL.RawQuery)
+ smithytesting.AssertHasQuery(t, c.ExpectQuery, queryItems)
+ smithytesting.AssertHasQueryKeys(t, c.RequireQuery, queryItems)
+ smithytesting.AssertNotHaveQueryKeys(t, c.ForbidQuery, queryItems)
+ smithytesting.AssertHasHeader(t, c.ExpectHeader, actualReq.Header)
+ smithytesting.AssertHasHeaderKeys(t, c.RequireHeader, actualReq.Header)
+ smithytesting.AssertNotHaveHeaderKeys(t, c.ForbidHeader, actualReq.Header)
+ if c.BodyAssert != nil {
+ if err := c.BodyAssert(actualReq.Body); err != nil {
+ t.Errorf("expect body equal, got %v", err)
+ }
+ }
+ })
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_TestPostNoPayload.go b/internal/protocoltest/awsrestjson/api_op_TestPostNoPayload.go
new file mode 100644
index 00000000000..a4216285940
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_TestPostNoPayload.go
@@ -0,0 +1,150 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// This example POST operation serializes a request without a modeled HTTP body.
+//
+// These tests are to ensure we do not attach a body or related headers
+// (Content-Type) to a POST operation with no modeled payload.
+func (c *Client) TestPostNoPayload(ctx context.Context, params *TestPostNoPayloadInput, optFns ...func(*Options)) (*TestPostNoPayloadOutput, error) {
+ if params == nil {
+ params = &TestPostNoPayloadInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "TestPostNoPayload", params, optFns, c.addOperationTestPostNoPayloadMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*TestPostNoPayloadOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type TestPostNoPayloadInput struct {
+ TestId *string
+
+ noSmithyDocumentSerde
+}
+
+type TestPostNoPayloadOutput struct {
+ TestId *string
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationTestPostNoPayloadMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpTestPostNoPayload{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTestPostNoPayload{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "TestPostNoPayload"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTestPostNoPayload(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opTestPostNoPayload(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "TestPostNoPayload",
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/api_op_TestPostNoPayload_test.go b/internal/protocoltest/awsrestjson/api_op_TestPostNoPayload_test.go
new file mode 100644
index 00000000000..c2862f9200c
--- /dev/null
+++ b/internal/protocoltest/awsrestjson/api_op_TestPostNoPayload_test.go
@@ -0,0 +1,129 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package awsrestjson
+
+import (
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ protocoltesthttp "github.com/aws/aws-sdk-go-v2/internal/protocoltest"
+ "github.com/aws/smithy-go/middleware"
+ smithyprivateprotocol "github.com/aws/smithy-go/private/protocol"
+ "github.com/aws/smithy-go/ptr"
+ smithyrand "github.com/aws/smithy-go/rand"
+ smithytesting "github.com/aws/smithy-go/testing"
+ "io"
+ "net/http"
+ "net/url"
+ "testing"
+)
+
+func TestClient_TestPostNoPayload_awsRestjson1Serialize(t *testing.T) {
+ cases := map[string]struct {
+ Params *TestPostNoPayloadInput
+ ExpectMethod string
+ ExpectURIPath string
+ ExpectQuery []smithytesting.QueryItem
+ RequireQuery []string
+ ForbidQuery []string
+ ExpectHeader http.Header
+ RequireHeader []string
+ ForbidHeader []string
+ Host *url.URL
+ BodyMediaType string
+ BodyAssert func(io.Reader) error
+ }{
+ // Serializes a POST request with no modeled body
+ "RestJsonHttpPostWithNoModeledBody": {
+ Params: &TestPostNoPayloadInput{},
+ ExpectMethod: "POST",
+ ExpectURIPath: "/no_payload",
+ ExpectQuery: []smithytesting.QueryItem{},
+ ForbidHeader: []string{
+ "Content-Type",
+ },
+ BodyAssert: func(actual io.Reader) error {
+ return smithytesting.CompareReaderEmpty(actual)
+ },
+ },
+ // Serializes a POST request with header member but no modeled body
+ "RestJsonHttpWithPostHeaderMemberNoModeledBody": {
+ Params: &TestPostNoPayloadInput{
+ TestId: ptr.String("t-12345"),
+ },
+ ExpectMethod: "POST",
+ ExpectURIPath: "/no_payload",
+ ExpectQuery: []smithytesting.QueryItem{},
+ ExpectHeader: http.Header{
+ "X-Amz-Test-Id": []string{"t-12345"},
+ },
+ ForbidHeader: []string{
+ "Content-Type",
+ },
+ BodyAssert: func(actual io.Reader) error {
+ return smithytesting.CompareReaderEmpty(actual)
+ },
+ },
+ }
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ actualReq := &http.Request{}
+ serverURL := "http://localhost:8888/"
+ if c.Host != nil {
+ u, err := url.Parse(serverURL)
+ if err != nil {
+ t.Fatalf("expect no error, got %v", err)
+ }
+ u.Path = c.Host.Path
+ u.RawPath = c.Host.RawPath
+ u.RawQuery = c.Host.RawQuery
+ serverURL = u.String()
+ }
+ client := New(Options{
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ HTTPClient: protocoltesthttp.NewClient(),
+ IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
+ Region: "us-west-2",
+ })
+ result, err := client.TestPostNoPayload(context.Background(), c.Params, func(options *Options) {
+ options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error {
+ return smithyprivateprotocol.AddCaptureRequestMiddleware(stack, actualReq)
+ })
+ })
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if e, a := c.ExpectMethod, actualReq.Method; e != a {
+ t.Errorf("expect %v method, got %v", e, a)
+ }
+ if e, a := c.ExpectURIPath, actualReq.URL.RawPath; e != a {
+ t.Errorf("expect %v path, got %v", e, a)
+ }
+ queryItems := smithytesting.ParseRawQuery(actualReq.URL.RawQuery)
+ smithytesting.AssertHasQuery(t, c.ExpectQuery, queryItems)
+ smithytesting.AssertHasQueryKeys(t, c.RequireQuery, queryItems)
+ smithytesting.AssertNotHaveQueryKeys(t, c.ForbidQuery, queryItems)
+ smithytesting.AssertHasHeader(t, c.ExpectHeader, actualReq.Header)
+ smithytesting.AssertHasHeaderKeys(t, c.RequireHeader, actualReq.Header)
+ smithytesting.AssertNotHaveHeaderKeys(t, c.ForbidHeader, actualReq.Header)
+ if c.BodyAssert != nil {
+ if err := c.BodyAssert(actualReq.Body); err != nil {
+ t.Errorf("expect body equal, got %v", err)
+ }
+ }
+ })
+ }
+}
diff --git a/internal/protocoltest/awsrestjson/deserializers.go b/internal/protocoltest/awsrestjson/deserializers.go
index f4d7cba0c71..8451870ea9a 100644
--- a/internal/protocoltest/awsrestjson/deserializers.go
+++ b/internal/protocoltest/awsrestjson/deserializers.go
@@ -6027,6 +6027,97 @@ func awsRestjson1_deserializeOpErrorMalformedContentTypeWithoutBody(response *sm
}
}
+type awsRestjson1_deserializeOpMalformedContentTypeWithoutBodyEmptyInput struct {
+}
+
+func (*awsRestjson1_deserializeOpMalformedContentTypeWithoutBodyEmptyInput) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsRestjson1_deserializeOpMalformedContentTypeWithoutBodyEmptyInput) 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
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsRestjson1_deserializeOpErrorMalformedContentTypeWithoutBodyEmptyInput(response, &metadata)
+ }
+ output := &MalformedContentTypeWithoutBodyEmptyInputOutput{}
+ out.Result = output
+
+ if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
+ return out, metadata, &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to discard response body, %w", err),
+ }
+ }
+
+ span.End()
+ return out, metadata, err
+}
+
+func awsRestjson1_deserializeOpErrorMalformedContentTypeWithoutBodyEmptyInput(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+ if len(headerCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(headerCode)
+ }
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ jsonCode, message, err := restjson.GetErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if len(headerCode) == 0 && len(jsonCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(jsonCode)
+ }
+ if len(message) != 0 {
+ errorMessage = message
+ }
+
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
type awsRestjson1_deserializeOpMalformedContentTypeWithPayload struct {
}
@@ -10322,6 +10413,191 @@ func awsRestjson1_deserializeOpDocumentRecursiveShapesOutput(v **RecursiveShapes
return nil
}
+type awsRestjson1_deserializeOpResponseCodeHttpFallback struct {
+}
+
+func (*awsRestjson1_deserializeOpResponseCodeHttpFallback) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsRestjson1_deserializeOpResponseCodeHttpFallback) 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
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsRestjson1_deserializeOpErrorResponseCodeHttpFallback(response, &metadata)
+ }
+ output := &ResponseCodeHttpFallbackOutput{}
+ out.Result = output
+
+ span.End()
+ return out, metadata, err
+}
+
+func awsRestjson1_deserializeOpErrorResponseCodeHttpFallback(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+ if len(headerCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(headerCode)
+ }
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ jsonCode, message, err := restjson.GetErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if len(headerCode) == 0 && len(jsonCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(jsonCode)
+ }
+ if len(message) != 0 {
+ errorMessage = message
+ }
+
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
+type awsRestjson1_deserializeOpResponseCodeRequired struct {
+}
+
+func (*awsRestjson1_deserializeOpResponseCodeRequired) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsRestjson1_deserializeOpResponseCodeRequired) 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
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsRestjson1_deserializeOpErrorResponseCodeRequired(response, &metadata)
+ }
+ output := &ResponseCodeRequiredOutput{}
+ out.Result = output
+
+ err = awsRestjson1_deserializeOpHttpBindingsResponseCodeRequiredOutput(output, response)
+ if err != nil {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
+ }
+
+ span.End()
+ return out, metadata, err
+}
+
+func awsRestjson1_deserializeOpErrorResponseCodeRequired(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+ if len(headerCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(headerCode)
+ }
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ jsonCode, message, err := restjson.GetErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if len(headerCode) == 0 && len(jsonCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(jsonCode)
+ }
+ if len(message) != 0 {
+ errorMessage = message
+ }
+
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
+func awsRestjson1_deserializeOpHttpBindingsResponseCodeRequiredOutput(v *ResponseCodeRequiredOutput, response *smithyhttp.Response) error {
+ if v == nil {
+ return fmt.Errorf("unsupported deserialization for nil %T", v)
+ }
+
+ v.ResponseCode = ptr.Int32(int32(response.StatusCode))
+
+ return nil
+}
+
type awsRestjson1_deserializeOpSimpleScalarProperties struct {
}
@@ -10765,6 +11041,11 @@ func awsRestjson1_deserializeOpDocumentSparseJsonListsOutput(v **SparseJsonLists
for key, value := range shape {
switch key {
+ case "sparseShortList":
+ if err := awsRestjson1_deserializeDocumentSparseShortList(&sv.SparseShortList, value); err != nil {
+ return err
+ }
+
case "sparseStringList":
if err := awsRestjson1_deserializeDocumentSparseStringList(&sv.SparseStringList, value); err != nil {
return err
@@ -11437,14 +11718,14 @@ func awsRestjson1_deserializeOpDocumentTestBodyStructureOutput(v **TestBodyStruc
return nil
}
-type awsRestjson1_deserializeOpTestNoInputNoPayload struct {
+type awsRestjson1_deserializeOpTestGetNoInputNoPayload struct {
}
-func (*awsRestjson1_deserializeOpTestNoInputNoPayload) ID() string {
+func (*awsRestjson1_deserializeOpTestGetNoInputNoPayload) ID() string {
return "OperationDeserializer"
}
-func (m *awsRestjson1_deserializeOpTestNoInputNoPayload) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
+func (m *awsRestjson1_deserializeOpTestGetNoInputNoPayload) 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)
@@ -11462,12 +11743,12 @@ func (m *awsRestjson1_deserializeOpTestNoInputNoPayload) HandleDeserialize(ctx c
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
- return out, metadata, awsRestjson1_deserializeOpErrorTestNoInputNoPayload(response, &metadata)
+ return out, metadata, awsRestjson1_deserializeOpErrorTestGetNoInputNoPayload(response, &metadata)
}
- output := &TestNoInputNoPayloadOutput{}
+ output := &TestGetNoInputNoPayloadOutput{}
out.Result = output
- err = awsRestjson1_deserializeOpHttpBindingsTestNoInputNoPayloadOutput(output, response)
+ err = awsRestjson1_deserializeOpHttpBindingsTestGetNoInputNoPayloadOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
@@ -11476,7 +11757,7 @@ func (m *awsRestjson1_deserializeOpTestNoInputNoPayload) HandleDeserialize(ctx c
return out, metadata, err
}
-func awsRestjson1_deserializeOpErrorTestNoInputNoPayload(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+func awsRestjson1_deserializeOpErrorTestGetNoInputNoPayload(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
@@ -11527,7 +11808,7 @@ func awsRestjson1_deserializeOpErrorTestNoInputNoPayload(response *smithyhttp.Re
}
}
-func awsRestjson1_deserializeOpHttpBindingsTestNoInputNoPayloadOutput(v *TestNoInputNoPayloadOutput, response *smithyhttp.Response) error {
+func awsRestjson1_deserializeOpHttpBindingsTestGetNoInputNoPayloadOutput(v *TestGetNoInputNoPayloadOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
@@ -11540,14 +11821,14 @@ func awsRestjson1_deserializeOpHttpBindingsTestNoInputNoPayloadOutput(v *TestNoI
return nil
}
-type awsRestjson1_deserializeOpTestNoPayload struct {
+type awsRestjson1_deserializeOpTestGetNoPayload struct {
}
-func (*awsRestjson1_deserializeOpTestNoPayload) ID() string {
+func (*awsRestjson1_deserializeOpTestGetNoPayload) ID() string {
return "OperationDeserializer"
}
-func (m *awsRestjson1_deserializeOpTestNoPayload) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
+func (m *awsRestjson1_deserializeOpTestGetNoPayload) 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)
@@ -11565,12 +11846,12 @@ func (m *awsRestjson1_deserializeOpTestNoPayload) HandleDeserialize(ctx context.
}
if response.StatusCode < 200 || response.StatusCode >= 300 {
- return out, metadata, awsRestjson1_deserializeOpErrorTestNoPayload(response, &metadata)
+ return out, metadata, awsRestjson1_deserializeOpErrorTestGetNoPayload(response, &metadata)
}
- output := &TestNoPayloadOutput{}
+ output := &TestGetNoPayloadOutput{}
out.Result = output
- err = awsRestjson1_deserializeOpHttpBindingsTestNoPayloadOutput(output, response)
+ err = awsRestjson1_deserializeOpHttpBindingsTestGetNoPayloadOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
@@ -11579,7 +11860,7 @@ func (m *awsRestjson1_deserializeOpTestNoPayload) HandleDeserialize(ctx context.
return out, metadata, err
}
-func awsRestjson1_deserializeOpErrorTestNoPayload(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+func awsRestjson1_deserializeOpErrorTestGetNoPayload(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
@@ -11630,7 +11911,7 @@ func awsRestjson1_deserializeOpErrorTestNoPayload(response *smithyhttp.Response,
}
}
-func awsRestjson1_deserializeOpHttpBindingsTestNoPayloadOutput(v *TestNoPayloadOutput, response *smithyhttp.Response) error {
+func awsRestjson1_deserializeOpHttpBindingsTestGetNoPayloadOutput(v *TestGetNoPayloadOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
@@ -11938,6 +12219,212 @@ func awsRestjson1_deserializeOpDocumentTestPayloadStructureOutput(v **TestPayloa
return nil
}
+type awsRestjson1_deserializeOpTestPostNoInputNoPayload struct {
+}
+
+func (*awsRestjson1_deserializeOpTestPostNoInputNoPayload) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsRestjson1_deserializeOpTestPostNoInputNoPayload) 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
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsRestjson1_deserializeOpErrorTestPostNoInputNoPayload(response, &metadata)
+ }
+ output := &TestPostNoInputNoPayloadOutput{}
+ out.Result = output
+
+ err = awsRestjson1_deserializeOpHttpBindingsTestPostNoInputNoPayloadOutput(output, response)
+ if err != nil {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
+ }
+
+ span.End()
+ return out, metadata, err
+}
+
+func awsRestjson1_deserializeOpErrorTestPostNoInputNoPayload(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+ if len(headerCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(headerCode)
+ }
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ jsonCode, message, err := restjson.GetErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if len(headerCode) == 0 && len(jsonCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(jsonCode)
+ }
+ if len(message) != 0 {
+ errorMessage = message
+ }
+
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
+func awsRestjson1_deserializeOpHttpBindingsTestPostNoInputNoPayloadOutput(v *TestPostNoInputNoPayloadOutput, response *smithyhttp.Response) error {
+ if v == nil {
+ return fmt.Errorf("unsupported deserialization for nil %T", v)
+ }
+
+ if headerValues := response.Header.Values("X-Amz-Test-Id"); len(headerValues) != 0 {
+ headerValues[0] = strings.TrimSpace(headerValues[0])
+ v.TestId = ptr.String(headerValues[0])
+ }
+
+ return nil
+}
+
+type awsRestjson1_deserializeOpTestPostNoPayload struct {
+}
+
+func (*awsRestjson1_deserializeOpTestPostNoPayload) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsRestjson1_deserializeOpTestPostNoPayload) 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
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsRestjson1_deserializeOpErrorTestPostNoPayload(response, &metadata)
+ }
+ output := &TestPostNoPayloadOutput{}
+ out.Result = output
+
+ err = awsRestjson1_deserializeOpHttpBindingsTestPostNoPayloadOutput(output, response)
+ if err != nil {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
+ }
+
+ span.End()
+ return out, metadata, err
+}
+
+func awsRestjson1_deserializeOpErrorTestPostNoPayload(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+ if len(headerCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(headerCode)
+ }
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ jsonCode, message, err := restjson.GetErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if len(headerCode) == 0 && len(jsonCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(jsonCode)
+ }
+ if len(message) != 0 {
+ errorMessage = message
+ }
+
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
+func awsRestjson1_deserializeOpHttpBindingsTestPostNoPayloadOutput(v *TestPostNoPayloadOutput, response *smithyhttp.Response) error {
+ if v == nil {
+ return fmt.Errorf("unsupported deserialization for nil %T", v)
+ }
+
+ if headerValues := response.Header.Values("X-Amz-Test-Id"); len(headerValues) != 0 {
+ headerValues[0] = strings.TrimSpace(headerValues[0])
+ v.TestId = ptr.String(headerValues[0])
+ }
+
+ return nil
+}
+
type awsRestjson1_deserializeOpTimestampFormatHeaders struct {
}
@@ -14079,6 +14566,46 @@ func awsRestjson1_deserializeDocumentNestedStringList(v *[][]string, value inter
return nil
}
+func awsRestjson1_deserializeDocumentSparseShortList(v *[]*int16, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.([]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var cv []*int16
+ if *v == nil {
+ cv = []*int16{}
+ } else {
+ cv = *v
+ }
+
+ for _, value := range shape {
+ var col *int16
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected Short to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ col = ptr.Int16(int16(i64))
+ }
+ cv = append(cv, col)
+
+ }
+ *v = cv
+ return nil
+}
+
func awsRestjson1_deserializeDocumentSparseStringList(v *[]*string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
diff --git a/internal/protocoltest/awsrestjson/generated.json b/internal/protocoltest/awsrestjson/generated.json
index 4af031e9f8c..0a80116ebf5 100644
--- a/internal/protocoltest/awsrestjson/generated.json
+++ b/internal/protocoltest/awsrestjson/generated.json
@@ -94,6 +94,7 @@
"api_op_MalformedContentTypeWithGenericString.go",
"api_op_MalformedContentTypeWithPayload.go",
"api_op_MalformedContentTypeWithoutBody.go",
+ "api_op_MalformedContentTypeWithoutBodyEmptyInput.go",
"api_op_MalformedDouble.go",
"api_op_MalformedFloat.go",
"api_op_MalformedInteger.go",
@@ -147,6 +148,10 @@
"api_op_QueryPrecedence_test.go",
"api_op_RecursiveShapes.go",
"api_op_RecursiveShapes_test.go",
+ "api_op_ResponseCodeHttpFallback.go",
+ "api_op_ResponseCodeHttpFallback_test.go",
+ "api_op_ResponseCodeRequired.go",
+ "api_op_ResponseCodeRequired_test.go",
"api_op_SimpleScalarProperties.go",
"api_op_SimpleScalarProperties_test.go",
"api_op_SparseJsonLists.go",
@@ -161,14 +166,18 @@
"api_op_StreamingTraits_test.go",
"api_op_TestBodyStructure.go",
"api_op_TestBodyStructure_test.go",
- "api_op_TestNoInputNoPayload.go",
- "api_op_TestNoInputNoPayload_test.go",
- "api_op_TestNoPayload.go",
- "api_op_TestNoPayload_test.go",
+ "api_op_TestGetNoInputNoPayload.go",
+ "api_op_TestGetNoInputNoPayload_test.go",
+ "api_op_TestGetNoPayload.go",
+ "api_op_TestGetNoPayload_test.go",
"api_op_TestPayloadBlob.go",
"api_op_TestPayloadBlob_test.go",
"api_op_TestPayloadStructure.go",
"api_op_TestPayloadStructure_test.go",
+ "api_op_TestPostNoInputNoPayload.go",
+ "api_op_TestPostNoInputNoPayload_test.go",
+ "api_op_TestPostNoPayload.go",
+ "api_op_TestPostNoPayload_test.go",
"api_op_TimestampFormatHeaders.go",
"api_op_TimestampFormatHeaders_test.go",
"api_op_UnitInputAndOutput.go",
diff --git a/internal/protocoltest/awsrestjson/serializers.go b/internal/protocoltest/awsrestjson/serializers.go
index b4179fc8270..42e614b32c3 100644
--- a/internal/protocoltest/awsrestjson/serializers.go
+++ b/internal/protocoltest/awsrestjson/serializers.go
@@ -4000,6 +4000,73 @@ func awsRestjson1_serializeOpHttpBindingsMalformedContentTypeWithoutBodyInput(v
return nil
}
+type awsRestjson1_serializeOpMalformedContentTypeWithoutBodyEmptyInput struct {
+}
+
+func (*awsRestjson1_serializeOpMalformedContentTypeWithoutBodyEmptyInput) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsRestjson1_serializeOpMalformedContentTypeWithoutBodyEmptyInput) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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.(*MalformedContentTypeWithoutBodyEmptyInputInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ opPath, opQuery := httpbinding.SplitURI("/MalformedContentTypeWithoutBodyEmptyInput")
+ request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
+ request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
+ request.Method = "POST"
+ var restEncoder *httpbinding.Encoder
+ if request.URL.RawPath == "" {
+ restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ } else {
+ request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
+ restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
+ }
+
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if err := awsRestjson1_serializeOpHttpBindingsMalformedContentTypeWithoutBodyEmptyInputInput(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
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+func awsRestjson1_serializeOpHttpBindingsMalformedContentTypeWithoutBodyEmptyInputInput(v *MalformedContentTypeWithoutBodyEmptyInputInput, encoder *httpbinding.Encoder) error {
+ if v == nil {
+ return fmt.Errorf("unsupported serialization of nil %T", v)
+ }
+
+ if v.Header != nil {
+ locationName := "Header"
+ encoder.SetHeader(locationName).String(*v.Header)
+ }
+
+ return nil
+}
+
type awsRestjson1_serializeOpMalformedContentTypeWithPayload struct {
}
@@ -7160,6 +7227,122 @@ func awsRestjson1_serializeOpDocumentRecursiveShapesInput(v *RecursiveShapesInpu
return nil
}
+type awsRestjson1_serializeOpResponseCodeHttpFallback struct {
+}
+
+func (*awsRestjson1_serializeOpResponseCodeHttpFallback) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsRestjson1_serializeOpResponseCodeHttpFallback) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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.(*ResponseCodeHttpFallbackInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ opPath, opQuery := httpbinding.SplitURI("/responseCodeHttpFallback")
+ request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
+ request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
+ request.Method = "GET"
+ var restEncoder *httpbinding.Encoder
+ if request.URL.RawPath == "" {
+ restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ } else {
+ request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
+ restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+func awsRestjson1_serializeOpHttpBindingsResponseCodeHttpFallbackInput(v *ResponseCodeHttpFallbackInput, encoder *httpbinding.Encoder) error {
+ if v == nil {
+ return fmt.Errorf("unsupported serialization of nil %T", v)
+ }
+
+ return nil
+}
+
+type awsRestjson1_serializeOpResponseCodeRequired struct {
+}
+
+func (*awsRestjson1_serializeOpResponseCodeRequired) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsRestjson1_serializeOpResponseCodeRequired) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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.(*ResponseCodeRequiredInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ opPath, opQuery := httpbinding.SplitURI("/responseCodeRequired")
+ request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
+ request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
+ request.Method = "GET"
+ var restEncoder *httpbinding.Encoder
+ if request.URL.RawPath == "" {
+ restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ } else {
+ request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
+ restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+func awsRestjson1_serializeOpHttpBindingsResponseCodeRequiredInput(v *ResponseCodeRequiredInput, encoder *httpbinding.Encoder) error {
+ if v == nil {
+ return fmt.Errorf("unsupported serialization of nil %T", v)
+ }
+
+ return nil
+}
+
type awsRestjson1_serializeOpSimpleScalarProperties struct {
}
@@ -7389,6 +7572,13 @@ func awsRestjson1_serializeOpDocumentSparseJsonListsInput(v *SparseJsonListsInpu
object := value.Object()
defer object.Close()
+ if v.SparseShortList != nil {
+ ok := object.Key("sparseShortList")
+ if err := awsRestjson1_serializeDocumentSparseShortList(v.SparseShortList, ok); err != nil {
+ return err
+ }
+ }
+
if v.SparseStringList != nil {
ok := object.Key("sparseStringList")
if err := awsRestjson1_serializeDocumentSparseStringList(v.SparseStringList, ok); err != nil {
@@ -7839,14 +8029,14 @@ func awsRestjson1_serializeOpDocumentTestBodyStructureInput(v *TestBodyStructure
return nil
}
-type awsRestjson1_serializeOpTestNoInputNoPayload struct {
+type awsRestjson1_serializeOpTestGetNoInputNoPayload struct {
}
-func (*awsRestjson1_serializeOpTestNoInputNoPayload) ID() string {
+func (*awsRestjson1_serializeOpTestGetNoInputNoPayload) ID() string {
return "OperationSerializer"
}
-func (m *awsRestjson1_serializeOpTestNoInputNoPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+func (m *awsRestjson1_serializeOpTestGetNoInputNoPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
_, span := tracing.StartSpan(ctx, "OperationSerializer")
@@ -7858,7 +8048,7 @@ func (m *awsRestjson1_serializeOpTestNoInputNoPayload) HandleSerialize(ctx conte
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
- input, ok := in.Parameters.(*TestNoInputNoPayloadInput)
+ input, ok := in.Parameters.(*TestGetNoInputNoPayloadInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
@@ -7889,7 +8079,7 @@ func (m *awsRestjson1_serializeOpTestNoInputNoPayload) HandleSerialize(ctx conte
span.End()
return next.HandleSerialize(ctx, in)
}
-func awsRestjson1_serializeOpHttpBindingsTestNoInputNoPayloadInput(v *TestNoInputNoPayloadInput, encoder *httpbinding.Encoder) error {
+func awsRestjson1_serializeOpHttpBindingsTestGetNoInputNoPayloadInput(v *TestGetNoInputNoPayloadInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
@@ -7897,14 +8087,14 @@ func awsRestjson1_serializeOpHttpBindingsTestNoInputNoPayloadInput(v *TestNoInpu
return nil
}
-type awsRestjson1_serializeOpTestNoPayload struct {
+type awsRestjson1_serializeOpTestGetNoPayload struct {
}
-func (*awsRestjson1_serializeOpTestNoPayload) ID() string {
+func (*awsRestjson1_serializeOpTestGetNoPayload) ID() string {
return "OperationSerializer"
}
-func (m *awsRestjson1_serializeOpTestNoPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+func (m *awsRestjson1_serializeOpTestGetNoPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
_, span := tracing.StartSpan(ctx, "OperationSerializer")
@@ -7916,7 +8106,7 @@ func (m *awsRestjson1_serializeOpTestNoPayload) HandleSerialize(ctx context.Cont
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
}
- input, ok := in.Parameters.(*TestNoPayloadInput)
+ input, ok := in.Parameters.(*TestGetNoPayloadInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
@@ -7938,7 +8128,7 @@ func (m *awsRestjson1_serializeOpTestNoPayload) HandleSerialize(ctx context.Cont
return out, metadata, &smithy.SerializationError{Err: err}
}
- if err := awsRestjson1_serializeOpHttpBindingsTestNoPayloadInput(input, restEncoder); err != nil {
+ if err := awsRestjson1_serializeOpHttpBindingsTestGetNoPayloadInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
@@ -7951,7 +8141,7 @@ func (m *awsRestjson1_serializeOpTestNoPayload) HandleSerialize(ctx context.Cont
span.End()
return next.HandleSerialize(ctx, in)
}
-func awsRestjson1_serializeOpHttpBindingsTestNoPayloadInput(v *TestNoPayloadInput, encoder *httpbinding.Encoder) error {
+func awsRestjson1_serializeOpHttpBindingsTestGetNoPayloadInput(v *TestGetNoPayloadInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
@@ -8134,6 +8324,131 @@ func awsRestjson1_serializeOpHttpBindingsTestPayloadStructureInput(v *TestPayloa
return nil
}
+type awsRestjson1_serializeOpTestPostNoInputNoPayload struct {
+}
+
+func (*awsRestjson1_serializeOpTestPostNoInputNoPayload) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsRestjson1_serializeOpTestPostNoInputNoPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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.(*TestPostNoInputNoPayloadInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ opPath, opQuery := httpbinding.SplitURI("/no_input_no_payload")
+ request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
+ request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
+ request.Method = "POST"
+ var restEncoder *httpbinding.Encoder
+ if request.URL.RawPath == "" {
+ restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ } else {
+ request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
+ restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+func awsRestjson1_serializeOpHttpBindingsTestPostNoInputNoPayloadInput(v *TestPostNoInputNoPayloadInput, encoder *httpbinding.Encoder) error {
+ if v == nil {
+ return fmt.Errorf("unsupported serialization of nil %T", v)
+ }
+
+ return nil
+}
+
+type awsRestjson1_serializeOpTestPostNoPayload struct {
+}
+
+func (*awsRestjson1_serializeOpTestPostNoPayload) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsRestjson1_serializeOpTestPostNoPayload) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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.(*TestPostNoPayloadInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ opPath, opQuery := httpbinding.SplitURI("/no_payload")
+ request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
+ request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
+ request.Method = "POST"
+ var restEncoder *httpbinding.Encoder
+ if request.URL.RawPath == "" {
+ restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ } else {
+ request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
+ restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
+ }
+
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if err := awsRestjson1_serializeOpHttpBindingsTestPostNoPayloadInput(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
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+func awsRestjson1_serializeOpHttpBindingsTestPostNoPayloadInput(v *TestPostNoPayloadInput, encoder *httpbinding.Encoder) error {
+ if v == nil {
+ return fmt.Errorf("unsupported serialization of nil %T", v)
+ }
+
+ if v.TestId != nil {
+ locationName := "X-Amz-Test-Id"
+ encoder.SetHeader(locationName).String(*v.TestId)
+ }
+
+ return nil
+}
+
type awsRestjson1_serializeOpTimestampFormatHeaders struct {
}
@@ -9182,6 +9497,21 @@ func awsRestjson1_serializeDocumentNestedStringList(v [][]string, value smithyjs
return nil
}
+func awsRestjson1_serializeDocumentSparseShortList(v []*int16, value smithyjson.Value) error {
+ array := value.Array()
+ defer array.Close()
+
+ for i := range v {
+ av := array.Value()
+ if vv := v[i]; vv == nil {
+ av.Null()
+ continue
+ }
+ av.Short(*v[i])
+ }
+ return nil
+}
+
func awsRestjson1_serializeDocumentSparseStringList(v []*string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
diff --git a/internal/protocoltest/awsrestjson/snapshot_test.go b/internal/protocoltest/awsrestjson/snapshot_test.go
index a9261ab8c17..e847f54b61d 100644
--- a/internal/protocoltest/awsrestjson/snapshot_test.go
+++ b/internal/protocoltest/awsrestjson/snapshot_test.go
@@ -626,6 +626,18 @@ func TestCheckSnapshot_MalformedContentTypeWithoutBody(t *testing.T) {
}
}
+func TestCheckSnapshot_MalformedContentTypeWithoutBodyEmptyInput(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.MalformedContentTypeWithoutBodyEmptyInput(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "MalformedContentTypeWithoutBodyEmptyInput")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestCheckSnapshot_MalformedContentTypeWithPayload(t *testing.T) {
svc := New(Options{})
_, err := svc.MalformedContentTypeWithPayload(context.Background(), nil, func(o *Options) {
@@ -1094,6 +1106,30 @@ func TestCheckSnapshot_RecursiveShapes(t *testing.T) {
}
}
+func TestCheckSnapshot_ResponseCodeHttpFallback(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.ResponseCodeHttpFallback(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "ResponseCodeHttpFallback")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestCheckSnapshot_ResponseCodeRequired(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.ResponseCodeRequired(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "ResponseCodeRequired")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestCheckSnapshot_SimpleScalarProperties(t *testing.T) {
svc := New(Options{})
_, err := svc.SimpleScalarProperties(context.Background(), nil, func(o *Options) {
@@ -1178,11 +1214,11 @@ func TestCheckSnapshot_TestBodyStructure(t *testing.T) {
}
}
-func TestCheckSnapshot_TestNoInputNoPayload(t *testing.T) {
+func TestCheckSnapshot_TestGetNoInputNoPayload(t *testing.T) {
svc := New(Options{})
- _, err := svc.TestNoInputNoPayload(context.Background(), nil, func(o *Options) {
+ _, err := svc.TestGetNoInputNoPayload(context.Background(), nil, func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
- return testSnapshot(stack, "TestNoInputNoPayload")
+ return testSnapshot(stack, "TestGetNoInputNoPayload")
})
})
if _, ok := err.(snapshotOK); !ok && err != nil {
@@ -1190,11 +1226,11 @@ func TestCheckSnapshot_TestNoInputNoPayload(t *testing.T) {
}
}
-func TestCheckSnapshot_TestNoPayload(t *testing.T) {
+func TestCheckSnapshot_TestGetNoPayload(t *testing.T) {
svc := New(Options{})
- _, err := svc.TestNoPayload(context.Background(), nil, func(o *Options) {
+ _, err := svc.TestGetNoPayload(context.Background(), nil, func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
- return testSnapshot(stack, "TestNoPayload")
+ return testSnapshot(stack, "TestGetNoPayload")
})
})
if _, ok := err.(snapshotOK); !ok && err != nil {
@@ -1226,6 +1262,30 @@ func TestCheckSnapshot_TestPayloadStructure(t *testing.T) {
}
}
+func TestCheckSnapshot_TestPostNoInputNoPayload(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.TestPostNoInputNoPayload(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "TestPostNoInputNoPayload")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestCheckSnapshot_TestPostNoPayload(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.TestPostNoPayload(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "TestPostNoPayload")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestCheckSnapshot_TimestampFormatHeaders(t *testing.T) {
svc := New(Options{})
_, err := svc.TimestampFormatHeaders(context.Background(), nil, func(o *Options) {
@@ -1813,6 +1873,18 @@ func TestUpdateSnapshot_MalformedContentTypeWithoutBody(t *testing.T) {
}
}
+func TestUpdateSnapshot_MalformedContentTypeWithoutBodyEmptyInput(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.MalformedContentTypeWithoutBodyEmptyInput(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "MalformedContentTypeWithoutBodyEmptyInput")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestUpdateSnapshot_MalformedContentTypeWithPayload(t *testing.T) {
svc := New(Options{})
_, err := svc.MalformedContentTypeWithPayload(context.Background(), nil, func(o *Options) {
@@ -2281,6 +2353,30 @@ func TestUpdateSnapshot_RecursiveShapes(t *testing.T) {
}
}
+func TestUpdateSnapshot_ResponseCodeHttpFallback(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.ResponseCodeHttpFallback(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "ResponseCodeHttpFallback")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestUpdateSnapshot_ResponseCodeRequired(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.ResponseCodeRequired(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "ResponseCodeRequired")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestUpdateSnapshot_SimpleScalarProperties(t *testing.T) {
svc := New(Options{})
_, err := svc.SimpleScalarProperties(context.Background(), nil, func(o *Options) {
@@ -2365,11 +2461,11 @@ func TestUpdateSnapshot_TestBodyStructure(t *testing.T) {
}
}
-func TestUpdateSnapshot_TestNoInputNoPayload(t *testing.T) {
+func TestUpdateSnapshot_TestGetNoInputNoPayload(t *testing.T) {
svc := New(Options{})
- _, err := svc.TestNoInputNoPayload(context.Background(), nil, func(o *Options) {
+ _, err := svc.TestGetNoInputNoPayload(context.Background(), nil, func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
- return updateSnapshot(stack, "TestNoInputNoPayload")
+ return updateSnapshot(stack, "TestGetNoInputNoPayload")
})
})
if _, ok := err.(snapshotOK); !ok && err != nil {
@@ -2377,11 +2473,11 @@ func TestUpdateSnapshot_TestNoInputNoPayload(t *testing.T) {
}
}
-func TestUpdateSnapshot_TestNoPayload(t *testing.T) {
+func TestUpdateSnapshot_TestGetNoPayload(t *testing.T) {
svc := New(Options{})
- _, err := svc.TestNoPayload(context.Background(), nil, func(o *Options) {
+ _, err := svc.TestGetNoPayload(context.Background(), nil, func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
- return updateSnapshot(stack, "TestNoPayload")
+ return updateSnapshot(stack, "TestGetNoPayload")
})
})
if _, ok := err.(snapshotOK); !ok && err != nil {
@@ -2413,6 +2509,30 @@ func TestUpdateSnapshot_TestPayloadStructure(t *testing.T) {
}
}
+func TestUpdateSnapshot_TestPostNoInputNoPayload(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.TestPostNoInputNoPayload(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "TestPostNoInputNoPayload")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestUpdateSnapshot_TestPostNoPayload(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.TestPostNoPayload(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "TestPostNoPayload")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestUpdateSnapshot_TimestampFormatHeaders(t *testing.T) {
svc := New(Options{})
_, err := svc.TimestampFormatHeaders(context.Background(), nil, func(o *Options) {
diff --git a/internal/protocoltest/jsonrpc/api_op_JsonIntEnums.go b/internal/protocoltest/jsonrpc/api_op_JsonIntEnums.go
new file mode 100644
index 00000000000..0e9d4a499a8
--- /dev/null
+++ b/internal/protocoltest/jsonrpc/api_op_JsonIntEnums.go
@@ -0,0 +1,169 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package jsonrpc
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/aws-sdk-go-v2/internal/protocoltest/jsonrpc/types"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// This example serializes intEnums as top level properties, in lists, sets, and
+// maps.
+func (c *Client) JsonIntEnums(ctx context.Context, params *JsonIntEnumsInput, optFns ...func(*Options)) (*JsonIntEnumsOutput, error) {
+ if params == nil {
+ params = &JsonIntEnumsInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "JsonIntEnums", params, optFns, c.addOperationJsonIntEnumsMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*JsonIntEnumsOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type JsonIntEnumsInput struct {
+ IntEnum1 types.IntegerEnum
+
+ IntEnum2 types.IntegerEnum
+
+ IntEnum3 types.IntegerEnum
+
+ IntEnumList []types.IntegerEnum
+
+ IntEnumMap map[string]types.IntegerEnum
+
+ IntEnumSet []types.IntegerEnum
+
+ noSmithyDocumentSerde
+}
+
+type JsonIntEnumsOutput struct {
+ IntEnum1 types.IntegerEnum
+
+ IntEnum2 types.IntegerEnum
+
+ IntEnum3 types.IntegerEnum
+
+ IntEnumList []types.IntegerEnum
+
+ IntEnumMap map[string]types.IntegerEnum
+
+ IntEnumSet []types.IntegerEnum
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationJsonIntEnumsMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsAwsjson11_serializeOpJsonIntEnums{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpJsonIntEnums{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "JsonIntEnums"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opJsonIntEnums(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opJsonIntEnums(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "JsonIntEnums",
+ }
+}
diff --git a/internal/protocoltest/jsonrpc/api_op_JsonIntEnums_test.go b/internal/protocoltest/jsonrpc/api_op_JsonIntEnums_test.go
new file mode 100644
index 00000000000..b5a13aa31ab
--- /dev/null
+++ b/internal/protocoltest/jsonrpc/api_op_JsonIntEnums_test.go
@@ -0,0 +1,255 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package jsonrpc
+
+import (
+ "bytes"
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ protocoltesthttp "github.com/aws/aws-sdk-go-v2/internal/protocoltest"
+ "github.com/aws/aws-sdk-go-v2/internal/protocoltest/jsonrpc/types"
+ "github.com/aws/smithy-go/middleware"
+ smithyprivateprotocol "github.com/aws/smithy-go/private/protocol"
+ smithytesting "github.com/aws/smithy-go/testing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "testing"
+)
+
+func TestClient_JsonIntEnums_awsAwsjson11Serialize(t *testing.T) {
+ cases := map[string]struct {
+ Params *JsonIntEnumsInput
+ ExpectMethod string
+ ExpectURIPath string
+ ExpectQuery []smithytesting.QueryItem
+ RequireQuery []string
+ ForbidQuery []string
+ ExpectHeader http.Header
+ RequireHeader []string
+ ForbidHeader []string
+ Host *url.URL
+ BodyMediaType string
+ BodyAssert func(io.Reader) error
+ }{
+ // Serializes simple scalar properties
+ "AwsJson11IntEnums": {
+ Params: &JsonIntEnumsInput{
+ IntEnum1: 1,
+ IntEnum2: 2,
+ IntEnum3: 3,
+ IntEnumList: []types.IntegerEnum{
+ 1,
+ 2,
+ },
+ IntEnumSet: []types.IntegerEnum{
+ 1,
+ 2,
+ },
+ IntEnumMap: map[string]types.IntegerEnum{
+ "a": 1,
+ "b": 2,
+ },
+ },
+ ExpectMethod: "POST",
+ ExpectURIPath: "/",
+ ExpectQuery: []smithytesting.QueryItem{},
+ ExpectHeader: http.Header{
+ "Content-Type": []string{"application/x-amz-json-1.1"},
+ "X-Amz-Target": []string{"JsonProtocol.JsonIntEnums"},
+ },
+ BodyMediaType: "application/json",
+ BodyAssert: func(actual io.Reader) error {
+ return smithytesting.CompareJSONReaderBytes(actual, []byte(`{
+ "intEnum1": 1,
+ "intEnum2": 2,
+ "intEnum3": 3,
+ "intEnumList": [
+ 1,
+ 2
+ ],
+ "intEnumSet": [
+ 1,
+ 2
+ ],
+ "intEnumMap": {
+ "a": 1,
+ "b": 2
+ }
+ }`))
+ },
+ },
+ }
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ actualReq := &http.Request{}
+ serverURL := "http://localhost:8888/"
+ if c.Host != nil {
+ u, err := url.Parse(serverURL)
+ if err != nil {
+ t.Fatalf("expect no error, got %v", err)
+ }
+ u.Path = c.Host.Path
+ u.RawPath = c.Host.RawPath
+ u.RawQuery = c.Host.RawQuery
+ serverURL = u.String()
+ }
+ client := New(Options{
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ HTTPClient: protocoltesthttp.NewClient(),
+ Region: "us-west-2",
+ })
+ result, err := client.JsonIntEnums(context.Background(), c.Params, func(options *Options) {
+ options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error {
+ return smithyprivateprotocol.AddCaptureRequestMiddleware(stack, actualReq)
+ })
+ })
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if e, a := c.ExpectMethod, actualReq.Method; e != a {
+ t.Errorf("expect %v method, got %v", e, a)
+ }
+ if e, a := c.ExpectURIPath, actualReq.URL.RawPath; e != a {
+ t.Errorf("expect %v path, got %v", e, a)
+ }
+ queryItems := smithytesting.ParseRawQuery(actualReq.URL.RawQuery)
+ smithytesting.AssertHasQuery(t, c.ExpectQuery, queryItems)
+ smithytesting.AssertHasQueryKeys(t, c.RequireQuery, queryItems)
+ smithytesting.AssertNotHaveQueryKeys(t, c.ForbidQuery, queryItems)
+ smithytesting.AssertHasHeader(t, c.ExpectHeader, actualReq.Header)
+ smithytesting.AssertHasHeaderKeys(t, c.RequireHeader, actualReq.Header)
+ smithytesting.AssertNotHaveHeaderKeys(t, c.ForbidHeader, actualReq.Header)
+ if c.BodyAssert != nil {
+ if err := c.BodyAssert(actualReq.Body); err != nil {
+ t.Errorf("expect body equal, got %v", err)
+ }
+ }
+ })
+ }
+}
+
+func TestClient_JsonIntEnums_awsAwsjson11Deserialize(t *testing.T) {
+ cases := map[string]struct {
+ StatusCode int
+ Header http.Header
+ BodyMediaType string
+ Body []byte
+ ExpectResult *JsonIntEnumsOutput
+ }{
+ // Serializes simple scalar properties
+ "AwsJson11IntEnums": {
+ StatusCode: 200,
+ Header: http.Header{
+ "Content-Type": []string{"application/x-amz-json-1.1"},
+ "X-Amz-Target": []string{"JsonProtocol.JsonIntEnums"},
+ },
+ BodyMediaType: "application/json",
+ Body: []byte(`{
+ "intEnum1": 1,
+ "intEnum2": 2,
+ "intEnum3": 3,
+ "intEnumList": [
+ 1,
+ 2
+ ],
+ "intEnumSet": [
+ 1,
+ 2
+ ],
+ "intEnumMap": {
+ "a": 1,
+ "b": 2
+ }
+ }`),
+ ExpectResult: &JsonIntEnumsOutput{
+ IntEnum1: 1,
+ IntEnum2: 2,
+ IntEnum3: 3,
+ IntEnumList: []types.IntegerEnum{
+ 1,
+ 2,
+ },
+ IntEnumSet: []types.IntegerEnum{
+ 1,
+ 2,
+ },
+ IntEnumMap: map[string]types.IntegerEnum{
+ "a": 1,
+ "b": 2,
+ },
+ },
+ },
+ }
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ serverURL := "http://localhost:8888/"
+ client := New(Options{
+ HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
+ headers := http.Header{}
+ for k, vs := range c.Header {
+ for _, v := range vs {
+ headers.Add(k, v)
+ }
+ }
+ if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 {
+ headers.Set("Content-Type", c.BodyMediaType)
+ }
+ response := &http.Response{
+ StatusCode: c.StatusCode,
+ Header: headers,
+ Request: r,
+ }
+ if len(c.Body) != 0 {
+ response.ContentLength = int64(len(c.Body))
+ response.Body = ioutil.NopCloser(bytes.NewReader(c.Body))
+ } else {
+
+ response.Body = http.NoBody
+ }
+ return response, nil
+ }),
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ Region: "us-west-2",
+ })
+ var params JsonIntEnumsInput
+ result, err := client.JsonIntEnums(context.Background(), ¶ms)
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if err := smithytesting.CompareValues(c.ExpectResult, result); err != nil {
+ t.Errorf("expect c.ExpectResult value match:\n%v", err)
+ }
+ })
+ }
+}
diff --git a/internal/protocoltest/jsonrpc/deserializers.go b/internal/protocoltest/jsonrpc/deserializers.go
index 66ce7c6d779..43ed4444b87 100644
--- a/internal/protocoltest/jsonrpc/deserializers.go
+++ b/internal/protocoltest/jsonrpc/deserializers.go
@@ -927,6 +927,114 @@ func awsAwsjson11_deserializeOpErrorJsonEnums(response *smithyhttp.Response, met
}
}
+type awsAwsjson11_deserializeOpJsonIntEnums struct {
+}
+
+func (*awsAwsjson11_deserializeOpJsonIntEnums) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsAwsjson11_deserializeOpJsonIntEnums) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
+ out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
+) {
+ out, metadata, err = next.HandleDeserialize(ctx, in)
+ if err != nil {
+ return out, metadata, err
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsAwsjson11_deserializeOpErrorJsonIntEnums(response, &metadata)
+ }
+ output := &JsonIntEnumsOutput{}
+ out.Result = output
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(response.Body, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ var shape interface{}
+ if err := decoder.Decode(&shape); err != nil && err != io.EOF {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ err = awsAwsjson11_deserializeOpDocumentJsonIntEnumsOutput(&output, shape)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ return out, metadata, err
+}
+
+func awsAwsjson11_deserializeOpErrorJsonIntEnums(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ bodyInfo, err := getProtocolErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok {
+ errorCode = restjson.SanitizeErrorCode(typ)
+ }
+ if len(bodyInfo.Message) != 0 {
+ errorMessage = bodyInfo.Message
+ }
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
type awsAwsjson11_deserializeOpJsonUnions struct {
}
@@ -3268,6 +3376,126 @@ func awsAwsjson11_deserializeDocumentGreetingStruct(v **types.GreetingStruct, va
return nil
}
+func awsAwsjson11_deserializeDocumentIntegerEnumList(v *[]types.IntegerEnum, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.([]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var cv []types.IntegerEnum
+ if *v == nil {
+ cv = []types.IntegerEnum{}
+ } else {
+ cv = *v
+ }
+
+ for _, value := range shape {
+ var col types.IntegerEnum
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ col = int32(i64)
+ }
+ cv = append(cv, col)
+
+ }
+ *v = cv
+ return nil
+}
+
+func awsAwsjson11_deserializeDocumentIntegerEnumMap(v *map[string]types.IntegerEnum, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var mv map[string]types.IntegerEnum
+ if *v == nil {
+ mv = map[string]types.IntegerEnum{}
+ } else {
+ mv = *v
+ }
+
+ for key, value := range shape {
+ var parsedVal types.IntegerEnum
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ parsedVal = int32(i64)
+ }
+ mv[key] = parsedVal
+
+ }
+ *v = mv
+ return nil
+}
+
+func awsAwsjson11_deserializeDocumentIntegerEnumSet(v *[]types.IntegerEnum, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.([]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var cv []types.IntegerEnum
+ if *v == nil {
+ cv = []types.IntegerEnum{}
+ } else {
+ cv = *v
+ }
+
+ for _, value := range shape {
+ var col types.IntegerEnum
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ col = int32(i64)
+ }
+ cv = append(cv, col)
+
+ }
+ *v = cv
+ return nil
+}
+
func awsAwsjson11_deserializeDocumentSparseStringList(v *[]*string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
@@ -3644,6 +3872,91 @@ func awsAwsjson11_deserializeOpDocumentJsonEnumsOutput(v **JsonEnumsOutput, valu
return nil
}
+func awsAwsjson11_deserializeOpDocumentJsonIntEnumsOutput(v **JsonIntEnumsOutput, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *JsonIntEnumsOutput
+ if *v == nil {
+ sv = &JsonIntEnumsOutput{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "intEnum1":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.IntEnum1 = int32(i64)
+ }
+
+ case "intEnum2":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.IntEnum2 = int32(i64)
+ }
+
+ case "intEnum3":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected IntegerEnum to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.IntEnum3 = int32(i64)
+ }
+
+ case "intEnumList":
+ if err := awsAwsjson11_deserializeDocumentIntegerEnumList(&sv.IntEnumList, value); err != nil {
+ return err
+ }
+
+ case "intEnumMap":
+ if err := awsAwsjson11_deserializeDocumentIntegerEnumMap(&sv.IntEnumMap, value); err != nil {
+ return err
+ }
+
+ case "intEnumSet":
+ if err := awsAwsjson11_deserializeDocumentIntegerEnumSet(&sv.IntEnumSet, value); err != nil {
+ return err
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
func awsAwsjson11_deserializeOpDocumentJsonUnionsOutput(v **JsonUnionsOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
diff --git a/internal/protocoltest/jsonrpc/generated.json b/internal/protocoltest/jsonrpc/generated.json
index 8a84a76fb55..cc04e302d42 100644
--- a/internal/protocoltest/jsonrpc/generated.json
+++ b/internal/protocoltest/jsonrpc/generated.json
@@ -26,6 +26,8 @@
"api_op_HostWithPathOperation_test.go",
"api_op_JsonEnums.go",
"api_op_JsonEnums_test.go",
+ "api_op_JsonIntEnums.go",
+ "api_op_JsonIntEnums_test.go",
"api_op_JsonUnions.go",
"api_op_JsonUnions_test.go",
"api_op_KitchenSinkOperation.go",
diff --git a/internal/protocoltest/jsonrpc/serializers.go b/internal/protocoltest/jsonrpc/serializers.go
index 7c89784863b..805f2681abe 100644
--- a/internal/protocoltest/jsonrpc/serializers.go
+++ b/internal/protocoltest/jsonrpc/serializers.go
@@ -540,6 +540,67 @@ func (m *awsAwsjson11_serializeOpJsonEnums) HandleSerialize(ctx context.Context,
return next.HandleSerialize(ctx, in)
}
+type awsAwsjson11_serializeOpJsonIntEnums struct {
+}
+
+func (*awsAwsjson11_serializeOpJsonIntEnums) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsAwsjson11_serializeOpJsonIntEnums) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ request, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
+ }
+
+ input, ok := in.Parameters.(*JsonIntEnumsInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ operationPath := "/"
+ if len(request.Request.URL.Path) == 0 {
+ request.Request.URL.Path = operationPath
+ } else {
+ request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath)
+ if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' {
+ request.Request.URL.Path += "/"
+ }
+ }
+ request.Request.Method = "POST"
+ httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1")
+ httpBindingEncoder.SetHeader("X-Amz-Target").String("JsonProtocol.JsonIntEnums")
+
+ jsonEncoder := smithyjson.NewEncoder()
+ if err := awsAwsjson11_serializeOpDocumentJsonIntEnumsInput(input, jsonEncoder.Value); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ in.Request = request
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+
type awsAwsjson11_serializeOpJsonUnions struct {
}
@@ -1503,6 +1564,39 @@ func awsAwsjson11_serializeDocumentGreetingStruct(v *types.GreetingStruct, value
return nil
}
+func awsAwsjson11_serializeDocumentIntegerEnumList(v []types.IntegerEnum, value smithyjson.Value) error {
+ array := value.Array()
+ defer array.Close()
+
+ for i := range v {
+ av := array.Value()
+ av.Integer(v[i])
+ }
+ return nil
+}
+
+func awsAwsjson11_serializeDocumentIntegerEnumMap(v map[string]types.IntegerEnum, value smithyjson.Value) error {
+ object := value.Object()
+ defer object.Close()
+
+ for key := range v {
+ om := object.Key(key)
+ om.Integer(v[key])
+ }
+ return nil
+}
+
+func awsAwsjson11_serializeDocumentIntegerEnumSet(v []types.IntegerEnum, value smithyjson.Value) error {
+ array := value.Array()
+ defer array.Close()
+
+ for i := range v {
+ av := array.Value()
+ av.Integer(v[i])
+ }
+ return nil
+}
+
func awsAwsjson11_serializeDocumentSparseStringList(v []*string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
@@ -1622,6 +1716,49 @@ func awsAwsjson11_serializeOpDocumentJsonEnumsInput(v *JsonEnumsInput, value smi
return nil
}
+func awsAwsjson11_serializeOpDocumentJsonIntEnumsInput(v *JsonIntEnumsInput, value smithyjson.Value) error {
+ object := value.Object()
+ defer object.Close()
+
+ if v.IntEnum1 != 0 {
+ ok := object.Key("intEnum1")
+ ok.Integer(v.IntEnum1)
+ }
+
+ if v.IntEnum2 != 0 {
+ ok := object.Key("intEnum2")
+ ok.Integer(v.IntEnum2)
+ }
+
+ if v.IntEnum3 != 0 {
+ ok := object.Key("intEnum3")
+ ok.Integer(v.IntEnum3)
+ }
+
+ if v.IntEnumList != nil {
+ ok := object.Key("intEnumList")
+ if err := awsAwsjson11_serializeDocumentIntegerEnumList(v.IntEnumList, ok); err != nil {
+ return err
+ }
+ }
+
+ if v.IntEnumMap != nil {
+ ok := object.Key("intEnumMap")
+ if err := awsAwsjson11_serializeDocumentIntegerEnumMap(v.IntEnumMap, ok); err != nil {
+ return err
+ }
+ }
+
+ if v.IntEnumSet != nil {
+ ok := object.Key("intEnumSet")
+ if err := awsAwsjson11_serializeDocumentIntegerEnumSet(v.IntEnumSet, ok); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
func awsAwsjson11_serializeOpDocumentJsonUnionsInput(v *JsonUnionsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
diff --git a/internal/protocoltest/jsonrpc/snapshot_test.go b/internal/protocoltest/jsonrpc/snapshot_test.go
index 31a78115e35..bdb640f40e5 100644
--- a/internal/protocoltest/jsonrpc/snapshot_test.go
+++ b/internal/protocoltest/jsonrpc/snapshot_test.go
@@ -170,6 +170,18 @@ func TestCheckSnapshot_JsonEnums(t *testing.T) {
}
}
+func TestCheckSnapshot_JsonIntEnums(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.JsonIntEnums(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "JsonIntEnums")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestCheckSnapshot_JsonUnions(t *testing.T) {
svc := New(Options{})
_, err := svc.JsonUnions(context.Background(), nil, func(o *Options) {
@@ -373,6 +385,18 @@ func TestUpdateSnapshot_JsonEnums(t *testing.T) {
}
}
+func TestUpdateSnapshot_JsonIntEnums(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.JsonIntEnums(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "JsonIntEnums")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestUpdateSnapshot_JsonUnions(t *testing.T) {
svc := New(Options{})
_, err := svc.JsonUnions(context.Background(), nil, func(o *Options) {
diff --git a/internal/protocoltest/jsonrpc/types/enums.go b/internal/protocoltest/jsonrpc/types/enums.go
index 49fef81a21f..f0cbe93725d 100644
--- a/internal/protocoltest/jsonrpc/types/enums.go
+++ b/internal/protocoltest/jsonrpc/types/enums.go
@@ -26,3 +26,12 @@ func (FooEnum) Values() []FooEnum {
"0",
}
}
+
+type IntegerEnum = int32
+
+// Enum values for IntegerEnum
+const (
+ IntegerEnumA IntegerEnum = 1
+ IntegerEnumB IntegerEnum = 2
+ IntegerEnumC IntegerEnum = 3
+)
diff --git a/internal/protocoltest/jsonrpc10/api_op_OperationWithRequiredMembersWithDefaults.go b/internal/protocoltest/jsonrpc10/api_op_OperationWithRequiredMembersWithDefaults.go
new file mode 100644
index 00000000000..5ef3924e316
--- /dev/null
+++ b/internal/protocoltest/jsonrpc10/api_op_OperationWithRequiredMembersWithDefaults.go
@@ -0,0 +1,187 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package jsonrpc10
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/aws-sdk-go-v2/internal/protocoltest/jsonrpc10/types"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "time"
+)
+
+func (c *Client) OperationWithRequiredMembersWithDefaults(ctx context.Context, params *OperationWithRequiredMembersWithDefaultsInput, optFns ...func(*Options)) (*OperationWithRequiredMembersWithDefaultsOutput, error) {
+ if params == nil {
+ params = &OperationWithRequiredMembersWithDefaultsInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "OperationWithRequiredMembersWithDefaults", params, optFns, c.addOperationOperationWithRequiredMembersWithDefaultsMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*OperationWithRequiredMembersWithDefaultsOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type OperationWithRequiredMembersWithDefaultsInput struct {
+ noSmithyDocumentSerde
+}
+
+type OperationWithRequiredMembersWithDefaultsOutput struct {
+
+ // This member is required.
+ RequiredBlob []byte
+
+ // This member is required.
+ RequiredBoolean *bool
+
+ // This member is required.
+ RequiredByte *int8
+
+ // This member is required.
+ RequiredDouble *float64
+
+ // This member is required.
+ RequiredEnum types.RequiredEnum
+
+ // This member is required.
+ RequiredFloat *float32
+
+ // This member is required.
+ RequiredIntEnum types.RequiredIntEnum
+
+ // This member is required.
+ RequiredInteger *int32
+
+ // This member is required.
+ RequiredList []string
+
+ // This member is required.
+ RequiredLong *int64
+
+ // This member is required.
+ RequiredMap map[string]string
+
+ // This member is required.
+ RequiredShort *int16
+
+ // This member is required.
+ RequiredString *string
+
+ // This member is required.
+ RequiredTimestamp *time.Time
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationOperationWithRequiredMembersWithDefaultsMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsAwsjson10_serializeOpOperationWithRequiredMembersWithDefaults{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpOperationWithRequiredMembersWithDefaults{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "OperationWithRequiredMembersWithDefaults"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opOperationWithRequiredMembersWithDefaults(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opOperationWithRequiredMembersWithDefaults(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "OperationWithRequiredMembersWithDefaults",
+ }
+}
diff --git a/internal/protocoltest/jsonrpc10/api_op_OperationWithRequiredMembersWithDefaults_test.go b/internal/protocoltest/jsonrpc10/api_op_OperationWithRequiredMembersWithDefaults_test.go
new file mode 100644
index 00000000000..0a54e3afc56
--- /dev/null
+++ b/internal/protocoltest/jsonrpc10/api_op_OperationWithRequiredMembersWithDefaults_test.go
@@ -0,0 +1,114 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package jsonrpc10
+
+import (
+ "bytes"
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/aws-sdk-go-v2/internal/protocoltest/jsonrpc10/types"
+ "github.com/aws/smithy-go/middleware"
+ "github.com/aws/smithy-go/ptr"
+ smithytesting "github.com/aws/smithy-go/testing"
+ smithytime "github.com/aws/smithy-go/time"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "io/ioutil"
+ "net/http"
+ "testing"
+)
+
+func TestClient_OperationWithRequiredMembersWithDefaults_awsAwsjson10Deserialize(t *testing.T) {
+ cases := map[string]struct {
+ StatusCode int
+ Header http.Header
+ BodyMediaType string
+ Body []byte
+ ExpectResult *OperationWithRequiredMembersWithDefaultsOutput
+ }{
+ // Client error corrects with default values when server fails to serialize
+ // required values.
+ "AwsJson10ClientErrorCorrectsWithDefaultValuesWhenServerFailsToSerializeRequiredValues": {
+ StatusCode: 200,
+ Header: http.Header{
+ "Content-Type": []string{"application/x-amz-json-1.0"},
+ },
+ BodyMediaType: "application/json",
+ Body: []byte(`{}`),
+ ExpectResult: &OperationWithRequiredMembersWithDefaultsOutput{
+ RequiredString: ptr.String("hi"),
+ RequiredBoolean: ptr.Bool(true),
+ RequiredList: []string{},
+ RequiredTimestamp: ptr.Time(smithytime.ParseEpochSeconds(1)),
+ RequiredBlob: []byte("{}"),
+ RequiredByte: ptr.Int8(1),
+ RequiredShort: ptr.Int16(1),
+ RequiredInteger: ptr.Int32(10),
+ RequiredLong: ptr.Int64(100),
+ RequiredFloat: ptr.Float32(1.0),
+ RequiredDouble: ptr.Float64(1.0),
+ RequiredMap: map[string]string{},
+ RequiredEnum: types.RequiredEnum("FOO"),
+ RequiredIntEnum: 1,
+ },
+ },
+ }
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ if name == "AwsJson10ClientErrorCorrectsWithDefaultValuesWhenServerFailsToSerializeRequiredValues" {
+ t.Skip("disabled test aws.protocoltests.json10#JsonRpc10 aws.protocoltests.json10#OperationWithRequiredMembersWithDefaults")
+ }
+
+ serverURL := "http://localhost:8888/"
+ client := New(Options{
+ HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
+ headers := http.Header{}
+ for k, vs := range c.Header {
+ for _, v := range vs {
+ headers.Add(k, v)
+ }
+ }
+ if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 {
+ headers.Set("Content-Type", c.BodyMediaType)
+ }
+ response := &http.Response{
+ StatusCode: c.StatusCode,
+ Header: headers,
+ Request: r,
+ }
+ if len(c.Body) != 0 {
+ response.ContentLength = int64(len(c.Body))
+ response.Body = ioutil.NopCloser(bytes.NewReader(c.Body))
+ } else {
+
+ response.Body = http.NoBody
+ }
+ return response, nil
+ }),
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ Region: "us-west-2",
+ })
+ var params OperationWithRequiredMembersWithDefaultsInput
+ result, err := client.OperationWithRequiredMembersWithDefaults(context.Background(), ¶ms)
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if err := smithytesting.CompareValues(c.ExpectResult, result); err != nil {
+ t.Errorf("expect c.ExpectResult value match:\n%v", err)
+ }
+ })
+ }
+}
diff --git a/internal/protocoltest/jsonrpc10/deserializers.go b/internal/protocoltest/jsonrpc10/deserializers.go
index e331194feeb..1d8db7cdf66 100644
--- a/internal/protocoltest/jsonrpc10/deserializers.go
+++ b/internal/protocoltest/jsonrpc10/deserializers.go
@@ -1251,6 +1251,114 @@ func awsAwsjson10_deserializeOpErrorOperationWithRequiredMembers(response *smith
}
}
+type awsAwsjson10_deserializeOpOperationWithRequiredMembersWithDefaults struct {
+}
+
+func (*awsAwsjson10_deserializeOpOperationWithRequiredMembersWithDefaults) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsAwsjson10_deserializeOpOperationWithRequiredMembersWithDefaults) 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
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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, awsAwsjson10_deserializeOpErrorOperationWithRequiredMembersWithDefaults(response, &metadata)
+ }
+ output := &OperationWithRequiredMembersWithDefaultsOutput{}
+ out.Result = output
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(response.Body, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ var shape interface{}
+ if err := decoder.Decode(&shape); err != nil && err != io.EOF {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ err = awsAwsjson10_deserializeOpDocumentOperationWithRequiredMembersWithDefaultsOutput(&output, shape)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ return out, metadata, err
+}
+
+func awsAwsjson10_deserializeOpErrorOperationWithRequiredMembersWithDefaults(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ bodyInfo, err := getProtocolErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok {
+ errorCode = restjson.SanitizeErrorCode(typ)
+ }
+ if len(bodyInfo.Message) != 0 {
+ errorMessage = bodyInfo.Message
+ }
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
type awsAwsjson10_deserializeOpPutWithContentEncoding struct {
}
@@ -3121,6 +3229,236 @@ func awsAwsjson10_deserializeOpDocumentOperationWithRequiredMembersOutput(v **Op
return nil
}
+func awsAwsjson10_deserializeOpDocumentOperationWithRequiredMembersWithDefaultsOutput(v **OperationWithRequiredMembersWithDefaultsOutput, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *OperationWithRequiredMembersWithDefaultsOutput
+ if *v == nil {
+ sv = &OperationWithRequiredMembersWithDefaultsOutput{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "requiredBlob":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected Blob to be []byte, got %T instead", value)
+ }
+ dv, err := base64.StdEncoding.DecodeString(jtv)
+ if err != nil {
+ return fmt.Errorf("failed to base64 decode Blob, %w", err)
+ }
+ sv.RequiredBlob = dv
+ }
+
+ case "requiredBoolean":
+ if value != nil {
+ jtv, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
+ }
+ sv.RequiredBoolean = ptr.Bool(jtv)
+ }
+
+ case "requiredByte":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected Byte to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredByte = ptr.Int8(int8(i64))
+ }
+
+ case "requiredDouble":
+ if value != nil {
+ switch jtv := value.(type) {
+ case json.Number:
+ f64, err := jtv.Float64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredDouble = ptr.Float64(f64)
+
+ case string:
+ var f64 float64
+ switch {
+ case strings.EqualFold(jtv, "NaN"):
+ f64 = math.NaN()
+
+ case strings.EqualFold(jtv, "Infinity"):
+ f64 = math.Inf(1)
+
+ case strings.EqualFold(jtv, "-Infinity"):
+ f64 = math.Inf(-1)
+
+ default:
+ return fmt.Errorf("unknown JSON number value: %s", jtv)
+
+ }
+ sv.RequiredDouble = ptr.Float64(f64)
+
+ default:
+ return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value)
+
+ }
+ }
+
+ case "requiredEnum":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected RequiredEnum to be of type string, got %T instead", value)
+ }
+ sv.RequiredEnum = types.RequiredEnum(jtv)
+ }
+
+ case "requiredFloat":
+ if value != nil {
+ switch jtv := value.(type) {
+ case json.Number:
+ f64, err := jtv.Float64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredFloat = ptr.Float32(float32(f64))
+
+ case string:
+ var f64 float64
+ switch {
+ case strings.EqualFold(jtv, "NaN"):
+ f64 = math.NaN()
+
+ case strings.EqualFold(jtv, "Infinity"):
+ f64 = math.Inf(1)
+
+ case strings.EqualFold(jtv, "-Infinity"):
+ f64 = math.Inf(-1)
+
+ default:
+ return fmt.Errorf("unknown JSON number value: %s", jtv)
+
+ }
+ sv.RequiredFloat = ptr.Float32(float32(f64))
+
+ default:
+ return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value)
+
+ }
+ }
+
+ case "requiredInteger":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredInteger = ptr.Int32(int32(i64))
+ }
+
+ case "requiredIntEnum":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected RequiredIntEnum to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredIntEnum = int32(i64)
+ }
+
+ case "requiredList":
+ if err := awsAwsjson10_deserializeDocumentRequiredStringList(&sv.RequiredList, value); err != nil {
+ return err
+ }
+
+ case "requiredLong":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredLong = ptr.Int64(i64)
+ }
+
+ case "requiredMap":
+ if err := awsAwsjson10_deserializeDocumentRequiredStringMap(&sv.RequiredMap, value); err != nil {
+ return err
+ }
+
+ case "requiredShort":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected Short to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredShort = ptr.Int16(int16(i64))
+ }
+
+ case "requiredString":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.RequiredString = ptr.String(jtv)
+ }
+
+ case "requiredTimestamp":
+ if value != nil {
+ switch jtv := value.(type) {
+ case json.Number:
+ f64, err := jtv.Float64()
+ if err != nil {
+ return err
+ }
+ sv.RequiredTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64))
+
+ default:
+ return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
+
+ }
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
func awsAwsjson10_deserializeOpDocumentSimpleScalarPropertiesOutput(v **SimpleScalarPropertiesOutput, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
diff --git a/internal/protocoltest/jsonrpc10/generated.json b/internal/protocoltest/jsonrpc10/generated.json
index 33e8f5f020d..f676d29c052 100644
--- a/internal/protocoltest/jsonrpc10/generated.json
+++ b/internal/protocoltest/jsonrpc10/generated.json
@@ -31,6 +31,8 @@
"api_op_OperationWithNestedStructure.go",
"api_op_OperationWithNestedStructure_test.go",
"api_op_OperationWithRequiredMembers.go",
+ "api_op_OperationWithRequiredMembersWithDefaults.go",
+ "api_op_OperationWithRequiredMembersWithDefaults_test.go",
"api_op_OperationWithRequiredMembers_test.go",
"api_op_PutWithContentEncoding.go",
"api_op_PutWithContentEncoding_test.go",
diff --git a/internal/protocoltest/jsonrpc10/serializers.go b/internal/protocoltest/jsonrpc10/serializers.go
index 742b57e20c9..8cd0a032d1a 100644
--- a/internal/protocoltest/jsonrpc10/serializers.go
+++ b/internal/protocoltest/jsonrpc10/serializers.go
@@ -728,6 +728,62 @@ func (m *awsAwsjson10_serializeOpOperationWithRequiredMembers) HandleSerialize(c
return next.HandleSerialize(ctx, in)
}
+type awsAwsjson10_serializeOpOperationWithRequiredMembersWithDefaults struct {
+}
+
+func (*awsAwsjson10_serializeOpOperationWithRequiredMembersWithDefaults) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsAwsjson10_serializeOpOperationWithRequiredMembersWithDefaults) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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.(*OperationWithRequiredMembersWithDefaultsInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ operationPath := "/"
+ if len(request.Request.URL.Path) == 0 {
+ request.Request.URL.Path = operationPath
+ } else {
+ request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath)
+ if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' {
+ request.Request.URL.Path += "/"
+ }
+ }
+ request.Request.Method = "POST"
+ httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.0")
+ httpBindingEncoder.SetHeader("X-Amz-Target").String("JsonRpc10.OperationWithRequiredMembersWithDefaults")
+
+ if request, err = request.SetStream(strings.NewReader(`{}`)); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ in.Request = request
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+
type awsAwsjson10_serializeOpPutWithContentEncoding struct {
}
diff --git a/internal/protocoltest/jsonrpc10/snapshot_test.go b/internal/protocoltest/jsonrpc10/snapshot_test.go
index 5c32996d20d..e5e46825576 100644
--- a/internal/protocoltest/jsonrpc10/snapshot_test.go
+++ b/internal/protocoltest/jsonrpc10/snapshot_test.go
@@ -206,6 +206,18 @@ func TestCheckSnapshot_OperationWithRequiredMembers(t *testing.T) {
}
}
+func TestCheckSnapshot_OperationWithRequiredMembersWithDefaults(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.OperationWithRequiredMembersWithDefaults(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "OperationWithRequiredMembersWithDefaults")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestCheckSnapshot_PutWithContentEncoding(t *testing.T) {
svc := New(Options{})
_, err := svc.PutWithContentEncoding(context.Background(), nil, func(o *Options) {
@@ -373,6 +385,18 @@ func TestUpdateSnapshot_OperationWithRequiredMembers(t *testing.T) {
}
}
+func TestUpdateSnapshot_OperationWithRequiredMembersWithDefaults(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.OperationWithRequiredMembersWithDefaults(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "OperationWithRequiredMembersWithDefaults")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestUpdateSnapshot_PutWithContentEncoding(t *testing.T) {
svc := New(Options{})
_, err := svc.PutWithContentEncoding(context.Background(), nil, func(o *Options) {
diff --git a/internal/protocoltest/jsonrpc10/types/enums.go b/internal/protocoltest/jsonrpc10/types/enums.go
index cdf0d71f0e2..c807405a3d7 100644
--- a/internal/protocoltest/jsonrpc10/types/enums.go
+++ b/internal/protocoltest/jsonrpc10/types/enums.go
@@ -2,6 +2,35 @@
package types
+type RequiredEnum string
+
+// Enum values for RequiredEnum
+const (
+ RequiredEnumFoo RequiredEnum = "FOO"
+ RequiredEnumBar RequiredEnum = "BAR"
+ RequiredEnumBaz RequiredEnum = "BAZ"
+)
+
+// Values returns all known values for RequiredEnum. Note that this can be
+// expanded in the future, and so it is only as up to date as the client.
+//
+// The ordering of this slice is not guaranteed to be stable across updates.
+func (RequiredEnum) Values() []RequiredEnum {
+ return []RequiredEnum{
+ "FOO",
+ "BAR",
+ "BAZ",
+ }
+}
+
+type RequiredIntEnum = int32
+
+// Enum values for RequiredIntEnum
+const (
+ RequiredIntEnumOne RequiredIntEnum = 1
+ RequiredIntEnumTwo RequiredIntEnum = 2
+)
+
type TestEnum string
// Enum values for TestEnum
diff --git a/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go b/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go
index 018e8de3053..5e99a880de6 100644
--- a/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go
+++ b/internal/protocoltest/restxml/api_op_HttpPrefixHeaders_test.go
@@ -56,7 +56,7 @@ func TestClient_HttpPrefixHeaders_awsRestxmlSerialize(t *testing.T) {
return smithytesting.CompareReaderEmpty(actual)
},
},
- // No prefix headers are serialized because the value is empty
+ // No prefix headers are serialized because the value is not present
"HttpPrefixHeadersAreNotPresent": {
Params: &HttpPrefixHeadersInput{
Foo: ptr.String("Foo"),
@@ -72,6 +72,23 @@ func TestClient_HttpPrefixHeaders_awsRestxmlSerialize(t *testing.T) {
return smithytesting.CompareReaderEmpty(actual)
},
},
+ // Serialize prefix headers were the value is present but empty
+ "HttpPrefixEmptyHeaders": {
+ Params: &HttpPrefixHeadersInput{
+ FooMap: map[string]string{
+ "Abc": "",
+ },
+ },
+ ExpectMethod: "GET",
+ ExpectURIPath: "/HttpPrefixHeaders",
+ ExpectQuery: []smithytesting.QueryItem{},
+ ExpectHeader: http.Header{
+ "X-Foo-Abc": []string{""},
+ },
+ BodyAssert: func(actual io.Reader) error {
+ return smithytesting.CompareReaderEmpty(actual)
+ },
+ },
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
diff --git a/internal/protocoltest/restxml/api_op_NestedXmlMapWithXmlName.go b/internal/protocoltest/restxml/api_op_NestedXmlMapWithXmlName.go
new file mode 100644
index 00000000000..c4c97bb1fb3
--- /dev/null
+++ b/internal/protocoltest/restxml/api_op_NestedXmlMapWithXmlName.go
@@ -0,0 +1,147 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package restxml
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// Nested Xml Maps with key/values with @xmlName
+func (c *Client) NestedXmlMapWithXmlName(ctx context.Context, params *NestedXmlMapWithXmlNameInput, optFns ...func(*Options)) (*NestedXmlMapWithXmlNameOutput, error) {
+ if params == nil {
+ params = &NestedXmlMapWithXmlNameInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "NestedXmlMapWithXmlName", params, optFns, c.addOperationNestedXmlMapWithXmlNameMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*NestedXmlMapWithXmlNameOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type NestedXmlMapWithXmlNameInput struct {
+ NestedXmlMapWithXmlNameMap map[string]map[string]string
+
+ noSmithyDocumentSerde
+}
+
+type NestedXmlMapWithXmlNameOutput struct {
+ NestedXmlMapWithXmlNameMap map[string]map[string]string
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationNestedXmlMapWithXmlNameMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsRestxml_serializeOpNestedXmlMapWithXmlName{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsRestxml_deserializeOpNestedXmlMapWithXmlName{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "NestedXmlMapWithXmlName"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opNestedXmlMapWithXmlName(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addSpanInitializeStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanInitializeEnd(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestStart(stack); err != nil {
+ return err
+ }
+ if err = addSpanBuildRequestEnd(stack); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opNestedXmlMapWithXmlName(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "NestedXmlMapWithXmlName",
+ }
+}
diff --git a/internal/protocoltest/restxml/api_op_NestedXmlMapWithXmlName_test.go b/internal/protocoltest/restxml/api_op_NestedXmlMapWithXmlName_test.go
new file mode 100644
index 00000000000..1f5a6be2792
--- /dev/null
+++ b/internal/protocoltest/restxml/api_op_NestedXmlMapWithXmlName_test.go
@@ -0,0 +1,273 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package restxml
+
+import (
+ "bytes"
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ protocoltesthttp "github.com/aws/aws-sdk-go-v2/internal/protocoltest"
+ "github.com/aws/smithy-go/middleware"
+ smithyprivateprotocol "github.com/aws/smithy-go/private/protocol"
+ smithyrand "github.com/aws/smithy-go/rand"
+ smithytesting "github.com/aws/smithy-go/testing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "testing"
+)
+
+func TestClient_NestedXmlMapWithXmlName_awsRestxmlSerialize(t *testing.T) {
+ cases := map[string]struct {
+ Params *NestedXmlMapWithXmlNameInput
+ ExpectMethod string
+ ExpectURIPath string
+ ExpectQuery []smithytesting.QueryItem
+ RequireQuery []string
+ ForbidQuery []string
+ ExpectHeader http.Header
+ RequireHeader []string
+ ForbidHeader []string
+ Host *url.URL
+ BodyMediaType string
+ BodyAssert func(io.Reader) error
+ }{
+ // Serializes nested XML Maps in requests that have xmlName on members
+ "NestedXmlMapWithXmlNameSerializes": {
+ Params: &NestedXmlMapWithXmlNameInput{
+ NestedXmlMapWithXmlNameMap: map[string]map[string]string{
+ "foo": {
+ "bar": "Baz",
+ "fizz": "Buzz",
+ },
+ "qux": {
+ "foobar": "Bar",
+ "fizzbuzz": "Buzz",
+ },
+ },
+ },
+ ExpectMethod: "POST",
+ ExpectURIPath: "/NestedXmlMapWithXmlName",
+ ExpectQuery: []smithytesting.QueryItem{},
+ ExpectHeader: http.Header{
+ "Content-Type": []string{"application/xml"},
+ },
+ BodyMediaType: "application/xml",
+ BodyAssert: func(actual io.Reader) error {
+ return smithytesting.CompareXMLReaderBytes(actual, []byte(`
+
+
+ foo
+
+
+ bar
+ Baz
+
+
+ fizz
+ Buzz
+
+
+
+
+ qux
+
+
+ foobar
+ Bar
+
+
+ fizzbuzz
+ Buzz
+
+
+
+
+
+ `))
+ },
+ },
+ }
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ actualReq := &http.Request{}
+ serverURL := "http://localhost:8888/"
+ if c.Host != nil {
+ u, err := url.Parse(serverURL)
+ if err != nil {
+ t.Fatalf("expect no error, got %v", err)
+ }
+ u.Path = c.Host.Path
+ u.RawPath = c.Host.RawPath
+ u.RawQuery = c.Host.RawQuery
+ serverURL = u.String()
+ }
+ client := New(Options{
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ HTTPClient: protocoltesthttp.NewClient(),
+ IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
+ Region: "us-west-2",
+ })
+ result, err := client.NestedXmlMapWithXmlName(context.Background(), c.Params, func(options *Options) {
+ options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error {
+ return smithyprivateprotocol.AddCaptureRequestMiddleware(stack, actualReq)
+ })
+ })
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if e, a := c.ExpectMethod, actualReq.Method; e != a {
+ t.Errorf("expect %v method, got %v", e, a)
+ }
+ if e, a := c.ExpectURIPath, actualReq.URL.RawPath; e != a {
+ t.Errorf("expect %v path, got %v", e, a)
+ }
+ queryItems := smithytesting.ParseRawQuery(actualReq.URL.RawQuery)
+ smithytesting.AssertHasQuery(t, c.ExpectQuery, queryItems)
+ smithytesting.AssertHasQueryKeys(t, c.RequireQuery, queryItems)
+ smithytesting.AssertNotHaveQueryKeys(t, c.ForbidQuery, queryItems)
+ smithytesting.AssertHasHeader(t, c.ExpectHeader, actualReq.Header)
+ smithytesting.AssertHasHeaderKeys(t, c.RequireHeader, actualReq.Header)
+ smithytesting.AssertNotHaveHeaderKeys(t, c.ForbidHeader, actualReq.Header)
+ if c.BodyAssert != nil {
+ if err := c.BodyAssert(actualReq.Body); err != nil {
+ t.Errorf("expect body equal, got %v", err)
+ }
+ }
+ })
+ }
+}
+
+func TestClient_NestedXmlMapWithXmlName_awsRestxmlDeserialize(t *testing.T) {
+ cases := map[string]struct {
+ StatusCode int
+ Header http.Header
+ BodyMediaType string
+ Body []byte
+ ExpectResult *NestedXmlMapWithXmlNameOutput
+ }{
+ // Serializes nested XML maps in responses that have xmlName on members
+ "NestedXmlMapWithXmlNameDeserializes": {
+ StatusCode: 200,
+ Header: http.Header{
+ "Content-Type": []string{"application/xml"},
+ },
+ BodyMediaType: "application/xml",
+ Body: []byte(`
+
+
+ foo
+
+
+ bar
+ Baz
+
+
+ fizz
+ Buzz
+
+
+
+
+ qux
+
+
+ foobar
+ Bar
+
+
+ fizzbuzz
+ Buzz
+
+
+
+
+
+ `),
+ ExpectResult: &NestedXmlMapWithXmlNameOutput{
+ NestedXmlMapWithXmlNameMap: map[string]map[string]string{
+ "foo": {
+ "bar": "Baz",
+ "fizz": "Buzz",
+ },
+ "qux": {
+ "foobar": "Bar",
+ "fizzbuzz": "Buzz",
+ },
+ },
+ },
+ },
+ }
+ for name, c := range cases {
+ t.Run(name, func(t *testing.T) {
+ serverURL := "http://localhost:8888/"
+ client := New(Options{
+ HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
+ headers := http.Header{}
+ for k, vs := range c.Header {
+ for _, v := range vs {
+ headers.Add(k, v)
+ }
+ }
+ if len(c.BodyMediaType) != 0 && len(headers.Values("Content-Type")) == 0 {
+ headers.Set("Content-Type", c.BodyMediaType)
+ }
+ response := &http.Response{
+ StatusCode: c.StatusCode,
+ Header: headers,
+ Request: r,
+ }
+ if len(c.Body) != 0 {
+ response.ContentLength = int64(len(c.Body))
+ response.Body = ioutil.NopCloser(bytes.NewReader(c.Body))
+ } else {
+
+ response.Body = http.NoBody
+ }
+ return response, nil
+ }),
+ APIOptions: []func(*middleware.Stack) error{
+ func(s *middleware.Stack) error {
+ s.Finalize.Clear()
+ s.Initialize.Remove(`OperationInputValidation`)
+ return nil
+ },
+ },
+ EndpointResolver: EndpointResolverFunc(func(region string, options EndpointResolverOptions) (e aws.Endpoint, err error) {
+ e.URL = serverURL
+ e.SigningRegion = "us-west-2"
+ return e, err
+ }),
+ IdempotencyTokenProvider: smithyrand.NewUUIDIdempotencyToken(&smithytesting.ByteLoop{}),
+ Region: "us-west-2",
+ })
+ var params NestedXmlMapWithXmlNameInput
+ result, err := client.NestedXmlMapWithXmlName(context.Background(), ¶ms)
+ if err != nil {
+ t.Fatalf("expect nil err, got %v", err)
+ }
+ if result == nil {
+ t.Fatalf("expect not nil result")
+ }
+ if err := smithytesting.CompareValues(c.ExpectResult, result); err != nil {
+ t.Errorf("expect c.ExpectResult value match:\n%v", err)
+ }
+ })
+ }
+}
diff --git a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go
index 8516a1e0d2d..27b527896d5 100644
--- a/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go
+++ b/internal/protocoltest/restxml/api_op_NullAndEmptyHeadersClient_test.go
@@ -32,7 +32,8 @@ func TestClient_NullAndEmptyHeadersClient_awsRestxmlSerialize(t *testing.T) {
BodyMediaType string
BodyAssert func(io.Reader) error
}{
- // Do not send null values, empty strings, or empty lists over the wire in headers
+ // Do not send null values, but do send empty strings and empty lists over the
+ // wire in headers
"NullAndEmptyHeaders": {
Params: &NullAndEmptyHeadersClientInput{
A: nil,
@@ -42,10 +43,12 @@ func TestClient_NullAndEmptyHeadersClient_awsRestxmlSerialize(t *testing.T) {
ExpectMethod: "GET",
ExpectURIPath: "/NullAndEmptyHeadersClient",
ExpectQuery: []smithytesting.QueryItem{},
+ ExpectHeader: http.Header{
+ "X-B": []string{""},
+ "X-C": []string{""},
+ },
ForbidHeader: []string{
"X-A",
- "X-B",
- "X-C",
},
BodyAssert: func(actual io.Reader) error {
return smithytesting.CompareReaderEmpty(actual)
@@ -54,10 +57,6 @@ func TestClient_NullAndEmptyHeadersClient_awsRestxmlSerialize(t *testing.T) {
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
- if name == "NullAndEmptyHeaders" {
- t.Skip("disabled test aws.protocoltests.restxml#RestXml aws.protocoltests.restxml#NullAndEmptyHeadersClient")
- }
-
actualReq := &http.Request{}
serverURL := "http://localhost:8888/"
if c.Host != nil {
diff --git a/internal/protocoltest/restxml/deserializers.go b/internal/protocoltest/restxml/deserializers.go
index f0c87757495..e227a1a947f 100644
--- a/internal/protocoltest/restxml/deserializers.go
+++ b/internal/protocoltest/restxml/deserializers.go
@@ -3863,6 +3863,145 @@ func awsRestxml_deserializeOpDocumentNestedXmlMapsOutput(v **NestedXmlMapsOutput
return nil
}
+type awsRestxml_deserializeOpNestedXmlMapWithXmlName struct {
+}
+
+func (*awsRestxml_deserializeOpNestedXmlMapWithXmlName) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsRestxml_deserializeOpNestedXmlMapWithXmlName) 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
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsRestxml_deserializeOpErrorNestedXmlMapWithXmlName(response, &metadata)
+ }
+ output := &NestedXmlMapWithXmlNameOutput{}
+ out.Result = output
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+ body := io.TeeReader(response.Body, ringBuffer)
+ rootDecoder := xml.NewDecoder(body)
+ t, err := smithyxml.FetchRootElement(rootDecoder)
+ if err == io.EOF {
+ return out, metadata, nil
+ }
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return out, metadata, &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder := smithyxml.WrapNodeDecoder(rootDecoder, t)
+ err = awsRestxml_deserializeOpDocumentNestedXmlMapWithXmlNameOutput(&output, decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return out, metadata, &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ span.End()
+ return out, metadata, err
+}
+
+func awsRestxml_deserializeOpErrorNestedXmlMapWithXmlName(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ errorComponents, err := awsxml.GetErrorResponseComponents(errorBody, false)
+ if err != nil {
+ return err
+ }
+ if reqID := errorComponents.RequestID; len(reqID) != 0 {
+ awsmiddleware.SetRequestIDMetadata(metadata, reqID)
+ }
+ if len(errorComponents.Code) != 0 {
+ errorCode = errorComponents.Code
+ }
+ if len(errorComponents.Message) != 0 {
+ errorMessage = errorComponents.Message
+ }
+ errorBody.Seek(0, io.SeekStart)
+ switch {
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
+func awsRestxml_deserializeOpDocumentNestedXmlMapWithXmlNameOutput(v **NestedXmlMapWithXmlNameOutput, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv *NestedXmlMapWithXmlNameOutput
+ if *v == nil {
+ sv = &NestedXmlMapWithXmlNameOutput{}
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("nestedXmlMapWithXmlNameMap", t.Name.Local):
+ nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ if err := awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameMap(&sv.NestedXmlMapWithXmlNameMap, nodeDecoder); err != nil {
+ return err
+ }
+
+ default:
+ // Do nothing and ignore the unexpected tag element
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
+
type awsRestxml_deserializeOpNoInputAndNoOutput struct {
}
@@ -8633,6 +8772,197 @@ func awsRestxml_deserializeDocumentNestedPayload(v **types.NestedPayload, decode
return nil
}
+func awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameInnerMap(v *map[string]string, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv map[string]string
+ if *v == nil {
+ sv = make(map[string]string, 0)
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ switch {
+ case strings.EqualFold("entry", t.Name.Local):
+ entryDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ if err := awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameInnerMapUnwrapped(&sv, entryDecoder); err != nil {
+ return err
+ }
+
+ default:
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameInnerMapUnwrapped(v *map[string]string, decoder smithyxml.NodeDecoder) error {
+ var sv map[string]string
+ if *v == nil {
+ sv = make(map[string]string, 0)
+ } else {
+ sv = *v
+ }
+
+ var ek string
+ var ev string
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ sv[ek] = ev
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("InnerKey", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ ek = xtv
+ }
+
+ case strings.EqualFold("InnerValue", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ ev = xtv
+ }
+
+ default:
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
+func awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameMap(v *map[string]map[string]string, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv map[string]map[string]string
+ if *v == nil {
+ sv = make(map[string]map[string]string, 0)
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ switch {
+ case strings.EqualFold("entry", t.Name.Local):
+ entryDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ if err := awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameMapUnwrapped(&sv, entryDecoder); err != nil {
+ return err
+ }
+
+ default:
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameMapUnwrapped(v *map[string]map[string]string, decoder smithyxml.NodeDecoder) error {
+ var sv map[string]map[string]string
+ if *v == nil {
+ sv = make(map[string]map[string]string, 0)
+ } else {
+ sv = *v
+ }
+
+ var ek string
+ var ev map[string]string
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ sv[ek] = ev
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("OuterKey", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ ek = xtv
+ }
+
+ case strings.EqualFold("value", t.Name.Local):
+ nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ mapVar := ev
+ if err := awsRestxml_deserializeDocumentNestedXmlMapWithXmlNameInnerMap(&mapVar, nodeDecoder); err != nil {
+ return err
+ }
+ ev = mapVar
+
+ default:
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
func awsRestxml_deserializeDocumentPayloadWithXmlName(v **types.PayloadWithXmlName, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
diff --git a/internal/protocoltest/restxml/generated.json b/internal/protocoltest/restxml/generated.json
index 02a03f1da79..13931495ac9 100644
--- a/internal/protocoltest/restxml/generated.json
+++ b/internal/protocoltest/restxml/generated.json
@@ -74,6 +74,8 @@
"api_op_IgnoreQueryParamsInResponse_test.go",
"api_op_InputAndOutputWithHeaders.go",
"api_op_InputAndOutputWithHeaders_test.go",
+ "api_op_NestedXmlMapWithXmlName.go",
+ "api_op_NestedXmlMapWithXmlName_test.go",
"api_op_NestedXmlMaps.go",
"api_op_NestedXmlMaps_test.go",
"api_op_NoInputAndNoOutput.go",
diff --git a/internal/protocoltest/restxml/serializers.go b/internal/protocoltest/restxml/serializers.go
index 768726d7bdd..cfeea6603f3 100644
--- a/internal/protocoltest/restxml/serializers.go
+++ b/internal/protocoltest/restxml/serializers.go
@@ -2907,6 +2907,99 @@ func awsRestxml_serializeOpDocumentNestedXmlMapsInput(v *NestedXmlMapsInput, val
return nil
}
+type awsRestxml_serializeOpNestedXmlMapWithXmlName struct {
+}
+
+func (*awsRestxml_serializeOpNestedXmlMapWithXmlName) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsRestxml_serializeOpNestedXmlMapWithXmlName) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ 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.(*NestedXmlMapWithXmlNameInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ opPath, opQuery := httpbinding.SplitURI("/NestedXmlMapWithXmlName")
+ request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
+ request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
+ request.Method = "POST"
+ var restEncoder *httpbinding.Encoder
+ if request.URL.RawPath == "" {
+ restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ } else {
+ request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
+ restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
+ }
+
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ restEncoder.SetHeader("Content-Type").String("application/xml")
+
+ xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil))
+ rootAttr := []smithyxml.Attr{}
+ root := smithyxml.StartElement{
+ Name: smithyxml.Name{
+ Local: "NestedXmlMapWithXmlNameInputOutput",
+ },
+ Attr: rootAttr,
+ }
+ if err := awsRestxml_serializeOpDocumentNestedXmlMapWithXmlNameInput(input, xmlEncoder.RootElement(root)); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ if request, err = request.SetStream(bytes.NewReader(xmlEncoder.Bytes())); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request.Request, err = restEncoder.Encode(request.Request); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ in.Request = request
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+func awsRestxml_serializeOpHttpBindingsNestedXmlMapWithXmlNameInput(v *NestedXmlMapWithXmlNameInput, encoder *httpbinding.Encoder) error {
+ if v == nil {
+ return fmt.Errorf("unsupported serialization of nil %T", v)
+ }
+
+ return nil
+}
+
+func awsRestxml_serializeOpDocumentNestedXmlMapWithXmlNameInput(v *NestedXmlMapWithXmlNameInput, value smithyxml.Value) error {
+ defer value.Close()
+ if v.NestedXmlMapWithXmlNameMap != nil {
+ rootAttr := []smithyxml.Attr{}
+ root := smithyxml.StartElement{
+ Name: smithyxml.Name{
+ Local: "nestedXmlMapWithXmlNameMap",
+ },
+ Attr: rootAttr,
+ }
+ el := value.MemberElement(root)
+ if err := awsRestxml_serializeDocumentNestedXmlMapWithXmlNameMap(v.NestedXmlMapWithXmlNameMap, el); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
type awsRestxml_serializeOpNoInputAndNoOutput struct {
}
@@ -6142,6 +6235,68 @@ func awsRestxml_serializeDocumentNestedPayload(v *types.NestedPayload, value smi
return nil
}
+func awsRestxml_serializeDocumentNestedXmlMapWithXmlNameInnerMap(v map[string]string, value smithyxml.Value) error {
+ if !value.IsFlattened() {
+ defer value.Close()
+ }
+ m := value.Map()
+ for key := range v {
+ entry := m.Entry()
+ keyElementAttr := []smithyxml.Attr{}
+ keyElement := smithyxml.StartElement{
+ Name: smithyxml.Name{
+ Local: "InnerKey",
+ },
+ Attr: keyElementAttr,
+ }
+ entry.MemberElement(keyElement).String(key)
+ valueElementAttr := []smithyxml.Attr{}
+ valueElement := smithyxml.StartElement{
+ Name: smithyxml.Name{
+ Local: "InnerValue",
+ },
+ Attr: valueElementAttr,
+ }
+ entry.MemberElement(valueElement).String(v[key])
+ entry.Close()
+ }
+ return nil
+}
+
+func awsRestxml_serializeDocumentNestedXmlMapWithXmlNameMap(v map[string]map[string]string, value smithyxml.Value) error {
+ if !value.IsFlattened() {
+ defer value.Close()
+ }
+ m := value.Map()
+ for key := range v {
+ entry := m.Entry()
+ if v[key] == nil {
+ entry.Close()
+ continue
+ }
+ keyElementAttr := []smithyxml.Attr{}
+ keyElement := smithyxml.StartElement{
+ Name: smithyxml.Name{
+ Local: "OuterKey",
+ },
+ Attr: keyElementAttr,
+ }
+ entry.MemberElement(keyElement).String(key)
+ valueElementAttr := []smithyxml.Attr{}
+ valueElement := smithyxml.StartElement{
+ Name: smithyxml.Name{
+ Local: "value",
+ },
+ Attr: valueElementAttr,
+ }
+ if err := awsRestxml_serializeDocumentNestedXmlMapWithXmlNameInnerMap(v[key], entry.MemberElement(valueElement)); err != nil {
+ return err
+ }
+ entry.Close()
+ }
+ return nil
+}
+
func awsRestxml_serializeDocumentPayloadWithXmlName(v *types.PayloadWithXmlName, value smithyxml.Value) error {
defer value.Close()
if v.Name != nil {
diff --git a/internal/protocoltest/restxml/snapshot_test.go b/internal/protocoltest/restxml/snapshot_test.go
index 3dcc7a6dbbb..dff971bf7e7 100644
--- a/internal/protocoltest/restxml/snapshot_test.go
+++ b/internal/protocoltest/restxml/snapshot_test.go
@@ -470,6 +470,18 @@ func TestCheckSnapshot_NestedXmlMaps(t *testing.T) {
}
}
+func TestCheckSnapshot_NestedXmlMapWithXmlName(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.NestedXmlMapWithXmlName(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return testSnapshot(stack, "NestedXmlMapWithXmlName")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestCheckSnapshot_NoInputAndNoOutput(t *testing.T) {
svc := New(Options{})
_, err := svc.NoInputAndNoOutput(context.Background(), nil, func(o *Options) {
@@ -1213,6 +1225,18 @@ func TestUpdateSnapshot_NestedXmlMaps(t *testing.T) {
}
}
+func TestUpdateSnapshot_NestedXmlMapWithXmlName(t *testing.T) {
+ svc := New(Options{})
+ _, err := svc.NestedXmlMapWithXmlName(context.Background(), nil, func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ return updateSnapshot(stack, "NestedXmlMapWithXmlName")
+ })
+ })
+ if _, ok := err.(snapshotOK); !ok && err != nil {
+ t.Fatal(err)
+ }
+}
+
func TestUpdateSnapshot_NoInputAndNoOutput(t *testing.T) {
svc := New(Options{})
_, err := svc.NoInputAndNoOutput(context.Background(), nil, func(o *Options) {
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_EmptyInputOutput_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_EmptyInputOutput_test.go
index 4de98d7177c..85a8250c3fc 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_EmptyInputOutput_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_EmptyInputOutput_test.go
@@ -41,6 +41,7 @@ func TestClient_EmptyInputOutput_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/EmptyInputOutput",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_NoInputOutput_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_NoInputOutput_test.go
index aa45155611c..06a4c1c5f1e 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_NoInputOutput_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_NoInputOutput_test.go
@@ -41,6 +41,7 @@ func TestClient_NoInputOutput_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/NoInputOutput",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
ForbidHeader: []string{
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_OperationWithDefaults_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_OperationWithDefaults_test.go
index 100a7a5c6ab..f793b276ffe 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_OperationWithDefaults_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_OperationWithDefaults_test.go
@@ -46,6 +46,7 @@ func TestClient_OperationWithDefaults_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/OperationWithDefaults",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -64,6 +65,7 @@ func TestClient_OperationWithDefaults_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/OperationWithDefaults",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -112,6 +114,7 @@ func TestClient_OperationWithDefaults_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/OperationWithDefaults",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -134,6 +137,7 @@ func TestClient_OperationWithDefaults_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/OperationWithDefaults",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -155,6 +159,7 @@ func TestClient_OperationWithDefaults_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/OperationWithDefaults",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_OptionalInputOutput_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_OptionalInputOutput_test.go
index b5dcec041c1..f3ca7512509 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_OptionalInputOutput_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_OptionalInputOutput_test.go
@@ -41,6 +41,7 @@ func TestClient_OptionalInputOutput_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/OptionalInputOutput",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_RecursiveShapes_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_RecursiveShapes_test.go
index 43ce718b6ec..918e3bf86c8 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_RecursiveShapes_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_RecursiveShapes_test.go
@@ -56,6 +56,7 @@ func TestClient_RecursiveShapes_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RecursiveShapes",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborDenseMaps_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborDenseMaps_test.go
index 7de7d5fa5ad..35a209ad69c 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborDenseMaps_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborDenseMaps_test.go
@@ -52,6 +52,7 @@ func TestClient_RpcV2CborDenseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -77,6 +78,7 @@ func TestClient_RpcV2CborDenseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -103,6 +105,7 @@ func TestClient_RpcV2CborDenseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborLists_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborLists_test.go
index 6598878fbae..ab6c4492e67 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborLists_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborLists_test.go
@@ -98,6 +98,7 @@ func TestClient_RpcV2CborLists_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborLists",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -118,6 +119,7 @@ func TestClient_RpcV2CborLists_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborLists",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -138,6 +140,7 @@ func TestClient_RpcV2CborLists_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborLists",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborSparseMaps_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborSparseMaps_test.go
index 651d66f2867..cf1bb01cdbd 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborSparseMaps_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_RpcV2CborSparseMaps_test.go
@@ -52,6 +52,7 @@ func TestClient_RpcV2CborSparseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -83,6 +84,7 @@ func TestClient_RpcV2CborSparseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -109,6 +111,7 @@ func TestClient_RpcV2CborSparseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -136,6 +139,7 @@ func TestClient_RpcV2CborSparseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -161,6 +165,7 @@ func TestClient_RpcV2CborSparseMaps_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_SimpleScalarProperties_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_SimpleScalarProperties_test.go
index dfe0f8c4567..d5fcb8452bf 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_SimpleScalarProperties_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_SimpleScalarProperties_test.go
@@ -54,6 +54,7 @@ func TestClient_SimpleScalarProperties_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -74,6 +75,7 @@ func TestClient_SimpleScalarProperties_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -95,6 +97,7 @@ func TestClient_SimpleScalarProperties_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -116,6 +119,7 @@ func TestClient_SimpleScalarProperties_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -137,6 +141,7 @@ func TestClient_SimpleScalarProperties_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/SimpleScalarProperties",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/internal/protocoltest/smithyrpcv2cbor/api_op_SparseNullsOperation_test.go b/internal/protocoltest/smithyrpcv2cbor/api_op_SparseNullsOperation_test.go
index ac58641603b..480e1d4f36a 100644
--- a/internal/protocoltest/smithyrpcv2cbor/api_op_SparseNullsOperation_test.go
+++ b/internal/protocoltest/smithyrpcv2cbor/api_op_SparseNullsOperation_test.go
@@ -45,6 +45,7 @@ func TestClient_SparseNullsOperation_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/SparseNullsOperation",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
@@ -67,6 +68,7 @@ func TestClient_SparseNullsOperation_smithyRpcv2cborSerialize(t *testing.T) {
ExpectURIPath: "/service/RpcV2Protocol/operation/SparseNullsOperation",
ExpectQuery: []smithytesting.QueryItem{},
ExpectHeader: http.Header{
+ "Accept": []string{"application/cbor"},
"Content-Type": []string{"application/cbor"},
"smithy-protocol": []string{"rpc-v2-cbor"},
},
diff --git a/service/.DS_Store b/service/.DS_Store
deleted file mode 100644
index ccf5a4c129c..00000000000
Binary files a/service/.DS_Store and /dev/null differ