// Code generated by smithy-go-codegen DO NOT EDIT.

//go:build response_snapshot

package query

import (
	"context"
	"errors"
	"github.com/aws/aws-sdk-go-v2/internal/protocoltest/query/schemas"
	"github.com/aws/aws-sdk-go-v2/internal/protocoltest/query/types"
	smithy "github.com/aws/smithy-go"
	"github.com/aws/smithy-go/ptr"
	smithyhttp "github.com/aws/smithy-go/transport/http"
	"github.com/aws/smithy-go/transport/http/protocol/awsquery"
	"io"
	"io/fs"
	"net/http"
	"os"
	"slices"
	"strconv"
	"strings"
	"testing"
	"time"
)

func serdeRespCreatePath(path string) (*os.File, error) {
	if err := os.MkdirAll(serdeRespSSPrefix, 0700); err != nil && !errors.Is(err, fs.ErrExist) {
		return nil, err
	}
	return os.Create(path)
}

func serdeRespWriteSnapshot(op string, status int, header http.Header, body []byte) error {
	f, err := serdeRespCreatePath(serdeRespSSPath(op))
	if err != nil {
		return err
	}
	defer f.Close()

	var sb strings.Builder
	sb.WriteString(strconv.Itoa(status))
	sb.WriteString("\n")
	keys := make([]string, 0, len(header))
	for k := range header {
		keys = append(keys, k)
	}
	slices.Sort(keys)
	for _, k := range keys {
		for _, v := range header[k] {
			sb.WriteString(k)
			sb.WriteString(": ")
			sb.WriteString(v)
			sb.WriteString("\n")
		}
	}
	sb.WriteString("\n")
	sb.Write(body)
	_, err = f.WriteString(sb.String())
	return err
}

// serdeRespXMLErrorEnvelope wraps serialized error members in the XML
// error envelope the restXml/query deserializers parse:
// <ErrorResponse><Error><Code>CODE</Code>MEMBERS</Error></ErrorResponse>.
// It strips the serialized body's outer root element and re-parents the
// members under <Error>.
func serdeRespXMLErrorEnvelope(body []byte, code string) []byte {
	inner := ""
	s := strings.TrimSpace(string(body))
	if strings.HasPrefix(s, "<?xml") {
		if i := strings.Index(s, "?>"); i >= 0 {
			s = strings.TrimSpace(s[i+2:])
		}
	}
	if start := strings.Index(s, ">"); start >= 0 {
		if end := strings.LastIndex(s, "<"); end > start {
			inner = s[start+1 : end]
		}
	}
	return []byte("<ErrorResponse><Error><Code>" + code + "</Code>" + inner + "</Error></ErrorResponse>")
}
func TestUpdateResponseSnapshot_DatetimeOffsets(t *testing.T) {
	want := &DatetimeOffsetsOutput{
		Datetime: ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.DatetimeOffsets, schemas.DatetimeOffsetsOutput, schemas.DatetimeOffsetsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("DatetimeOffsets.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_EmptyInputAndEmptyOutput(t *testing.T) {
	want := &EmptyInputAndEmptyOutputOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.EmptyInputAndEmptyOutput, schemas.EmptyInputAndEmptyOutputOutput, schemas.EmptyInputAndEmptyOutputOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("EmptyInputAndEmptyOutput.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_EndpointOperation(t *testing.T) {
	want := &EndpointOperationOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.EndpointOperation, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("EndpointOperation.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_EndpointWithHostLabelOperation(t *testing.T) {
	want := &EndpointWithHostLabelOperationOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.EndpointWithHostLabelOperation, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("EndpointWithHostLabelOperation.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_FlattenedXmlMap(t *testing.T) {
	want := &FlattenedXmlMapOutput{
		MyMap: map[string]types.FooEnum{
			"key0": types.FooEnum("Foo"),
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.FlattenedXmlMap, schemas.FlattenedXmlMapOutput, schemas.FlattenedXmlMapOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("FlattenedXmlMap.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_FlattenedXmlMapWithXmlName(t *testing.T) {
	want := &FlattenedXmlMapWithXmlNameOutput{
		MyMap: map[string]string{
			"key0": "__Value__",
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.FlattenedXmlMapWithXmlName, schemas.FlattenedXmlMapWithXmlNameOutput, schemas.FlattenedXmlMapWithXmlNameOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("FlattenedXmlMapWithXmlName.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_FlattenedXmlMapWithXmlNamespace(t *testing.T) {
	want := &FlattenedXmlMapWithXmlNamespaceOutput{
		MyMap: map[string]string{
			"key0": "__Value__",
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.FlattenedXmlMapWithXmlNamespace, schemas.FlattenedXmlMapWithXmlNamespaceOutput, schemas.FlattenedXmlMapWithXmlNamespaceOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("FlattenedXmlMapWithXmlNamespace.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_FractionalSeconds(t *testing.T) {
	want := &FractionalSecondsOutput{
		Datetime: ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.FractionalSeconds, schemas.FractionalSecondsOutput, schemas.FractionalSecondsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("FractionalSeconds.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_GreetingWithErrors(t *testing.T) {
	want := &GreetingWithErrorsOutput{
		Greeting: ptr.String("__Greeting__"),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.GreetingWithErrors, schemas.GreetingWithErrorsOutput, schemas.GreetingWithErrorsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("GreetingWithErrors.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_HostWithPathOperation(t *testing.T) {
	want := &HostWithPathOperationOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.HostWithPathOperation, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("HostWithPathOperation.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_IgnoresWrappingXmlName(t *testing.T) {
	want := &IgnoresWrappingXmlNameOutput{
		Foo: ptr.String("__Foo__"),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.IgnoresWrappingXmlName, schemas.IgnoresWrappingXmlNameOutput, schemas.IgnoresWrappingXmlNameOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("IgnoresWrappingXmlName.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_NestedStructures(t *testing.T) {
	want := &NestedStructuresOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.NestedStructures, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("NestedStructures.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_NoInputAndNoOutput(t *testing.T) {
	want := &NoInputAndNoOutputOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.NoInputAndNoOutput, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("NoInputAndNoOutput.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_NoInputAndOutput(t *testing.T) {
	want := &NoInputAndOutputOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.NoInputAndOutput, schemas.NoInputAndOutputOutput, schemas.NoInputAndOutputOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("NoInputAndOutput.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_PutWithContentEncoding(t *testing.T) {
	want := &PutWithContentEncodingOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.PutWithContentEncoding, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("PutWithContentEncoding.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_QueryIdempotencyTokenAutoFill(t *testing.T) {
	want := &QueryIdempotencyTokenAutoFillOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.QueryIdempotencyTokenAutoFill, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("QueryIdempotencyTokenAutoFill.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_QueryLists(t *testing.T) {
	want := &QueryListsOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.QueryLists, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("QueryLists.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_QueryMaps(t *testing.T) {
	want := &QueryMapsOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.QueryMaps, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("QueryMaps.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_QueryTimestamps(t *testing.T) {
	want := &QueryTimestampsOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.QueryTimestamps, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("QueryTimestamps.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_RecursiveXmlShapes(t *testing.T) {
	want := &RecursiveXmlShapesOutput{
		Nested: &types.RecursiveXmlShapesOutputNested1{
			Foo: ptr.String("__Foo__"),
			Nested: &types.RecursiveXmlShapesOutputNested2{
				Bar:             ptr.String("__Bar__"),
				RecursiveMember: nil,
			},
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.RecursiveXmlShapes, schemas.RecursiveXmlShapesOutput, schemas.RecursiveXmlShapesOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("RecursiveXmlShapes.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_SimpleInputParams(t *testing.T) {
	want := &SimpleInputParamsOutput{}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.SimpleInputParams, nil, nil)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("SimpleInputParams.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_SimpleScalarXmlProperties(t *testing.T) {
	want := &SimpleScalarXmlPropertiesOutput{
		StringValue:       ptr.String("__StringValue__"),
		EmptyStringValue:  ptr.String("__EmptyStringValue__"),
		TrueBooleanValue:  ptr.Bool(true),
		FalseBooleanValue: ptr.Bool(true),
		ByteValue:         ptr.Int8(1),
		ShortValue:        ptr.Int16(1),
		IntegerValue:      ptr.Int32(1),
		LongValue:         ptr.Int64(1),
		FloatValue:        ptr.Float32(1.0),
		DoubleValue:       ptr.Float64(1.0),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.SimpleScalarXmlProperties, schemas.SimpleScalarXmlPropertiesOutput, schemas.SimpleScalarXmlPropertiesOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("SimpleScalarXmlProperties.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlBlobs(t *testing.T) {
	want := &XmlBlobsOutput{
		Data: []byte("blob"),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlBlobs, schemas.XmlBlobsOutput, schemas.XmlBlobsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlBlobs.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlEmptyBlobs(t *testing.T) {
	want := &XmlEmptyBlobsOutput{
		Data: []byte("blob"),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlEmptyBlobs, schemas.XmlBlobsOutput, schemas.XmlBlobsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlEmptyBlobs.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlEmptyLists(t *testing.T) {
	want := &XmlEmptyListsOutput{
		StringList: []string{
			"__Member__",
			"__Member__",
		},
		StringSet: []string{
			"__Member__",
			"__Member__",
		},
		IntegerList: []int32{
			1,
			1,
		},
		BooleanList: []bool{
			true,
			true,
		},
		TimestampList: []time.Time{
			time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC),
			time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC),
		},
		EnumList: []types.FooEnum{
			types.FooEnum("Foo"),
			types.FooEnum("Foo"),
		},
		IntEnumList: []types.IntegerEnum{
			types.IntegerEnum(1),
			types.IntegerEnum(1),
		},
		NestedStringList: [][]string{
			{
				"__Member__",
				"__Member__",
			},
			{
				"__Member__",
				"__Member__",
			},
		},
		RenamedListMembers: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedList: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedList2: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedListWithMemberNamespace: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedListWithNamespace: []string{
			"__Member__",
			"__Member__",
		},
		StructureList: []types.StructureListMember{
			{
				A: ptr.String("__A__"),
				B: ptr.String("__B__"),
			},
			{
				A: ptr.String("__A__"),
				B: ptr.String("__B__"),
			},
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlEmptyLists, schemas.XmlListsOutput, schemas.XmlListsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlEmptyLists.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlEmptyMaps(t *testing.T) {
	want := &XmlEmptyMapsOutput{
		MyMap: map[string]types.GreetingStruct{
			"key0": {
				Hi: ptr.String("__Hi__"),
			},
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlEmptyMaps, schemas.XmlMapsOutput, schemas.XmlMapsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlEmptyMaps.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlEnums(t *testing.T) {
	want := &XmlEnumsOutput{
		FooEnum1: types.FooEnum("Foo"),
		FooEnum2: types.FooEnum("Foo"),
		FooEnum3: types.FooEnum("Foo"),
		FooEnumList: []types.FooEnum{
			types.FooEnum("Foo"),
			types.FooEnum("Foo"),
		},
		FooEnumSet: []types.FooEnum{
			types.FooEnum("Foo"),
			types.FooEnum("Foo"),
		},
		FooEnumMap: map[string]types.FooEnum{
			"key0": types.FooEnum("Foo"),
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlEnums, schemas.XmlEnumsOutput, schemas.XmlEnumsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlEnums.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlIntEnums(t *testing.T) {
	want := &XmlIntEnumsOutput{
		IntEnum1: types.IntegerEnum(1),
		IntEnum2: types.IntegerEnum(1),
		IntEnum3: types.IntegerEnum(1),
		IntEnumList: []types.IntegerEnum{
			types.IntegerEnum(1),
			types.IntegerEnum(1),
		},
		IntEnumSet: []types.IntegerEnum{
			types.IntegerEnum(1),
			types.IntegerEnum(1),
		},
		IntEnumMap: map[string]types.IntegerEnum{
			"key0": types.IntegerEnum(1),
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlIntEnums, schemas.XmlIntEnumsOutput, schemas.XmlIntEnumsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlIntEnums.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlLists(t *testing.T) {
	want := &XmlListsOutput{
		StringList: []string{
			"__Member__",
			"__Member__",
		},
		StringSet: []string{
			"__Member__",
			"__Member__",
		},
		IntegerList: []int32{
			1,
			1,
		},
		BooleanList: []bool{
			true,
			true,
		},
		TimestampList: []time.Time{
			time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC),
			time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC),
		},
		EnumList: []types.FooEnum{
			types.FooEnum("Foo"),
			types.FooEnum("Foo"),
		},
		IntEnumList: []types.IntegerEnum{
			types.IntegerEnum(1),
			types.IntegerEnum(1),
		},
		NestedStringList: [][]string{
			{
				"__Member__",
				"__Member__",
			},
			{
				"__Member__",
				"__Member__",
			},
		},
		RenamedListMembers: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedList: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedList2: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedListWithMemberNamespace: []string{
			"__Member__",
			"__Member__",
		},
		FlattenedListWithNamespace: []string{
			"__Member__",
			"__Member__",
		},
		StructureList: []types.StructureListMember{
			{
				A: ptr.String("__A__"),
				B: ptr.String("__B__"),
			},
			{
				A: ptr.String("__A__"),
				B: ptr.String("__B__"),
			},
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlLists, schemas.XmlListsOutput, schemas.XmlListsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlLists.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlMaps(t *testing.T) {
	want := &XmlMapsOutput{
		MyMap: map[string]types.GreetingStruct{
			"key0": {
				Hi: ptr.String("__Hi__"),
			},
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlMaps, schemas.XmlMapsOutput, schemas.XmlMapsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlMaps.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlMapsXmlName(t *testing.T) {
	want := &XmlMapsXmlNameOutput{
		MyMap: map[string]types.GreetingStruct{
			"key0": {
				Hi: ptr.String("__Hi__"),
			},
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlMapsXmlName, schemas.XmlMapsXmlNameOutput, schemas.XmlMapsXmlNameOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlMapsXmlName.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlNamespaces(t *testing.T) {
	want := &XmlNamespacesOutput{
		Nested: &types.XmlNamespaceNested{
			Foo: ptr.String("__Foo__"),
			Values: []string{
				"__Member__",
				"__Member__",
			},
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlNamespaces, schemas.XmlNamespacesOutput, schemas.XmlNamespacesOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlNamespaces.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_XmlTimestamps(t *testing.T) {
	want := &XmlTimestampsOutput{
		Normal:               ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
		DateTime:             ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
		DateTimeOnTarget:     ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
		EpochSeconds:         ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
		EpochSecondsOnTarget: ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
		HttpDate:             ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
		HttpDateOnTarget:     ptr.Time(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.XmlTimestamps, schemas.XmlTimestampsOutput, schemas.XmlTimestampsOutput)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	if err := serdeRespWriteSnapshot("XmlTimestamps.response", 200, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_Error_ComplexError(t *testing.T) {
	want := &types.ComplexError{
		TopLevel: ptr.String("__TopLevel__"),
		Nested: &types.ComplexNestedErrorData{
			Foo: ptr.String("__Foo__"),
		},
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.GreetingWithErrors, schemas.ComplexError, schemas.ComplexError)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	// Wrap the serialized members in the XML error envelope the deserializer parses.
	body = serdeRespXMLErrorEnvelope(body, want.ErrorCode())
	if err := serdeRespWriteSnapshot("ComplexError.error", 400, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_Error_CustomCodeError(t *testing.T) {
	want := &types.CustomCodeError{
		Message: ptr.String("__Message__"),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.GreetingWithErrors, schemas.CustomCodeError, schemas.CustomCodeError)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	// Wrap the serialized members in the XML error envelope the deserializer parses.
	body = serdeRespXMLErrorEnvelope(body, want.ErrorCode())
	if err := serdeRespWriteSnapshot("CustomCodeError.error", 400, built.Header, body); err != nil {
		t.Fatal(err)
	}
}

func TestUpdateResponseSnapshot_Error_InvalidGreeting(t *testing.T) {
	want := &types.InvalidGreeting{
		Message: ptr.String("__Message__"),
	}
	proto := awsquery.New(schemas.AwsQuery)
	opSchema := smithy.NewOperationSchema(schemas.GreetingWithErrors, schemas.InvalidGreeting, schemas.InvalidGreeting)
	req := smithyhttp.NewStackRequest().(*smithyhttp.Request)
	if err := proto.SerializeRequest(context.Background(), opSchema, want, req); err != nil {
		t.Fatal(err)
	}
	built := req.Build(context.Background())
	var body []byte
	if built.Body != nil {
		b, err := io.ReadAll(built.Body)
		if err != nil {
			t.Fatal(err)
		}
		body = b
	}
	// Wrap the serialized members in the XML error envelope the deserializer parses.
	body = serdeRespXMLErrorEnvelope(body, want.ErrorCode())
	if err := serdeRespWriteSnapshot("InvalidGreeting.error", 400, built.Header, body); err != nil {
		t.Fatal(err)
	}
}
