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

package awsrestjson

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/internal/protocoltest/awsrestjson/schemas"
	smithy "github.com/aws/smithy-go"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Clients that perform this test extract all headers from the response.
func (c *Client) HttpEmptyPrefixHeaders(ctx context.Context, params *HttpEmptyPrefixHeadersInput, optFns ...func(*Options)) (*HttpEmptyPrefixHeadersOutput, error) {
	if params == nil {
		params = &HttpEmptyPrefixHeadersInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "HttpEmptyPrefixHeaders", params, optFns, c.addOperationHttpEmptyPrefixHeadersMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*HttpEmptyPrefixHeadersOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type HttpEmptyPrefixHeadersInput struct {
	PrefixHeaders map[string]string

	SpecificHeader *string

	noSmithyDocumentSerde
}

func (v *HttpEmptyPrefixHeadersInput) Serialize(s smithy.ShapeSerializer) {
	s.WriteStruct(schemas.HttpEmptyPrefixHeadersInput)
	v.SerializeMembers(s)
	s.CloseStruct()
}

func (v *HttpEmptyPrefixHeadersInput) SerializeMembers(s smithy.ShapeSerializer) {
	serializeStringMap(s, schemas.HttpEmptyPrefixHeadersInput_prefixHeaders, v.PrefixHeaders)
	if v.SpecificHeader != nil {
		s.WriteString(schemas.HttpEmptyPrefixHeadersInput_specificHeader, *v.SpecificHeader)
	}
}

type HttpEmptyPrefixHeadersOutput struct {

	// Map keys will be normalized to lower-case.
	PrefixHeaders map[string]string

	SpecificHeader *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (v *HttpEmptyPrefixHeadersOutput) Serialize(s smithy.ShapeSerializer) {
	s.WriteStruct(schemas.HttpEmptyPrefixHeadersOutput)
	v.SerializeMembers(s)
	s.CloseStruct()
}

func (v *HttpEmptyPrefixHeadersOutput) SerializeMembers(s smithy.ShapeSerializer) {
	serializeStringMap(s, schemas.HttpEmptyPrefixHeadersOutput_prefixHeaders, v.PrefixHeaders)
	if v.SpecificHeader != nil {
		s.WriteString(schemas.HttpEmptyPrefixHeadersOutput_specificHeader, *v.SpecificHeader)
	}
}
func (v *HttpEmptyPrefixHeadersOutput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.HttpEmptyPrefixHeadersOutput, func(s *smithy.Schema) error {
		switch s {
		case schemas.HttpEmptyPrefixHeadersOutput_prefixHeaders:
			return deserializeStringMap(d, schemas.HttpEmptyPrefixHeadersOutput_prefixHeaders, &v.PrefixHeaders)
		case schemas.HttpEmptyPrefixHeadersOutput_specificHeader:
			v.SpecificHeader = new(string)
			return d.ReadString(schemas.HttpEmptyPrefixHeadersOutput_specificHeader, v.SpecificHeader)
		}
		return nil
	})
}
func (c *Client) addOperationHttpEmptyPrefixHeadersMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&serializeRequestMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.HttpEmptyPrefixHeaders, schemas.HttpEmptyPrefixHeadersInput, schemas.HttpEmptyPrefixHeadersOutput)}, middleware.After); err != nil {
		return err
	}
	if err := stack.Deserialize.Add(&deserializeResponseMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.HttpEmptyPrefixHeaders, schemas.HttpEmptyPrefixHeadersInput, schemas.HttpEmptyPrefixHeadersOutput), output: &HttpEmptyPrefixHeadersOutput{}}, middleware.After); err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); 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 = addRecordResponseTiming(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 = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "HttpEmptyPrefixHeaders"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
