1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package cognitosync
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/cognitosync/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	smithytime "github.com/aws/smithy-go/time"
17	smithyhttp "github.com/aws/smithy-go/transport/http"
18	"io"
19	"io/ioutil"
20	"strings"
21)
22
23type awsRestjson1_deserializeOpBulkPublish struct {
24}
25
26func (*awsRestjson1_deserializeOpBulkPublish) ID() string {
27	return "OperationDeserializer"
28}
29
30func (m *awsRestjson1_deserializeOpBulkPublish) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
31	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
32) {
33	out, metadata, err = next.HandleDeserialize(ctx, in)
34	if err != nil {
35		return out, metadata, err
36	}
37
38	response, ok := out.RawResponse.(*smithyhttp.Response)
39	if !ok {
40		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
41	}
42
43	if response.StatusCode < 200 || response.StatusCode >= 300 {
44		return out, metadata, awsRestjson1_deserializeOpErrorBulkPublish(response, &metadata)
45	}
46	output := &BulkPublishOutput{}
47	out.Result = output
48
49	var buff [1024]byte
50	ringBuffer := smithyio.NewRingBuffer(buff[:])
51
52	body := io.TeeReader(response.Body, ringBuffer)
53
54	decoder := json.NewDecoder(body)
55	decoder.UseNumber()
56	var shape interface{}
57	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
58		var snapshot bytes.Buffer
59		io.Copy(&snapshot, ringBuffer)
60		err = &smithy.DeserializationError{
61			Err:      fmt.Errorf("failed to decode response body, %w", err),
62			Snapshot: snapshot.Bytes(),
63		}
64		return out, metadata, err
65	}
66
67	err = awsRestjson1_deserializeOpDocumentBulkPublishOutput(&output, shape)
68	if err != nil {
69		var snapshot bytes.Buffer
70		io.Copy(&snapshot, ringBuffer)
71		return out, metadata, &smithy.DeserializationError{
72			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
73			Snapshot: snapshot.Bytes(),
74		}
75	}
76
77	return out, metadata, err
78}
79
80func awsRestjson1_deserializeOpErrorBulkPublish(response *smithyhttp.Response, metadata *middleware.Metadata) error {
81	var errorBuffer bytes.Buffer
82	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
83		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
84	}
85	errorBody := bytes.NewReader(errorBuffer.Bytes())
86
87	errorCode := "UnknownError"
88	errorMessage := errorCode
89
90	code := response.Header.Get("X-Amzn-ErrorType")
91	if len(code) != 0 {
92		errorCode = restjson.SanitizeErrorCode(code)
93	}
94
95	var buff [1024]byte
96	ringBuffer := smithyio.NewRingBuffer(buff[:])
97
98	body := io.TeeReader(errorBody, ringBuffer)
99	decoder := json.NewDecoder(body)
100	decoder.UseNumber()
101	code, message, err := restjson.GetErrorInfo(decoder)
102	if err != nil {
103		var snapshot bytes.Buffer
104		io.Copy(&snapshot, ringBuffer)
105		err = &smithy.DeserializationError{
106			Err:      fmt.Errorf("failed to decode response body, %w", err),
107			Snapshot: snapshot.Bytes(),
108		}
109		return err
110	}
111
112	errorBody.Seek(0, io.SeekStart)
113	if len(code) != 0 {
114		errorCode = restjson.SanitizeErrorCode(code)
115	}
116	if len(message) != 0 {
117		errorMessage = message
118	}
119
120	switch {
121	case strings.EqualFold("AlreadyStreamedException", errorCode):
122		return awsRestjson1_deserializeErrorAlreadyStreamedException(response, errorBody)
123
124	case strings.EqualFold("DuplicateRequestException", errorCode):
125		return awsRestjson1_deserializeErrorDuplicateRequestException(response, errorBody)
126
127	case strings.EqualFold("InternalErrorException", errorCode):
128		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
129
130	case strings.EqualFold("InvalidParameterException", errorCode):
131		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
132
133	case strings.EqualFold("NotAuthorizedException", errorCode):
134		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
135
136	case strings.EqualFold("ResourceNotFoundException", errorCode):
137		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
138
139	default:
140		genericError := &smithy.GenericAPIError{
141			Code:    errorCode,
142			Message: errorMessage,
143		}
144		return genericError
145
146	}
147}
148
149func awsRestjson1_deserializeOpDocumentBulkPublishOutput(v **BulkPublishOutput, value interface{}) error {
150	if v == nil {
151		return fmt.Errorf("unexpected nil of type %T", v)
152	}
153	if value == nil {
154		return nil
155	}
156
157	shape, ok := value.(map[string]interface{})
158	if !ok {
159		return fmt.Errorf("unexpected JSON type %v", value)
160	}
161
162	var sv *BulkPublishOutput
163	if *v == nil {
164		sv = &BulkPublishOutput{}
165	} else {
166		sv = *v
167	}
168
169	for key, value := range shape {
170		switch key {
171		case "IdentityPoolId":
172			if value != nil {
173				jtv, ok := value.(string)
174				if !ok {
175					return fmt.Errorf("expected IdentityPoolId to be of type string, got %T instead", value)
176				}
177				sv.IdentityPoolId = ptr.String(jtv)
178			}
179
180		default:
181			_, _ = key, value
182
183		}
184	}
185	*v = sv
186	return nil
187}
188
189type awsRestjson1_deserializeOpDeleteDataset struct {
190}
191
192func (*awsRestjson1_deserializeOpDeleteDataset) ID() string {
193	return "OperationDeserializer"
194}
195
196func (m *awsRestjson1_deserializeOpDeleteDataset) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
197	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
198) {
199	out, metadata, err = next.HandleDeserialize(ctx, in)
200	if err != nil {
201		return out, metadata, err
202	}
203
204	response, ok := out.RawResponse.(*smithyhttp.Response)
205	if !ok {
206		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
207	}
208
209	if response.StatusCode < 200 || response.StatusCode >= 300 {
210		return out, metadata, awsRestjson1_deserializeOpErrorDeleteDataset(response, &metadata)
211	}
212	output := &DeleteDatasetOutput{}
213	out.Result = output
214
215	var buff [1024]byte
216	ringBuffer := smithyio.NewRingBuffer(buff[:])
217
218	body := io.TeeReader(response.Body, ringBuffer)
219
220	decoder := json.NewDecoder(body)
221	decoder.UseNumber()
222	var shape interface{}
223	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
224		var snapshot bytes.Buffer
225		io.Copy(&snapshot, ringBuffer)
226		err = &smithy.DeserializationError{
227			Err:      fmt.Errorf("failed to decode response body, %w", err),
228			Snapshot: snapshot.Bytes(),
229		}
230		return out, metadata, err
231	}
232
233	err = awsRestjson1_deserializeOpDocumentDeleteDatasetOutput(&output, shape)
234	if err != nil {
235		var snapshot bytes.Buffer
236		io.Copy(&snapshot, ringBuffer)
237		return out, metadata, &smithy.DeserializationError{
238			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
239			Snapshot: snapshot.Bytes(),
240		}
241	}
242
243	return out, metadata, err
244}
245
246func awsRestjson1_deserializeOpErrorDeleteDataset(response *smithyhttp.Response, metadata *middleware.Metadata) error {
247	var errorBuffer bytes.Buffer
248	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
249		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
250	}
251	errorBody := bytes.NewReader(errorBuffer.Bytes())
252
253	errorCode := "UnknownError"
254	errorMessage := errorCode
255
256	code := response.Header.Get("X-Amzn-ErrorType")
257	if len(code) != 0 {
258		errorCode = restjson.SanitizeErrorCode(code)
259	}
260
261	var buff [1024]byte
262	ringBuffer := smithyio.NewRingBuffer(buff[:])
263
264	body := io.TeeReader(errorBody, ringBuffer)
265	decoder := json.NewDecoder(body)
266	decoder.UseNumber()
267	code, message, err := restjson.GetErrorInfo(decoder)
268	if err != nil {
269		var snapshot bytes.Buffer
270		io.Copy(&snapshot, ringBuffer)
271		err = &smithy.DeserializationError{
272			Err:      fmt.Errorf("failed to decode response body, %w", err),
273			Snapshot: snapshot.Bytes(),
274		}
275		return err
276	}
277
278	errorBody.Seek(0, io.SeekStart)
279	if len(code) != 0 {
280		errorCode = restjson.SanitizeErrorCode(code)
281	}
282	if len(message) != 0 {
283		errorMessage = message
284	}
285
286	switch {
287	case strings.EqualFold("InternalErrorException", errorCode):
288		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
289
290	case strings.EqualFold("InvalidParameterException", errorCode):
291		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
292
293	case strings.EqualFold("NotAuthorizedException", errorCode):
294		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
295
296	case strings.EqualFold("ResourceConflictException", errorCode):
297		return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody)
298
299	case strings.EqualFold("ResourceNotFoundException", errorCode):
300		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
301
302	case strings.EqualFold("TooManyRequestsException", errorCode):
303		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
304
305	default:
306		genericError := &smithy.GenericAPIError{
307			Code:    errorCode,
308			Message: errorMessage,
309		}
310		return genericError
311
312	}
313}
314
315func awsRestjson1_deserializeOpDocumentDeleteDatasetOutput(v **DeleteDatasetOutput, value interface{}) error {
316	if v == nil {
317		return fmt.Errorf("unexpected nil of type %T", v)
318	}
319	if value == nil {
320		return nil
321	}
322
323	shape, ok := value.(map[string]interface{})
324	if !ok {
325		return fmt.Errorf("unexpected JSON type %v", value)
326	}
327
328	var sv *DeleteDatasetOutput
329	if *v == nil {
330		sv = &DeleteDatasetOutput{}
331	} else {
332		sv = *v
333	}
334
335	for key, value := range shape {
336		switch key {
337		case "Dataset":
338			if err := awsRestjson1_deserializeDocumentDataset(&sv.Dataset, value); err != nil {
339				return err
340			}
341
342		default:
343			_, _ = key, value
344
345		}
346	}
347	*v = sv
348	return nil
349}
350
351type awsRestjson1_deserializeOpDescribeDataset struct {
352}
353
354func (*awsRestjson1_deserializeOpDescribeDataset) ID() string {
355	return "OperationDeserializer"
356}
357
358func (m *awsRestjson1_deserializeOpDescribeDataset) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
359	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
360) {
361	out, metadata, err = next.HandleDeserialize(ctx, in)
362	if err != nil {
363		return out, metadata, err
364	}
365
366	response, ok := out.RawResponse.(*smithyhttp.Response)
367	if !ok {
368		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
369	}
370
371	if response.StatusCode < 200 || response.StatusCode >= 300 {
372		return out, metadata, awsRestjson1_deserializeOpErrorDescribeDataset(response, &metadata)
373	}
374	output := &DescribeDatasetOutput{}
375	out.Result = output
376
377	var buff [1024]byte
378	ringBuffer := smithyio.NewRingBuffer(buff[:])
379
380	body := io.TeeReader(response.Body, ringBuffer)
381
382	decoder := json.NewDecoder(body)
383	decoder.UseNumber()
384	var shape interface{}
385	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
386		var snapshot bytes.Buffer
387		io.Copy(&snapshot, ringBuffer)
388		err = &smithy.DeserializationError{
389			Err:      fmt.Errorf("failed to decode response body, %w", err),
390			Snapshot: snapshot.Bytes(),
391		}
392		return out, metadata, err
393	}
394
395	err = awsRestjson1_deserializeOpDocumentDescribeDatasetOutput(&output, shape)
396	if err != nil {
397		var snapshot bytes.Buffer
398		io.Copy(&snapshot, ringBuffer)
399		return out, metadata, &smithy.DeserializationError{
400			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
401			Snapshot: snapshot.Bytes(),
402		}
403	}
404
405	return out, metadata, err
406}
407
408func awsRestjson1_deserializeOpErrorDescribeDataset(response *smithyhttp.Response, metadata *middleware.Metadata) error {
409	var errorBuffer bytes.Buffer
410	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
411		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
412	}
413	errorBody := bytes.NewReader(errorBuffer.Bytes())
414
415	errorCode := "UnknownError"
416	errorMessage := errorCode
417
418	code := response.Header.Get("X-Amzn-ErrorType")
419	if len(code) != 0 {
420		errorCode = restjson.SanitizeErrorCode(code)
421	}
422
423	var buff [1024]byte
424	ringBuffer := smithyio.NewRingBuffer(buff[:])
425
426	body := io.TeeReader(errorBody, ringBuffer)
427	decoder := json.NewDecoder(body)
428	decoder.UseNumber()
429	code, message, err := restjson.GetErrorInfo(decoder)
430	if err != nil {
431		var snapshot bytes.Buffer
432		io.Copy(&snapshot, ringBuffer)
433		err = &smithy.DeserializationError{
434			Err:      fmt.Errorf("failed to decode response body, %w", err),
435			Snapshot: snapshot.Bytes(),
436		}
437		return err
438	}
439
440	errorBody.Seek(0, io.SeekStart)
441	if len(code) != 0 {
442		errorCode = restjson.SanitizeErrorCode(code)
443	}
444	if len(message) != 0 {
445		errorMessage = message
446	}
447
448	switch {
449	case strings.EqualFold("InternalErrorException", errorCode):
450		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
451
452	case strings.EqualFold("InvalidParameterException", errorCode):
453		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
454
455	case strings.EqualFold("NotAuthorizedException", errorCode):
456		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
457
458	case strings.EqualFold("ResourceNotFoundException", errorCode):
459		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
460
461	case strings.EqualFold("TooManyRequestsException", errorCode):
462		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
463
464	default:
465		genericError := &smithy.GenericAPIError{
466			Code:    errorCode,
467			Message: errorMessage,
468		}
469		return genericError
470
471	}
472}
473
474func awsRestjson1_deserializeOpDocumentDescribeDatasetOutput(v **DescribeDatasetOutput, value interface{}) error {
475	if v == nil {
476		return fmt.Errorf("unexpected nil of type %T", v)
477	}
478	if value == nil {
479		return nil
480	}
481
482	shape, ok := value.(map[string]interface{})
483	if !ok {
484		return fmt.Errorf("unexpected JSON type %v", value)
485	}
486
487	var sv *DescribeDatasetOutput
488	if *v == nil {
489		sv = &DescribeDatasetOutput{}
490	} else {
491		sv = *v
492	}
493
494	for key, value := range shape {
495		switch key {
496		case "Dataset":
497			if err := awsRestjson1_deserializeDocumentDataset(&sv.Dataset, value); err != nil {
498				return err
499			}
500
501		default:
502			_, _ = key, value
503
504		}
505	}
506	*v = sv
507	return nil
508}
509
510type awsRestjson1_deserializeOpDescribeIdentityPoolUsage struct {
511}
512
513func (*awsRestjson1_deserializeOpDescribeIdentityPoolUsage) ID() string {
514	return "OperationDeserializer"
515}
516
517func (m *awsRestjson1_deserializeOpDescribeIdentityPoolUsage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
518	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
519) {
520	out, metadata, err = next.HandleDeserialize(ctx, in)
521	if err != nil {
522		return out, metadata, err
523	}
524
525	response, ok := out.RawResponse.(*smithyhttp.Response)
526	if !ok {
527		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
528	}
529
530	if response.StatusCode < 200 || response.StatusCode >= 300 {
531		return out, metadata, awsRestjson1_deserializeOpErrorDescribeIdentityPoolUsage(response, &metadata)
532	}
533	output := &DescribeIdentityPoolUsageOutput{}
534	out.Result = output
535
536	var buff [1024]byte
537	ringBuffer := smithyio.NewRingBuffer(buff[:])
538
539	body := io.TeeReader(response.Body, ringBuffer)
540
541	decoder := json.NewDecoder(body)
542	decoder.UseNumber()
543	var shape interface{}
544	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
545		var snapshot bytes.Buffer
546		io.Copy(&snapshot, ringBuffer)
547		err = &smithy.DeserializationError{
548			Err:      fmt.Errorf("failed to decode response body, %w", err),
549			Snapshot: snapshot.Bytes(),
550		}
551		return out, metadata, err
552	}
553
554	err = awsRestjson1_deserializeOpDocumentDescribeIdentityPoolUsageOutput(&output, shape)
555	if err != nil {
556		var snapshot bytes.Buffer
557		io.Copy(&snapshot, ringBuffer)
558		return out, metadata, &smithy.DeserializationError{
559			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
560			Snapshot: snapshot.Bytes(),
561		}
562	}
563
564	return out, metadata, err
565}
566
567func awsRestjson1_deserializeOpErrorDescribeIdentityPoolUsage(response *smithyhttp.Response, metadata *middleware.Metadata) error {
568	var errorBuffer bytes.Buffer
569	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
570		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
571	}
572	errorBody := bytes.NewReader(errorBuffer.Bytes())
573
574	errorCode := "UnknownError"
575	errorMessage := errorCode
576
577	code := response.Header.Get("X-Amzn-ErrorType")
578	if len(code) != 0 {
579		errorCode = restjson.SanitizeErrorCode(code)
580	}
581
582	var buff [1024]byte
583	ringBuffer := smithyio.NewRingBuffer(buff[:])
584
585	body := io.TeeReader(errorBody, ringBuffer)
586	decoder := json.NewDecoder(body)
587	decoder.UseNumber()
588	code, message, err := restjson.GetErrorInfo(decoder)
589	if err != nil {
590		var snapshot bytes.Buffer
591		io.Copy(&snapshot, ringBuffer)
592		err = &smithy.DeserializationError{
593			Err:      fmt.Errorf("failed to decode response body, %w", err),
594			Snapshot: snapshot.Bytes(),
595		}
596		return err
597	}
598
599	errorBody.Seek(0, io.SeekStart)
600	if len(code) != 0 {
601		errorCode = restjson.SanitizeErrorCode(code)
602	}
603	if len(message) != 0 {
604		errorMessage = message
605	}
606
607	switch {
608	case strings.EqualFold("InternalErrorException", errorCode):
609		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
610
611	case strings.EqualFold("InvalidParameterException", errorCode):
612		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
613
614	case strings.EqualFold("NotAuthorizedException", errorCode):
615		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
616
617	case strings.EqualFold("ResourceNotFoundException", errorCode):
618		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
619
620	case strings.EqualFold("TooManyRequestsException", errorCode):
621		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
622
623	default:
624		genericError := &smithy.GenericAPIError{
625			Code:    errorCode,
626			Message: errorMessage,
627		}
628		return genericError
629
630	}
631}
632
633func awsRestjson1_deserializeOpDocumentDescribeIdentityPoolUsageOutput(v **DescribeIdentityPoolUsageOutput, value interface{}) error {
634	if v == nil {
635		return fmt.Errorf("unexpected nil of type %T", v)
636	}
637	if value == nil {
638		return nil
639	}
640
641	shape, ok := value.(map[string]interface{})
642	if !ok {
643		return fmt.Errorf("unexpected JSON type %v", value)
644	}
645
646	var sv *DescribeIdentityPoolUsageOutput
647	if *v == nil {
648		sv = &DescribeIdentityPoolUsageOutput{}
649	} else {
650		sv = *v
651	}
652
653	for key, value := range shape {
654		switch key {
655		case "IdentityPoolUsage":
656			if err := awsRestjson1_deserializeDocumentIdentityPoolUsage(&sv.IdentityPoolUsage, value); err != nil {
657				return err
658			}
659
660		default:
661			_, _ = key, value
662
663		}
664	}
665	*v = sv
666	return nil
667}
668
669type awsRestjson1_deserializeOpDescribeIdentityUsage struct {
670}
671
672func (*awsRestjson1_deserializeOpDescribeIdentityUsage) ID() string {
673	return "OperationDeserializer"
674}
675
676func (m *awsRestjson1_deserializeOpDescribeIdentityUsage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
677	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
678) {
679	out, metadata, err = next.HandleDeserialize(ctx, in)
680	if err != nil {
681		return out, metadata, err
682	}
683
684	response, ok := out.RawResponse.(*smithyhttp.Response)
685	if !ok {
686		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
687	}
688
689	if response.StatusCode < 200 || response.StatusCode >= 300 {
690		return out, metadata, awsRestjson1_deserializeOpErrorDescribeIdentityUsage(response, &metadata)
691	}
692	output := &DescribeIdentityUsageOutput{}
693	out.Result = output
694
695	var buff [1024]byte
696	ringBuffer := smithyio.NewRingBuffer(buff[:])
697
698	body := io.TeeReader(response.Body, ringBuffer)
699
700	decoder := json.NewDecoder(body)
701	decoder.UseNumber()
702	var shape interface{}
703	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
704		var snapshot bytes.Buffer
705		io.Copy(&snapshot, ringBuffer)
706		err = &smithy.DeserializationError{
707			Err:      fmt.Errorf("failed to decode response body, %w", err),
708			Snapshot: snapshot.Bytes(),
709		}
710		return out, metadata, err
711	}
712
713	err = awsRestjson1_deserializeOpDocumentDescribeIdentityUsageOutput(&output, shape)
714	if err != nil {
715		var snapshot bytes.Buffer
716		io.Copy(&snapshot, ringBuffer)
717		return out, metadata, &smithy.DeserializationError{
718			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
719			Snapshot: snapshot.Bytes(),
720		}
721	}
722
723	return out, metadata, err
724}
725
726func awsRestjson1_deserializeOpErrorDescribeIdentityUsage(response *smithyhttp.Response, metadata *middleware.Metadata) error {
727	var errorBuffer bytes.Buffer
728	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
729		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
730	}
731	errorBody := bytes.NewReader(errorBuffer.Bytes())
732
733	errorCode := "UnknownError"
734	errorMessage := errorCode
735
736	code := response.Header.Get("X-Amzn-ErrorType")
737	if len(code) != 0 {
738		errorCode = restjson.SanitizeErrorCode(code)
739	}
740
741	var buff [1024]byte
742	ringBuffer := smithyio.NewRingBuffer(buff[:])
743
744	body := io.TeeReader(errorBody, ringBuffer)
745	decoder := json.NewDecoder(body)
746	decoder.UseNumber()
747	code, message, err := restjson.GetErrorInfo(decoder)
748	if err != nil {
749		var snapshot bytes.Buffer
750		io.Copy(&snapshot, ringBuffer)
751		err = &smithy.DeserializationError{
752			Err:      fmt.Errorf("failed to decode response body, %w", err),
753			Snapshot: snapshot.Bytes(),
754		}
755		return err
756	}
757
758	errorBody.Seek(0, io.SeekStart)
759	if len(code) != 0 {
760		errorCode = restjson.SanitizeErrorCode(code)
761	}
762	if len(message) != 0 {
763		errorMessage = message
764	}
765
766	switch {
767	case strings.EqualFold("InternalErrorException", errorCode):
768		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
769
770	case strings.EqualFold("InvalidParameterException", errorCode):
771		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
772
773	case strings.EqualFold("NotAuthorizedException", errorCode):
774		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
775
776	case strings.EqualFold("ResourceNotFoundException", errorCode):
777		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
778
779	case strings.EqualFold("TooManyRequestsException", errorCode):
780		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
781
782	default:
783		genericError := &smithy.GenericAPIError{
784			Code:    errorCode,
785			Message: errorMessage,
786		}
787		return genericError
788
789	}
790}
791
792func awsRestjson1_deserializeOpDocumentDescribeIdentityUsageOutput(v **DescribeIdentityUsageOutput, value interface{}) error {
793	if v == nil {
794		return fmt.Errorf("unexpected nil of type %T", v)
795	}
796	if value == nil {
797		return nil
798	}
799
800	shape, ok := value.(map[string]interface{})
801	if !ok {
802		return fmt.Errorf("unexpected JSON type %v", value)
803	}
804
805	var sv *DescribeIdentityUsageOutput
806	if *v == nil {
807		sv = &DescribeIdentityUsageOutput{}
808	} else {
809		sv = *v
810	}
811
812	for key, value := range shape {
813		switch key {
814		case "IdentityUsage":
815			if err := awsRestjson1_deserializeDocumentIdentityUsage(&sv.IdentityUsage, value); err != nil {
816				return err
817			}
818
819		default:
820			_, _ = key, value
821
822		}
823	}
824	*v = sv
825	return nil
826}
827
828type awsRestjson1_deserializeOpGetBulkPublishDetails struct {
829}
830
831func (*awsRestjson1_deserializeOpGetBulkPublishDetails) ID() string {
832	return "OperationDeserializer"
833}
834
835func (m *awsRestjson1_deserializeOpGetBulkPublishDetails) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
836	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
837) {
838	out, metadata, err = next.HandleDeserialize(ctx, in)
839	if err != nil {
840		return out, metadata, err
841	}
842
843	response, ok := out.RawResponse.(*smithyhttp.Response)
844	if !ok {
845		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
846	}
847
848	if response.StatusCode < 200 || response.StatusCode >= 300 {
849		return out, metadata, awsRestjson1_deserializeOpErrorGetBulkPublishDetails(response, &metadata)
850	}
851	output := &GetBulkPublishDetailsOutput{}
852	out.Result = output
853
854	var buff [1024]byte
855	ringBuffer := smithyio.NewRingBuffer(buff[:])
856
857	body := io.TeeReader(response.Body, ringBuffer)
858
859	decoder := json.NewDecoder(body)
860	decoder.UseNumber()
861	var shape interface{}
862	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
863		var snapshot bytes.Buffer
864		io.Copy(&snapshot, ringBuffer)
865		err = &smithy.DeserializationError{
866			Err:      fmt.Errorf("failed to decode response body, %w", err),
867			Snapshot: snapshot.Bytes(),
868		}
869		return out, metadata, err
870	}
871
872	err = awsRestjson1_deserializeOpDocumentGetBulkPublishDetailsOutput(&output, shape)
873	if err != nil {
874		var snapshot bytes.Buffer
875		io.Copy(&snapshot, ringBuffer)
876		return out, metadata, &smithy.DeserializationError{
877			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
878			Snapshot: snapshot.Bytes(),
879		}
880	}
881
882	return out, metadata, err
883}
884
885func awsRestjson1_deserializeOpErrorGetBulkPublishDetails(response *smithyhttp.Response, metadata *middleware.Metadata) error {
886	var errorBuffer bytes.Buffer
887	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
888		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
889	}
890	errorBody := bytes.NewReader(errorBuffer.Bytes())
891
892	errorCode := "UnknownError"
893	errorMessage := errorCode
894
895	code := response.Header.Get("X-Amzn-ErrorType")
896	if len(code) != 0 {
897		errorCode = restjson.SanitizeErrorCode(code)
898	}
899
900	var buff [1024]byte
901	ringBuffer := smithyio.NewRingBuffer(buff[:])
902
903	body := io.TeeReader(errorBody, ringBuffer)
904	decoder := json.NewDecoder(body)
905	decoder.UseNumber()
906	code, message, err := restjson.GetErrorInfo(decoder)
907	if err != nil {
908		var snapshot bytes.Buffer
909		io.Copy(&snapshot, ringBuffer)
910		err = &smithy.DeserializationError{
911			Err:      fmt.Errorf("failed to decode response body, %w", err),
912			Snapshot: snapshot.Bytes(),
913		}
914		return err
915	}
916
917	errorBody.Seek(0, io.SeekStart)
918	if len(code) != 0 {
919		errorCode = restjson.SanitizeErrorCode(code)
920	}
921	if len(message) != 0 {
922		errorMessage = message
923	}
924
925	switch {
926	case strings.EqualFold("InternalErrorException", errorCode):
927		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
928
929	case strings.EqualFold("InvalidParameterException", errorCode):
930		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
931
932	case strings.EqualFold("NotAuthorizedException", errorCode):
933		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
934
935	case strings.EqualFold("ResourceNotFoundException", errorCode):
936		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
937
938	default:
939		genericError := &smithy.GenericAPIError{
940			Code:    errorCode,
941			Message: errorMessage,
942		}
943		return genericError
944
945	}
946}
947
948func awsRestjson1_deserializeOpDocumentGetBulkPublishDetailsOutput(v **GetBulkPublishDetailsOutput, value interface{}) error {
949	if v == nil {
950		return fmt.Errorf("unexpected nil of type %T", v)
951	}
952	if value == nil {
953		return nil
954	}
955
956	shape, ok := value.(map[string]interface{})
957	if !ok {
958		return fmt.Errorf("unexpected JSON type %v", value)
959	}
960
961	var sv *GetBulkPublishDetailsOutput
962	if *v == nil {
963		sv = &GetBulkPublishDetailsOutput{}
964	} else {
965		sv = *v
966	}
967
968	for key, value := range shape {
969		switch key {
970		case "BulkPublishCompleteTime":
971			if value != nil {
972				jtv, ok := value.(json.Number)
973				if !ok {
974					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
975				}
976				f64, err := jtv.Float64()
977				if err != nil {
978					return err
979				}
980				sv.BulkPublishCompleteTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
981			}
982
983		case "BulkPublishStartTime":
984			if value != nil {
985				jtv, ok := value.(json.Number)
986				if !ok {
987					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
988				}
989				f64, err := jtv.Float64()
990				if err != nil {
991					return err
992				}
993				sv.BulkPublishStartTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
994			}
995
996		case "BulkPublishStatus":
997			if value != nil {
998				jtv, ok := value.(string)
999				if !ok {
1000					return fmt.Errorf("expected BulkPublishStatus to be of type string, got %T instead", value)
1001				}
1002				sv.BulkPublishStatus = types.BulkPublishStatus(jtv)
1003			}
1004
1005		case "FailureMessage":
1006			if value != nil {
1007				jtv, ok := value.(string)
1008				if !ok {
1009					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1010				}
1011				sv.FailureMessage = ptr.String(jtv)
1012			}
1013
1014		case "IdentityPoolId":
1015			if value != nil {
1016				jtv, ok := value.(string)
1017				if !ok {
1018					return fmt.Errorf("expected IdentityPoolId to be of type string, got %T instead", value)
1019				}
1020				sv.IdentityPoolId = ptr.String(jtv)
1021			}
1022
1023		default:
1024			_, _ = key, value
1025
1026		}
1027	}
1028	*v = sv
1029	return nil
1030}
1031
1032type awsRestjson1_deserializeOpGetCognitoEvents struct {
1033}
1034
1035func (*awsRestjson1_deserializeOpGetCognitoEvents) ID() string {
1036	return "OperationDeserializer"
1037}
1038
1039func (m *awsRestjson1_deserializeOpGetCognitoEvents) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1040	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1041) {
1042	out, metadata, err = next.HandleDeserialize(ctx, in)
1043	if err != nil {
1044		return out, metadata, err
1045	}
1046
1047	response, ok := out.RawResponse.(*smithyhttp.Response)
1048	if !ok {
1049		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1050	}
1051
1052	if response.StatusCode < 200 || response.StatusCode >= 300 {
1053		return out, metadata, awsRestjson1_deserializeOpErrorGetCognitoEvents(response, &metadata)
1054	}
1055	output := &GetCognitoEventsOutput{}
1056	out.Result = output
1057
1058	var buff [1024]byte
1059	ringBuffer := smithyio.NewRingBuffer(buff[:])
1060
1061	body := io.TeeReader(response.Body, ringBuffer)
1062
1063	decoder := json.NewDecoder(body)
1064	decoder.UseNumber()
1065	var shape interface{}
1066	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1067		var snapshot bytes.Buffer
1068		io.Copy(&snapshot, ringBuffer)
1069		err = &smithy.DeserializationError{
1070			Err:      fmt.Errorf("failed to decode response body, %w", err),
1071			Snapshot: snapshot.Bytes(),
1072		}
1073		return out, metadata, err
1074	}
1075
1076	err = awsRestjson1_deserializeOpDocumentGetCognitoEventsOutput(&output, shape)
1077	if err != nil {
1078		var snapshot bytes.Buffer
1079		io.Copy(&snapshot, ringBuffer)
1080		return out, metadata, &smithy.DeserializationError{
1081			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
1082			Snapshot: snapshot.Bytes(),
1083		}
1084	}
1085
1086	return out, metadata, err
1087}
1088
1089func awsRestjson1_deserializeOpErrorGetCognitoEvents(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1090	var errorBuffer bytes.Buffer
1091	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1092		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1093	}
1094	errorBody := bytes.NewReader(errorBuffer.Bytes())
1095
1096	errorCode := "UnknownError"
1097	errorMessage := errorCode
1098
1099	code := response.Header.Get("X-Amzn-ErrorType")
1100	if len(code) != 0 {
1101		errorCode = restjson.SanitizeErrorCode(code)
1102	}
1103
1104	var buff [1024]byte
1105	ringBuffer := smithyio.NewRingBuffer(buff[:])
1106
1107	body := io.TeeReader(errorBody, ringBuffer)
1108	decoder := json.NewDecoder(body)
1109	decoder.UseNumber()
1110	code, message, err := restjson.GetErrorInfo(decoder)
1111	if err != nil {
1112		var snapshot bytes.Buffer
1113		io.Copy(&snapshot, ringBuffer)
1114		err = &smithy.DeserializationError{
1115			Err:      fmt.Errorf("failed to decode response body, %w", err),
1116			Snapshot: snapshot.Bytes(),
1117		}
1118		return err
1119	}
1120
1121	errorBody.Seek(0, io.SeekStart)
1122	if len(code) != 0 {
1123		errorCode = restjson.SanitizeErrorCode(code)
1124	}
1125	if len(message) != 0 {
1126		errorMessage = message
1127	}
1128
1129	switch {
1130	case strings.EqualFold("InternalErrorException", errorCode):
1131		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
1132
1133	case strings.EqualFold("InvalidParameterException", errorCode):
1134		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
1135
1136	case strings.EqualFold("NotAuthorizedException", errorCode):
1137		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
1138
1139	case strings.EqualFold("ResourceNotFoundException", errorCode):
1140		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
1141
1142	case strings.EqualFold("TooManyRequestsException", errorCode):
1143		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
1144
1145	default:
1146		genericError := &smithy.GenericAPIError{
1147			Code:    errorCode,
1148			Message: errorMessage,
1149		}
1150		return genericError
1151
1152	}
1153}
1154
1155func awsRestjson1_deserializeOpDocumentGetCognitoEventsOutput(v **GetCognitoEventsOutput, value interface{}) error {
1156	if v == nil {
1157		return fmt.Errorf("unexpected nil of type %T", v)
1158	}
1159	if value == nil {
1160		return nil
1161	}
1162
1163	shape, ok := value.(map[string]interface{})
1164	if !ok {
1165		return fmt.Errorf("unexpected JSON type %v", value)
1166	}
1167
1168	var sv *GetCognitoEventsOutput
1169	if *v == nil {
1170		sv = &GetCognitoEventsOutput{}
1171	} else {
1172		sv = *v
1173	}
1174
1175	for key, value := range shape {
1176		switch key {
1177		case "Events":
1178			if err := awsRestjson1_deserializeDocumentEvents(&sv.Events, value); err != nil {
1179				return err
1180			}
1181
1182		default:
1183			_, _ = key, value
1184
1185		}
1186	}
1187	*v = sv
1188	return nil
1189}
1190
1191type awsRestjson1_deserializeOpGetIdentityPoolConfiguration struct {
1192}
1193
1194func (*awsRestjson1_deserializeOpGetIdentityPoolConfiguration) ID() string {
1195	return "OperationDeserializer"
1196}
1197
1198func (m *awsRestjson1_deserializeOpGetIdentityPoolConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1199	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1200) {
1201	out, metadata, err = next.HandleDeserialize(ctx, in)
1202	if err != nil {
1203		return out, metadata, err
1204	}
1205
1206	response, ok := out.RawResponse.(*smithyhttp.Response)
1207	if !ok {
1208		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1209	}
1210
1211	if response.StatusCode < 200 || response.StatusCode >= 300 {
1212		return out, metadata, awsRestjson1_deserializeOpErrorGetIdentityPoolConfiguration(response, &metadata)
1213	}
1214	output := &GetIdentityPoolConfigurationOutput{}
1215	out.Result = output
1216
1217	var buff [1024]byte
1218	ringBuffer := smithyio.NewRingBuffer(buff[:])
1219
1220	body := io.TeeReader(response.Body, ringBuffer)
1221
1222	decoder := json.NewDecoder(body)
1223	decoder.UseNumber()
1224	var shape interface{}
1225	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1226		var snapshot bytes.Buffer
1227		io.Copy(&snapshot, ringBuffer)
1228		err = &smithy.DeserializationError{
1229			Err:      fmt.Errorf("failed to decode response body, %w", err),
1230			Snapshot: snapshot.Bytes(),
1231		}
1232		return out, metadata, err
1233	}
1234
1235	err = awsRestjson1_deserializeOpDocumentGetIdentityPoolConfigurationOutput(&output, shape)
1236	if err != nil {
1237		var snapshot bytes.Buffer
1238		io.Copy(&snapshot, ringBuffer)
1239		return out, metadata, &smithy.DeserializationError{
1240			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
1241			Snapshot: snapshot.Bytes(),
1242		}
1243	}
1244
1245	return out, metadata, err
1246}
1247
1248func awsRestjson1_deserializeOpErrorGetIdentityPoolConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1249	var errorBuffer bytes.Buffer
1250	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1251		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1252	}
1253	errorBody := bytes.NewReader(errorBuffer.Bytes())
1254
1255	errorCode := "UnknownError"
1256	errorMessage := errorCode
1257
1258	code := response.Header.Get("X-Amzn-ErrorType")
1259	if len(code) != 0 {
1260		errorCode = restjson.SanitizeErrorCode(code)
1261	}
1262
1263	var buff [1024]byte
1264	ringBuffer := smithyio.NewRingBuffer(buff[:])
1265
1266	body := io.TeeReader(errorBody, ringBuffer)
1267	decoder := json.NewDecoder(body)
1268	decoder.UseNumber()
1269	code, message, err := restjson.GetErrorInfo(decoder)
1270	if err != nil {
1271		var snapshot bytes.Buffer
1272		io.Copy(&snapshot, ringBuffer)
1273		err = &smithy.DeserializationError{
1274			Err:      fmt.Errorf("failed to decode response body, %w", err),
1275			Snapshot: snapshot.Bytes(),
1276		}
1277		return err
1278	}
1279
1280	errorBody.Seek(0, io.SeekStart)
1281	if len(code) != 0 {
1282		errorCode = restjson.SanitizeErrorCode(code)
1283	}
1284	if len(message) != 0 {
1285		errorMessage = message
1286	}
1287
1288	switch {
1289	case strings.EqualFold("InternalErrorException", errorCode):
1290		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
1291
1292	case strings.EqualFold("InvalidParameterException", errorCode):
1293		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
1294
1295	case strings.EqualFold("NotAuthorizedException", errorCode):
1296		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
1297
1298	case strings.EqualFold("ResourceNotFoundException", errorCode):
1299		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
1300
1301	case strings.EqualFold("TooManyRequestsException", errorCode):
1302		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
1303
1304	default:
1305		genericError := &smithy.GenericAPIError{
1306			Code:    errorCode,
1307			Message: errorMessage,
1308		}
1309		return genericError
1310
1311	}
1312}
1313
1314func awsRestjson1_deserializeOpDocumentGetIdentityPoolConfigurationOutput(v **GetIdentityPoolConfigurationOutput, value interface{}) error {
1315	if v == nil {
1316		return fmt.Errorf("unexpected nil of type %T", v)
1317	}
1318	if value == nil {
1319		return nil
1320	}
1321
1322	shape, ok := value.(map[string]interface{})
1323	if !ok {
1324		return fmt.Errorf("unexpected JSON type %v", value)
1325	}
1326
1327	var sv *GetIdentityPoolConfigurationOutput
1328	if *v == nil {
1329		sv = &GetIdentityPoolConfigurationOutput{}
1330	} else {
1331		sv = *v
1332	}
1333
1334	for key, value := range shape {
1335		switch key {
1336		case "CognitoStreams":
1337			if err := awsRestjson1_deserializeDocumentCognitoStreams(&sv.CognitoStreams, value); err != nil {
1338				return err
1339			}
1340
1341		case "IdentityPoolId":
1342			if value != nil {
1343				jtv, ok := value.(string)
1344				if !ok {
1345					return fmt.Errorf("expected IdentityPoolId to be of type string, got %T instead", value)
1346				}
1347				sv.IdentityPoolId = ptr.String(jtv)
1348			}
1349
1350		case "PushSync":
1351			if err := awsRestjson1_deserializeDocumentPushSync(&sv.PushSync, value); err != nil {
1352				return err
1353			}
1354
1355		default:
1356			_, _ = key, value
1357
1358		}
1359	}
1360	*v = sv
1361	return nil
1362}
1363
1364type awsRestjson1_deserializeOpListDatasets struct {
1365}
1366
1367func (*awsRestjson1_deserializeOpListDatasets) ID() string {
1368	return "OperationDeserializer"
1369}
1370
1371func (m *awsRestjson1_deserializeOpListDatasets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1372	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1373) {
1374	out, metadata, err = next.HandleDeserialize(ctx, in)
1375	if err != nil {
1376		return out, metadata, err
1377	}
1378
1379	response, ok := out.RawResponse.(*smithyhttp.Response)
1380	if !ok {
1381		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1382	}
1383
1384	if response.StatusCode < 200 || response.StatusCode >= 300 {
1385		return out, metadata, awsRestjson1_deserializeOpErrorListDatasets(response, &metadata)
1386	}
1387	output := &ListDatasetsOutput{}
1388	out.Result = output
1389
1390	var buff [1024]byte
1391	ringBuffer := smithyio.NewRingBuffer(buff[:])
1392
1393	body := io.TeeReader(response.Body, ringBuffer)
1394
1395	decoder := json.NewDecoder(body)
1396	decoder.UseNumber()
1397	var shape interface{}
1398	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1399		var snapshot bytes.Buffer
1400		io.Copy(&snapshot, ringBuffer)
1401		err = &smithy.DeserializationError{
1402			Err:      fmt.Errorf("failed to decode response body, %w", err),
1403			Snapshot: snapshot.Bytes(),
1404		}
1405		return out, metadata, err
1406	}
1407
1408	err = awsRestjson1_deserializeOpDocumentListDatasetsOutput(&output, shape)
1409	if err != nil {
1410		var snapshot bytes.Buffer
1411		io.Copy(&snapshot, ringBuffer)
1412		return out, metadata, &smithy.DeserializationError{
1413			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
1414			Snapshot: snapshot.Bytes(),
1415		}
1416	}
1417
1418	return out, metadata, err
1419}
1420
1421func awsRestjson1_deserializeOpErrorListDatasets(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1422	var errorBuffer bytes.Buffer
1423	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1424		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1425	}
1426	errorBody := bytes.NewReader(errorBuffer.Bytes())
1427
1428	errorCode := "UnknownError"
1429	errorMessage := errorCode
1430
1431	code := response.Header.Get("X-Amzn-ErrorType")
1432	if len(code) != 0 {
1433		errorCode = restjson.SanitizeErrorCode(code)
1434	}
1435
1436	var buff [1024]byte
1437	ringBuffer := smithyio.NewRingBuffer(buff[:])
1438
1439	body := io.TeeReader(errorBody, ringBuffer)
1440	decoder := json.NewDecoder(body)
1441	decoder.UseNumber()
1442	code, message, err := restjson.GetErrorInfo(decoder)
1443	if err != nil {
1444		var snapshot bytes.Buffer
1445		io.Copy(&snapshot, ringBuffer)
1446		err = &smithy.DeserializationError{
1447			Err:      fmt.Errorf("failed to decode response body, %w", err),
1448			Snapshot: snapshot.Bytes(),
1449		}
1450		return err
1451	}
1452
1453	errorBody.Seek(0, io.SeekStart)
1454	if len(code) != 0 {
1455		errorCode = restjson.SanitizeErrorCode(code)
1456	}
1457	if len(message) != 0 {
1458		errorMessage = message
1459	}
1460
1461	switch {
1462	case strings.EqualFold("InternalErrorException", errorCode):
1463		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
1464
1465	case strings.EqualFold("InvalidParameterException", errorCode):
1466		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
1467
1468	case strings.EqualFold("NotAuthorizedException", errorCode):
1469		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
1470
1471	case strings.EqualFold("TooManyRequestsException", errorCode):
1472		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
1473
1474	default:
1475		genericError := &smithy.GenericAPIError{
1476			Code:    errorCode,
1477			Message: errorMessage,
1478		}
1479		return genericError
1480
1481	}
1482}
1483
1484func awsRestjson1_deserializeOpDocumentListDatasetsOutput(v **ListDatasetsOutput, value interface{}) error {
1485	if v == nil {
1486		return fmt.Errorf("unexpected nil of type %T", v)
1487	}
1488	if value == nil {
1489		return nil
1490	}
1491
1492	shape, ok := value.(map[string]interface{})
1493	if !ok {
1494		return fmt.Errorf("unexpected JSON type %v", value)
1495	}
1496
1497	var sv *ListDatasetsOutput
1498	if *v == nil {
1499		sv = &ListDatasetsOutput{}
1500	} else {
1501		sv = *v
1502	}
1503
1504	for key, value := range shape {
1505		switch key {
1506		case "Count":
1507			if value != nil {
1508				jtv, ok := value.(json.Number)
1509				if !ok {
1510					return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
1511				}
1512				i64, err := jtv.Int64()
1513				if err != nil {
1514					return err
1515				}
1516				sv.Count = int32(i64)
1517			}
1518
1519		case "Datasets":
1520			if err := awsRestjson1_deserializeDocumentDatasetList(&sv.Datasets, value); err != nil {
1521				return err
1522			}
1523
1524		case "NextToken":
1525			if value != nil {
1526				jtv, ok := value.(string)
1527				if !ok {
1528					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1529				}
1530				sv.NextToken = ptr.String(jtv)
1531			}
1532
1533		default:
1534			_, _ = key, value
1535
1536		}
1537	}
1538	*v = sv
1539	return nil
1540}
1541
1542type awsRestjson1_deserializeOpListIdentityPoolUsage struct {
1543}
1544
1545func (*awsRestjson1_deserializeOpListIdentityPoolUsage) ID() string {
1546	return "OperationDeserializer"
1547}
1548
1549func (m *awsRestjson1_deserializeOpListIdentityPoolUsage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1550	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1551) {
1552	out, metadata, err = next.HandleDeserialize(ctx, in)
1553	if err != nil {
1554		return out, metadata, err
1555	}
1556
1557	response, ok := out.RawResponse.(*smithyhttp.Response)
1558	if !ok {
1559		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1560	}
1561
1562	if response.StatusCode < 200 || response.StatusCode >= 300 {
1563		return out, metadata, awsRestjson1_deserializeOpErrorListIdentityPoolUsage(response, &metadata)
1564	}
1565	output := &ListIdentityPoolUsageOutput{}
1566	out.Result = output
1567
1568	var buff [1024]byte
1569	ringBuffer := smithyio.NewRingBuffer(buff[:])
1570
1571	body := io.TeeReader(response.Body, ringBuffer)
1572
1573	decoder := json.NewDecoder(body)
1574	decoder.UseNumber()
1575	var shape interface{}
1576	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1577		var snapshot bytes.Buffer
1578		io.Copy(&snapshot, ringBuffer)
1579		err = &smithy.DeserializationError{
1580			Err:      fmt.Errorf("failed to decode response body, %w", err),
1581			Snapshot: snapshot.Bytes(),
1582		}
1583		return out, metadata, err
1584	}
1585
1586	err = awsRestjson1_deserializeOpDocumentListIdentityPoolUsageOutput(&output, shape)
1587	if err != nil {
1588		var snapshot bytes.Buffer
1589		io.Copy(&snapshot, ringBuffer)
1590		return out, metadata, &smithy.DeserializationError{
1591			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
1592			Snapshot: snapshot.Bytes(),
1593		}
1594	}
1595
1596	return out, metadata, err
1597}
1598
1599func awsRestjson1_deserializeOpErrorListIdentityPoolUsage(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1600	var errorBuffer bytes.Buffer
1601	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1602		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1603	}
1604	errorBody := bytes.NewReader(errorBuffer.Bytes())
1605
1606	errorCode := "UnknownError"
1607	errorMessage := errorCode
1608
1609	code := response.Header.Get("X-Amzn-ErrorType")
1610	if len(code) != 0 {
1611		errorCode = restjson.SanitizeErrorCode(code)
1612	}
1613
1614	var buff [1024]byte
1615	ringBuffer := smithyio.NewRingBuffer(buff[:])
1616
1617	body := io.TeeReader(errorBody, ringBuffer)
1618	decoder := json.NewDecoder(body)
1619	decoder.UseNumber()
1620	code, message, err := restjson.GetErrorInfo(decoder)
1621	if err != nil {
1622		var snapshot bytes.Buffer
1623		io.Copy(&snapshot, ringBuffer)
1624		err = &smithy.DeserializationError{
1625			Err:      fmt.Errorf("failed to decode response body, %w", err),
1626			Snapshot: snapshot.Bytes(),
1627		}
1628		return err
1629	}
1630
1631	errorBody.Seek(0, io.SeekStart)
1632	if len(code) != 0 {
1633		errorCode = restjson.SanitizeErrorCode(code)
1634	}
1635	if len(message) != 0 {
1636		errorMessage = message
1637	}
1638
1639	switch {
1640	case strings.EqualFold("InternalErrorException", errorCode):
1641		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
1642
1643	case strings.EqualFold("InvalidParameterException", errorCode):
1644		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
1645
1646	case strings.EqualFold("NotAuthorizedException", errorCode):
1647		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
1648
1649	case strings.EqualFold("TooManyRequestsException", errorCode):
1650		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
1651
1652	default:
1653		genericError := &smithy.GenericAPIError{
1654			Code:    errorCode,
1655			Message: errorMessage,
1656		}
1657		return genericError
1658
1659	}
1660}
1661
1662func awsRestjson1_deserializeOpDocumentListIdentityPoolUsageOutput(v **ListIdentityPoolUsageOutput, value interface{}) error {
1663	if v == nil {
1664		return fmt.Errorf("unexpected nil of type %T", v)
1665	}
1666	if value == nil {
1667		return nil
1668	}
1669
1670	shape, ok := value.(map[string]interface{})
1671	if !ok {
1672		return fmt.Errorf("unexpected JSON type %v", value)
1673	}
1674
1675	var sv *ListIdentityPoolUsageOutput
1676	if *v == nil {
1677		sv = &ListIdentityPoolUsageOutput{}
1678	} else {
1679		sv = *v
1680	}
1681
1682	for key, value := range shape {
1683		switch key {
1684		case "Count":
1685			if value != nil {
1686				jtv, ok := value.(json.Number)
1687				if !ok {
1688					return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
1689				}
1690				i64, err := jtv.Int64()
1691				if err != nil {
1692					return err
1693				}
1694				sv.Count = int32(i64)
1695			}
1696
1697		case "IdentityPoolUsages":
1698			if err := awsRestjson1_deserializeDocumentIdentityPoolUsageList(&sv.IdentityPoolUsages, value); err != nil {
1699				return err
1700			}
1701
1702		case "MaxResults":
1703			if value != nil {
1704				jtv, ok := value.(json.Number)
1705				if !ok {
1706					return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
1707				}
1708				i64, err := jtv.Int64()
1709				if err != nil {
1710					return err
1711				}
1712				sv.MaxResults = int32(i64)
1713			}
1714
1715		case "NextToken":
1716			if value != nil {
1717				jtv, ok := value.(string)
1718				if !ok {
1719					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1720				}
1721				sv.NextToken = ptr.String(jtv)
1722			}
1723
1724		default:
1725			_, _ = key, value
1726
1727		}
1728	}
1729	*v = sv
1730	return nil
1731}
1732
1733type awsRestjson1_deserializeOpListRecords struct {
1734}
1735
1736func (*awsRestjson1_deserializeOpListRecords) ID() string {
1737	return "OperationDeserializer"
1738}
1739
1740func (m *awsRestjson1_deserializeOpListRecords) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1741	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1742) {
1743	out, metadata, err = next.HandleDeserialize(ctx, in)
1744	if err != nil {
1745		return out, metadata, err
1746	}
1747
1748	response, ok := out.RawResponse.(*smithyhttp.Response)
1749	if !ok {
1750		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1751	}
1752
1753	if response.StatusCode < 200 || response.StatusCode >= 300 {
1754		return out, metadata, awsRestjson1_deserializeOpErrorListRecords(response, &metadata)
1755	}
1756	output := &ListRecordsOutput{}
1757	out.Result = output
1758
1759	var buff [1024]byte
1760	ringBuffer := smithyio.NewRingBuffer(buff[:])
1761
1762	body := io.TeeReader(response.Body, ringBuffer)
1763
1764	decoder := json.NewDecoder(body)
1765	decoder.UseNumber()
1766	var shape interface{}
1767	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1768		var snapshot bytes.Buffer
1769		io.Copy(&snapshot, ringBuffer)
1770		err = &smithy.DeserializationError{
1771			Err:      fmt.Errorf("failed to decode response body, %w", err),
1772			Snapshot: snapshot.Bytes(),
1773		}
1774		return out, metadata, err
1775	}
1776
1777	err = awsRestjson1_deserializeOpDocumentListRecordsOutput(&output, shape)
1778	if err != nil {
1779		var snapshot bytes.Buffer
1780		io.Copy(&snapshot, ringBuffer)
1781		return out, metadata, &smithy.DeserializationError{
1782			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
1783			Snapshot: snapshot.Bytes(),
1784		}
1785	}
1786
1787	return out, metadata, err
1788}
1789
1790func awsRestjson1_deserializeOpErrorListRecords(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1791	var errorBuffer bytes.Buffer
1792	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1793		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1794	}
1795	errorBody := bytes.NewReader(errorBuffer.Bytes())
1796
1797	errorCode := "UnknownError"
1798	errorMessage := errorCode
1799
1800	code := response.Header.Get("X-Amzn-ErrorType")
1801	if len(code) != 0 {
1802		errorCode = restjson.SanitizeErrorCode(code)
1803	}
1804
1805	var buff [1024]byte
1806	ringBuffer := smithyio.NewRingBuffer(buff[:])
1807
1808	body := io.TeeReader(errorBody, ringBuffer)
1809	decoder := json.NewDecoder(body)
1810	decoder.UseNumber()
1811	code, message, err := restjson.GetErrorInfo(decoder)
1812	if err != nil {
1813		var snapshot bytes.Buffer
1814		io.Copy(&snapshot, ringBuffer)
1815		err = &smithy.DeserializationError{
1816			Err:      fmt.Errorf("failed to decode response body, %w", err),
1817			Snapshot: snapshot.Bytes(),
1818		}
1819		return err
1820	}
1821
1822	errorBody.Seek(0, io.SeekStart)
1823	if len(code) != 0 {
1824		errorCode = restjson.SanitizeErrorCode(code)
1825	}
1826	if len(message) != 0 {
1827		errorMessage = message
1828	}
1829
1830	switch {
1831	case strings.EqualFold("InternalErrorException", errorCode):
1832		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
1833
1834	case strings.EqualFold("InvalidParameterException", errorCode):
1835		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
1836
1837	case strings.EqualFold("NotAuthorizedException", errorCode):
1838		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
1839
1840	case strings.EqualFold("TooManyRequestsException", errorCode):
1841		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
1842
1843	default:
1844		genericError := &smithy.GenericAPIError{
1845			Code:    errorCode,
1846			Message: errorMessage,
1847		}
1848		return genericError
1849
1850	}
1851}
1852
1853func awsRestjson1_deserializeOpDocumentListRecordsOutput(v **ListRecordsOutput, value interface{}) error {
1854	if v == nil {
1855		return fmt.Errorf("unexpected nil of type %T", v)
1856	}
1857	if value == nil {
1858		return nil
1859	}
1860
1861	shape, ok := value.(map[string]interface{})
1862	if !ok {
1863		return fmt.Errorf("unexpected JSON type %v", value)
1864	}
1865
1866	var sv *ListRecordsOutput
1867	if *v == nil {
1868		sv = &ListRecordsOutput{}
1869	} else {
1870		sv = *v
1871	}
1872
1873	for key, value := range shape {
1874		switch key {
1875		case "Count":
1876			if value != nil {
1877				jtv, ok := value.(json.Number)
1878				if !ok {
1879					return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
1880				}
1881				i64, err := jtv.Int64()
1882				if err != nil {
1883					return err
1884				}
1885				sv.Count = int32(i64)
1886			}
1887
1888		case "DatasetDeletedAfterRequestedSyncCount":
1889			if value != nil {
1890				jtv, ok := value.(bool)
1891				if !ok {
1892					return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
1893				}
1894				sv.DatasetDeletedAfterRequestedSyncCount = jtv
1895			}
1896
1897		case "DatasetExists":
1898			if value != nil {
1899				jtv, ok := value.(bool)
1900				if !ok {
1901					return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
1902				}
1903				sv.DatasetExists = jtv
1904			}
1905
1906		case "DatasetSyncCount":
1907			if value != nil {
1908				jtv, ok := value.(json.Number)
1909				if !ok {
1910					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
1911				}
1912				i64, err := jtv.Int64()
1913				if err != nil {
1914					return err
1915				}
1916				sv.DatasetSyncCount = ptr.Int64(i64)
1917			}
1918
1919		case "LastModifiedBy":
1920			if value != nil {
1921				jtv, ok := value.(string)
1922				if !ok {
1923					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1924				}
1925				sv.LastModifiedBy = ptr.String(jtv)
1926			}
1927
1928		case "MergedDatasetNames":
1929			if err := awsRestjson1_deserializeDocumentMergedDatasetNameList(&sv.MergedDatasetNames, value); err != nil {
1930				return err
1931			}
1932
1933		case "NextToken":
1934			if value != nil {
1935				jtv, ok := value.(string)
1936				if !ok {
1937					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1938				}
1939				sv.NextToken = ptr.String(jtv)
1940			}
1941
1942		case "Records":
1943			if err := awsRestjson1_deserializeDocumentRecordList(&sv.Records, value); err != nil {
1944				return err
1945			}
1946
1947		case "SyncSessionToken":
1948			if value != nil {
1949				jtv, ok := value.(string)
1950				if !ok {
1951					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1952				}
1953				sv.SyncSessionToken = ptr.String(jtv)
1954			}
1955
1956		default:
1957			_, _ = key, value
1958
1959		}
1960	}
1961	*v = sv
1962	return nil
1963}
1964
1965type awsRestjson1_deserializeOpRegisterDevice struct {
1966}
1967
1968func (*awsRestjson1_deserializeOpRegisterDevice) ID() string {
1969	return "OperationDeserializer"
1970}
1971
1972func (m *awsRestjson1_deserializeOpRegisterDevice) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1973	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1974) {
1975	out, metadata, err = next.HandleDeserialize(ctx, in)
1976	if err != nil {
1977		return out, metadata, err
1978	}
1979
1980	response, ok := out.RawResponse.(*smithyhttp.Response)
1981	if !ok {
1982		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1983	}
1984
1985	if response.StatusCode < 200 || response.StatusCode >= 300 {
1986		return out, metadata, awsRestjson1_deserializeOpErrorRegisterDevice(response, &metadata)
1987	}
1988	output := &RegisterDeviceOutput{}
1989	out.Result = output
1990
1991	var buff [1024]byte
1992	ringBuffer := smithyio.NewRingBuffer(buff[:])
1993
1994	body := io.TeeReader(response.Body, ringBuffer)
1995
1996	decoder := json.NewDecoder(body)
1997	decoder.UseNumber()
1998	var shape interface{}
1999	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2000		var snapshot bytes.Buffer
2001		io.Copy(&snapshot, ringBuffer)
2002		err = &smithy.DeserializationError{
2003			Err:      fmt.Errorf("failed to decode response body, %w", err),
2004			Snapshot: snapshot.Bytes(),
2005		}
2006		return out, metadata, err
2007	}
2008
2009	err = awsRestjson1_deserializeOpDocumentRegisterDeviceOutput(&output, shape)
2010	if err != nil {
2011		var snapshot bytes.Buffer
2012		io.Copy(&snapshot, ringBuffer)
2013		return out, metadata, &smithy.DeserializationError{
2014			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
2015			Snapshot: snapshot.Bytes(),
2016		}
2017	}
2018
2019	return out, metadata, err
2020}
2021
2022func awsRestjson1_deserializeOpErrorRegisterDevice(response *smithyhttp.Response, metadata *middleware.Metadata) error {
2023	var errorBuffer bytes.Buffer
2024	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
2025		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
2026	}
2027	errorBody := bytes.NewReader(errorBuffer.Bytes())
2028
2029	errorCode := "UnknownError"
2030	errorMessage := errorCode
2031
2032	code := response.Header.Get("X-Amzn-ErrorType")
2033	if len(code) != 0 {
2034		errorCode = restjson.SanitizeErrorCode(code)
2035	}
2036
2037	var buff [1024]byte
2038	ringBuffer := smithyio.NewRingBuffer(buff[:])
2039
2040	body := io.TeeReader(errorBody, ringBuffer)
2041	decoder := json.NewDecoder(body)
2042	decoder.UseNumber()
2043	code, message, err := restjson.GetErrorInfo(decoder)
2044	if err != nil {
2045		var snapshot bytes.Buffer
2046		io.Copy(&snapshot, ringBuffer)
2047		err = &smithy.DeserializationError{
2048			Err:      fmt.Errorf("failed to decode response body, %w", err),
2049			Snapshot: snapshot.Bytes(),
2050		}
2051		return err
2052	}
2053
2054	errorBody.Seek(0, io.SeekStart)
2055	if len(code) != 0 {
2056		errorCode = restjson.SanitizeErrorCode(code)
2057	}
2058	if len(message) != 0 {
2059		errorMessage = message
2060	}
2061
2062	switch {
2063	case strings.EqualFold("InternalErrorException", errorCode):
2064		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
2065
2066	case strings.EqualFold("InvalidConfigurationException", errorCode):
2067		return awsRestjson1_deserializeErrorInvalidConfigurationException(response, errorBody)
2068
2069	case strings.EqualFold("InvalidParameterException", errorCode):
2070		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
2071
2072	case strings.EqualFold("NotAuthorizedException", errorCode):
2073		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
2074
2075	case strings.EqualFold("ResourceNotFoundException", errorCode):
2076		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
2077
2078	case strings.EqualFold("TooManyRequestsException", errorCode):
2079		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
2080
2081	default:
2082		genericError := &smithy.GenericAPIError{
2083			Code:    errorCode,
2084			Message: errorMessage,
2085		}
2086		return genericError
2087
2088	}
2089}
2090
2091func awsRestjson1_deserializeOpDocumentRegisterDeviceOutput(v **RegisterDeviceOutput, value interface{}) error {
2092	if v == nil {
2093		return fmt.Errorf("unexpected nil of type %T", v)
2094	}
2095	if value == nil {
2096		return nil
2097	}
2098
2099	shape, ok := value.(map[string]interface{})
2100	if !ok {
2101		return fmt.Errorf("unexpected JSON type %v", value)
2102	}
2103
2104	var sv *RegisterDeviceOutput
2105	if *v == nil {
2106		sv = &RegisterDeviceOutput{}
2107	} else {
2108		sv = *v
2109	}
2110
2111	for key, value := range shape {
2112		switch key {
2113		case "DeviceId":
2114			if value != nil {
2115				jtv, ok := value.(string)
2116				if !ok {
2117					return fmt.Errorf("expected DeviceId to be of type string, got %T instead", value)
2118				}
2119				sv.DeviceId = ptr.String(jtv)
2120			}
2121
2122		default:
2123			_, _ = key, value
2124
2125		}
2126	}
2127	*v = sv
2128	return nil
2129}
2130
2131type awsRestjson1_deserializeOpSetCognitoEvents struct {
2132}
2133
2134func (*awsRestjson1_deserializeOpSetCognitoEvents) ID() string {
2135	return "OperationDeserializer"
2136}
2137
2138func (m *awsRestjson1_deserializeOpSetCognitoEvents) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
2139	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
2140) {
2141	out, metadata, err = next.HandleDeserialize(ctx, in)
2142	if err != nil {
2143		return out, metadata, err
2144	}
2145
2146	response, ok := out.RawResponse.(*smithyhttp.Response)
2147	if !ok {
2148		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
2149	}
2150
2151	if response.StatusCode < 200 || response.StatusCode >= 300 {
2152		return out, metadata, awsRestjson1_deserializeOpErrorSetCognitoEvents(response, &metadata)
2153	}
2154	output := &SetCognitoEventsOutput{}
2155	out.Result = output
2156
2157	if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
2158		return out, metadata, &smithy.DeserializationError{
2159			Err: fmt.Errorf("failed to discard response body, %w", err),
2160		}
2161	}
2162
2163	return out, metadata, err
2164}
2165
2166func awsRestjson1_deserializeOpErrorSetCognitoEvents(response *smithyhttp.Response, metadata *middleware.Metadata) error {
2167	var errorBuffer bytes.Buffer
2168	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
2169		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
2170	}
2171	errorBody := bytes.NewReader(errorBuffer.Bytes())
2172
2173	errorCode := "UnknownError"
2174	errorMessage := errorCode
2175
2176	code := response.Header.Get("X-Amzn-ErrorType")
2177	if len(code) != 0 {
2178		errorCode = restjson.SanitizeErrorCode(code)
2179	}
2180
2181	var buff [1024]byte
2182	ringBuffer := smithyio.NewRingBuffer(buff[:])
2183
2184	body := io.TeeReader(errorBody, ringBuffer)
2185	decoder := json.NewDecoder(body)
2186	decoder.UseNumber()
2187	code, message, err := restjson.GetErrorInfo(decoder)
2188	if err != nil {
2189		var snapshot bytes.Buffer
2190		io.Copy(&snapshot, ringBuffer)
2191		err = &smithy.DeserializationError{
2192			Err:      fmt.Errorf("failed to decode response body, %w", err),
2193			Snapshot: snapshot.Bytes(),
2194		}
2195		return err
2196	}
2197
2198	errorBody.Seek(0, io.SeekStart)
2199	if len(code) != 0 {
2200		errorCode = restjson.SanitizeErrorCode(code)
2201	}
2202	if len(message) != 0 {
2203		errorMessage = message
2204	}
2205
2206	switch {
2207	case strings.EqualFold("InternalErrorException", errorCode):
2208		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
2209
2210	case strings.EqualFold("InvalidParameterException", errorCode):
2211		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
2212
2213	case strings.EqualFold("NotAuthorizedException", errorCode):
2214		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
2215
2216	case strings.EqualFold("ResourceNotFoundException", errorCode):
2217		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
2218
2219	case strings.EqualFold("TooManyRequestsException", errorCode):
2220		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
2221
2222	default:
2223		genericError := &smithy.GenericAPIError{
2224			Code:    errorCode,
2225			Message: errorMessage,
2226		}
2227		return genericError
2228
2229	}
2230}
2231
2232type awsRestjson1_deserializeOpSetIdentityPoolConfiguration struct {
2233}
2234
2235func (*awsRestjson1_deserializeOpSetIdentityPoolConfiguration) ID() string {
2236	return "OperationDeserializer"
2237}
2238
2239func (m *awsRestjson1_deserializeOpSetIdentityPoolConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
2240	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
2241) {
2242	out, metadata, err = next.HandleDeserialize(ctx, in)
2243	if err != nil {
2244		return out, metadata, err
2245	}
2246
2247	response, ok := out.RawResponse.(*smithyhttp.Response)
2248	if !ok {
2249		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
2250	}
2251
2252	if response.StatusCode < 200 || response.StatusCode >= 300 {
2253		return out, metadata, awsRestjson1_deserializeOpErrorSetIdentityPoolConfiguration(response, &metadata)
2254	}
2255	output := &SetIdentityPoolConfigurationOutput{}
2256	out.Result = output
2257
2258	var buff [1024]byte
2259	ringBuffer := smithyio.NewRingBuffer(buff[:])
2260
2261	body := io.TeeReader(response.Body, ringBuffer)
2262
2263	decoder := json.NewDecoder(body)
2264	decoder.UseNumber()
2265	var shape interface{}
2266	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2267		var snapshot bytes.Buffer
2268		io.Copy(&snapshot, ringBuffer)
2269		err = &smithy.DeserializationError{
2270			Err:      fmt.Errorf("failed to decode response body, %w", err),
2271			Snapshot: snapshot.Bytes(),
2272		}
2273		return out, metadata, err
2274	}
2275
2276	err = awsRestjson1_deserializeOpDocumentSetIdentityPoolConfigurationOutput(&output, shape)
2277	if err != nil {
2278		var snapshot bytes.Buffer
2279		io.Copy(&snapshot, ringBuffer)
2280		return out, metadata, &smithy.DeserializationError{
2281			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
2282			Snapshot: snapshot.Bytes(),
2283		}
2284	}
2285
2286	return out, metadata, err
2287}
2288
2289func awsRestjson1_deserializeOpErrorSetIdentityPoolConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error {
2290	var errorBuffer bytes.Buffer
2291	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
2292		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
2293	}
2294	errorBody := bytes.NewReader(errorBuffer.Bytes())
2295
2296	errorCode := "UnknownError"
2297	errorMessage := errorCode
2298
2299	code := response.Header.Get("X-Amzn-ErrorType")
2300	if len(code) != 0 {
2301		errorCode = restjson.SanitizeErrorCode(code)
2302	}
2303
2304	var buff [1024]byte
2305	ringBuffer := smithyio.NewRingBuffer(buff[:])
2306
2307	body := io.TeeReader(errorBody, ringBuffer)
2308	decoder := json.NewDecoder(body)
2309	decoder.UseNumber()
2310	code, message, err := restjson.GetErrorInfo(decoder)
2311	if err != nil {
2312		var snapshot bytes.Buffer
2313		io.Copy(&snapshot, ringBuffer)
2314		err = &smithy.DeserializationError{
2315			Err:      fmt.Errorf("failed to decode response body, %w", err),
2316			Snapshot: snapshot.Bytes(),
2317		}
2318		return err
2319	}
2320
2321	errorBody.Seek(0, io.SeekStart)
2322	if len(code) != 0 {
2323		errorCode = restjson.SanitizeErrorCode(code)
2324	}
2325	if len(message) != 0 {
2326		errorMessage = message
2327	}
2328
2329	switch {
2330	case strings.EqualFold("ConcurrentModificationException", errorCode):
2331		return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody)
2332
2333	case strings.EqualFold("InternalErrorException", errorCode):
2334		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
2335
2336	case strings.EqualFold("InvalidParameterException", errorCode):
2337		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
2338
2339	case strings.EqualFold("NotAuthorizedException", errorCode):
2340		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
2341
2342	case strings.EqualFold("ResourceNotFoundException", errorCode):
2343		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
2344
2345	case strings.EqualFold("TooManyRequestsException", errorCode):
2346		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
2347
2348	default:
2349		genericError := &smithy.GenericAPIError{
2350			Code:    errorCode,
2351			Message: errorMessage,
2352		}
2353		return genericError
2354
2355	}
2356}
2357
2358func awsRestjson1_deserializeOpDocumentSetIdentityPoolConfigurationOutput(v **SetIdentityPoolConfigurationOutput, value interface{}) error {
2359	if v == nil {
2360		return fmt.Errorf("unexpected nil of type %T", v)
2361	}
2362	if value == nil {
2363		return nil
2364	}
2365
2366	shape, ok := value.(map[string]interface{})
2367	if !ok {
2368		return fmt.Errorf("unexpected JSON type %v", value)
2369	}
2370
2371	var sv *SetIdentityPoolConfigurationOutput
2372	if *v == nil {
2373		sv = &SetIdentityPoolConfigurationOutput{}
2374	} else {
2375		sv = *v
2376	}
2377
2378	for key, value := range shape {
2379		switch key {
2380		case "CognitoStreams":
2381			if err := awsRestjson1_deserializeDocumentCognitoStreams(&sv.CognitoStreams, value); err != nil {
2382				return err
2383			}
2384
2385		case "IdentityPoolId":
2386			if value != nil {
2387				jtv, ok := value.(string)
2388				if !ok {
2389					return fmt.Errorf("expected IdentityPoolId to be of type string, got %T instead", value)
2390				}
2391				sv.IdentityPoolId = ptr.String(jtv)
2392			}
2393
2394		case "PushSync":
2395			if err := awsRestjson1_deserializeDocumentPushSync(&sv.PushSync, value); err != nil {
2396				return err
2397			}
2398
2399		default:
2400			_, _ = key, value
2401
2402		}
2403	}
2404	*v = sv
2405	return nil
2406}
2407
2408type awsRestjson1_deserializeOpSubscribeToDataset struct {
2409}
2410
2411func (*awsRestjson1_deserializeOpSubscribeToDataset) ID() string {
2412	return "OperationDeserializer"
2413}
2414
2415func (m *awsRestjson1_deserializeOpSubscribeToDataset) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
2416	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
2417) {
2418	out, metadata, err = next.HandleDeserialize(ctx, in)
2419	if err != nil {
2420		return out, metadata, err
2421	}
2422
2423	response, ok := out.RawResponse.(*smithyhttp.Response)
2424	if !ok {
2425		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
2426	}
2427
2428	if response.StatusCode < 200 || response.StatusCode >= 300 {
2429		return out, metadata, awsRestjson1_deserializeOpErrorSubscribeToDataset(response, &metadata)
2430	}
2431	output := &SubscribeToDatasetOutput{}
2432	out.Result = output
2433
2434	return out, metadata, err
2435}
2436
2437func awsRestjson1_deserializeOpErrorSubscribeToDataset(response *smithyhttp.Response, metadata *middleware.Metadata) error {
2438	var errorBuffer bytes.Buffer
2439	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
2440		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
2441	}
2442	errorBody := bytes.NewReader(errorBuffer.Bytes())
2443
2444	errorCode := "UnknownError"
2445	errorMessage := errorCode
2446
2447	code := response.Header.Get("X-Amzn-ErrorType")
2448	if len(code) != 0 {
2449		errorCode = restjson.SanitizeErrorCode(code)
2450	}
2451
2452	var buff [1024]byte
2453	ringBuffer := smithyio.NewRingBuffer(buff[:])
2454
2455	body := io.TeeReader(errorBody, ringBuffer)
2456	decoder := json.NewDecoder(body)
2457	decoder.UseNumber()
2458	code, message, err := restjson.GetErrorInfo(decoder)
2459	if err != nil {
2460		var snapshot bytes.Buffer
2461		io.Copy(&snapshot, ringBuffer)
2462		err = &smithy.DeserializationError{
2463			Err:      fmt.Errorf("failed to decode response body, %w", err),
2464			Snapshot: snapshot.Bytes(),
2465		}
2466		return err
2467	}
2468
2469	errorBody.Seek(0, io.SeekStart)
2470	if len(code) != 0 {
2471		errorCode = restjson.SanitizeErrorCode(code)
2472	}
2473	if len(message) != 0 {
2474		errorMessage = message
2475	}
2476
2477	switch {
2478	case strings.EqualFold("InternalErrorException", errorCode):
2479		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
2480
2481	case strings.EqualFold("InvalidConfigurationException", errorCode):
2482		return awsRestjson1_deserializeErrorInvalidConfigurationException(response, errorBody)
2483
2484	case strings.EqualFold("InvalidParameterException", errorCode):
2485		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
2486
2487	case strings.EqualFold("NotAuthorizedException", errorCode):
2488		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
2489
2490	case strings.EqualFold("ResourceNotFoundException", errorCode):
2491		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
2492
2493	case strings.EqualFold("TooManyRequestsException", errorCode):
2494		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
2495
2496	default:
2497		genericError := &smithy.GenericAPIError{
2498			Code:    errorCode,
2499			Message: errorMessage,
2500		}
2501		return genericError
2502
2503	}
2504}
2505
2506type awsRestjson1_deserializeOpUnsubscribeFromDataset struct {
2507}
2508
2509func (*awsRestjson1_deserializeOpUnsubscribeFromDataset) ID() string {
2510	return "OperationDeserializer"
2511}
2512
2513func (m *awsRestjson1_deserializeOpUnsubscribeFromDataset) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
2514	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
2515) {
2516	out, metadata, err = next.HandleDeserialize(ctx, in)
2517	if err != nil {
2518		return out, metadata, err
2519	}
2520
2521	response, ok := out.RawResponse.(*smithyhttp.Response)
2522	if !ok {
2523		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
2524	}
2525
2526	if response.StatusCode < 200 || response.StatusCode >= 300 {
2527		return out, metadata, awsRestjson1_deserializeOpErrorUnsubscribeFromDataset(response, &metadata)
2528	}
2529	output := &UnsubscribeFromDatasetOutput{}
2530	out.Result = output
2531
2532	return out, metadata, err
2533}
2534
2535func awsRestjson1_deserializeOpErrorUnsubscribeFromDataset(response *smithyhttp.Response, metadata *middleware.Metadata) error {
2536	var errorBuffer bytes.Buffer
2537	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
2538		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
2539	}
2540	errorBody := bytes.NewReader(errorBuffer.Bytes())
2541
2542	errorCode := "UnknownError"
2543	errorMessage := errorCode
2544
2545	code := response.Header.Get("X-Amzn-ErrorType")
2546	if len(code) != 0 {
2547		errorCode = restjson.SanitizeErrorCode(code)
2548	}
2549
2550	var buff [1024]byte
2551	ringBuffer := smithyio.NewRingBuffer(buff[:])
2552
2553	body := io.TeeReader(errorBody, ringBuffer)
2554	decoder := json.NewDecoder(body)
2555	decoder.UseNumber()
2556	code, message, err := restjson.GetErrorInfo(decoder)
2557	if err != nil {
2558		var snapshot bytes.Buffer
2559		io.Copy(&snapshot, ringBuffer)
2560		err = &smithy.DeserializationError{
2561			Err:      fmt.Errorf("failed to decode response body, %w", err),
2562			Snapshot: snapshot.Bytes(),
2563		}
2564		return err
2565	}
2566
2567	errorBody.Seek(0, io.SeekStart)
2568	if len(code) != 0 {
2569		errorCode = restjson.SanitizeErrorCode(code)
2570	}
2571	if len(message) != 0 {
2572		errorMessage = message
2573	}
2574
2575	switch {
2576	case strings.EqualFold("InternalErrorException", errorCode):
2577		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
2578
2579	case strings.EqualFold("InvalidConfigurationException", errorCode):
2580		return awsRestjson1_deserializeErrorInvalidConfigurationException(response, errorBody)
2581
2582	case strings.EqualFold("InvalidParameterException", errorCode):
2583		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
2584
2585	case strings.EqualFold("NotAuthorizedException", errorCode):
2586		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
2587
2588	case strings.EqualFold("ResourceNotFoundException", errorCode):
2589		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
2590
2591	case strings.EqualFold("TooManyRequestsException", errorCode):
2592		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
2593
2594	default:
2595		genericError := &smithy.GenericAPIError{
2596			Code:    errorCode,
2597			Message: errorMessage,
2598		}
2599		return genericError
2600
2601	}
2602}
2603
2604type awsRestjson1_deserializeOpUpdateRecords struct {
2605}
2606
2607func (*awsRestjson1_deserializeOpUpdateRecords) ID() string {
2608	return "OperationDeserializer"
2609}
2610
2611func (m *awsRestjson1_deserializeOpUpdateRecords) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
2612	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
2613) {
2614	out, metadata, err = next.HandleDeserialize(ctx, in)
2615	if err != nil {
2616		return out, metadata, err
2617	}
2618
2619	response, ok := out.RawResponse.(*smithyhttp.Response)
2620	if !ok {
2621		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
2622	}
2623
2624	if response.StatusCode < 200 || response.StatusCode >= 300 {
2625		return out, metadata, awsRestjson1_deserializeOpErrorUpdateRecords(response, &metadata)
2626	}
2627	output := &UpdateRecordsOutput{}
2628	out.Result = output
2629
2630	var buff [1024]byte
2631	ringBuffer := smithyio.NewRingBuffer(buff[:])
2632
2633	body := io.TeeReader(response.Body, ringBuffer)
2634
2635	decoder := json.NewDecoder(body)
2636	decoder.UseNumber()
2637	var shape interface{}
2638	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2639		var snapshot bytes.Buffer
2640		io.Copy(&snapshot, ringBuffer)
2641		err = &smithy.DeserializationError{
2642			Err:      fmt.Errorf("failed to decode response body, %w", err),
2643			Snapshot: snapshot.Bytes(),
2644		}
2645		return out, metadata, err
2646	}
2647
2648	err = awsRestjson1_deserializeOpDocumentUpdateRecordsOutput(&output, shape)
2649	if err != nil {
2650		var snapshot bytes.Buffer
2651		io.Copy(&snapshot, ringBuffer)
2652		return out, metadata, &smithy.DeserializationError{
2653			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
2654			Snapshot: snapshot.Bytes(),
2655		}
2656	}
2657
2658	return out, metadata, err
2659}
2660
2661func awsRestjson1_deserializeOpErrorUpdateRecords(response *smithyhttp.Response, metadata *middleware.Metadata) error {
2662	var errorBuffer bytes.Buffer
2663	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
2664		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
2665	}
2666	errorBody := bytes.NewReader(errorBuffer.Bytes())
2667
2668	errorCode := "UnknownError"
2669	errorMessage := errorCode
2670
2671	code := response.Header.Get("X-Amzn-ErrorType")
2672	if len(code) != 0 {
2673		errorCode = restjson.SanitizeErrorCode(code)
2674	}
2675
2676	var buff [1024]byte
2677	ringBuffer := smithyio.NewRingBuffer(buff[:])
2678
2679	body := io.TeeReader(errorBody, ringBuffer)
2680	decoder := json.NewDecoder(body)
2681	decoder.UseNumber()
2682	code, message, err := restjson.GetErrorInfo(decoder)
2683	if err != nil {
2684		var snapshot bytes.Buffer
2685		io.Copy(&snapshot, ringBuffer)
2686		err = &smithy.DeserializationError{
2687			Err:      fmt.Errorf("failed to decode response body, %w", err),
2688			Snapshot: snapshot.Bytes(),
2689		}
2690		return err
2691	}
2692
2693	errorBody.Seek(0, io.SeekStart)
2694	if len(code) != 0 {
2695		errorCode = restjson.SanitizeErrorCode(code)
2696	}
2697	if len(message) != 0 {
2698		errorMessage = message
2699	}
2700
2701	switch {
2702	case strings.EqualFold("InternalErrorException", errorCode):
2703		return awsRestjson1_deserializeErrorInternalErrorException(response, errorBody)
2704
2705	case strings.EqualFold("InvalidLambdaFunctionOutputException", errorCode):
2706		return awsRestjson1_deserializeErrorInvalidLambdaFunctionOutputException(response, errorBody)
2707
2708	case strings.EqualFold("InvalidParameterException", errorCode):
2709		return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
2710
2711	case strings.EqualFold("LambdaThrottledException", errorCode):
2712		return awsRestjson1_deserializeErrorLambdaThrottledException(response, errorBody)
2713
2714	case strings.EqualFold("LimitExceededException", errorCode):
2715		return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody)
2716
2717	case strings.EqualFold("NotAuthorizedException", errorCode):
2718		return awsRestjson1_deserializeErrorNotAuthorizedException(response, errorBody)
2719
2720	case strings.EqualFold("ResourceConflictException", errorCode):
2721		return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody)
2722
2723	case strings.EqualFold("ResourceNotFoundException", errorCode):
2724		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
2725
2726	case strings.EqualFold("TooManyRequestsException", errorCode):
2727		return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody)
2728
2729	default:
2730		genericError := &smithy.GenericAPIError{
2731			Code:    errorCode,
2732			Message: errorMessage,
2733		}
2734		return genericError
2735
2736	}
2737}
2738
2739func awsRestjson1_deserializeOpDocumentUpdateRecordsOutput(v **UpdateRecordsOutput, value interface{}) error {
2740	if v == nil {
2741		return fmt.Errorf("unexpected nil of type %T", v)
2742	}
2743	if value == nil {
2744		return nil
2745	}
2746
2747	shape, ok := value.(map[string]interface{})
2748	if !ok {
2749		return fmt.Errorf("unexpected JSON type %v", value)
2750	}
2751
2752	var sv *UpdateRecordsOutput
2753	if *v == nil {
2754		sv = &UpdateRecordsOutput{}
2755	} else {
2756		sv = *v
2757	}
2758
2759	for key, value := range shape {
2760		switch key {
2761		case "Records":
2762			if err := awsRestjson1_deserializeDocumentRecordList(&sv.Records, value); err != nil {
2763				return err
2764			}
2765
2766		default:
2767			_, _ = key, value
2768
2769		}
2770	}
2771	*v = sv
2772	return nil
2773}
2774
2775func awsRestjson1_deserializeErrorAlreadyStreamedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
2776	output := &types.AlreadyStreamedException{}
2777	var buff [1024]byte
2778	ringBuffer := smithyio.NewRingBuffer(buff[:])
2779
2780	body := io.TeeReader(errorBody, ringBuffer)
2781	decoder := json.NewDecoder(body)
2782	decoder.UseNumber()
2783	var shape interface{}
2784	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2785		var snapshot bytes.Buffer
2786		io.Copy(&snapshot, ringBuffer)
2787		err = &smithy.DeserializationError{
2788			Err:      fmt.Errorf("failed to decode response body, %w", err),
2789			Snapshot: snapshot.Bytes(),
2790		}
2791		return err
2792	}
2793
2794	err := awsRestjson1_deserializeDocumentAlreadyStreamedException(&output, shape)
2795
2796	if err != nil {
2797		var snapshot bytes.Buffer
2798		io.Copy(&snapshot, ringBuffer)
2799		err = &smithy.DeserializationError{
2800			Err:      fmt.Errorf("failed to decode response body, %w", err),
2801			Snapshot: snapshot.Bytes(),
2802		}
2803		return err
2804	}
2805
2806	errorBody.Seek(0, io.SeekStart)
2807
2808	return output
2809}
2810
2811func awsRestjson1_deserializeErrorConcurrentModificationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
2812	output := &types.ConcurrentModificationException{}
2813	var buff [1024]byte
2814	ringBuffer := smithyio.NewRingBuffer(buff[:])
2815
2816	body := io.TeeReader(errorBody, ringBuffer)
2817	decoder := json.NewDecoder(body)
2818	decoder.UseNumber()
2819	var shape interface{}
2820	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2821		var snapshot bytes.Buffer
2822		io.Copy(&snapshot, ringBuffer)
2823		err = &smithy.DeserializationError{
2824			Err:      fmt.Errorf("failed to decode response body, %w", err),
2825			Snapshot: snapshot.Bytes(),
2826		}
2827		return err
2828	}
2829
2830	err := awsRestjson1_deserializeDocumentConcurrentModificationException(&output, shape)
2831
2832	if err != nil {
2833		var snapshot bytes.Buffer
2834		io.Copy(&snapshot, ringBuffer)
2835		err = &smithy.DeserializationError{
2836			Err:      fmt.Errorf("failed to decode response body, %w", err),
2837			Snapshot: snapshot.Bytes(),
2838		}
2839		return err
2840	}
2841
2842	errorBody.Seek(0, io.SeekStart)
2843
2844	return output
2845}
2846
2847func awsRestjson1_deserializeErrorDuplicateRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
2848	output := &types.DuplicateRequestException{}
2849	var buff [1024]byte
2850	ringBuffer := smithyio.NewRingBuffer(buff[:])
2851
2852	body := io.TeeReader(errorBody, ringBuffer)
2853	decoder := json.NewDecoder(body)
2854	decoder.UseNumber()
2855	var shape interface{}
2856	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2857		var snapshot bytes.Buffer
2858		io.Copy(&snapshot, ringBuffer)
2859		err = &smithy.DeserializationError{
2860			Err:      fmt.Errorf("failed to decode response body, %w", err),
2861			Snapshot: snapshot.Bytes(),
2862		}
2863		return err
2864	}
2865
2866	err := awsRestjson1_deserializeDocumentDuplicateRequestException(&output, shape)
2867
2868	if err != nil {
2869		var snapshot bytes.Buffer
2870		io.Copy(&snapshot, ringBuffer)
2871		err = &smithy.DeserializationError{
2872			Err:      fmt.Errorf("failed to decode response body, %w", err),
2873			Snapshot: snapshot.Bytes(),
2874		}
2875		return err
2876	}
2877
2878	errorBody.Seek(0, io.SeekStart)
2879
2880	return output
2881}
2882
2883func awsRestjson1_deserializeErrorInternalErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
2884	output := &types.InternalErrorException{}
2885	var buff [1024]byte
2886	ringBuffer := smithyio.NewRingBuffer(buff[:])
2887
2888	body := io.TeeReader(errorBody, ringBuffer)
2889	decoder := json.NewDecoder(body)
2890	decoder.UseNumber()
2891	var shape interface{}
2892	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2893		var snapshot bytes.Buffer
2894		io.Copy(&snapshot, ringBuffer)
2895		err = &smithy.DeserializationError{
2896			Err:      fmt.Errorf("failed to decode response body, %w", err),
2897			Snapshot: snapshot.Bytes(),
2898		}
2899		return err
2900	}
2901
2902	err := awsRestjson1_deserializeDocumentInternalErrorException(&output, shape)
2903
2904	if err != nil {
2905		var snapshot bytes.Buffer
2906		io.Copy(&snapshot, ringBuffer)
2907		err = &smithy.DeserializationError{
2908			Err:      fmt.Errorf("failed to decode response body, %w", err),
2909			Snapshot: snapshot.Bytes(),
2910		}
2911		return err
2912	}
2913
2914	errorBody.Seek(0, io.SeekStart)
2915
2916	return output
2917}
2918
2919func awsRestjson1_deserializeErrorInvalidConfigurationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
2920	output := &types.InvalidConfigurationException{}
2921	var buff [1024]byte
2922	ringBuffer := smithyio.NewRingBuffer(buff[:])
2923
2924	body := io.TeeReader(errorBody, ringBuffer)
2925	decoder := json.NewDecoder(body)
2926	decoder.UseNumber()
2927	var shape interface{}
2928	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2929		var snapshot bytes.Buffer
2930		io.Copy(&snapshot, ringBuffer)
2931		err = &smithy.DeserializationError{
2932			Err:      fmt.Errorf("failed to decode response body, %w", err),
2933			Snapshot: snapshot.Bytes(),
2934		}
2935		return err
2936	}
2937
2938	err := awsRestjson1_deserializeDocumentInvalidConfigurationException(&output, shape)
2939
2940	if err != nil {
2941		var snapshot bytes.Buffer
2942		io.Copy(&snapshot, ringBuffer)
2943		err = &smithy.DeserializationError{
2944			Err:      fmt.Errorf("failed to decode response body, %w", err),
2945			Snapshot: snapshot.Bytes(),
2946		}
2947		return err
2948	}
2949
2950	errorBody.Seek(0, io.SeekStart)
2951
2952	return output
2953}
2954
2955func awsRestjson1_deserializeErrorInvalidLambdaFunctionOutputException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
2956	output := &types.InvalidLambdaFunctionOutputException{}
2957	var buff [1024]byte
2958	ringBuffer := smithyio.NewRingBuffer(buff[:])
2959
2960	body := io.TeeReader(errorBody, ringBuffer)
2961	decoder := json.NewDecoder(body)
2962	decoder.UseNumber()
2963	var shape interface{}
2964	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
2965		var snapshot bytes.Buffer
2966		io.Copy(&snapshot, ringBuffer)
2967		err = &smithy.DeserializationError{
2968			Err:      fmt.Errorf("failed to decode response body, %w", err),
2969			Snapshot: snapshot.Bytes(),
2970		}
2971		return err
2972	}
2973
2974	err := awsRestjson1_deserializeDocumentInvalidLambdaFunctionOutputException(&output, shape)
2975
2976	if err != nil {
2977		var snapshot bytes.Buffer
2978		io.Copy(&snapshot, ringBuffer)
2979		err = &smithy.DeserializationError{
2980			Err:      fmt.Errorf("failed to decode response body, %w", err),
2981			Snapshot: snapshot.Bytes(),
2982		}
2983		return err
2984	}
2985
2986	errorBody.Seek(0, io.SeekStart)
2987
2988	return output
2989}
2990
2991func awsRestjson1_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
2992	output := &types.InvalidParameterException{}
2993	var buff [1024]byte
2994	ringBuffer := smithyio.NewRingBuffer(buff[:])
2995
2996	body := io.TeeReader(errorBody, ringBuffer)
2997	decoder := json.NewDecoder(body)
2998	decoder.UseNumber()
2999	var shape interface{}
3000	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
3001		var snapshot bytes.Buffer
3002		io.Copy(&snapshot, ringBuffer)
3003		err = &smithy.DeserializationError{
3004			Err:      fmt.Errorf("failed to decode response body, %w", err),
3005			Snapshot: snapshot.Bytes(),
3006		}
3007		return err
3008	}
3009
3010	err := awsRestjson1_deserializeDocumentInvalidParameterException(&output, shape)
3011
3012	if err != nil {
3013		var snapshot bytes.Buffer
3014		io.Copy(&snapshot, ringBuffer)
3015		err = &smithy.DeserializationError{
3016			Err:      fmt.Errorf("failed to decode response body, %w", err),
3017			Snapshot: snapshot.Bytes(),
3018		}
3019		return err
3020	}
3021
3022	errorBody.Seek(0, io.SeekStart)
3023
3024	return output
3025}
3026
3027func awsRestjson1_deserializeErrorLambdaThrottledException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
3028	output := &types.LambdaThrottledException{}
3029	var buff [1024]byte
3030	ringBuffer := smithyio.NewRingBuffer(buff[:])
3031
3032	body := io.TeeReader(errorBody, ringBuffer)
3033	decoder := json.NewDecoder(body)
3034	decoder.UseNumber()
3035	var shape interface{}
3036	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
3037		var snapshot bytes.Buffer
3038		io.Copy(&snapshot, ringBuffer)
3039		err = &smithy.DeserializationError{
3040			Err:      fmt.Errorf("failed to decode response body, %w", err),
3041			Snapshot: snapshot.Bytes(),
3042		}
3043		return err
3044	}
3045
3046	err := awsRestjson1_deserializeDocumentLambdaThrottledException(&output, shape)
3047
3048	if err != nil {
3049		var snapshot bytes.Buffer
3050		io.Copy(&snapshot, ringBuffer)
3051		err = &smithy.DeserializationError{
3052			Err:      fmt.Errorf("failed to decode response body, %w", err),
3053			Snapshot: snapshot.Bytes(),
3054		}
3055		return err
3056	}
3057
3058	errorBody.Seek(0, io.SeekStart)
3059
3060	return output
3061}
3062
3063func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
3064	output := &types.LimitExceededException{}
3065	var buff [1024]byte
3066	ringBuffer := smithyio.NewRingBuffer(buff[:])
3067
3068	body := io.TeeReader(errorBody, ringBuffer)
3069	decoder := json.NewDecoder(body)
3070	decoder.UseNumber()
3071	var shape interface{}
3072	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
3073		var snapshot bytes.Buffer
3074		io.Copy(&snapshot, ringBuffer)
3075		err = &smithy.DeserializationError{
3076			Err:      fmt.Errorf("failed to decode response body, %w", err),
3077			Snapshot: snapshot.Bytes(),
3078		}
3079		return err
3080	}
3081
3082	err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape)
3083
3084	if err != nil {
3085		var snapshot bytes.Buffer
3086		io.Copy(&snapshot, ringBuffer)
3087		err = &smithy.DeserializationError{
3088			Err:      fmt.Errorf("failed to decode response body, %w", err),
3089			Snapshot: snapshot.Bytes(),
3090		}
3091		return err
3092	}
3093
3094	errorBody.Seek(0, io.SeekStart)
3095
3096	return output
3097}
3098
3099func awsRestjson1_deserializeErrorNotAuthorizedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
3100	output := &types.NotAuthorizedException{}
3101	var buff [1024]byte
3102	ringBuffer := smithyio.NewRingBuffer(buff[:])
3103
3104	body := io.TeeReader(errorBody, ringBuffer)
3105	decoder := json.NewDecoder(body)
3106	decoder.UseNumber()
3107	var shape interface{}
3108	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
3109		var snapshot bytes.Buffer
3110		io.Copy(&snapshot, ringBuffer)
3111		err = &smithy.DeserializationError{
3112			Err:      fmt.Errorf("failed to decode response body, %w", err),
3113			Snapshot: snapshot.Bytes(),
3114		}
3115		return err
3116	}
3117
3118	err := awsRestjson1_deserializeDocumentNotAuthorizedException(&output, shape)
3119
3120	if err != nil {
3121		var snapshot bytes.Buffer
3122		io.Copy(&snapshot, ringBuffer)
3123		err = &smithy.DeserializationError{
3124			Err:      fmt.Errorf("failed to decode response body, %w", err),
3125			Snapshot: snapshot.Bytes(),
3126		}
3127		return err
3128	}
3129
3130	errorBody.Seek(0, io.SeekStart)
3131
3132	return output
3133}
3134
3135func awsRestjson1_deserializeErrorResourceConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
3136	output := &types.ResourceConflictException{}
3137	var buff [1024]byte
3138	ringBuffer := smithyio.NewRingBuffer(buff[:])
3139
3140	body := io.TeeReader(errorBody, ringBuffer)
3141	decoder := json.NewDecoder(body)
3142	decoder.UseNumber()
3143	var shape interface{}
3144	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
3145		var snapshot bytes.Buffer
3146		io.Copy(&snapshot, ringBuffer)
3147		err = &smithy.DeserializationError{
3148			Err:      fmt.Errorf("failed to decode response body, %w", err),
3149			Snapshot: snapshot.Bytes(),
3150		}
3151		return err
3152	}
3153
3154	err := awsRestjson1_deserializeDocumentResourceConflictException(&output, shape)
3155
3156	if err != nil {
3157		var snapshot bytes.Buffer
3158		io.Copy(&snapshot, ringBuffer)
3159		err = &smithy.DeserializationError{
3160			Err:      fmt.Errorf("failed to decode response body, %w", err),
3161			Snapshot: snapshot.Bytes(),
3162		}
3163		return err
3164	}
3165
3166	errorBody.Seek(0, io.SeekStart)
3167
3168	return output
3169}
3170
3171func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
3172	output := &types.ResourceNotFoundException{}
3173	var buff [1024]byte
3174	ringBuffer := smithyio.NewRingBuffer(buff[:])
3175
3176	body := io.TeeReader(errorBody, ringBuffer)
3177	decoder := json.NewDecoder(body)
3178	decoder.UseNumber()
3179	var shape interface{}
3180	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
3181		var snapshot bytes.Buffer
3182		io.Copy(&snapshot, ringBuffer)
3183		err = &smithy.DeserializationError{
3184			Err:      fmt.Errorf("failed to decode response body, %w", err),
3185			Snapshot: snapshot.Bytes(),
3186		}
3187		return err
3188	}
3189
3190	err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape)
3191
3192	if err != nil {
3193		var snapshot bytes.Buffer
3194		io.Copy(&snapshot, ringBuffer)
3195		err = &smithy.DeserializationError{
3196			Err:      fmt.Errorf("failed to decode response body, %w", err),
3197			Snapshot: snapshot.Bytes(),
3198		}
3199		return err
3200	}
3201
3202	errorBody.Seek(0, io.SeekStart)
3203
3204	return output
3205}
3206
3207func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
3208	output := &types.TooManyRequestsException{}
3209	var buff [1024]byte
3210	ringBuffer := smithyio.NewRingBuffer(buff[:])
3211
3212	body := io.TeeReader(errorBody, ringBuffer)
3213	decoder := json.NewDecoder(body)
3214	decoder.UseNumber()
3215	var shape interface{}
3216	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
3217		var snapshot bytes.Buffer
3218		io.Copy(&snapshot, ringBuffer)
3219		err = &smithy.DeserializationError{
3220			Err:      fmt.Errorf("failed to decode response body, %w", err),
3221			Snapshot: snapshot.Bytes(),
3222		}
3223		return err
3224	}
3225
3226	err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape)
3227
3228	if err != nil {
3229		var snapshot bytes.Buffer
3230		io.Copy(&snapshot, ringBuffer)
3231		err = &smithy.DeserializationError{
3232			Err:      fmt.Errorf("failed to decode response body, %w", err),
3233			Snapshot: snapshot.Bytes(),
3234		}
3235		return err
3236	}
3237
3238	errorBody.Seek(0, io.SeekStart)
3239
3240	return output
3241}
3242
3243func awsRestjson1_deserializeDocumentAlreadyStreamedException(v **types.AlreadyStreamedException, value interface{}) error {
3244	if v == nil {
3245		return fmt.Errorf("unexpected nil of type %T", v)
3246	}
3247	if value == nil {
3248		return nil
3249	}
3250
3251	shape, ok := value.(map[string]interface{})
3252	if !ok {
3253		return fmt.Errorf("unexpected JSON type %v", value)
3254	}
3255
3256	var sv *types.AlreadyStreamedException
3257	if *v == nil {
3258		sv = &types.AlreadyStreamedException{}
3259	} else {
3260		sv = *v
3261	}
3262
3263	for key, value := range shape {
3264		switch key {
3265		case "message":
3266			if value != nil {
3267				jtv, ok := value.(string)
3268				if !ok {
3269					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
3270				}
3271				sv.Message = ptr.String(jtv)
3272			}
3273
3274		default:
3275			_, _ = key, value
3276
3277		}
3278	}
3279	*v = sv
3280	return nil
3281}
3282
3283func awsRestjson1_deserializeDocumentApplicationArnList(v *[]string, value interface{}) error {
3284	if v == nil {
3285		return fmt.Errorf("unexpected nil of type %T", v)
3286	}
3287	if value == nil {
3288		return nil
3289	}
3290
3291	shape, ok := value.([]interface{})
3292	if !ok {
3293		return fmt.Errorf("unexpected JSON type %v", value)
3294	}
3295
3296	var cv []string
3297	if *v == nil {
3298		cv = []string{}
3299	} else {
3300		cv = *v
3301	}
3302
3303	for _, value := range shape {
3304		var col string
3305		if value != nil {
3306			jtv, ok := value.(string)
3307			if !ok {
3308				return fmt.Errorf("expected ApplicationArn to be of type string, got %T instead", value)
3309			}
3310			col = jtv
3311		}
3312		cv = append(cv, col)
3313
3314	}
3315	*v = cv
3316	return nil
3317}
3318
3319func awsRestjson1_deserializeDocumentCognitoStreams(v **types.CognitoStreams, value interface{}) error {
3320	if v == nil {
3321		return fmt.Errorf("unexpected nil of type %T", v)
3322	}
3323	if value == nil {
3324		return nil
3325	}
3326
3327	shape, ok := value.(map[string]interface{})
3328	if !ok {
3329		return fmt.Errorf("unexpected JSON type %v", value)
3330	}
3331
3332	var sv *types.CognitoStreams
3333	if *v == nil {
3334		sv = &types.CognitoStreams{}
3335	} else {
3336		sv = *v
3337	}
3338
3339	for key, value := range shape {
3340		switch key {
3341		case "RoleArn":
3342			if value != nil {
3343				jtv, ok := value.(string)
3344				if !ok {
3345					return fmt.Errorf("expected AssumeRoleArn to be of type string, got %T instead", value)
3346				}
3347				sv.RoleArn = ptr.String(jtv)
3348			}
3349
3350		case "StreamingStatus":
3351			if value != nil {
3352				jtv, ok := value.(string)
3353				if !ok {
3354					return fmt.Errorf("expected StreamingStatus to be of type string, got %T instead", value)
3355				}
3356				sv.StreamingStatus = types.StreamingStatus(jtv)
3357			}
3358
3359		case "StreamName":
3360			if value != nil {
3361				jtv, ok := value.(string)
3362				if !ok {
3363					return fmt.Errorf("expected StreamName to be of type string, got %T instead", value)
3364				}
3365				sv.StreamName = ptr.String(jtv)
3366			}
3367
3368		default:
3369			_, _ = key, value
3370
3371		}
3372	}
3373	*v = sv
3374	return nil
3375}
3376
3377func awsRestjson1_deserializeDocumentConcurrentModificationException(v **types.ConcurrentModificationException, value interface{}) error {
3378	if v == nil {
3379		return fmt.Errorf("unexpected nil of type %T", v)
3380	}
3381	if value == nil {
3382		return nil
3383	}
3384
3385	shape, ok := value.(map[string]interface{})
3386	if !ok {
3387		return fmt.Errorf("unexpected JSON type %v", value)
3388	}
3389
3390	var sv *types.ConcurrentModificationException
3391	if *v == nil {
3392		sv = &types.ConcurrentModificationException{}
3393	} else {
3394		sv = *v
3395	}
3396
3397	for key, value := range shape {
3398		switch key {
3399		case "message":
3400			if value != nil {
3401				jtv, ok := value.(string)
3402				if !ok {
3403					return fmt.Errorf("expected String to be of type string, got %T instead", value)
3404				}
3405				sv.Message = ptr.String(jtv)
3406			}
3407
3408		default:
3409			_, _ = key, value
3410
3411		}
3412	}
3413	*v = sv
3414	return nil
3415}
3416
3417func awsRestjson1_deserializeDocumentDataset(v **types.Dataset, value interface{}) error {
3418	if v == nil {
3419		return fmt.Errorf("unexpected nil of type %T", v)
3420	}
3421	if value == nil {
3422		return nil
3423	}
3424
3425	shape, ok := value.(map[string]interface{})
3426	if !ok {
3427		return fmt.Errorf("unexpected JSON type %v", value)
3428	}
3429
3430	var sv *types.Dataset
3431	if *v == nil {
3432		sv = &types.Dataset{}
3433	} else {
3434		sv = *v
3435	}
3436
3437	for key, value := range shape {
3438		switch key {
3439		case "CreationDate":
3440			if value != nil {
3441				jtv, ok := value.(json.Number)
3442				if !ok {
3443					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
3444				}
3445				f64, err := jtv.Float64()
3446				if err != nil {
3447					return err
3448				}
3449				sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64))
3450			}
3451
3452		case "DatasetName":
3453			if value != nil {
3454				jtv, ok := value.(string)
3455				if !ok {
3456					return fmt.Errorf("expected DatasetName to be of type string, got %T instead", value)
3457				}
3458				sv.DatasetName = ptr.String(jtv)
3459			}
3460
3461		case "DataStorage":
3462			if value != nil {
3463				jtv, ok := value.(json.Number)
3464				if !ok {
3465					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
3466				}
3467				i64, err := jtv.Int64()
3468				if err != nil {
3469					return err
3470				}
3471				sv.DataStorage = ptr.Int64(i64)
3472			}
3473
3474		case "IdentityId":
3475			if value != nil {
3476				jtv, ok := value.(string)
3477				if !ok {
3478					return fmt.Errorf("expected IdentityId to be of type string, got %T instead", value)
3479				}
3480				sv.IdentityId = ptr.String(jtv)
3481			}
3482
3483		case "LastModifiedBy":
3484			if value != nil {
3485				jtv, ok := value.(string)
3486				if !ok {
3487					return fmt.Errorf("expected String to be of type string, got %T instead", value)
3488				}
3489				sv.LastModifiedBy = ptr.String(jtv)
3490			}
3491
3492		case "LastModifiedDate":
3493			if value != nil {
3494				jtv, ok := value.(json.Number)
3495				if !ok {
3496					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
3497				}
3498				f64, err := jtv.Float64()
3499				if err != nil {
3500					return err
3501				}
3502				sv.LastModifiedDate = ptr.Time(smithytime.ParseEpochSeconds(f64))
3503			}
3504
3505		case "NumRecords":
3506			if value != nil {
3507				jtv, ok := value.(json.Number)
3508				if !ok {
3509					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
3510				}
3511				i64, err := jtv.Int64()
3512				if err != nil {
3513					return err
3514				}
3515				sv.NumRecords = ptr.Int64(i64)
3516			}
3517
3518		default:
3519			_, _ = key, value
3520
3521		}
3522	}
3523	*v = sv
3524	return nil
3525}
3526
3527func awsRestjson1_deserializeDocumentDatasetList(v *[]types.Dataset, value interface{}) error {
3528	if v == nil {
3529		return fmt.Errorf("unexpected nil of type %T", v)
3530	}
3531	if value == nil {
3532		return nil
3533	}
3534
3535	shape, ok := value.([]interface{})
3536	if !ok {
3537		return fmt.Errorf("unexpected JSON type %v", value)
3538	}
3539
3540	var cv []types.Dataset
3541	if *v == nil {
3542		cv = []types.Dataset{}
3543	} else {
3544		cv = *v
3545	}
3546
3547	for _, value := range shape {
3548		var col types.Dataset
3549		destAddr := &col
3550		if err := awsRestjson1_deserializeDocumentDataset(&destAddr, value); err != nil {
3551			return err
3552		}
3553		col = *destAddr
3554		cv = append(cv, col)
3555
3556	}
3557	*v = cv
3558	return nil
3559}
3560
3561func awsRestjson1_deserializeDocumentDuplicateRequestException(v **types.DuplicateRequestException, value interface{}) error {
3562	if v == nil {
3563		return fmt.Errorf("unexpected nil of type %T", v)
3564	}
3565	if value == nil {
3566		return nil
3567	}
3568
3569	shape, ok := value.(map[string]interface{})
3570	if !ok {
3571		return fmt.Errorf("unexpected JSON type %v", value)
3572	}
3573
3574	var sv *types.DuplicateRequestException
3575	if *v == nil {
3576		sv = &types.DuplicateRequestException{}
3577	} else {
3578		sv = *v
3579	}
3580
3581	for key, value := range shape {
3582		switch key {
3583		case "message":
3584			if value != nil {
3585				jtv, ok := value.(string)
3586				if !ok {
3587					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
3588				}
3589				sv.Message = ptr.String(jtv)
3590			}
3591
3592		default:
3593			_, _ = key, value
3594
3595		}
3596	}
3597	*v = sv
3598	return nil
3599}
3600
3601func awsRestjson1_deserializeDocumentEvents(v *map[string]string, value interface{}) error {
3602	if v == nil {
3603		return fmt.Errorf("unexpected nil of type %T", v)
3604	}
3605	if value == nil {
3606		return nil
3607	}
3608
3609	shape, ok := value.(map[string]interface{})
3610	if !ok {
3611		return fmt.Errorf("unexpected JSON type %v", value)
3612	}
3613
3614	var mv map[string]string
3615	if *v == nil {
3616		mv = map[string]string{}
3617	} else {
3618		mv = *v
3619	}
3620
3621	for key, value := range shape {
3622		var parsedVal string
3623		if value != nil {
3624			jtv, ok := value.(string)
3625			if !ok {
3626				return fmt.Errorf("expected LambdaFunctionArn to be of type string, got %T instead", value)
3627			}
3628			parsedVal = jtv
3629		}
3630		mv[key] = parsedVal
3631
3632	}
3633	*v = mv
3634	return nil
3635}
3636
3637func awsRestjson1_deserializeDocumentIdentityPoolUsage(v **types.IdentityPoolUsage, value interface{}) error {
3638	if v == nil {
3639		return fmt.Errorf("unexpected nil of type %T", v)
3640	}
3641	if value == nil {
3642		return nil
3643	}
3644
3645	shape, ok := value.(map[string]interface{})
3646	if !ok {
3647		return fmt.Errorf("unexpected JSON type %v", value)
3648	}
3649
3650	var sv *types.IdentityPoolUsage
3651	if *v == nil {
3652		sv = &types.IdentityPoolUsage{}
3653	} else {
3654		sv = *v
3655	}
3656
3657	for key, value := range shape {
3658		switch key {
3659		case "DataStorage":
3660			if value != nil {
3661				jtv, ok := value.(json.Number)
3662				if !ok {
3663					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
3664				}
3665				i64, err := jtv.Int64()
3666				if err != nil {
3667					return err
3668				}
3669				sv.DataStorage = ptr.Int64(i64)
3670			}
3671
3672		case "IdentityPoolId":
3673			if value != nil {
3674				jtv, ok := value.(string)
3675				if !ok {
3676					return fmt.Errorf("expected IdentityPoolId to be of type string, got %T instead", value)
3677				}
3678				sv.IdentityPoolId = ptr.String(jtv)
3679			}
3680
3681		case "LastModifiedDate":
3682			if value != nil {
3683				jtv, ok := value.(json.Number)
3684				if !ok {
3685					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
3686				}
3687				f64, err := jtv.Float64()
3688				if err != nil {
3689					return err
3690				}
3691				sv.LastModifiedDate = ptr.Time(smithytime.ParseEpochSeconds(f64))
3692			}
3693
3694		case "SyncSessionsCount":
3695			if value != nil {
3696				jtv, ok := value.(json.Number)
3697				if !ok {
3698					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
3699				}
3700				i64, err := jtv.Int64()
3701				if err != nil {
3702					return err
3703				}
3704				sv.SyncSessionsCount = ptr.Int64(i64)
3705			}
3706
3707		default:
3708			_, _ = key, value
3709
3710		}
3711	}
3712	*v = sv
3713	return nil
3714}
3715
3716func awsRestjson1_deserializeDocumentIdentityPoolUsageList(v *[]types.IdentityPoolUsage, value interface{}) error {
3717	if v == nil {
3718		return fmt.Errorf("unexpected nil of type %T", v)
3719	}
3720	if value == nil {
3721		return nil
3722	}
3723
3724	shape, ok := value.([]interface{})
3725	if !ok {
3726		return fmt.Errorf("unexpected JSON type %v", value)
3727	}
3728
3729	var cv []types.IdentityPoolUsage
3730	if *v == nil {
3731		cv = []types.IdentityPoolUsage{}
3732	} else {
3733		cv = *v
3734	}
3735
3736	for _, value := range shape {
3737		var col types.IdentityPoolUsage
3738		destAddr := &col
3739		if err := awsRestjson1_deserializeDocumentIdentityPoolUsage(&destAddr, value); err != nil {
3740			return err
3741		}
3742		col = *destAddr
3743		cv = append(cv, col)
3744
3745	}
3746	*v = cv
3747	return nil
3748}
3749
3750func awsRestjson1_deserializeDocumentIdentityUsage(v **types.IdentityUsage, value interface{}) error {
3751	if v == nil {
3752		return fmt.Errorf("unexpected nil of type %T", v)
3753	}
3754	if value == nil {
3755		return nil
3756	}
3757
3758	shape, ok := value.(map[string]interface{})
3759	if !ok {
3760		return fmt.Errorf("unexpected JSON type %v", value)
3761	}
3762
3763	var sv *types.IdentityUsage
3764	if *v == nil {
3765		sv = &types.IdentityUsage{}
3766	} else {
3767		sv = *v
3768	}
3769
3770	for key, value := range shape {
3771		switch key {
3772		case "DatasetCount":
3773			if value != nil {
3774				jtv, ok := value.(json.Number)
3775				if !ok {
3776					return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
3777				}
3778				i64, err := jtv.Int64()
3779				if err != nil {
3780					return err
3781				}
3782				sv.DatasetCount = int32(i64)
3783			}
3784
3785		case "DataStorage":
3786			if value != nil {
3787				jtv, ok := value.(json.Number)
3788				if !ok {
3789					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
3790				}
3791				i64, err := jtv.Int64()
3792				if err != nil {
3793					return err
3794				}
3795				sv.DataStorage = ptr.Int64(i64)
3796			}
3797
3798		case "IdentityId":
3799			if value != nil {
3800				jtv, ok := value.(string)
3801				if !ok {
3802					return fmt.Errorf("expected IdentityId to be of type string, got %T instead", value)
3803				}
3804				sv.IdentityId = ptr.String(jtv)
3805			}
3806
3807		case "IdentityPoolId":
3808			if value != nil {
3809				jtv, ok := value.(string)
3810				if !ok {
3811					return fmt.Errorf("expected IdentityPoolId to be of type string, got %T instead", value)
3812				}
3813				sv.IdentityPoolId = ptr.String(jtv)
3814			}
3815
3816		case "LastModifiedDate":
3817			if value != nil {
3818				jtv, ok := value.(json.Number)
3819				if !ok {
3820					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
3821				}
3822				f64, err := jtv.Float64()
3823				if err != nil {
3824					return err
3825				}
3826				sv.LastModifiedDate = ptr.Time(smithytime.ParseEpochSeconds(f64))
3827			}
3828
3829		default:
3830			_, _ = key, value
3831
3832		}
3833	}
3834	*v = sv
3835	return nil
3836}
3837
3838func awsRestjson1_deserializeDocumentInternalErrorException(v **types.InternalErrorException, value interface{}) error {
3839	if v == nil {
3840		return fmt.Errorf("unexpected nil of type %T", v)
3841	}
3842	if value == nil {
3843		return nil
3844	}
3845
3846	shape, ok := value.(map[string]interface{})
3847	if !ok {
3848		return fmt.Errorf("unexpected JSON type %v", value)
3849	}
3850
3851	var sv *types.InternalErrorException
3852	if *v == nil {
3853		sv = &types.InternalErrorException{}
3854	} else {
3855		sv = *v
3856	}
3857
3858	for key, value := range shape {
3859		switch key {
3860		case "message":
3861			if value != nil {
3862				jtv, ok := value.(string)
3863				if !ok {
3864					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
3865				}
3866				sv.Message = ptr.String(jtv)
3867			}
3868
3869		default:
3870			_, _ = key, value
3871
3872		}
3873	}
3874	*v = sv
3875	return nil
3876}
3877
3878func awsRestjson1_deserializeDocumentInvalidConfigurationException(v **types.InvalidConfigurationException, value interface{}) error {
3879	if v == nil {
3880		return fmt.Errorf("unexpected nil of type %T", v)
3881	}
3882	if value == nil {
3883		return nil
3884	}
3885
3886	shape, ok := value.(map[string]interface{})
3887	if !ok {
3888		return fmt.Errorf("unexpected JSON type %v", value)
3889	}
3890
3891	var sv *types.InvalidConfigurationException
3892	if *v == nil {
3893		sv = &types.InvalidConfigurationException{}
3894	} else {
3895		sv = *v
3896	}
3897
3898	for key, value := range shape {
3899		switch key {
3900		case "message":
3901			if value != nil {
3902				jtv, ok := value.(string)
3903				if !ok {
3904					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
3905				}
3906				sv.Message = ptr.String(jtv)
3907			}
3908
3909		default:
3910			_, _ = key, value
3911
3912		}
3913	}
3914	*v = sv
3915	return nil
3916}
3917
3918func awsRestjson1_deserializeDocumentInvalidLambdaFunctionOutputException(v **types.InvalidLambdaFunctionOutputException, value interface{}) error {
3919	if v == nil {
3920		return fmt.Errorf("unexpected nil of type %T", v)
3921	}
3922	if value == nil {
3923		return nil
3924	}
3925
3926	shape, ok := value.(map[string]interface{})
3927	if !ok {
3928		return fmt.Errorf("unexpected JSON type %v", value)
3929	}
3930
3931	var sv *types.InvalidLambdaFunctionOutputException
3932	if *v == nil {
3933		sv = &types.InvalidLambdaFunctionOutputException{}
3934	} else {
3935		sv = *v
3936	}
3937
3938	for key, value := range shape {
3939		switch key {
3940		case "message":
3941			if value != nil {
3942				jtv, ok := value.(string)
3943				if !ok {
3944					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
3945				}
3946				sv.Message = ptr.String(jtv)
3947			}
3948
3949		default:
3950			_, _ = key, value
3951
3952		}
3953	}
3954	*v = sv
3955	return nil
3956}
3957
3958func awsRestjson1_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error {
3959	if v == nil {
3960		return fmt.Errorf("unexpected nil of type %T", v)
3961	}
3962	if value == nil {
3963		return nil
3964	}
3965
3966	shape, ok := value.(map[string]interface{})
3967	if !ok {
3968		return fmt.Errorf("unexpected JSON type %v", value)
3969	}
3970
3971	var sv *types.InvalidParameterException
3972	if *v == nil {
3973		sv = &types.InvalidParameterException{}
3974	} else {
3975		sv = *v
3976	}
3977
3978	for key, value := range shape {
3979		switch key {
3980		case "message":
3981			if value != nil {
3982				jtv, ok := value.(string)
3983				if !ok {
3984					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
3985				}
3986				sv.Message = ptr.String(jtv)
3987			}
3988
3989		default:
3990			_, _ = key, value
3991
3992		}
3993	}
3994	*v = sv
3995	return nil
3996}
3997
3998func awsRestjson1_deserializeDocumentLambdaThrottledException(v **types.LambdaThrottledException, value interface{}) error {
3999	if v == nil {
4000		return fmt.Errorf("unexpected nil of type %T", v)
4001	}
4002	if value == nil {
4003		return nil
4004	}
4005
4006	shape, ok := value.(map[string]interface{})
4007	if !ok {
4008		return fmt.Errorf("unexpected JSON type %v", value)
4009	}
4010
4011	var sv *types.LambdaThrottledException
4012	if *v == nil {
4013		sv = &types.LambdaThrottledException{}
4014	} else {
4015		sv = *v
4016	}
4017
4018	for key, value := range shape {
4019		switch key {
4020		case "message":
4021			if value != nil {
4022				jtv, ok := value.(string)
4023				if !ok {
4024					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
4025				}
4026				sv.Message = ptr.String(jtv)
4027			}
4028
4029		default:
4030			_, _ = key, value
4031
4032		}
4033	}
4034	*v = sv
4035	return nil
4036}
4037
4038func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error {
4039	if v == nil {
4040		return fmt.Errorf("unexpected nil of type %T", v)
4041	}
4042	if value == nil {
4043		return nil
4044	}
4045
4046	shape, ok := value.(map[string]interface{})
4047	if !ok {
4048		return fmt.Errorf("unexpected JSON type %v", value)
4049	}
4050
4051	var sv *types.LimitExceededException
4052	if *v == nil {
4053		sv = &types.LimitExceededException{}
4054	} else {
4055		sv = *v
4056	}
4057
4058	for key, value := range shape {
4059		switch key {
4060		case "message":
4061			if value != nil {
4062				jtv, ok := value.(string)
4063				if !ok {
4064					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
4065				}
4066				sv.Message = ptr.String(jtv)
4067			}
4068
4069		default:
4070			_, _ = key, value
4071
4072		}
4073	}
4074	*v = sv
4075	return nil
4076}
4077
4078func awsRestjson1_deserializeDocumentMergedDatasetNameList(v *[]string, value interface{}) error {
4079	if v == nil {
4080		return fmt.Errorf("unexpected nil of type %T", v)
4081	}
4082	if value == nil {
4083		return nil
4084	}
4085
4086	shape, ok := value.([]interface{})
4087	if !ok {
4088		return fmt.Errorf("unexpected JSON type %v", value)
4089	}
4090
4091	var cv []string
4092	if *v == nil {
4093		cv = []string{}
4094	} else {
4095		cv = *v
4096	}
4097
4098	for _, value := range shape {
4099		var col string
4100		if value != nil {
4101			jtv, ok := value.(string)
4102			if !ok {
4103				return fmt.Errorf("expected String to be of type string, got %T instead", value)
4104			}
4105			col = jtv
4106		}
4107		cv = append(cv, col)
4108
4109	}
4110	*v = cv
4111	return nil
4112}
4113
4114func awsRestjson1_deserializeDocumentNotAuthorizedException(v **types.NotAuthorizedException, value interface{}) error {
4115	if v == nil {
4116		return fmt.Errorf("unexpected nil of type %T", v)
4117	}
4118	if value == nil {
4119		return nil
4120	}
4121
4122	shape, ok := value.(map[string]interface{})
4123	if !ok {
4124		return fmt.Errorf("unexpected JSON type %v", value)
4125	}
4126
4127	var sv *types.NotAuthorizedException
4128	if *v == nil {
4129		sv = &types.NotAuthorizedException{}
4130	} else {
4131		sv = *v
4132	}
4133
4134	for key, value := range shape {
4135		switch key {
4136		case "message":
4137			if value != nil {
4138				jtv, ok := value.(string)
4139				if !ok {
4140					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
4141				}
4142				sv.Message = ptr.String(jtv)
4143			}
4144
4145		default:
4146			_, _ = key, value
4147
4148		}
4149	}
4150	*v = sv
4151	return nil
4152}
4153
4154func awsRestjson1_deserializeDocumentPushSync(v **types.PushSync, value interface{}) error {
4155	if v == nil {
4156		return fmt.Errorf("unexpected nil of type %T", v)
4157	}
4158	if value == nil {
4159		return nil
4160	}
4161
4162	shape, ok := value.(map[string]interface{})
4163	if !ok {
4164		return fmt.Errorf("unexpected JSON type %v", value)
4165	}
4166
4167	var sv *types.PushSync
4168	if *v == nil {
4169		sv = &types.PushSync{}
4170	} else {
4171		sv = *v
4172	}
4173
4174	for key, value := range shape {
4175		switch key {
4176		case "ApplicationArns":
4177			if err := awsRestjson1_deserializeDocumentApplicationArnList(&sv.ApplicationArns, value); err != nil {
4178				return err
4179			}
4180
4181		case "RoleArn":
4182			if value != nil {
4183				jtv, ok := value.(string)
4184				if !ok {
4185					return fmt.Errorf("expected AssumeRoleArn to be of type string, got %T instead", value)
4186				}
4187				sv.RoleArn = ptr.String(jtv)
4188			}
4189
4190		default:
4191			_, _ = key, value
4192
4193		}
4194	}
4195	*v = sv
4196	return nil
4197}
4198
4199func awsRestjson1_deserializeDocumentRecord(v **types.Record, value interface{}) error {
4200	if v == nil {
4201		return fmt.Errorf("unexpected nil of type %T", v)
4202	}
4203	if value == nil {
4204		return nil
4205	}
4206
4207	shape, ok := value.(map[string]interface{})
4208	if !ok {
4209		return fmt.Errorf("unexpected JSON type %v", value)
4210	}
4211
4212	var sv *types.Record
4213	if *v == nil {
4214		sv = &types.Record{}
4215	} else {
4216		sv = *v
4217	}
4218
4219	for key, value := range shape {
4220		switch key {
4221		case "DeviceLastModifiedDate":
4222			if value != nil {
4223				jtv, ok := value.(json.Number)
4224				if !ok {
4225					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
4226				}
4227				f64, err := jtv.Float64()
4228				if err != nil {
4229					return err
4230				}
4231				sv.DeviceLastModifiedDate = ptr.Time(smithytime.ParseEpochSeconds(f64))
4232			}
4233
4234		case "Key":
4235			if value != nil {
4236				jtv, ok := value.(string)
4237				if !ok {
4238					return fmt.Errorf("expected RecordKey to be of type string, got %T instead", value)
4239				}
4240				sv.Key = ptr.String(jtv)
4241			}
4242
4243		case "LastModifiedBy":
4244			if value != nil {
4245				jtv, ok := value.(string)
4246				if !ok {
4247					return fmt.Errorf("expected String to be of type string, got %T instead", value)
4248				}
4249				sv.LastModifiedBy = ptr.String(jtv)
4250			}
4251
4252		case "LastModifiedDate":
4253			if value != nil {
4254				jtv, ok := value.(json.Number)
4255				if !ok {
4256					return fmt.Errorf("expected Date to be json.Number, got %T instead", value)
4257				}
4258				f64, err := jtv.Float64()
4259				if err != nil {
4260					return err
4261				}
4262				sv.LastModifiedDate = ptr.Time(smithytime.ParseEpochSeconds(f64))
4263			}
4264
4265		case "SyncCount":
4266			if value != nil {
4267				jtv, ok := value.(json.Number)
4268				if !ok {
4269					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
4270				}
4271				i64, err := jtv.Int64()
4272				if err != nil {
4273					return err
4274				}
4275				sv.SyncCount = ptr.Int64(i64)
4276			}
4277
4278		case "Value":
4279			if value != nil {
4280				jtv, ok := value.(string)
4281				if !ok {
4282					return fmt.Errorf("expected RecordValue to be of type string, got %T instead", value)
4283				}
4284				sv.Value = ptr.String(jtv)
4285			}
4286
4287		default:
4288			_, _ = key, value
4289
4290		}
4291	}
4292	*v = sv
4293	return nil
4294}
4295
4296func awsRestjson1_deserializeDocumentRecordList(v *[]types.Record, value interface{}) error {
4297	if v == nil {
4298		return fmt.Errorf("unexpected nil of type %T", v)
4299	}
4300	if value == nil {
4301		return nil
4302	}
4303
4304	shape, ok := value.([]interface{})
4305	if !ok {
4306		return fmt.Errorf("unexpected JSON type %v", value)
4307	}
4308
4309	var cv []types.Record
4310	if *v == nil {
4311		cv = []types.Record{}
4312	} else {
4313		cv = *v
4314	}
4315
4316	for _, value := range shape {
4317		var col types.Record
4318		destAddr := &col
4319		if err := awsRestjson1_deserializeDocumentRecord(&destAddr, value); err != nil {
4320			return err
4321		}
4322		col = *destAddr
4323		cv = append(cv, col)
4324
4325	}
4326	*v = cv
4327	return nil
4328}
4329
4330func awsRestjson1_deserializeDocumentResourceConflictException(v **types.ResourceConflictException, value interface{}) error {
4331	if v == nil {
4332		return fmt.Errorf("unexpected nil of type %T", v)
4333	}
4334	if value == nil {
4335		return nil
4336	}
4337
4338	shape, ok := value.(map[string]interface{})
4339	if !ok {
4340		return fmt.Errorf("unexpected JSON type %v", value)
4341	}
4342
4343	var sv *types.ResourceConflictException
4344	if *v == nil {
4345		sv = &types.ResourceConflictException{}
4346	} else {
4347		sv = *v
4348	}
4349
4350	for key, value := range shape {
4351		switch key {
4352		case "message":
4353			if value != nil {
4354				jtv, ok := value.(string)
4355				if !ok {
4356					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
4357				}
4358				sv.Message = ptr.String(jtv)
4359			}
4360
4361		default:
4362			_, _ = key, value
4363
4364		}
4365	}
4366	*v = sv
4367	return nil
4368}
4369
4370func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error {
4371	if v == nil {
4372		return fmt.Errorf("unexpected nil of type %T", v)
4373	}
4374	if value == nil {
4375		return nil
4376	}
4377
4378	shape, ok := value.(map[string]interface{})
4379	if !ok {
4380		return fmt.Errorf("unexpected JSON type %v", value)
4381	}
4382
4383	var sv *types.ResourceNotFoundException
4384	if *v == nil {
4385		sv = &types.ResourceNotFoundException{}
4386	} else {
4387		sv = *v
4388	}
4389
4390	for key, value := range shape {
4391		switch key {
4392		case "message":
4393			if value != nil {
4394				jtv, ok := value.(string)
4395				if !ok {
4396					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
4397				}
4398				sv.Message = ptr.String(jtv)
4399			}
4400
4401		default:
4402			_, _ = key, value
4403
4404		}
4405	}
4406	*v = sv
4407	return nil
4408}
4409
4410func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error {
4411	if v == nil {
4412		return fmt.Errorf("unexpected nil of type %T", v)
4413	}
4414	if value == nil {
4415		return nil
4416	}
4417
4418	shape, ok := value.(map[string]interface{})
4419	if !ok {
4420		return fmt.Errorf("unexpected JSON type %v", value)
4421	}
4422
4423	var sv *types.TooManyRequestsException
4424	if *v == nil {
4425		sv = &types.TooManyRequestsException{}
4426	} else {
4427		sv = *v
4428	}
4429
4430	for key, value := range shape {
4431		switch key {
4432		case "message":
4433			if value != nil {
4434				jtv, ok := value.(string)
4435				if !ok {
4436					return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
4437				}
4438				sv.Message = ptr.String(jtv)
4439			}
4440
4441		default:
4442			_, _ = key, value
4443
4444		}
4445	}
4446	*v = sv
4447	return nil
4448}
4449