1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package braket
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/braket/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	"strings"
20)
21
22type awsRestjson1_deserializeOpCancelQuantumTask struct {
23}
24
25func (*awsRestjson1_deserializeOpCancelQuantumTask) ID() string {
26	return "OperationDeserializer"
27}
28
29func (m *awsRestjson1_deserializeOpCancelQuantumTask) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
30	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
31) {
32	out, metadata, err = next.HandleDeserialize(ctx, in)
33	if err != nil {
34		return out, metadata, err
35	}
36
37	response, ok := out.RawResponse.(*smithyhttp.Response)
38	if !ok {
39		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
40	}
41
42	if response.StatusCode < 200 || response.StatusCode >= 300 {
43		return out, metadata, awsRestjson1_deserializeOpErrorCancelQuantumTask(response, &metadata)
44	}
45	output := &CancelQuantumTaskOutput{}
46	out.Result = output
47
48	var buff [1024]byte
49	ringBuffer := smithyio.NewRingBuffer(buff[:])
50
51	body := io.TeeReader(response.Body, ringBuffer)
52
53	decoder := json.NewDecoder(body)
54	decoder.UseNumber()
55	var shape interface{}
56	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
57		var snapshot bytes.Buffer
58		io.Copy(&snapshot, ringBuffer)
59		err = &smithy.DeserializationError{
60			Err:      fmt.Errorf("failed to decode response body, %w", err),
61			Snapshot: snapshot.Bytes(),
62		}
63		return out, metadata, err
64	}
65
66	err = awsRestjson1_deserializeOpDocumentCancelQuantumTaskOutput(&output, shape)
67	if err != nil {
68		var snapshot bytes.Buffer
69		io.Copy(&snapshot, ringBuffer)
70		return out, metadata, &smithy.DeserializationError{
71			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
72			Snapshot: snapshot.Bytes(),
73		}
74	}
75
76	return out, metadata, err
77}
78
79func awsRestjson1_deserializeOpErrorCancelQuantumTask(response *smithyhttp.Response, metadata *middleware.Metadata) error {
80	var errorBuffer bytes.Buffer
81	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
82		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
83	}
84	errorBody := bytes.NewReader(errorBuffer.Bytes())
85
86	errorCode := "UnknownError"
87	errorMessage := errorCode
88
89	code := response.Header.Get("X-Amzn-ErrorType")
90	if len(code) != 0 {
91		errorCode = restjson.SanitizeErrorCode(code)
92	}
93
94	var buff [1024]byte
95	ringBuffer := smithyio.NewRingBuffer(buff[:])
96
97	body := io.TeeReader(errorBody, ringBuffer)
98	decoder := json.NewDecoder(body)
99	decoder.UseNumber()
100	code, message, err := restjson.GetErrorInfo(decoder)
101	if err != nil {
102		var snapshot bytes.Buffer
103		io.Copy(&snapshot, ringBuffer)
104		err = &smithy.DeserializationError{
105			Err:      fmt.Errorf("failed to decode response body, %w", err),
106			Snapshot: snapshot.Bytes(),
107		}
108		return err
109	}
110
111	errorBody.Seek(0, io.SeekStart)
112	if len(code) != 0 {
113		errorCode = restjson.SanitizeErrorCode(code)
114	}
115	if len(message) != 0 {
116		errorMessage = message
117	}
118
119	switch {
120	case strings.EqualFold("AccessDeniedException", errorCode):
121		return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
122
123	case strings.EqualFold("ConflictException", errorCode):
124		return awsRestjson1_deserializeErrorConflictException(response, errorBody)
125
126	case strings.EqualFold("InternalServiceException", errorCode):
127		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
128
129	case strings.EqualFold("ResourceNotFoundException", errorCode):
130		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
131
132	case strings.EqualFold("ThrottlingException", errorCode):
133		return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
134
135	case strings.EqualFold("ValidationException", errorCode):
136		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
137
138	default:
139		genericError := &smithy.GenericAPIError{
140			Code:    errorCode,
141			Message: errorMessage,
142		}
143		return genericError
144
145	}
146}
147
148func awsRestjson1_deserializeOpDocumentCancelQuantumTaskOutput(v **CancelQuantumTaskOutput, value interface{}) error {
149	if v == nil {
150		return fmt.Errorf("unexpected nil of type %T", v)
151	}
152	if value == nil {
153		return nil
154	}
155
156	shape, ok := value.(map[string]interface{})
157	if !ok {
158		return fmt.Errorf("unexpected JSON type %v", value)
159	}
160
161	var sv *CancelQuantumTaskOutput
162	if *v == nil {
163		sv = &CancelQuantumTaskOutput{}
164	} else {
165		sv = *v
166	}
167
168	for key, value := range shape {
169		switch key {
170		case "cancellationStatus":
171			if value != nil {
172				jtv, ok := value.(string)
173				if !ok {
174					return fmt.Errorf("expected CancellationStatus to be of type string, got %T instead", value)
175				}
176				sv.CancellationStatus = types.CancellationStatus(jtv)
177			}
178
179		case "quantumTaskArn":
180			if value != nil {
181				jtv, ok := value.(string)
182				if !ok {
183					return fmt.Errorf("expected QuantumTaskArn to be of type string, got %T instead", value)
184				}
185				sv.QuantumTaskArn = ptr.String(jtv)
186			}
187
188		default:
189			_, _ = key, value
190
191		}
192	}
193	*v = sv
194	return nil
195}
196
197type awsRestjson1_deserializeOpCreateQuantumTask struct {
198}
199
200func (*awsRestjson1_deserializeOpCreateQuantumTask) ID() string {
201	return "OperationDeserializer"
202}
203
204func (m *awsRestjson1_deserializeOpCreateQuantumTask) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
205	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
206) {
207	out, metadata, err = next.HandleDeserialize(ctx, in)
208	if err != nil {
209		return out, metadata, err
210	}
211
212	response, ok := out.RawResponse.(*smithyhttp.Response)
213	if !ok {
214		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
215	}
216
217	if response.StatusCode < 200 || response.StatusCode >= 300 {
218		return out, metadata, awsRestjson1_deserializeOpErrorCreateQuantumTask(response, &metadata)
219	}
220	output := &CreateQuantumTaskOutput{}
221	out.Result = output
222
223	var buff [1024]byte
224	ringBuffer := smithyio.NewRingBuffer(buff[:])
225
226	body := io.TeeReader(response.Body, ringBuffer)
227
228	decoder := json.NewDecoder(body)
229	decoder.UseNumber()
230	var shape interface{}
231	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
232		var snapshot bytes.Buffer
233		io.Copy(&snapshot, ringBuffer)
234		err = &smithy.DeserializationError{
235			Err:      fmt.Errorf("failed to decode response body, %w", err),
236			Snapshot: snapshot.Bytes(),
237		}
238		return out, metadata, err
239	}
240
241	err = awsRestjson1_deserializeOpDocumentCreateQuantumTaskOutput(&output, shape)
242	if err != nil {
243		var snapshot bytes.Buffer
244		io.Copy(&snapshot, ringBuffer)
245		return out, metadata, &smithy.DeserializationError{
246			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
247			Snapshot: snapshot.Bytes(),
248		}
249	}
250
251	return out, metadata, err
252}
253
254func awsRestjson1_deserializeOpErrorCreateQuantumTask(response *smithyhttp.Response, metadata *middleware.Metadata) error {
255	var errorBuffer bytes.Buffer
256	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
257		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
258	}
259	errorBody := bytes.NewReader(errorBuffer.Bytes())
260
261	errorCode := "UnknownError"
262	errorMessage := errorCode
263
264	code := response.Header.Get("X-Amzn-ErrorType")
265	if len(code) != 0 {
266		errorCode = restjson.SanitizeErrorCode(code)
267	}
268
269	var buff [1024]byte
270	ringBuffer := smithyio.NewRingBuffer(buff[:])
271
272	body := io.TeeReader(errorBody, ringBuffer)
273	decoder := json.NewDecoder(body)
274	decoder.UseNumber()
275	code, message, err := restjson.GetErrorInfo(decoder)
276	if err != nil {
277		var snapshot bytes.Buffer
278		io.Copy(&snapshot, ringBuffer)
279		err = &smithy.DeserializationError{
280			Err:      fmt.Errorf("failed to decode response body, %w", err),
281			Snapshot: snapshot.Bytes(),
282		}
283		return err
284	}
285
286	errorBody.Seek(0, io.SeekStart)
287	if len(code) != 0 {
288		errorCode = restjson.SanitizeErrorCode(code)
289	}
290	if len(message) != 0 {
291		errorMessage = message
292	}
293
294	switch {
295	case strings.EqualFold("AccessDeniedException", errorCode):
296		return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
297
298	case strings.EqualFold("DeviceOfflineException", errorCode):
299		return awsRestjson1_deserializeErrorDeviceOfflineException(response, errorBody)
300
301	case strings.EqualFold("InternalServiceException", errorCode):
302		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
303
304	case strings.EqualFold("ServiceQuotaExceededException", errorCode):
305		return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
306
307	case strings.EqualFold("ThrottlingException", errorCode):
308		return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
309
310	case strings.EqualFold("ValidationException", errorCode):
311		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
312
313	default:
314		genericError := &smithy.GenericAPIError{
315			Code:    errorCode,
316			Message: errorMessage,
317		}
318		return genericError
319
320	}
321}
322
323func awsRestjson1_deserializeOpDocumentCreateQuantumTaskOutput(v **CreateQuantumTaskOutput, value interface{}) error {
324	if v == nil {
325		return fmt.Errorf("unexpected nil of type %T", v)
326	}
327	if value == nil {
328		return nil
329	}
330
331	shape, ok := value.(map[string]interface{})
332	if !ok {
333		return fmt.Errorf("unexpected JSON type %v", value)
334	}
335
336	var sv *CreateQuantumTaskOutput
337	if *v == nil {
338		sv = &CreateQuantumTaskOutput{}
339	} else {
340		sv = *v
341	}
342
343	for key, value := range shape {
344		switch key {
345		case "quantumTaskArn":
346			if value != nil {
347				jtv, ok := value.(string)
348				if !ok {
349					return fmt.Errorf("expected QuantumTaskArn to be of type string, got %T instead", value)
350				}
351				sv.QuantumTaskArn = ptr.String(jtv)
352			}
353
354		default:
355			_, _ = key, value
356
357		}
358	}
359	*v = sv
360	return nil
361}
362
363type awsRestjson1_deserializeOpGetDevice struct {
364}
365
366func (*awsRestjson1_deserializeOpGetDevice) ID() string {
367	return "OperationDeserializer"
368}
369
370func (m *awsRestjson1_deserializeOpGetDevice) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
371	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
372) {
373	out, metadata, err = next.HandleDeserialize(ctx, in)
374	if err != nil {
375		return out, metadata, err
376	}
377
378	response, ok := out.RawResponse.(*smithyhttp.Response)
379	if !ok {
380		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
381	}
382
383	if response.StatusCode < 200 || response.StatusCode >= 300 {
384		return out, metadata, awsRestjson1_deserializeOpErrorGetDevice(response, &metadata)
385	}
386	output := &GetDeviceOutput{}
387	out.Result = output
388
389	var buff [1024]byte
390	ringBuffer := smithyio.NewRingBuffer(buff[:])
391
392	body := io.TeeReader(response.Body, ringBuffer)
393
394	decoder := json.NewDecoder(body)
395	decoder.UseNumber()
396	var shape interface{}
397	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
398		var snapshot bytes.Buffer
399		io.Copy(&snapshot, ringBuffer)
400		err = &smithy.DeserializationError{
401			Err:      fmt.Errorf("failed to decode response body, %w", err),
402			Snapshot: snapshot.Bytes(),
403		}
404		return out, metadata, err
405	}
406
407	err = awsRestjson1_deserializeOpDocumentGetDeviceOutput(&output, shape)
408	if err != nil {
409		var snapshot bytes.Buffer
410		io.Copy(&snapshot, ringBuffer)
411		return out, metadata, &smithy.DeserializationError{
412			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
413			Snapshot: snapshot.Bytes(),
414		}
415	}
416
417	return out, metadata, err
418}
419
420func awsRestjson1_deserializeOpErrorGetDevice(response *smithyhttp.Response, metadata *middleware.Metadata) error {
421	var errorBuffer bytes.Buffer
422	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
423		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
424	}
425	errorBody := bytes.NewReader(errorBuffer.Bytes())
426
427	errorCode := "UnknownError"
428	errorMessage := errorCode
429
430	code := response.Header.Get("X-Amzn-ErrorType")
431	if len(code) != 0 {
432		errorCode = restjson.SanitizeErrorCode(code)
433	}
434
435	var buff [1024]byte
436	ringBuffer := smithyio.NewRingBuffer(buff[:])
437
438	body := io.TeeReader(errorBody, ringBuffer)
439	decoder := json.NewDecoder(body)
440	decoder.UseNumber()
441	code, message, err := restjson.GetErrorInfo(decoder)
442	if err != nil {
443		var snapshot bytes.Buffer
444		io.Copy(&snapshot, ringBuffer)
445		err = &smithy.DeserializationError{
446			Err:      fmt.Errorf("failed to decode response body, %w", err),
447			Snapshot: snapshot.Bytes(),
448		}
449		return err
450	}
451
452	errorBody.Seek(0, io.SeekStart)
453	if len(code) != 0 {
454		errorCode = restjson.SanitizeErrorCode(code)
455	}
456	if len(message) != 0 {
457		errorMessage = message
458	}
459
460	switch {
461	case strings.EqualFold("AccessDeniedException", errorCode):
462		return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
463
464	case strings.EqualFold("DeviceOfflineException", errorCode):
465		return awsRestjson1_deserializeErrorDeviceOfflineException(response, errorBody)
466
467	case strings.EqualFold("DeviceRetiredException", errorCode):
468		return awsRestjson1_deserializeErrorDeviceRetiredException(response, errorBody)
469
470	case strings.EqualFold("InternalServiceException", errorCode):
471		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
472
473	case strings.EqualFold("ResourceNotFoundException", errorCode):
474		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
475
476	case strings.EqualFold("ThrottlingException", errorCode):
477		return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
478
479	case strings.EqualFold("ValidationException", errorCode):
480		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
481
482	default:
483		genericError := &smithy.GenericAPIError{
484			Code:    errorCode,
485			Message: errorMessage,
486		}
487		return genericError
488
489	}
490}
491
492func awsRestjson1_deserializeOpDocumentGetDeviceOutput(v **GetDeviceOutput, value interface{}) error {
493	if v == nil {
494		return fmt.Errorf("unexpected nil of type %T", v)
495	}
496	if value == nil {
497		return nil
498	}
499
500	shape, ok := value.(map[string]interface{})
501	if !ok {
502		return fmt.Errorf("unexpected JSON type %v", value)
503	}
504
505	var sv *GetDeviceOutput
506	if *v == nil {
507		sv = &GetDeviceOutput{}
508	} else {
509		sv = *v
510	}
511
512	for key, value := range shape {
513		switch key {
514		case "deviceArn":
515			if value != nil {
516				jtv, ok := value.(string)
517				if !ok {
518					return fmt.Errorf("expected DeviceArn to be of type string, got %T instead", value)
519				}
520				sv.DeviceArn = ptr.String(jtv)
521			}
522
523		case "deviceCapabilities":
524			if value != nil {
525				jtv, ok := value.(string)
526				if !ok {
527					return fmt.Errorf("expected JsonValue to be of type string, got %T instead", value)
528				}
529				sv.DeviceCapabilities = ptr.String(jtv)
530			}
531
532		case "deviceName":
533			if value != nil {
534				jtv, ok := value.(string)
535				if !ok {
536					return fmt.Errorf("expected String to be of type string, got %T instead", value)
537				}
538				sv.DeviceName = ptr.String(jtv)
539			}
540
541		case "deviceStatus":
542			if value != nil {
543				jtv, ok := value.(string)
544				if !ok {
545					return fmt.Errorf("expected DeviceStatus to be of type string, got %T instead", value)
546				}
547				sv.DeviceStatus = types.DeviceStatus(jtv)
548			}
549
550		case "deviceType":
551			if value != nil {
552				jtv, ok := value.(string)
553				if !ok {
554					return fmt.Errorf("expected DeviceType to be of type string, got %T instead", value)
555				}
556				sv.DeviceType = types.DeviceType(jtv)
557			}
558
559		case "providerName":
560			if value != nil {
561				jtv, ok := value.(string)
562				if !ok {
563					return fmt.Errorf("expected String to be of type string, got %T instead", value)
564				}
565				sv.ProviderName = ptr.String(jtv)
566			}
567
568		default:
569			_, _ = key, value
570
571		}
572	}
573	*v = sv
574	return nil
575}
576
577type awsRestjson1_deserializeOpGetQuantumTask struct {
578}
579
580func (*awsRestjson1_deserializeOpGetQuantumTask) ID() string {
581	return "OperationDeserializer"
582}
583
584func (m *awsRestjson1_deserializeOpGetQuantumTask) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
585	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
586) {
587	out, metadata, err = next.HandleDeserialize(ctx, in)
588	if err != nil {
589		return out, metadata, err
590	}
591
592	response, ok := out.RawResponse.(*smithyhttp.Response)
593	if !ok {
594		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
595	}
596
597	if response.StatusCode < 200 || response.StatusCode >= 300 {
598		return out, metadata, awsRestjson1_deserializeOpErrorGetQuantumTask(response, &metadata)
599	}
600	output := &GetQuantumTaskOutput{}
601	out.Result = output
602
603	var buff [1024]byte
604	ringBuffer := smithyio.NewRingBuffer(buff[:])
605
606	body := io.TeeReader(response.Body, ringBuffer)
607
608	decoder := json.NewDecoder(body)
609	decoder.UseNumber()
610	var shape interface{}
611	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
612		var snapshot bytes.Buffer
613		io.Copy(&snapshot, ringBuffer)
614		err = &smithy.DeserializationError{
615			Err:      fmt.Errorf("failed to decode response body, %w", err),
616			Snapshot: snapshot.Bytes(),
617		}
618		return out, metadata, err
619	}
620
621	err = awsRestjson1_deserializeOpDocumentGetQuantumTaskOutput(&output, shape)
622	if err != nil {
623		var snapshot bytes.Buffer
624		io.Copy(&snapshot, ringBuffer)
625		return out, metadata, &smithy.DeserializationError{
626			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
627			Snapshot: snapshot.Bytes(),
628		}
629	}
630
631	return out, metadata, err
632}
633
634func awsRestjson1_deserializeOpErrorGetQuantumTask(response *smithyhttp.Response, metadata *middleware.Metadata) error {
635	var errorBuffer bytes.Buffer
636	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
637		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
638	}
639	errorBody := bytes.NewReader(errorBuffer.Bytes())
640
641	errorCode := "UnknownError"
642	errorMessage := errorCode
643
644	code := response.Header.Get("X-Amzn-ErrorType")
645	if len(code) != 0 {
646		errorCode = restjson.SanitizeErrorCode(code)
647	}
648
649	var buff [1024]byte
650	ringBuffer := smithyio.NewRingBuffer(buff[:])
651
652	body := io.TeeReader(errorBody, ringBuffer)
653	decoder := json.NewDecoder(body)
654	decoder.UseNumber()
655	code, message, err := restjson.GetErrorInfo(decoder)
656	if err != nil {
657		var snapshot bytes.Buffer
658		io.Copy(&snapshot, ringBuffer)
659		err = &smithy.DeserializationError{
660			Err:      fmt.Errorf("failed to decode response body, %w", err),
661			Snapshot: snapshot.Bytes(),
662		}
663		return err
664	}
665
666	errorBody.Seek(0, io.SeekStart)
667	if len(code) != 0 {
668		errorCode = restjson.SanitizeErrorCode(code)
669	}
670	if len(message) != 0 {
671		errorMessage = message
672	}
673
674	switch {
675	case strings.EqualFold("AccessDeniedException", errorCode):
676		return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
677
678	case strings.EqualFold("InternalServiceException", errorCode):
679		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
680
681	case strings.EqualFold("ResourceNotFoundException", errorCode):
682		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
683
684	case strings.EqualFold("ThrottlingException", errorCode):
685		return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
686
687	case strings.EqualFold("ValidationException", errorCode):
688		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
689
690	default:
691		genericError := &smithy.GenericAPIError{
692			Code:    errorCode,
693			Message: errorMessage,
694		}
695		return genericError
696
697	}
698}
699
700func awsRestjson1_deserializeOpDocumentGetQuantumTaskOutput(v **GetQuantumTaskOutput, value interface{}) error {
701	if v == nil {
702		return fmt.Errorf("unexpected nil of type %T", v)
703	}
704	if value == nil {
705		return nil
706	}
707
708	shape, ok := value.(map[string]interface{})
709	if !ok {
710		return fmt.Errorf("unexpected JSON type %v", value)
711	}
712
713	var sv *GetQuantumTaskOutput
714	if *v == nil {
715		sv = &GetQuantumTaskOutput{}
716	} else {
717		sv = *v
718	}
719
720	for key, value := range shape {
721		switch key {
722		case "createdAt":
723			if value != nil {
724				jtv, ok := value.(string)
725				if !ok {
726					return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
727				}
728				t, err := smithytime.ParseDateTime(jtv)
729				if err != nil {
730					return err
731				}
732				sv.CreatedAt = ptr.Time(t)
733			}
734
735		case "deviceArn":
736			if value != nil {
737				jtv, ok := value.(string)
738				if !ok {
739					return fmt.Errorf("expected DeviceArn to be of type string, got %T instead", value)
740				}
741				sv.DeviceArn = ptr.String(jtv)
742			}
743
744		case "deviceParameters":
745			if value != nil {
746				jtv, ok := value.(string)
747				if !ok {
748					return fmt.Errorf("expected JsonValue to be of type string, got %T instead", value)
749				}
750				sv.DeviceParameters = ptr.String(jtv)
751			}
752
753		case "endedAt":
754			if value != nil {
755				jtv, ok := value.(string)
756				if !ok {
757					return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
758				}
759				t, err := smithytime.ParseDateTime(jtv)
760				if err != nil {
761					return err
762				}
763				sv.EndedAt = ptr.Time(t)
764			}
765
766		case "failureReason":
767			if value != nil {
768				jtv, ok := value.(string)
769				if !ok {
770					return fmt.Errorf("expected String to be of type string, got %T instead", value)
771				}
772				sv.FailureReason = ptr.String(jtv)
773			}
774
775		case "outputS3Bucket":
776			if value != nil {
777				jtv, ok := value.(string)
778				if !ok {
779					return fmt.Errorf("expected String to be of type string, got %T instead", value)
780				}
781				sv.OutputS3Bucket = ptr.String(jtv)
782			}
783
784		case "outputS3Directory":
785			if value != nil {
786				jtv, ok := value.(string)
787				if !ok {
788					return fmt.Errorf("expected String to be of type string, got %T instead", value)
789				}
790				sv.OutputS3Directory = ptr.String(jtv)
791			}
792
793		case "quantumTaskArn":
794			if value != nil {
795				jtv, ok := value.(string)
796				if !ok {
797					return fmt.Errorf("expected QuantumTaskArn to be of type string, got %T instead", value)
798				}
799				sv.QuantumTaskArn = ptr.String(jtv)
800			}
801
802		case "shots":
803			if value != nil {
804				jtv, ok := value.(json.Number)
805				if !ok {
806					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
807				}
808				i64, err := jtv.Int64()
809				if err != nil {
810					return err
811				}
812				sv.Shots = ptr.Int64(i64)
813			}
814
815		case "status":
816			if value != nil {
817				jtv, ok := value.(string)
818				if !ok {
819					return fmt.Errorf("expected QuantumTaskStatus to be of type string, got %T instead", value)
820				}
821				sv.Status = types.QuantumTaskStatus(jtv)
822			}
823
824		case "tags":
825			if err := awsRestjson1_deserializeDocumentTagsMap(&sv.Tags, value); err != nil {
826				return err
827			}
828
829		default:
830			_, _ = key, value
831
832		}
833	}
834	*v = sv
835	return nil
836}
837
838type awsRestjson1_deserializeOpListTagsForResource struct {
839}
840
841func (*awsRestjson1_deserializeOpListTagsForResource) ID() string {
842	return "OperationDeserializer"
843}
844
845func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
846	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
847) {
848	out, metadata, err = next.HandleDeserialize(ctx, in)
849	if err != nil {
850		return out, metadata, err
851	}
852
853	response, ok := out.RawResponse.(*smithyhttp.Response)
854	if !ok {
855		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
856	}
857
858	if response.StatusCode < 200 || response.StatusCode >= 300 {
859		return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata)
860	}
861	output := &ListTagsForResourceOutput{}
862	out.Result = output
863
864	var buff [1024]byte
865	ringBuffer := smithyio.NewRingBuffer(buff[:])
866
867	body := io.TeeReader(response.Body, ringBuffer)
868
869	decoder := json.NewDecoder(body)
870	decoder.UseNumber()
871	var shape interface{}
872	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
873		var snapshot bytes.Buffer
874		io.Copy(&snapshot, ringBuffer)
875		err = &smithy.DeserializationError{
876			Err:      fmt.Errorf("failed to decode response body, %w", err),
877			Snapshot: snapshot.Bytes(),
878		}
879		return out, metadata, err
880	}
881
882	err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape)
883	if err != nil {
884		var snapshot bytes.Buffer
885		io.Copy(&snapshot, ringBuffer)
886		return out, metadata, &smithy.DeserializationError{
887			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
888			Snapshot: snapshot.Bytes(),
889		}
890	}
891
892	return out, metadata, err
893}
894
895func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error {
896	var errorBuffer bytes.Buffer
897	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
898		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
899	}
900	errorBody := bytes.NewReader(errorBuffer.Bytes())
901
902	errorCode := "UnknownError"
903	errorMessage := errorCode
904
905	code := response.Header.Get("X-Amzn-ErrorType")
906	if len(code) != 0 {
907		errorCode = restjson.SanitizeErrorCode(code)
908	}
909
910	var buff [1024]byte
911	ringBuffer := smithyio.NewRingBuffer(buff[:])
912
913	body := io.TeeReader(errorBody, ringBuffer)
914	decoder := json.NewDecoder(body)
915	decoder.UseNumber()
916	code, message, err := restjson.GetErrorInfo(decoder)
917	if err != nil {
918		var snapshot bytes.Buffer
919		io.Copy(&snapshot, ringBuffer)
920		err = &smithy.DeserializationError{
921			Err:      fmt.Errorf("failed to decode response body, %w", err),
922			Snapshot: snapshot.Bytes(),
923		}
924		return err
925	}
926
927	errorBody.Seek(0, io.SeekStart)
928	if len(code) != 0 {
929		errorCode = restjson.SanitizeErrorCode(code)
930	}
931	if len(message) != 0 {
932		errorMessage = message
933	}
934
935	switch {
936	case strings.EqualFold("InternalServiceException", errorCode):
937		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
938
939	case strings.EqualFold("ResourceNotFoundException", errorCode):
940		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
941
942	case strings.EqualFold("ValidationException", errorCode):
943		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
944
945	default:
946		genericError := &smithy.GenericAPIError{
947			Code:    errorCode,
948			Message: errorMessage,
949		}
950		return genericError
951
952	}
953}
954
955func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error {
956	if v == nil {
957		return fmt.Errorf("unexpected nil of type %T", v)
958	}
959	if value == nil {
960		return nil
961	}
962
963	shape, ok := value.(map[string]interface{})
964	if !ok {
965		return fmt.Errorf("unexpected JSON type %v", value)
966	}
967
968	var sv *ListTagsForResourceOutput
969	if *v == nil {
970		sv = &ListTagsForResourceOutput{}
971	} else {
972		sv = *v
973	}
974
975	for key, value := range shape {
976		switch key {
977		case "tags":
978			if err := awsRestjson1_deserializeDocumentTagsMap(&sv.Tags, value); err != nil {
979				return err
980			}
981
982		default:
983			_, _ = key, value
984
985		}
986	}
987	*v = sv
988	return nil
989}
990
991type awsRestjson1_deserializeOpSearchDevices struct {
992}
993
994func (*awsRestjson1_deserializeOpSearchDevices) ID() string {
995	return "OperationDeserializer"
996}
997
998func (m *awsRestjson1_deserializeOpSearchDevices) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
999	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1000) {
1001	out, metadata, err = next.HandleDeserialize(ctx, in)
1002	if err != nil {
1003		return out, metadata, err
1004	}
1005
1006	response, ok := out.RawResponse.(*smithyhttp.Response)
1007	if !ok {
1008		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1009	}
1010
1011	if response.StatusCode < 200 || response.StatusCode >= 300 {
1012		return out, metadata, awsRestjson1_deserializeOpErrorSearchDevices(response, &metadata)
1013	}
1014	output := &SearchDevicesOutput{}
1015	out.Result = output
1016
1017	var buff [1024]byte
1018	ringBuffer := smithyio.NewRingBuffer(buff[:])
1019
1020	body := io.TeeReader(response.Body, ringBuffer)
1021
1022	decoder := json.NewDecoder(body)
1023	decoder.UseNumber()
1024	var shape interface{}
1025	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1026		var snapshot bytes.Buffer
1027		io.Copy(&snapshot, ringBuffer)
1028		err = &smithy.DeserializationError{
1029			Err:      fmt.Errorf("failed to decode response body, %w", err),
1030			Snapshot: snapshot.Bytes(),
1031		}
1032		return out, metadata, err
1033	}
1034
1035	err = awsRestjson1_deserializeOpDocumentSearchDevicesOutput(&output, shape)
1036	if err != nil {
1037		var snapshot bytes.Buffer
1038		io.Copy(&snapshot, ringBuffer)
1039		return out, metadata, &smithy.DeserializationError{
1040			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
1041			Snapshot: snapshot.Bytes(),
1042		}
1043	}
1044
1045	return out, metadata, err
1046}
1047
1048func awsRestjson1_deserializeOpErrorSearchDevices(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1049	var errorBuffer bytes.Buffer
1050	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1051		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1052	}
1053	errorBody := bytes.NewReader(errorBuffer.Bytes())
1054
1055	errorCode := "UnknownError"
1056	errorMessage := errorCode
1057
1058	code := response.Header.Get("X-Amzn-ErrorType")
1059	if len(code) != 0 {
1060		errorCode = restjson.SanitizeErrorCode(code)
1061	}
1062
1063	var buff [1024]byte
1064	ringBuffer := smithyio.NewRingBuffer(buff[:])
1065
1066	body := io.TeeReader(errorBody, ringBuffer)
1067	decoder := json.NewDecoder(body)
1068	decoder.UseNumber()
1069	code, message, err := restjson.GetErrorInfo(decoder)
1070	if err != nil {
1071		var snapshot bytes.Buffer
1072		io.Copy(&snapshot, ringBuffer)
1073		err = &smithy.DeserializationError{
1074			Err:      fmt.Errorf("failed to decode response body, %w", err),
1075			Snapshot: snapshot.Bytes(),
1076		}
1077		return err
1078	}
1079
1080	errorBody.Seek(0, io.SeekStart)
1081	if len(code) != 0 {
1082		errorCode = restjson.SanitizeErrorCode(code)
1083	}
1084	if len(message) != 0 {
1085		errorMessage = message
1086	}
1087
1088	switch {
1089	case strings.EqualFold("AccessDeniedException", errorCode):
1090		return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
1091
1092	case strings.EqualFold("InternalServiceException", errorCode):
1093		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
1094
1095	case strings.EqualFold("ThrottlingException", errorCode):
1096		return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
1097
1098	case strings.EqualFold("ValidationException", errorCode):
1099		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
1100
1101	default:
1102		genericError := &smithy.GenericAPIError{
1103			Code:    errorCode,
1104			Message: errorMessage,
1105		}
1106		return genericError
1107
1108	}
1109}
1110
1111func awsRestjson1_deserializeOpDocumentSearchDevicesOutput(v **SearchDevicesOutput, value interface{}) error {
1112	if v == nil {
1113		return fmt.Errorf("unexpected nil of type %T", v)
1114	}
1115	if value == nil {
1116		return nil
1117	}
1118
1119	shape, ok := value.(map[string]interface{})
1120	if !ok {
1121		return fmt.Errorf("unexpected JSON type %v", value)
1122	}
1123
1124	var sv *SearchDevicesOutput
1125	if *v == nil {
1126		sv = &SearchDevicesOutput{}
1127	} else {
1128		sv = *v
1129	}
1130
1131	for key, value := range shape {
1132		switch key {
1133		case "devices":
1134			if err := awsRestjson1_deserializeDocumentDeviceSummaryList(&sv.Devices, value); err != nil {
1135				return err
1136			}
1137
1138		case "nextToken":
1139			if value != nil {
1140				jtv, ok := value.(string)
1141				if !ok {
1142					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1143				}
1144				sv.NextToken = ptr.String(jtv)
1145			}
1146
1147		default:
1148			_, _ = key, value
1149
1150		}
1151	}
1152	*v = sv
1153	return nil
1154}
1155
1156type awsRestjson1_deserializeOpSearchQuantumTasks struct {
1157}
1158
1159func (*awsRestjson1_deserializeOpSearchQuantumTasks) ID() string {
1160	return "OperationDeserializer"
1161}
1162
1163func (m *awsRestjson1_deserializeOpSearchQuantumTasks) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1164	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1165) {
1166	out, metadata, err = next.HandleDeserialize(ctx, in)
1167	if err != nil {
1168		return out, metadata, err
1169	}
1170
1171	response, ok := out.RawResponse.(*smithyhttp.Response)
1172	if !ok {
1173		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1174	}
1175
1176	if response.StatusCode < 200 || response.StatusCode >= 300 {
1177		return out, metadata, awsRestjson1_deserializeOpErrorSearchQuantumTasks(response, &metadata)
1178	}
1179	output := &SearchQuantumTasksOutput{}
1180	out.Result = output
1181
1182	var buff [1024]byte
1183	ringBuffer := smithyio.NewRingBuffer(buff[:])
1184
1185	body := io.TeeReader(response.Body, ringBuffer)
1186
1187	decoder := json.NewDecoder(body)
1188	decoder.UseNumber()
1189	var shape interface{}
1190	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1191		var snapshot bytes.Buffer
1192		io.Copy(&snapshot, ringBuffer)
1193		err = &smithy.DeserializationError{
1194			Err:      fmt.Errorf("failed to decode response body, %w", err),
1195			Snapshot: snapshot.Bytes(),
1196		}
1197		return out, metadata, err
1198	}
1199
1200	err = awsRestjson1_deserializeOpDocumentSearchQuantumTasksOutput(&output, shape)
1201	if err != nil {
1202		var snapshot bytes.Buffer
1203		io.Copy(&snapshot, ringBuffer)
1204		return out, metadata, &smithy.DeserializationError{
1205			Err:      fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
1206			Snapshot: snapshot.Bytes(),
1207		}
1208	}
1209
1210	return out, metadata, err
1211}
1212
1213func awsRestjson1_deserializeOpErrorSearchQuantumTasks(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1214	var errorBuffer bytes.Buffer
1215	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1216		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1217	}
1218	errorBody := bytes.NewReader(errorBuffer.Bytes())
1219
1220	errorCode := "UnknownError"
1221	errorMessage := errorCode
1222
1223	code := response.Header.Get("X-Amzn-ErrorType")
1224	if len(code) != 0 {
1225		errorCode = restjson.SanitizeErrorCode(code)
1226	}
1227
1228	var buff [1024]byte
1229	ringBuffer := smithyio.NewRingBuffer(buff[:])
1230
1231	body := io.TeeReader(errorBody, ringBuffer)
1232	decoder := json.NewDecoder(body)
1233	decoder.UseNumber()
1234	code, message, err := restjson.GetErrorInfo(decoder)
1235	if err != nil {
1236		var snapshot bytes.Buffer
1237		io.Copy(&snapshot, ringBuffer)
1238		err = &smithy.DeserializationError{
1239			Err:      fmt.Errorf("failed to decode response body, %w", err),
1240			Snapshot: snapshot.Bytes(),
1241		}
1242		return err
1243	}
1244
1245	errorBody.Seek(0, io.SeekStart)
1246	if len(code) != 0 {
1247		errorCode = restjson.SanitizeErrorCode(code)
1248	}
1249	if len(message) != 0 {
1250		errorMessage = message
1251	}
1252
1253	switch {
1254	case strings.EqualFold("AccessDeniedException", errorCode):
1255		return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
1256
1257	case strings.EqualFold("InternalServiceException", errorCode):
1258		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
1259
1260	case strings.EqualFold("ThrottlingException", errorCode):
1261		return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
1262
1263	case strings.EqualFold("ValidationException", errorCode):
1264		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
1265
1266	default:
1267		genericError := &smithy.GenericAPIError{
1268			Code:    errorCode,
1269			Message: errorMessage,
1270		}
1271		return genericError
1272
1273	}
1274}
1275
1276func awsRestjson1_deserializeOpDocumentSearchQuantumTasksOutput(v **SearchQuantumTasksOutput, value interface{}) error {
1277	if v == nil {
1278		return fmt.Errorf("unexpected nil of type %T", v)
1279	}
1280	if value == nil {
1281		return nil
1282	}
1283
1284	shape, ok := value.(map[string]interface{})
1285	if !ok {
1286		return fmt.Errorf("unexpected JSON type %v", value)
1287	}
1288
1289	var sv *SearchQuantumTasksOutput
1290	if *v == nil {
1291		sv = &SearchQuantumTasksOutput{}
1292	} else {
1293		sv = *v
1294	}
1295
1296	for key, value := range shape {
1297		switch key {
1298		case "nextToken":
1299			if value != nil {
1300				jtv, ok := value.(string)
1301				if !ok {
1302					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1303				}
1304				sv.NextToken = ptr.String(jtv)
1305			}
1306
1307		case "quantumTasks":
1308			if err := awsRestjson1_deserializeDocumentQuantumTaskSummaryList(&sv.QuantumTasks, value); err != nil {
1309				return err
1310			}
1311
1312		default:
1313			_, _ = key, value
1314
1315		}
1316	}
1317	*v = sv
1318	return nil
1319}
1320
1321type awsRestjson1_deserializeOpTagResource struct {
1322}
1323
1324func (*awsRestjson1_deserializeOpTagResource) ID() string {
1325	return "OperationDeserializer"
1326}
1327
1328func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1329	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1330) {
1331	out, metadata, err = next.HandleDeserialize(ctx, in)
1332	if err != nil {
1333		return out, metadata, err
1334	}
1335
1336	response, ok := out.RawResponse.(*smithyhttp.Response)
1337	if !ok {
1338		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1339	}
1340
1341	if response.StatusCode < 200 || response.StatusCode >= 300 {
1342		return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata)
1343	}
1344	output := &TagResourceOutput{}
1345	out.Result = output
1346
1347	return out, metadata, err
1348}
1349
1350func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1351	var errorBuffer bytes.Buffer
1352	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1353		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1354	}
1355	errorBody := bytes.NewReader(errorBuffer.Bytes())
1356
1357	errorCode := "UnknownError"
1358	errorMessage := errorCode
1359
1360	code := response.Header.Get("X-Amzn-ErrorType")
1361	if len(code) != 0 {
1362		errorCode = restjson.SanitizeErrorCode(code)
1363	}
1364
1365	var buff [1024]byte
1366	ringBuffer := smithyio.NewRingBuffer(buff[:])
1367
1368	body := io.TeeReader(errorBody, ringBuffer)
1369	decoder := json.NewDecoder(body)
1370	decoder.UseNumber()
1371	code, message, err := restjson.GetErrorInfo(decoder)
1372	if err != nil {
1373		var snapshot bytes.Buffer
1374		io.Copy(&snapshot, ringBuffer)
1375		err = &smithy.DeserializationError{
1376			Err:      fmt.Errorf("failed to decode response body, %w", err),
1377			Snapshot: snapshot.Bytes(),
1378		}
1379		return err
1380	}
1381
1382	errorBody.Seek(0, io.SeekStart)
1383	if len(code) != 0 {
1384		errorCode = restjson.SanitizeErrorCode(code)
1385	}
1386	if len(message) != 0 {
1387		errorMessage = message
1388	}
1389
1390	switch {
1391	case strings.EqualFold("InternalServiceException", errorCode):
1392		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
1393
1394	case strings.EqualFold("ResourceNotFoundException", errorCode):
1395		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
1396
1397	case strings.EqualFold("ValidationException", errorCode):
1398		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
1399
1400	default:
1401		genericError := &smithy.GenericAPIError{
1402			Code:    errorCode,
1403			Message: errorMessage,
1404		}
1405		return genericError
1406
1407	}
1408}
1409
1410type awsRestjson1_deserializeOpUntagResource struct {
1411}
1412
1413func (*awsRestjson1_deserializeOpUntagResource) ID() string {
1414	return "OperationDeserializer"
1415}
1416
1417func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
1418	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
1419) {
1420	out, metadata, err = next.HandleDeserialize(ctx, in)
1421	if err != nil {
1422		return out, metadata, err
1423	}
1424
1425	response, ok := out.RawResponse.(*smithyhttp.Response)
1426	if !ok {
1427		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
1428	}
1429
1430	if response.StatusCode < 200 || response.StatusCode >= 300 {
1431		return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata)
1432	}
1433	output := &UntagResourceOutput{}
1434	out.Result = output
1435
1436	return out, metadata, err
1437}
1438
1439func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error {
1440	var errorBuffer bytes.Buffer
1441	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
1442		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
1443	}
1444	errorBody := bytes.NewReader(errorBuffer.Bytes())
1445
1446	errorCode := "UnknownError"
1447	errorMessage := errorCode
1448
1449	code := response.Header.Get("X-Amzn-ErrorType")
1450	if len(code) != 0 {
1451		errorCode = restjson.SanitizeErrorCode(code)
1452	}
1453
1454	var buff [1024]byte
1455	ringBuffer := smithyio.NewRingBuffer(buff[:])
1456
1457	body := io.TeeReader(errorBody, ringBuffer)
1458	decoder := json.NewDecoder(body)
1459	decoder.UseNumber()
1460	code, message, err := restjson.GetErrorInfo(decoder)
1461	if err != nil {
1462		var snapshot bytes.Buffer
1463		io.Copy(&snapshot, ringBuffer)
1464		err = &smithy.DeserializationError{
1465			Err:      fmt.Errorf("failed to decode response body, %w", err),
1466			Snapshot: snapshot.Bytes(),
1467		}
1468		return err
1469	}
1470
1471	errorBody.Seek(0, io.SeekStart)
1472	if len(code) != 0 {
1473		errorCode = restjson.SanitizeErrorCode(code)
1474	}
1475	if len(message) != 0 {
1476		errorMessage = message
1477	}
1478
1479	switch {
1480	case strings.EqualFold("InternalServiceException", errorCode):
1481		return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody)
1482
1483	case strings.EqualFold("ResourceNotFoundException", errorCode):
1484		return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
1485
1486	case strings.EqualFold("ValidationException", errorCode):
1487		return awsRestjson1_deserializeErrorValidationException(response, errorBody)
1488
1489	default:
1490		genericError := &smithy.GenericAPIError{
1491			Code:    errorCode,
1492			Message: errorMessage,
1493		}
1494		return genericError
1495
1496	}
1497}
1498
1499func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1500	output := &types.AccessDeniedException{}
1501	var buff [1024]byte
1502	ringBuffer := smithyio.NewRingBuffer(buff[:])
1503
1504	body := io.TeeReader(errorBody, ringBuffer)
1505	decoder := json.NewDecoder(body)
1506	decoder.UseNumber()
1507	var shape interface{}
1508	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1509		var snapshot bytes.Buffer
1510		io.Copy(&snapshot, ringBuffer)
1511		err = &smithy.DeserializationError{
1512			Err:      fmt.Errorf("failed to decode response body, %w", err),
1513			Snapshot: snapshot.Bytes(),
1514		}
1515		return err
1516	}
1517
1518	err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape)
1519
1520	if err != nil {
1521		var snapshot bytes.Buffer
1522		io.Copy(&snapshot, ringBuffer)
1523		err = &smithy.DeserializationError{
1524			Err:      fmt.Errorf("failed to decode response body, %w", err),
1525			Snapshot: snapshot.Bytes(),
1526		}
1527		return err
1528	}
1529
1530	errorBody.Seek(0, io.SeekStart)
1531
1532	return output
1533}
1534
1535func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1536	output := &types.ConflictException{}
1537	var buff [1024]byte
1538	ringBuffer := smithyio.NewRingBuffer(buff[:])
1539
1540	body := io.TeeReader(errorBody, ringBuffer)
1541	decoder := json.NewDecoder(body)
1542	decoder.UseNumber()
1543	var shape interface{}
1544	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1545		var snapshot bytes.Buffer
1546		io.Copy(&snapshot, ringBuffer)
1547		err = &smithy.DeserializationError{
1548			Err:      fmt.Errorf("failed to decode response body, %w", err),
1549			Snapshot: snapshot.Bytes(),
1550		}
1551		return err
1552	}
1553
1554	err := awsRestjson1_deserializeDocumentConflictException(&output, shape)
1555
1556	if err != nil {
1557		var snapshot bytes.Buffer
1558		io.Copy(&snapshot, ringBuffer)
1559		err = &smithy.DeserializationError{
1560			Err:      fmt.Errorf("failed to decode response body, %w", err),
1561			Snapshot: snapshot.Bytes(),
1562		}
1563		return err
1564	}
1565
1566	errorBody.Seek(0, io.SeekStart)
1567
1568	return output
1569}
1570
1571func awsRestjson1_deserializeErrorDeviceOfflineException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1572	output := &types.DeviceOfflineException{}
1573	var buff [1024]byte
1574	ringBuffer := smithyio.NewRingBuffer(buff[:])
1575
1576	body := io.TeeReader(errorBody, ringBuffer)
1577	decoder := json.NewDecoder(body)
1578	decoder.UseNumber()
1579	var shape interface{}
1580	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1581		var snapshot bytes.Buffer
1582		io.Copy(&snapshot, ringBuffer)
1583		err = &smithy.DeserializationError{
1584			Err:      fmt.Errorf("failed to decode response body, %w", err),
1585			Snapshot: snapshot.Bytes(),
1586		}
1587		return err
1588	}
1589
1590	err := awsRestjson1_deserializeDocumentDeviceOfflineException(&output, shape)
1591
1592	if err != nil {
1593		var snapshot bytes.Buffer
1594		io.Copy(&snapshot, ringBuffer)
1595		err = &smithy.DeserializationError{
1596			Err:      fmt.Errorf("failed to decode response body, %w", err),
1597			Snapshot: snapshot.Bytes(),
1598		}
1599		return err
1600	}
1601
1602	errorBody.Seek(0, io.SeekStart)
1603
1604	return output
1605}
1606
1607func awsRestjson1_deserializeErrorDeviceRetiredException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1608	output := &types.DeviceRetiredException{}
1609	var buff [1024]byte
1610	ringBuffer := smithyio.NewRingBuffer(buff[:])
1611
1612	body := io.TeeReader(errorBody, ringBuffer)
1613	decoder := json.NewDecoder(body)
1614	decoder.UseNumber()
1615	var shape interface{}
1616	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1617		var snapshot bytes.Buffer
1618		io.Copy(&snapshot, ringBuffer)
1619		err = &smithy.DeserializationError{
1620			Err:      fmt.Errorf("failed to decode response body, %w", err),
1621			Snapshot: snapshot.Bytes(),
1622		}
1623		return err
1624	}
1625
1626	err := awsRestjson1_deserializeDocumentDeviceRetiredException(&output, shape)
1627
1628	if err != nil {
1629		var snapshot bytes.Buffer
1630		io.Copy(&snapshot, ringBuffer)
1631		err = &smithy.DeserializationError{
1632			Err:      fmt.Errorf("failed to decode response body, %w", err),
1633			Snapshot: snapshot.Bytes(),
1634		}
1635		return err
1636	}
1637
1638	errorBody.Seek(0, io.SeekStart)
1639
1640	return output
1641}
1642
1643func awsRestjson1_deserializeErrorInternalServiceException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1644	output := &types.InternalServiceException{}
1645	var buff [1024]byte
1646	ringBuffer := smithyio.NewRingBuffer(buff[:])
1647
1648	body := io.TeeReader(errorBody, ringBuffer)
1649	decoder := json.NewDecoder(body)
1650	decoder.UseNumber()
1651	var shape interface{}
1652	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1653		var snapshot bytes.Buffer
1654		io.Copy(&snapshot, ringBuffer)
1655		err = &smithy.DeserializationError{
1656			Err:      fmt.Errorf("failed to decode response body, %w", err),
1657			Snapshot: snapshot.Bytes(),
1658		}
1659		return err
1660	}
1661
1662	err := awsRestjson1_deserializeDocumentInternalServiceException(&output, shape)
1663
1664	if err != nil {
1665		var snapshot bytes.Buffer
1666		io.Copy(&snapshot, ringBuffer)
1667		err = &smithy.DeserializationError{
1668			Err:      fmt.Errorf("failed to decode response body, %w", err),
1669			Snapshot: snapshot.Bytes(),
1670		}
1671		return err
1672	}
1673
1674	errorBody.Seek(0, io.SeekStart)
1675
1676	return output
1677}
1678
1679func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1680	output := &types.ResourceNotFoundException{}
1681	var buff [1024]byte
1682	ringBuffer := smithyio.NewRingBuffer(buff[:])
1683
1684	body := io.TeeReader(errorBody, ringBuffer)
1685	decoder := json.NewDecoder(body)
1686	decoder.UseNumber()
1687	var shape interface{}
1688	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1689		var snapshot bytes.Buffer
1690		io.Copy(&snapshot, ringBuffer)
1691		err = &smithy.DeserializationError{
1692			Err:      fmt.Errorf("failed to decode response body, %w", err),
1693			Snapshot: snapshot.Bytes(),
1694		}
1695		return err
1696	}
1697
1698	err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape)
1699
1700	if err != nil {
1701		var snapshot bytes.Buffer
1702		io.Copy(&snapshot, ringBuffer)
1703		err = &smithy.DeserializationError{
1704			Err:      fmt.Errorf("failed to decode response body, %w", err),
1705			Snapshot: snapshot.Bytes(),
1706		}
1707		return err
1708	}
1709
1710	errorBody.Seek(0, io.SeekStart)
1711
1712	return output
1713}
1714
1715func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1716	output := &types.ServiceQuotaExceededException{}
1717	var buff [1024]byte
1718	ringBuffer := smithyio.NewRingBuffer(buff[:])
1719
1720	body := io.TeeReader(errorBody, ringBuffer)
1721	decoder := json.NewDecoder(body)
1722	decoder.UseNumber()
1723	var shape interface{}
1724	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1725		var snapshot bytes.Buffer
1726		io.Copy(&snapshot, ringBuffer)
1727		err = &smithy.DeserializationError{
1728			Err:      fmt.Errorf("failed to decode response body, %w", err),
1729			Snapshot: snapshot.Bytes(),
1730		}
1731		return err
1732	}
1733
1734	err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape)
1735
1736	if err != nil {
1737		var snapshot bytes.Buffer
1738		io.Copy(&snapshot, ringBuffer)
1739		err = &smithy.DeserializationError{
1740			Err:      fmt.Errorf("failed to decode response body, %w", err),
1741			Snapshot: snapshot.Bytes(),
1742		}
1743		return err
1744	}
1745
1746	errorBody.Seek(0, io.SeekStart)
1747
1748	return output
1749}
1750
1751func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1752	output := &types.ThrottlingException{}
1753	var buff [1024]byte
1754	ringBuffer := smithyio.NewRingBuffer(buff[:])
1755
1756	body := io.TeeReader(errorBody, ringBuffer)
1757	decoder := json.NewDecoder(body)
1758	decoder.UseNumber()
1759	var shape interface{}
1760	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1761		var snapshot bytes.Buffer
1762		io.Copy(&snapshot, ringBuffer)
1763		err = &smithy.DeserializationError{
1764			Err:      fmt.Errorf("failed to decode response body, %w", err),
1765			Snapshot: snapshot.Bytes(),
1766		}
1767		return err
1768	}
1769
1770	err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape)
1771
1772	if err != nil {
1773		var snapshot bytes.Buffer
1774		io.Copy(&snapshot, ringBuffer)
1775		err = &smithy.DeserializationError{
1776			Err:      fmt.Errorf("failed to decode response body, %w", err),
1777			Snapshot: snapshot.Bytes(),
1778		}
1779		return err
1780	}
1781
1782	errorBody.Seek(0, io.SeekStart)
1783
1784	return output
1785}
1786
1787func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
1788	output := &types.ValidationException{}
1789	var buff [1024]byte
1790	ringBuffer := smithyio.NewRingBuffer(buff[:])
1791
1792	body := io.TeeReader(errorBody, ringBuffer)
1793	decoder := json.NewDecoder(body)
1794	decoder.UseNumber()
1795	var shape interface{}
1796	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
1797		var snapshot bytes.Buffer
1798		io.Copy(&snapshot, ringBuffer)
1799		err = &smithy.DeserializationError{
1800			Err:      fmt.Errorf("failed to decode response body, %w", err),
1801			Snapshot: snapshot.Bytes(),
1802		}
1803		return err
1804	}
1805
1806	err := awsRestjson1_deserializeDocumentValidationException(&output, shape)
1807
1808	if err != nil {
1809		var snapshot bytes.Buffer
1810		io.Copy(&snapshot, ringBuffer)
1811		err = &smithy.DeserializationError{
1812			Err:      fmt.Errorf("failed to decode response body, %w", err),
1813			Snapshot: snapshot.Bytes(),
1814		}
1815		return err
1816	}
1817
1818	errorBody.Seek(0, io.SeekStart)
1819
1820	return output
1821}
1822
1823func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error {
1824	if v == nil {
1825		return fmt.Errorf("unexpected nil of type %T", v)
1826	}
1827	if value == nil {
1828		return nil
1829	}
1830
1831	shape, ok := value.(map[string]interface{})
1832	if !ok {
1833		return fmt.Errorf("unexpected JSON type %v", value)
1834	}
1835
1836	var sv *types.AccessDeniedException
1837	if *v == nil {
1838		sv = &types.AccessDeniedException{}
1839	} else {
1840		sv = *v
1841	}
1842
1843	for key, value := range shape {
1844		switch key {
1845		case "message":
1846			if value != nil {
1847				jtv, ok := value.(string)
1848				if !ok {
1849					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1850				}
1851				sv.Message = ptr.String(jtv)
1852			}
1853
1854		default:
1855			_, _ = key, value
1856
1857		}
1858	}
1859	*v = sv
1860	return nil
1861}
1862
1863func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error {
1864	if v == nil {
1865		return fmt.Errorf("unexpected nil of type %T", v)
1866	}
1867	if value == nil {
1868		return nil
1869	}
1870
1871	shape, ok := value.(map[string]interface{})
1872	if !ok {
1873		return fmt.Errorf("unexpected JSON type %v", value)
1874	}
1875
1876	var sv *types.ConflictException
1877	if *v == nil {
1878		sv = &types.ConflictException{}
1879	} else {
1880		sv = *v
1881	}
1882
1883	for key, value := range shape {
1884		switch key {
1885		case "message":
1886			if value != nil {
1887				jtv, ok := value.(string)
1888				if !ok {
1889					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1890				}
1891				sv.Message = ptr.String(jtv)
1892			}
1893
1894		default:
1895			_, _ = key, value
1896
1897		}
1898	}
1899	*v = sv
1900	return nil
1901}
1902
1903func awsRestjson1_deserializeDocumentDeviceOfflineException(v **types.DeviceOfflineException, value interface{}) error {
1904	if v == nil {
1905		return fmt.Errorf("unexpected nil of type %T", v)
1906	}
1907	if value == nil {
1908		return nil
1909	}
1910
1911	shape, ok := value.(map[string]interface{})
1912	if !ok {
1913		return fmt.Errorf("unexpected JSON type %v", value)
1914	}
1915
1916	var sv *types.DeviceOfflineException
1917	if *v == nil {
1918		sv = &types.DeviceOfflineException{}
1919	} else {
1920		sv = *v
1921	}
1922
1923	for key, value := range shape {
1924		switch key {
1925		case "message":
1926			if value != nil {
1927				jtv, ok := value.(string)
1928				if !ok {
1929					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1930				}
1931				sv.Message = ptr.String(jtv)
1932			}
1933
1934		default:
1935			_, _ = key, value
1936
1937		}
1938	}
1939	*v = sv
1940	return nil
1941}
1942
1943func awsRestjson1_deserializeDocumentDeviceRetiredException(v **types.DeviceRetiredException, value interface{}) error {
1944	if v == nil {
1945		return fmt.Errorf("unexpected nil of type %T", v)
1946	}
1947	if value == nil {
1948		return nil
1949	}
1950
1951	shape, ok := value.(map[string]interface{})
1952	if !ok {
1953		return fmt.Errorf("unexpected JSON type %v", value)
1954	}
1955
1956	var sv *types.DeviceRetiredException
1957	if *v == nil {
1958		sv = &types.DeviceRetiredException{}
1959	} else {
1960		sv = *v
1961	}
1962
1963	for key, value := range shape {
1964		switch key {
1965		case "message":
1966			if value != nil {
1967				jtv, ok := value.(string)
1968				if !ok {
1969					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1970				}
1971				sv.Message = ptr.String(jtv)
1972			}
1973
1974		default:
1975			_, _ = key, value
1976
1977		}
1978	}
1979	*v = sv
1980	return nil
1981}
1982
1983func awsRestjson1_deserializeDocumentDeviceSummary(v **types.DeviceSummary, value interface{}) error {
1984	if v == nil {
1985		return fmt.Errorf("unexpected nil of type %T", v)
1986	}
1987	if value == nil {
1988		return nil
1989	}
1990
1991	shape, ok := value.(map[string]interface{})
1992	if !ok {
1993		return fmt.Errorf("unexpected JSON type %v", value)
1994	}
1995
1996	var sv *types.DeviceSummary
1997	if *v == nil {
1998		sv = &types.DeviceSummary{}
1999	} else {
2000		sv = *v
2001	}
2002
2003	for key, value := range shape {
2004		switch key {
2005		case "deviceArn":
2006			if value != nil {
2007				jtv, ok := value.(string)
2008				if !ok {
2009					return fmt.Errorf("expected DeviceArn to be of type string, got %T instead", value)
2010				}
2011				sv.DeviceArn = ptr.String(jtv)
2012			}
2013
2014		case "deviceName":
2015			if value != nil {
2016				jtv, ok := value.(string)
2017				if !ok {
2018					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2019				}
2020				sv.DeviceName = ptr.String(jtv)
2021			}
2022
2023		case "deviceStatus":
2024			if value != nil {
2025				jtv, ok := value.(string)
2026				if !ok {
2027					return fmt.Errorf("expected DeviceStatus to be of type string, got %T instead", value)
2028				}
2029				sv.DeviceStatus = types.DeviceStatus(jtv)
2030			}
2031
2032		case "deviceType":
2033			if value != nil {
2034				jtv, ok := value.(string)
2035				if !ok {
2036					return fmt.Errorf("expected DeviceType to be of type string, got %T instead", value)
2037				}
2038				sv.DeviceType = types.DeviceType(jtv)
2039			}
2040
2041		case "providerName":
2042			if value != nil {
2043				jtv, ok := value.(string)
2044				if !ok {
2045					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2046				}
2047				sv.ProviderName = ptr.String(jtv)
2048			}
2049
2050		default:
2051			_, _ = key, value
2052
2053		}
2054	}
2055	*v = sv
2056	return nil
2057}
2058
2059func awsRestjson1_deserializeDocumentDeviceSummaryList(v *[]types.DeviceSummary, value interface{}) error {
2060	if v == nil {
2061		return fmt.Errorf("unexpected nil of type %T", v)
2062	}
2063	if value == nil {
2064		return nil
2065	}
2066
2067	shape, ok := value.([]interface{})
2068	if !ok {
2069		return fmt.Errorf("unexpected JSON type %v", value)
2070	}
2071
2072	var cv []types.DeviceSummary
2073	if *v == nil {
2074		cv = []types.DeviceSummary{}
2075	} else {
2076		cv = *v
2077	}
2078
2079	for _, value := range shape {
2080		var col types.DeviceSummary
2081		destAddr := &col
2082		if err := awsRestjson1_deserializeDocumentDeviceSummary(&destAddr, value); err != nil {
2083			return err
2084		}
2085		col = *destAddr
2086		cv = append(cv, col)
2087
2088	}
2089	*v = cv
2090	return nil
2091}
2092
2093func awsRestjson1_deserializeDocumentInternalServiceException(v **types.InternalServiceException, value interface{}) error {
2094	if v == nil {
2095		return fmt.Errorf("unexpected nil of type %T", v)
2096	}
2097	if value == nil {
2098		return nil
2099	}
2100
2101	shape, ok := value.(map[string]interface{})
2102	if !ok {
2103		return fmt.Errorf("unexpected JSON type %v", value)
2104	}
2105
2106	var sv *types.InternalServiceException
2107	if *v == nil {
2108		sv = &types.InternalServiceException{}
2109	} else {
2110		sv = *v
2111	}
2112
2113	for key, value := range shape {
2114		switch key {
2115		case "message":
2116			if value != nil {
2117				jtv, ok := value.(string)
2118				if !ok {
2119					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2120				}
2121				sv.Message = ptr.String(jtv)
2122			}
2123
2124		default:
2125			_, _ = key, value
2126
2127		}
2128	}
2129	*v = sv
2130	return nil
2131}
2132
2133func awsRestjson1_deserializeDocumentQuantumTaskSummary(v **types.QuantumTaskSummary, value interface{}) error {
2134	if v == nil {
2135		return fmt.Errorf("unexpected nil of type %T", v)
2136	}
2137	if value == nil {
2138		return nil
2139	}
2140
2141	shape, ok := value.(map[string]interface{})
2142	if !ok {
2143		return fmt.Errorf("unexpected JSON type %v", value)
2144	}
2145
2146	var sv *types.QuantumTaskSummary
2147	if *v == nil {
2148		sv = &types.QuantumTaskSummary{}
2149	} else {
2150		sv = *v
2151	}
2152
2153	for key, value := range shape {
2154		switch key {
2155		case "createdAt":
2156			if value != nil {
2157				jtv, ok := value.(string)
2158				if !ok {
2159					return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
2160				}
2161				t, err := smithytime.ParseDateTime(jtv)
2162				if err != nil {
2163					return err
2164				}
2165				sv.CreatedAt = ptr.Time(t)
2166			}
2167
2168		case "deviceArn":
2169			if value != nil {
2170				jtv, ok := value.(string)
2171				if !ok {
2172					return fmt.Errorf("expected DeviceArn to be of type string, got %T instead", value)
2173				}
2174				sv.DeviceArn = ptr.String(jtv)
2175			}
2176
2177		case "endedAt":
2178			if value != nil {
2179				jtv, ok := value.(string)
2180				if !ok {
2181					return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
2182				}
2183				t, err := smithytime.ParseDateTime(jtv)
2184				if err != nil {
2185					return err
2186				}
2187				sv.EndedAt = ptr.Time(t)
2188			}
2189
2190		case "outputS3Bucket":
2191			if value != nil {
2192				jtv, ok := value.(string)
2193				if !ok {
2194					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2195				}
2196				sv.OutputS3Bucket = ptr.String(jtv)
2197			}
2198
2199		case "outputS3Directory":
2200			if value != nil {
2201				jtv, ok := value.(string)
2202				if !ok {
2203					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2204				}
2205				sv.OutputS3Directory = ptr.String(jtv)
2206			}
2207
2208		case "quantumTaskArn":
2209			if value != nil {
2210				jtv, ok := value.(string)
2211				if !ok {
2212					return fmt.Errorf("expected QuantumTaskArn to be of type string, got %T instead", value)
2213				}
2214				sv.QuantumTaskArn = ptr.String(jtv)
2215			}
2216
2217		case "shots":
2218			if value != nil {
2219				jtv, ok := value.(json.Number)
2220				if !ok {
2221					return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
2222				}
2223				i64, err := jtv.Int64()
2224				if err != nil {
2225					return err
2226				}
2227				sv.Shots = ptr.Int64(i64)
2228			}
2229
2230		case "status":
2231			if value != nil {
2232				jtv, ok := value.(string)
2233				if !ok {
2234					return fmt.Errorf("expected QuantumTaskStatus to be of type string, got %T instead", value)
2235				}
2236				sv.Status = types.QuantumTaskStatus(jtv)
2237			}
2238
2239		case "tags":
2240			if err := awsRestjson1_deserializeDocumentTagsMap(&sv.Tags, value); err != nil {
2241				return err
2242			}
2243
2244		default:
2245			_, _ = key, value
2246
2247		}
2248	}
2249	*v = sv
2250	return nil
2251}
2252
2253func awsRestjson1_deserializeDocumentQuantumTaskSummaryList(v *[]types.QuantumTaskSummary, value interface{}) error {
2254	if v == nil {
2255		return fmt.Errorf("unexpected nil of type %T", v)
2256	}
2257	if value == nil {
2258		return nil
2259	}
2260
2261	shape, ok := value.([]interface{})
2262	if !ok {
2263		return fmt.Errorf("unexpected JSON type %v", value)
2264	}
2265
2266	var cv []types.QuantumTaskSummary
2267	if *v == nil {
2268		cv = []types.QuantumTaskSummary{}
2269	} else {
2270		cv = *v
2271	}
2272
2273	for _, value := range shape {
2274		var col types.QuantumTaskSummary
2275		destAddr := &col
2276		if err := awsRestjson1_deserializeDocumentQuantumTaskSummary(&destAddr, value); err != nil {
2277			return err
2278		}
2279		col = *destAddr
2280		cv = append(cv, col)
2281
2282	}
2283	*v = cv
2284	return nil
2285}
2286
2287func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error {
2288	if v == nil {
2289		return fmt.Errorf("unexpected nil of type %T", v)
2290	}
2291	if value == nil {
2292		return nil
2293	}
2294
2295	shape, ok := value.(map[string]interface{})
2296	if !ok {
2297		return fmt.Errorf("unexpected JSON type %v", value)
2298	}
2299
2300	var sv *types.ResourceNotFoundException
2301	if *v == nil {
2302		sv = &types.ResourceNotFoundException{}
2303	} else {
2304		sv = *v
2305	}
2306
2307	for key, value := range shape {
2308		switch key {
2309		case "message":
2310			if value != nil {
2311				jtv, ok := value.(string)
2312				if !ok {
2313					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2314				}
2315				sv.Message = ptr.String(jtv)
2316			}
2317
2318		default:
2319			_, _ = key, value
2320
2321		}
2322	}
2323	*v = sv
2324	return nil
2325}
2326
2327func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error {
2328	if v == nil {
2329		return fmt.Errorf("unexpected nil of type %T", v)
2330	}
2331	if value == nil {
2332		return nil
2333	}
2334
2335	shape, ok := value.(map[string]interface{})
2336	if !ok {
2337		return fmt.Errorf("unexpected JSON type %v", value)
2338	}
2339
2340	var sv *types.ServiceQuotaExceededException
2341	if *v == nil {
2342		sv = &types.ServiceQuotaExceededException{}
2343	} else {
2344		sv = *v
2345	}
2346
2347	for key, value := range shape {
2348		switch key {
2349		case "message":
2350			if value != nil {
2351				jtv, ok := value.(string)
2352				if !ok {
2353					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2354				}
2355				sv.Message = ptr.String(jtv)
2356			}
2357
2358		default:
2359			_, _ = key, value
2360
2361		}
2362	}
2363	*v = sv
2364	return nil
2365}
2366
2367func awsRestjson1_deserializeDocumentTagsMap(v *map[string]string, value interface{}) error {
2368	if v == nil {
2369		return fmt.Errorf("unexpected nil of type %T", v)
2370	}
2371	if value == nil {
2372		return nil
2373	}
2374
2375	shape, ok := value.(map[string]interface{})
2376	if !ok {
2377		return fmt.Errorf("unexpected JSON type %v", value)
2378	}
2379
2380	var mv map[string]string
2381	if *v == nil {
2382		mv = map[string]string{}
2383	} else {
2384		mv = *v
2385	}
2386
2387	for key, value := range shape {
2388		var parsedVal string
2389		if value != nil {
2390			jtv, ok := value.(string)
2391			if !ok {
2392				return fmt.Errorf("expected String to be of type string, got %T instead", value)
2393			}
2394			parsedVal = jtv
2395		}
2396		mv[key] = parsedVal
2397
2398	}
2399	*v = mv
2400	return nil
2401}
2402
2403func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error {
2404	if v == nil {
2405		return fmt.Errorf("unexpected nil of type %T", v)
2406	}
2407	if value == nil {
2408		return nil
2409	}
2410
2411	shape, ok := value.(map[string]interface{})
2412	if !ok {
2413		return fmt.Errorf("unexpected JSON type %v", value)
2414	}
2415
2416	var sv *types.ThrottlingException
2417	if *v == nil {
2418		sv = &types.ThrottlingException{}
2419	} else {
2420		sv = *v
2421	}
2422
2423	for key, value := range shape {
2424		switch key {
2425		case "message":
2426			if value != nil {
2427				jtv, ok := value.(string)
2428				if !ok {
2429					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2430				}
2431				sv.Message = ptr.String(jtv)
2432			}
2433
2434		default:
2435			_, _ = key, value
2436
2437		}
2438	}
2439	*v = sv
2440	return nil
2441}
2442
2443func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error {
2444	if v == nil {
2445		return fmt.Errorf("unexpected nil of type %T", v)
2446	}
2447	if value == nil {
2448		return nil
2449	}
2450
2451	shape, ok := value.(map[string]interface{})
2452	if !ok {
2453		return fmt.Errorf("unexpected JSON type %v", value)
2454	}
2455
2456	var sv *types.ValidationException
2457	if *v == nil {
2458		sv = &types.ValidationException{}
2459	} else {
2460		sv = *v
2461	}
2462
2463	for key, value := range shape {
2464		switch key {
2465		case "message":
2466			if value != nil {
2467				jtv, ok := value.(string)
2468				if !ok {
2469					return fmt.Errorf("expected String to be of type string, got %T instead", value)
2470				}
2471				sv.Message = ptr.String(jtv)
2472			}
2473
2474		default:
2475			_, _ = key, value
2476
2477		}
2478	}
2479	*v = sv
2480	return nil
2481}
2482