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