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

package restxml

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

func (c *Client) HttpResponseCode(ctx context.Context, params *HttpResponseCodeInput, optFns ...func(*Options)) (*HttpResponseCodeOutput, error) {
	if params == nil {
		params = &HttpResponseCodeInput{}
	}

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

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

type HttpResponseCodeInput struct {
	noSmithyDocumentSerde
}

func (v *HttpResponseCodeInput) Serialize(s smithy.ShapeSerializer) {
	s.WriteStruct(nil)
	v.SerializeMembers(s)
	s.CloseStruct()
}

func (v *HttpResponseCodeInput) SerializeMembers(s smithy.ShapeSerializer) {
}
func (v *HttpResponseCodeInput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, nil, func(s *smithy.Schema) error {
		switch s {
		}
		return nil
	})
}

type HttpResponseCodeOutput struct {
	Status *int32

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

	noSmithyDocumentSerde
}

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

func (v *HttpResponseCodeOutput) SerializeMembers(s smithy.ShapeSerializer) {
	if v.Status != nil {
		s.WriteInt32(schemas.HttpResponseCodeOutput_Status, *v.Status)
	}
}
func (v *HttpResponseCodeOutput) Deserialize(d smithy.ShapeDeserializer) error {
	return smithy.ReadStruct(d, schemas.HttpResponseCodeOutput, func(s *smithy.Schema) error {
		switch s {
		case schemas.HttpResponseCodeOutput_Status:
			v.Status = new(int32)
			return d.ReadInt32(schemas.HttpResponseCodeOutput_Status, v.Status)
		}
		return nil
	})
}
func (c *Client) addOperationHttpResponseCodeMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&serializeRequestMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.HttpResponseCode, nil, schemas.HttpResponseCodeOutput)}, middleware.After); err != nil {
		return err
	}
	if err := stack.Deserialize.Add(&deserializeResponseMiddleware{options: &options, operationSchema: smithy.NewOperationSchema(schemas.HttpResponseCode, nil, schemas.HttpResponseCodeOutput), output: &HttpResponseCodeOutput{}}, 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, "HttpResponseCode"), 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
}
