1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package pricing
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/pricing/types"
12	smithy "github.com/aws/smithy-go"
13	smithyio "github.com/aws/smithy-go/io"
14	"github.com/aws/smithy-go/middleware"
15	"github.com/aws/smithy-go/ptr"
16	smithyhttp "github.com/aws/smithy-go/transport/http"
17	"io"
18	"strings"
19)
20
21type awsAwsjson11_deserializeOpDescribeServices struct {
22}
23
24func (*awsAwsjson11_deserializeOpDescribeServices) ID() string {
25	return "OperationDeserializer"
26}
27
28func (m *awsAwsjson11_deserializeOpDescribeServices) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
29	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
30) {
31	out, metadata, err = next.HandleDeserialize(ctx, in)
32	if err != nil {
33		return out, metadata, err
34	}
35
36	response, ok := out.RawResponse.(*smithyhttp.Response)
37	if !ok {
38		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
39	}
40
41	if response.StatusCode < 200 || response.StatusCode >= 300 {
42		return out, metadata, awsAwsjson11_deserializeOpErrorDescribeServices(response, &metadata)
43	}
44	output := &DescribeServicesOutput{}
45	out.Result = output
46
47	var buff [1024]byte
48	ringBuffer := smithyio.NewRingBuffer(buff[:])
49
50	body := io.TeeReader(response.Body, ringBuffer)
51	decoder := json.NewDecoder(body)
52	decoder.UseNumber()
53	var shape interface{}
54	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
55		var snapshot bytes.Buffer
56		io.Copy(&snapshot, ringBuffer)
57		err = &smithy.DeserializationError{
58			Err:      fmt.Errorf("failed to decode response body, %w", err),
59			Snapshot: snapshot.Bytes(),
60		}
61		return out, metadata, err
62	}
63
64	err = awsAwsjson11_deserializeOpDocumentDescribeServicesOutput(&output, shape)
65	if err != nil {
66		var snapshot bytes.Buffer
67		io.Copy(&snapshot, ringBuffer)
68		err = &smithy.DeserializationError{
69			Err:      fmt.Errorf("failed to decode response body, %w", err),
70			Snapshot: snapshot.Bytes(),
71		}
72		return out, metadata, err
73	}
74
75	return out, metadata, err
76}
77
78func awsAwsjson11_deserializeOpErrorDescribeServices(response *smithyhttp.Response, metadata *middleware.Metadata) error {
79	var errorBuffer bytes.Buffer
80	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
81		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
82	}
83	errorBody := bytes.NewReader(errorBuffer.Bytes())
84
85	errorCode := "UnknownError"
86	errorMessage := errorCode
87
88	code := response.Header.Get("X-Amzn-ErrorType")
89	if len(code) != 0 {
90		errorCode = restjson.SanitizeErrorCode(code)
91	}
92
93	var buff [1024]byte
94	ringBuffer := smithyio.NewRingBuffer(buff[:])
95
96	body := io.TeeReader(errorBody, ringBuffer)
97	decoder := json.NewDecoder(body)
98	decoder.UseNumber()
99	code, message, err := restjson.GetErrorInfo(decoder)
100	if err != nil {
101		var snapshot bytes.Buffer
102		io.Copy(&snapshot, ringBuffer)
103		err = &smithy.DeserializationError{
104			Err:      fmt.Errorf("failed to decode response body, %w", err),
105			Snapshot: snapshot.Bytes(),
106		}
107		return err
108	}
109
110	errorBody.Seek(0, io.SeekStart)
111	if len(code) != 0 {
112		errorCode = restjson.SanitizeErrorCode(code)
113	}
114	if len(message) != 0 {
115		errorMessage = message
116	}
117
118	switch {
119	case strings.EqualFold("ExpiredNextTokenException", errorCode):
120		return awsAwsjson11_deserializeErrorExpiredNextTokenException(response, errorBody)
121
122	case strings.EqualFold("InternalErrorException", errorCode):
123		return awsAwsjson11_deserializeErrorInternalErrorException(response, errorBody)
124
125	case strings.EqualFold("InvalidNextTokenException", errorCode):
126		return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody)
127
128	case strings.EqualFold("InvalidParameterException", errorCode):
129		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
130
131	case strings.EqualFold("NotFoundException", errorCode):
132		return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody)
133
134	default:
135		genericError := &smithy.GenericAPIError{
136			Code:    errorCode,
137			Message: errorMessage,
138		}
139		return genericError
140
141	}
142}
143
144type awsAwsjson11_deserializeOpGetAttributeValues struct {
145}
146
147func (*awsAwsjson11_deserializeOpGetAttributeValues) ID() string {
148	return "OperationDeserializer"
149}
150
151func (m *awsAwsjson11_deserializeOpGetAttributeValues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
152	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
153) {
154	out, metadata, err = next.HandleDeserialize(ctx, in)
155	if err != nil {
156		return out, metadata, err
157	}
158
159	response, ok := out.RawResponse.(*smithyhttp.Response)
160	if !ok {
161		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
162	}
163
164	if response.StatusCode < 200 || response.StatusCode >= 300 {
165		return out, metadata, awsAwsjson11_deserializeOpErrorGetAttributeValues(response, &metadata)
166	}
167	output := &GetAttributeValuesOutput{}
168	out.Result = output
169
170	var buff [1024]byte
171	ringBuffer := smithyio.NewRingBuffer(buff[:])
172
173	body := io.TeeReader(response.Body, ringBuffer)
174	decoder := json.NewDecoder(body)
175	decoder.UseNumber()
176	var shape interface{}
177	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
178		var snapshot bytes.Buffer
179		io.Copy(&snapshot, ringBuffer)
180		err = &smithy.DeserializationError{
181			Err:      fmt.Errorf("failed to decode response body, %w", err),
182			Snapshot: snapshot.Bytes(),
183		}
184		return out, metadata, err
185	}
186
187	err = awsAwsjson11_deserializeOpDocumentGetAttributeValuesOutput(&output, shape)
188	if err != nil {
189		var snapshot bytes.Buffer
190		io.Copy(&snapshot, ringBuffer)
191		err = &smithy.DeserializationError{
192			Err:      fmt.Errorf("failed to decode response body, %w", err),
193			Snapshot: snapshot.Bytes(),
194		}
195		return out, metadata, err
196	}
197
198	return out, metadata, err
199}
200
201func awsAwsjson11_deserializeOpErrorGetAttributeValues(response *smithyhttp.Response, metadata *middleware.Metadata) error {
202	var errorBuffer bytes.Buffer
203	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
204		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
205	}
206	errorBody := bytes.NewReader(errorBuffer.Bytes())
207
208	errorCode := "UnknownError"
209	errorMessage := errorCode
210
211	code := response.Header.Get("X-Amzn-ErrorType")
212	if len(code) != 0 {
213		errorCode = restjson.SanitizeErrorCode(code)
214	}
215
216	var buff [1024]byte
217	ringBuffer := smithyio.NewRingBuffer(buff[:])
218
219	body := io.TeeReader(errorBody, ringBuffer)
220	decoder := json.NewDecoder(body)
221	decoder.UseNumber()
222	code, message, err := restjson.GetErrorInfo(decoder)
223	if err != nil {
224		var snapshot bytes.Buffer
225		io.Copy(&snapshot, ringBuffer)
226		err = &smithy.DeserializationError{
227			Err:      fmt.Errorf("failed to decode response body, %w", err),
228			Snapshot: snapshot.Bytes(),
229		}
230		return err
231	}
232
233	errorBody.Seek(0, io.SeekStart)
234	if len(code) != 0 {
235		errorCode = restjson.SanitizeErrorCode(code)
236	}
237	if len(message) != 0 {
238		errorMessage = message
239	}
240
241	switch {
242	case strings.EqualFold("ExpiredNextTokenException", errorCode):
243		return awsAwsjson11_deserializeErrorExpiredNextTokenException(response, errorBody)
244
245	case strings.EqualFold("InternalErrorException", errorCode):
246		return awsAwsjson11_deserializeErrorInternalErrorException(response, errorBody)
247
248	case strings.EqualFold("InvalidNextTokenException", errorCode):
249		return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody)
250
251	case strings.EqualFold("InvalidParameterException", errorCode):
252		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
253
254	case strings.EqualFold("NotFoundException", errorCode):
255		return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody)
256
257	default:
258		genericError := &smithy.GenericAPIError{
259			Code:    errorCode,
260			Message: errorMessage,
261		}
262		return genericError
263
264	}
265}
266
267type awsAwsjson11_deserializeOpGetProducts struct {
268}
269
270func (*awsAwsjson11_deserializeOpGetProducts) ID() string {
271	return "OperationDeserializer"
272}
273
274func (m *awsAwsjson11_deserializeOpGetProducts) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
275	out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
276) {
277	out, metadata, err = next.HandleDeserialize(ctx, in)
278	if err != nil {
279		return out, metadata, err
280	}
281
282	response, ok := out.RawResponse.(*smithyhttp.Response)
283	if !ok {
284		return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
285	}
286
287	if response.StatusCode < 200 || response.StatusCode >= 300 {
288		return out, metadata, awsAwsjson11_deserializeOpErrorGetProducts(response, &metadata)
289	}
290	output := &GetProductsOutput{}
291	out.Result = output
292
293	var buff [1024]byte
294	ringBuffer := smithyio.NewRingBuffer(buff[:])
295
296	body := io.TeeReader(response.Body, ringBuffer)
297	decoder := json.NewDecoder(body)
298	decoder.UseNumber()
299	var shape interface{}
300	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
301		var snapshot bytes.Buffer
302		io.Copy(&snapshot, ringBuffer)
303		err = &smithy.DeserializationError{
304			Err:      fmt.Errorf("failed to decode response body, %w", err),
305			Snapshot: snapshot.Bytes(),
306		}
307		return out, metadata, err
308	}
309
310	err = awsAwsjson11_deserializeOpDocumentGetProductsOutput(&output, shape)
311	if err != nil {
312		var snapshot bytes.Buffer
313		io.Copy(&snapshot, ringBuffer)
314		err = &smithy.DeserializationError{
315			Err:      fmt.Errorf("failed to decode response body, %w", err),
316			Snapshot: snapshot.Bytes(),
317		}
318		return out, metadata, err
319	}
320
321	return out, metadata, err
322}
323
324func awsAwsjson11_deserializeOpErrorGetProducts(response *smithyhttp.Response, metadata *middleware.Metadata) error {
325	var errorBuffer bytes.Buffer
326	if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
327		return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
328	}
329	errorBody := bytes.NewReader(errorBuffer.Bytes())
330
331	errorCode := "UnknownError"
332	errorMessage := errorCode
333
334	code := response.Header.Get("X-Amzn-ErrorType")
335	if len(code) != 0 {
336		errorCode = restjson.SanitizeErrorCode(code)
337	}
338
339	var buff [1024]byte
340	ringBuffer := smithyio.NewRingBuffer(buff[:])
341
342	body := io.TeeReader(errorBody, ringBuffer)
343	decoder := json.NewDecoder(body)
344	decoder.UseNumber()
345	code, message, err := restjson.GetErrorInfo(decoder)
346	if err != nil {
347		var snapshot bytes.Buffer
348		io.Copy(&snapshot, ringBuffer)
349		err = &smithy.DeserializationError{
350			Err:      fmt.Errorf("failed to decode response body, %w", err),
351			Snapshot: snapshot.Bytes(),
352		}
353		return err
354	}
355
356	errorBody.Seek(0, io.SeekStart)
357	if len(code) != 0 {
358		errorCode = restjson.SanitizeErrorCode(code)
359	}
360	if len(message) != 0 {
361		errorMessage = message
362	}
363
364	switch {
365	case strings.EqualFold("ExpiredNextTokenException", errorCode):
366		return awsAwsjson11_deserializeErrorExpiredNextTokenException(response, errorBody)
367
368	case strings.EqualFold("InternalErrorException", errorCode):
369		return awsAwsjson11_deserializeErrorInternalErrorException(response, errorBody)
370
371	case strings.EqualFold("InvalidNextTokenException", errorCode):
372		return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody)
373
374	case strings.EqualFold("InvalidParameterException", errorCode):
375		return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody)
376
377	case strings.EqualFold("NotFoundException", errorCode):
378		return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody)
379
380	default:
381		genericError := &smithy.GenericAPIError{
382			Code:    errorCode,
383			Message: errorMessage,
384		}
385		return genericError
386
387	}
388}
389
390func awsAwsjson11_deserializeErrorExpiredNextTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
391	var buff [1024]byte
392	ringBuffer := smithyio.NewRingBuffer(buff[:])
393
394	body := io.TeeReader(errorBody, ringBuffer)
395	decoder := json.NewDecoder(body)
396	decoder.UseNumber()
397	var shape interface{}
398	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
399		var snapshot bytes.Buffer
400		io.Copy(&snapshot, ringBuffer)
401		err = &smithy.DeserializationError{
402			Err:      fmt.Errorf("failed to decode response body, %w", err),
403			Snapshot: snapshot.Bytes(),
404		}
405		return err
406	}
407
408	output := &types.ExpiredNextTokenException{}
409	err := awsAwsjson11_deserializeDocumentExpiredNextTokenException(&output, shape)
410
411	if err != nil {
412		var snapshot bytes.Buffer
413		io.Copy(&snapshot, ringBuffer)
414		err = &smithy.DeserializationError{
415			Err:      fmt.Errorf("failed to decode response body, %w", err),
416			Snapshot: snapshot.Bytes(),
417		}
418		return err
419	}
420
421	errorBody.Seek(0, io.SeekStart)
422	return output
423}
424
425func awsAwsjson11_deserializeErrorInternalErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
426	var buff [1024]byte
427	ringBuffer := smithyio.NewRingBuffer(buff[:])
428
429	body := io.TeeReader(errorBody, ringBuffer)
430	decoder := json.NewDecoder(body)
431	decoder.UseNumber()
432	var shape interface{}
433	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
434		var snapshot bytes.Buffer
435		io.Copy(&snapshot, ringBuffer)
436		err = &smithy.DeserializationError{
437			Err:      fmt.Errorf("failed to decode response body, %w", err),
438			Snapshot: snapshot.Bytes(),
439		}
440		return err
441	}
442
443	output := &types.InternalErrorException{}
444	err := awsAwsjson11_deserializeDocumentInternalErrorException(&output, shape)
445
446	if err != nil {
447		var snapshot bytes.Buffer
448		io.Copy(&snapshot, ringBuffer)
449		err = &smithy.DeserializationError{
450			Err:      fmt.Errorf("failed to decode response body, %w", err),
451			Snapshot: snapshot.Bytes(),
452		}
453		return err
454	}
455
456	errorBody.Seek(0, io.SeekStart)
457	return output
458}
459
460func awsAwsjson11_deserializeErrorInvalidNextTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
461	var buff [1024]byte
462	ringBuffer := smithyio.NewRingBuffer(buff[:])
463
464	body := io.TeeReader(errorBody, ringBuffer)
465	decoder := json.NewDecoder(body)
466	decoder.UseNumber()
467	var shape interface{}
468	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
469		var snapshot bytes.Buffer
470		io.Copy(&snapshot, ringBuffer)
471		err = &smithy.DeserializationError{
472			Err:      fmt.Errorf("failed to decode response body, %w", err),
473			Snapshot: snapshot.Bytes(),
474		}
475		return err
476	}
477
478	output := &types.InvalidNextTokenException{}
479	err := awsAwsjson11_deserializeDocumentInvalidNextTokenException(&output, shape)
480
481	if err != nil {
482		var snapshot bytes.Buffer
483		io.Copy(&snapshot, ringBuffer)
484		err = &smithy.DeserializationError{
485			Err:      fmt.Errorf("failed to decode response body, %w", err),
486			Snapshot: snapshot.Bytes(),
487		}
488		return err
489	}
490
491	errorBody.Seek(0, io.SeekStart)
492	return output
493}
494
495func awsAwsjson11_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
496	var buff [1024]byte
497	ringBuffer := smithyio.NewRingBuffer(buff[:])
498
499	body := io.TeeReader(errorBody, ringBuffer)
500	decoder := json.NewDecoder(body)
501	decoder.UseNumber()
502	var shape interface{}
503	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
504		var snapshot bytes.Buffer
505		io.Copy(&snapshot, ringBuffer)
506		err = &smithy.DeserializationError{
507			Err:      fmt.Errorf("failed to decode response body, %w", err),
508			Snapshot: snapshot.Bytes(),
509		}
510		return err
511	}
512
513	output := &types.InvalidParameterException{}
514	err := awsAwsjson11_deserializeDocumentInvalidParameterException(&output, shape)
515
516	if err != nil {
517		var snapshot bytes.Buffer
518		io.Copy(&snapshot, ringBuffer)
519		err = &smithy.DeserializationError{
520			Err:      fmt.Errorf("failed to decode response body, %w", err),
521			Snapshot: snapshot.Bytes(),
522		}
523		return err
524	}
525
526	errorBody.Seek(0, io.SeekStart)
527	return output
528}
529
530func awsAwsjson11_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
531	var buff [1024]byte
532	ringBuffer := smithyio.NewRingBuffer(buff[:])
533
534	body := io.TeeReader(errorBody, ringBuffer)
535	decoder := json.NewDecoder(body)
536	decoder.UseNumber()
537	var shape interface{}
538	if err := decoder.Decode(&shape); err != nil && err != io.EOF {
539		var snapshot bytes.Buffer
540		io.Copy(&snapshot, ringBuffer)
541		err = &smithy.DeserializationError{
542			Err:      fmt.Errorf("failed to decode response body, %w", err),
543			Snapshot: snapshot.Bytes(),
544		}
545		return err
546	}
547
548	output := &types.NotFoundException{}
549	err := awsAwsjson11_deserializeDocumentNotFoundException(&output, shape)
550
551	if err != nil {
552		var snapshot bytes.Buffer
553		io.Copy(&snapshot, ringBuffer)
554		err = &smithy.DeserializationError{
555			Err:      fmt.Errorf("failed to decode response body, %w", err),
556			Snapshot: snapshot.Bytes(),
557		}
558		return err
559	}
560
561	errorBody.Seek(0, io.SeekStart)
562	return output
563}
564
565func awsAwsjson11_deserializeDocumentAttributeNameList(v *[]string, value interface{}) error {
566	if v == nil {
567		return fmt.Errorf("unexpected nil of type %T", v)
568	}
569	if value == nil {
570		return nil
571	}
572
573	shape, ok := value.([]interface{})
574	if !ok {
575		return fmt.Errorf("unexpected JSON type %v", value)
576	}
577
578	var cv []string
579	if *v == nil {
580		cv = []string{}
581	} else {
582		cv = *v
583	}
584
585	for _, value := range shape {
586		var col string
587		if value != nil {
588			jtv, ok := value.(string)
589			if !ok {
590				return fmt.Errorf("expected String to be of type string, got %T instead", value)
591			}
592			col = jtv
593		}
594		cv = append(cv, col)
595
596	}
597	*v = cv
598	return nil
599}
600
601func awsAwsjson11_deserializeDocumentAttributeValue(v **types.AttributeValue, value interface{}) error {
602	if v == nil {
603		return fmt.Errorf("unexpected nil of type %T", v)
604	}
605	if value == nil {
606		return nil
607	}
608
609	shape, ok := value.(map[string]interface{})
610	if !ok {
611		return fmt.Errorf("unexpected JSON type %v", value)
612	}
613
614	var sv *types.AttributeValue
615	if *v == nil {
616		sv = &types.AttributeValue{}
617	} else {
618		sv = *v
619	}
620
621	for key, value := range shape {
622		switch key {
623		case "Value":
624			if value != nil {
625				jtv, ok := value.(string)
626				if !ok {
627					return fmt.Errorf("expected String to be of type string, got %T instead", value)
628				}
629				sv.Value = ptr.String(jtv)
630			}
631
632		default:
633			_, _ = key, value
634
635		}
636	}
637	*v = sv
638	return nil
639}
640
641func awsAwsjson11_deserializeDocumentAttributeValueList(v *[]types.AttributeValue, value interface{}) error {
642	if v == nil {
643		return fmt.Errorf("unexpected nil of type %T", v)
644	}
645	if value == nil {
646		return nil
647	}
648
649	shape, ok := value.([]interface{})
650	if !ok {
651		return fmt.Errorf("unexpected JSON type %v", value)
652	}
653
654	var cv []types.AttributeValue
655	if *v == nil {
656		cv = []types.AttributeValue{}
657	} else {
658		cv = *v
659	}
660
661	for _, value := range shape {
662		var col types.AttributeValue
663		destAddr := &col
664		if err := awsAwsjson11_deserializeDocumentAttributeValue(&destAddr, value); err != nil {
665			return err
666		}
667		col = *destAddr
668		cv = append(cv, col)
669
670	}
671	*v = cv
672	return nil
673}
674
675func awsAwsjson11_deserializeDocumentExpiredNextTokenException(v **types.ExpiredNextTokenException, value interface{}) error {
676	if v == nil {
677		return fmt.Errorf("unexpected nil of type %T", v)
678	}
679	if value == nil {
680		return nil
681	}
682
683	shape, ok := value.(map[string]interface{})
684	if !ok {
685		return fmt.Errorf("unexpected JSON type %v", value)
686	}
687
688	var sv *types.ExpiredNextTokenException
689	if *v == nil {
690		sv = &types.ExpiredNextTokenException{}
691	} else {
692		sv = *v
693	}
694
695	for key, value := range shape {
696		switch key {
697		case "Message":
698			if value != nil {
699				jtv, ok := value.(string)
700				if !ok {
701					return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value)
702				}
703				sv.Message = ptr.String(jtv)
704			}
705
706		default:
707			_, _ = key, value
708
709		}
710	}
711	*v = sv
712	return nil
713}
714
715func awsAwsjson11_deserializeDocumentInternalErrorException(v **types.InternalErrorException, value interface{}) error {
716	if v == nil {
717		return fmt.Errorf("unexpected nil of type %T", v)
718	}
719	if value == nil {
720		return nil
721	}
722
723	shape, ok := value.(map[string]interface{})
724	if !ok {
725		return fmt.Errorf("unexpected JSON type %v", value)
726	}
727
728	var sv *types.InternalErrorException
729	if *v == nil {
730		sv = &types.InternalErrorException{}
731	} else {
732		sv = *v
733	}
734
735	for key, value := range shape {
736		switch key {
737		case "Message":
738			if value != nil {
739				jtv, ok := value.(string)
740				if !ok {
741					return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value)
742				}
743				sv.Message = ptr.String(jtv)
744			}
745
746		default:
747			_, _ = key, value
748
749		}
750	}
751	*v = sv
752	return nil
753}
754
755func awsAwsjson11_deserializeDocumentInvalidNextTokenException(v **types.InvalidNextTokenException, value interface{}) error {
756	if v == nil {
757		return fmt.Errorf("unexpected nil of type %T", v)
758	}
759	if value == nil {
760		return nil
761	}
762
763	shape, ok := value.(map[string]interface{})
764	if !ok {
765		return fmt.Errorf("unexpected JSON type %v", value)
766	}
767
768	var sv *types.InvalidNextTokenException
769	if *v == nil {
770		sv = &types.InvalidNextTokenException{}
771	} else {
772		sv = *v
773	}
774
775	for key, value := range shape {
776		switch key {
777		case "Message":
778			if value != nil {
779				jtv, ok := value.(string)
780				if !ok {
781					return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value)
782				}
783				sv.Message = ptr.String(jtv)
784			}
785
786		default:
787			_, _ = key, value
788
789		}
790	}
791	*v = sv
792	return nil
793}
794
795func awsAwsjson11_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error {
796	if v == nil {
797		return fmt.Errorf("unexpected nil of type %T", v)
798	}
799	if value == nil {
800		return nil
801	}
802
803	shape, ok := value.(map[string]interface{})
804	if !ok {
805		return fmt.Errorf("unexpected JSON type %v", value)
806	}
807
808	var sv *types.InvalidParameterException
809	if *v == nil {
810		sv = &types.InvalidParameterException{}
811	} else {
812		sv = *v
813	}
814
815	for key, value := range shape {
816		switch key {
817		case "Message":
818			if value != nil {
819				jtv, ok := value.(string)
820				if !ok {
821					return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value)
822				}
823				sv.Message = ptr.String(jtv)
824			}
825
826		default:
827			_, _ = key, value
828
829		}
830	}
831	*v = sv
832	return nil
833}
834
835func awsAwsjson11_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error {
836	if v == nil {
837		return fmt.Errorf("unexpected nil of type %T", v)
838	}
839	if value == nil {
840		return nil
841	}
842
843	shape, ok := value.(map[string]interface{})
844	if !ok {
845		return fmt.Errorf("unexpected JSON type %v", value)
846	}
847
848	var sv *types.NotFoundException
849	if *v == nil {
850		sv = &types.NotFoundException{}
851	} else {
852		sv = *v
853	}
854
855	for key, value := range shape {
856		switch key {
857		case "Message":
858			if value != nil {
859				jtv, ok := value.(string)
860				if !ok {
861					return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value)
862				}
863				sv.Message = ptr.String(jtv)
864			}
865
866		default:
867			_, _ = key, value
868
869		}
870	}
871	*v = sv
872	return nil
873}
874
875func awsAwsjson11_deserializeDocumentPriceList(v *[]string, value interface{}) error {
876	if v == nil {
877		return fmt.Errorf("unexpected nil of type %T", v)
878	}
879	if value == nil {
880		return nil
881	}
882
883	shape, ok := value.([]interface{})
884	if !ok {
885		return fmt.Errorf("unexpected JSON type %v", value)
886	}
887
888	var cv []string
889	if *v == nil {
890		cv = []string{}
891	} else {
892		cv = *v
893	}
894
895	for _, value := range shape {
896		var col string
897		if value != nil {
898			jtv, ok := value.(string)
899			if !ok {
900				return fmt.Errorf("expected SynthesizedJsonPriceListItemJSON to be of type string, got %T instead", value)
901			}
902			col = jtv
903		}
904		cv = append(cv, col)
905
906	}
907	*v = cv
908	return nil
909}
910
911func awsAwsjson11_deserializeDocumentService(v **types.Service, value interface{}) error {
912	if v == nil {
913		return fmt.Errorf("unexpected nil of type %T", v)
914	}
915	if value == nil {
916		return nil
917	}
918
919	shape, ok := value.(map[string]interface{})
920	if !ok {
921		return fmt.Errorf("unexpected JSON type %v", value)
922	}
923
924	var sv *types.Service
925	if *v == nil {
926		sv = &types.Service{}
927	} else {
928		sv = *v
929	}
930
931	for key, value := range shape {
932		switch key {
933		case "AttributeNames":
934			if err := awsAwsjson11_deserializeDocumentAttributeNameList(&sv.AttributeNames, value); err != nil {
935				return err
936			}
937
938		case "ServiceCode":
939			if value != nil {
940				jtv, ok := value.(string)
941				if !ok {
942					return fmt.Errorf("expected String to be of type string, got %T instead", value)
943				}
944				sv.ServiceCode = ptr.String(jtv)
945			}
946
947		default:
948			_, _ = key, value
949
950		}
951	}
952	*v = sv
953	return nil
954}
955
956func awsAwsjson11_deserializeDocumentServiceList(v *[]types.Service, value interface{}) error {
957	if v == nil {
958		return fmt.Errorf("unexpected nil of type %T", v)
959	}
960	if value == nil {
961		return nil
962	}
963
964	shape, ok := value.([]interface{})
965	if !ok {
966		return fmt.Errorf("unexpected JSON type %v", value)
967	}
968
969	var cv []types.Service
970	if *v == nil {
971		cv = []types.Service{}
972	} else {
973		cv = *v
974	}
975
976	for _, value := range shape {
977		var col types.Service
978		destAddr := &col
979		if err := awsAwsjson11_deserializeDocumentService(&destAddr, value); err != nil {
980			return err
981		}
982		col = *destAddr
983		cv = append(cv, col)
984
985	}
986	*v = cv
987	return nil
988}
989
990func awsAwsjson11_deserializeOpDocumentDescribeServicesOutput(v **DescribeServicesOutput, value interface{}) error {
991	if v == nil {
992		return fmt.Errorf("unexpected nil of type %T", v)
993	}
994	if value == nil {
995		return nil
996	}
997
998	shape, ok := value.(map[string]interface{})
999	if !ok {
1000		return fmt.Errorf("unexpected JSON type %v", value)
1001	}
1002
1003	var sv *DescribeServicesOutput
1004	if *v == nil {
1005		sv = &DescribeServicesOutput{}
1006	} else {
1007		sv = *v
1008	}
1009
1010	for key, value := range shape {
1011		switch key {
1012		case "FormatVersion":
1013			if value != nil {
1014				jtv, ok := value.(string)
1015				if !ok {
1016					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1017				}
1018				sv.FormatVersion = ptr.String(jtv)
1019			}
1020
1021		case "NextToken":
1022			if value != nil {
1023				jtv, ok := value.(string)
1024				if !ok {
1025					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1026				}
1027				sv.NextToken = ptr.String(jtv)
1028			}
1029
1030		case "Services":
1031			if err := awsAwsjson11_deserializeDocumentServiceList(&sv.Services, value); err != nil {
1032				return err
1033			}
1034
1035		default:
1036			_, _ = key, value
1037
1038		}
1039	}
1040	*v = sv
1041	return nil
1042}
1043
1044func awsAwsjson11_deserializeOpDocumentGetAttributeValuesOutput(v **GetAttributeValuesOutput, value interface{}) error {
1045	if v == nil {
1046		return fmt.Errorf("unexpected nil of type %T", v)
1047	}
1048	if value == nil {
1049		return nil
1050	}
1051
1052	shape, ok := value.(map[string]interface{})
1053	if !ok {
1054		return fmt.Errorf("unexpected JSON type %v", value)
1055	}
1056
1057	var sv *GetAttributeValuesOutput
1058	if *v == nil {
1059		sv = &GetAttributeValuesOutput{}
1060	} else {
1061		sv = *v
1062	}
1063
1064	for key, value := range shape {
1065		switch key {
1066		case "AttributeValues":
1067			if err := awsAwsjson11_deserializeDocumentAttributeValueList(&sv.AttributeValues, value); err != nil {
1068				return err
1069			}
1070
1071		case "NextToken":
1072			if value != nil {
1073				jtv, ok := value.(string)
1074				if !ok {
1075					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1076				}
1077				sv.NextToken = ptr.String(jtv)
1078			}
1079
1080		default:
1081			_, _ = key, value
1082
1083		}
1084	}
1085	*v = sv
1086	return nil
1087}
1088
1089func awsAwsjson11_deserializeOpDocumentGetProductsOutput(v **GetProductsOutput, value interface{}) error {
1090	if v == nil {
1091		return fmt.Errorf("unexpected nil of type %T", v)
1092	}
1093	if value == nil {
1094		return nil
1095	}
1096
1097	shape, ok := value.(map[string]interface{})
1098	if !ok {
1099		return fmt.Errorf("unexpected JSON type %v", value)
1100	}
1101
1102	var sv *GetProductsOutput
1103	if *v == nil {
1104		sv = &GetProductsOutput{}
1105	} else {
1106		sv = *v
1107	}
1108
1109	for key, value := range shape {
1110		switch key {
1111		case "FormatVersion":
1112			if value != nil {
1113				jtv, ok := value.(string)
1114				if !ok {
1115					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1116				}
1117				sv.FormatVersion = ptr.String(jtv)
1118			}
1119
1120		case "NextToken":
1121			if value != nil {
1122				jtv, ok := value.(string)
1123				if !ok {
1124					return fmt.Errorf("expected String to be of type string, got %T instead", value)
1125				}
1126				sv.NextToken = ptr.String(jtv)
1127			}
1128
1129		case "PriceList":
1130			if err := awsAwsjson11_deserializeDocumentPriceList(&sv.PriceList, value); err != nil {
1131				return err
1132			}
1133
1134		default:
1135			_, _ = key, value
1136
1137		}
1138	}
1139	*v = sv
1140	return nil
1141}
1142