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


package nas

import (
	"context"
	"fmt"
	"github.com/aws/smithy-go/middleware"
	smithy "github.com/aws/smithy-go"
	"github.com/nifcloud/nifcloud-sdk-go/service/nas/types"
)

type validateOpAuthorizeNASSecurityGroupIngress struct {
}

func (*validateOpAuthorizeNASSecurityGroupIngress) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpAuthorizeNASSecurityGroupIngress) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*AuthorizeNASSecurityGroupIngressInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpAuthorizeNASSecurityGroupIngressInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpClearNASSession struct {
}

func (*validateOpClearNASSession) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpClearNASSession) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*ClearNASSessionInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpClearNASSessionInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpCreateNASInstance struct {
}

func (*validateOpCreateNASInstance) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpCreateNASInstance) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*CreateNASInstanceInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpCreateNASInstanceInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpCreateNASSecurityGroup struct {
}

func (*validateOpCreateNASSecurityGroup) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpCreateNASSecurityGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*CreateNASSecurityGroupInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpCreateNASSecurityGroupInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpDeleteNASInstance struct {
}

func (*validateOpDeleteNASInstance) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpDeleteNASInstance) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*DeleteNASInstanceInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpDeleteNASInstanceInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpDeleteNASSecurityGroup struct {
}

func (*validateOpDeleteNASSecurityGroup) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpDeleteNASSecurityGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*DeleteNASSecurityGroupInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpDeleteNASSecurityGroupInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpGetMetricStatistics struct {
}

func (*validateOpGetMetricStatistics) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpGetMetricStatistics) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*GetMetricStatisticsInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpGetMetricStatisticsInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpModifyNASInstance struct {
}

func (*validateOpModifyNASInstance) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpModifyNASInstance) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*ModifyNASInstanceInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpModifyNASInstanceInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpModifyNASSecurityGroup struct {
}

func (*validateOpModifyNASSecurityGroup) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpModifyNASSecurityGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*ModifyNASSecurityGroupInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpModifyNASSecurityGroupInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpRevokeNASSecurityGroupIngress struct {
}

func (*validateOpRevokeNASSecurityGroupIngress) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpRevokeNASSecurityGroupIngress) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*RevokeNASSecurityGroupIngressInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpRevokeNASSecurityGroupIngressInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

type validateOpUpgradeNASInstance struct {
}

func (*validateOpUpgradeNASInstance) ID() string {
	return "OperationInputValidation"
}

func (m *validateOpUpgradeNASInstance) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
	input, ok := in.Parameters.(*UpgradeNASInstanceInput)
	if !ok {
		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
	}
	if err := validateOpUpgradeNASInstanceInput(input); err != nil {
		return out, metadata, err
	}
	return next.HandleInitialize(ctx, in)
}

func addOpAuthorizeNASSecurityGroupIngressValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpAuthorizeNASSecurityGroupIngress{}, middleware.After)
}

func addOpClearNASSessionValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpClearNASSession{}, middleware.After)
}

func addOpCreateNASInstanceValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpCreateNASInstance{}, middleware.After)
}

func addOpCreateNASSecurityGroupValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpCreateNASSecurityGroup{}, middleware.After)
}

func addOpDeleteNASInstanceValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpDeleteNASInstance{}, middleware.After)
}

func addOpDeleteNASSecurityGroupValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpDeleteNASSecurityGroup{}, middleware.After)
}

func addOpGetMetricStatisticsValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpGetMetricStatistics{}, middleware.After)
}

func addOpModifyNASInstanceValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpModifyNASInstance{}, middleware.After)
}

func addOpModifyNASSecurityGroupValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpModifyNASSecurityGroup{}, middleware.After)
}

func addOpRevokeNASSecurityGroupIngressValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpRevokeNASSecurityGroupIngress{}, middleware.After)
}

func addOpUpgradeNASInstanceValidationMiddleware(stack *middleware.Stack) error {
	return stack.Initialize.Add(&validateOpUpgradeNASInstance{}, middleware.After)
}

func validateListOfRequestDimensions(v []types.RequestDimensions) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "ListOfRequestDimensions"}
	for i := range v {
		if err := validateRequestDimensions(&v[i]); err != nil {
			invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
		}
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateRequestDimensions(v *types.RequestDimensions) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "RequestDimensions"}
	if v.Name == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Name"))
	}
	if v.Value == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Value"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpAuthorizeNASSecurityGroupIngressInput(v *AuthorizeNASSecurityGroupIngressInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "AuthorizeNASSecurityGroupIngressInput"}
	if v.NASSecurityGroupName == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASSecurityGroupName"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpClearNASSessionInput(v *ClearNASSessionInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "ClearNASSessionInput"}
	if v.NASInstanceIdentifier == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASInstanceIdentifier"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpCreateNASInstanceInput(v *CreateNASInstanceInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "CreateNASInstanceInput"}
	if v.AllocatedStorage == nil {
	invalidParams.Add(smithy.NewErrParamRequired("AllocatedStorage"))
	}
	if v.NASInstanceIdentifier == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASInstanceIdentifier"))
	}
	if len(v.Protocol) == 0 {
	invalidParams.Add(smithy.NewErrParamRequired("Protocol"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpCreateNASSecurityGroupInput(v *CreateNASSecurityGroupInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "CreateNASSecurityGroupInput"}
	if v.AvailabilityZone == nil {
	invalidParams.Add(smithy.NewErrParamRequired("AvailabilityZone"))
	}
	if v.NASSecurityGroupName == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASSecurityGroupName"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpDeleteNASInstanceInput(v *DeleteNASInstanceInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "DeleteNASInstanceInput"}
	if v.NASInstanceIdentifier == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASInstanceIdentifier"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpDeleteNASSecurityGroupInput(v *DeleteNASSecurityGroupInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "DeleteNASSecurityGroupInput"}
	if v.NASSecurityGroupName == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASSecurityGroupName"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpGetMetricStatisticsInput(v *GetMetricStatisticsInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "GetMetricStatisticsInput"}
	if v.Dimensions == nil {
	invalidParams.Add(smithy.NewErrParamRequired("Dimensions"))
	} else if v.Dimensions != nil {
		if err := validateListOfRequestDimensions(v.Dimensions); err != nil {
			invalidParams.AddNested("Dimensions", err.(smithy.InvalidParamsError))
		}
	}
	if len(v.MetricName) == 0 {
	invalidParams.Add(smithy.NewErrParamRequired("MetricName"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpModifyNASInstanceInput(v *ModifyNASInstanceInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "ModifyNASInstanceInput"}
	if v.NASInstanceIdentifier == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASInstanceIdentifier"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpModifyNASSecurityGroupInput(v *ModifyNASSecurityGroupInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "ModifyNASSecurityGroupInput"}
	if v.NASSecurityGroupName == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASSecurityGroupName"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpRevokeNASSecurityGroupIngressInput(v *RevokeNASSecurityGroupIngressInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "RevokeNASSecurityGroupIngressInput"}
	if v.NASSecurityGroupName == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASSecurityGroupName"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}

func validateOpUpgradeNASInstanceInput(v *UpgradeNASInstanceInput) error {
	if v == nil {
		return nil
	}
	invalidParams := smithy.InvalidParamsError{Context: "UpgradeNASInstanceInput"}
	if v.NASInstanceIdentifier == nil {
	invalidParams.Add(smithy.NewErrParamRequired("NASInstanceIdentifier"))
	}
	if invalidParams.Len() > 0 {
	return invalidParams
	} else {
	return nil
	}
}
