1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package acm
4
5import (
6	"context"
7	"fmt"
8	"github.com/aws/aws-sdk-go-v2/service/acm/types"
9	smithy "github.com/aws/smithy-go"
10	"github.com/aws/smithy-go/middleware"
11)
12
13type validateOpAddTagsToCertificate struct {
14}
15
16func (*validateOpAddTagsToCertificate) ID() string {
17	return "OperationInputValidation"
18}
19
20func (m *validateOpAddTagsToCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
21	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
22) {
23	input, ok := in.Parameters.(*AddTagsToCertificateInput)
24	if !ok {
25		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
26	}
27	if err := validateOpAddTagsToCertificateInput(input); err != nil {
28		return out, metadata, err
29	}
30	return next.HandleInitialize(ctx, in)
31}
32
33type validateOpDeleteCertificate struct {
34}
35
36func (*validateOpDeleteCertificate) ID() string {
37	return "OperationInputValidation"
38}
39
40func (m *validateOpDeleteCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
41	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
42) {
43	input, ok := in.Parameters.(*DeleteCertificateInput)
44	if !ok {
45		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
46	}
47	if err := validateOpDeleteCertificateInput(input); err != nil {
48		return out, metadata, err
49	}
50	return next.HandleInitialize(ctx, in)
51}
52
53type validateOpDescribeCertificate struct {
54}
55
56func (*validateOpDescribeCertificate) ID() string {
57	return "OperationInputValidation"
58}
59
60func (m *validateOpDescribeCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
61	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
62) {
63	input, ok := in.Parameters.(*DescribeCertificateInput)
64	if !ok {
65		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
66	}
67	if err := validateOpDescribeCertificateInput(input); err != nil {
68		return out, metadata, err
69	}
70	return next.HandleInitialize(ctx, in)
71}
72
73type validateOpExportCertificate struct {
74}
75
76func (*validateOpExportCertificate) ID() string {
77	return "OperationInputValidation"
78}
79
80func (m *validateOpExportCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
81	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
82) {
83	input, ok := in.Parameters.(*ExportCertificateInput)
84	if !ok {
85		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
86	}
87	if err := validateOpExportCertificateInput(input); err != nil {
88		return out, metadata, err
89	}
90	return next.HandleInitialize(ctx, in)
91}
92
93type validateOpGetCertificate struct {
94}
95
96func (*validateOpGetCertificate) ID() string {
97	return "OperationInputValidation"
98}
99
100func (m *validateOpGetCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
101	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
102) {
103	input, ok := in.Parameters.(*GetCertificateInput)
104	if !ok {
105		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
106	}
107	if err := validateOpGetCertificateInput(input); err != nil {
108		return out, metadata, err
109	}
110	return next.HandleInitialize(ctx, in)
111}
112
113type validateOpImportCertificate struct {
114}
115
116func (*validateOpImportCertificate) ID() string {
117	return "OperationInputValidation"
118}
119
120func (m *validateOpImportCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
121	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
122) {
123	input, ok := in.Parameters.(*ImportCertificateInput)
124	if !ok {
125		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
126	}
127	if err := validateOpImportCertificateInput(input); err != nil {
128		return out, metadata, err
129	}
130	return next.HandleInitialize(ctx, in)
131}
132
133type validateOpListTagsForCertificate struct {
134}
135
136func (*validateOpListTagsForCertificate) ID() string {
137	return "OperationInputValidation"
138}
139
140func (m *validateOpListTagsForCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
141	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
142) {
143	input, ok := in.Parameters.(*ListTagsForCertificateInput)
144	if !ok {
145		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
146	}
147	if err := validateOpListTagsForCertificateInput(input); err != nil {
148		return out, metadata, err
149	}
150	return next.HandleInitialize(ctx, in)
151}
152
153type validateOpPutAccountConfiguration struct {
154}
155
156func (*validateOpPutAccountConfiguration) ID() string {
157	return "OperationInputValidation"
158}
159
160func (m *validateOpPutAccountConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
161	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
162) {
163	input, ok := in.Parameters.(*PutAccountConfigurationInput)
164	if !ok {
165		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
166	}
167	if err := validateOpPutAccountConfigurationInput(input); err != nil {
168		return out, metadata, err
169	}
170	return next.HandleInitialize(ctx, in)
171}
172
173type validateOpRemoveTagsFromCertificate struct {
174}
175
176func (*validateOpRemoveTagsFromCertificate) ID() string {
177	return "OperationInputValidation"
178}
179
180func (m *validateOpRemoveTagsFromCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
181	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
182) {
183	input, ok := in.Parameters.(*RemoveTagsFromCertificateInput)
184	if !ok {
185		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
186	}
187	if err := validateOpRemoveTagsFromCertificateInput(input); err != nil {
188		return out, metadata, err
189	}
190	return next.HandleInitialize(ctx, in)
191}
192
193type validateOpRenewCertificate struct {
194}
195
196func (*validateOpRenewCertificate) ID() string {
197	return "OperationInputValidation"
198}
199
200func (m *validateOpRenewCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
201	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
202) {
203	input, ok := in.Parameters.(*RenewCertificateInput)
204	if !ok {
205		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
206	}
207	if err := validateOpRenewCertificateInput(input); err != nil {
208		return out, metadata, err
209	}
210	return next.HandleInitialize(ctx, in)
211}
212
213type validateOpRequestCertificate struct {
214}
215
216func (*validateOpRequestCertificate) ID() string {
217	return "OperationInputValidation"
218}
219
220func (m *validateOpRequestCertificate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
221	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
222) {
223	input, ok := in.Parameters.(*RequestCertificateInput)
224	if !ok {
225		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
226	}
227	if err := validateOpRequestCertificateInput(input); err != nil {
228		return out, metadata, err
229	}
230	return next.HandleInitialize(ctx, in)
231}
232
233type validateOpResendValidationEmail struct {
234}
235
236func (*validateOpResendValidationEmail) ID() string {
237	return "OperationInputValidation"
238}
239
240func (m *validateOpResendValidationEmail) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
241	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
242) {
243	input, ok := in.Parameters.(*ResendValidationEmailInput)
244	if !ok {
245		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
246	}
247	if err := validateOpResendValidationEmailInput(input); err != nil {
248		return out, metadata, err
249	}
250	return next.HandleInitialize(ctx, in)
251}
252
253type validateOpUpdateCertificateOptions struct {
254}
255
256func (*validateOpUpdateCertificateOptions) ID() string {
257	return "OperationInputValidation"
258}
259
260func (m *validateOpUpdateCertificateOptions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
261	out middleware.InitializeOutput, metadata middleware.Metadata, err error,
262) {
263	input, ok := in.Parameters.(*UpdateCertificateOptionsInput)
264	if !ok {
265		return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
266	}
267	if err := validateOpUpdateCertificateOptionsInput(input); err != nil {
268		return out, metadata, err
269	}
270	return next.HandleInitialize(ctx, in)
271}
272
273func addOpAddTagsToCertificateValidationMiddleware(stack *middleware.Stack) error {
274	return stack.Initialize.Add(&validateOpAddTagsToCertificate{}, middleware.After)
275}
276
277func addOpDeleteCertificateValidationMiddleware(stack *middleware.Stack) error {
278	return stack.Initialize.Add(&validateOpDeleteCertificate{}, middleware.After)
279}
280
281func addOpDescribeCertificateValidationMiddleware(stack *middleware.Stack) error {
282	return stack.Initialize.Add(&validateOpDescribeCertificate{}, middleware.After)
283}
284
285func addOpExportCertificateValidationMiddleware(stack *middleware.Stack) error {
286	return stack.Initialize.Add(&validateOpExportCertificate{}, middleware.After)
287}
288
289func addOpGetCertificateValidationMiddleware(stack *middleware.Stack) error {
290	return stack.Initialize.Add(&validateOpGetCertificate{}, middleware.After)
291}
292
293func addOpImportCertificateValidationMiddleware(stack *middleware.Stack) error {
294	return stack.Initialize.Add(&validateOpImportCertificate{}, middleware.After)
295}
296
297func addOpListTagsForCertificateValidationMiddleware(stack *middleware.Stack) error {
298	return stack.Initialize.Add(&validateOpListTagsForCertificate{}, middleware.After)
299}
300
301func addOpPutAccountConfigurationValidationMiddleware(stack *middleware.Stack) error {
302	return stack.Initialize.Add(&validateOpPutAccountConfiguration{}, middleware.After)
303}
304
305func addOpRemoveTagsFromCertificateValidationMiddleware(stack *middleware.Stack) error {
306	return stack.Initialize.Add(&validateOpRemoveTagsFromCertificate{}, middleware.After)
307}
308
309func addOpRenewCertificateValidationMiddleware(stack *middleware.Stack) error {
310	return stack.Initialize.Add(&validateOpRenewCertificate{}, middleware.After)
311}
312
313func addOpRequestCertificateValidationMiddleware(stack *middleware.Stack) error {
314	return stack.Initialize.Add(&validateOpRequestCertificate{}, middleware.After)
315}
316
317func addOpResendValidationEmailValidationMiddleware(stack *middleware.Stack) error {
318	return stack.Initialize.Add(&validateOpResendValidationEmail{}, middleware.After)
319}
320
321func addOpUpdateCertificateOptionsValidationMiddleware(stack *middleware.Stack) error {
322	return stack.Initialize.Add(&validateOpUpdateCertificateOptions{}, middleware.After)
323}
324
325func validateDomainValidationOption(v *types.DomainValidationOption) error {
326	if v == nil {
327		return nil
328	}
329	invalidParams := smithy.InvalidParamsError{Context: "DomainValidationOption"}
330	if v.DomainName == nil {
331		invalidParams.Add(smithy.NewErrParamRequired("DomainName"))
332	}
333	if v.ValidationDomain == nil {
334		invalidParams.Add(smithy.NewErrParamRequired("ValidationDomain"))
335	}
336	if invalidParams.Len() > 0 {
337		return invalidParams
338	} else {
339		return nil
340	}
341}
342
343func validateDomainValidationOptionList(v []types.DomainValidationOption) error {
344	if v == nil {
345		return nil
346	}
347	invalidParams := smithy.InvalidParamsError{Context: "DomainValidationOptionList"}
348	for i := range v {
349		if err := validateDomainValidationOption(&v[i]); err != nil {
350			invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
351		}
352	}
353	if invalidParams.Len() > 0 {
354		return invalidParams
355	} else {
356		return nil
357	}
358}
359
360func validateTag(v *types.Tag) error {
361	if v == nil {
362		return nil
363	}
364	invalidParams := smithy.InvalidParamsError{Context: "Tag"}
365	if v.Key == nil {
366		invalidParams.Add(smithy.NewErrParamRequired("Key"))
367	}
368	if invalidParams.Len() > 0 {
369		return invalidParams
370	} else {
371		return nil
372	}
373}
374
375func validateTagList(v []types.Tag) error {
376	if v == nil {
377		return nil
378	}
379	invalidParams := smithy.InvalidParamsError{Context: "TagList"}
380	for i := range v {
381		if err := validateTag(&v[i]); err != nil {
382			invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
383		}
384	}
385	if invalidParams.Len() > 0 {
386		return invalidParams
387	} else {
388		return nil
389	}
390}
391
392func validateOpAddTagsToCertificateInput(v *AddTagsToCertificateInput) error {
393	if v == nil {
394		return nil
395	}
396	invalidParams := smithy.InvalidParamsError{Context: "AddTagsToCertificateInput"}
397	if v.CertificateArn == nil {
398		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
399	}
400	if v.Tags == nil {
401		invalidParams.Add(smithy.NewErrParamRequired("Tags"))
402	} else if v.Tags != nil {
403		if err := validateTagList(v.Tags); err != nil {
404			invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
405		}
406	}
407	if invalidParams.Len() > 0 {
408		return invalidParams
409	} else {
410		return nil
411	}
412}
413
414func validateOpDeleteCertificateInput(v *DeleteCertificateInput) error {
415	if v == nil {
416		return nil
417	}
418	invalidParams := smithy.InvalidParamsError{Context: "DeleteCertificateInput"}
419	if v.CertificateArn == nil {
420		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
421	}
422	if invalidParams.Len() > 0 {
423		return invalidParams
424	} else {
425		return nil
426	}
427}
428
429func validateOpDescribeCertificateInput(v *DescribeCertificateInput) error {
430	if v == nil {
431		return nil
432	}
433	invalidParams := smithy.InvalidParamsError{Context: "DescribeCertificateInput"}
434	if v.CertificateArn == nil {
435		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
436	}
437	if invalidParams.Len() > 0 {
438		return invalidParams
439	} else {
440		return nil
441	}
442}
443
444func validateOpExportCertificateInput(v *ExportCertificateInput) error {
445	if v == nil {
446		return nil
447	}
448	invalidParams := smithy.InvalidParamsError{Context: "ExportCertificateInput"}
449	if v.CertificateArn == nil {
450		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
451	}
452	if v.Passphrase == nil {
453		invalidParams.Add(smithy.NewErrParamRequired("Passphrase"))
454	}
455	if invalidParams.Len() > 0 {
456		return invalidParams
457	} else {
458		return nil
459	}
460}
461
462func validateOpGetCertificateInput(v *GetCertificateInput) error {
463	if v == nil {
464		return nil
465	}
466	invalidParams := smithy.InvalidParamsError{Context: "GetCertificateInput"}
467	if v.CertificateArn == nil {
468		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
469	}
470	if invalidParams.Len() > 0 {
471		return invalidParams
472	} else {
473		return nil
474	}
475}
476
477func validateOpImportCertificateInput(v *ImportCertificateInput) error {
478	if v == nil {
479		return nil
480	}
481	invalidParams := smithy.InvalidParamsError{Context: "ImportCertificateInput"}
482	if v.Certificate == nil {
483		invalidParams.Add(smithy.NewErrParamRequired("Certificate"))
484	}
485	if v.PrivateKey == nil {
486		invalidParams.Add(smithy.NewErrParamRequired("PrivateKey"))
487	}
488	if v.Tags != nil {
489		if err := validateTagList(v.Tags); err != nil {
490			invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
491		}
492	}
493	if invalidParams.Len() > 0 {
494		return invalidParams
495	} else {
496		return nil
497	}
498}
499
500func validateOpListTagsForCertificateInput(v *ListTagsForCertificateInput) error {
501	if v == nil {
502		return nil
503	}
504	invalidParams := smithy.InvalidParamsError{Context: "ListTagsForCertificateInput"}
505	if v.CertificateArn == nil {
506		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
507	}
508	if invalidParams.Len() > 0 {
509		return invalidParams
510	} else {
511		return nil
512	}
513}
514
515func validateOpPutAccountConfigurationInput(v *PutAccountConfigurationInput) error {
516	if v == nil {
517		return nil
518	}
519	invalidParams := smithy.InvalidParamsError{Context: "PutAccountConfigurationInput"}
520	if v.IdempotencyToken == nil {
521		invalidParams.Add(smithy.NewErrParamRequired("IdempotencyToken"))
522	}
523	if invalidParams.Len() > 0 {
524		return invalidParams
525	} else {
526		return nil
527	}
528}
529
530func validateOpRemoveTagsFromCertificateInput(v *RemoveTagsFromCertificateInput) error {
531	if v == nil {
532		return nil
533	}
534	invalidParams := smithy.InvalidParamsError{Context: "RemoveTagsFromCertificateInput"}
535	if v.CertificateArn == nil {
536		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
537	}
538	if v.Tags == nil {
539		invalidParams.Add(smithy.NewErrParamRequired("Tags"))
540	} else if v.Tags != nil {
541		if err := validateTagList(v.Tags); err != nil {
542			invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
543		}
544	}
545	if invalidParams.Len() > 0 {
546		return invalidParams
547	} else {
548		return nil
549	}
550}
551
552func validateOpRenewCertificateInput(v *RenewCertificateInput) error {
553	if v == nil {
554		return nil
555	}
556	invalidParams := smithy.InvalidParamsError{Context: "RenewCertificateInput"}
557	if v.CertificateArn == nil {
558		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
559	}
560	if invalidParams.Len() > 0 {
561		return invalidParams
562	} else {
563		return nil
564	}
565}
566
567func validateOpRequestCertificateInput(v *RequestCertificateInput) error {
568	if v == nil {
569		return nil
570	}
571	invalidParams := smithy.InvalidParamsError{Context: "RequestCertificateInput"}
572	if v.DomainName == nil {
573		invalidParams.Add(smithy.NewErrParamRequired("DomainName"))
574	}
575	if v.DomainValidationOptions != nil {
576		if err := validateDomainValidationOptionList(v.DomainValidationOptions); err != nil {
577			invalidParams.AddNested("DomainValidationOptions", err.(smithy.InvalidParamsError))
578		}
579	}
580	if v.Tags != nil {
581		if err := validateTagList(v.Tags); err != nil {
582			invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
583		}
584	}
585	if invalidParams.Len() > 0 {
586		return invalidParams
587	} else {
588		return nil
589	}
590}
591
592func validateOpResendValidationEmailInput(v *ResendValidationEmailInput) error {
593	if v == nil {
594		return nil
595	}
596	invalidParams := smithy.InvalidParamsError{Context: "ResendValidationEmailInput"}
597	if v.CertificateArn == nil {
598		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
599	}
600	if v.Domain == nil {
601		invalidParams.Add(smithy.NewErrParamRequired("Domain"))
602	}
603	if v.ValidationDomain == nil {
604		invalidParams.Add(smithy.NewErrParamRequired("ValidationDomain"))
605	}
606	if invalidParams.Len() > 0 {
607		return invalidParams
608	} else {
609		return nil
610	}
611}
612
613func validateOpUpdateCertificateOptionsInput(v *UpdateCertificateOptionsInput) error {
614	if v == nil {
615		return nil
616	}
617	invalidParams := smithy.InvalidParamsError{Context: "UpdateCertificateOptionsInput"}
618	if v.CertificateArn == nil {
619		invalidParams.Add(smithy.NewErrParamRequired("CertificateArn"))
620	}
621	if v.Options == nil {
622		invalidParams.Add(smithy.NewErrParamRequired("Options"))
623	}
624	if invalidParams.Len() > 0 {
625		return invalidParams
626	} else {
627		return nil
628	}
629}
630