1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package textract
4
5import (
6	"bytes"
7	"context"
8	"encoding/json"
9	"fmt"
10	"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
11	"github.com/aws/aws-sdk-go-v2/service/textract/types"
12	smithy "github.com/aws/smithy-go"
13	smithyio "github.com/aws/smithy-go/io"
14	"github.com/aws/smithy-go/middleware"
15	"github.com/aws/smithy-go/ptr"
16	smithyhttp "github.com/aws/smithy-go/transport/http"
17	"io"
18	"strings"
19)
20
21type awsAwsjson11_deserializeOpAnalyzeDocument struct {
22}
23
24func (*awsAwsjson11_deserializeOpAnalyzeDocument) ID() string {
25	return "OperationDeserializer"
26}
27
28func (m *awsAwsjson11_deserializeOpAnalyzeDocument) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
29	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
30) {
31	out, metadata, err = next.HandleDeserialize(ctx, in)
32	if err != nil {
33		return out, metadata, err
34	}
35
36	response, ok := out.RawResponse.(*smithyhttp.Response)
37	if !ok {
38		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
39	}
40
41	if response.StatusCode < 200 || response.StatusCode >= 300 {
42		return out, metadata, awsAwsjson11_deserializeOpErrorAnalyzeDocument(response, &metadata)
43	}
44	output := &AnalyzeDocumentOutput{}
45	out.Result = output
46
47	var buff [1024]byte
48	ringBuffer := smithyio.NewRingBuffer(buff[:])
49
50	body := io.TeeReader(response.Body, ringBuffer)
51	decoder := json.NewDecoder(body)
52	decoder.UseNumber()
53	var shape interface{}
54	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
55		var snapshot bytes.Buffer
56		io.Copy(&snapshot, ringBuffer)
57		err = &smithy.DeserializationError{
58			Err:      fmt.Errorf("failed to decode response body, %w", err),
59			Snapshot: snapshot.Bytes(),
60		}
61		return out, metadata, err
62	}
63
64	err = awsAwsjson11_deserializeOpDocumentAnalyzeDocumentOutput(&output, shape)
65	if err != nil {
66		var snapshot bytes.Buffer
67		io.Copy(&snapshot, ringBuffer)
68		err = &smithy.DeserializationError{
69			Err:      fmt.Errorf("failed to decode response body, %w", err),
70			Snapshot: snapshot.Bytes(),
71		}
72		return out, metadata, err
73	}
74
75	return out, metadata, err
76}
77
78func awsAwsjson11_deserializeOpErrorAnalyzeDocument(response *smithyhttp.Response, metadata *middleware.Metadata) error {
79	var errorBuffer bytes.Buffer
80	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
81		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
82	}
83	errorBody := bytes.NewReader(errorBuffer.Bytes())
84
85	errorCode := "UnknownError"
86	errorMessage := errorCode
87
88	code := response.Header.Get("X-Amzn-ErrorType")
89	if len(code) != 0 {
90		errorCode = restjson.SanitizeErrorCode(code)
91	}
92
93	var buff [1024]byte
94	ringBuffer := smithyio.NewRingBuffer(buff[:])
95
96	body := io.TeeReader(errorBody, ringBuffer)
97	decoder := json.NewDecoder(body)
98	decoder.UseNumber()
99	code, message, err := restjson.GetErrorInfo(decoder)
100	if err != nil {
101		var snapshot bytes.Buffer
102		io.Copy(&snapshot, ringBuffer)
103		err = &smithy.DeserializationError{
104			Err:      fmt.Errorf("failed to decode response body, %w", err),
105			Snapshot: snapshot.Bytes(),
106		}
107		return err
108	}
109
110	errorBody.Seek(0, io.SeekStart)
111	if len(code) != 0 {
112		errorCode = restjson.SanitizeErrorCode(code)
113	}
114	if len(message) != 0 {
115		errorMessage = message
116	}
117
118	switch {
119	case strings.EqualFold("AccessDeniedException", errorCode):
120		return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody)
121
122	case strings.EqualFold("BadDocumentException", errorCode):
123		return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody)
124
125	case strings.EqualFold("DocumentTooLargeException", errorCode):
126		return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody)
127
128	case strings.EqualFold("HumanLoopQuotaExceededException", errorCode):
129		return awsAwsjson11_deserializeErrorHumanLoopQuotaExceededException(response, errorBody)
130
131	case strings.EqualFold("InternalServerError", errorCode):
132		return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody)
133
134	case strings.EqualFold("InvalidParameterException", errorCode):
135		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
136
137	case strings.EqualFold("InvalidS3ObjectException", errorCode):
138		return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody)
139
140	case strings.EqualFold("ProvisionedThroughputExceededException", errorCode):
141		return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody)
142
143	case strings.EqualFold("ThrottlingException", errorCode):
144		return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
145
146	case strings.EqualFold("UnsupportedDocumentException", errorCode):
147		return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody)
148
149	default:
150		genericError := &smithy.GenericAPIError{
151			Code:    errorCode,
152			Message: errorMessage,
153		}
154		return genericError
155
156	}
157}
158
159type awsAwsjson11_deserializeOpDetectDocumentText struct {
160}
161
162func (*awsAwsjson11_deserializeOpDetectDocumentText) ID() string {
163	return "OperationDeserializer"
164}
165
166func (m *awsAwsjson11_deserializeOpDetectDocumentText) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
167	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
168) {
169	out, metadata, err = next.HandleDeserialize(ctx, in)
170	if err != nil {
171		return out, metadata, err
172	}
173
174	response, ok := out.RawResponse.(*smithyhttp.Response)
175	if !ok {
176		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
177	}
178
179	if response.StatusCode < 200 || response.StatusCode >= 300 {
180		return out, metadata, awsAwsjson11_deserializeOpErrorDetectDocumentText(response, &metadata)
181	}
182	output := &DetectDocumentTextOutput{}
183	out.Result = output
184
185	var buff [1024]byte
186	ringBuffer := smithyio.NewRingBuffer(buff[:])
187
188	body := io.TeeReader(response.Body, ringBuffer)
189	decoder := json.NewDecoder(body)
190	decoder.UseNumber()
191	var shape interface{}
192	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
193		var snapshot bytes.Buffer
194		io.Copy(&snapshot, ringBuffer)
195		err = &smithy.DeserializationError{
196			Err:      fmt.Errorf("failed to decode response body, %w", err),
197			Snapshot: snapshot.Bytes(),
198		}
199		return out, metadata, err
200	}
201
202	err = awsAwsjson11_deserializeOpDocumentDetectDocumentTextOutput(&output, shape)
203	if err != nil {
204		var snapshot bytes.Buffer
205		io.Copy(&snapshot, ringBuffer)
206		err = &smithy.DeserializationError{
207			Err:      fmt.Errorf("failed to decode response body, %w", err),
208			Snapshot: snapshot.Bytes(),
209		}
210		return out, metadata, err
211	}
212
213	return out, metadata, err
214}
215
216func awsAwsjson11_deserializeOpErrorDetectDocumentText(response *smithyhttp.Response, metadata *middleware.Metadata) error {
217	var errorBuffer bytes.Buffer
218	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
219		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
220	}
221	errorBody := bytes.NewReader(errorBuffer.Bytes())
222
223	errorCode := "UnknownError"
224	errorMessage := errorCode
225
226	code := response.Header.Get("X-Amzn-ErrorType")
227	if len(code) != 0 {
228		errorCode = restjson.SanitizeErrorCode(code)
229	}
230
231	var buff [1024]byte
232	ringBuffer := smithyio.NewRingBuffer(buff[:])
233
234	body := io.TeeReader(errorBody, ringBuffer)
235	decoder := json.NewDecoder(body)
236	decoder.UseNumber()
237	code, message, err := restjson.GetErrorInfo(decoder)
238	if err != nil {
239		var snapshot bytes.Buffer
240		io.Copy(&snapshot, ringBuffer)
241		err = &smithy.DeserializationError{
242			Err:      fmt.Errorf("failed to decode response body, %w", err),
243			Snapshot: snapshot.Bytes(),
244		}
245		return err
246	}
247
248	errorBody.Seek(0, io.SeekStart)
249	if len(code) != 0 {
250		errorCode = restjson.SanitizeErrorCode(code)
251	}
252	if len(message) != 0 {
253		errorMessage = message
254	}
255
256	switch {
257	case strings.EqualFold("AccessDeniedException", errorCode):
258		return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody)
259
260	case strings.EqualFold("BadDocumentException", errorCode):
261		return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody)
262
263	case strings.EqualFold("DocumentTooLargeException", errorCode):
264		return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody)
265
266	case strings.EqualFold("InternalServerError", errorCode):
267		return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody)
268
269	case strings.EqualFold("InvalidParameterException", errorCode):
270		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
271
272	case strings.EqualFold("InvalidS3ObjectException", errorCode):
273		return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody)
274
275	case strings.EqualFold("ProvisionedThroughputExceededException", errorCode):
276		return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody)
277
278	case strings.EqualFold("ThrottlingException", errorCode):
279		return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
280
281	case strings.EqualFold("UnsupportedDocumentException", errorCode):
282		return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody)
283
284	default:
285		genericError := &smithy.GenericAPIError{
286			Code:    errorCode,
287			Message: errorMessage,
288		}
289		return genericError
290
291	}
292}
293
294type awsAwsjson11_deserializeOpGetDocumentAnalysis struct {
295}
296
297func (*awsAwsjson11_deserializeOpGetDocumentAnalysis) ID() string {
298	return "OperationDeserializer"
299}
300
301func (m *awsAwsjson11_deserializeOpGetDocumentAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
302	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
303) {
304	out, metadata, err = next.HandleDeserialize(ctx, in)
305	if err != nil {
306		return out, metadata, err
307	}
308
309	response, ok := out.RawResponse.(*smithyhttp.Response)
310	if !ok {
311		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
312	}
313
314	if response.StatusCode < 200 || response.StatusCode >= 300 {
315		return out, metadata, awsAwsjson11_deserializeOpErrorGetDocumentAnalysis(response, &metadata)
316	}
317	output := &GetDocumentAnalysisOutput{}
318	out.Result = output
319
320	var buff [1024]byte
321	ringBuffer := smithyio.NewRingBuffer(buff[:])
322
323	body := io.TeeReader(response.Body, ringBuffer)
324	decoder := json.NewDecoder(body)
325	decoder.UseNumber()
326	var shape interface{}
327	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
328		var snapshot bytes.Buffer
329		io.Copy(&snapshot, ringBuffer)
330		err = &smithy.DeserializationError{
331			Err:      fmt.Errorf("failed to decode response body, %w", err),
332			Snapshot: snapshot.Bytes(),
333		}
334		return out, metadata, err
335	}
336
337	err = awsAwsjson11_deserializeOpDocumentGetDocumentAnalysisOutput(&output, shape)
338	if err != nil {
339		var snapshot bytes.Buffer
340		io.Copy(&snapshot, ringBuffer)
341		err = &smithy.DeserializationError{
342			Err:      fmt.Errorf("failed to decode response body, %w", err),
343			Snapshot: snapshot.Bytes(),
344		}
345		return out, metadata, err
346	}
347
348	return out, metadata, err
349}
350
351func awsAwsjson11_deserializeOpErrorGetDocumentAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error {
352	var errorBuffer bytes.Buffer
353	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
354		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
355	}
356	errorBody := bytes.NewReader(errorBuffer.Bytes())
357
358	errorCode := "UnknownError"
359	errorMessage := errorCode
360
361	code := response.Header.Get("X-Amzn-ErrorType")
362	if len(code) != 0 {
363		errorCode = restjson.SanitizeErrorCode(code)
364	}
365
366	var buff [1024]byte
367	ringBuffer := smithyio.NewRingBuffer(buff[:])
368
369	body := io.TeeReader(errorBody, ringBuffer)
370	decoder := json.NewDecoder(body)
371	decoder.UseNumber()
372	code, message, err := restjson.GetErrorInfo(decoder)
373	if err != nil {
374		var snapshot bytes.Buffer
375		io.Copy(&snapshot, ringBuffer)
376		err = &smithy.DeserializationError{
377			Err:      fmt.Errorf("failed to decode response body, %w", err),
378			Snapshot: snapshot.Bytes(),
379		}
380		return err
381	}
382
383	errorBody.Seek(0, io.SeekStart)
384	if len(code) != 0 {
385		errorCode = restjson.SanitizeErrorCode(code)
386	}
387	if len(message) != 0 {
388		errorMessage = message
389	}
390
391	switch {
392	case strings.EqualFold("AccessDeniedException", errorCode):
393		return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody)
394
395	case strings.EqualFold("InternalServerError", errorCode):
396		return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody)
397
398	case strings.EqualFold("InvalidJobIdException", errorCode):
399		return awsAwsjson11_deserializeErrorInvalidJobIdException(response, errorBody)
400
401	case strings.EqualFold("InvalidParameterException", errorCode):
402		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
403
404	case strings.EqualFold("InvalidS3ObjectException", errorCode):
405		return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody)
406
407	case strings.EqualFold("ProvisionedThroughputExceededException", errorCode):
408		return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody)
409
410	case strings.EqualFold("ThrottlingException", errorCode):
411		return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
412
413	default:
414		genericError := &smithy.GenericAPIError{
415			Code:    errorCode,
416			Message: errorMessage,
417		}
418		return genericError
419
420	}
421}
422
423type awsAwsjson11_deserializeOpGetDocumentTextDetection struct {
424}
425
426func (*awsAwsjson11_deserializeOpGetDocumentTextDetection) ID() string {
427	return "OperationDeserializer"
428}
429
430func (m *awsAwsjson11_deserializeOpGetDocumentTextDetection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
431	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
432) {
433	out, metadata, err = next.HandleDeserialize(ctx, in)
434	if err != nil {
435		return out, metadata, err
436	}
437
438	response, ok := out.RawResponse.(*smithyhttp.Response)
439	if !ok {
440		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
441	}
442
443	if response.StatusCode < 200 || response.StatusCode >= 300 {
444		return out, metadata, awsAwsjson11_deserializeOpErrorGetDocumentTextDetection(response, &metadata)
445	}
446	output := &GetDocumentTextDetectionOutput{}
447	out.Result = output
448
449	var buff [1024]byte
450	ringBuffer := smithyio.NewRingBuffer(buff[:])
451
452	body := io.TeeReader(response.Body, ringBuffer)
453	decoder := json.NewDecoder(body)
454	decoder.UseNumber()
455	var shape interface{}
456	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
457		var snapshot bytes.Buffer
458		io.Copy(&snapshot, ringBuffer)
459		err = &smithy.DeserializationError{
460			Err:      fmt.Errorf("failed to decode response body, %w", err),
461			Snapshot: snapshot.Bytes(),
462		}
463		return out, metadata, err
464	}
465
466	err = awsAwsjson11_deserializeOpDocumentGetDocumentTextDetectionOutput(&output, shape)
467	if err != nil {
468		var snapshot bytes.Buffer
469		io.Copy(&snapshot, ringBuffer)
470		err = &smithy.DeserializationError{
471			Err:      fmt.Errorf("failed to decode response body, %w", err),
472			Snapshot: snapshot.Bytes(),
473		}
474		return out, metadata, err
475	}
476
477	return out, metadata, err
478}
479
480func awsAwsjson11_deserializeOpErrorGetDocumentTextDetection(response *smithyhttp.Response, metadata *middleware.Metadata) error {
481	var errorBuffer bytes.Buffer
482	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
483		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
484	}
485	errorBody := bytes.NewReader(errorBuffer.Bytes())
486
487	errorCode := "UnknownError"
488	errorMessage := errorCode
489
490	code := response.Header.Get("X-Amzn-ErrorType")
491	if len(code) != 0 {
492		errorCode = restjson.SanitizeErrorCode(code)
493	}
494
495	var buff [1024]byte
496	ringBuffer := smithyio.NewRingBuffer(buff[:])
497
498	body := io.TeeReader(errorBody, ringBuffer)
499	decoder := json.NewDecoder(body)
500	decoder.UseNumber()
501	code, message, err := restjson.GetErrorInfo(decoder)
502	if err != nil {
503		var snapshot bytes.Buffer
504		io.Copy(&snapshot, ringBuffer)
505		err = &smithy.DeserializationError{
506			Err:      fmt.Errorf("failed to decode response body, %w", err),
507			Snapshot: snapshot.Bytes(),
508		}
509		return err
510	}
511
512	errorBody.Seek(0, io.SeekStart)
513	if len(code) != 0 {
514		errorCode = restjson.SanitizeErrorCode(code)
515	}
516	if len(message) != 0 {
517		errorMessage = message
518	}
519
520	switch {
521	case strings.EqualFold("AccessDeniedException", errorCode):
522		return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody)
523
524	case strings.EqualFold("InternalServerError", errorCode):
525		return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody)
526
527	case strings.EqualFold("InvalidJobIdException", errorCode):
528		return awsAwsjson11_deserializeErrorInvalidJobIdException(response, errorBody)
529
530	case strings.EqualFold("InvalidParameterException", errorCode):
531		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
532
533	case strings.EqualFold("InvalidS3ObjectException", errorCode):
534		return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody)
535
536	case strings.EqualFold("ProvisionedThroughputExceededException", errorCode):
537		return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody)
538
539	case strings.EqualFold("ThrottlingException", errorCode):
540		return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
541
542	default:
543		genericError := &smithy.GenericAPIError{
544			Code:    errorCode,
545			Message: errorMessage,
546		}
547		return genericError
548
549	}
550}
551
552type awsAwsjson11_deserializeOpStartDocumentAnalysis struct {
553}
554
555func (*awsAwsjson11_deserializeOpStartDocumentAnalysis) ID() string {
556	return "OperationDeserializer"
557}
558
559func (m *awsAwsjson11_deserializeOpStartDocumentAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
560	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
561) {
562	out, metadata, err = next.HandleDeserialize(ctx, in)
563	if err != nil {
564		return out, metadata, err
565	}
566
567	response, ok := out.RawResponse.(*smithyhttp.Response)
568	if !ok {
569		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
570	}
571
572	if response.StatusCode < 200 || response.StatusCode >= 300 {
573		return out, metadata, awsAwsjson11_deserializeOpErrorStartDocumentAnalysis(response, &metadata)
574	}
575	output := &StartDocumentAnalysisOutput{}
576	out.Result = output
577
578	var buff [1024]byte
579	ringBuffer := smithyio.NewRingBuffer(buff[:])
580
581	body := io.TeeReader(response.Body, ringBuffer)
582	decoder := json.NewDecoder(body)
583	decoder.UseNumber()
584	var shape interface{}
585	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
586		var snapshot bytes.Buffer
587		io.Copy(&snapshot, ringBuffer)
588		err = &smithy.DeserializationError{
589			Err:      fmt.Errorf("failed to decode response body, %w", err),
590			Snapshot: snapshot.Bytes(),
591		}
592		return out, metadata, err
593	}
594
595	err = awsAwsjson11_deserializeOpDocumentStartDocumentAnalysisOutput(&output, shape)
596	if err != nil {
597		var snapshot bytes.Buffer
598		io.Copy(&snapshot, ringBuffer)
599		err = &smithy.DeserializationError{
600			Err:      fmt.Errorf("failed to decode response body, %w", err),
601			Snapshot: snapshot.Bytes(),
602		}
603		return out, metadata, err
604	}
605
606	return out, metadata, err
607}
608
609func awsAwsjson11_deserializeOpErrorStartDocumentAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error {
610	var errorBuffer bytes.Buffer
611	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
612		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
613	}
614	errorBody := bytes.NewReader(errorBuffer.Bytes())
615
616	errorCode := "UnknownError"
617	errorMessage := errorCode
618
619	code := response.Header.Get("X-Amzn-ErrorType")
620	if len(code) != 0 {
621		errorCode = restjson.SanitizeErrorCode(code)
622	}
623
624	var buff [1024]byte
625	ringBuffer := smithyio.NewRingBuffer(buff[:])
626
627	body := io.TeeReader(errorBody, ringBuffer)
628	decoder := json.NewDecoder(body)
629	decoder.UseNumber()
630	code, message, err := restjson.GetErrorInfo(decoder)
631	if err != nil {
632		var snapshot bytes.Buffer
633		io.Copy(&snapshot, ringBuffer)
634		err = &smithy.DeserializationError{
635			Err:      fmt.Errorf("failed to decode response body, %w", err),
636			Snapshot: snapshot.Bytes(),
637		}
638		return err
639	}
640
641	errorBody.Seek(0, io.SeekStart)
642	if len(code) != 0 {
643		errorCode = restjson.SanitizeErrorCode(code)
644	}
645	if len(message) != 0 {
646		errorMessage = message
647	}
648
649	switch {
650	case strings.EqualFold("AccessDeniedException", errorCode):
651		return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody)
652
653	case strings.EqualFold("BadDocumentException", errorCode):
654		return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody)
655
656	case strings.EqualFold("DocumentTooLargeException", errorCode):
657		return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody)
658
659	case strings.EqualFold("IdempotentParameterMismatchException", errorCode):
660		return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
661
662	case strings.EqualFold("InternalServerError", errorCode):
663		return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody)
664
665	case strings.EqualFold("InvalidKMSKeyException", errorCode):
666		return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody)
667
668	case strings.EqualFold("InvalidParameterException", errorCode):
669		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
670
671	case strings.EqualFold("InvalidS3ObjectException", errorCode):
672		return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody)
673
674	case strings.EqualFold("LimitExceededException", errorCode):
675		return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody)
676
677	case strings.EqualFold("ProvisionedThroughputExceededException", errorCode):
678		return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody)
679
680	case strings.EqualFold("ThrottlingException", errorCode):
681		return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
682
683	case strings.EqualFold("UnsupportedDocumentException", errorCode):
684		return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody)
685
686	default:
687		genericError := &smithy.GenericAPIError{
688			Code:    errorCode,
689			Message: errorMessage,
690		}
691		return genericError
692
693	}
694}
695
696type awsAwsjson11_deserializeOpStartDocumentTextDetection struct {
697}
698
699func (*awsAwsjson11_deserializeOpStartDocumentTextDetection) ID() string {
700	return "OperationDeserializer"
701}
702
703func (m *awsAwsjson11_deserializeOpStartDocumentTextDetection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
704	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
705) {
706	out, metadata, err = next.HandleDeserialize(ctx, in)
707	if err != nil {
708		return out, metadata, err
709	}
710
711	response, ok := out.RawResponse.(*smithyhttp.Response)
712	if !ok {
713		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
714	}
715
716	if response.StatusCode < 200 || response.StatusCode >= 300 {
717		return out, metadata, awsAwsjson11_deserializeOpErrorStartDocumentTextDetection(response, &metadata)
718	}
719	output := &StartDocumentTextDetectionOutput{}
720	out.Result = output
721
722	var buff [1024]byte
723	ringBuffer := smithyio.NewRingBuffer(buff[:])
724
725	body := io.TeeReader(response.Body, ringBuffer)
726	decoder := json.NewDecoder(body)
727	decoder.UseNumber()
728	var shape interface{}
729	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
730		var snapshot bytes.Buffer
731		io.Copy(&snapshot, ringBuffer)
732		err = &smithy.DeserializationError{
733			Err:      fmt.Errorf("failed to decode response body, %w", err),
734			Snapshot: snapshot.Bytes(),
735		}
736		return out, metadata, err
737	}
738
739	err = awsAwsjson11_deserializeOpDocumentStartDocumentTextDetectionOutput(&output, shape)
740	if err != nil {
741		var snapshot bytes.Buffer
742		io.Copy(&snapshot, ringBuffer)
743		err = &smithy.DeserializationError{
744			Err:      fmt.Errorf("failed to decode response body, %w", err),
745			Snapshot: snapshot.Bytes(),
746		}
747		return out, metadata, err
748	}
749
750	return out, metadata, err
751}
752
753func awsAwsjson11_deserializeOpErrorStartDocumentTextDetection(response *smithyhttp.Response, metadata *middleware.Metadata) error {
754	var errorBuffer bytes.Buffer
755	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
756		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
757	}
758	errorBody := bytes.NewReader(errorBuffer.Bytes())
759
760	errorCode := "UnknownError"
761	errorMessage := errorCode
762
763	code := response.Header.Get("X-Amzn-ErrorType")
764	if len(code) != 0 {
765		errorCode = restjson.SanitizeErrorCode(code)
766	}
767
768	var buff [1024]byte
769	ringBuffer := smithyio.NewRingBuffer(buff[:])
770
771	body := io.TeeReader(errorBody, ringBuffer)
772	decoder := json.NewDecoder(body)
773	decoder.UseNumber()
774	code, message, err := restjson.GetErrorInfo(decoder)
775	if err != nil {
776		var snapshot bytes.Buffer
777		io.Copy(&snapshot, ringBuffer)
778		err = &smithy.DeserializationError{
779			Err:      fmt.Errorf("failed to decode response body, %w", err),
780			Snapshot: snapshot.Bytes(),
781		}
782		return err
783	}
784
785	errorBody.Seek(0, io.SeekStart)
786	if len(code) != 0 {
787		errorCode = restjson.SanitizeErrorCode(code)
788	}
789	if len(message) != 0 {
790		errorMessage = message
791	}
792
793	switch {
794	case strings.EqualFold("AccessDeniedException", errorCode):
795		return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody)
796
797	case strings.EqualFold("BadDocumentException", errorCode):
798		return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody)
799
800	case strings.EqualFold("DocumentTooLargeException", errorCode):
801		return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody)
802
803	case strings.EqualFold("IdempotentParameterMismatchException", errorCode):
804		return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
805
806	case strings.EqualFold("InternalServerError", errorCode):
807		return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody)
808
809	case strings.EqualFold("InvalidKMSKeyException", errorCode):
810		return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody)
811
812	case strings.EqualFold("InvalidParameterException", errorCode):
813		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
814
815	case strings.EqualFold("InvalidS3ObjectException", errorCode):
816		return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody)
817
818	case strings.EqualFold("LimitExceededException", errorCode):
819		return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody)
820
821	case strings.EqualFold("ProvisionedThroughputExceededException", errorCode):
822		return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody)
823
824	case strings.EqualFold("ThrottlingException", errorCode):
825		return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
826
827	case strings.EqualFold("UnsupportedDocumentException", errorCode):
828		return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody)
829
830	default:
831		genericError := &smithy.GenericAPIError{
832			Code:    errorCode,
833			Message: errorMessage,
834		}
835		return genericError
836
837	}
838}
839
840func awsAwsjson11_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
841	var buff [1024]byte
842	ringBuffer := smithyio.NewRingBuffer(buff[:])
843
844	body := io.TeeReader(errorBody, ringBuffer)
845	decoder := json.NewDecoder(body)
846	decoder.UseNumber()
847	var shape interface{}
848	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
849		var snapshot bytes.Buffer
850		io.Copy(&snapshot, ringBuffer)
851		err = &smithy.DeserializationError{
852			Err:      fmt.Errorf("failed to decode response body, %w", err),
853			Snapshot: snapshot.Bytes(),
854		}
855		return err
856	}
857
858	output := &types.AccessDeniedException{}
859	err := awsAwsjson11_deserializeDocumentAccessDeniedException(&output, shape)
860
861	if err != nil {
862		var snapshot bytes.Buffer
863		io.Copy(&snapshot, ringBuffer)
864		err = &smithy.DeserializationError{
865			Err:      fmt.Errorf("failed to decode response body, %w", err),
866			Snapshot: snapshot.Bytes(),
867		}
868		return err
869	}
870
871	errorBody.Seek(0, io.SeekStart)
872	return output
873}
874
875func awsAwsjson11_deserializeErrorBadDocumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
876	var buff [1024]byte
877	ringBuffer := smithyio.NewRingBuffer(buff[:])
878
879	body := io.TeeReader(errorBody, ringBuffer)
880	decoder := json.NewDecoder(body)
881	decoder.UseNumber()
882	var shape interface{}
883	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
884		var snapshot bytes.Buffer
885		io.Copy(&snapshot, ringBuffer)
886		err = &smithy.DeserializationError{
887			Err:      fmt.Errorf("failed to decode response body, %w", err),
888			Snapshot: snapshot.Bytes(),
889		}
890		return err
891	}
892
893	output := &types.BadDocumentException{}
894	err := awsAwsjson11_deserializeDocumentBadDocumentException(&output, shape)
895
896	if err != nil {
897		var snapshot bytes.Buffer
898		io.Copy(&snapshot, ringBuffer)
899		err = &smithy.DeserializationError{
900			Err:      fmt.Errorf("failed to decode response body, %w", err),
901			Snapshot: snapshot.Bytes(),
902		}
903		return err
904	}
905
906	errorBody.Seek(0, io.SeekStart)
907	return output
908}
909
910func awsAwsjson11_deserializeErrorDocumentTooLargeException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
911	var buff [1024]byte
912	ringBuffer := smithyio.NewRingBuffer(buff[:])
913
914	body := io.TeeReader(errorBody, ringBuffer)
915	decoder := json.NewDecoder(body)
916	decoder.UseNumber()
917	var shape interface{}
918	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
919		var snapshot bytes.Buffer
920		io.Copy(&snapshot, ringBuffer)
921		err = &smithy.DeserializationError{
922			Err:      fmt.Errorf("failed to decode response body, %w", err),
923			Snapshot: snapshot.Bytes(),
924		}
925		return err
926	}
927
928	output := &types.DocumentTooLargeException{}
929	err := awsAwsjson11_deserializeDocumentDocumentTooLargeException(&output, shape)
930
931	if err != nil {
932		var snapshot bytes.Buffer
933		io.Copy(&snapshot, ringBuffer)
934		err = &smithy.DeserializationError{
935			Err:      fmt.Errorf("failed to decode response body, %w", err),
936			Snapshot: snapshot.Bytes(),
937		}
938		return err
939	}
940
941	errorBody.Seek(0, io.SeekStart)
942	return output
943}
944
945func awsAwsjson11_deserializeErrorHumanLoopQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
946	var buff [1024]byte
947	ringBuffer := smithyio.NewRingBuffer(buff[:])
948
949	body := io.TeeReader(errorBody, ringBuffer)
950	decoder := json.NewDecoder(body)
951	decoder.UseNumber()
952	var shape interface{}
953	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
954		var snapshot bytes.Buffer
955		io.Copy(&snapshot, ringBuffer)
956		err = &smithy.DeserializationError{
957			Err:      fmt.Errorf("failed to decode response body, %w", err),
958			Snapshot: snapshot.Bytes(),
959		}
960		return err
961	}
962
963	output := &types.HumanLoopQuotaExceededException{}
964	err := awsAwsjson11_deserializeDocumentHumanLoopQuotaExceededException(&output, shape)
965
966	if err != nil {
967		var snapshot bytes.Buffer
968		io.Copy(&snapshot, ringBuffer)
969		err = &smithy.DeserializationError{
970			Err:      fmt.Errorf("failed to decode response body, %w", err),
971			Snapshot: snapshot.Bytes(),
972		}
973		return err
974	}
975
976	errorBody.Seek(0, io.SeekStart)
977	return output
978}
979
980func awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
981	var buff [1024]byte
982	ringBuffer := smithyio.NewRingBuffer(buff[:])
983
984	body := io.TeeReader(errorBody, ringBuffer)
985	decoder := json.NewDecoder(body)
986	decoder.UseNumber()
987	var shape interface{}
988	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
989		var snapshot bytes.Buffer
990		io.Copy(&snapshot, ringBuffer)
991		err = &smithy.DeserializationError{
992			Err:      fmt.Errorf("failed to decode response body, %w", err),
993			Snapshot: snapshot.Bytes(),
994		}
995		return err
996	}
997
998	output := &types.IdempotentParameterMismatchException{}
999	err := awsAwsjson11_deserializeDocumentIdempotentParameterMismatchException(&output, shape)
1000
1001	if err != nil {
1002		var snapshot bytes.Buffer
1003		io.Copy(&snapshot, ringBuffer)
1004		err = &smithy.DeserializationError{
1005			Err:      fmt.Errorf("failed to decode response body, %w", err),
1006			Snapshot: snapshot.Bytes(),
1007		}
1008		return err
1009	}
1010
1011	errorBody.Seek(0, io.SeekStart)
1012	return output
1013}
1014
1015func awsAwsjson11_deserializeErrorInternalServerError(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1016	var buff [1024]byte
1017	ringBuffer := smithyio.NewRingBuffer(buff[:])
1018
1019	body := io.TeeReader(errorBody, ringBuffer)
1020	decoder := json.NewDecoder(body)
1021	decoder.UseNumber()
1022	var shape interface{}
1023	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1024		var snapshot bytes.Buffer
1025		io.Copy(&snapshot, ringBuffer)
1026		err = &smithy.DeserializationError{
1027			Err:      fmt.Errorf("failed to decode response body, %w", err),
1028			Snapshot: snapshot.Bytes(),
1029		}
1030		return err
1031	}
1032
1033	output := &types.InternalServerError{}
1034	err := awsAwsjson11_deserializeDocumentInternalServerError(&output, shape)
1035
1036	if err != nil {
1037		var snapshot bytes.Buffer
1038		io.Copy(&snapshot, ringBuffer)
1039		err = &smithy.DeserializationError{
1040			Err:      fmt.Errorf("failed to decode response body, %w", err),
1041			Snapshot: snapshot.Bytes(),
1042		}
1043		return err
1044	}
1045
1046	errorBody.Seek(0, io.SeekStart)
1047	return output
1048}
1049
1050func awsAwsjson11_deserializeErrorInvalidJobIdException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1051	var buff [1024]byte
1052	ringBuffer := smithyio.NewRingBuffer(buff[:])
1053
1054	body := io.TeeReader(errorBody, ringBuffer)
1055	decoder := json.NewDecoder(body)
1056	decoder.UseNumber()
1057	var shape interface{}
1058	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1059		var snapshot bytes.Buffer
1060		io.Copy(&snapshot, ringBuffer)
1061		err = &smithy.DeserializationError{
1062			Err:      fmt.Errorf("failed to decode response body, %w", err),
1063			Snapshot: snapshot.Bytes(),
1064		}
1065		return err
1066	}
1067
1068	output := &types.InvalidJobIdException{}
1069	err := awsAwsjson11_deserializeDocumentInvalidJobIdException(&output, shape)
1070
1071	if err != nil {
1072		var snapshot bytes.Buffer
1073		io.Copy(&snapshot, ringBuffer)
1074		err = &smithy.DeserializationError{
1075			Err:      fmt.Errorf("failed to decode response body, %w", err),
1076			Snapshot: snapshot.Bytes(),
1077		}
1078		return err
1079	}
1080
1081	errorBody.Seek(0, io.SeekStart)
1082	return output
1083}
1084
1085func awsAwsjson11_deserializeErrorInvalidKMSKeyException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1086	var buff [1024]byte
1087	ringBuffer := smithyio.NewRingBuffer(buff[:])
1088
1089	body := io.TeeReader(errorBody, ringBuffer)
1090	decoder := json.NewDecoder(body)
1091	decoder.UseNumber()
1092	var shape interface{}
1093	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1094		var snapshot bytes.Buffer
1095		io.Copy(&snapshot, ringBuffer)
1096		err = &smithy.DeserializationError{
1097			Err:      fmt.Errorf("failed to decode response body, %w", err),
1098			Snapshot: snapshot.Bytes(),
1099		}
1100		return err
1101	}
1102
1103	output := &types.InvalidKMSKeyException{}
1104	err := awsAwsjson11_deserializeDocumentInvalidKMSKeyException(&output, shape)
1105
1106	if err != nil {
1107		var snapshot bytes.Buffer
1108		io.Copy(&snapshot, ringBuffer)
1109		err = &smithy.DeserializationError{
1110			Err:      fmt.Errorf("failed to decode response body, %w", err),
1111			Snapshot: snapshot.Bytes(),
1112		}
1113		return err
1114	}
1115
1116	errorBody.Seek(0, io.SeekStart)
1117	return output
1118}
1119
1120func awsAwsjson11_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1121	var buff [1024]byte
1122	ringBuffer := smithyio.NewRingBuffer(buff[:])
1123
1124	body := io.TeeReader(errorBody, ringBuffer)
1125	decoder := json.NewDecoder(body)
1126	decoder.UseNumber()
1127	var shape interface{}
1128	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1129		var snapshot bytes.Buffer
1130		io.Copy(&snapshot, ringBuffer)
1131		err = &smithy.DeserializationError{
1132			Err:      fmt.Errorf("failed to decode response body, %w", err),
1133			Snapshot: snapshot.Bytes(),
1134		}
1135		return err
1136	}
1137
1138	output := &types.InvalidParameterException{}
1139	err := awsAwsjson11_deserializeDocumentInvalidParameterException(&output, shape)
1140
1141	if err != nil {
1142		var snapshot bytes.Buffer
1143		io.Copy(&snapshot, ringBuffer)
1144		err = &smithy.DeserializationError{
1145			Err:      fmt.Errorf("failed to decode response body, %w", err),
1146			Snapshot: snapshot.Bytes(),
1147		}
1148		return err
1149	}
1150
1151	errorBody.Seek(0, io.SeekStart)
1152	return output
1153}
1154
1155func awsAwsjson11_deserializeErrorInvalidS3ObjectException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1156	var buff [1024]byte
1157	ringBuffer := smithyio.NewRingBuffer(buff[:])
1158
1159	body := io.TeeReader(errorBody, ringBuffer)
1160	decoder := json.NewDecoder(body)
1161	decoder.UseNumber()
1162	var shape interface{}
1163	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1164		var snapshot bytes.Buffer
1165		io.Copy(&snapshot, ringBuffer)
1166		err = &smithy.DeserializationError{
1167			Err:      fmt.Errorf("failed to decode response body, %w", err),
1168			Snapshot: snapshot.Bytes(),
1169		}
1170		return err
1171	}
1172
1173	output := &types.InvalidS3ObjectException{}
1174	err := awsAwsjson11_deserializeDocumentInvalidS3ObjectException(&output, shape)
1175
1176	if err != nil {
1177		var snapshot bytes.Buffer
1178		io.Copy(&snapshot, ringBuffer)
1179		err = &smithy.DeserializationError{
1180			Err:      fmt.Errorf("failed to decode response body, %w", err),
1181			Snapshot: snapshot.Bytes(),
1182		}
1183		return err
1184	}
1185
1186	errorBody.Seek(0, io.SeekStart)
1187	return output
1188}
1189
1190func awsAwsjson11_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1191	var buff [1024]byte
1192	ringBuffer := smithyio.NewRingBuffer(buff[:])
1193
1194	body := io.TeeReader(errorBody, ringBuffer)
1195	decoder := json.NewDecoder(body)
1196	decoder.UseNumber()
1197	var shape interface{}
1198	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1199		var snapshot bytes.Buffer
1200		io.Copy(&snapshot, ringBuffer)
1201		err = &smithy.DeserializationError{
1202			Err:      fmt.Errorf("failed to decode response body, %w", err),
1203			Snapshot: snapshot.Bytes(),
1204		}
1205		return err
1206	}
1207
1208	output := &types.LimitExceededException{}
1209	err := awsAwsjson11_deserializeDocumentLimitExceededException(&output, shape)
1210
1211	if err != nil {
1212		var snapshot bytes.Buffer
1213		io.Copy(&snapshot, ringBuffer)
1214		err = &smithy.DeserializationError{
1215			Err:      fmt.Errorf("failed to decode response body, %w", err),
1216			Snapshot: snapshot.Bytes(),
1217		}
1218		return err
1219	}
1220
1221	errorBody.Seek(0, io.SeekStart)
1222	return output
1223}
1224
1225func awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1226	var buff [1024]byte
1227	ringBuffer := smithyio.NewRingBuffer(buff[:])
1228
1229	body := io.TeeReader(errorBody, ringBuffer)
1230	decoder := json.NewDecoder(body)
1231	decoder.UseNumber()
1232	var shape interface{}
1233	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1234		var snapshot bytes.Buffer
1235		io.Copy(&snapshot, ringBuffer)
1236		err = &smithy.DeserializationError{
1237			Err:      fmt.Errorf("failed to decode response body, %w", err),
1238			Snapshot: snapshot.Bytes(),
1239		}
1240		return err
1241	}
1242
1243	output := &types.ProvisionedThroughputExceededException{}
1244	err := awsAwsjson11_deserializeDocumentProvisionedThroughputExceededException(&output, shape)
1245
1246	if err != nil {
1247		var snapshot bytes.Buffer
1248		io.Copy(&snapshot, ringBuffer)
1249		err = &smithy.DeserializationError{
1250			Err:      fmt.Errorf("failed to decode response body, %w", err),
1251			Snapshot: snapshot.Bytes(),
1252		}
1253		return err
1254	}
1255
1256	errorBody.Seek(0, io.SeekStart)
1257	return output
1258}
1259
1260func awsAwsjson11_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1261	var buff [1024]byte
1262	ringBuffer := smithyio.NewRingBuffer(buff[:])
1263
1264	body := io.TeeReader(errorBody, ringBuffer)
1265	decoder := json.NewDecoder(body)
1266	decoder.UseNumber()
1267	var shape interface{}
1268	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1269		var snapshot bytes.Buffer
1270		io.Copy(&snapshot, ringBuffer)
1271		err = &smithy.DeserializationError{
1272			Err:      fmt.Errorf("failed to decode response body, %w", err),
1273			Snapshot: snapshot.Bytes(),
1274		}
1275		return err
1276	}
1277
1278	output := &types.ThrottlingException{}
1279	err := awsAwsjson11_deserializeDocumentThrottlingException(&output, shape)
1280
1281	if err != nil {
1282		var snapshot bytes.Buffer
1283		io.Copy(&snapshot, ringBuffer)
1284		err = &smithy.DeserializationError{
1285			Err:      fmt.Errorf("failed to decode response body, %w", err),
1286			Snapshot: snapshot.Bytes(),
1287		}
1288		return err
1289	}
1290
1291	errorBody.Seek(0, io.SeekStart)
1292	return output
1293}
1294
1295func awsAwsjson11_deserializeErrorUnsupportedDocumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1296	var buff [1024]byte
1297	ringBuffer := smithyio.NewRingBuffer(buff[:])
1298
1299	body := io.TeeReader(errorBody, ringBuffer)
1300	decoder := json.NewDecoder(body)
1301	decoder.UseNumber()
1302	var shape interface{}
1303	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1304		var snapshot bytes.Buffer
1305		io.Copy(&snapshot, ringBuffer)
1306		err = &smithy.DeserializationError{
1307			Err:      fmt.Errorf("failed to decode response body, %w", err),
1308			Snapshot: snapshot.Bytes(),
1309		}
1310		return err
1311	}
1312
1313	output := &types.UnsupportedDocumentException{}
1314	err := awsAwsjson11_deserializeDocumentUnsupportedDocumentException(&output, shape)
1315
1316	if err != nil {
1317		var snapshot bytes.Buffer
1318		io.Copy(&snapshot, ringBuffer)
1319		err = &smithy.DeserializationError{
1320			Err:      fmt.Errorf("failed to decode response body, %w", err),
1321			Snapshot: snapshot.Bytes(),
1322		}
1323		return err
1324	}
1325
1326	errorBody.Seek(0, io.SeekStart)
1327	return output
1328}
1329
1330func awsAwsjson11_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error {
1331	if v == nil {
1332		return fmt.Errorf("unexpected nil of type %T", v)
1333	}
1334	if value == nil {
1335		return nil
1336	}
1337
1338	shape, ok := value.(map[string]interface{})
1339	if !ok {
1340		return fmt.Errorf("unexpected JSON type %v", value)
1341	}
1342
1343	var sv *types.AccessDeniedException
1344	if *v == nil {
1345		sv = &types.AccessDeniedException{}
1346	} else {
1347		sv = *v
1348	}
1349
1350	for key, value := range shape {
1351		switch key {
1352		case "Code":
1353			if value != nil {
1354				jtv, ok := value.(string)
1355				if !ok {
1356					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1357				}
1358				sv.Code = ptr.String(jtv)
1359			}
1360
1361		case "Message":
1362			if value != nil {
1363				jtv, ok := value.(string)
1364				if !ok {
1365					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1366				}
1367				sv.Message = ptr.String(jtv)
1368			}
1369
1370		default:
1371			_, _ = key, value
1372
1373		}
1374	}
1375	*v = sv
1376	return nil
1377}
1378
1379func awsAwsjson11_deserializeDocumentBadDocumentException(v **types.BadDocumentException, value interface{}) error {
1380	if v == nil {
1381		return fmt.Errorf("unexpected nil of type %T", v)
1382	}
1383	if value == nil {
1384		return nil
1385	}
1386
1387	shape, ok := value.(map[string]interface{})
1388	if !ok {
1389		return fmt.Errorf("unexpected JSON type %v", value)
1390	}
1391
1392	var sv *types.BadDocumentException
1393	if *v == nil {
1394		sv = &types.BadDocumentException{}
1395	} else {
1396		sv = *v
1397	}
1398
1399	for key, value := range shape {
1400		switch key {
1401		case "Code":
1402			if value != nil {
1403				jtv, ok := value.(string)
1404				if !ok {
1405					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1406				}
1407				sv.Code = ptr.String(jtv)
1408			}
1409
1410		case "Message":
1411			if value != nil {
1412				jtv, ok := value.(string)
1413				if !ok {
1414					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1415				}
1416				sv.Message = ptr.String(jtv)
1417			}
1418
1419		default:
1420			_, _ = key, value
1421
1422		}
1423	}
1424	*v = sv
1425	return nil
1426}
1427
1428func awsAwsjson11_deserializeDocumentBlock(v **types.Block, value interface{}) error {
1429	if v == nil {
1430		return fmt.Errorf("unexpected nil of type %T", v)
1431	}
1432	if value == nil {
1433		return nil
1434	}
1435
1436	shape, ok := value.(map[string]interface{})
1437	if !ok {
1438		return fmt.Errorf("unexpected JSON type %v", value)
1439	}
1440
1441	var sv *types.Block
1442	if *v == nil {
1443		sv = &types.Block{}
1444	} else {
1445		sv = *v
1446	}
1447
1448	for key, value := range shape {
1449		switch key {
1450		case "BlockType":
1451			if value != nil {
1452				jtv, ok := value.(string)
1453				if !ok {
1454					return fmt.Errorf("expected BlockType to be of type string, got %T instead", value)
1455				}
1456				sv.BlockType = types.BlockType(jtv)
1457			}
1458
1459		case "ColumnIndex":
1460			if value != nil {
1461				jtv, ok := value.(json.Number)
1462				if !ok {
1463					return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value)
1464				}
1465				i64, err := jtv.Int64()
1466				if err != nil {
1467					return err
1468				}
1469				sv.ColumnIndex = ptr.Int32(int32(i64))
1470			}
1471
1472		case "ColumnSpan":
1473			if value != nil {
1474				jtv, ok := value.(json.Number)
1475				if !ok {
1476					return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value)
1477				}
1478				i64, err := jtv.Int64()
1479				if err != nil {
1480					return err
1481				}
1482				sv.ColumnSpan = ptr.Int32(int32(i64))
1483			}
1484
1485		case "Confidence":
1486			if value != nil {
1487				jtv, ok := value.(json.Number)
1488				if !ok {
1489					return fmt.Errorf("expected Percent to be json.Number, got %T instead", value)
1490				}
1491				f64, err := jtv.Float64()
1492				if err != nil {
1493					return err
1494				}
1495				sv.Confidence = ptr.Float32(float32(f64))
1496			}
1497
1498		case "EntityTypes":
1499			if err := awsAwsjson11_deserializeDocumentEntityTypes(&sv.EntityTypes, value); err != nil {
1500				return err
1501			}
1502
1503		case "Geometry":
1504			if err := awsAwsjson11_deserializeDocumentGeometry(&sv.Geometry, value); err != nil {
1505				return err
1506			}
1507
1508		case "Id":
1509			if value != nil {
1510				jtv, ok := value.(string)
1511				if !ok {
1512					return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value)
1513				}
1514				sv.Id = ptr.String(jtv)
1515			}
1516
1517		case "Page":
1518			if value != nil {
1519				jtv, ok := value.(json.Number)
1520				if !ok {
1521					return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value)
1522				}
1523				i64, err := jtv.Int64()
1524				if err != nil {
1525					return err
1526				}
1527				sv.Page = ptr.Int32(int32(i64))
1528			}
1529
1530		case "Relationships":
1531			if err := awsAwsjson11_deserializeDocumentRelationshipList(&sv.Relationships, value); err != nil {
1532				return err
1533			}
1534
1535		case "RowIndex":
1536			if value != nil {
1537				jtv, ok := value.(json.Number)
1538				if !ok {
1539					return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value)
1540				}
1541				i64, err := jtv.Int64()
1542				if err != nil {
1543					return err
1544				}
1545				sv.RowIndex = ptr.Int32(int32(i64))
1546			}
1547
1548		case "RowSpan":
1549			if value != nil {
1550				jtv, ok := value.(json.Number)
1551				if !ok {
1552					return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value)
1553				}
1554				i64, err := jtv.Int64()
1555				if err != nil {
1556					return err
1557				}
1558				sv.RowSpan = ptr.Int32(int32(i64))
1559			}
1560
1561		case "SelectionStatus":
1562			if value != nil {
1563				jtv, ok := value.(string)
1564				if !ok {
1565					return fmt.Errorf("expected SelectionStatus to be of type string, got %T instead", value)
1566				}
1567				sv.SelectionStatus = types.SelectionStatus(jtv)
1568			}
1569
1570		case "Text":
1571			if value != nil {
1572				jtv, ok := value.(string)
1573				if !ok {
1574					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1575				}
1576				sv.Text = ptr.String(jtv)
1577			}
1578
1579		case "TextType":
1580			if value != nil {
1581				jtv, ok := value.(string)
1582				if !ok {
1583					return fmt.Errorf("expected TextType to be of type string, got %T instead", value)
1584				}
1585				sv.TextType = types.TextType(jtv)
1586			}
1587
1588		default:
1589			_, _ = key, value
1590
1591		}
1592	}
1593	*v = sv
1594	return nil
1595}
1596
1597func awsAwsjson11_deserializeDocumentBlockList(v *[]types.Block, value interface{}) error {
1598	if v == nil {
1599		return fmt.Errorf("unexpected nil of type %T", v)
1600	}
1601	if value == nil {
1602		return nil
1603	}
1604
1605	shape, ok := value.([]interface{})
1606	if !ok {
1607		return fmt.Errorf("unexpected JSON type %v", value)
1608	}
1609
1610	var cv []types.Block
1611	if *v == nil {
1612		cv = []types.Block{}
1613	} else {
1614		cv = *v
1615	}
1616
1617	for _, value := range shape {
1618		var col types.Block
1619		destAddr := &col
1620		if err := awsAwsjson11_deserializeDocumentBlock(&destAddr, value); err != nil {
1621			return err
1622		}
1623		col = *destAddr
1624		cv = append(cv, col)
1625
1626	}
1627	*v = cv
1628	return nil
1629}
1630
1631func awsAwsjson11_deserializeDocumentBoundingBox(v **types.BoundingBox, value interface{}) error {
1632	if v == nil {
1633		return fmt.Errorf("unexpected nil of type %T", v)
1634	}
1635	if value == nil {
1636		return nil
1637	}
1638
1639	shape, ok := value.(map[string]interface{})
1640	if !ok {
1641		return fmt.Errorf("unexpected JSON type %v", value)
1642	}
1643
1644	var sv *types.BoundingBox
1645	if *v == nil {
1646		sv = &types.BoundingBox{}
1647	} else {
1648		sv = *v
1649	}
1650
1651	for key, value := range shape {
1652		switch key {
1653		case "Height":
1654			if value != nil {
1655				jtv, ok := value.(json.Number)
1656				if !ok {
1657					return fmt.Errorf("expected Float to be json.Number, got %T instead", value)
1658				}
1659				f64, err := jtv.Float64()
1660				if err != nil {
1661					return err
1662				}
1663				sv.Height = float32(f64)
1664			}
1665
1666		case "Left":
1667			if value != nil {
1668				jtv, ok := value.(json.Number)
1669				if !ok {
1670					return fmt.Errorf("expected Float to be json.Number, got %T instead", value)
1671				}
1672				f64, err := jtv.Float64()
1673				if err != nil {
1674					return err
1675				}
1676				sv.Left = float32(f64)
1677			}
1678
1679		case "Top":
1680			if value != nil {
1681				jtv, ok := value.(json.Number)
1682				if !ok {
1683					return fmt.Errorf("expected Float to be json.Number, got %T instead", value)
1684				}
1685				f64, err := jtv.Float64()
1686				if err != nil {
1687					return err
1688				}
1689				sv.Top = float32(f64)
1690			}
1691
1692		case "Width":
1693			if value != nil {
1694				jtv, ok := value.(json.Number)
1695				if !ok {
1696					return fmt.Errorf("expected Float to be json.Number, got %T instead", value)
1697				}
1698				f64, err := jtv.Float64()
1699				if err != nil {
1700					return err
1701				}
1702				sv.Width = float32(f64)
1703			}
1704
1705		default:
1706			_, _ = key, value
1707
1708		}
1709	}
1710	*v = sv
1711	return nil
1712}
1713
1714func awsAwsjson11_deserializeDocumentDocumentMetadata(v **types.DocumentMetadata, value interface{}) error {
1715	if v == nil {
1716		return fmt.Errorf("unexpected nil of type %T", v)
1717	}
1718	if value == nil {
1719		return nil
1720	}
1721
1722	shape, ok := value.(map[string]interface{})
1723	if !ok {
1724		return fmt.Errorf("unexpected JSON type %v", value)
1725	}
1726
1727	var sv *types.DocumentMetadata
1728	if *v == nil {
1729		sv = &types.DocumentMetadata{}
1730	} else {
1731		sv = *v
1732	}
1733
1734	for key, value := range shape {
1735		switch key {
1736		case "Pages":
1737			if value != nil {
1738				jtv, ok := value.(json.Number)
1739				if !ok {
1740					return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value)
1741				}
1742				i64, err := jtv.Int64()
1743				if err != nil {
1744					return err
1745				}
1746				sv.Pages = ptr.Int32(int32(i64))
1747			}
1748
1749		default:
1750			_, _ = key, value
1751
1752		}
1753	}
1754	*v = sv
1755	return nil
1756}
1757
1758func awsAwsjson11_deserializeDocumentDocumentTooLargeException(v **types.DocumentTooLargeException, value interface{}) error {
1759	if v == nil {
1760		return fmt.Errorf("unexpected nil of type %T", v)
1761	}
1762	if value == nil {
1763		return nil
1764	}
1765
1766	shape, ok := value.(map[string]interface{})
1767	if !ok {
1768		return fmt.Errorf("unexpected JSON type %v", value)
1769	}
1770
1771	var sv *types.DocumentTooLargeException
1772	if *v == nil {
1773		sv = &types.DocumentTooLargeException{}
1774	} else {
1775		sv = *v
1776	}
1777
1778	for key, value := range shape {
1779		switch key {
1780		case "Code":
1781			if value != nil {
1782				jtv, ok := value.(string)
1783				if !ok {
1784					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1785				}
1786				sv.Code = ptr.String(jtv)
1787			}
1788
1789		case "Message":
1790			if value != nil {
1791				jtv, ok := value.(string)
1792				if !ok {
1793					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1794				}
1795				sv.Message = ptr.String(jtv)
1796			}
1797
1798		default:
1799			_, _ = key, value
1800
1801		}
1802	}
1803	*v = sv
1804	return nil
1805}
1806
1807func awsAwsjson11_deserializeDocumentEntityTypes(v *[]types.EntityType, value interface{}) error {
1808	if v == nil {
1809		return fmt.Errorf("unexpected nil of type %T", v)
1810	}
1811	if value == nil {
1812		return nil
1813	}
1814
1815	shape, ok := value.([]interface{})
1816	if !ok {
1817		return fmt.Errorf("unexpected JSON type %v", value)
1818	}
1819
1820	var cv []types.EntityType
1821	if *v == nil {
1822		cv = []types.EntityType{}
1823	} else {
1824		cv = *v
1825	}
1826
1827	for _, value := range shape {
1828		var col types.EntityType
1829		if value != nil {
1830			jtv, ok := value.(string)
1831			if !ok {
1832				return fmt.Errorf("expected EntityType to be of type string, got %T instead", value)
1833			}
1834			col = types.EntityType(jtv)
1835		}
1836		cv = append(cv, col)
1837
1838	}
1839	*v = cv
1840	return nil
1841}
1842
1843func awsAwsjson11_deserializeDocumentGeometry(v **types.Geometry, value interface{}) error {
1844	if v == nil {
1845		return fmt.Errorf("unexpected nil of type %T", v)
1846	}
1847	if value == nil {
1848		return nil
1849	}
1850
1851	shape, ok := value.(map[string]interface{})
1852	if !ok {
1853		return fmt.Errorf("unexpected JSON type %v", value)
1854	}
1855
1856	var sv *types.Geometry
1857	if *v == nil {
1858		sv = &types.Geometry{}
1859	} else {
1860		sv = *v
1861	}
1862
1863	for key, value := range shape {
1864		switch key {
1865		case "BoundingBox":
1866			if err := awsAwsjson11_deserializeDocumentBoundingBox(&sv.BoundingBox, value); err != nil {
1867				return err
1868			}
1869
1870		case "Polygon":
1871			if err := awsAwsjson11_deserializeDocumentPolygon(&sv.Polygon, value); err != nil {
1872				return err
1873			}
1874
1875		default:
1876			_, _ = key, value
1877
1878		}
1879	}
1880	*v = sv
1881	return nil
1882}
1883
1884func awsAwsjson11_deserializeDocumentHumanLoopActivationOutput(v **types.HumanLoopActivationOutput, value interface{}) error {
1885	if v == nil {
1886		return fmt.Errorf("unexpected nil of type %T", v)
1887	}
1888	if value == nil {
1889		return nil
1890	}
1891
1892	shape, ok := value.(map[string]interface{})
1893	if !ok {
1894		return fmt.Errorf("unexpected JSON type %v", value)
1895	}
1896
1897	var sv *types.HumanLoopActivationOutput
1898	if *v == nil {
1899		sv = &types.HumanLoopActivationOutput{}
1900	} else {
1901		sv = *v
1902	}
1903
1904	for key, value := range shape {
1905		switch key {
1906		case "HumanLoopActivationConditionsEvaluationResults":
1907			if value != nil {
1908				jtv, ok := value.(string)
1909				if !ok {
1910					return fmt.Errorf("expected SynthesizedJsonHumanLoopActivationConditionsEvaluationResults to be of type string, got %T instead", value)
1911				}
1912				sv.HumanLoopActivationConditionsEvaluationResults = ptr.String(jtv)
1913			}
1914
1915		case "HumanLoopActivationReasons":
1916			if err := awsAwsjson11_deserializeDocumentHumanLoopActivationReasons(&sv.HumanLoopActivationReasons, value); err != nil {
1917				return err
1918			}
1919
1920		case "HumanLoopArn":
1921			if value != nil {
1922				jtv, ok := value.(string)
1923				if !ok {
1924					return fmt.Errorf("expected HumanLoopArn to be of type string, got %T instead", value)
1925				}
1926				sv.HumanLoopArn = ptr.String(jtv)
1927			}
1928
1929		default:
1930			_, _ = key, value
1931
1932		}
1933	}
1934	*v = sv
1935	return nil
1936}
1937
1938func awsAwsjson11_deserializeDocumentHumanLoopActivationReasons(v *[]string, value interface{}) error {
1939	if v == nil {
1940		return fmt.Errorf("unexpected nil of type %T", v)
1941	}
1942	if value == nil {
1943		return nil
1944	}
1945
1946	shape, ok := value.([]interface{})
1947	if !ok {
1948		return fmt.Errorf("unexpected JSON type %v", value)
1949	}
1950
1951	var cv []string
1952	if *v == nil {
1953		cv = []string{}
1954	} else {
1955		cv = *v
1956	}
1957
1958	for _, value := range shape {
1959		var col string
1960		if value != nil {
1961			jtv, ok := value.(string)
1962			if !ok {
1963				return fmt.Errorf("expected HumanLoopActivationReason to be of type string, got %T instead", value)
1964			}
1965			col = jtv
1966		}
1967		cv = append(cv, col)
1968
1969	}
1970	*v = cv
1971	return nil
1972}
1973
1974func awsAwsjson11_deserializeDocumentHumanLoopQuotaExceededException(v **types.HumanLoopQuotaExceededException, value interface{}) error {
1975	if v == nil {
1976		return fmt.Errorf("unexpected nil of type %T", v)
1977	}
1978	if value == nil {
1979		return nil
1980	}
1981
1982	shape, ok := value.(map[string]interface{})
1983	if !ok {
1984		return fmt.Errorf("unexpected JSON type %v", value)
1985	}
1986
1987	var sv *types.HumanLoopQuotaExceededException
1988	if *v == nil {
1989		sv = &types.HumanLoopQuotaExceededException{}
1990	} else {
1991		sv = *v
1992	}
1993
1994	for key, value := range shape {
1995		switch key {
1996		case "Code":
1997			if value != nil {
1998				jtv, ok := value.(string)
1999				if !ok {
2000					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2001				}
2002				sv.Code = ptr.String(jtv)
2003			}
2004
2005		case "Message":
2006			if value != nil {
2007				jtv, ok := value.(string)
2008				if !ok {
2009					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2010				}
2011				sv.Message = ptr.String(jtv)
2012			}
2013
2014		case "QuotaCode":
2015			if value != nil {
2016				jtv, ok := value.(string)
2017				if !ok {
2018					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2019				}
2020				sv.QuotaCode = ptr.String(jtv)
2021			}
2022
2023		case "ResourceType":
2024			if value != nil {
2025				jtv, ok := value.(string)
2026				if !ok {
2027					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2028				}
2029				sv.ResourceType = ptr.String(jtv)
2030			}
2031
2032		case "ServiceCode":
2033			if value != nil {
2034				jtv, ok := value.(string)
2035				if !ok {
2036					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2037				}
2038				sv.ServiceCode = ptr.String(jtv)
2039			}
2040
2041		default:
2042			_, _ = key, value
2043
2044		}
2045	}
2046	*v = sv
2047	return nil
2048}
2049
2050func awsAwsjson11_deserializeDocumentIdempotentParameterMismatchException(v **types.IdempotentParameterMismatchException, value interface{}) error {
2051	if v == nil {
2052		return fmt.Errorf("unexpected nil of type %T", v)
2053	}
2054	if value == nil {
2055		return nil
2056	}
2057
2058	shape, ok := value.(map[string]interface{})
2059	if !ok {
2060		return fmt.Errorf("unexpected JSON type %v", value)
2061	}
2062
2063	var sv *types.IdempotentParameterMismatchException
2064	if *v == nil {
2065		sv = &types.IdempotentParameterMismatchException{}
2066	} else {
2067		sv = *v
2068	}
2069
2070	for key, value := range shape {
2071		switch key {
2072		case "Code":
2073			if value != nil {
2074				jtv, ok := value.(string)
2075				if !ok {
2076					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2077				}
2078				sv.Code = ptr.String(jtv)
2079			}
2080
2081		case "Message":
2082			if value != nil {
2083				jtv, ok := value.(string)
2084				if !ok {
2085					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2086				}
2087				sv.Message = ptr.String(jtv)
2088			}
2089
2090		default:
2091			_, _ = key, value
2092
2093		}
2094	}
2095	*v = sv
2096	return nil
2097}
2098
2099func awsAwsjson11_deserializeDocumentIdList(v *[]string, value interface{}) error {
2100	if v == nil {
2101		return fmt.Errorf("unexpected nil of type %T", v)
2102	}
2103	if value == nil {
2104		return nil
2105	}
2106
2107	shape, ok := value.([]interface{})
2108	if !ok {
2109		return fmt.Errorf("unexpected JSON type %v", value)
2110	}
2111
2112	var cv []string
2113	if *v == nil {
2114		cv = []string{}
2115	} else {
2116		cv = *v
2117	}
2118
2119	for _, value := range shape {
2120		var col string
2121		if value != nil {
2122			jtv, ok := value.(string)
2123			if !ok {
2124				return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value)
2125			}
2126			col = jtv
2127		}
2128		cv = append(cv, col)
2129
2130	}
2131	*v = cv
2132	return nil
2133}
2134
2135func awsAwsjson11_deserializeDocumentInternalServerError(v **types.InternalServerError, value interface{}) error {
2136	if v == nil {
2137		return fmt.Errorf("unexpected nil of type %T", v)
2138	}
2139	if value == nil {
2140		return nil
2141	}
2142
2143	shape, ok := value.(map[string]interface{})
2144	if !ok {
2145		return fmt.Errorf("unexpected JSON type %v", value)
2146	}
2147
2148	var sv *types.InternalServerError
2149	if *v == nil {
2150		sv = &types.InternalServerError{}
2151	} else {
2152		sv = *v
2153	}
2154
2155	for key, value := range shape {
2156		switch key {
2157		case "Code":
2158			if value != nil {
2159				jtv, ok := value.(string)
2160				if !ok {
2161					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2162				}
2163				sv.Code = ptr.String(jtv)
2164			}
2165
2166		case "Message":
2167			if value != nil {
2168				jtv, ok := value.(string)
2169				if !ok {
2170					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2171				}
2172				sv.Message = ptr.String(jtv)
2173			}
2174
2175		default:
2176			_, _ = key, value
2177
2178		}
2179	}
2180	*v = sv
2181	return nil
2182}
2183
2184func awsAwsjson11_deserializeDocumentInvalidJobIdException(v **types.InvalidJobIdException, value interface{}) error {
2185	if v == nil {
2186		return fmt.Errorf("unexpected nil of type %T", v)
2187	}
2188	if value == nil {
2189		return nil
2190	}
2191
2192	shape, ok := value.(map[string]interface{})
2193	if !ok {
2194		return fmt.Errorf("unexpected JSON type %v", value)
2195	}
2196
2197	var sv *types.InvalidJobIdException
2198	if *v == nil {
2199		sv = &types.InvalidJobIdException{}
2200	} else {
2201		sv = *v
2202	}
2203
2204	for key, value := range shape {
2205		switch key {
2206		case "Code":
2207			if value != nil {
2208				jtv, ok := value.(string)
2209				if !ok {
2210					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2211				}
2212				sv.Code = ptr.String(jtv)
2213			}
2214
2215		case "Message":
2216			if value != nil {
2217				jtv, ok := value.(string)
2218				if !ok {
2219					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2220				}
2221				sv.Message = ptr.String(jtv)
2222			}
2223
2224		default:
2225			_, _ = key, value
2226
2227		}
2228	}
2229	*v = sv
2230	return nil
2231}
2232
2233func awsAwsjson11_deserializeDocumentInvalidKMSKeyException(v **types.InvalidKMSKeyException, value interface{}) error {
2234	if v == nil {
2235		return fmt.Errorf("unexpected nil of type %T", v)
2236	}
2237	if value == nil {
2238		return nil
2239	}
2240
2241	shape, ok := value.(map[string]interface{})
2242	if !ok {
2243		return fmt.Errorf("unexpected JSON type %v", value)
2244	}
2245
2246	var sv *types.InvalidKMSKeyException
2247	if *v == nil {
2248		sv = &types.InvalidKMSKeyException{}
2249	} else {
2250		sv = *v
2251	}
2252
2253	for key, value := range shape {
2254		switch key {
2255		case "Code":
2256			if value != nil {
2257				jtv, ok := value.(string)
2258				if !ok {
2259					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2260				}
2261				sv.Code = ptr.String(jtv)
2262			}
2263
2264		case "Message":
2265			if value != nil {
2266				jtv, ok := value.(string)
2267				if !ok {
2268					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2269				}
2270				sv.Message = ptr.String(jtv)
2271			}
2272
2273		default:
2274			_, _ = key, value
2275
2276		}
2277	}
2278	*v = sv
2279	return nil
2280}
2281
2282func awsAwsjson11_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error {
2283	if v == nil {
2284		return fmt.Errorf("unexpected nil of type %T", v)
2285	}
2286	if value == nil {
2287		return nil
2288	}
2289
2290	shape, ok := value.(map[string]interface{})
2291	if !ok {
2292		return fmt.Errorf("unexpected JSON type %v", value)
2293	}
2294
2295	var sv *types.InvalidParameterException
2296	if *v == nil {
2297		sv = &types.InvalidParameterException{}
2298	} else {
2299		sv = *v
2300	}
2301
2302	for key, value := range shape {
2303		switch key {
2304		case "Code":
2305			if value != nil {
2306				jtv, ok := value.(string)
2307				if !ok {
2308					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2309				}
2310				sv.Code = ptr.String(jtv)
2311			}
2312
2313		case "Message":
2314			if value != nil {
2315				jtv, ok := value.(string)
2316				if !ok {
2317					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2318				}
2319				sv.Message = ptr.String(jtv)
2320			}
2321
2322		default:
2323			_, _ = key, value
2324
2325		}
2326	}
2327	*v = sv
2328	return nil
2329}
2330
2331func awsAwsjson11_deserializeDocumentInvalidS3ObjectException(v **types.InvalidS3ObjectException, value interface{}) error {
2332	if v == nil {
2333		return fmt.Errorf("unexpected nil of type %T", v)
2334	}
2335	if value == nil {
2336		return nil
2337	}
2338
2339	shape, ok := value.(map[string]interface{})
2340	if !ok {
2341		return fmt.Errorf("unexpected JSON type %v", value)
2342	}
2343
2344	var sv *types.InvalidS3ObjectException
2345	if *v == nil {
2346		sv = &types.InvalidS3ObjectException{}
2347	} else {
2348		sv = *v
2349	}
2350
2351	for key, value := range shape {
2352		switch key {
2353		case "Code":
2354			if value != nil {
2355				jtv, ok := value.(string)
2356				if !ok {
2357					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2358				}
2359				sv.Code = ptr.String(jtv)
2360			}
2361
2362		case "Message":
2363			if value != nil {
2364				jtv, ok := value.(string)
2365				if !ok {
2366					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2367				}
2368				sv.Message = ptr.String(jtv)
2369			}
2370
2371		default:
2372			_, _ = key, value
2373
2374		}
2375	}
2376	*v = sv
2377	return nil
2378}
2379
2380func awsAwsjson11_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error {
2381	if v == nil {
2382		return fmt.Errorf("unexpected nil of type %T", v)
2383	}
2384	if value == nil {
2385		return nil
2386	}
2387
2388	shape, ok := value.(map[string]interface{})
2389	if !ok {
2390		return fmt.Errorf("unexpected JSON type %v", value)
2391	}
2392
2393	var sv *types.LimitExceededException
2394	if *v == nil {
2395		sv = &types.LimitExceededException{}
2396	} else {
2397		sv = *v
2398	}
2399
2400	for key, value := range shape {
2401		switch key {
2402		case "Code":
2403			if value != nil {
2404				jtv, ok := value.(string)
2405				if !ok {
2406					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2407				}
2408				sv.Code = ptr.String(jtv)
2409			}
2410
2411		case "Message":
2412			if value != nil {
2413				jtv, ok := value.(string)
2414				if !ok {
2415					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2416				}
2417				sv.Message = ptr.String(jtv)
2418			}
2419
2420		default:
2421			_, _ = key, value
2422
2423		}
2424	}
2425	*v = sv
2426	return nil
2427}
2428
2429func awsAwsjson11_deserializeDocumentPages(v *[]int32, value interface{}) error {
2430	if v == nil {
2431		return fmt.Errorf("unexpected nil of type %T", v)
2432	}
2433	if value == nil {
2434		return nil
2435	}
2436
2437	shape, ok := value.([]interface{})
2438	if !ok {
2439		return fmt.Errorf("unexpected JSON type %v", value)
2440	}
2441
2442	var cv []int32
2443	if *v == nil {
2444		cv = []int32{}
2445	} else {
2446		cv = *v
2447	}
2448
2449	for _, value := range shape {
2450		var col int32
2451		if value != nil {
2452			jtv, ok := value.(json.Number)
2453			if !ok {
2454				return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value)
2455			}
2456			i64, err := jtv.Int64()
2457			if err != nil {
2458				return err
2459			}
2460			col = int32(i64)
2461		}
2462		cv = append(cv, col)
2463
2464	}
2465	*v = cv
2466	return nil
2467}
2468
2469func awsAwsjson11_deserializeDocumentPoint(v **types.Point, value interface{}) error {
2470	if v == nil {
2471		return fmt.Errorf("unexpected nil of type %T", v)
2472	}
2473	if value == nil {
2474		return nil
2475	}
2476
2477	shape, ok := value.(map[string]interface{})
2478	if !ok {
2479		return fmt.Errorf("unexpected JSON type %v", value)
2480	}
2481
2482	var sv *types.Point
2483	if *v == nil {
2484		sv = &types.Point{}
2485	} else {
2486		sv = *v
2487	}
2488
2489	for key, value := range shape {
2490		switch key {
2491		case "X":
2492			if value != nil {
2493				jtv, ok := value.(json.Number)
2494				if !ok {
2495					return fmt.Errorf("expected Float to be json.Number, got %T instead", value)
2496				}
2497				f64, err := jtv.Float64()
2498				if err != nil {
2499					return err
2500				}
2501				sv.X = float32(f64)
2502			}
2503
2504		case "Y":
2505			if value != nil {
2506				jtv, ok := value.(json.Number)
2507				if !ok {
2508					return fmt.Errorf("expected Float to be json.Number, got %T instead", value)
2509				}
2510				f64, err := jtv.Float64()
2511				if err != nil {
2512					return err
2513				}
2514				sv.Y = float32(f64)
2515			}
2516
2517		default:
2518			_, _ = key, value
2519
2520		}
2521	}
2522	*v = sv
2523	return nil
2524}
2525
2526func awsAwsjson11_deserializeDocumentPolygon(v *[]types.Point, value interface{}) error {
2527	if v == nil {
2528		return fmt.Errorf("unexpected nil of type %T", v)
2529	}
2530	if value == nil {
2531		return nil
2532	}
2533
2534	shape, ok := value.([]interface{})
2535	if !ok {
2536		return fmt.Errorf("unexpected JSON type %v", value)
2537	}
2538
2539	var cv []types.Point
2540	if *v == nil {
2541		cv = []types.Point{}
2542	} else {
2543		cv = *v
2544	}
2545
2546	for _, value := range shape {
2547		var col types.Point
2548		destAddr := &col
2549		if err := awsAwsjson11_deserializeDocumentPoint(&destAddr, value); err != nil {
2550			return err
2551		}
2552		col = *destAddr
2553		cv = append(cv, col)
2554
2555	}
2556	*v = cv
2557	return nil
2558}
2559
2560func awsAwsjson11_deserializeDocumentProvisionedThroughputExceededException(v **types.ProvisionedThroughputExceededException, value interface{}) error {
2561	if v == nil {
2562		return fmt.Errorf("unexpected nil of type %T", v)
2563	}
2564	if value == nil {
2565		return nil
2566	}
2567
2568	shape, ok := value.(map[string]interface{})
2569	if !ok {
2570		return fmt.Errorf("unexpected JSON type %v", value)
2571	}
2572
2573	var sv *types.ProvisionedThroughputExceededException
2574	if *v == nil {
2575		sv = &types.ProvisionedThroughputExceededException{}
2576	} else {
2577		sv = *v
2578	}
2579
2580	for key, value := range shape {
2581		switch key {
2582		case "Code":
2583			if value != nil {
2584				jtv, ok := value.(string)
2585				if !ok {
2586					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2587				}
2588				sv.Code = ptr.String(jtv)
2589			}
2590
2591		case "Message":
2592			if value != nil {
2593				jtv, ok := value.(string)
2594				if !ok {
2595					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2596				}
2597				sv.Message = ptr.String(jtv)
2598			}
2599
2600		default:
2601			_, _ = key, value
2602
2603		}
2604	}
2605	*v = sv
2606	return nil
2607}
2608
2609func awsAwsjson11_deserializeDocumentRelationship(v **types.Relationship, value interface{}) error {
2610	if v == nil {
2611		return fmt.Errorf("unexpected nil of type %T", v)
2612	}
2613	if value == nil {
2614		return nil
2615	}
2616
2617	shape, ok := value.(map[string]interface{})
2618	if !ok {
2619		return fmt.Errorf("unexpected JSON type %v", value)
2620	}
2621
2622	var sv *types.Relationship
2623	if *v == nil {
2624		sv = &types.Relationship{}
2625	} else {
2626		sv = *v
2627	}
2628
2629	for key, value := range shape {
2630		switch key {
2631		case "Ids":
2632			if err := awsAwsjson11_deserializeDocumentIdList(&sv.Ids, value); err != nil {
2633				return err
2634			}
2635
2636		case "Type":
2637			if value != nil {
2638				jtv, ok := value.(string)
2639				if !ok {
2640					return fmt.Errorf("expected RelationshipType to be of type string, got %T instead", value)
2641				}
2642				sv.Type = types.RelationshipType(jtv)
2643			}
2644
2645		default:
2646			_, _ = key, value
2647
2648		}
2649	}
2650	*v = sv
2651	return nil
2652}
2653
2654func awsAwsjson11_deserializeDocumentRelationshipList(v *[]types.Relationship, value interface{}) error {
2655	if v == nil {
2656		return fmt.Errorf("unexpected nil of type %T", v)
2657	}
2658	if value == nil {
2659		return nil
2660	}
2661
2662	shape, ok := value.([]interface{})
2663	if !ok {
2664		return fmt.Errorf("unexpected JSON type %v", value)
2665	}
2666
2667	var cv []types.Relationship
2668	if *v == nil {
2669		cv = []types.Relationship{}
2670	} else {
2671		cv = *v
2672	}
2673
2674	for _, value := range shape {
2675		var col types.Relationship
2676		destAddr := &col
2677		if err := awsAwsjson11_deserializeDocumentRelationship(&destAddr, value); err != nil {
2678			return err
2679		}
2680		col = *destAddr
2681		cv = append(cv, col)
2682
2683	}
2684	*v = cv
2685	return nil
2686}
2687
2688func awsAwsjson11_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error {
2689	if v == nil {
2690		return fmt.Errorf("unexpected nil of type %T", v)
2691	}
2692	if value == nil {
2693		return nil
2694	}
2695
2696	shape, ok := value.(map[string]interface{})
2697	if !ok {
2698		return fmt.Errorf("unexpected JSON type %v", value)
2699	}
2700
2701	var sv *types.ThrottlingException
2702	if *v == nil {
2703		sv = &types.ThrottlingException{}
2704	} else {
2705		sv = *v
2706	}
2707
2708	for key, value := range shape {
2709		switch key {
2710		case "Code":
2711			if value != nil {
2712				jtv, ok := value.(string)
2713				if !ok {
2714					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2715				}
2716				sv.Code = ptr.String(jtv)
2717			}
2718
2719		case "Message":
2720			if value != nil {
2721				jtv, ok := value.(string)
2722				if !ok {
2723					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2724				}
2725				sv.Message = ptr.String(jtv)
2726			}
2727
2728		default:
2729			_, _ = key, value
2730
2731		}
2732	}
2733	*v = sv
2734	return nil
2735}
2736
2737func awsAwsjson11_deserializeDocumentUnsupportedDocumentException(v **types.UnsupportedDocumentException, value interface{}) error {
2738	if v == nil {
2739		return fmt.Errorf("unexpected nil of type %T", v)
2740	}
2741	if value == nil {
2742		return nil
2743	}
2744
2745	shape, ok := value.(map[string]interface{})
2746	if !ok {
2747		return fmt.Errorf("unexpected JSON type %v", value)
2748	}
2749
2750	var sv *types.UnsupportedDocumentException
2751	if *v == nil {
2752		sv = &types.UnsupportedDocumentException{}
2753	} else {
2754		sv = *v
2755	}
2756
2757	for key, value := range shape {
2758		switch key {
2759		case "Code":
2760			if value != nil {
2761				jtv, ok := value.(string)
2762				if !ok {
2763					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2764				}
2765				sv.Code = ptr.String(jtv)
2766			}
2767
2768		case "Message":
2769			if value != nil {
2770				jtv, ok := value.(string)
2771				if !ok {
2772					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2773				}
2774				sv.Message = ptr.String(jtv)
2775			}
2776
2777		default:
2778			_, _ = key, value
2779
2780		}
2781	}
2782	*v = sv
2783	return nil
2784}
2785
2786func awsAwsjson11_deserializeDocumentWarning(v **types.Warning, value interface{}) error {
2787	if v == nil {
2788		return fmt.Errorf("unexpected nil of type %T", v)
2789	}
2790	if value == nil {
2791		return nil
2792	}
2793
2794	shape, ok := value.(map[string]interface{})
2795	if !ok {
2796		return fmt.Errorf("unexpected JSON type %v", value)
2797	}
2798
2799	var sv *types.Warning
2800	if *v == nil {
2801		sv = &types.Warning{}
2802	} else {
2803		sv = *v
2804	}
2805
2806	for key, value := range shape {
2807		switch key {
2808		case "ErrorCode":
2809			if value != nil {
2810				jtv, ok := value.(string)
2811				if !ok {
2812					return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value)
2813				}
2814				sv.ErrorCode = ptr.String(jtv)
2815			}
2816
2817		case "Pages":
2818			if err := awsAwsjson11_deserializeDocumentPages(&sv.Pages, value); err != nil {
2819				return err
2820			}
2821
2822		default:
2823			_, _ = key, value
2824
2825		}
2826	}
2827	*v = sv
2828	return nil
2829}
2830
2831func awsAwsjson11_deserializeDocumentWarnings(v *[]types.Warning, value interface{}) error {
2832	if v == nil {
2833		return fmt.Errorf("unexpected nil of type %T", v)
2834	}
2835	if value == nil {
2836		return nil
2837	}
2838
2839	shape, ok := value.([]interface{})
2840	if !ok {
2841		return fmt.Errorf("unexpected JSON type %v", value)
2842	}
2843
2844	var cv []types.Warning
2845	if *v == nil {
2846		cv = []types.Warning{}
2847	} else {
2848		cv = *v
2849	}
2850
2851	for _, value := range shape {
2852		var col types.Warning
2853		destAddr := &col
2854		if err := awsAwsjson11_deserializeDocumentWarning(&destAddr, value); err != nil {
2855			return err
2856		}
2857		col = *destAddr
2858		cv = append(cv, col)
2859
2860	}
2861	*v = cv
2862	return nil
2863}
2864
2865func awsAwsjson11_deserializeOpDocumentAnalyzeDocumentOutput(v **AnalyzeDocumentOutput, value interface{}) error {
2866	if v == nil {
2867		return fmt.Errorf("unexpected nil of type %T", v)
2868	}
2869	if value == nil {
2870		return nil
2871	}
2872
2873	shape, ok := value.(map[string]interface{})
2874	if !ok {
2875		return fmt.Errorf("unexpected JSON type %v", value)
2876	}
2877
2878	var sv *AnalyzeDocumentOutput
2879	if *v == nil {
2880		sv = &AnalyzeDocumentOutput{}
2881	} else {
2882		sv = *v
2883	}
2884
2885	for key, value := range shape {
2886		switch key {
2887		case "AnalyzeDocumentModelVersion":
2888			if value != nil {
2889				jtv, ok := value.(string)
2890				if !ok {
2891					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2892				}
2893				sv.AnalyzeDocumentModelVersion = ptr.String(jtv)
2894			}
2895
2896		case "Blocks":
2897			if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil {
2898				return err
2899			}
2900
2901		case "DocumentMetadata":
2902			if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil {
2903				return err
2904			}
2905
2906		case "HumanLoopActivationOutput":
2907			if err := awsAwsjson11_deserializeDocumentHumanLoopActivationOutput(&sv.HumanLoopActivationOutput, value); err != nil {
2908				return err
2909			}
2910
2911		default:
2912			_, _ = key, value
2913
2914		}
2915	}
2916	*v = sv
2917	return nil
2918}
2919
2920func awsAwsjson11_deserializeOpDocumentDetectDocumentTextOutput(v **DetectDocumentTextOutput, value interface{}) error {
2921	if v == nil {
2922		return fmt.Errorf("unexpected nil of type %T", v)
2923	}
2924	if value == nil {
2925		return nil
2926	}
2927
2928	shape, ok := value.(map[string]interface{})
2929	if !ok {
2930		return fmt.Errorf("unexpected JSON type %v", value)
2931	}
2932
2933	var sv *DetectDocumentTextOutput
2934	if *v == nil {
2935		sv = &DetectDocumentTextOutput{}
2936	} else {
2937		sv = *v
2938	}
2939
2940	for key, value := range shape {
2941		switch key {
2942		case "Blocks":
2943			if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil {
2944				return err
2945			}
2946
2947		case "DetectDocumentTextModelVersion":
2948			if value != nil {
2949				jtv, ok := value.(string)
2950				if !ok {
2951					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2952				}
2953				sv.DetectDocumentTextModelVersion = ptr.String(jtv)
2954			}
2955
2956		case "DocumentMetadata":
2957			if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil {
2958				return err
2959			}
2960
2961		default:
2962			_, _ = key, value
2963
2964		}
2965	}
2966	*v = sv
2967	return nil
2968}
2969
2970func awsAwsjson11_deserializeOpDocumentGetDocumentAnalysisOutput(v **GetDocumentAnalysisOutput, value interface{}) error {
2971	if v == nil {
2972		return fmt.Errorf("unexpected nil of type %T", v)
2973	}
2974	if value == nil {
2975		return nil
2976	}
2977
2978	shape, ok := value.(map[string]interface{})
2979	if !ok {
2980		return fmt.Errorf("unexpected JSON type %v", value)
2981	}
2982
2983	var sv *GetDocumentAnalysisOutput
2984	if *v == nil {
2985		sv = &GetDocumentAnalysisOutput{}
2986	} else {
2987		sv = *v
2988	}
2989
2990	for key, value := range shape {
2991		switch key {
2992		case "AnalyzeDocumentModelVersion":
2993			if value != nil {
2994				jtv, ok := value.(string)
2995				if !ok {
2996					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2997				}
2998				sv.AnalyzeDocumentModelVersion = ptr.String(jtv)
2999			}
3000
3001		case "Blocks":
3002			if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil {
3003				return err
3004			}
3005
3006		case "DocumentMetadata":
3007			if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil {
3008				return err
3009			}
3010
3011		case "JobStatus":
3012			if value != nil {
3013				jtv, ok := value.(string)
3014				if !ok {
3015					return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value)
3016				}
3017				sv.JobStatus = types.JobStatus(jtv)
3018			}
3019
3020		case "NextToken":
3021			if value != nil {
3022				jtv, ok := value.(string)
3023				if !ok {
3024					return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value)
3025				}
3026				sv.NextToken = ptr.String(jtv)
3027			}
3028
3029		case "StatusMessage":
3030			if value != nil {
3031				jtv, ok := value.(string)
3032				if !ok {
3033					return fmt.Errorf("expected StatusMessage to be of type string, got %T instead", value)
3034				}
3035				sv.StatusMessage = ptr.String(jtv)
3036			}
3037
3038		case "Warnings":
3039			if err := awsAwsjson11_deserializeDocumentWarnings(&sv.Warnings, value); err != nil {
3040				return err
3041			}
3042
3043		default:
3044			_, _ = key, value
3045
3046		}
3047	}
3048	*v = sv
3049	return nil
3050}
3051
3052func awsAwsjson11_deserializeOpDocumentGetDocumentTextDetectionOutput(v **GetDocumentTextDetectionOutput, value interface{}) error {
3053	if v == nil {
3054		return fmt.Errorf("unexpected nil of type %T", v)
3055	}
3056	if value == nil {
3057		return nil
3058	}
3059
3060	shape, ok := value.(map[string]interface{})
3061	if !ok {
3062		return fmt.Errorf("unexpected JSON type %v", value)
3063	}
3064
3065	var sv *GetDocumentTextDetectionOutput
3066	if *v == nil {
3067		sv = &GetDocumentTextDetectionOutput{}
3068	} else {
3069		sv = *v
3070	}
3071
3072	for key, value := range shape {
3073		switch key {
3074		case "Blocks":
3075			if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil {
3076				return err
3077			}
3078
3079		case "DetectDocumentTextModelVersion":
3080			if value != nil {
3081				jtv, ok := value.(string)
3082				if !ok {
3083					return fmt.Errorf("expected String to be of type string, got %T instead", value)
3084				}
3085				sv.DetectDocumentTextModelVersion = ptr.String(jtv)
3086			}
3087
3088		case "DocumentMetadata":
3089			if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil {
3090				return err
3091			}
3092
3093		case "JobStatus":
3094			if value != nil {
3095				jtv, ok := value.(string)
3096				if !ok {
3097					return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value)
3098				}
3099				sv.JobStatus = types.JobStatus(jtv)
3100			}
3101
3102		case "NextToken":
3103			if value != nil {
3104				jtv, ok := value.(string)
3105				if !ok {
3106					return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value)
3107				}
3108				sv.NextToken = ptr.String(jtv)
3109			}
3110
3111		case "StatusMessage":
3112			if value != nil {
3113				jtv, ok := value.(string)
3114				if !ok {
3115					return fmt.Errorf("expected StatusMessage to be of type string, got %T instead", value)
3116				}
3117				sv.StatusMessage = ptr.String(jtv)
3118			}
3119
3120		case "Warnings":
3121			if err := awsAwsjson11_deserializeDocumentWarnings(&sv.Warnings, value); err != nil {
3122				return err
3123			}
3124
3125		default:
3126			_, _ = key, value
3127
3128		}
3129	}
3130	*v = sv
3131	return nil
3132}
3133
3134func awsAwsjson11_deserializeOpDocumentStartDocumentAnalysisOutput(v **StartDocumentAnalysisOutput, value interface{}) error {
3135	if v == nil {
3136		return fmt.Errorf("unexpected nil of type %T", v)
3137	}
3138	if value == nil {
3139		return nil
3140	}
3141
3142	shape, ok := value.(map[string]interface{})
3143	if !ok {
3144		return fmt.Errorf("unexpected JSON type %v", value)
3145	}
3146
3147	var sv *StartDocumentAnalysisOutput
3148	if *v == nil {
3149		sv = &StartDocumentAnalysisOutput{}
3150	} else {
3151		sv = *v
3152	}
3153
3154	for key, value := range shape {
3155		switch key {
3156		case "JobId":
3157			if value != nil {
3158				jtv, ok := value.(string)
3159				if !ok {
3160					return fmt.Errorf("expected JobId to be of type string, got %T instead", value)
3161				}
3162				sv.JobId = ptr.String(jtv)
3163			}
3164
3165		default:
3166			_, _ = key, value
3167
3168		}
3169	}
3170	*v = sv
3171	return nil
3172}
3173
3174func awsAwsjson11_deserializeOpDocumentStartDocumentTextDetectionOutput(v **StartDocumentTextDetectionOutput, value interface{}) error {
3175	if v == nil {
3176		return fmt.Errorf("unexpected nil of type %T", v)
3177	}
3178	if value == nil {
3179		return nil
3180	}
3181
3182	shape, ok := value.(map[string]interface{})
3183	if !ok {
3184		return fmt.Errorf("unexpected JSON type %v", value)
3185	}
3186
3187	var sv *StartDocumentTextDetectionOutput
3188	if *v == nil {
3189		sv = &StartDocumentTextDetectionOutput{}
3190	} else {
3191		sv = *v
3192	}
3193
3194	for key, value := range shape {
3195		switch key {
3196		case "JobId":
3197			if value != nil {
3198				jtv, ok := value.(string)
3199				if !ok {
3200					return fmt.Errorf("expected JobId to be of type string, got %T instead", value)
3201				}
3202				sv.JobId = ptr.String(jtv)
3203			}
3204
3205		default:
3206			_, _ = key, value
3207
3208		}
3209	}
3210	*v = sv
3211	return nil
3212}
3213