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