1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package s3outposts 4 5import ( 6 "context" 7 "fmt" 8 smithy "github.com/aws/smithy-go" 9 "github.com/aws/smithy-go/middleware" 10) 11 12type validateOpCreateEndpoint struct { 13} 14 15func (*validateOpCreateEndpoint) ID() string { 16 return "OperationInputValidation" 17} 18 19func (m *validateOpCreateEndpoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 20 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 21) { 22 input, ok := in.Parameters.(*CreateEndpointInput) 23 if !ok { 24 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 25 } 26 if err := validateOpCreateEndpointInput(input); err != nil { 27 return out, metadata, err 28 } 29 return next.HandleInitialize(ctx, in) 30} 31 32type validateOpDeleteEndpoint struct { 33} 34 35func (*validateOpDeleteEndpoint) ID() string { 36 return "OperationInputValidation" 37} 38 39func (m *validateOpDeleteEndpoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( 40 out middleware.InitializeOutput, metadata middleware.Metadata, err error, 41) { 42 input, ok := in.Parameters.(*DeleteEndpointInput) 43 if !ok { 44 return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) 45 } 46 if err := validateOpDeleteEndpointInput(input); err != nil { 47 return out, metadata, err 48 } 49 return next.HandleInitialize(ctx, in) 50} 51 52func addOpCreateEndpointValidationMiddleware(stack *middleware.Stack) error { 53 return stack.Initialize.Add(&validateOpCreateEndpoint{}, middleware.After) 54} 55 56func addOpDeleteEndpointValidationMiddleware(stack *middleware.Stack) error { 57 return stack.Initialize.Add(&validateOpDeleteEndpoint{}, middleware.After) 58} 59 60func validateOpCreateEndpointInput(v *CreateEndpointInput) error { 61 if v == nil { 62 return nil 63 } 64 invalidParams := smithy.InvalidParamsError{Context: "CreateEndpointInput"} 65 if v.OutpostId == nil { 66 invalidParams.Add(smithy.NewErrParamRequired("OutpostId")) 67 } 68 if v.SubnetId == nil { 69 invalidParams.Add(smithy.NewErrParamRequired("SubnetId")) 70 } 71 if v.SecurityGroupId == nil { 72 invalidParams.Add(smithy.NewErrParamRequired("SecurityGroupId")) 73 } 74 if invalidParams.Len() > 0 { 75 return invalidParams 76 } else { 77 return nil 78 } 79} 80 81func validateOpDeleteEndpointInput(v *DeleteEndpointInput) error { 82 if v == nil { 83 return nil 84 } 85 invalidParams := smithy.InvalidParamsError{Context: "DeleteEndpointInput"} 86 if v.EndpointId == nil { 87 invalidParams.Add(smithy.NewErrParamRequired("EndpointId")) 88 } 89 if v.OutpostId == nil { 90 invalidParams.Add(smithy.NewErrParamRequired("OutpostId")) 91 } 92 if invalidParams.Len() > 0 { 93 return invalidParams 94 } else { 95 return nil 96 } 97} 98