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