1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package appmesh 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/appmesh/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_deserializeOpCreateGatewayRoute struct { 23} 24 25func (*awsRestjson1_deserializeOpCreateGatewayRoute) ID() string { 26 return "OperationDeserializer" 27} 28 29func (m *awsRestjson1_deserializeOpCreateGatewayRoute) 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_deserializeOpErrorCreateGatewayRoute(response, &metadata) 44 } 45 output := &CreateGatewayRouteOutput{} 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_deserializeDocumentGatewayRouteData(&output.GatewayRoute, 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_deserializeOpErrorCreateGatewayRoute(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("BadRequestException", errorCode): 121 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 122 123 case strings.EqualFold("ConflictException", errorCode): 124 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 125 126 case strings.EqualFold("ForbiddenException", errorCode): 127 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 128 129 case strings.EqualFold("InternalServerErrorException", errorCode): 130 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 131 132 case strings.EqualFold("LimitExceededException", errorCode): 133 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 134 135 case strings.EqualFold("NotFoundException", errorCode): 136 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 137 138 case strings.EqualFold("ServiceUnavailableException", errorCode): 139 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 140 141 case strings.EqualFold("TooManyRequestsException", errorCode): 142 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 143 144 default: 145 genericError := &smithy.GenericAPIError{ 146 Code: errorCode, 147 Message: errorMessage, 148 } 149 return genericError 150 151 } 152} 153 154func awsRestjson1_deserializeOpDocumentCreateGatewayRouteOutput(v **CreateGatewayRouteOutput, value interface{}) error { 155 if v == nil { 156 return fmt.Errorf("unexpected nil of type %T", v) 157 } 158 if value == nil { 159 return nil 160 } 161 162 shape, ok := value.(map[string]interface{}) 163 if !ok { 164 return fmt.Errorf("unexpected JSON type %v", value) 165 } 166 167 var sv *CreateGatewayRouteOutput 168 if *v == nil { 169 sv = &CreateGatewayRouteOutput{} 170 } else { 171 sv = *v 172 } 173 174 for key, value := range shape { 175 switch key { 176 case "gatewayRoute": 177 if err := awsRestjson1_deserializeDocumentGatewayRouteData(&sv.GatewayRoute, value); err != nil { 178 return err 179 } 180 181 default: 182 _, _ = key, value 183 184 } 185 } 186 *v = sv 187 return nil 188} 189 190type awsRestjson1_deserializeOpCreateMesh struct { 191} 192 193func (*awsRestjson1_deserializeOpCreateMesh) ID() string { 194 return "OperationDeserializer" 195} 196 197func (m *awsRestjson1_deserializeOpCreateMesh) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 198 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 199) { 200 out, metadata, err = next.HandleDeserialize(ctx, in) 201 if err != nil { 202 return out, metadata, err 203 } 204 205 response, ok := out.RawResponse.(*smithyhttp.Response) 206 if !ok { 207 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 208 } 209 210 if response.StatusCode < 200 || response.StatusCode >= 300 { 211 return out, metadata, awsRestjson1_deserializeOpErrorCreateMesh(response, &metadata) 212 } 213 output := &CreateMeshOutput{} 214 out.Result = output 215 216 var buff [1024]byte 217 ringBuffer := smithyio.NewRingBuffer(buff[:]) 218 219 body := io.TeeReader(response.Body, ringBuffer) 220 221 decoder := json.NewDecoder(body) 222 decoder.UseNumber() 223 var shape interface{} 224 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 225 var snapshot bytes.Buffer 226 io.Copy(&snapshot, ringBuffer) 227 err = &smithy.DeserializationError{ 228 Err: fmt.Errorf("failed to decode response body, %w", err), 229 Snapshot: snapshot.Bytes(), 230 } 231 return out, metadata, err 232 } 233 234 err = awsRestjson1_deserializeDocumentMeshData(&output.Mesh, shape) 235 if err != nil { 236 var snapshot bytes.Buffer 237 io.Copy(&snapshot, ringBuffer) 238 return out, metadata, &smithy.DeserializationError{ 239 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 240 Snapshot: snapshot.Bytes(), 241 } 242 } 243 244 return out, metadata, err 245} 246 247func awsRestjson1_deserializeOpErrorCreateMesh(response *smithyhttp.Response, metadata *middleware.Metadata) error { 248 var errorBuffer bytes.Buffer 249 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 250 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 251 } 252 errorBody := bytes.NewReader(errorBuffer.Bytes()) 253 254 errorCode := "UnknownError" 255 errorMessage := errorCode 256 257 code := response.Header.Get("X-Amzn-ErrorType") 258 if len(code) != 0 { 259 errorCode = restjson.SanitizeErrorCode(code) 260 } 261 262 var buff [1024]byte 263 ringBuffer := smithyio.NewRingBuffer(buff[:]) 264 265 body := io.TeeReader(errorBody, ringBuffer) 266 decoder := json.NewDecoder(body) 267 decoder.UseNumber() 268 code, message, err := restjson.GetErrorInfo(decoder) 269 if err != nil { 270 var snapshot bytes.Buffer 271 io.Copy(&snapshot, ringBuffer) 272 err = &smithy.DeserializationError{ 273 Err: fmt.Errorf("failed to decode response body, %w", err), 274 Snapshot: snapshot.Bytes(), 275 } 276 return err 277 } 278 279 errorBody.Seek(0, io.SeekStart) 280 if len(code) != 0 { 281 errorCode = restjson.SanitizeErrorCode(code) 282 } 283 if len(message) != 0 { 284 errorMessage = message 285 } 286 287 switch { 288 case strings.EqualFold("BadRequestException", errorCode): 289 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 290 291 case strings.EqualFold("ConflictException", errorCode): 292 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 293 294 case strings.EqualFold("ForbiddenException", errorCode): 295 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 296 297 case strings.EqualFold("InternalServerErrorException", errorCode): 298 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 299 300 case strings.EqualFold("LimitExceededException", errorCode): 301 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 302 303 case strings.EqualFold("NotFoundException", errorCode): 304 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 305 306 case strings.EqualFold("ServiceUnavailableException", errorCode): 307 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 308 309 case strings.EqualFold("TooManyRequestsException", errorCode): 310 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 311 312 default: 313 genericError := &smithy.GenericAPIError{ 314 Code: errorCode, 315 Message: errorMessage, 316 } 317 return genericError 318 319 } 320} 321 322func awsRestjson1_deserializeOpDocumentCreateMeshOutput(v **CreateMeshOutput, value interface{}) error { 323 if v == nil { 324 return fmt.Errorf("unexpected nil of type %T", v) 325 } 326 if value == nil { 327 return nil 328 } 329 330 shape, ok := value.(map[string]interface{}) 331 if !ok { 332 return fmt.Errorf("unexpected JSON type %v", value) 333 } 334 335 var sv *CreateMeshOutput 336 if *v == nil { 337 sv = &CreateMeshOutput{} 338 } else { 339 sv = *v 340 } 341 342 for key, value := range shape { 343 switch key { 344 case "mesh": 345 if err := awsRestjson1_deserializeDocumentMeshData(&sv.Mesh, value); err != nil { 346 return err 347 } 348 349 default: 350 _, _ = key, value 351 352 } 353 } 354 *v = sv 355 return nil 356} 357 358type awsRestjson1_deserializeOpCreateRoute struct { 359} 360 361func (*awsRestjson1_deserializeOpCreateRoute) ID() string { 362 return "OperationDeserializer" 363} 364 365func (m *awsRestjson1_deserializeOpCreateRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 366 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 367) { 368 out, metadata, err = next.HandleDeserialize(ctx, in) 369 if err != nil { 370 return out, metadata, err 371 } 372 373 response, ok := out.RawResponse.(*smithyhttp.Response) 374 if !ok { 375 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 376 } 377 378 if response.StatusCode < 200 || response.StatusCode >= 300 { 379 return out, metadata, awsRestjson1_deserializeOpErrorCreateRoute(response, &metadata) 380 } 381 output := &CreateRouteOutput{} 382 out.Result = output 383 384 var buff [1024]byte 385 ringBuffer := smithyio.NewRingBuffer(buff[:]) 386 387 body := io.TeeReader(response.Body, ringBuffer) 388 389 decoder := json.NewDecoder(body) 390 decoder.UseNumber() 391 var shape interface{} 392 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 393 var snapshot bytes.Buffer 394 io.Copy(&snapshot, ringBuffer) 395 err = &smithy.DeserializationError{ 396 Err: fmt.Errorf("failed to decode response body, %w", err), 397 Snapshot: snapshot.Bytes(), 398 } 399 return out, metadata, err 400 } 401 402 err = awsRestjson1_deserializeDocumentRouteData(&output.Route, shape) 403 if err != nil { 404 var snapshot bytes.Buffer 405 io.Copy(&snapshot, ringBuffer) 406 return out, metadata, &smithy.DeserializationError{ 407 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 408 Snapshot: snapshot.Bytes(), 409 } 410 } 411 412 return out, metadata, err 413} 414 415func awsRestjson1_deserializeOpErrorCreateRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 416 var errorBuffer bytes.Buffer 417 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 418 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 419 } 420 errorBody := bytes.NewReader(errorBuffer.Bytes()) 421 422 errorCode := "UnknownError" 423 errorMessage := errorCode 424 425 code := response.Header.Get("X-Amzn-ErrorType") 426 if len(code) != 0 { 427 errorCode = restjson.SanitizeErrorCode(code) 428 } 429 430 var buff [1024]byte 431 ringBuffer := smithyio.NewRingBuffer(buff[:]) 432 433 body := io.TeeReader(errorBody, ringBuffer) 434 decoder := json.NewDecoder(body) 435 decoder.UseNumber() 436 code, message, err := restjson.GetErrorInfo(decoder) 437 if err != nil { 438 var snapshot bytes.Buffer 439 io.Copy(&snapshot, ringBuffer) 440 err = &smithy.DeserializationError{ 441 Err: fmt.Errorf("failed to decode response body, %w", err), 442 Snapshot: snapshot.Bytes(), 443 } 444 return err 445 } 446 447 errorBody.Seek(0, io.SeekStart) 448 if len(code) != 0 { 449 errorCode = restjson.SanitizeErrorCode(code) 450 } 451 if len(message) != 0 { 452 errorMessage = message 453 } 454 455 switch { 456 case strings.EqualFold("BadRequestException", errorCode): 457 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 458 459 case strings.EqualFold("ConflictException", errorCode): 460 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 461 462 case strings.EqualFold("ForbiddenException", errorCode): 463 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 464 465 case strings.EqualFold("InternalServerErrorException", errorCode): 466 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 467 468 case strings.EqualFold("LimitExceededException", errorCode): 469 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 470 471 case strings.EqualFold("NotFoundException", errorCode): 472 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 473 474 case strings.EqualFold("ServiceUnavailableException", errorCode): 475 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 476 477 case strings.EqualFold("TooManyRequestsException", errorCode): 478 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 479 480 default: 481 genericError := &smithy.GenericAPIError{ 482 Code: errorCode, 483 Message: errorMessage, 484 } 485 return genericError 486 487 } 488} 489 490func awsRestjson1_deserializeOpDocumentCreateRouteOutput(v **CreateRouteOutput, value interface{}) error { 491 if v == nil { 492 return fmt.Errorf("unexpected nil of type %T", v) 493 } 494 if value == nil { 495 return nil 496 } 497 498 shape, ok := value.(map[string]interface{}) 499 if !ok { 500 return fmt.Errorf("unexpected JSON type %v", value) 501 } 502 503 var sv *CreateRouteOutput 504 if *v == nil { 505 sv = &CreateRouteOutput{} 506 } else { 507 sv = *v 508 } 509 510 for key, value := range shape { 511 switch key { 512 case "route": 513 if err := awsRestjson1_deserializeDocumentRouteData(&sv.Route, value); err != nil { 514 return err 515 } 516 517 default: 518 _, _ = key, value 519 520 } 521 } 522 *v = sv 523 return nil 524} 525 526type awsRestjson1_deserializeOpCreateVirtualGateway struct { 527} 528 529func (*awsRestjson1_deserializeOpCreateVirtualGateway) ID() string { 530 return "OperationDeserializer" 531} 532 533func (m *awsRestjson1_deserializeOpCreateVirtualGateway) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 534 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 535) { 536 out, metadata, err = next.HandleDeserialize(ctx, in) 537 if err != nil { 538 return out, metadata, err 539 } 540 541 response, ok := out.RawResponse.(*smithyhttp.Response) 542 if !ok { 543 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 544 } 545 546 if response.StatusCode < 200 || response.StatusCode >= 300 { 547 return out, metadata, awsRestjson1_deserializeOpErrorCreateVirtualGateway(response, &metadata) 548 } 549 output := &CreateVirtualGatewayOutput{} 550 out.Result = output 551 552 var buff [1024]byte 553 ringBuffer := smithyio.NewRingBuffer(buff[:]) 554 555 body := io.TeeReader(response.Body, ringBuffer) 556 557 decoder := json.NewDecoder(body) 558 decoder.UseNumber() 559 var shape interface{} 560 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 561 var snapshot bytes.Buffer 562 io.Copy(&snapshot, ringBuffer) 563 err = &smithy.DeserializationError{ 564 Err: fmt.Errorf("failed to decode response body, %w", err), 565 Snapshot: snapshot.Bytes(), 566 } 567 return out, metadata, err 568 } 569 570 err = awsRestjson1_deserializeDocumentVirtualGatewayData(&output.VirtualGateway, shape) 571 if err != nil { 572 var snapshot bytes.Buffer 573 io.Copy(&snapshot, ringBuffer) 574 return out, metadata, &smithy.DeserializationError{ 575 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 576 Snapshot: snapshot.Bytes(), 577 } 578 } 579 580 return out, metadata, err 581} 582 583func awsRestjson1_deserializeOpErrorCreateVirtualGateway(response *smithyhttp.Response, metadata *middleware.Metadata) error { 584 var errorBuffer bytes.Buffer 585 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 586 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 587 } 588 errorBody := bytes.NewReader(errorBuffer.Bytes()) 589 590 errorCode := "UnknownError" 591 errorMessage := errorCode 592 593 code := response.Header.Get("X-Amzn-ErrorType") 594 if len(code) != 0 { 595 errorCode = restjson.SanitizeErrorCode(code) 596 } 597 598 var buff [1024]byte 599 ringBuffer := smithyio.NewRingBuffer(buff[:]) 600 601 body := io.TeeReader(errorBody, ringBuffer) 602 decoder := json.NewDecoder(body) 603 decoder.UseNumber() 604 code, message, err := restjson.GetErrorInfo(decoder) 605 if err != nil { 606 var snapshot bytes.Buffer 607 io.Copy(&snapshot, ringBuffer) 608 err = &smithy.DeserializationError{ 609 Err: fmt.Errorf("failed to decode response body, %w", err), 610 Snapshot: snapshot.Bytes(), 611 } 612 return err 613 } 614 615 errorBody.Seek(0, io.SeekStart) 616 if len(code) != 0 { 617 errorCode = restjson.SanitizeErrorCode(code) 618 } 619 if len(message) != 0 { 620 errorMessage = message 621 } 622 623 switch { 624 case strings.EqualFold("BadRequestException", errorCode): 625 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 626 627 case strings.EqualFold("ConflictException", errorCode): 628 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 629 630 case strings.EqualFold("ForbiddenException", errorCode): 631 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 632 633 case strings.EqualFold("InternalServerErrorException", errorCode): 634 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 635 636 case strings.EqualFold("LimitExceededException", errorCode): 637 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 638 639 case strings.EqualFold("NotFoundException", errorCode): 640 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 641 642 case strings.EqualFold("ServiceUnavailableException", errorCode): 643 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 644 645 case strings.EqualFold("TooManyRequestsException", errorCode): 646 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 647 648 default: 649 genericError := &smithy.GenericAPIError{ 650 Code: errorCode, 651 Message: errorMessage, 652 } 653 return genericError 654 655 } 656} 657 658func awsRestjson1_deserializeOpDocumentCreateVirtualGatewayOutput(v **CreateVirtualGatewayOutput, value interface{}) error { 659 if v == nil { 660 return fmt.Errorf("unexpected nil of type %T", v) 661 } 662 if value == nil { 663 return nil 664 } 665 666 shape, ok := value.(map[string]interface{}) 667 if !ok { 668 return fmt.Errorf("unexpected JSON type %v", value) 669 } 670 671 var sv *CreateVirtualGatewayOutput 672 if *v == nil { 673 sv = &CreateVirtualGatewayOutput{} 674 } else { 675 sv = *v 676 } 677 678 for key, value := range shape { 679 switch key { 680 case "virtualGateway": 681 if err := awsRestjson1_deserializeDocumentVirtualGatewayData(&sv.VirtualGateway, value); err != nil { 682 return err 683 } 684 685 default: 686 _, _ = key, value 687 688 } 689 } 690 *v = sv 691 return nil 692} 693 694type awsRestjson1_deserializeOpCreateVirtualNode struct { 695} 696 697func (*awsRestjson1_deserializeOpCreateVirtualNode) ID() string { 698 return "OperationDeserializer" 699} 700 701func (m *awsRestjson1_deserializeOpCreateVirtualNode) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 702 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 703) { 704 out, metadata, err = next.HandleDeserialize(ctx, in) 705 if err != nil { 706 return out, metadata, err 707 } 708 709 response, ok := out.RawResponse.(*smithyhttp.Response) 710 if !ok { 711 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 712 } 713 714 if response.StatusCode < 200 || response.StatusCode >= 300 { 715 return out, metadata, awsRestjson1_deserializeOpErrorCreateVirtualNode(response, &metadata) 716 } 717 output := &CreateVirtualNodeOutput{} 718 out.Result = output 719 720 var buff [1024]byte 721 ringBuffer := smithyio.NewRingBuffer(buff[:]) 722 723 body := io.TeeReader(response.Body, ringBuffer) 724 725 decoder := json.NewDecoder(body) 726 decoder.UseNumber() 727 var shape interface{} 728 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 729 var snapshot bytes.Buffer 730 io.Copy(&snapshot, ringBuffer) 731 err = &smithy.DeserializationError{ 732 Err: fmt.Errorf("failed to decode response body, %w", err), 733 Snapshot: snapshot.Bytes(), 734 } 735 return out, metadata, err 736 } 737 738 err = awsRestjson1_deserializeDocumentVirtualNodeData(&output.VirtualNode, shape) 739 if err != nil { 740 var snapshot bytes.Buffer 741 io.Copy(&snapshot, ringBuffer) 742 return out, metadata, &smithy.DeserializationError{ 743 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 744 Snapshot: snapshot.Bytes(), 745 } 746 } 747 748 return out, metadata, err 749} 750 751func awsRestjson1_deserializeOpErrorCreateVirtualNode(response *smithyhttp.Response, metadata *middleware.Metadata) error { 752 var errorBuffer bytes.Buffer 753 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 754 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 755 } 756 errorBody := bytes.NewReader(errorBuffer.Bytes()) 757 758 errorCode := "UnknownError" 759 errorMessage := errorCode 760 761 code := response.Header.Get("X-Amzn-ErrorType") 762 if len(code) != 0 { 763 errorCode = restjson.SanitizeErrorCode(code) 764 } 765 766 var buff [1024]byte 767 ringBuffer := smithyio.NewRingBuffer(buff[:]) 768 769 body := io.TeeReader(errorBody, ringBuffer) 770 decoder := json.NewDecoder(body) 771 decoder.UseNumber() 772 code, message, err := restjson.GetErrorInfo(decoder) 773 if err != nil { 774 var snapshot bytes.Buffer 775 io.Copy(&snapshot, ringBuffer) 776 err = &smithy.DeserializationError{ 777 Err: fmt.Errorf("failed to decode response body, %w", err), 778 Snapshot: snapshot.Bytes(), 779 } 780 return err 781 } 782 783 errorBody.Seek(0, io.SeekStart) 784 if len(code) != 0 { 785 errorCode = restjson.SanitizeErrorCode(code) 786 } 787 if len(message) != 0 { 788 errorMessage = message 789 } 790 791 switch { 792 case strings.EqualFold("BadRequestException", errorCode): 793 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 794 795 case strings.EqualFold("ConflictException", errorCode): 796 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 797 798 case strings.EqualFold("ForbiddenException", errorCode): 799 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 800 801 case strings.EqualFold("InternalServerErrorException", errorCode): 802 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 803 804 case strings.EqualFold("LimitExceededException", errorCode): 805 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 806 807 case strings.EqualFold("NotFoundException", errorCode): 808 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 809 810 case strings.EqualFold("ServiceUnavailableException", errorCode): 811 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 812 813 case strings.EqualFold("TooManyRequestsException", errorCode): 814 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 815 816 default: 817 genericError := &smithy.GenericAPIError{ 818 Code: errorCode, 819 Message: errorMessage, 820 } 821 return genericError 822 823 } 824} 825 826func awsRestjson1_deserializeOpDocumentCreateVirtualNodeOutput(v **CreateVirtualNodeOutput, value interface{}) error { 827 if v == nil { 828 return fmt.Errorf("unexpected nil of type %T", v) 829 } 830 if value == nil { 831 return nil 832 } 833 834 shape, ok := value.(map[string]interface{}) 835 if !ok { 836 return fmt.Errorf("unexpected JSON type %v", value) 837 } 838 839 var sv *CreateVirtualNodeOutput 840 if *v == nil { 841 sv = &CreateVirtualNodeOutput{} 842 } else { 843 sv = *v 844 } 845 846 for key, value := range shape { 847 switch key { 848 case "virtualNode": 849 if err := awsRestjson1_deserializeDocumentVirtualNodeData(&sv.VirtualNode, value); err != nil { 850 return err 851 } 852 853 default: 854 _, _ = key, value 855 856 } 857 } 858 *v = sv 859 return nil 860} 861 862type awsRestjson1_deserializeOpCreateVirtualRouter struct { 863} 864 865func (*awsRestjson1_deserializeOpCreateVirtualRouter) ID() string { 866 return "OperationDeserializer" 867} 868 869func (m *awsRestjson1_deserializeOpCreateVirtualRouter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 870 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 871) { 872 out, metadata, err = next.HandleDeserialize(ctx, in) 873 if err != nil { 874 return out, metadata, err 875 } 876 877 response, ok := out.RawResponse.(*smithyhttp.Response) 878 if !ok { 879 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 880 } 881 882 if response.StatusCode < 200 || response.StatusCode >= 300 { 883 return out, metadata, awsRestjson1_deserializeOpErrorCreateVirtualRouter(response, &metadata) 884 } 885 output := &CreateVirtualRouterOutput{} 886 out.Result = output 887 888 var buff [1024]byte 889 ringBuffer := smithyio.NewRingBuffer(buff[:]) 890 891 body := io.TeeReader(response.Body, ringBuffer) 892 893 decoder := json.NewDecoder(body) 894 decoder.UseNumber() 895 var shape interface{} 896 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 897 var snapshot bytes.Buffer 898 io.Copy(&snapshot, ringBuffer) 899 err = &smithy.DeserializationError{ 900 Err: fmt.Errorf("failed to decode response body, %w", err), 901 Snapshot: snapshot.Bytes(), 902 } 903 return out, metadata, err 904 } 905 906 err = awsRestjson1_deserializeDocumentVirtualRouterData(&output.VirtualRouter, shape) 907 if err != nil { 908 var snapshot bytes.Buffer 909 io.Copy(&snapshot, ringBuffer) 910 return out, metadata, &smithy.DeserializationError{ 911 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 912 Snapshot: snapshot.Bytes(), 913 } 914 } 915 916 return out, metadata, err 917} 918 919func awsRestjson1_deserializeOpErrorCreateVirtualRouter(response *smithyhttp.Response, metadata *middleware.Metadata) error { 920 var errorBuffer bytes.Buffer 921 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 922 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 923 } 924 errorBody := bytes.NewReader(errorBuffer.Bytes()) 925 926 errorCode := "UnknownError" 927 errorMessage := errorCode 928 929 code := response.Header.Get("X-Amzn-ErrorType") 930 if len(code) != 0 { 931 errorCode = restjson.SanitizeErrorCode(code) 932 } 933 934 var buff [1024]byte 935 ringBuffer := smithyio.NewRingBuffer(buff[:]) 936 937 body := io.TeeReader(errorBody, ringBuffer) 938 decoder := json.NewDecoder(body) 939 decoder.UseNumber() 940 code, message, err := restjson.GetErrorInfo(decoder) 941 if err != nil { 942 var snapshot bytes.Buffer 943 io.Copy(&snapshot, ringBuffer) 944 err = &smithy.DeserializationError{ 945 Err: fmt.Errorf("failed to decode response body, %w", err), 946 Snapshot: snapshot.Bytes(), 947 } 948 return err 949 } 950 951 errorBody.Seek(0, io.SeekStart) 952 if len(code) != 0 { 953 errorCode = restjson.SanitizeErrorCode(code) 954 } 955 if len(message) != 0 { 956 errorMessage = message 957 } 958 959 switch { 960 case strings.EqualFold("BadRequestException", errorCode): 961 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 962 963 case strings.EqualFold("ConflictException", errorCode): 964 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 965 966 case strings.EqualFold("ForbiddenException", errorCode): 967 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 968 969 case strings.EqualFold("InternalServerErrorException", errorCode): 970 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 971 972 case strings.EqualFold("LimitExceededException", errorCode): 973 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 974 975 case strings.EqualFold("NotFoundException", errorCode): 976 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 977 978 case strings.EqualFold("ServiceUnavailableException", errorCode): 979 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 980 981 case strings.EqualFold("TooManyRequestsException", errorCode): 982 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 983 984 default: 985 genericError := &smithy.GenericAPIError{ 986 Code: errorCode, 987 Message: errorMessage, 988 } 989 return genericError 990 991 } 992} 993 994func awsRestjson1_deserializeOpDocumentCreateVirtualRouterOutput(v **CreateVirtualRouterOutput, value interface{}) error { 995 if v == nil { 996 return fmt.Errorf("unexpected nil of type %T", v) 997 } 998 if value == nil { 999 return nil 1000 } 1001 1002 shape, ok := value.(map[string]interface{}) 1003 if !ok { 1004 return fmt.Errorf("unexpected JSON type %v", value) 1005 } 1006 1007 var sv *CreateVirtualRouterOutput 1008 if *v == nil { 1009 sv = &CreateVirtualRouterOutput{} 1010 } else { 1011 sv = *v 1012 } 1013 1014 for key, value := range shape { 1015 switch key { 1016 case "virtualRouter": 1017 if err := awsRestjson1_deserializeDocumentVirtualRouterData(&sv.VirtualRouter, value); err != nil { 1018 return err 1019 } 1020 1021 default: 1022 _, _ = key, value 1023 1024 } 1025 } 1026 *v = sv 1027 return nil 1028} 1029 1030type awsRestjson1_deserializeOpCreateVirtualService struct { 1031} 1032 1033func (*awsRestjson1_deserializeOpCreateVirtualService) ID() string { 1034 return "OperationDeserializer" 1035} 1036 1037func (m *awsRestjson1_deserializeOpCreateVirtualService) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1038 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1039) { 1040 out, metadata, err = next.HandleDeserialize(ctx, in) 1041 if err != nil { 1042 return out, metadata, err 1043 } 1044 1045 response, ok := out.RawResponse.(*smithyhttp.Response) 1046 if !ok { 1047 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1048 } 1049 1050 if response.StatusCode < 200 || response.StatusCode >= 300 { 1051 return out, metadata, awsRestjson1_deserializeOpErrorCreateVirtualService(response, &metadata) 1052 } 1053 output := &CreateVirtualServiceOutput{} 1054 out.Result = output 1055 1056 var buff [1024]byte 1057 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1058 1059 body := io.TeeReader(response.Body, ringBuffer) 1060 1061 decoder := json.NewDecoder(body) 1062 decoder.UseNumber() 1063 var shape interface{} 1064 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1065 var snapshot bytes.Buffer 1066 io.Copy(&snapshot, ringBuffer) 1067 err = &smithy.DeserializationError{ 1068 Err: fmt.Errorf("failed to decode response body, %w", err), 1069 Snapshot: snapshot.Bytes(), 1070 } 1071 return out, metadata, err 1072 } 1073 1074 err = awsRestjson1_deserializeDocumentVirtualServiceData(&output.VirtualService, shape) 1075 if err != nil { 1076 var snapshot bytes.Buffer 1077 io.Copy(&snapshot, ringBuffer) 1078 return out, metadata, &smithy.DeserializationError{ 1079 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1080 Snapshot: snapshot.Bytes(), 1081 } 1082 } 1083 1084 return out, metadata, err 1085} 1086 1087func awsRestjson1_deserializeOpErrorCreateVirtualService(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1088 var errorBuffer bytes.Buffer 1089 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1090 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1091 } 1092 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1093 1094 errorCode := "UnknownError" 1095 errorMessage := errorCode 1096 1097 code := response.Header.Get("X-Amzn-ErrorType") 1098 if len(code) != 0 { 1099 errorCode = restjson.SanitizeErrorCode(code) 1100 } 1101 1102 var buff [1024]byte 1103 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1104 1105 body := io.TeeReader(errorBody, ringBuffer) 1106 decoder := json.NewDecoder(body) 1107 decoder.UseNumber() 1108 code, message, err := restjson.GetErrorInfo(decoder) 1109 if err != nil { 1110 var snapshot bytes.Buffer 1111 io.Copy(&snapshot, ringBuffer) 1112 err = &smithy.DeserializationError{ 1113 Err: fmt.Errorf("failed to decode response body, %w", err), 1114 Snapshot: snapshot.Bytes(), 1115 } 1116 return err 1117 } 1118 1119 errorBody.Seek(0, io.SeekStart) 1120 if len(code) != 0 { 1121 errorCode = restjson.SanitizeErrorCode(code) 1122 } 1123 if len(message) != 0 { 1124 errorMessage = message 1125 } 1126 1127 switch { 1128 case strings.EqualFold("BadRequestException", errorCode): 1129 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1130 1131 case strings.EqualFold("ConflictException", errorCode): 1132 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1133 1134 case strings.EqualFold("ForbiddenException", errorCode): 1135 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1136 1137 case strings.EqualFold("InternalServerErrorException", errorCode): 1138 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1139 1140 case strings.EqualFold("LimitExceededException", errorCode): 1141 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1142 1143 case strings.EqualFold("NotFoundException", errorCode): 1144 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1145 1146 case strings.EqualFold("ServiceUnavailableException", errorCode): 1147 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1148 1149 case strings.EqualFold("TooManyRequestsException", errorCode): 1150 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1151 1152 default: 1153 genericError := &smithy.GenericAPIError{ 1154 Code: errorCode, 1155 Message: errorMessage, 1156 } 1157 return genericError 1158 1159 } 1160} 1161 1162func awsRestjson1_deserializeOpDocumentCreateVirtualServiceOutput(v **CreateVirtualServiceOutput, value interface{}) error { 1163 if v == nil { 1164 return fmt.Errorf("unexpected nil of type %T", v) 1165 } 1166 if value == nil { 1167 return nil 1168 } 1169 1170 shape, ok := value.(map[string]interface{}) 1171 if !ok { 1172 return fmt.Errorf("unexpected JSON type %v", value) 1173 } 1174 1175 var sv *CreateVirtualServiceOutput 1176 if *v == nil { 1177 sv = &CreateVirtualServiceOutput{} 1178 } else { 1179 sv = *v 1180 } 1181 1182 for key, value := range shape { 1183 switch key { 1184 case "virtualService": 1185 if err := awsRestjson1_deserializeDocumentVirtualServiceData(&sv.VirtualService, value); err != nil { 1186 return err 1187 } 1188 1189 default: 1190 _, _ = key, value 1191 1192 } 1193 } 1194 *v = sv 1195 return nil 1196} 1197 1198type awsRestjson1_deserializeOpDeleteGatewayRoute struct { 1199} 1200 1201func (*awsRestjson1_deserializeOpDeleteGatewayRoute) ID() string { 1202 return "OperationDeserializer" 1203} 1204 1205func (m *awsRestjson1_deserializeOpDeleteGatewayRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1206 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1207) { 1208 out, metadata, err = next.HandleDeserialize(ctx, in) 1209 if err != nil { 1210 return out, metadata, err 1211 } 1212 1213 response, ok := out.RawResponse.(*smithyhttp.Response) 1214 if !ok { 1215 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1216 } 1217 1218 if response.StatusCode < 200 || response.StatusCode >= 300 { 1219 return out, metadata, awsRestjson1_deserializeOpErrorDeleteGatewayRoute(response, &metadata) 1220 } 1221 output := &DeleteGatewayRouteOutput{} 1222 out.Result = output 1223 1224 var buff [1024]byte 1225 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1226 1227 body := io.TeeReader(response.Body, ringBuffer) 1228 1229 decoder := json.NewDecoder(body) 1230 decoder.UseNumber() 1231 var shape interface{} 1232 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1233 var snapshot bytes.Buffer 1234 io.Copy(&snapshot, ringBuffer) 1235 err = &smithy.DeserializationError{ 1236 Err: fmt.Errorf("failed to decode response body, %w", err), 1237 Snapshot: snapshot.Bytes(), 1238 } 1239 return out, metadata, err 1240 } 1241 1242 err = awsRestjson1_deserializeDocumentGatewayRouteData(&output.GatewayRoute, shape) 1243 if err != nil { 1244 var snapshot bytes.Buffer 1245 io.Copy(&snapshot, ringBuffer) 1246 return out, metadata, &smithy.DeserializationError{ 1247 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1248 Snapshot: snapshot.Bytes(), 1249 } 1250 } 1251 1252 return out, metadata, err 1253} 1254 1255func awsRestjson1_deserializeOpErrorDeleteGatewayRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1256 var errorBuffer bytes.Buffer 1257 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1258 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1259 } 1260 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1261 1262 errorCode := "UnknownError" 1263 errorMessage := errorCode 1264 1265 code := response.Header.Get("X-Amzn-ErrorType") 1266 if len(code) != 0 { 1267 errorCode = restjson.SanitizeErrorCode(code) 1268 } 1269 1270 var buff [1024]byte 1271 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1272 1273 body := io.TeeReader(errorBody, ringBuffer) 1274 decoder := json.NewDecoder(body) 1275 decoder.UseNumber() 1276 code, message, err := restjson.GetErrorInfo(decoder) 1277 if err != nil { 1278 var snapshot bytes.Buffer 1279 io.Copy(&snapshot, ringBuffer) 1280 err = &smithy.DeserializationError{ 1281 Err: fmt.Errorf("failed to decode response body, %w", err), 1282 Snapshot: snapshot.Bytes(), 1283 } 1284 return err 1285 } 1286 1287 errorBody.Seek(0, io.SeekStart) 1288 if len(code) != 0 { 1289 errorCode = restjson.SanitizeErrorCode(code) 1290 } 1291 if len(message) != 0 { 1292 errorMessage = message 1293 } 1294 1295 switch { 1296 case strings.EqualFold("BadRequestException", errorCode): 1297 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1298 1299 case strings.EqualFold("ForbiddenException", errorCode): 1300 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1301 1302 case strings.EqualFold("InternalServerErrorException", errorCode): 1303 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1304 1305 case strings.EqualFold("NotFoundException", errorCode): 1306 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1307 1308 case strings.EqualFold("ResourceInUseException", errorCode): 1309 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 1310 1311 case strings.EqualFold("ServiceUnavailableException", errorCode): 1312 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1313 1314 case strings.EqualFold("TooManyRequestsException", errorCode): 1315 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1316 1317 default: 1318 genericError := &smithy.GenericAPIError{ 1319 Code: errorCode, 1320 Message: errorMessage, 1321 } 1322 return genericError 1323 1324 } 1325} 1326 1327func awsRestjson1_deserializeOpDocumentDeleteGatewayRouteOutput(v **DeleteGatewayRouteOutput, value interface{}) error { 1328 if v == nil { 1329 return fmt.Errorf("unexpected nil of type %T", v) 1330 } 1331 if value == nil { 1332 return nil 1333 } 1334 1335 shape, ok := value.(map[string]interface{}) 1336 if !ok { 1337 return fmt.Errorf("unexpected JSON type %v", value) 1338 } 1339 1340 var sv *DeleteGatewayRouteOutput 1341 if *v == nil { 1342 sv = &DeleteGatewayRouteOutput{} 1343 } else { 1344 sv = *v 1345 } 1346 1347 for key, value := range shape { 1348 switch key { 1349 case "gatewayRoute": 1350 if err := awsRestjson1_deserializeDocumentGatewayRouteData(&sv.GatewayRoute, value); err != nil { 1351 return err 1352 } 1353 1354 default: 1355 _, _ = key, value 1356 1357 } 1358 } 1359 *v = sv 1360 return nil 1361} 1362 1363type awsRestjson1_deserializeOpDeleteMesh struct { 1364} 1365 1366func (*awsRestjson1_deserializeOpDeleteMesh) ID() string { 1367 return "OperationDeserializer" 1368} 1369 1370func (m *awsRestjson1_deserializeOpDeleteMesh) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1371 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1372) { 1373 out, metadata, err = next.HandleDeserialize(ctx, in) 1374 if err != nil { 1375 return out, metadata, err 1376 } 1377 1378 response, ok := out.RawResponse.(*smithyhttp.Response) 1379 if !ok { 1380 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1381 } 1382 1383 if response.StatusCode < 200 || response.StatusCode >= 300 { 1384 return out, metadata, awsRestjson1_deserializeOpErrorDeleteMesh(response, &metadata) 1385 } 1386 output := &DeleteMeshOutput{} 1387 out.Result = output 1388 1389 var buff [1024]byte 1390 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1391 1392 body := io.TeeReader(response.Body, ringBuffer) 1393 1394 decoder := json.NewDecoder(body) 1395 decoder.UseNumber() 1396 var shape interface{} 1397 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1398 var snapshot bytes.Buffer 1399 io.Copy(&snapshot, ringBuffer) 1400 err = &smithy.DeserializationError{ 1401 Err: fmt.Errorf("failed to decode response body, %w", err), 1402 Snapshot: snapshot.Bytes(), 1403 } 1404 return out, metadata, err 1405 } 1406 1407 err = awsRestjson1_deserializeDocumentMeshData(&output.Mesh, shape) 1408 if err != nil { 1409 var snapshot bytes.Buffer 1410 io.Copy(&snapshot, ringBuffer) 1411 return out, metadata, &smithy.DeserializationError{ 1412 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1413 Snapshot: snapshot.Bytes(), 1414 } 1415 } 1416 1417 return out, metadata, err 1418} 1419 1420func awsRestjson1_deserializeOpErrorDeleteMesh(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1421 var errorBuffer bytes.Buffer 1422 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1423 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1424 } 1425 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1426 1427 errorCode := "UnknownError" 1428 errorMessage := errorCode 1429 1430 code := response.Header.Get("X-Amzn-ErrorType") 1431 if len(code) != 0 { 1432 errorCode = restjson.SanitizeErrorCode(code) 1433 } 1434 1435 var buff [1024]byte 1436 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1437 1438 body := io.TeeReader(errorBody, ringBuffer) 1439 decoder := json.NewDecoder(body) 1440 decoder.UseNumber() 1441 code, message, err := restjson.GetErrorInfo(decoder) 1442 if err != nil { 1443 var snapshot bytes.Buffer 1444 io.Copy(&snapshot, ringBuffer) 1445 err = &smithy.DeserializationError{ 1446 Err: fmt.Errorf("failed to decode response body, %w", err), 1447 Snapshot: snapshot.Bytes(), 1448 } 1449 return err 1450 } 1451 1452 errorBody.Seek(0, io.SeekStart) 1453 if len(code) != 0 { 1454 errorCode = restjson.SanitizeErrorCode(code) 1455 } 1456 if len(message) != 0 { 1457 errorMessage = message 1458 } 1459 1460 switch { 1461 case strings.EqualFold("BadRequestException", errorCode): 1462 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1463 1464 case strings.EqualFold("ForbiddenException", errorCode): 1465 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1466 1467 case strings.EqualFold("InternalServerErrorException", errorCode): 1468 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1469 1470 case strings.EqualFold("NotFoundException", errorCode): 1471 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1472 1473 case strings.EqualFold("ResourceInUseException", errorCode): 1474 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 1475 1476 case strings.EqualFold("ServiceUnavailableException", errorCode): 1477 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1478 1479 case strings.EqualFold("TooManyRequestsException", errorCode): 1480 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1481 1482 default: 1483 genericError := &smithy.GenericAPIError{ 1484 Code: errorCode, 1485 Message: errorMessage, 1486 } 1487 return genericError 1488 1489 } 1490} 1491 1492func awsRestjson1_deserializeOpDocumentDeleteMeshOutput(v **DeleteMeshOutput, value interface{}) error { 1493 if v == nil { 1494 return fmt.Errorf("unexpected nil of type %T", v) 1495 } 1496 if value == nil { 1497 return nil 1498 } 1499 1500 shape, ok := value.(map[string]interface{}) 1501 if !ok { 1502 return fmt.Errorf("unexpected JSON type %v", value) 1503 } 1504 1505 var sv *DeleteMeshOutput 1506 if *v == nil { 1507 sv = &DeleteMeshOutput{} 1508 } else { 1509 sv = *v 1510 } 1511 1512 for key, value := range shape { 1513 switch key { 1514 case "mesh": 1515 if err := awsRestjson1_deserializeDocumentMeshData(&sv.Mesh, value); err != nil { 1516 return err 1517 } 1518 1519 default: 1520 _, _ = key, value 1521 1522 } 1523 } 1524 *v = sv 1525 return nil 1526} 1527 1528type awsRestjson1_deserializeOpDeleteRoute struct { 1529} 1530 1531func (*awsRestjson1_deserializeOpDeleteRoute) ID() string { 1532 return "OperationDeserializer" 1533} 1534 1535func (m *awsRestjson1_deserializeOpDeleteRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1536 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1537) { 1538 out, metadata, err = next.HandleDeserialize(ctx, in) 1539 if err != nil { 1540 return out, metadata, err 1541 } 1542 1543 response, ok := out.RawResponse.(*smithyhttp.Response) 1544 if !ok { 1545 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1546 } 1547 1548 if response.StatusCode < 200 || response.StatusCode >= 300 { 1549 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRoute(response, &metadata) 1550 } 1551 output := &DeleteRouteOutput{} 1552 out.Result = output 1553 1554 var buff [1024]byte 1555 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1556 1557 body := io.TeeReader(response.Body, ringBuffer) 1558 1559 decoder := json.NewDecoder(body) 1560 decoder.UseNumber() 1561 var shape interface{} 1562 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1563 var snapshot bytes.Buffer 1564 io.Copy(&snapshot, ringBuffer) 1565 err = &smithy.DeserializationError{ 1566 Err: fmt.Errorf("failed to decode response body, %w", err), 1567 Snapshot: snapshot.Bytes(), 1568 } 1569 return out, metadata, err 1570 } 1571 1572 err = awsRestjson1_deserializeDocumentRouteData(&output.Route, shape) 1573 if err != nil { 1574 var snapshot bytes.Buffer 1575 io.Copy(&snapshot, ringBuffer) 1576 return out, metadata, &smithy.DeserializationError{ 1577 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1578 Snapshot: snapshot.Bytes(), 1579 } 1580 } 1581 1582 return out, metadata, err 1583} 1584 1585func awsRestjson1_deserializeOpErrorDeleteRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1586 var errorBuffer bytes.Buffer 1587 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1588 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1589 } 1590 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1591 1592 errorCode := "UnknownError" 1593 errorMessage := errorCode 1594 1595 code := response.Header.Get("X-Amzn-ErrorType") 1596 if len(code) != 0 { 1597 errorCode = restjson.SanitizeErrorCode(code) 1598 } 1599 1600 var buff [1024]byte 1601 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1602 1603 body := io.TeeReader(errorBody, ringBuffer) 1604 decoder := json.NewDecoder(body) 1605 decoder.UseNumber() 1606 code, message, err := restjson.GetErrorInfo(decoder) 1607 if err != nil { 1608 var snapshot bytes.Buffer 1609 io.Copy(&snapshot, ringBuffer) 1610 err = &smithy.DeserializationError{ 1611 Err: fmt.Errorf("failed to decode response body, %w", err), 1612 Snapshot: snapshot.Bytes(), 1613 } 1614 return err 1615 } 1616 1617 errorBody.Seek(0, io.SeekStart) 1618 if len(code) != 0 { 1619 errorCode = restjson.SanitizeErrorCode(code) 1620 } 1621 if len(message) != 0 { 1622 errorMessage = message 1623 } 1624 1625 switch { 1626 case strings.EqualFold("BadRequestException", errorCode): 1627 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1628 1629 case strings.EqualFold("ForbiddenException", errorCode): 1630 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1631 1632 case strings.EqualFold("InternalServerErrorException", errorCode): 1633 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1634 1635 case strings.EqualFold("NotFoundException", errorCode): 1636 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1637 1638 case strings.EqualFold("ResourceInUseException", errorCode): 1639 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 1640 1641 case strings.EqualFold("ServiceUnavailableException", errorCode): 1642 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1643 1644 case strings.EqualFold("TooManyRequestsException", errorCode): 1645 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1646 1647 default: 1648 genericError := &smithy.GenericAPIError{ 1649 Code: errorCode, 1650 Message: errorMessage, 1651 } 1652 return genericError 1653 1654 } 1655} 1656 1657func awsRestjson1_deserializeOpDocumentDeleteRouteOutput(v **DeleteRouteOutput, value interface{}) error { 1658 if v == nil { 1659 return fmt.Errorf("unexpected nil of type %T", v) 1660 } 1661 if value == nil { 1662 return nil 1663 } 1664 1665 shape, ok := value.(map[string]interface{}) 1666 if !ok { 1667 return fmt.Errorf("unexpected JSON type %v", value) 1668 } 1669 1670 var sv *DeleteRouteOutput 1671 if *v == nil { 1672 sv = &DeleteRouteOutput{} 1673 } else { 1674 sv = *v 1675 } 1676 1677 for key, value := range shape { 1678 switch key { 1679 case "route": 1680 if err := awsRestjson1_deserializeDocumentRouteData(&sv.Route, value); err != nil { 1681 return err 1682 } 1683 1684 default: 1685 _, _ = key, value 1686 1687 } 1688 } 1689 *v = sv 1690 return nil 1691} 1692 1693type awsRestjson1_deserializeOpDeleteVirtualGateway struct { 1694} 1695 1696func (*awsRestjson1_deserializeOpDeleteVirtualGateway) ID() string { 1697 return "OperationDeserializer" 1698} 1699 1700func (m *awsRestjson1_deserializeOpDeleteVirtualGateway) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1701 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1702) { 1703 out, metadata, err = next.HandleDeserialize(ctx, in) 1704 if err != nil { 1705 return out, metadata, err 1706 } 1707 1708 response, ok := out.RawResponse.(*smithyhttp.Response) 1709 if !ok { 1710 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1711 } 1712 1713 if response.StatusCode < 200 || response.StatusCode >= 300 { 1714 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVirtualGateway(response, &metadata) 1715 } 1716 output := &DeleteVirtualGatewayOutput{} 1717 out.Result = output 1718 1719 var buff [1024]byte 1720 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1721 1722 body := io.TeeReader(response.Body, ringBuffer) 1723 1724 decoder := json.NewDecoder(body) 1725 decoder.UseNumber() 1726 var shape interface{} 1727 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1728 var snapshot bytes.Buffer 1729 io.Copy(&snapshot, ringBuffer) 1730 err = &smithy.DeserializationError{ 1731 Err: fmt.Errorf("failed to decode response body, %w", err), 1732 Snapshot: snapshot.Bytes(), 1733 } 1734 return out, metadata, err 1735 } 1736 1737 err = awsRestjson1_deserializeDocumentVirtualGatewayData(&output.VirtualGateway, shape) 1738 if err != nil { 1739 var snapshot bytes.Buffer 1740 io.Copy(&snapshot, ringBuffer) 1741 return out, metadata, &smithy.DeserializationError{ 1742 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1743 Snapshot: snapshot.Bytes(), 1744 } 1745 } 1746 1747 return out, metadata, err 1748} 1749 1750func awsRestjson1_deserializeOpErrorDeleteVirtualGateway(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1751 var errorBuffer bytes.Buffer 1752 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1753 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1754 } 1755 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1756 1757 errorCode := "UnknownError" 1758 errorMessage := errorCode 1759 1760 code := response.Header.Get("X-Amzn-ErrorType") 1761 if len(code) != 0 { 1762 errorCode = restjson.SanitizeErrorCode(code) 1763 } 1764 1765 var buff [1024]byte 1766 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1767 1768 body := io.TeeReader(errorBody, ringBuffer) 1769 decoder := json.NewDecoder(body) 1770 decoder.UseNumber() 1771 code, message, err := restjson.GetErrorInfo(decoder) 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 if len(code) != 0 { 1784 errorCode = restjson.SanitizeErrorCode(code) 1785 } 1786 if len(message) != 0 { 1787 errorMessage = message 1788 } 1789 1790 switch { 1791 case strings.EqualFold("BadRequestException", errorCode): 1792 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1793 1794 case strings.EqualFold("ForbiddenException", errorCode): 1795 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1796 1797 case strings.EqualFold("InternalServerErrorException", errorCode): 1798 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1799 1800 case strings.EqualFold("NotFoundException", errorCode): 1801 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1802 1803 case strings.EqualFold("ResourceInUseException", errorCode): 1804 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 1805 1806 case strings.EqualFold("ServiceUnavailableException", errorCode): 1807 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1808 1809 case strings.EqualFold("TooManyRequestsException", errorCode): 1810 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1811 1812 default: 1813 genericError := &smithy.GenericAPIError{ 1814 Code: errorCode, 1815 Message: errorMessage, 1816 } 1817 return genericError 1818 1819 } 1820} 1821 1822func awsRestjson1_deserializeOpDocumentDeleteVirtualGatewayOutput(v **DeleteVirtualGatewayOutput, value interface{}) error { 1823 if v == nil { 1824 return fmt.Errorf("unexpected nil of type %T", v) 1825 } 1826 if value == nil { 1827 return nil 1828 } 1829 1830 shape, ok := value.(map[string]interface{}) 1831 if !ok { 1832 return fmt.Errorf("unexpected JSON type %v", value) 1833 } 1834 1835 var sv *DeleteVirtualGatewayOutput 1836 if *v == nil { 1837 sv = &DeleteVirtualGatewayOutput{} 1838 } else { 1839 sv = *v 1840 } 1841 1842 for key, value := range shape { 1843 switch key { 1844 case "virtualGateway": 1845 if err := awsRestjson1_deserializeDocumentVirtualGatewayData(&sv.VirtualGateway, value); err != nil { 1846 return err 1847 } 1848 1849 default: 1850 _, _ = key, value 1851 1852 } 1853 } 1854 *v = sv 1855 return nil 1856} 1857 1858type awsRestjson1_deserializeOpDeleteVirtualNode struct { 1859} 1860 1861func (*awsRestjson1_deserializeOpDeleteVirtualNode) ID() string { 1862 return "OperationDeserializer" 1863} 1864 1865func (m *awsRestjson1_deserializeOpDeleteVirtualNode) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1866 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1867) { 1868 out, metadata, err = next.HandleDeserialize(ctx, in) 1869 if err != nil { 1870 return out, metadata, err 1871 } 1872 1873 response, ok := out.RawResponse.(*smithyhttp.Response) 1874 if !ok { 1875 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1876 } 1877 1878 if response.StatusCode < 200 || response.StatusCode >= 300 { 1879 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVirtualNode(response, &metadata) 1880 } 1881 output := &DeleteVirtualNodeOutput{} 1882 out.Result = output 1883 1884 var buff [1024]byte 1885 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1886 1887 body := io.TeeReader(response.Body, ringBuffer) 1888 1889 decoder := json.NewDecoder(body) 1890 decoder.UseNumber() 1891 var shape interface{} 1892 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1893 var snapshot bytes.Buffer 1894 io.Copy(&snapshot, ringBuffer) 1895 err = &smithy.DeserializationError{ 1896 Err: fmt.Errorf("failed to decode response body, %w", err), 1897 Snapshot: snapshot.Bytes(), 1898 } 1899 return out, metadata, err 1900 } 1901 1902 err = awsRestjson1_deserializeDocumentVirtualNodeData(&output.VirtualNode, shape) 1903 if err != nil { 1904 var snapshot bytes.Buffer 1905 io.Copy(&snapshot, ringBuffer) 1906 return out, metadata, &smithy.DeserializationError{ 1907 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1908 Snapshot: snapshot.Bytes(), 1909 } 1910 } 1911 1912 return out, metadata, err 1913} 1914 1915func awsRestjson1_deserializeOpErrorDeleteVirtualNode(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1916 var errorBuffer bytes.Buffer 1917 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1918 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1919 } 1920 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1921 1922 errorCode := "UnknownError" 1923 errorMessage := errorCode 1924 1925 code := response.Header.Get("X-Amzn-ErrorType") 1926 if len(code) != 0 { 1927 errorCode = restjson.SanitizeErrorCode(code) 1928 } 1929 1930 var buff [1024]byte 1931 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1932 1933 body := io.TeeReader(errorBody, ringBuffer) 1934 decoder := json.NewDecoder(body) 1935 decoder.UseNumber() 1936 code, message, err := restjson.GetErrorInfo(decoder) 1937 if err != nil { 1938 var snapshot bytes.Buffer 1939 io.Copy(&snapshot, ringBuffer) 1940 err = &smithy.DeserializationError{ 1941 Err: fmt.Errorf("failed to decode response body, %w", err), 1942 Snapshot: snapshot.Bytes(), 1943 } 1944 return err 1945 } 1946 1947 errorBody.Seek(0, io.SeekStart) 1948 if len(code) != 0 { 1949 errorCode = restjson.SanitizeErrorCode(code) 1950 } 1951 if len(message) != 0 { 1952 errorMessage = message 1953 } 1954 1955 switch { 1956 case strings.EqualFold("BadRequestException", errorCode): 1957 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1958 1959 case strings.EqualFold("ForbiddenException", errorCode): 1960 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1961 1962 case strings.EqualFold("InternalServerErrorException", errorCode): 1963 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1964 1965 case strings.EqualFold("NotFoundException", errorCode): 1966 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1967 1968 case strings.EqualFold("ResourceInUseException", errorCode): 1969 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 1970 1971 case strings.EqualFold("ServiceUnavailableException", errorCode): 1972 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1973 1974 case strings.EqualFold("TooManyRequestsException", errorCode): 1975 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1976 1977 default: 1978 genericError := &smithy.GenericAPIError{ 1979 Code: errorCode, 1980 Message: errorMessage, 1981 } 1982 return genericError 1983 1984 } 1985} 1986 1987func awsRestjson1_deserializeOpDocumentDeleteVirtualNodeOutput(v **DeleteVirtualNodeOutput, value interface{}) error { 1988 if v == nil { 1989 return fmt.Errorf("unexpected nil of type %T", v) 1990 } 1991 if value == nil { 1992 return nil 1993 } 1994 1995 shape, ok := value.(map[string]interface{}) 1996 if !ok { 1997 return fmt.Errorf("unexpected JSON type %v", value) 1998 } 1999 2000 var sv *DeleteVirtualNodeOutput 2001 if *v == nil { 2002 sv = &DeleteVirtualNodeOutput{} 2003 } else { 2004 sv = *v 2005 } 2006 2007 for key, value := range shape { 2008 switch key { 2009 case "virtualNode": 2010 if err := awsRestjson1_deserializeDocumentVirtualNodeData(&sv.VirtualNode, value); err != nil { 2011 return err 2012 } 2013 2014 default: 2015 _, _ = key, value 2016 2017 } 2018 } 2019 *v = sv 2020 return nil 2021} 2022 2023type awsRestjson1_deserializeOpDeleteVirtualRouter struct { 2024} 2025 2026func (*awsRestjson1_deserializeOpDeleteVirtualRouter) ID() string { 2027 return "OperationDeserializer" 2028} 2029 2030func (m *awsRestjson1_deserializeOpDeleteVirtualRouter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2031 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2032) { 2033 out, metadata, err = next.HandleDeserialize(ctx, in) 2034 if err != nil { 2035 return out, metadata, err 2036 } 2037 2038 response, ok := out.RawResponse.(*smithyhttp.Response) 2039 if !ok { 2040 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2041 } 2042 2043 if response.StatusCode < 200 || response.StatusCode >= 300 { 2044 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVirtualRouter(response, &metadata) 2045 } 2046 output := &DeleteVirtualRouterOutput{} 2047 out.Result = output 2048 2049 var buff [1024]byte 2050 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2051 2052 body := io.TeeReader(response.Body, ringBuffer) 2053 2054 decoder := json.NewDecoder(body) 2055 decoder.UseNumber() 2056 var shape interface{} 2057 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2058 var snapshot bytes.Buffer 2059 io.Copy(&snapshot, ringBuffer) 2060 err = &smithy.DeserializationError{ 2061 Err: fmt.Errorf("failed to decode response body, %w", err), 2062 Snapshot: snapshot.Bytes(), 2063 } 2064 return out, metadata, err 2065 } 2066 2067 err = awsRestjson1_deserializeDocumentVirtualRouterData(&output.VirtualRouter, shape) 2068 if err != nil { 2069 var snapshot bytes.Buffer 2070 io.Copy(&snapshot, ringBuffer) 2071 return out, metadata, &smithy.DeserializationError{ 2072 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2073 Snapshot: snapshot.Bytes(), 2074 } 2075 } 2076 2077 return out, metadata, err 2078} 2079 2080func awsRestjson1_deserializeOpErrorDeleteVirtualRouter(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2081 var errorBuffer bytes.Buffer 2082 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2083 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2084 } 2085 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2086 2087 errorCode := "UnknownError" 2088 errorMessage := errorCode 2089 2090 code := response.Header.Get("X-Amzn-ErrorType") 2091 if len(code) != 0 { 2092 errorCode = restjson.SanitizeErrorCode(code) 2093 } 2094 2095 var buff [1024]byte 2096 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2097 2098 body := io.TeeReader(errorBody, ringBuffer) 2099 decoder := json.NewDecoder(body) 2100 decoder.UseNumber() 2101 code, message, err := restjson.GetErrorInfo(decoder) 2102 if err != nil { 2103 var snapshot bytes.Buffer 2104 io.Copy(&snapshot, ringBuffer) 2105 err = &smithy.DeserializationError{ 2106 Err: fmt.Errorf("failed to decode response body, %w", err), 2107 Snapshot: snapshot.Bytes(), 2108 } 2109 return err 2110 } 2111 2112 errorBody.Seek(0, io.SeekStart) 2113 if len(code) != 0 { 2114 errorCode = restjson.SanitizeErrorCode(code) 2115 } 2116 if len(message) != 0 { 2117 errorMessage = message 2118 } 2119 2120 switch { 2121 case strings.EqualFold("BadRequestException", errorCode): 2122 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2123 2124 case strings.EqualFold("ForbiddenException", errorCode): 2125 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2126 2127 case strings.EqualFold("InternalServerErrorException", errorCode): 2128 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2129 2130 case strings.EqualFold("NotFoundException", errorCode): 2131 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2132 2133 case strings.EqualFold("ResourceInUseException", errorCode): 2134 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 2135 2136 case strings.EqualFold("ServiceUnavailableException", errorCode): 2137 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2138 2139 case strings.EqualFold("TooManyRequestsException", errorCode): 2140 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2141 2142 default: 2143 genericError := &smithy.GenericAPIError{ 2144 Code: errorCode, 2145 Message: errorMessage, 2146 } 2147 return genericError 2148 2149 } 2150} 2151 2152func awsRestjson1_deserializeOpDocumentDeleteVirtualRouterOutput(v **DeleteVirtualRouterOutput, value interface{}) error { 2153 if v == nil { 2154 return fmt.Errorf("unexpected nil of type %T", v) 2155 } 2156 if value == nil { 2157 return nil 2158 } 2159 2160 shape, ok := value.(map[string]interface{}) 2161 if !ok { 2162 return fmt.Errorf("unexpected JSON type %v", value) 2163 } 2164 2165 var sv *DeleteVirtualRouterOutput 2166 if *v == nil { 2167 sv = &DeleteVirtualRouterOutput{} 2168 } else { 2169 sv = *v 2170 } 2171 2172 for key, value := range shape { 2173 switch key { 2174 case "virtualRouter": 2175 if err := awsRestjson1_deserializeDocumentVirtualRouterData(&sv.VirtualRouter, value); err != nil { 2176 return err 2177 } 2178 2179 default: 2180 _, _ = key, value 2181 2182 } 2183 } 2184 *v = sv 2185 return nil 2186} 2187 2188type awsRestjson1_deserializeOpDeleteVirtualService struct { 2189} 2190 2191func (*awsRestjson1_deserializeOpDeleteVirtualService) ID() string { 2192 return "OperationDeserializer" 2193} 2194 2195func (m *awsRestjson1_deserializeOpDeleteVirtualService) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2196 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2197) { 2198 out, metadata, err = next.HandleDeserialize(ctx, in) 2199 if err != nil { 2200 return out, metadata, err 2201 } 2202 2203 response, ok := out.RawResponse.(*smithyhttp.Response) 2204 if !ok { 2205 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2206 } 2207 2208 if response.StatusCode < 200 || response.StatusCode >= 300 { 2209 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVirtualService(response, &metadata) 2210 } 2211 output := &DeleteVirtualServiceOutput{} 2212 out.Result = output 2213 2214 var buff [1024]byte 2215 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2216 2217 body := io.TeeReader(response.Body, ringBuffer) 2218 2219 decoder := json.NewDecoder(body) 2220 decoder.UseNumber() 2221 var shape interface{} 2222 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2223 var snapshot bytes.Buffer 2224 io.Copy(&snapshot, ringBuffer) 2225 err = &smithy.DeserializationError{ 2226 Err: fmt.Errorf("failed to decode response body, %w", err), 2227 Snapshot: snapshot.Bytes(), 2228 } 2229 return out, metadata, err 2230 } 2231 2232 err = awsRestjson1_deserializeDocumentVirtualServiceData(&output.VirtualService, shape) 2233 if err != nil { 2234 var snapshot bytes.Buffer 2235 io.Copy(&snapshot, ringBuffer) 2236 return out, metadata, &smithy.DeserializationError{ 2237 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2238 Snapshot: snapshot.Bytes(), 2239 } 2240 } 2241 2242 return out, metadata, err 2243} 2244 2245func awsRestjson1_deserializeOpErrorDeleteVirtualService(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2246 var errorBuffer bytes.Buffer 2247 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2248 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2249 } 2250 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2251 2252 errorCode := "UnknownError" 2253 errorMessage := errorCode 2254 2255 code := response.Header.Get("X-Amzn-ErrorType") 2256 if len(code) != 0 { 2257 errorCode = restjson.SanitizeErrorCode(code) 2258 } 2259 2260 var buff [1024]byte 2261 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2262 2263 body := io.TeeReader(errorBody, ringBuffer) 2264 decoder := json.NewDecoder(body) 2265 decoder.UseNumber() 2266 code, message, err := restjson.GetErrorInfo(decoder) 2267 if err != nil { 2268 var snapshot bytes.Buffer 2269 io.Copy(&snapshot, ringBuffer) 2270 err = &smithy.DeserializationError{ 2271 Err: fmt.Errorf("failed to decode response body, %w", err), 2272 Snapshot: snapshot.Bytes(), 2273 } 2274 return err 2275 } 2276 2277 errorBody.Seek(0, io.SeekStart) 2278 if len(code) != 0 { 2279 errorCode = restjson.SanitizeErrorCode(code) 2280 } 2281 if len(message) != 0 { 2282 errorMessage = message 2283 } 2284 2285 switch { 2286 case strings.EqualFold("BadRequestException", errorCode): 2287 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2288 2289 case strings.EqualFold("ForbiddenException", errorCode): 2290 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2291 2292 case strings.EqualFold("InternalServerErrorException", errorCode): 2293 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2294 2295 case strings.EqualFold("NotFoundException", errorCode): 2296 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2297 2298 case strings.EqualFold("ResourceInUseException", errorCode): 2299 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 2300 2301 case strings.EqualFold("ServiceUnavailableException", errorCode): 2302 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2303 2304 case strings.EqualFold("TooManyRequestsException", errorCode): 2305 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2306 2307 default: 2308 genericError := &smithy.GenericAPIError{ 2309 Code: errorCode, 2310 Message: errorMessage, 2311 } 2312 return genericError 2313 2314 } 2315} 2316 2317func awsRestjson1_deserializeOpDocumentDeleteVirtualServiceOutput(v **DeleteVirtualServiceOutput, value interface{}) error { 2318 if v == nil { 2319 return fmt.Errorf("unexpected nil of type %T", v) 2320 } 2321 if value == nil { 2322 return nil 2323 } 2324 2325 shape, ok := value.(map[string]interface{}) 2326 if !ok { 2327 return fmt.Errorf("unexpected JSON type %v", value) 2328 } 2329 2330 var sv *DeleteVirtualServiceOutput 2331 if *v == nil { 2332 sv = &DeleteVirtualServiceOutput{} 2333 } else { 2334 sv = *v 2335 } 2336 2337 for key, value := range shape { 2338 switch key { 2339 case "virtualService": 2340 if err := awsRestjson1_deserializeDocumentVirtualServiceData(&sv.VirtualService, value); err != nil { 2341 return err 2342 } 2343 2344 default: 2345 _, _ = key, value 2346 2347 } 2348 } 2349 *v = sv 2350 return nil 2351} 2352 2353type awsRestjson1_deserializeOpDescribeGatewayRoute struct { 2354} 2355 2356func (*awsRestjson1_deserializeOpDescribeGatewayRoute) ID() string { 2357 return "OperationDeserializer" 2358} 2359 2360func (m *awsRestjson1_deserializeOpDescribeGatewayRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2361 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2362) { 2363 out, metadata, err = next.HandleDeserialize(ctx, in) 2364 if err != nil { 2365 return out, metadata, err 2366 } 2367 2368 response, ok := out.RawResponse.(*smithyhttp.Response) 2369 if !ok { 2370 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2371 } 2372 2373 if response.StatusCode < 200 || response.StatusCode >= 300 { 2374 return out, metadata, awsRestjson1_deserializeOpErrorDescribeGatewayRoute(response, &metadata) 2375 } 2376 output := &DescribeGatewayRouteOutput{} 2377 out.Result = output 2378 2379 var buff [1024]byte 2380 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2381 2382 body := io.TeeReader(response.Body, ringBuffer) 2383 2384 decoder := json.NewDecoder(body) 2385 decoder.UseNumber() 2386 var shape interface{} 2387 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2388 var snapshot bytes.Buffer 2389 io.Copy(&snapshot, ringBuffer) 2390 err = &smithy.DeserializationError{ 2391 Err: fmt.Errorf("failed to decode response body, %w", err), 2392 Snapshot: snapshot.Bytes(), 2393 } 2394 return out, metadata, err 2395 } 2396 2397 err = awsRestjson1_deserializeDocumentGatewayRouteData(&output.GatewayRoute, shape) 2398 if err != nil { 2399 var snapshot bytes.Buffer 2400 io.Copy(&snapshot, ringBuffer) 2401 return out, metadata, &smithy.DeserializationError{ 2402 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2403 Snapshot: snapshot.Bytes(), 2404 } 2405 } 2406 2407 return out, metadata, err 2408} 2409 2410func awsRestjson1_deserializeOpErrorDescribeGatewayRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2411 var errorBuffer bytes.Buffer 2412 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2413 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2414 } 2415 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2416 2417 errorCode := "UnknownError" 2418 errorMessage := errorCode 2419 2420 code := response.Header.Get("X-Amzn-ErrorType") 2421 if len(code) != 0 { 2422 errorCode = restjson.SanitizeErrorCode(code) 2423 } 2424 2425 var buff [1024]byte 2426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2427 2428 body := io.TeeReader(errorBody, ringBuffer) 2429 decoder := json.NewDecoder(body) 2430 decoder.UseNumber() 2431 code, message, err := restjson.GetErrorInfo(decoder) 2432 if err != nil { 2433 var snapshot bytes.Buffer 2434 io.Copy(&snapshot, ringBuffer) 2435 err = &smithy.DeserializationError{ 2436 Err: fmt.Errorf("failed to decode response body, %w", err), 2437 Snapshot: snapshot.Bytes(), 2438 } 2439 return err 2440 } 2441 2442 errorBody.Seek(0, io.SeekStart) 2443 if len(code) != 0 { 2444 errorCode = restjson.SanitizeErrorCode(code) 2445 } 2446 if len(message) != 0 { 2447 errorMessage = message 2448 } 2449 2450 switch { 2451 case strings.EqualFold("BadRequestException", errorCode): 2452 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2453 2454 case strings.EqualFold("ForbiddenException", errorCode): 2455 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2456 2457 case strings.EqualFold("InternalServerErrorException", errorCode): 2458 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2459 2460 case strings.EqualFold("NotFoundException", errorCode): 2461 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2462 2463 case strings.EqualFold("ServiceUnavailableException", errorCode): 2464 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2465 2466 case strings.EqualFold("TooManyRequestsException", errorCode): 2467 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2468 2469 default: 2470 genericError := &smithy.GenericAPIError{ 2471 Code: errorCode, 2472 Message: errorMessage, 2473 } 2474 return genericError 2475 2476 } 2477} 2478 2479func awsRestjson1_deserializeOpDocumentDescribeGatewayRouteOutput(v **DescribeGatewayRouteOutput, value interface{}) error { 2480 if v == nil { 2481 return fmt.Errorf("unexpected nil of type %T", v) 2482 } 2483 if value == nil { 2484 return nil 2485 } 2486 2487 shape, ok := value.(map[string]interface{}) 2488 if !ok { 2489 return fmt.Errorf("unexpected JSON type %v", value) 2490 } 2491 2492 var sv *DescribeGatewayRouteOutput 2493 if *v == nil { 2494 sv = &DescribeGatewayRouteOutput{} 2495 } else { 2496 sv = *v 2497 } 2498 2499 for key, value := range shape { 2500 switch key { 2501 case "gatewayRoute": 2502 if err := awsRestjson1_deserializeDocumentGatewayRouteData(&sv.GatewayRoute, value); err != nil { 2503 return err 2504 } 2505 2506 default: 2507 _, _ = key, value 2508 2509 } 2510 } 2511 *v = sv 2512 return nil 2513} 2514 2515type awsRestjson1_deserializeOpDescribeMesh struct { 2516} 2517 2518func (*awsRestjson1_deserializeOpDescribeMesh) ID() string { 2519 return "OperationDeserializer" 2520} 2521 2522func (m *awsRestjson1_deserializeOpDescribeMesh) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2523 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2524) { 2525 out, metadata, err = next.HandleDeserialize(ctx, in) 2526 if err != nil { 2527 return out, metadata, err 2528 } 2529 2530 response, ok := out.RawResponse.(*smithyhttp.Response) 2531 if !ok { 2532 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2533 } 2534 2535 if response.StatusCode < 200 || response.StatusCode >= 300 { 2536 return out, metadata, awsRestjson1_deserializeOpErrorDescribeMesh(response, &metadata) 2537 } 2538 output := &DescribeMeshOutput{} 2539 out.Result = output 2540 2541 var buff [1024]byte 2542 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2543 2544 body := io.TeeReader(response.Body, ringBuffer) 2545 2546 decoder := json.NewDecoder(body) 2547 decoder.UseNumber() 2548 var shape interface{} 2549 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2550 var snapshot bytes.Buffer 2551 io.Copy(&snapshot, ringBuffer) 2552 err = &smithy.DeserializationError{ 2553 Err: fmt.Errorf("failed to decode response body, %w", err), 2554 Snapshot: snapshot.Bytes(), 2555 } 2556 return out, metadata, err 2557 } 2558 2559 err = awsRestjson1_deserializeDocumentMeshData(&output.Mesh, shape) 2560 if err != nil { 2561 var snapshot bytes.Buffer 2562 io.Copy(&snapshot, ringBuffer) 2563 return out, metadata, &smithy.DeserializationError{ 2564 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2565 Snapshot: snapshot.Bytes(), 2566 } 2567 } 2568 2569 return out, metadata, err 2570} 2571 2572func awsRestjson1_deserializeOpErrorDescribeMesh(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2573 var errorBuffer bytes.Buffer 2574 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2575 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2576 } 2577 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2578 2579 errorCode := "UnknownError" 2580 errorMessage := errorCode 2581 2582 code := response.Header.Get("X-Amzn-ErrorType") 2583 if len(code) != 0 { 2584 errorCode = restjson.SanitizeErrorCode(code) 2585 } 2586 2587 var buff [1024]byte 2588 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2589 2590 body := io.TeeReader(errorBody, ringBuffer) 2591 decoder := json.NewDecoder(body) 2592 decoder.UseNumber() 2593 code, message, err := restjson.GetErrorInfo(decoder) 2594 if err != nil { 2595 var snapshot bytes.Buffer 2596 io.Copy(&snapshot, ringBuffer) 2597 err = &smithy.DeserializationError{ 2598 Err: fmt.Errorf("failed to decode response body, %w", err), 2599 Snapshot: snapshot.Bytes(), 2600 } 2601 return err 2602 } 2603 2604 errorBody.Seek(0, io.SeekStart) 2605 if len(code) != 0 { 2606 errorCode = restjson.SanitizeErrorCode(code) 2607 } 2608 if len(message) != 0 { 2609 errorMessage = message 2610 } 2611 2612 switch { 2613 case strings.EqualFold("BadRequestException", errorCode): 2614 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2615 2616 case strings.EqualFold("ForbiddenException", errorCode): 2617 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2618 2619 case strings.EqualFold("InternalServerErrorException", errorCode): 2620 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2621 2622 case strings.EqualFold("NotFoundException", errorCode): 2623 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2624 2625 case strings.EqualFold("ServiceUnavailableException", errorCode): 2626 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2627 2628 case strings.EqualFold("TooManyRequestsException", errorCode): 2629 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2630 2631 default: 2632 genericError := &smithy.GenericAPIError{ 2633 Code: errorCode, 2634 Message: errorMessage, 2635 } 2636 return genericError 2637 2638 } 2639} 2640 2641func awsRestjson1_deserializeOpDocumentDescribeMeshOutput(v **DescribeMeshOutput, value interface{}) error { 2642 if v == nil { 2643 return fmt.Errorf("unexpected nil of type %T", v) 2644 } 2645 if value == nil { 2646 return nil 2647 } 2648 2649 shape, ok := value.(map[string]interface{}) 2650 if !ok { 2651 return fmt.Errorf("unexpected JSON type %v", value) 2652 } 2653 2654 var sv *DescribeMeshOutput 2655 if *v == nil { 2656 sv = &DescribeMeshOutput{} 2657 } else { 2658 sv = *v 2659 } 2660 2661 for key, value := range shape { 2662 switch key { 2663 case "mesh": 2664 if err := awsRestjson1_deserializeDocumentMeshData(&sv.Mesh, value); err != nil { 2665 return err 2666 } 2667 2668 default: 2669 _, _ = key, value 2670 2671 } 2672 } 2673 *v = sv 2674 return nil 2675} 2676 2677type awsRestjson1_deserializeOpDescribeRoute struct { 2678} 2679 2680func (*awsRestjson1_deserializeOpDescribeRoute) ID() string { 2681 return "OperationDeserializer" 2682} 2683 2684func (m *awsRestjson1_deserializeOpDescribeRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2685 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2686) { 2687 out, metadata, err = next.HandleDeserialize(ctx, in) 2688 if err != nil { 2689 return out, metadata, err 2690 } 2691 2692 response, ok := out.RawResponse.(*smithyhttp.Response) 2693 if !ok { 2694 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2695 } 2696 2697 if response.StatusCode < 200 || response.StatusCode >= 300 { 2698 return out, metadata, awsRestjson1_deserializeOpErrorDescribeRoute(response, &metadata) 2699 } 2700 output := &DescribeRouteOutput{} 2701 out.Result = output 2702 2703 var buff [1024]byte 2704 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2705 2706 body := io.TeeReader(response.Body, ringBuffer) 2707 2708 decoder := json.NewDecoder(body) 2709 decoder.UseNumber() 2710 var shape interface{} 2711 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2712 var snapshot bytes.Buffer 2713 io.Copy(&snapshot, ringBuffer) 2714 err = &smithy.DeserializationError{ 2715 Err: fmt.Errorf("failed to decode response body, %w", err), 2716 Snapshot: snapshot.Bytes(), 2717 } 2718 return out, metadata, err 2719 } 2720 2721 err = awsRestjson1_deserializeDocumentRouteData(&output.Route, shape) 2722 if err != nil { 2723 var snapshot bytes.Buffer 2724 io.Copy(&snapshot, ringBuffer) 2725 return out, metadata, &smithy.DeserializationError{ 2726 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2727 Snapshot: snapshot.Bytes(), 2728 } 2729 } 2730 2731 return out, metadata, err 2732} 2733 2734func awsRestjson1_deserializeOpErrorDescribeRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2735 var errorBuffer bytes.Buffer 2736 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2737 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2738 } 2739 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2740 2741 errorCode := "UnknownError" 2742 errorMessage := errorCode 2743 2744 code := response.Header.Get("X-Amzn-ErrorType") 2745 if len(code) != 0 { 2746 errorCode = restjson.SanitizeErrorCode(code) 2747 } 2748 2749 var buff [1024]byte 2750 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2751 2752 body := io.TeeReader(errorBody, ringBuffer) 2753 decoder := json.NewDecoder(body) 2754 decoder.UseNumber() 2755 code, message, err := restjson.GetErrorInfo(decoder) 2756 if err != nil { 2757 var snapshot bytes.Buffer 2758 io.Copy(&snapshot, ringBuffer) 2759 err = &smithy.DeserializationError{ 2760 Err: fmt.Errorf("failed to decode response body, %w", err), 2761 Snapshot: snapshot.Bytes(), 2762 } 2763 return err 2764 } 2765 2766 errorBody.Seek(0, io.SeekStart) 2767 if len(code) != 0 { 2768 errorCode = restjson.SanitizeErrorCode(code) 2769 } 2770 if len(message) != 0 { 2771 errorMessage = message 2772 } 2773 2774 switch { 2775 case strings.EqualFold("BadRequestException", errorCode): 2776 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2777 2778 case strings.EqualFold("ForbiddenException", errorCode): 2779 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2780 2781 case strings.EqualFold("InternalServerErrorException", errorCode): 2782 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2783 2784 case strings.EqualFold("NotFoundException", errorCode): 2785 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2786 2787 case strings.EqualFold("ServiceUnavailableException", errorCode): 2788 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2789 2790 case strings.EqualFold("TooManyRequestsException", errorCode): 2791 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2792 2793 default: 2794 genericError := &smithy.GenericAPIError{ 2795 Code: errorCode, 2796 Message: errorMessage, 2797 } 2798 return genericError 2799 2800 } 2801} 2802 2803func awsRestjson1_deserializeOpDocumentDescribeRouteOutput(v **DescribeRouteOutput, value interface{}) error { 2804 if v == nil { 2805 return fmt.Errorf("unexpected nil of type %T", v) 2806 } 2807 if value == nil { 2808 return nil 2809 } 2810 2811 shape, ok := value.(map[string]interface{}) 2812 if !ok { 2813 return fmt.Errorf("unexpected JSON type %v", value) 2814 } 2815 2816 var sv *DescribeRouteOutput 2817 if *v == nil { 2818 sv = &DescribeRouteOutput{} 2819 } else { 2820 sv = *v 2821 } 2822 2823 for key, value := range shape { 2824 switch key { 2825 case "route": 2826 if err := awsRestjson1_deserializeDocumentRouteData(&sv.Route, value); err != nil { 2827 return err 2828 } 2829 2830 default: 2831 _, _ = key, value 2832 2833 } 2834 } 2835 *v = sv 2836 return nil 2837} 2838 2839type awsRestjson1_deserializeOpDescribeVirtualGateway struct { 2840} 2841 2842func (*awsRestjson1_deserializeOpDescribeVirtualGateway) ID() string { 2843 return "OperationDeserializer" 2844} 2845 2846func (m *awsRestjson1_deserializeOpDescribeVirtualGateway) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2847 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2848) { 2849 out, metadata, err = next.HandleDeserialize(ctx, in) 2850 if err != nil { 2851 return out, metadata, err 2852 } 2853 2854 response, ok := out.RawResponse.(*smithyhttp.Response) 2855 if !ok { 2856 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2857 } 2858 2859 if response.StatusCode < 200 || response.StatusCode >= 300 { 2860 return out, metadata, awsRestjson1_deserializeOpErrorDescribeVirtualGateway(response, &metadata) 2861 } 2862 output := &DescribeVirtualGatewayOutput{} 2863 out.Result = output 2864 2865 var buff [1024]byte 2866 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2867 2868 body := io.TeeReader(response.Body, ringBuffer) 2869 2870 decoder := json.NewDecoder(body) 2871 decoder.UseNumber() 2872 var shape interface{} 2873 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2874 var snapshot bytes.Buffer 2875 io.Copy(&snapshot, ringBuffer) 2876 err = &smithy.DeserializationError{ 2877 Err: fmt.Errorf("failed to decode response body, %w", err), 2878 Snapshot: snapshot.Bytes(), 2879 } 2880 return out, metadata, err 2881 } 2882 2883 err = awsRestjson1_deserializeDocumentVirtualGatewayData(&output.VirtualGateway, shape) 2884 if err != nil { 2885 var snapshot bytes.Buffer 2886 io.Copy(&snapshot, ringBuffer) 2887 return out, metadata, &smithy.DeserializationError{ 2888 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2889 Snapshot: snapshot.Bytes(), 2890 } 2891 } 2892 2893 return out, metadata, err 2894} 2895 2896func awsRestjson1_deserializeOpErrorDescribeVirtualGateway(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2897 var errorBuffer bytes.Buffer 2898 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2899 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2900 } 2901 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2902 2903 errorCode := "UnknownError" 2904 errorMessage := errorCode 2905 2906 code := response.Header.Get("X-Amzn-ErrorType") 2907 if len(code) != 0 { 2908 errorCode = restjson.SanitizeErrorCode(code) 2909 } 2910 2911 var buff [1024]byte 2912 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2913 2914 body := io.TeeReader(errorBody, ringBuffer) 2915 decoder := json.NewDecoder(body) 2916 decoder.UseNumber() 2917 code, message, err := restjson.GetErrorInfo(decoder) 2918 if err != nil { 2919 var snapshot bytes.Buffer 2920 io.Copy(&snapshot, ringBuffer) 2921 err = &smithy.DeserializationError{ 2922 Err: fmt.Errorf("failed to decode response body, %w", err), 2923 Snapshot: snapshot.Bytes(), 2924 } 2925 return err 2926 } 2927 2928 errorBody.Seek(0, io.SeekStart) 2929 if len(code) != 0 { 2930 errorCode = restjson.SanitizeErrorCode(code) 2931 } 2932 if len(message) != 0 { 2933 errorMessage = message 2934 } 2935 2936 switch { 2937 case strings.EqualFold("BadRequestException", errorCode): 2938 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2939 2940 case strings.EqualFold("ForbiddenException", errorCode): 2941 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2942 2943 case strings.EqualFold("InternalServerErrorException", errorCode): 2944 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2945 2946 case strings.EqualFold("NotFoundException", errorCode): 2947 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2948 2949 case strings.EqualFold("ServiceUnavailableException", errorCode): 2950 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2951 2952 case strings.EqualFold("TooManyRequestsException", errorCode): 2953 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2954 2955 default: 2956 genericError := &smithy.GenericAPIError{ 2957 Code: errorCode, 2958 Message: errorMessage, 2959 } 2960 return genericError 2961 2962 } 2963} 2964 2965func awsRestjson1_deserializeOpDocumentDescribeVirtualGatewayOutput(v **DescribeVirtualGatewayOutput, value interface{}) error { 2966 if v == nil { 2967 return fmt.Errorf("unexpected nil of type %T", v) 2968 } 2969 if value == nil { 2970 return nil 2971 } 2972 2973 shape, ok := value.(map[string]interface{}) 2974 if !ok { 2975 return fmt.Errorf("unexpected JSON type %v", value) 2976 } 2977 2978 var sv *DescribeVirtualGatewayOutput 2979 if *v == nil { 2980 sv = &DescribeVirtualGatewayOutput{} 2981 } else { 2982 sv = *v 2983 } 2984 2985 for key, value := range shape { 2986 switch key { 2987 case "virtualGateway": 2988 if err := awsRestjson1_deserializeDocumentVirtualGatewayData(&sv.VirtualGateway, value); err != nil { 2989 return err 2990 } 2991 2992 default: 2993 _, _ = key, value 2994 2995 } 2996 } 2997 *v = sv 2998 return nil 2999} 3000 3001type awsRestjson1_deserializeOpDescribeVirtualNode struct { 3002} 3003 3004func (*awsRestjson1_deserializeOpDescribeVirtualNode) ID() string { 3005 return "OperationDeserializer" 3006} 3007 3008func (m *awsRestjson1_deserializeOpDescribeVirtualNode) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3009 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3010) { 3011 out, metadata, err = next.HandleDeserialize(ctx, in) 3012 if err != nil { 3013 return out, metadata, err 3014 } 3015 3016 response, ok := out.RawResponse.(*smithyhttp.Response) 3017 if !ok { 3018 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3019 } 3020 3021 if response.StatusCode < 200 || response.StatusCode >= 300 { 3022 return out, metadata, awsRestjson1_deserializeOpErrorDescribeVirtualNode(response, &metadata) 3023 } 3024 output := &DescribeVirtualNodeOutput{} 3025 out.Result = output 3026 3027 var buff [1024]byte 3028 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3029 3030 body := io.TeeReader(response.Body, ringBuffer) 3031 3032 decoder := json.NewDecoder(body) 3033 decoder.UseNumber() 3034 var shape interface{} 3035 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3036 var snapshot bytes.Buffer 3037 io.Copy(&snapshot, ringBuffer) 3038 err = &smithy.DeserializationError{ 3039 Err: fmt.Errorf("failed to decode response body, %w", err), 3040 Snapshot: snapshot.Bytes(), 3041 } 3042 return out, metadata, err 3043 } 3044 3045 err = awsRestjson1_deserializeDocumentVirtualNodeData(&output.VirtualNode, shape) 3046 if err != nil { 3047 var snapshot bytes.Buffer 3048 io.Copy(&snapshot, ringBuffer) 3049 return out, metadata, &smithy.DeserializationError{ 3050 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3051 Snapshot: snapshot.Bytes(), 3052 } 3053 } 3054 3055 return out, metadata, err 3056} 3057 3058func awsRestjson1_deserializeOpErrorDescribeVirtualNode(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3059 var errorBuffer bytes.Buffer 3060 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3061 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3062 } 3063 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3064 3065 errorCode := "UnknownError" 3066 errorMessage := errorCode 3067 3068 code := response.Header.Get("X-Amzn-ErrorType") 3069 if len(code) != 0 { 3070 errorCode = restjson.SanitizeErrorCode(code) 3071 } 3072 3073 var buff [1024]byte 3074 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3075 3076 body := io.TeeReader(errorBody, ringBuffer) 3077 decoder := json.NewDecoder(body) 3078 decoder.UseNumber() 3079 code, message, err := restjson.GetErrorInfo(decoder) 3080 if err != nil { 3081 var snapshot bytes.Buffer 3082 io.Copy(&snapshot, ringBuffer) 3083 err = &smithy.DeserializationError{ 3084 Err: fmt.Errorf("failed to decode response body, %w", err), 3085 Snapshot: snapshot.Bytes(), 3086 } 3087 return err 3088 } 3089 3090 errorBody.Seek(0, io.SeekStart) 3091 if len(code) != 0 { 3092 errorCode = restjson.SanitizeErrorCode(code) 3093 } 3094 if len(message) != 0 { 3095 errorMessage = message 3096 } 3097 3098 switch { 3099 case strings.EqualFold("BadRequestException", errorCode): 3100 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3101 3102 case strings.EqualFold("ForbiddenException", errorCode): 3103 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 3104 3105 case strings.EqualFold("InternalServerErrorException", errorCode): 3106 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 3107 3108 case strings.EqualFold("NotFoundException", errorCode): 3109 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3110 3111 case strings.EqualFold("ServiceUnavailableException", errorCode): 3112 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3113 3114 case strings.EqualFold("TooManyRequestsException", errorCode): 3115 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3116 3117 default: 3118 genericError := &smithy.GenericAPIError{ 3119 Code: errorCode, 3120 Message: errorMessage, 3121 } 3122 return genericError 3123 3124 } 3125} 3126 3127func awsRestjson1_deserializeOpDocumentDescribeVirtualNodeOutput(v **DescribeVirtualNodeOutput, value interface{}) error { 3128 if v == nil { 3129 return fmt.Errorf("unexpected nil of type %T", v) 3130 } 3131 if value == nil { 3132 return nil 3133 } 3134 3135 shape, ok := value.(map[string]interface{}) 3136 if !ok { 3137 return fmt.Errorf("unexpected JSON type %v", value) 3138 } 3139 3140 var sv *DescribeVirtualNodeOutput 3141 if *v == nil { 3142 sv = &DescribeVirtualNodeOutput{} 3143 } else { 3144 sv = *v 3145 } 3146 3147 for key, value := range shape { 3148 switch key { 3149 case "virtualNode": 3150 if err := awsRestjson1_deserializeDocumentVirtualNodeData(&sv.VirtualNode, value); err != nil { 3151 return err 3152 } 3153 3154 default: 3155 _, _ = key, value 3156 3157 } 3158 } 3159 *v = sv 3160 return nil 3161} 3162 3163type awsRestjson1_deserializeOpDescribeVirtualRouter struct { 3164} 3165 3166func (*awsRestjson1_deserializeOpDescribeVirtualRouter) ID() string { 3167 return "OperationDeserializer" 3168} 3169 3170func (m *awsRestjson1_deserializeOpDescribeVirtualRouter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3171 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3172) { 3173 out, metadata, err = next.HandleDeserialize(ctx, in) 3174 if err != nil { 3175 return out, metadata, err 3176 } 3177 3178 response, ok := out.RawResponse.(*smithyhttp.Response) 3179 if !ok { 3180 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3181 } 3182 3183 if response.StatusCode < 200 || response.StatusCode >= 300 { 3184 return out, metadata, awsRestjson1_deserializeOpErrorDescribeVirtualRouter(response, &metadata) 3185 } 3186 output := &DescribeVirtualRouterOutput{} 3187 out.Result = output 3188 3189 var buff [1024]byte 3190 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3191 3192 body := io.TeeReader(response.Body, ringBuffer) 3193 3194 decoder := json.NewDecoder(body) 3195 decoder.UseNumber() 3196 var shape interface{} 3197 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3198 var snapshot bytes.Buffer 3199 io.Copy(&snapshot, ringBuffer) 3200 err = &smithy.DeserializationError{ 3201 Err: fmt.Errorf("failed to decode response body, %w", err), 3202 Snapshot: snapshot.Bytes(), 3203 } 3204 return out, metadata, err 3205 } 3206 3207 err = awsRestjson1_deserializeDocumentVirtualRouterData(&output.VirtualRouter, shape) 3208 if err != nil { 3209 var snapshot bytes.Buffer 3210 io.Copy(&snapshot, ringBuffer) 3211 return out, metadata, &smithy.DeserializationError{ 3212 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3213 Snapshot: snapshot.Bytes(), 3214 } 3215 } 3216 3217 return out, metadata, err 3218} 3219 3220func awsRestjson1_deserializeOpErrorDescribeVirtualRouter(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3221 var errorBuffer bytes.Buffer 3222 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3223 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3224 } 3225 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3226 3227 errorCode := "UnknownError" 3228 errorMessage := errorCode 3229 3230 code := response.Header.Get("X-Amzn-ErrorType") 3231 if len(code) != 0 { 3232 errorCode = restjson.SanitizeErrorCode(code) 3233 } 3234 3235 var buff [1024]byte 3236 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3237 3238 body := io.TeeReader(errorBody, ringBuffer) 3239 decoder := json.NewDecoder(body) 3240 decoder.UseNumber() 3241 code, message, err := restjson.GetErrorInfo(decoder) 3242 if err != nil { 3243 var snapshot bytes.Buffer 3244 io.Copy(&snapshot, ringBuffer) 3245 err = &smithy.DeserializationError{ 3246 Err: fmt.Errorf("failed to decode response body, %w", err), 3247 Snapshot: snapshot.Bytes(), 3248 } 3249 return err 3250 } 3251 3252 errorBody.Seek(0, io.SeekStart) 3253 if len(code) != 0 { 3254 errorCode = restjson.SanitizeErrorCode(code) 3255 } 3256 if len(message) != 0 { 3257 errorMessage = message 3258 } 3259 3260 switch { 3261 case strings.EqualFold("BadRequestException", errorCode): 3262 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3263 3264 case strings.EqualFold("ForbiddenException", errorCode): 3265 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 3266 3267 case strings.EqualFold("InternalServerErrorException", errorCode): 3268 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 3269 3270 case strings.EqualFold("NotFoundException", errorCode): 3271 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3272 3273 case strings.EqualFold("ServiceUnavailableException", errorCode): 3274 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3275 3276 case strings.EqualFold("TooManyRequestsException", errorCode): 3277 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3278 3279 default: 3280 genericError := &smithy.GenericAPIError{ 3281 Code: errorCode, 3282 Message: errorMessage, 3283 } 3284 return genericError 3285 3286 } 3287} 3288 3289func awsRestjson1_deserializeOpDocumentDescribeVirtualRouterOutput(v **DescribeVirtualRouterOutput, value interface{}) error { 3290 if v == nil { 3291 return fmt.Errorf("unexpected nil of type %T", v) 3292 } 3293 if value == nil { 3294 return nil 3295 } 3296 3297 shape, ok := value.(map[string]interface{}) 3298 if !ok { 3299 return fmt.Errorf("unexpected JSON type %v", value) 3300 } 3301 3302 var sv *DescribeVirtualRouterOutput 3303 if *v == nil { 3304 sv = &DescribeVirtualRouterOutput{} 3305 } else { 3306 sv = *v 3307 } 3308 3309 for key, value := range shape { 3310 switch key { 3311 case "virtualRouter": 3312 if err := awsRestjson1_deserializeDocumentVirtualRouterData(&sv.VirtualRouter, value); err != nil { 3313 return err 3314 } 3315 3316 default: 3317 _, _ = key, value 3318 3319 } 3320 } 3321 *v = sv 3322 return nil 3323} 3324 3325type awsRestjson1_deserializeOpDescribeVirtualService struct { 3326} 3327 3328func (*awsRestjson1_deserializeOpDescribeVirtualService) ID() string { 3329 return "OperationDeserializer" 3330} 3331 3332func (m *awsRestjson1_deserializeOpDescribeVirtualService) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3333 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3334) { 3335 out, metadata, err = next.HandleDeserialize(ctx, in) 3336 if err != nil { 3337 return out, metadata, err 3338 } 3339 3340 response, ok := out.RawResponse.(*smithyhttp.Response) 3341 if !ok { 3342 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3343 } 3344 3345 if response.StatusCode < 200 || response.StatusCode >= 300 { 3346 return out, metadata, awsRestjson1_deserializeOpErrorDescribeVirtualService(response, &metadata) 3347 } 3348 output := &DescribeVirtualServiceOutput{} 3349 out.Result = output 3350 3351 var buff [1024]byte 3352 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3353 3354 body := io.TeeReader(response.Body, ringBuffer) 3355 3356 decoder := json.NewDecoder(body) 3357 decoder.UseNumber() 3358 var shape interface{} 3359 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3360 var snapshot bytes.Buffer 3361 io.Copy(&snapshot, ringBuffer) 3362 err = &smithy.DeserializationError{ 3363 Err: fmt.Errorf("failed to decode response body, %w", err), 3364 Snapshot: snapshot.Bytes(), 3365 } 3366 return out, metadata, err 3367 } 3368 3369 err = awsRestjson1_deserializeDocumentVirtualServiceData(&output.VirtualService, shape) 3370 if err != nil { 3371 var snapshot bytes.Buffer 3372 io.Copy(&snapshot, ringBuffer) 3373 return out, metadata, &smithy.DeserializationError{ 3374 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3375 Snapshot: snapshot.Bytes(), 3376 } 3377 } 3378 3379 return out, metadata, err 3380} 3381 3382func awsRestjson1_deserializeOpErrorDescribeVirtualService(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3383 var errorBuffer bytes.Buffer 3384 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3385 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3386 } 3387 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3388 3389 errorCode := "UnknownError" 3390 errorMessage := errorCode 3391 3392 code := response.Header.Get("X-Amzn-ErrorType") 3393 if len(code) != 0 { 3394 errorCode = restjson.SanitizeErrorCode(code) 3395 } 3396 3397 var buff [1024]byte 3398 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3399 3400 body := io.TeeReader(errorBody, ringBuffer) 3401 decoder := json.NewDecoder(body) 3402 decoder.UseNumber() 3403 code, message, err := restjson.GetErrorInfo(decoder) 3404 if err != nil { 3405 var snapshot bytes.Buffer 3406 io.Copy(&snapshot, ringBuffer) 3407 err = &smithy.DeserializationError{ 3408 Err: fmt.Errorf("failed to decode response body, %w", err), 3409 Snapshot: snapshot.Bytes(), 3410 } 3411 return err 3412 } 3413 3414 errorBody.Seek(0, io.SeekStart) 3415 if len(code) != 0 { 3416 errorCode = restjson.SanitizeErrorCode(code) 3417 } 3418 if len(message) != 0 { 3419 errorMessage = message 3420 } 3421 3422 switch { 3423 case strings.EqualFold("BadRequestException", errorCode): 3424 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3425 3426 case strings.EqualFold("ForbiddenException", errorCode): 3427 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 3428 3429 case strings.EqualFold("InternalServerErrorException", errorCode): 3430 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 3431 3432 case strings.EqualFold("NotFoundException", errorCode): 3433 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3434 3435 case strings.EqualFold("ServiceUnavailableException", errorCode): 3436 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3437 3438 case strings.EqualFold("TooManyRequestsException", errorCode): 3439 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3440 3441 default: 3442 genericError := &smithy.GenericAPIError{ 3443 Code: errorCode, 3444 Message: errorMessage, 3445 } 3446 return genericError 3447 3448 } 3449} 3450 3451func awsRestjson1_deserializeOpDocumentDescribeVirtualServiceOutput(v **DescribeVirtualServiceOutput, value interface{}) error { 3452 if v == nil { 3453 return fmt.Errorf("unexpected nil of type %T", v) 3454 } 3455 if value == nil { 3456 return nil 3457 } 3458 3459 shape, ok := value.(map[string]interface{}) 3460 if !ok { 3461 return fmt.Errorf("unexpected JSON type %v", value) 3462 } 3463 3464 var sv *DescribeVirtualServiceOutput 3465 if *v == nil { 3466 sv = &DescribeVirtualServiceOutput{} 3467 } else { 3468 sv = *v 3469 } 3470 3471 for key, value := range shape { 3472 switch key { 3473 case "virtualService": 3474 if err := awsRestjson1_deserializeDocumentVirtualServiceData(&sv.VirtualService, value); err != nil { 3475 return err 3476 } 3477 3478 default: 3479 _, _ = key, value 3480 3481 } 3482 } 3483 *v = sv 3484 return nil 3485} 3486 3487type awsRestjson1_deserializeOpListGatewayRoutes struct { 3488} 3489 3490func (*awsRestjson1_deserializeOpListGatewayRoutes) ID() string { 3491 return "OperationDeserializer" 3492} 3493 3494func (m *awsRestjson1_deserializeOpListGatewayRoutes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3495 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3496) { 3497 out, metadata, err = next.HandleDeserialize(ctx, in) 3498 if err != nil { 3499 return out, metadata, err 3500 } 3501 3502 response, ok := out.RawResponse.(*smithyhttp.Response) 3503 if !ok { 3504 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3505 } 3506 3507 if response.StatusCode < 200 || response.StatusCode >= 300 { 3508 return out, metadata, awsRestjson1_deserializeOpErrorListGatewayRoutes(response, &metadata) 3509 } 3510 output := &ListGatewayRoutesOutput{} 3511 out.Result = output 3512 3513 var buff [1024]byte 3514 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3515 3516 body := io.TeeReader(response.Body, ringBuffer) 3517 3518 decoder := json.NewDecoder(body) 3519 decoder.UseNumber() 3520 var shape interface{} 3521 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3522 var snapshot bytes.Buffer 3523 io.Copy(&snapshot, ringBuffer) 3524 err = &smithy.DeserializationError{ 3525 Err: fmt.Errorf("failed to decode response body, %w", err), 3526 Snapshot: snapshot.Bytes(), 3527 } 3528 return out, metadata, err 3529 } 3530 3531 err = awsRestjson1_deserializeOpDocumentListGatewayRoutesOutput(&output, shape) 3532 if err != nil { 3533 var snapshot bytes.Buffer 3534 io.Copy(&snapshot, ringBuffer) 3535 return out, metadata, &smithy.DeserializationError{ 3536 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3537 Snapshot: snapshot.Bytes(), 3538 } 3539 } 3540 3541 return out, metadata, err 3542} 3543 3544func awsRestjson1_deserializeOpErrorListGatewayRoutes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3545 var errorBuffer bytes.Buffer 3546 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3547 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3548 } 3549 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3550 3551 errorCode := "UnknownError" 3552 errorMessage := errorCode 3553 3554 code := response.Header.Get("X-Amzn-ErrorType") 3555 if len(code) != 0 { 3556 errorCode = restjson.SanitizeErrorCode(code) 3557 } 3558 3559 var buff [1024]byte 3560 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3561 3562 body := io.TeeReader(errorBody, ringBuffer) 3563 decoder := json.NewDecoder(body) 3564 decoder.UseNumber() 3565 code, message, err := restjson.GetErrorInfo(decoder) 3566 if err != nil { 3567 var snapshot bytes.Buffer 3568 io.Copy(&snapshot, ringBuffer) 3569 err = &smithy.DeserializationError{ 3570 Err: fmt.Errorf("failed to decode response body, %w", err), 3571 Snapshot: snapshot.Bytes(), 3572 } 3573 return err 3574 } 3575 3576 errorBody.Seek(0, io.SeekStart) 3577 if len(code) != 0 { 3578 errorCode = restjson.SanitizeErrorCode(code) 3579 } 3580 if len(message) != 0 { 3581 errorMessage = message 3582 } 3583 3584 switch { 3585 case strings.EqualFold("BadRequestException", errorCode): 3586 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3587 3588 case strings.EqualFold("ForbiddenException", errorCode): 3589 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 3590 3591 case strings.EqualFold("InternalServerErrorException", errorCode): 3592 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 3593 3594 case strings.EqualFold("NotFoundException", errorCode): 3595 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3596 3597 case strings.EqualFold("ServiceUnavailableException", errorCode): 3598 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3599 3600 case strings.EqualFold("TooManyRequestsException", errorCode): 3601 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3602 3603 default: 3604 genericError := &smithy.GenericAPIError{ 3605 Code: errorCode, 3606 Message: errorMessage, 3607 } 3608 return genericError 3609 3610 } 3611} 3612 3613func awsRestjson1_deserializeOpDocumentListGatewayRoutesOutput(v **ListGatewayRoutesOutput, value interface{}) error { 3614 if v == nil { 3615 return fmt.Errorf("unexpected nil of type %T", v) 3616 } 3617 if value == nil { 3618 return nil 3619 } 3620 3621 shape, ok := value.(map[string]interface{}) 3622 if !ok { 3623 return fmt.Errorf("unexpected JSON type %v", value) 3624 } 3625 3626 var sv *ListGatewayRoutesOutput 3627 if *v == nil { 3628 sv = &ListGatewayRoutesOutput{} 3629 } else { 3630 sv = *v 3631 } 3632 3633 for key, value := range shape { 3634 switch key { 3635 case "gatewayRoutes": 3636 if err := awsRestjson1_deserializeDocumentGatewayRouteList(&sv.GatewayRoutes, value); err != nil { 3637 return err 3638 } 3639 3640 case "nextToken": 3641 if value != nil { 3642 jtv, ok := value.(string) 3643 if !ok { 3644 return fmt.Errorf("expected String to be of type string, got %T instead", value) 3645 } 3646 sv.NextToken = ptr.String(jtv) 3647 } 3648 3649 default: 3650 _, _ = key, value 3651 3652 } 3653 } 3654 *v = sv 3655 return nil 3656} 3657 3658type awsRestjson1_deserializeOpListMeshes struct { 3659} 3660 3661func (*awsRestjson1_deserializeOpListMeshes) ID() string { 3662 return "OperationDeserializer" 3663} 3664 3665func (m *awsRestjson1_deserializeOpListMeshes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3666 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3667) { 3668 out, metadata, err = next.HandleDeserialize(ctx, in) 3669 if err != nil { 3670 return out, metadata, err 3671 } 3672 3673 response, ok := out.RawResponse.(*smithyhttp.Response) 3674 if !ok { 3675 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3676 } 3677 3678 if response.StatusCode < 200 || response.StatusCode >= 300 { 3679 return out, metadata, awsRestjson1_deserializeOpErrorListMeshes(response, &metadata) 3680 } 3681 output := &ListMeshesOutput{} 3682 out.Result = output 3683 3684 var buff [1024]byte 3685 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3686 3687 body := io.TeeReader(response.Body, ringBuffer) 3688 3689 decoder := json.NewDecoder(body) 3690 decoder.UseNumber() 3691 var shape interface{} 3692 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3693 var snapshot bytes.Buffer 3694 io.Copy(&snapshot, ringBuffer) 3695 err = &smithy.DeserializationError{ 3696 Err: fmt.Errorf("failed to decode response body, %w", err), 3697 Snapshot: snapshot.Bytes(), 3698 } 3699 return out, metadata, err 3700 } 3701 3702 err = awsRestjson1_deserializeOpDocumentListMeshesOutput(&output, shape) 3703 if err != nil { 3704 var snapshot bytes.Buffer 3705 io.Copy(&snapshot, ringBuffer) 3706 return out, metadata, &smithy.DeserializationError{ 3707 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3708 Snapshot: snapshot.Bytes(), 3709 } 3710 } 3711 3712 return out, metadata, err 3713} 3714 3715func awsRestjson1_deserializeOpErrorListMeshes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3716 var errorBuffer bytes.Buffer 3717 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3718 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3719 } 3720 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3721 3722 errorCode := "UnknownError" 3723 errorMessage := errorCode 3724 3725 code := response.Header.Get("X-Amzn-ErrorType") 3726 if len(code) != 0 { 3727 errorCode = restjson.SanitizeErrorCode(code) 3728 } 3729 3730 var buff [1024]byte 3731 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3732 3733 body := io.TeeReader(errorBody, ringBuffer) 3734 decoder := json.NewDecoder(body) 3735 decoder.UseNumber() 3736 code, message, err := restjson.GetErrorInfo(decoder) 3737 if err != nil { 3738 var snapshot bytes.Buffer 3739 io.Copy(&snapshot, ringBuffer) 3740 err = &smithy.DeserializationError{ 3741 Err: fmt.Errorf("failed to decode response body, %w", err), 3742 Snapshot: snapshot.Bytes(), 3743 } 3744 return err 3745 } 3746 3747 errorBody.Seek(0, io.SeekStart) 3748 if len(code) != 0 { 3749 errorCode = restjson.SanitizeErrorCode(code) 3750 } 3751 if len(message) != 0 { 3752 errorMessage = message 3753 } 3754 3755 switch { 3756 case strings.EqualFold("BadRequestException", errorCode): 3757 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3758 3759 case strings.EqualFold("ForbiddenException", errorCode): 3760 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 3761 3762 case strings.EqualFold("InternalServerErrorException", errorCode): 3763 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 3764 3765 case strings.EqualFold("NotFoundException", errorCode): 3766 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3767 3768 case strings.EqualFold("ServiceUnavailableException", errorCode): 3769 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3770 3771 case strings.EqualFold("TooManyRequestsException", errorCode): 3772 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3773 3774 default: 3775 genericError := &smithy.GenericAPIError{ 3776 Code: errorCode, 3777 Message: errorMessage, 3778 } 3779 return genericError 3780 3781 } 3782} 3783 3784func awsRestjson1_deserializeOpDocumentListMeshesOutput(v **ListMeshesOutput, value interface{}) error { 3785 if v == nil { 3786 return fmt.Errorf("unexpected nil of type %T", v) 3787 } 3788 if value == nil { 3789 return nil 3790 } 3791 3792 shape, ok := value.(map[string]interface{}) 3793 if !ok { 3794 return fmt.Errorf("unexpected JSON type %v", value) 3795 } 3796 3797 var sv *ListMeshesOutput 3798 if *v == nil { 3799 sv = &ListMeshesOutput{} 3800 } else { 3801 sv = *v 3802 } 3803 3804 for key, value := range shape { 3805 switch key { 3806 case "meshes": 3807 if err := awsRestjson1_deserializeDocumentMeshList(&sv.Meshes, value); err != nil { 3808 return err 3809 } 3810 3811 case "nextToken": 3812 if value != nil { 3813 jtv, ok := value.(string) 3814 if !ok { 3815 return fmt.Errorf("expected String to be of type string, got %T instead", value) 3816 } 3817 sv.NextToken = ptr.String(jtv) 3818 } 3819 3820 default: 3821 _, _ = key, value 3822 3823 } 3824 } 3825 *v = sv 3826 return nil 3827} 3828 3829type awsRestjson1_deserializeOpListRoutes struct { 3830} 3831 3832func (*awsRestjson1_deserializeOpListRoutes) ID() string { 3833 return "OperationDeserializer" 3834} 3835 3836func (m *awsRestjson1_deserializeOpListRoutes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3837 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3838) { 3839 out, metadata, err = next.HandleDeserialize(ctx, in) 3840 if err != nil { 3841 return out, metadata, err 3842 } 3843 3844 response, ok := out.RawResponse.(*smithyhttp.Response) 3845 if !ok { 3846 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3847 } 3848 3849 if response.StatusCode < 200 || response.StatusCode >= 300 { 3850 return out, metadata, awsRestjson1_deserializeOpErrorListRoutes(response, &metadata) 3851 } 3852 output := &ListRoutesOutput{} 3853 out.Result = output 3854 3855 var buff [1024]byte 3856 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3857 3858 body := io.TeeReader(response.Body, ringBuffer) 3859 3860 decoder := json.NewDecoder(body) 3861 decoder.UseNumber() 3862 var shape interface{} 3863 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3864 var snapshot bytes.Buffer 3865 io.Copy(&snapshot, ringBuffer) 3866 err = &smithy.DeserializationError{ 3867 Err: fmt.Errorf("failed to decode response body, %w", err), 3868 Snapshot: snapshot.Bytes(), 3869 } 3870 return out, metadata, err 3871 } 3872 3873 err = awsRestjson1_deserializeOpDocumentListRoutesOutput(&output, shape) 3874 if err != nil { 3875 var snapshot bytes.Buffer 3876 io.Copy(&snapshot, ringBuffer) 3877 return out, metadata, &smithy.DeserializationError{ 3878 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3879 Snapshot: snapshot.Bytes(), 3880 } 3881 } 3882 3883 return out, metadata, err 3884} 3885 3886func awsRestjson1_deserializeOpErrorListRoutes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3887 var errorBuffer bytes.Buffer 3888 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3889 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3890 } 3891 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3892 3893 errorCode := "UnknownError" 3894 errorMessage := errorCode 3895 3896 code := response.Header.Get("X-Amzn-ErrorType") 3897 if len(code) != 0 { 3898 errorCode = restjson.SanitizeErrorCode(code) 3899 } 3900 3901 var buff [1024]byte 3902 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3903 3904 body := io.TeeReader(errorBody, ringBuffer) 3905 decoder := json.NewDecoder(body) 3906 decoder.UseNumber() 3907 code, message, err := restjson.GetErrorInfo(decoder) 3908 if err != nil { 3909 var snapshot bytes.Buffer 3910 io.Copy(&snapshot, ringBuffer) 3911 err = &smithy.DeserializationError{ 3912 Err: fmt.Errorf("failed to decode response body, %w", err), 3913 Snapshot: snapshot.Bytes(), 3914 } 3915 return err 3916 } 3917 3918 errorBody.Seek(0, io.SeekStart) 3919 if len(code) != 0 { 3920 errorCode = restjson.SanitizeErrorCode(code) 3921 } 3922 if len(message) != 0 { 3923 errorMessage = message 3924 } 3925 3926 switch { 3927 case strings.EqualFold("BadRequestException", errorCode): 3928 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3929 3930 case strings.EqualFold("ForbiddenException", errorCode): 3931 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 3932 3933 case strings.EqualFold("InternalServerErrorException", errorCode): 3934 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 3935 3936 case strings.EqualFold("NotFoundException", errorCode): 3937 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3938 3939 case strings.EqualFold("ServiceUnavailableException", errorCode): 3940 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3941 3942 case strings.EqualFold("TooManyRequestsException", errorCode): 3943 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3944 3945 default: 3946 genericError := &smithy.GenericAPIError{ 3947 Code: errorCode, 3948 Message: errorMessage, 3949 } 3950 return genericError 3951 3952 } 3953} 3954 3955func awsRestjson1_deserializeOpDocumentListRoutesOutput(v **ListRoutesOutput, value interface{}) error { 3956 if v == nil { 3957 return fmt.Errorf("unexpected nil of type %T", v) 3958 } 3959 if value == nil { 3960 return nil 3961 } 3962 3963 shape, ok := value.(map[string]interface{}) 3964 if !ok { 3965 return fmt.Errorf("unexpected JSON type %v", value) 3966 } 3967 3968 var sv *ListRoutesOutput 3969 if *v == nil { 3970 sv = &ListRoutesOutput{} 3971 } else { 3972 sv = *v 3973 } 3974 3975 for key, value := range shape { 3976 switch key { 3977 case "nextToken": 3978 if value != nil { 3979 jtv, ok := value.(string) 3980 if !ok { 3981 return fmt.Errorf("expected String to be of type string, got %T instead", value) 3982 } 3983 sv.NextToken = ptr.String(jtv) 3984 } 3985 3986 case "routes": 3987 if err := awsRestjson1_deserializeDocumentRouteList(&sv.Routes, value); err != nil { 3988 return err 3989 } 3990 3991 default: 3992 _, _ = key, value 3993 3994 } 3995 } 3996 *v = sv 3997 return nil 3998} 3999 4000type awsRestjson1_deserializeOpListTagsForResource struct { 4001} 4002 4003func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 4004 return "OperationDeserializer" 4005} 4006 4007func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4008 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4009) { 4010 out, metadata, err = next.HandleDeserialize(ctx, in) 4011 if err != nil { 4012 return out, metadata, err 4013 } 4014 4015 response, ok := out.RawResponse.(*smithyhttp.Response) 4016 if !ok { 4017 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4018 } 4019 4020 if response.StatusCode < 200 || response.StatusCode >= 300 { 4021 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 4022 } 4023 output := &ListTagsForResourceOutput{} 4024 out.Result = output 4025 4026 var buff [1024]byte 4027 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4028 4029 body := io.TeeReader(response.Body, ringBuffer) 4030 4031 decoder := json.NewDecoder(body) 4032 decoder.UseNumber() 4033 var shape interface{} 4034 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4035 var snapshot bytes.Buffer 4036 io.Copy(&snapshot, ringBuffer) 4037 err = &smithy.DeserializationError{ 4038 Err: fmt.Errorf("failed to decode response body, %w", err), 4039 Snapshot: snapshot.Bytes(), 4040 } 4041 return out, metadata, err 4042 } 4043 4044 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 4045 if err != nil { 4046 var snapshot bytes.Buffer 4047 io.Copy(&snapshot, ringBuffer) 4048 return out, metadata, &smithy.DeserializationError{ 4049 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4050 Snapshot: snapshot.Bytes(), 4051 } 4052 } 4053 4054 return out, metadata, err 4055} 4056 4057func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4058 var errorBuffer bytes.Buffer 4059 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4060 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4061 } 4062 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4063 4064 errorCode := "UnknownError" 4065 errorMessage := errorCode 4066 4067 code := response.Header.Get("X-Amzn-ErrorType") 4068 if len(code) != 0 { 4069 errorCode = restjson.SanitizeErrorCode(code) 4070 } 4071 4072 var buff [1024]byte 4073 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4074 4075 body := io.TeeReader(errorBody, ringBuffer) 4076 decoder := json.NewDecoder(body) 4077 decoder.UseNumber() 4078 code, message, err := restjson.GetErrorInfo(decoder) 4079 if err != nil { 4080 var snapshot bytes.Buffer 4081 io.Copy(&snapshot, ringBuffer) 4082 err = &smithy.DeserializationError{ 4083 Err: fmt.Errorf("failed to decode response body, %w", err), 4084 Snapshot: snapshot.Bytes(), 4085 } 4086 return err 4087 } 4088 4089 errorBody.Seek(0, io.SeekStart) 4090 if len(code) != 0 { 4091 errorCode = restjson.SanitizeErrorCode(code) 4092 } 4093 if len(message) != 0 { 4094 errorMessage = message 4095 } 4096 4097 switch { 4098 case strings.EqualFold("BadRequestException", errorCode): 4099 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4100 4101 case strings.EqualFold("ForbiddenException", errorCode): 4102 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 4103 4104 case strings.EqualFold("InternalServerErrorException", errorCode): 4105 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 4106 4107 case strings.EqualFold("NotFoundException", errorCode): 4108 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4109 4110 case strings.EqualFold("ServiceUnavailableException", errorCode): 4111 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4112 4113 case strings.EqualFold("TooManyRequestsException", errorCode): 4114 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4115 4116 default: 4117 genericError := &smithy.GenericAPIError{ 4118 Code: errorCode, 4119 Message: errorMessage, 4120 } 4121 return genericError 4122 4123 } 4124} 4125 4126func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 4127 if v == nil { 4128 return fmt.Errorf("unexpected nil of type %T", v) 4129 } 4130 if value == nil { 4131 return nil 4132 } 4133 4134 shape, ok := value.(map[string]interface{}) 4135 if !ok { 4136 return fmt.Errorf("unexpected JSON type %v", value) 4137 } 4138 4139 var sv *ListTagsForResourceOutput 4140 if *v == nil { 4141 sv = &ListTagsForResourceOutput{} 4142 } else { 4143 sv = *v 4144 } 4145 4146 for key, value := range shape { 4147 switch key { 4148 case "nextToken": 4149 if value != nil { 4150 jtv, ok := value.(string) 4151 if !ok { 4152 return fmt.Errorf("expected String to be of type string, got %T instead", value) 4153 } 4154 sv.NextToken = ptr.String(jtv) 4155 } 4156 4157 case "tags": 4158 if err := awsRestjson1_deserializeDocumentTagList(&sv.Tags, value); err != nil { 4159 return err 4160 } 4161 4162 default: 4163 _, _ = key, value 4164 4165 } 4166 } 4167 *v = sv 4168 return nil 4169} 4170 4171type awsRestjson1_deserializeOpListVirtualGateways struct { 4172} 4173 4174func (*awsRestjson1_deserializeOpListVirtualGateways) ID() string { 4175 return "OperationDeserializer" 4176} 4177 4178func (m *awsRestjson1_deserializeOpListVirtualGateways) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4179 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4180) { 4181 out, metadata, err = next.HandleDeserialize(ctx, in) 4182 if err != nil { 4183 return out, metadata, err 4184 } 4185 4186 response, ok := out.RawResponse.(*smithyhttp.Response) 4187 if !ok { 4188 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4189 } 4190 4191 if response.StatusCode < 200 || response.StatusCode >= 300 { 4192 return out, metadata, awsRestjson1_deserializeOpErrorListVirtualGateways(response, &metadata) 4193 } 4194 output := &ListVirtualGatewaysOutput{} 4195 out.Result = output 4196 4197 var buff [1024]byte 4198 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4199 4200 body := io.TeeReader(response.Body, ringBuffer) 4201 4202 decoder := json.NewDecoder(body) 4203 decoder.UseNumber() 4204 var shape interface{} 4205 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4206 var snapshot bytes.Buffer 4207 io.Copy(&snapshot, ringBuffer) 4208 err = &smithy.DeserializationError{ 4209 Err: fmt.Errorf("failed to decode response body, %w", err), 4210 Snapshot: snapshot.Bytes(), 4211 } 4212 return out, metadata, err 4213 } 4214 4215 err = awsRestjson1_deserializeOpDocumentListVirtualGatewaysOutput(&output, shape) 4216 if err != nil { 4217 var snapshot bytes.Buffer 4218 io.Copy(&snapshot, ringBuffer) 4219 return out, metadata, &smithy.DeserializationError{ 4220 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4221 Snapshot: snapshot.Bytes(), 4222 } 4223 } 4224 4225 return out, metadata, err 4226} 4227 4228func awsRestjson1_deserializeOpErrorListVirtualGateways(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4229 var errorBuffer bytes.Buffer 4230 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4231 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4232 } 4233 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4234 4235 errorCode := "UnknownError" 4236 errorMessage := errorCode 4237 4238 code := response.Header.Get("X-Amzn-ErrorType") 4239 if len(code) != 0 { 4240 errorCode = restjson.SanitizeErrorCode(code) 4241 } 4242 4243 var buff [1024]byte 4244 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4245 4246 body := io.TeeReader(errorBody, ringBuffer) 4247 decoder := json.NewDecoder(body) 4248 decoder.UseNumber() 4249 code, message, err := restjson.GetErrorInfo(decoder) 4250 if err != nil { 4251 var snapshot bytes.Buffer 4252 io.Copy(&snapshot, ringBuffer) 4253 err = &smithy.DeserializationError{ 4254 Err: fmt.Errorf("failed to decode response body, %w", err), 4255 Snapshot: snapshot.Bytes(), 4256 } 4257 return err 4258 } 4259 4260 errorBody.Seek(0, io.SeekStart) 4261 if len(code) != 0 { 4262 errorCode = restjson.SanitizeErrorCode(code) 4263 } 4264 if len(message) != 0 { 4265 errorMessage = message 4266 } 4267 4268 switch { 4269 case strings.EqualFold("BadRequestException", errorCode): 4270 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4271 4272 case strings.EqualFold("ForbiddenException", errorCode): 4273 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 4274 4275 case strings.EqualFold("InternalServerErrorException", errorCode): 4276 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 4277 4278 case strings.EqualFold("NotFoundException", errorCode): 4279 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4280 4281 case strings.EqualFold("ServiceUnavailableException", errorCode): 4282 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4283 4284 case strings.EqualFold("TooManyRequestsException", errorCode): 4285 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4286 4287 default: 4288 genericError := &smithy.GenericAPIError{ 4289 Code: errorCode, 4290 Message: errorMessage, 4291 } 4292 return genericError 4293 4294 } 4295} 4296 4297func awsRestjson1_deserializeOpDocumentListVirtualGatewaysOutput(v **ListVirtualGatewaysOutput, value interface{}) error { 4298 if v == nil { 4299 return fmt.Errorf("unexpected nil of type %T", v) 4300 } 4301 if value == nil { 4302 return nil 4303 } 4304 4305 shape, ok := value.(map[string]interface{}) 4306 if !ok { 4307 return fmt.Errorf("unexpected JSON type %v", value) 4308 } 4309 4310 var sv *ListVirtualGatewaysOutput 4311 if *v == nil { 4312 sv = &ListVirtualGatewaysOutput{} 4313 } else { 4314 sv = *v 4315 } 4316 4317 for key, value := range shape { 4318 switch key { 4319 case "nextToken": 4320 if value != nil { 4321 jtv, ok := value.(string) 4322 if !ok { 4323 return fmt.Errorf("expected String to be of type string, got %T instead", value) 4324 } 4325 sv.NextToken = ptr.String(jtv) 4326 } 4327 4328 case "virtualGateways": 4329 if err := awsRestjson1_deserializeDocumentVirtualGatewayList(&sv.VirtualGateways, value); err != nil { 4330 return err 4331 } 4332 4333 default: 4334 _, _ = key, value 4335 4336 } 4337 } 4338 *v = sv 4339 return nil 4340} 4341 4342type awsRestjson1_deserializeOpListVirtualNodes struct { 4343} 4344 4345func (*awsRestjson1_deserializeOpListVirtualNodes) ID() string { 4346 return "OperationDeserializer" 4347} 4348 4349func (m *awsRestjson1_deserializeOpListVirtualNodes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4350 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4351) { 4352 out, metadata, err = next.HandleDeserialize(ctx, in) 4353 if err != nil { 4354 return out, metadata, err 4355 } 4356 4357 response, ok := out.RawResponse.(*smithyhttp.Response) 4358 if !ok { 4359 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4360 } 4361 4362 if response.StatusCode < 200 || response.StatusCode >= 300 { 4363 return out, metadata, awsRestjson1_deserializeOpErrorListVirtualNodes(response, &metadata) 4364 } 4365 output := &ListVirtualNodesOutput{} 4366 out.Result = output 4367 4368 var buff [1024]byte 4369 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4370 4371 body := io.TeeReader(response.Body, ringBuffer) 4372 4373 decoder := json.NewDecoder(body) 4374 decoder.UseNumber() 4375 var shape interface{} 4376 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4377 var snapshot bytes.Buffer 4378 io.Copy(&snapshot, ringBuffer) 4379 err = &smithy.DeserializationError{ 4380 Err: fmt.Errorf("failed to decode response body, %w", err), 4381 Snapshot: snapshot.Bytes(), 4382 } 4383 return out, metadata, err 4384 } 4385 4386 err = awsRestjson1_deserializeOpDocumentListVirtualNodesOutput(&output, shape) 4387 if err != nil { 4388 var snapshot bytes.Buffer 4389 io.Copy(&snapshot, ringBuffer) 4390 return out, metadata, &smithy.DeserializationError{ 4391 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4392 Snapshot: snapshot.Bytes(), 4393 } 4394 } 4395 4396 return out, metadata, err 4397} 4398 4399func awsRestjson1_deserializeOpErrorListVirtualNodes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4400 var errorBuffer bytes.Buffer 4401 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4402 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4403 } 4404 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4405 4406 errorCode := "UnknownError" 4407 errorMessage := errorCode 4408 4409 code := response.Header.Get("X-Amzn-ErrorType") 4410 if len(code) != 0 { 4411 errorCode = restjson.SanitizeErrorCode(code) 4412 } 4413 4414 var buff [1024]byte 4415 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4416 4417 body := io.TeeReader(errorBody, ringBuffer) 4418 decoder := json.NewDecoder(body) 4419 decoder.UseNumber() 4420 code, message, err := restjson.GetErrorInfo(decoder) 4421 if err != nil { 4422 var snapshot bytes.Buffer 4423 io.Copy(&snapshot, ringBuffer) 4424 err = &smithy.DeserializationError{ 4425 Err: fmt.Errorf("failed to decode response body, %w", err), 4426 Snapshot: snapshot.Bytes(), 4427 } 4428 return err 4429 } 4430 4431 errorBody.Seek(0, io.SeekStart) 4432 if len(code) != 0 { 4433 errorCode = restjson.SanitizeErrorCode(code) 4434 } 4435 if len(message) != 0 { 4436 errorMessage = message 4437 } 4438 4439 switch { 4440 case strings.EqualFold("BadRequestException", errorCode): 4441 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4442 4443 case strings.EqualFold("ForbiddenException", errorCode): 4444 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 4445 4446 case strings.EqualFold("InternalServerErrorException", errorCode): 4447 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 4448 4449 case strings.EqualFold("NotFoundException", errorCode): 4450 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4451 4452 case strings.EqualFold("ServiceUnavailableException", errorCode): 4453 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4454 4455 case strings.EqualFold("TooManyRequestsException", errorCode): 4456 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4457 4458 default: 4459 genericError := &smithy.GenericAPIError{ 4460 Code: errorCode, 4461 Message: errorMessage, 4462 } 4463 return genericError 4464 4465 } 4466} 4467 4468func awsRestjson1_deserializeOpDocumentListVirtualNodesOutput(v **ListVirtualNodesOutput, value interface{}) error { 4469 if v == nil { 4470 return fmt.Errorf("unexpected nil of type %T", v) 4471 } 4472 if value == nil { 4473 return nil 4474 } 4475 4476 shape, ok := value.(map[string]interface{}) 4477 if !ok { 4478 return fmt.Errorf("unexpected JSON type %v", value) 4479 } 4480 4481 var sv *ListVirtualNodesOutput 4482 if *v == nil { 4483 sv = &ListVirtualNodesOutput{} 4484 } else { 4485 sv = *v 4486 } 4487 4488 for key, value := range shape { 4489 switch key { 4490 case "nextToken": 4491 if value != nil { 4492 jtv, ok := value.(string) 4493 if !ok { 4494 return fmt.Errorf("expected String to be of type string, got %T instead", value) 4495 } 4496 sv.NextToken = ptr.String(jtv) 4497 } 4498 4499 case "virtualNodes": 4500 if err := awsRestjson1_deserializeDocumentVirtualNodeList(&sv.VirtualNodes, value); err != nil { 4501 return err 4502 } 4503 4504 default: 4505 _, _ = key, value 4506 4507 } 4508 } 4509 *v = sv 4510 return nil 4511} 4512 4513type awsRestjson1_deserializeOpListVirtualRouters struct { 4514} 4515 4516func (*awsRestjson1_deserializeOpListVirtualRouters) ID() string { 4517 return "OperationDeserializer" 4518} 4519 4520func (m *awsRestjson1_deserializeOpListVirtualRouters) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4521 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4522) { 4523 out, metadata, err = next.HandleDeserialize(ctx, in) 4524 if err != nil { 4525 return out, metadata, err 4526 } 4527 4528 response, ok := out.RawResponse.(*smithyhttp.Response) 4529 if !ok { 4530 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4531 } 4532 4533 if response.StatusCode < 200 || response.StatusCode >= 300 { 4534 return out, metadata, awsRestjson1_deserializeOpErrorListVirtualRouters(response, &metadata) 4535 } 4536 output := &ListVirtualRoutersOutput{} 4537 out.Result = output 4538 4539 var buff [1024]byte 4540 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4541 4542 body := io.TeeReader(response.Body, ringBuffer) 4543 4544 decoder := json.NewDecoder(body) 4545 decoder.UseNumber() 4546 var shape interface{} 4547 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4548 var snapshot bytes.Buffer 4549 io.Copy(&snapshot, ringBuffer) 4550 err = &smithy.DeserializationError{ 4551 Err: fmt.Errorf("failed to decode response body, %w", err), 4552 Snapshot: snapshot.Bytes(), 4553 } 4554 return out, metadata, err 4555 } 4556 4557 err = awsRestjson1_deserializeOpDocumentListVirtualRoutersOutput(&output, shape) 4558 if err != nil { 4559 var snapshot bytes.Buffer 4560 io.Copy(&snapshot, ringBuffer) 4561 return out, metadata, &smithy.DeserializationError{ 4562 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4563 Snapshot: snapshot.Bytes(), 4564 } 4565 } 4566 4567 return out, metadata, err 4568} 4569 4570func awsRestjson1_deserializeOpErrorListVirtualRouters(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4571 var errorBuffer bytes.Buffer 4572 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4573 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4574 } 4575 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4576 4577 errorCode := "UnknownError" 4578 errorMessage := errorCode 4579 4580 code := response.Header.Get("X-Amzn-ErrorType") 4581 if len(code) != 0 { 4582 errorCode = restjson.SanitizeErrorCode(code) 4583 } 4584 4585 var buff [1024]byte 4586 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4587 4588 body := io.TeeReader(errorBody, ringBuffer) 4589 decoder := json.NewDecoder(body) 4590 decoder.UseNumber() 4591 code, message, err := restjson.GetErrorInfo(decoder) 4592 if err != nil { 4593 var snapshot bytes.Buffer 4594 io.Copy(&snapshot, ringBuffer) 4595 err = &smithy.DeserializationError{ 4596 Err: fmt.Errorf("failed to decode response body, %w", err), 4597 Snapshot: snapshot.Bytes(), 4598 } 4599 return err 4600 } 4601 4602 errorBody.Seek(0, io.SeekStart) 4603 if len(code) != 0 { 4604 errorCode = restjson.SanitizeErrorCode(code) 4605 } 4606 if len(message) != 0 { 4607 errorMessage = message 4608 } 4609 4610 switch { 4611 case strings.EqualFold("BadRequestException", errorCode): 4612 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4613 4614 case strings.EqualFold("ForbiddenException", errorCode): 4615 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 4616 4617 case strings.EqualFold("InternalServerErrorException", errorCode): 4618 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 4619 4620 case strings.EqualFold("NotFoundException", errorCode): 4621 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4622 4623 case strings.EqualFold("ServiceUnavailableException", errorCode): 4624 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4625 4626 case strings.EqualFold("TooManyRequestsException", errorCode): 4627 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4628 4629 default: 4630 genericError := &smithy.GenericAPIError{ 4631 Code: errorCode, 4632 Message: errorMessage, 4633 } 4634 return genericError 4635 4636 } 4637} 4638 4639func awsRestjson1_deserializeOpDocumentListVirtualRoutersOutput(v **ListVirtualRoutersOutput, value interface{}) error { 4640 if v == nil { 4641 return fmt.Errorf("unexpected nil of type %T", v) 4642 } 4643 if value == nil { 4644 return nil 4645 } 4646 4647 shape, ok := value.(map[string]interface{}) 4648 if !ok { 4649 return fmt.Errorf("unexpected JSON type %v", value) 4650 } 4651 4652 var sv *ListVirtualRoutersOutput 4653 if *v == nil { 4654 sv = &ListVirtualRoutersOutput{} 4655 } else { 4656 sv = *v 4657 } 4658 4659 for key, value := range shape { 4660 switch key { 4661 case "nextToken": 4662 if value != nil { 4663 jtv, ok := value.(string) 4664 if !ok { 4665 return fmt.Errorf("expected String to be of type string, got %T instead", value) 4666 } 4667 sv.NextToken = ptr.String(jtv) 4668 } 4669 4670 case "virtualRouters": 4671 if err := awsRestjson1_deserializeDocumentVirtualRouterList(&sv.VirtualRouters, value); err != nil { 4672 return err 4673 } 4674 4675 default: 4676 _, _ = key, value 4677 4678 } 4679 } 4680 *v = sv 4681 return nil 4682} 4683 4684type awsRestjson1_deserializeOpListVirtualServices struct { 4685} 4686 4687func (*awsRestjson1_deserializeOpListVirtualServices) ID() string { 4688 return "OperationDeserializer" 4689} 4690 4691func (m *awsRestjson1_deserializeOpListVirtualServices) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4692 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4693) { 4694 out, metadata, err = next.HandleDeserialize(ctx, in) 4695 if err != nil { 4696 return out, metadata, err 4697 } 4698 4699 response, ok := out.RawResponse.(*smithyhttp.Response) 4700 if !ok { 4701 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4702 } 4703 4704 if response.StatusCode < 200 || response.StatusCode >= 300 { 4705 return out, metadata, awsRestjson1_deserializeOpErrorListVirtualServices(response, &metadata) 4706 } 4707 output := &ListVirtualServicesOutput{} 4708 out.Result = output 4709 4710 var buff [1024]byte 4711 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4712 4713 body := io.TeeReader(response.Body, ringBuffer) 4714 4715 decoder := json.NewDecoder(body) 4716 decoder.UseNumber() 4717 var shape interface{} 4718 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4719 var snapshot bytes.Buffer 4720 io.Copy(&snapshot, ringBuffer) 4721 err = &smithy.DeserializationError{ 4722 Err: fmt.Errorf("failed to decode response body, %w", err), 4723 Snapshot: snapshot.Bytes(), 4724 } 4725 return out, metadata, err 4726 } 4727 4728 err = awsRestjson1_deserializeOpDocumentListVirtualServicesOutput(&output, shape) 4729 if err != nil { 4730 var snapshot bytes.Buffer 4731 io.Copy(&snapshot, ringBuffer) 4732 return out, metadata, &smithy.DeserializationError{ 4733 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4734 Snapshot: snapshot.Bytes(), 4735 } 4736 } 4737 4738 return out, metadata, err 4739} 4740 4741func awsRestjson1_deserializeOpErrorListVirtualServices(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4742 var errorBuffer bytes.Buffer 4743 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4744 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4745 } 4746 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4747 4748 errorCode := "UnknownError" 4749 errorMessage := errorCode 4750 4751 code := response.Header.Get("X-Amzn-ErrorType") 4752 if len(code) != 0 { 4753 errorCode = restjson.SanitizeErrorCode(code) 4754 } 4755 4756 var buff [1024]byte 4757 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4758 4759 body := io.TeeReader(errorBody, ringBuffer) 4760 decoder := json.NewDecoder(body) 4761 decoder.UseNumber() 4762 code, message, err := restjson.GetErrorInfo(decoder) 4763 if err != nil { 4764 var snapshot bytes.Buffer 4765 io.Copy(&snapshot, ringBuffer) 4766 err = &smithy.DeserializationError{ 4767 Err: fmt.Errorf("failed to decode response body, %w", err), 4768 Snapshot: snapshot.Bytes(), 4769 } 4770 return err 4771 } 4772 4773 errorBody.Seek(0, io.SeekStart) 4774 if len(code) != 0 { 4775 errorCode = restjson.SanitizeErrorCode(code) 4776 } 4777 if len(message) != 0 { 4778 errorMessage = message 4779 } 4780 4781 switch { 4782 case strings.EqualFold("BadRequestException", errorCode): 4783 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4784 4785 case strings.EqualFold("ForbiddenException", errorCode): 4786 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 4787 4788 case strings.EqualFold("InternalServerErrorException", errorCode): 4789 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 4790 4791 case strings.EqualFold("NotFoundException", errorCode): 4792 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4793 4794 case strings.EqualFold("ServiceUnavailableException", errorCode): 4795 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4796 4797 case strings.EqualFold("TooManyRequestsException", errorCode): 4798 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4799 4800 default: 4801 genericError := &smithy.GenericAPIError{ 4802 Code: errorCode, 4803 Message: errorMessage, 4804 } 4805 return genericError 4806 4807 } 4808} 4809 4810func awsRestjson1_deserializeOpDocumentListVirtualServicesOutput(v **ListVirtualServicesOutput, value interface{}) error { 4811 if v == nil { 4812 return fmt.Errorf("unexpected nil of type %T", v) 4813 } 4814 if value == nil { 4815 return nil 4816 } 4817 4818 shape, ok := value.(map[string]interface{}) 4819 if !ok { 4820 return fmt.Errorf("unexpected JSON type %v", value) 4821 } 4822 4823 var sv *ListVirtualServicesOutput 4824 if *v == nil { 4825 sv = &ListVirtualServicesOutput{} 4826 } else { 4827 sv = *v 4828 } 4829 4830 for key, value := range shape { 4831 switch key { 4832 case "nextToken": 4833 if value != nil { 4834 jtv, ok := value.(string) 4835 if !ok { 4836 return fmt.Errorf("expected String to be of type string, got %T instead", value) 4837 } 4838 sv.NextToken = ptr.String(jtv) 4839 } 4840 4841 case "virtualServices": 4842 if err := awsRestjson1_deserializeDocumentVirtualServiceList(&sv.VirtualServices, value); err != nil { 4843 return err 4844 } 4845 4846 default: 4847 _, _ = key, value 4848 4849 } 4850 } 4851 *v = sv 4852 return nil 4853} 4854 4855type awsRestjson1_deserializeOpTagResource struct { 4856} 4857 4858func (*awsRestjson1_deserializeOpTagResource) ID() string { 4859 return "OperationDeserializer" 4860} 4861 4862func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4863 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4864) { 4865 out, metadata, err = next.HandleDeserialize(ctx, in) 4866 if err != nil { 4867 return out, metadata, err 4868 } 4869 4870 response, ok := out.RawResponse.(*smithyhttp.Response) 4871 if !ok { 4872 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4873 } 4874 4875 if response.StatusCode < 200 || response.StatusCode >= 300 { 4876 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 4877 } 4878 output := &TagResourceOutput{} 4879 out.Result = output 4880 4881 return out, metadata, err 4882} 4883 4884func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4885 var errorBuffer bytes.Buffer 4886 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4887 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4888 } 4889 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4890 4891 errorCode := "UnknownError" 4892 errorMessage := errorCode 4893 4894 code := response.Header.Get("X-Amzn-ErrorType") 4895 if len(code) != 0 { 4896 errorCode = restjson.SanitizeErrorCode(code) 4897 } 4898 4899 var buff [1024]byte 4900 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4901 4902 body := io.TeeReader(errorBody, ringBuffer) 4903 decoder := json.NewDecoder(body) 4904 decoder.UseNumber() 4905 code, message, err := restjson.GetErrorInfo(decoder) 4906 if err != nil { 4907 var snapshot bytes.Buffer 4908 io.Copy(&snapshot, ringBuffer) 4909 err = &smithy.DeserializationError{ 4910 Err: fmt.Errorf("failed to decode response body, %w", err), 4911 Snapshot: snapshot.Bytes(), 4912 } 4913 return err 4914 } 4915 4916 errorBody.Seek(0, io.SeekStart) 4917 if len(code) != 0 { 4918 errorCode = restjson.SanitizeErrorCode(code) 4919 } 4920 if len(message) != 0 { 4921 errorMessage = message 4922 } 4923 4924 switch { 4925 case strings.EqualFold("BadRequestException", errorCode): 4926 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4927 4928 case strings.EqualFold("ForbiddenException", errorCode): 4929 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 4930 4931 case strings.EqualFold("InternalServerErrorException", errorCode): 4932 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 4933 4934 case strings.EqualFold("NotFoundException", errorCode): 4935 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4936 4937 case strings.EqualFold("ServiceUnavailableException", errorCode): 4938 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4939 4940 case strings.EqualFold("TooManyRequestsException", errorCode): 4941 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4942 4943 case strings.EqualFold("TooManyTagsException", errorCode): 4944 return awsRestjson1_deserializeErrorTooManyTagsException(response, errorBody) 4945 4946 default: 4947 genericError := &smithy.GenericAPIError{ 4948 Code: errorCode, 4949 Message: errorMessage, 4950 } 4951 return genericError 4952 4953 } 4954} 4955 4956type awsRestjson1_deserializeOpUntagResource struct { 4957} 4958 4959func (*awsRestjson1_deserializeOpUntagResource) ID() string { 4960 return "OperationDeserializer" 4961} 4962 4963func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4964 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4965) { 4966 out, metadata, err = next.HandleDeserialize(ctx, in) 4967 if err != nil { 4968 return out, metadata, err 4969 } 4970 4971 response, ok := out.RawResponse.(*smithyhttp.Response) 4972 if !ok { 4973 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4974 } 4975 4976 if response.StatusCode < 200 || response.StatusCode >= 300 { 4977 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 4978 } 4979 output := &UntagResourceOutput{} 4980 out.Result = output 4981 4982 return out, metadata, err 4983} 4984 4985func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4986 var errorBuffer bytes.Buffer 4987 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4988 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4989 } 4990 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4991 4992 errorCode := "UnknownError" 4993 errorMessage := errorCode 4994 4995 code := response.Header.Get("X-Amzn-ErrorType") 4996 if len(code) != 0 { 4997 errorCode = restjson.SanitizeErrorCode(code) 4998 } 4999 5000 var buff [1024]byte 5001 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5002 5003 body := io.TeeReader(errorBody, ringBuffer) 5004 decoder := json.NewDecoder(body) 5005 decoder.UseNumber() 5006 code, message, err := restjson.GetErrorInfo(decoder) 5007 if err != nil { 5008 var snapshot bytes.Buffer 5009 io.Copy(&snapshot, ringBuffer) 5010 err = &smithy.DeserializationError{ 5011 Err: fmt.Errorf("failed to decode response body, %w", err), 5012 Snapshot: snapshot.Bytes(), 5013 } 5014 return err 5015 } 5016 5017 errorBody.Seek(0, io.SeekStart) 5018 if len(code) != 0 { 5019 errorCode = restjson.SanitizeErrorCode(code) 5020 } 5021 if len(message) != 0 { 5022 errorMessage = message 5023 } 5024 5025 switch { 5026 case strings.EqualFold("BadRequestException", errorCode): 5027 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5028 5029 case strings.EqualFold("ForbiddenException", errorCode): 5030 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 5031 5032 case strings.EqualFold("InternalServerErrorException", errorCode): 5033 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 5034 5035 case strings.EqualFold("NotFoundException", errorCode): 5036 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5037 5038 case strings.EqualFold("ServiceUnavailableException", errorCode): 5039 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 5040 5041 case strings.EqualFold("TooManyRequestsException", errorCode): 5042 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5043 5044 default: 5045 genericError := &smithy.GenericAPIError{ 5046 Code: errorCode, 5047 Message: errorMessage, 5048 } 5049 return genericError 5050 5051 } 5052} 5053 5054type awsRestjson1_deserializeOpUpdateGatewayRoute struct { 5055} 5056 5057func (*awsRestjson1_deserializeOpUpdateGatewayRoute) ID() string { 5058 return "OperationDeserializer" 5059} 5060 5061func (m *awsRestjson1_deserializeOpUpdateGatewayRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5062 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5063) { 5064 out, metadata, err = next.HandleDeserialize(ctx, in) 5065 if err != nil { 5066 return out, metadata, err 5067 } 5068 5069 response, ok := out.RawResponse.(*smithyhttp.Response) 5070 if !ok { 5071 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5072 } 5073 5074 if response.StatusCode < 200 || response.StatusCode >= 300 { 5075 return out, metadata, awsRestjson1_deserializeOpErrorUpdateGatewayRoute(response, &metadata) 5076 } 5077 output := &UpdateGatewayRouteOutput{} 5078 out.Result = output 5079 5080 var buff [1024]byte 5081 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5082 5083 body := io.TeeReader(response.Body, ringBuffer) 5084 5085 decoder := json.NewDecoder(body) 5086 decoder.UseNumber() 5087 var shape interface{} 5088 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5089 var snapshot bytes.Buffer 5090 io.Copy(&snapshot, ringBuffer) 5091 err = &smithy.DeserializationError{ 5092 Err: fmt.Errorf("failed to decode response body, %w", err), 5093 Snapshot: snapshot.Bytes(), 5094 } 5095 return out, metadata, err 5096 } 5097 5098 err = awsRestjson1_deserializeDocumentGatewayRouteData(&output.GatewayRoute, shape) 5099 if err != nil { 5100 var snapshot bytes.Buffer 5101 io.Copy(&snapshot, ringBuffer) 5102 return out, metadata, &smithy.DeserializationError{ 5103 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5104 Snapshot: snapshot.Bytes(), 5105 } 5106 } 5107 5108 return out, metadata, err 5109} 5110 5111func awsRestjson1_deserializeOpErrorUpdateGatewayRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5112 var errorBuffer bytes.Buffer 5113 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5114 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5115 } 5116 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5117 5118 errorCode := "UnknownError" 5119 errorMessage := errorCode 5120 5121 code := response.Header.Get("X-Amzn-ErrorType") 5122 if len(code) != 0 { 5123 errorCode = restjson.SanitizeErrorCode(code) 5124 } 5125 5126 var buff [1024]byte 5127 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5128 5129 body := io.TeeReader(errorBody, ringBuffer) 5130 decoder := json.NewDecoder(body) 5131 decoder.UseNumber() 5132 code, message, err := restjson.GetErrorInfo(decoder) 5133 if err != nil { 5134 var snapshot bytes.Buffer 5135 io.Copy(&snapshot, ringBuffer) 5136 err = &smithy.DeserializationError{ 5137 Err: fmt.Errorf("failed to decode response body, %w", err), 5138 Snapshot: snapshot.Bytes(), 5139 } 5140 return err 5141 } 5142 5143 errorBody.Seek(0, io.SeekStart) 5144 if len(code) != 0 { 5145 errorCode = restjson.SanitizeErrorCode(code) 5146 } 5147 if len(message) != 0 { 5148 errorMessage = message 5149 } 5150 5151 switch { 5152 case strings.EqualFold("BadRequestException", errorCode): 5153 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5154 5155 case strings.EqualFold("ConflictException", errorCode): 5156 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 5157 5158 case strings.EqualFold("ForbiddenException", errorCode): 5159 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 5160 5161 case strings.EqualFold("InternalServerErrorException", errorCode): 5162 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 5163 5164 case strings.EqualFold("LimitExceededException", errorCode): 5165 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 5166 5167 case strings.EqualFold("NotFoundException", errorCode): 5168 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5169 5170 case strings.EqualFold("ServiceUnavailableException", errorCode): 5171 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 5172 5173 case strings.EqualFold("TooManyRequestsException", errorCode): 5174 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5175 5176 default: 5177 genericError := &smithy.GenericAPIError{ 5178 Code: errorCode, 5179 Message: errorMessage, 5180 } 5181 return genericError 5182 5183 } 5184} 5185 5186func awsRestjson1_deserializeOpDocumentUpdateGatewayRouteOutput(v **UpdateGatewayRouteOutput, value interface{}) error { 5187 if v == nil { 5188 return fmt.Errorf("unexpected nil of type %T", v) 5189 } 5190 if value == nil { 5191 return nil 5192 } 5193 5194 shape, ok := value.(map[string]interface{}) 5195 if !ok { 5196 return fmt.Errorf("unexpected JSON type %v", value) 5197 } 5198 5199 var sv *UpdateGatewayRouteOutput 5200 if *v == nil { 5201 sv = &UpdateGatewayRouteOutput{} 5202 } else { 5203 sv = *v 5204 } 5205 5206 for key, value := range shape { 5207 switch key { 5208 case "gatewayRoute": 5209 if err := awsRestjson1_deserializeDocumentGatewayRouteData(&sv.GatewayRoute, value); err != nil { 5210 return err 5211 } 5212 5213 default: 5214 _, _ = key, value 5215 5216 } 5217 } 5218 *v = sv 5219 return nil 5220} 5221 5222type awsRestjson1_deserializeOpUpdateMesh struct { 5223} 5224 5225func (*awsRestjson1_deserializeOpUpdateMesh) ID() string { 5226 return "OperationDeserializer" 5227} 5228 5229func (m *awsRestjson1_deserializeOpUpdateMesh) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5230 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5231) { 5232 out, metadata, err = next.HandleDeserialize(ctx, in) 5233 if err != nil { 5234 return out, metadata, err 5235 } 5236 5237 response, ok := out.RawResponse.(*smithyhttp.Response) 5238 if !ok { 5239 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5240 } 5241 5242 if response.StatusCode < 200 || response.StatusCode >= 300 { 5243 return out, metadata, awsRestjson1_deserializeOpErrorUpdateMesh(response, &metadata) 5244 } 5245 output := &UpdateMeshOutput{} 5246 out.Result = output 5247 5248 var buff [1024]byte 5249 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5250 5251 body := io.TeeReader(response.Body, ringBuffer) 5252 5253 decoder := json.NewDecoder(body) 5254 decoder.UseNumber() 5255 var shape interface{} 5256 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5257 var snapshot bytes.Buffer 5258 io.Copy(&snapshot, ringBuffer) 5259 err = &smithy.DeserializationError{ 5260 Err: fmt.Errorf("failed to decode response body, %w", err), 5261 Snapshot: snapshot.Bytes(), 5262 } 5263 return out, metadata, err 5264 } 5265 5266 err = awsRestjson1_deserializeDocumentMeshData(&output.Mesh, shape) 5267 if err != nil { 5268 var snapshot bytes.Buffer 5269 io.Copy(&snapshot, ringBuffer) 5270 return out, metadata, &smithy.DeserializationError{ 5271 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5272 Snapshot: snapshot.Bytes(), 5273 } 5274 } 5275 5276 return out, metadata, err 5277} 5278 5279func awsRestjson1_deserializeOpErrorUpdateMesh(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5280 var errorBuffer bytes.Buffer 5281 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5282 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5283 } 5284 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5285 5286 errorCode := "UnknownError" 5287 errorMessage := errorCode 5288 5289 code := response.Header.Get("X-Amzn-ErrorType") 5290 if len(code) != 0 { 5291 errorCode = restjson.SanitizeErrorCode(code) 5292 } 5293 5294 var buff [1024]byte 5295 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5296 5297 body := io.TeeReader(errorBody, ringBuffer) 5298 decoder := json.NewDecoder(body) 5299 decoder.UseNumber() 5300 code, message, err := restjson.GetErrorInfo(decoder) 5301 if err != nil { 5302 var snapshot bytes.Buffer 5303 io.Copy(&snapshot, ringBuffer) 5304 err = &smithy.DeserializationError{ 5305 Err: fmt.Errorf("failed to decode response body, %w", err), 5306 Snapshot: snapshot.Bytes(), 5307 } 5308 return err 5309 } 5310 5311 errorBody.Seek(0, io.SeekStart) 5312 if len(code) != 0 { 5313 errorCode = restjson.SanitizeErrorCode(code) 5314 } 5315 if len(message) != 0 { 5316 errorMessage = message 5317 } 5318 5319 switch { 5320 case strings.EqualFold("BadRequestException", errorCode): 5321 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5322 5323 case strings.EqualFold("ConflictException", errorCode): 5324 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 5325 5326 case strings.EqualFold("ForbiddenException", errorCode): 5327 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 5328 5329 case strings.EqualFold("InternalServerErrorException", errorCode): 5330 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 5331 5332 case strings.EqualFold("NotFoundException", errorCode): 5333 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5334 5335 case strings.EqualFold("ServiceUnavailableException", errorCode): 5336 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 5337 5338 case strings.EqualFold("TooManyRequestsException", errorCode): 5339 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5340 5341 default: 5342 genericError := &smithy.GenericAPIError{ 5343 Code: errorCode, 5344 Message: errorMessage, 5345 } 5346 return genericError 5347 5348 } 5349} 5350 5351func awsRestjson1_deserializeOpDocumentUpdateMeshOutput(v **UpdateMeshOutput, value interface{}) error { 5352 if v == nil { 5353 return fmt.Errorf("unexpected nil of type %T", v) 5354 } 5355 if value == nil { 5356 return nil 5357 } 5358 5359 shape, ok := value.(map[string]interface{}) 5360 if !ok { 5361 return fmt.Errorf("unexpected JSON type %v", value) 5362 } 5363 5364 var sv *UpdateMeshOutput 5365 if *v == nil { 5366 sv = &UpdateMeshOutput{} 5367 } else { 5368 sv = *v 5369 } 5370 5371 for key, value := range shape { 5372 switch key { 5373 case "mesh": 5374 if err := awsRestjson1_deserializeDocumentMeshData(&sv.Mesh, value); err != nil { 5375 return err 5376 } 5377 5378 default: 5379 _, _ = key, value 5380 5381 } 5382 } 5383 *v = sv 5384 return nil 5385} 5386 5387type awsRestjson1_deserializeOpUpdateRoute struct { 5388} 5389 5390func (*awsRestjson1_deserializeOpUpdateRoute) ID() string { 5391 return "OperationDeserializer" 5392} 5393 5394func (m *awsRestjson1_deserializeOpUpdateRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5395 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5396) { 5397 out, metadata, err = next.HandleDeserialize(ctx, in) 5398 if err != nil { 5399 return out, metadata, err 5400 } 5401 5402 response, ok := out.RawResponse.(*smithyhttp.Response) 5403 if !ok { 5404 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5405 } 5406 5407 if response.StatusCode < 200 || response.StatusCode >= 300 { 5408 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoute(response, &metadata) 5409 } 5410 output := &UpdateRouteOutput{} 5411 out.Result = output 5412 5413 var buff [1024]byte 5414 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5415 5416 body := io.TeeReader(response.Body, ringBuffer) 5417 5418 decoder := json.NewDecoder(body) 5419 decoder.UseNumber() 5420 var shape interface{} 5421 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5422 var snapshot bytes.Buffer 5423 io.Copy(&snapshot, ringBuffer) 5424 err = &smithy.DeserializationError{ 5425 Err: fmt.Errorf("failed to decode response body, %w", err), 5426 Snapshot: snapshot.Bytes(), 5427 } 5428 return out, metadata, err 5429 } 5430 5431 err = awsRestjson1_deserializeDocumentRouteData(&output.Route, shape) 5432 if err != nil { 5433 var snapshot bytes.Buffer 5434 io.Copy(&snapshot, ringBuffer) 5435 return out, metadata, &smithy.DeserializationError{ 5436 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5437 Snapshot: snapshot.Bytes(), 5438 } 5439 } 5440 5441 return out, metadata, err 5442} 5443 5444func awsRestjson1_deserializeOpErrorUpdateRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5445 var errorBuffer bytes.Buffer 5446 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5447 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5448 } 5449 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5450 5451 errorCode := "UnknownError" 5452 errorMessage := errorCode 5453 5454 code := response.Header.Get("X-Amzn-ErrorType") 5455 if len(code) != 0 { 5456 errorCode = restjson.SanitizeErrorCode(code) 5457 } 5458 5459 var buff [1024]byte 5460 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5461 5462 body := io.TeeReader(errorBody, ringBuffer) 5463 decoder := json.NewDecoder(body) 5464 decoder.UseNumber() 5465 code, message, err := restjson.GetErrorInfo(decoder) 5466 if err != nil { 5467 var snapshot bytes.Buffer 5468 io.Copy(&snapshot, ringBuffer) 5469 err = &smithy.DeserializationError{ 5470 Err: fmt.Errorf("failed to decode response body, %w", err), 5471 Snapshot: snapshot.Bytes(), 5472 } 5473 return err 5474 } 5475 5476 errorBody.Seek(0, io.SeekStart) 5477 if len(code) != 0 { 5478 errorCode = restjson.SanitizeErrorCode(code) 5479 } 5480 if len(message) != 0 { 5481 errorMessage = message 5482 } 5483 5484 switch { 5485 case strings.EqualFold("BadRequestException", errorCode): 5486 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5487 5488 case strings.EqualFold("ConflictException", errorCode): 5489 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 5490 5491 case strings.EqualFold("ForbiddenException", errorCode): 5492 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 5493 5494 case strings.EqualFold("InternalServerErrorException", errorCode): 5495 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 5496 5497 case strings.EqualFold("LimitExceededException", errorCode): 5498 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 5499 5500 case strings.EqualFold("NotFoundException", errorCode): 5501 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5502 5503 case strings.EqualFold("ServiceUnavailableException", errorCode): 5504 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 5505 5506 case strings.EqualFold("TooManyRequestsException", errorCode): 5507 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5508 5509 default: 5510 genericError := &smithy.GenericAPIError{ 5511 Code: errorCode, 5512 Message: errorMessage, 5513 } 5514 return genericError 5515 5516 } 5517} 5518 5519func awsRestjson1_deserializeOpDocumentUpdateRouteOutput(v **UpdateRouteOutput, value interface{}) error { 5520 if v == nil { 5521 return fmt.Errorf("unexpected nil of type %T", v) 5522 } 5523 if value == nil { 5524 return nil 5525 } 5526 5527 shape, ok := value.(map[string]interface{}) 5528 if !ok { 5529 return fmt.Errorf("unexpected JSON type %v", value) 5530 } 5531 5532 var sv *UpdateRouteOutput 5533 if *v == nil { 5534 sv = &UpdateRouteOutput{} 5535 } else { 5536 sv = *v 5537 } 5538 5539 for key, value := range shape { 5540 switch key { 5541 case "route": 5542 if err := awsRestjson1_deserializeDocumentRouteData(&sv.Route, value); err != nil { 5543 return err 5544 } 5545 5546 default: 5547 _, _ = key, value 5548 5549 } 5550 } 5551 *v = sv 5552 return nil 5553} 5554 5555type awsRestjson1_deserializeOpUpdateVirtualGateway struct { 5556} 5557 5558func (*awsRestjson1_deserializeOpUpdateVirtualGateway) ID() string { 5559 return "OperationDeserializer" 5560} 5561 5562func (m *awsRestjson1_deserializeOpUpdateVirtualGateway) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5563 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5564) { 5565 out, metadata, err = next.HandleDeserialize(ctx, in) 5566 if err != nil { 5567 return out, metadata, err 5568 } 5569 5570 response, ok := out.RawResponse.(*smithyhttp.Response) 5571 if !ok { 5572 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5573 } 5574 5575 if response.StatusCode < 200 || response.StatusCode >= 300 { 5576 return out, metadata, awsRestjson1_deserializeOpErrorUpdateVirtualGateway(response, &metadata) 5577 } 5578 output := &UpdateVirtualGatewayOutput{} 5579 out.Result = output 5580 5581 var buff [1024]byte 5582 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5583 5584 body := io.TeeReader(response.Body, ringBuffer) 5585 5586 decoder := json.NewDecoder(body) 5587 decoder.UseNumber() 5588 var shape interface{} 5589 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5590 var snapshot bytes.Buffer 5591 io.Copy(&snapshot, ringBuffer) 5592 err = &smithy.DeserializationError{ 5593 Err: fmt.Errorf("failed to decode response body, %w", err), 5594 Snapshot: snapshot.Bytes(), 5595 } 5596 return out, metadata, err 5597 } 5598 5599 err = awsRestjson1_deserializeDocumentVirtualGatewayData(&output.VirtualGateway, shape) 5600 if err != nil { 5601 var snapshot bytes.Buffer 5602 io.Copy(&snapshot, ringBuffer) 5603 return out, metadata, &smithy.DeserializationError{ 5604 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5605 Snapshot: snapshot.Bytes(), 5606 } 5607 } 5608 5609 return out, metadata, err 5610} 5611 5612func awsRestjson1_deserializeOpErrorUpdateVirtualGateway(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5613 var errorBuffer bytes.Buffer 5614 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5615 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5616 } 5617 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5618 5619 errorCode := "UnknownError" 5620 errorMessage := errorCode 5621 5622 code := response.Header.Get("X-Amzn-ErrorType") 5623 if len(code) != 0 { 5624 errorCode = restjson.SanitizeErrorCode(code) 5625 } 5626 5627 var buff [1024]byte 5628 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5629 5630 body := io.TeeReader(errorBody, ringBuffer) 5631 decoder := json.NewDecoder(body) 5632 decoder.UseNumber() 5633 code, message, err := restjson.GetErrorInfo(decoder) 5634 if err != nil { 5635 var snapshot bytes.Buffer 5636 io.Copy(&snapshot, ringBuffer) 5637 err = &smithy.DeserializationError{ 5638 Err: fmt.Errorf("failed to decode response body, %w", err), 5639 Snapshot: snapshot.Bytes(), 5640 } 5641 return err 5642 } 5643 5644 errorBody.Seek(0, io.SeekStart) 5645 if len(code) != 0 { 5646 errorCode = restjson.SanitizeErrorCode(code) 5647 } 5648 if len(message) != 0 { 5649 errorMessage = message 5650 } 5651 5652 switch { 5653 case strings.EqualFold("BadRequestException", errorCode): 5654 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5655 5656 case strings.EqualFold("ConflictException", errorCode): 5657 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 5658 5659 case strings.EqualFold("ForbiddenException", errorCode): 5660 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 5661 5662 case strings.EqualFold("InternalServerErrorException", errorCode): 5663 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 5664 5665 case strings.EqualFold("LimitExceededException", errorCode): 5666 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 5667 5668 case strings.EqualFold("NotFoundException", errorCode): 5669 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5670 5671 case strings.EqualFold("ServiceUnavailableException", errorCode): 5672 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 5673 5674 case strings.EqualFold("TooManyRequestsException", errorCode): 5675 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5676 5677 default: 5678 genericError := &smithy.GenericAPIError{ 5679 Code: errorCode, 5680 Message: errorMessage, 5681 } 5682 return genericError 5683 5684 } 5685} 5686 5687func awsRestjson1_deserializeOpDocumentUpdateVirtualGatewayOutput(v **UpdateVirtualGatewayOutput, value interface{}) error { 5688 if v == nil { 5689 return fmt.Errorf("unexpected nil of type %T", v) 5690 } 5691 if value == nil { 5692 return nil 5693 } 5694 5695 shape, ok := value.(map[string]interface{}) 5696 if !ok { 5697 return fmt.Errorf("unexpected JSON type %v", value) 5698 } 5699 5700 var sv *UpdateVirtualGatewayOutput 5701 if *v == nil { 5702 sv = &UpdateVirtualGatewayOutput{} 5703 } else { 5704 sv = *v 5705 } 5706 5707 for key, value := range shape { 5708 switch key { 5709 case "virtualGateway": 5710 if err := awsRestjson1_deserializeDocumentVirtualGatewayData(&sv.VirtualGateway, value); err != nil { 5711 return err 5712 } 5713 5714 default: 5715 _, _ = key, value 5716 5717 } 5718 } 5719 *v = sv 5720 return nil 5721} 5722 5723type awsRestjson1_deserializeOpUpdateVirtualNode struct { 5724} 5725 5726func (*awsRestjson1_deserializeOpUpdateVirtualNode) ID() string { 5727 return "OperationDeserializer" 5728} 5729 5730func (m *awsRestjson1_deserializeOpUpdateVirtualNode) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5731 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5732) { 5733 out, metadata, err = next.HandleDeserialize(ctx, in) 5734 if err != nil { 5735 return out, metadata, err 5736 } 5737 5738 response, ok := out.RawResponse.(*smithyhttp.Response) 5739 if !ok { 5740 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5741 } 5742 5743 if response.StatusCode < 200 || response.StatusCode >= 300 { 5744 return out, metadata, awsRestjson1_deserializeOpErrorUpdateVirtualNode(response, &metadata) 5745 } 5746 output := &UpdateVirtualNodeOutput{} 5747 out.Result = output 5748 5749 var buff [1024]byte 5750 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5751 5752 body := io.TeeReader(response.Body, ringBuffer) 5753 5754 decoder := json.NewDecoder(body) 5755 decoder.UseNumber() 5756 var shape interface{} 5757 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5758 var snapshot bytes.Buffer 5759 io.Copy(&snapshot, ringBuffer) 5760 err = &smithy.DeserializationError{ 5761 Err: fmt.Errorf("failed to decode response body, %w", err), 5762 Snapshot: snapshot.Bytes(), 5763 } 5764 return out, metadata, err 5765 } 5766 5767 err = awsRestjson1_deserializeDocumentVirtualNodeData(&output.VirtualNode, shape) 5768 if err != nil { 5769 var snapshot bytes.Buffer 5770 io.Copy(&snapshot, ringBuffer) 5771 return out, metadata, &smithy.DeserializationError{ 5772 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5773 Snapshot: snapshot.Bytes(), 5774 } 5775 } 5776 5777 return out, metadata, err 5778} 5779 5780func awsRestjson1_deserializeOpErrorUpdateVirtualNode(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5781 var errorBuffer bytes.Buffer 5782 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5783 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5784 } 5785 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5786 5787 errorCode := "UnknownError" 5788 errorMessage := errorCode 5789 5790 code := response.Header.Get("X-Amzn-ErrorType") 5791 if len(code) != 0 { 5792 errorCode = restjson.SanitizeErrorCode(code) 5793 } 5794 5795 var buff [1024]byte 5796 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5797 5798 body := io.TeeReader(errorBody, ringBuffer) 5799 decoder := json.NewDecoder(body) 5800 decoder.UseNumber() 5801 code, message, err := restjson.GetErrorInfo(decoder) 5802 if err != nil { 5803 var snapshot bytes.Buffer 5804 io.Copy(&snapshot, ringBuffer) 5805 err = &smithy.DeserializationError{ 5806 Err: fmt.Errorf("failed to decode response body, %w", err), 5807 Snapshot: snapshot.Bytes(), 5808 } 5809 return err 5810 } 5811 5812 errorBody.Seek(0, io.SeekStart) 5813 if len(code) != 0 { 5814 errorCode = restjson.SanitizeErrorCode(code) 5815 } 5816 if len(message) != 0 { 5817 errorMessage = message 5818 } 5819 5820 switch { 5821 case strings.EqualFold("BadRequestException", errorCode): 5822 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5823 5824 case strings.EqualFold("ConflictException", errorCode): 5825 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 5826 5827 case strings.EqualFold("ForbiddenException", errorCode): 5828 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 5829 5830 case strings.EqualFold("InternalServerErrorException", errorCode): 5831 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 5832 5833 case strings.EqualFold("LimitExceededException", errorCode): 5834 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 5835 5836 case strings.EqualFold("NotFoundException", errorCode): 5837 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5838 5839 case strings.EqualFold("ServiceUnavailableException", errorCode): 5840 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 5841 5842 case strings.EqualFold("TooManyRequestsException", errorCode): 5843 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5844 5845 default: 5846 genericError := &smithy.GenericAPIError{ 5847 Code: errorCode, 5848 Message: errorMessage, 5849 } 5850 return genericError 5851 5852 } 5853} 5854 5855func awsRestjson1_deserializeOpDocumentUpdateVirtualNodeOutput(v **UpdateVirtualNodeOutput, value interface{}) error { 5856 if v == nil { 5857 return fmt.Errorf("unexpected nil of type %T", v) 5858 } 5859 if value == nil { 5860 return nil 5861 } 5862 5863 shape, ok := value.(map[string]interface{}) 5864 if !ok { 5865 return fmt.Errorf("unexpected JSON type %v", value) 5866 } 5867 5868 var sv *UpdateVirtualNodeOutput 5869 if *v == nil { 5870 sv = &UpdateVirtualNodeOutput{} 5871 } else { 5872 sv = *v 5873 } 5874 5875 for key, value := range shape { 5876 switch key { 5877 case "virtualNode": 5878 if err := awsRestjson1_deserializeDocumentVirtualNodeData(&sv.VirtualNode, value); err != nil { 5879 return err 5880 } 5881 5882 default: 5883 _, _ = key, value 5884 5885 } 5886 } 5887 *v = sv 5888 return nil 5889} 5890 5891type awsRestjson1_deserializeOpUpdateVirtualRouter struct { 5892} 5893 5894func (*awsRestjson1_deserializeOpUpdateVirtualRouter) ID() string { 5895 return "OperationDeserializer" 5896} 5897 5898func (m *awsRestjson1_deserializeOpUpdateVirtualRouter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5899 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5900) { 5901 out, metadata, err = next.HandleDeserialize(ctx, in) 5902 if err != nil { 5903 return out, metadata, err 5904 } 5905 5906 response, ok := out.RawResponse.(*smithyhttp.Response) 5907 if !ok { 5908 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5909 } 5910 5911 if response.StatusCode < 200 || response.StatusCode >= 300 { 5912 return out, metadata, awsRestjson1_deserializeOpErrorUpdateVirtualRouter(response, &metadata) 5913 } 5914 output := &UpdateVirtualRouterOutput{} 5915 out.Result = output 5916 5917 var buff [1024]byte 5918 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5919 5920 body := io.TeeReader(response.Body, ringBuffer) 5921 5922 decoder := json.NewDecoder(body) 5923 decoder.UseNumber() 5924 var shape interface{} 5925 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5926 var snapshot bytes.Buffer 5927 io.Copy(&snapshot, ringBuffer) 5928 err = &smithy.DeserializationError{ 5929 Err: fmt.Errorf("failed to decode response body, %w", err), 5930 Snapshot: snapshot.Bytes(), 5931 } 5932 return out, metadata, err 5933 } 5934 5935 err = awsRestjson1_deserializeDocumentVirtualRouterData(&output.VirtualRouter, shape) 5936 if err != nil { 5937 var snapshot bytes.Buffer 5938 io.Copy(&snapshot, ringBuffer) 5939 return out, metadata, &smithy.DeserializationError{ 5940 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5941 Snapshot: snapshot.Bytes(), 5942 } 5943 } 5944 5945 return out, metadata, err 5946} 5947 5948func awsRestjson1_deserializeOpErrorUpdateVirtualRouter(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5949 var errorBuffer bytes.Buffer 5950 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5951 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5952 } 5953 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5954 5955 errorCode := "UnknownError" 5956 errorMessage := errorCode 5957 5958 code := response.Header.Get("X-Amzn-ErrorType") 5959 if len(code) != 0 { 5960 errorCode = restjson.SanitizeErrorCode(code) 5961 } 5962 5963 var buff [1024]byte 5964 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5965 5966 body := io.TeeReader(errorBody, ringBuffer) 5967 decoder := json.NewDecoder(body) 5968 decoder.UseNumber() 5969 code, message, err := restjson.GetErrorInfo(decoder) 5970 if err != nil { 5971 var snapshot bytes.Buffer 5972 io.Copy(&snapshot, ringBuffer) 5973 err = &smithy.DeserializationError{ 5974 Err: fmt.Errorf("failed to decode response body, %w", err), 5975 Snapshot: snapshot.Bytes(), 5976 } 5977 return err 5978 } 5979 5980 errorBody.Seek(0, io.SeekStart) 5981 if len(code) != 0 { 5982 errorCode = restjson.SanitizeErrorCode(code) 5983 } 5984 if len(message) != 0 { 5985 errorMessage = message 5986 } 5987 5988 switch { 5989 case strings.EqualFold("BadRequestException", errorCode): 5990 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5991 5992 case strings.EqualFold("ConflictException", errorCode): 5993 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 5994 5995 case strings.EqualFold("ForbiddenException", errorCode): 5996 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 5997 5998 case strings.EqualFold("InternalServerErrorException", errorCode): 5999 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 6000 6001 case strings.EqualFold("LimitExceededException", errorCode): 6002 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 6003 6004 case strings.EqualFold("NotFoundException", errorCode): 6005 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6006 6007 case strings.EqualFold("ServiceUnavailableException", errorCode): 6008 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 6009 6010 case strings.EqualFold("TooManyRequestsException", errorCode): 6011 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6012 6013 default: 6014 genericError := &smithy.GenericAPIError{ 6015 Code: errorCode, 6016 Message: errorMessage, 6017 } 6018 return genericError 6019 6020 } 6021} 6022 6023func awsRestjson1_deserializeOpDocumentUpdateVirtualRouterOutput(v **UpdateVirtualRouterOutput, value interface{}) error { 6024 if v == nil { 6025 return fmt.Errorf("unexpected nil of type %T", v) 6026 } 6027 if value == nil { 6028 return nil 6029 } 6030 6031 shape, ok := value.(map[string]interface{}) 6032 if !ok { 6033 return fmt.Errorf("unexpected JSON type %v", value) 6034 } 6035 6036 var sv *UpdateVirtualRouterOutput 6037 if *v == nil { 6038 sv = &UpdateVirtualRouterOutput{} 6039 } else { 6040 sv = *v 6041 } 6042 6043 for key, value := range shape { 6044 switch key { 6045 case "virtualRouter": 6046 if err := awsRestjson1_deserializeDocumentVirtualRouterData(&sv.VirtualRouter, value); err != nil { 6047 return err 6048 } 6049 6050 default: 6051 _, _ = key, value 6052 6053 } 6054 } 6055 *v = sv 6056 return nil 6057} 6058 6059type awsRestjson1_deserializeOpUpdateVirtualService struct { 6060} 6061 6062func (*awsRestjson1_deserializeOpUpdateVirtualService) ID() string { 6063 return "OperationDeserializer" 6064} 6065 6066func (m *awsRestjson1_deserializeOpUpdateVirtualService) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6067 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6068) { 6069 out, metadata, err = next.HandleDeserialize(ctx, in) 6070 if err != nil { 6071 return out, metadata, err 6072 } 6073 6074 response, ok := out.RawResponse.(*smithyhttp.Response) 6075 if !ok { 6076 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6077 } 6078 6079 if response.StatusCode < 200 || response.StatusCode >= 300 { 6080 return out, metadata, awsRestjson1_deserializeOpErrorUpdateVirtualService(response, &metadata) 6081 } 6082 output := &UpdateVirtualServiceOutput{} 6083 out.Result = output 6084 6085 var buff [1024]byte 6086 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6087 6088 body := io.TeeReader(response.Body, ringBuffer) 6089 6090 decoder := json.NewDecoder(body) 6091 decoder.UseNumber() 6092 var shape interface{} 6093 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6094 var snapshot bytes.Buffer 6095 io.Copy(&snapshot, ringBuffer) 6096 err = &smithy.DeserializationError{ 6097 Err: fmt.Errorf("failed to decode response body, %w", err), 6098 Snapshot: snapshot.Bytes(), 6099 } 6100 return out, metadata, err 6101 } 6102 6103 err = awsRestjson1_deserializeDocumentVirtualServiceData(&output.VirtualService, shape) 6104 if err != nil { 6105 var snapshot bytes.Buffer 6106 io.Copy(&snapshot, ringBuffer) 6107 return out, metadata, &smithy.DeserializationError{ 6108 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6109 Snapshot: snapshot.Bytes(), 6110 } 6111 } 6112 6113 return out, metadata, err 6114} 6115 6116func awsRestjson1_deserializeOpErrorUpdateVirtualService(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6117 var errorBuffer bytes.Buffer 6118 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6119 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6120 } 6121 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6122 6123 errorCode := "UnknownError" 6124 errorMessage := errorCode 6125 6126 code := response.Header.Get("X-Amzn-ErrorType") 6127 if len(code) != 0 { 6128 errorCode = restjson.SanitizeErrorCode(code) 6129 } 6130 6131 var buff [1024]byte 6132 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6133 6134 body := io.TeeReader(errorBody, ringBuffer) 6135 decoder := json.NewDecoder(body) 6136 decoder.UseNumber() 6137 code, message, err := restjson.GetErrorInfo(decoder) 6138 if err != nil { 6139 var snapshot bytes.Buffer 6140 io.Copy(&snapshot, ringBuffer) 6141 err = &smithy.DeserializationError{ 6142 Err: fmt.Errorf("failed to decode response body, %w", err), 6143 Snapshot: snapshot.Bytes(), 6144 } 6145 return err 6146 } 6147 6148 errorBody.Seek(0, io.SeekStart) 6149 if len(code) != 0 { 6150 errorCode = restjson.SanitizeErrorCode(code) 6151 } 6152 if len(message) != 0 { 6153 errorMessage = message 6154 } 6155 6156 switch { 6157 case strings.EqualFold("BadRequestException", errorCode): 6158 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 6159 6160 case strings.EqualFold("ConflictException", errorCode): 6161 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 6162 6163 case strings.EqualFold("ForbiddenException", errorCode): 6164 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 6165 6166 case strings.EqualFold("InternalServerErrorException", errorCode): 6167 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 6168 6169 case strings.EqualFold("LimitExceededException", errorCode): 6170 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 6171 6172 case strings.EqualFold("NotFoundException", errorCode): 6173 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6174 6175 case strings.EqualFold("ServiceUnavailableException", errorCode): 6176 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 6177 6178 case strings.EqualFold("TooManyRequestsException", errorCode): 6179 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6180 6181 default: 6182 genericError := &smithy.GenericAPIError{ 6183 Code: errorCode, 6184 Message: errorMessage, 6185 } 6186 return genericError 6187 6188 } 6189} 6190 6191func awsRestjson1_deserializeOpDocumentUpdateVirtualServiceOutput(v **UpdateVirtualServiceOutput, value interface{}) error { 6192 if v == nil { 6193 return fmt.Errorf("unexpected nil of type %T", v) 6194 } 6195 if value == nil { 6196 return nil 6197 } 6198 6199 shape, ok := value.(map[string]interface{}) 6200 if !ok { 6201 return fmt.Errorf("unexpected JSON type %v", value) 6202 } 6203 6204 var sv *UpdateVirtualServiceOutput 6205 if *v == nil { 6206 sv = &UpdateVirtualServiceOutput{} 6207 } else { 6208 sv = *v 6209 } 6210 6211 for key, value := range shape { 6212 switch key { 6213 case "virtualService": 6214 if err := awsRestjson1_deserializeDocumentVirtualServiceData(&sv.VirtualService, value); err != nil { 6215 return err 6216 } 6217 6218 default: 6219 _, _ = key, value 6220 6221 } 6222 } 6223 *v = sv 6224 return nil 6225} 6226 6227func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6228 output := &types.BadRequestException{} 6229 var buff [1024]byte 6230 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6231 6232 body := io.TeeReader(errorBody, ringBuffer) 6233 decoder := json.NewDecoder(body) 6234 decoder.UseNumber() 6235 var shape interface{} 6236 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6237 var snapshot bytes.Buffer 6238 io.Copy(&snapshot, ringBuffer) 6239 err = &smithy.DeserializationError{ 6240 Err: fmt.Errorf("failed to decode response body, %w", err), 6241 Snapshot: snapshot.Bytes(), 6242 } 6243 return err 6244 } 6245 6246 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 6247 6248 if err != nil { 6249 var snapshot bytes.Buffer 6250 io.Copy(&snapshot, ringBuffer) 6251 err = &smithy.DeserializationError{ 6252 Err: fmt.Errorf("failed to decode response body, %w", err), 6253 Snapshot: snapshot.Bytes(), 6254 } 6255 return err 6256 } 6257 6258 errorBody.Seek(0, io.SeekStart) 6259 6260 return output 6261} 6262 6263func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6264 output := &types.ConflictException{} 6265 var buff [1024]byte 6266 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6267 6268 body := io.TeeReader(errorBody, ringBuffer) 6269 decoder := json.NewDecoder(body) 6270 decoder.UseNumber() 6271 var shape interface{} 6272 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6273 var snapshot bytes.Buffer 6274 io.Copy(&snapshot, ringBuffer) 6275 err = &smithy.DeserializationError{ 6276 Err: fmt.Errorf("failed to decode response body, %w", err), 6277 Snapshot: snapshot.Bytes(), 6278 } 6279 return err 6280 } 6281 6282 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 6283 6284 if err != nil { 6285 var snapshot bytes.Buffer 6286 io.Copy(&snapshot, ringBuffer) 6287 err = &smithy.DeserializationError{ 6288 Err: fmt.Errorf("failed to decode response body, %w", err), 6289 Snapshot: snapshot.Bytes(), 6290 } 6291 return err 6292 } 6293 6294 errorBody.Seek(0, io.SeekStart) 6295 6296 return output 6297} 6298 6299func awsRestjson1_deserializeErrorForbiddenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6300 output := &types.ForbiddenException{} 6301 var buff [1024]byte 6302 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6303 6304 body := io.TeeReader(errorBody, ringBuffer) 6305 decoder := json.NewDecoder(body) 6306 decoder.UseNumber() 6307 var shape interface{} 6308 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6309 var snapshot bytes.Buffer 6310 io.Copy(&snapshot, ringBuffer) 6311 err = &smithy.DeserializationError{ 6312 Err: fmt.Errorf("failed to decode response body, %w", err), 6313 Snapshot: snapshot.Bytes(), 6314 } 6315 return err 6316 } 6317 6318 err := awsRestjson1_deserializeDocumentForbiddenException(&output, shape) 6319 6320 if err != nil { 6321 var snapshot bytes.Buffer 6322 io.Copy(&snapshot, ringBuffer) 6323 err = &smithy.DeserializationError{ 6324 Err: fmt.Errorf("failed to decode response body, %w", err), 6325 Snapshot: snapshot.Bytes(), 6326 } 6327 return err 6328 } 6329 6330 errorBody.Seek(0, io.SeekStart) 6331 6332 return output 6333} 6334 6335func awsRestjson1_deserializeErrorInternalServerErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6336 output := &types.InternalServerErrorException{} 6337 var buff [1024]byte 6338 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6339 6340 body := io.TeeReader(errorBody, ringBuffer) 6341 decoder := json.NewDecoder(body) 6342 decoder.UseNumber() 6343 var shape interface{} 6344 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6345 var snapshot bytes.Buffer 6346 io.Copy(&snapshot, ringBuffer) 6347 err = &smithy.DeserializationError{ 6348 Err: fmt.Errorf("failed to decode response body, %w", err), 6349 Snapshot: snapshot.Bytes(), 6350 } 6351 return err 6352 } 6353 6354 err := awsRestjson1_deserializeDocumentInternalServerErrorException(&output, shape) 6355 6356 if err != nil { 6357 var snapshot bytes.Buffer 6358 io.Copy(&snapshot, ringBuffer) 6359 err = &smithy.DeserializationError{ 6360 Err: fmt.Errorf("failed to decode response body, %w", err), 6361 Snapshot: snapshot.Bytes(), 6362 } 6363 return err 6364 } 6365 6366 errorBody.Seek(0, io.SeekStart) 6367 6368 return output 6369} 6370 6371func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6372 output := &types.LimitExceededException{} 6373 var buff [1024]byte 6374 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6375 6376 body := io.TeeReader(errorBody, ringBuffer) 6377 decoder := json.NewDecoder(body) 6378 decoder.UseNumber() 6379 var shape interface{} 6380 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6381 var snapshot bytes.Buffer 6382 io.Copy(&snapshot, ringBuffer) 6383 err = &smithy.DeserializationError{ 6384 Err: fmt.Errorf("failed to decode response body, %w", err), 6385 Snapshot: snapshot.Bytes(), 6386 } 6387 return err 6388 } 6389 6390 err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) 6391 6392 if err != nil { 6393 var snapshot bytes.Buffer 6394 io.Copy(&snapshot, ringBuffer) 6395 err = &smithy.DeserializationError{ 6396 Err: fmt.Errorf("failed to decode response body, %w", err), 6397 Snapshot: snapshot.Bytes(), 6398 } 6399 return err 6400 } 6401 6402 errorBody.Seek(0, io.SeekStart) 6403 6404 return output 6405} 6406 6407func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6408 output := &types.NotFoundException{} 6409 var buff [1024]byte 6410 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6411 6412 body := io.TeeReader(errorBody, ringBuffer) 6413 decoder := json.NewDecoder(body) 6414 decoder.UseNumber() 6415 var shape interface{} 6416 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6417 var snapshot bytes.Buffer 6418 io.Copy(&snapshot, ringBuffer) 6419 err = &smithy.DeserializationError{ 6420 Err: fmt.Errorf("failed to decode response body, %w", err), 6421 Snapshot: snapshot.Bytes(), 6422 } 6423 return err 6424 } 6425 6426 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 6427 6428 if err != nil { 6429 var snapshot bytes.Buffer 6430 io.Copy(&snapshot, ringBuffer) 6431 err = &smithy.DeserializationError{ 6432 Err: fmt.Errorf("failed to decode response body, %w", err), 6433 Snapshot: snapshot.Bytes(), 6434 } 6435 return err 6436 } 6437 6438 errorBody.Seek(0, io.SeekStart) 6439 6440 return output 6441} 6442 6443func awsRestjson1_deserializeErrorResourceInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6444 output := &types.ResourceInUseException{} 6445 var buff [1024]byte 6446 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6447 6448 body := io.TeeReader(errorBody, ringBuffer) 6449 decoder := json.NewDecoder(body) 6450 decoder.UseNumber() 6451 var shape interface{} 6452 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6453 var snapshot bytes.Buffer 6454 io.Copy(&snapshot, ringBuffer) 6455 err = &smithy.DeserializationError{ 6456 Err: fmt.Errorf("failed to decode response body, %w", err), 6457 Snapshot: snapshot.Bytes(), 6458 } 6459 return err 6460 } 6461 6462 err := awsRestjson1_deserializeDocumentResourceInUseException(&output, shape) 6463 6464 if err != nil { 6465 var snapshot bytes.Buffer 6466 io.Copy(&snapshot, ringBuffer) 6467 err = &smithy.DeserializationError{ 6468 Err: fmt.Errorf("failed to decode response body, %w", err), 6469 Snapshot: snapshot.Bytes(), 6470 } 6471 return err 6472 } 6473 6474 errorBody.Seek(0, io.SeekStart) 6475 6476 return output 6477} 6478 6479func awsRestjson1_deserializeErrorServiceUnavailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6480 output := &types.ServiceUnavailableException{} 6481 var buff [1024]byte 6482 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6483 6484 body := io.TeeReader(errorBody, ringBuffer) 6485 decoder := json.NewDecoder(body) 6486 decoder.UseNumber() 6487 var shape interface{} 6488 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6489 var snapshot bytes.Buffer 6490 io.Copy(&snapshot, ringBuffer) 6491 err = &smithy.DeserializationError{ 6492 Err: fmt.Errorf("failed to decode response body, %w", err), 6493 Snapshot: snapshot.Bytes(), 6494 } 6495 return err 6496 } 6497 6498 err := awsRestjson1_deserializeDocumentServiceUnavailableException(&output, shape) 6499 6500 if err != nil { 6501 var snapshot bytes.Buffer 6502 io.Copy(&snapshot, ringBuffer) 6503 err = &smithy.DeserializationError{ 6504 Err: fmt.Errorf("failed to decode response body, %w", err), 6505 Snapshot: snapshot.Bytes(), 6506 } 6507 return err 6508 } 6509 6510 errorBody.Seek(0, io.SeekStart) 6511 6512 return output 6513} 6514 6515func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6516 output := &types.TooManyRequestsException{} 6517 var buff [1024]byte 6518 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6519 6520 body := io.TeeReader(errorBody, ringBuffer) 6521 decoder := json.NewDecoder(body) 6522 decoder.UseNumber() 6523 var shape interface{} 6524 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6525 var snapshot bytes.Buffer 6526 io.Copy(&snapshot, ringBuffer) 6527 err = &smithy.DeserializationError{ 6528 Err: fmt.Errorf("failed to decode response body, %w", err), 6529 Snapshot: snapshot.Bytes(), 6530 } 6531 return err 6532 } 6533 6534 err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) 6535 6536 if err != nil { 6537 var snapshot bytes.Buffer 6538 io.Copy(&snapshot, ringBuffer) 6539 err = &smithy.DeserializationError{ 6540 Err: fmt.Errorf("failed to decode response body, %w", err), 6541 Snapshot: snapshot.Bytes(), 6542 } 6543 return err 6544 } 6545 6546 errorBody.Seek(0, io.SeekStart) 6547 6548 return output 6549} 6550 6551func awsRestjson1_deserializeErrorTooManyTagsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6552 output := &types.TooManyTagsException{} 6553 var buff [1024]byte 6554 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6555 6556 body := io.TeeReader(errorBody, ringBuffer) 6557 decoder := json.NewDecoder(body) 6558 decoder.UseNumber() 6559 var shape interface{} 6560 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6561 var snapshot bytes.Buffer 6562 io.Copy(&snapshot, ringBuffer) 6563 err = &smithy.DeserializationError{ 6564 Err: fmt.Errorf("failed to decode response body, %w", err), 6565 Snapshot: snapshot.Bytes(), 6566 } 6567 return err 6568 } 6569 6570 err := awsRestjson1_deserializeDocumentTooManyTagsException(&output, shape) 6571 6572 if err != nil { 6573 var snapshot bytes.Buffer 6574 io.Copy(&snapshot, ringBuffer) 6575 err = &smithy.DeserializationError{ 6576 Err: fmt.Errorf("failed to decode response body, %w", err), 6577 Snapshot: snapshot.Bytes(), 6578 } 6579 return err 6580 } 6581 6582 errorBody.Seek(0, io.SeekStart) 6583 6584 return output 6585} 6586 6587func awsRestjson1_deserializeDocumentAccessLog(v *types.AccessLog, value interface{}) error { 6588 if v == nil { 6589 return fmt.Errorf("unexpected nil of type %T", v) 6590 } 6591 if value == nil { 6592 return nil 6593 } 6594 6595 shape, ok := value.(map[string]interface{}) 6596 if !ok { 6597 return fmt.Errorf("unexpected JSON type %v", value) 6598 } 6599 6600 var uv types.AccessLog 6601loop: 6602 for key, value := range shape { 6603 switch key { 6604 case "file": 6605 var mv types.FileAccessLog 6606 destAddr := &mv 6607 if err := awsRestjson1_deserializeDocumentFileAccessLog(&destAddr, value); err != nil { 6608 return err 6609 } 6610 mv = *destAddr 6611 uv = &types.AccessLogMemberFile{Value: mv} 6612 break loop 6613 6614 default: 6615 uv = &types.UnknownUnionMember{Tag: key} 6616 break loop 6617 6618 } 6619 } 6620 *v = uv 6621 return nil 6622} 6623 6624func awsRestjson1_deserializeDocumentAwsCloudMapInstanceAttribute(v **types.AwsCloudMapInstanceAttribute, value interface{}) error { 6625 if v == nil { 6626 return fmt.Errorf("unexpected nil of type %T", v) 6627 } 6628 if value == nil { 6629 return nil 6630 } 6631 6632 shape, ok := value.(map[string]interface{}) 6633 if !ok { 6634 return fmt.Errorf("unexpected JSON type %v", value) 6635 } 6636 6637 var sv *types.AwsCloudMapInstanceAttribute 6638 if *v == nil { 6639 sv = &types.AwsCloudMapInstanceAttribute{} 6640 } else { 6641 sv = *v 6642 } 6643 6644 for key, value := range shape { 6645 switch key { 6646 case "key": 6647 if value != nil { 6648 jtv, ok := value.(string) 6649 if !ok { 6650 return fmt.Errorf("expected AwsCloudMapInstanceAttributeKey to be of type string, got %T instead", value) 6651 } 6652 sv.Key = ptr.String(jtv) 6653 } 6654 6655 case "value": 6656 if value != nil { 6657 jtv, ok := value.(string) 6658 if !ok { 6659 return fmt.Errorf("expected AwsCloudMapInstanceAttributeValue to be of type string, got %T instead", value) 6660 } 6661 sv.Value = ptr.String(jtv) 6662 } 6663 6664 default: 6665 _, _ = key, value 6666 6667 } 6668 } 6669 *v = sv 6670 return nil 6671} 6672 6673func awsRestjson1_deserializeDocumentAwsCloudMapInstanceAttributes(v *[]types.AwsCloudMapInstanceAttribute, value interface{}) error { 6674 if v == nil { 6675 return fmt.Errorf("unexpected nil of type %T", v) 6676 } 6677 if value == nil { 6678 return nil 6679 } 6680 6681 shape, ok := value.([]interface{}) 6682 if !ok { 6683 return fmt.Errorf("unexpected JSON type %v", value) 6684 } 6685 6686 var cv []types.AwsCloudMapInstanceAttribute 6687 if *v == nil { 6688 cv = []types.AwsCloudMapInstanceAttribute{} 6689 } else { 6690 cv = *v 6691 } 6692 6693 for _, value := range shape { 6694 var col types.AwsCloudMapInstanceAttribute 6695 destAddr := &col 6696 if err := awsRestjson1_deserializeDocumentAwsCloudMapInstanceAttribute(&destAddr, value); err != nil { 6697 return err 6698 } 6699 col = *destAddr 6700 cv = append(cv, col) 6701 6702 } 6703 *v = cv 6704 return nil 6705} 6706 6707func awsRestjson1_deserializeDocumentAwsCloudMapServiceDiscovery(v **types.AwsCloudMapServiceDiscovery, value interface{}) error { 6708 if v == nil { 6709 return fmt.Errorf("unexpected nil of type %T", v) 6710 } 6711 if value == nil { 6712 return nil 6713 } 6714 6715 shape, ok := value.(map[string]interface{}) 6716 if !ok { 6717 return fmt.Errorf("unexpected JSON type %v", value) 6718 } 6719 6720 var sv *types.AwsCloudMapServiceDiscovery 6721 if *v == nil { 6722 sv = &types.AwsCloudMapServiceDiscovery{} 6723 } else { 6724 sv = *v 6725 } 6726 6727 for key, value := range shape { 6728 switch key { 6729 case "attributes": 6730 if err := awsRestjson1_deserializeDocumentAwsCloudMapInstanceAttributes(&sv.Attributes, value); err != nil { 6731 return err 6732 } 6733 6734 case "namespaceName": 6735 if value != nil { 6736 jtv, ok := value.(string) 6737 if !ok { 6738 return fmt.Errorf("expected AwsCloudMapName to be of type string, got %T instead", value) 6739 } 6740 sv.NamespaceName = ptr.String(jtv) 6741 } 6742 6743 case "serviceName": 6744 if value != nil { 6745 jtv, ok := value.(string) 6746 if !ok { 6747 return fmt.Errorf("expected AwsCloudMapName to be of type string, got %T instead", value) 6748 } 6749 sv.ServiceName = ptr.String(jtv) 6750 } 6751 6752 default: 6753 _, _ = key, value 6754 6755 } 6756 } 6757 *v = sv 6758 return nil 6759} 6760 6761func awsRestjson1_deserializeDocumentBackend(v *types.Backend, value interface{}) error { 6762 if v == nil { 6763 return fmt.Errorf("unexpected nil of type %T", v) 6764 } 6765 if value == nil { 6766 return nil 6767 } 6768 6769 shape, ok := value.(map[string]interface{}) 6770 if !ok { 6771 return fmt.Errorf("unexpected JSON type %v", value) 6772 } 6773 6774 var uv types.Backend 6775loop: 6776 for key, value := range shape { 6777 switch key { 6778 case "virtualService": 6779 var mv types.VirtualServiceBackend 6780 destAddr := &mv 6781 if err := awsRestjson1_deserializeDocumentVirtualServiceBackend(&destAddr, value); err != nil { 6782 return err 6783 } 6784 mv = *destAddr 6785 uv = &types.BackendMemberVirtualService{Value: mv} 6786 break loop 6787 6788 default: 6789 uv = &types.UnknownUnionMember{Tag: key} 6790 break loop 6791 6792 } 6793 } 6794 *v = uv 6795 return nil 6796} 6797 6798func awsRestjson1_deserializeDocumentBackendDefaults(v **types.BackendDefaults, value interface{}) error { 6799 if v == nil { 6800 return fmt.Errorf("unexpected nil of type %T", v) 6801 } 6802 if value == nil { 6803 return nil 6804 } 6805 6806 shape, ok := value.(map[string]interface{}) 6807 if !ok { 6808 return fmt.Errorf("unexpected JSON type %v", value) 6809 } 6810 6811 var sv *types.BackendDefaults 6812 if *v == nil { 6813 sv = &types.BackendDefaults{} 6814 } else { 6815 sv = *v 6816 } 6817 6818 for key, value := range shape { 6819 switch key { 6820 case "clientPolicy": 6821 if err := awsRestjson1_deserializeDocumentClientPolicy(&sv.ClientPolicy, value); err != nil { 6822 return err 6823 } 6824 6825 default: 6826 _, _ = key, value 6827 6828 } 6829 } 6830 *v = sv 6831 return nil 6832} 6833 6834func awsRestjson1_deserializeDocumentBackends(v *[]types.Backend, value interface{}) error { 6835 if v == nil { 6836 return fmt.Errorf("unexpected nil of type %T", v) 6837 } 6838 if value == nil { 6839 return nil 6840 } 6841 6842 shape, ok := value.([]interface{}) 6843 if !ok { 6844 return fmt.Errorf("unexpected JSON type %v", value) 6845 } 6846 6847 var cv []types.Backend 6848 if *v == nil { 6849 cv = []types.Backend{} 6850 } else { 6851 cv = *v 6852 } 6853 6854 for _, value := range shape { 6855 var col types.Backend 6856 if err := awsRestjson1_deserializeDocumentBackend(&col, value); err != nil { 6857 return err 6858 } 6859 cv = append(cv, col) 6860 6861 } 6862 *v = cv 6863 return nil 6864} 6865 6866func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 6867 if v == nil { 6868 return fmt.Errorf("unexpected nil of type %T", v) 6869 } 6870 if value == nil { 6871 return nil 6872 } 6873 6874 shape, ok := value.(map[string]interface{}) 6875 if !ok { 6876 return fmt.Errorf("unexpected JSON type %v", value) 6877 } 6878 6879 var sv *types.BadRequestException 6880 if *v == nil { 6881 sv = &types.BadRequestException{} 6882 } else { 6883 sv = *v 6884 } 6885 6886 for key, value := range shape { 6887 switch key { 6888 case "message": 6889 if value != nil { 6890 jtv, ok := value.(string) 6891 if !ok { 6892 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6893 } 6894 sv.Message = ptr.String(jtv) 6895 } 6896 6897 default: 6898 _, _ = key, value 6899 6900 } 6901 } 6902 *v = sv 6903 return nil 6904} 6905 6906func awsRestjson1_deserializeDocumentCertificateAuthorityArns(v *[]string, value interface{}) error { 6907 if v == nil { 6908 return fmt.Errorf("unexpected nil of type %T", v) 6909 } 6910 if value == nil { 6911 return nil 6912 } 6913 6914 shape, ok := value.([]interface{}) 6915 if !ok { 6916 return fmt.Errorf("unexpected JSON type %v", value) 6917 } 6918 6919 var cv []string 6920 if *v == nil { 6921 cv = []string{} 6922 } else { 6923 cv = *v 6924 } 6925 6926 for _, value := range shape { 6927 var col string 6928 if value != nil { 6929 jtv, ok := value.(string) 6930 if !ok { 6931 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 6932 } 6933 col = jtv 6934 } 6935 cv = append(cv, col) 6936 6937 } 6938 *v = cv 6939 return nil 6940} 6941 6942func awsRestjson1_deserializeDocumentClientPolicy(v **types.ClientPolicy, value interface{}) error { 6943 if v == nil { 6944 return fmt.Errorf("unexpected nil of type %T", v) 6945 } 6946 if value == nil { 6947 return nil 6948 } 6949 6950 shape, ok := value.(map[string]interface{}) 6951 if !ok { 6952 return fmt.Errorf("unexpected JSON type %v", value) 6953 } 6954 6955 var sv *types.ClientPolicy 6956 if *v == nil { 6957 sv = &types.ClientPolicy{} 6958 } else { 6959 sv = *v 6960 } 6961 6962 for key, value := range shape { 6963 switch key { 6964 case "tls": 6965 if err := awsRestjson1_deserializeDocumentClientPolicyTls(&sv.Tls, value); err != nil { 6966 return err 6967 } 6968 6969 default: 6970 _, _ = key, value 6971 6972 } 6973 } 6974 *v = sv 6975 return nil 6976} 6977 6978func awsRestjson1_deserializeDocumentClientPolicyTls(v **types.ClientPolicyTls, value interface{}) error { 6979 if v == nil { 6980 return fmt.Errorf("unexpected nil of type %T", v) 6981 } 6982 if value == nil { 6983 return nil 6984 } 6985 6986 shape, ok := value.(map[string]interface{}) 6987 if !ok { 6988 return fmt.Errorf("unexpected JSON type %v", value) 6989 } 6990 6991 var sv *types.ClientPolicyTls 6992 if *v == nil { 6993 sv = &types.ClientPolicyTls{} 6994 } else { 6995 sv = *v 6996 } 6997 6998 for key, value := range shape { 6999 switch key { 7000 case "enforce": 7001 if value != nil { 7002 jtv, ok := value.(bool) 7003 if !ok { 7004 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7005 } 7006 sv.Enforce = ptr.Bool(jtv) 7007 } 7008 7009 case "ports": 7010 if err := awsRestjson1_deserializeDocumentPortSet(&sv.Ports, value); err != nil { 7011 return err 7012 } 7013 7014 case "validation": 7015 if err := awsRestjson1_deserializeDocumentTlsValidationContext(&sv.Validation, value); err != nil { 7016 return err 7017 } 7018 7019 default: 7020 _, _ = key, value 7021 7022 } 7023 } 7024 *v = sv 7025 return nil 7026} 7027 7028func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 7029 if v == nil { 7030 return fmt.Errorf("unexpected nil of type %T", v) 7031 } 7032 if value == nil { 7033 return nil 7034 } 7035 7036 shape, ok := value.(map[string]interface{}) 7037 if !ok { 7038 return fmt.Errorf("unexpected JSON type %v", value) 7039 } 7040 7041 var sv *types.ConflictException 7042 if *v == nil { 7043 sv = &types.ConflictException{} 7044 } else { 7045 sv = *v 7046 } 7047 7048 for key, value := range shape { 7049 switch key { 7050 case "message": 7051 if value != nil { 7052 jtv, ok := value.(string) 7053 if !ok { 7054 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7055 } 7056 sv.Message = ptr.String(jtv) 7057 } 7058 7059 default: 7060 _, _ = key, value 7061 7062 } 7063 } 7064 *v = sv 7065 return nil 7066} 7067 7068func awsRestjson1_deserializeDocumentDnsServiceDiscovery(v **types.DnsServiceDiscovery, value interface{}) error { 7069 if v == nil { 7070 return fmt.Errorf("unexpected nil of type %T", v) 7071 } 7072 if value == nil { 7073 return nil 7074 } 7075 7076 shape, ok := value.(map[string]interface{}) 7077 if !ok { 7078 return fmt.Errorf("unexpected JSON type %v", value) 7079 } 7080 7081 var sv *types.DnsServiceDiscovery 7082 if *v == nil { 7083 sv = &types.DnsServiceDiscovery{} 7084 } else { 7085 sv = *v 7086 } 7087 7088 for key, value := range shape { 7089 switch key { 7090 case "hostname": 7091 if value != nil { 7092 jtv, ok := value.(string) 7093 if !ok { 7094 return fmt.Errorf("expected Hostname to be of type string, got %T instead", value) 7095 } 7096 sv.Hostname = ptr.String(jtv) 7097 } 7098 7099 default: 7100 _, _ = key, value 7101 7102 } 7103 } 7104 *v = sv 7105 return nil 7106} 7107 7108func awsRestjson1_deserializeDocumentDuration(v **types.Duration, value interface{}) error { 7109 if v == nil { 7110 return fmt.Errorf("unexpected nil of type %T", v) 7111 } 7112 if value == nil { 7113 return nil 7114 } 7115 7116 shape, ok := value.(map[string]interface{}) 7117 if !ok { 7118 return fmt.Errorf("unexpected JSON type %v", value) 7119 } 7120 7121 var sv *types.Duration 7122 if *v == nil { 7123 sv = &types.Duration{} 7124 } else { 7125 sv = *v 7126 } 7127 7128 for key, value := range shape { 7129 switch key { 7130 case "unit": 7131 if value != nil { 7132 jtv, ok := value.(string) 7133 if !ok { 7134 return fmt.Errorf("expected DurationUnit to be of type string, got %T instead", value) 7135 } 7136 sv.Unit = types.DurationUnit(jtv) 7137 } 7138 7139 case "value": 7140 if value != nil { 7141 jtv, ok := value.(json.Number) 7142 if !ok { 7143 return fmt.Errorf("expected DurationValue to be json.Number, got %T instead", value) 7144 } 7145 i64, err := jtv.Int64() 7146 if err != nil { 7147 return err 7148 } 7149 sv.Value = ptr.Int64(i64) 7150 } 7151 7152 default: 7153 _, _ = key, value 7154 7155 } 7156 } 7157 *v = sv 7158 return nil 7159} 7160 7161func awsRestjson1_deserializeDocumentEgressFilter(v **types.EgressFilter, value interface{}) error { 7162 if v == nil { 7163 return fmt.Errorf("unexpected nil of type %T", v) 7164 } 7165 if value == nil { 7166 return nil 7167 } 7168 7169 shape, ok := value.(map[string]interface{}) 7170 if !ok { 7171 return fmt.Errorf("unexpected JSON type %v", value) 7172 } 7173 7174 var sv *types.EgressFilter 7175 if *v == nil { 7176 sv = &types.EgressFilter{} 7177 } else { 7178 sv = *v 7179 } 7180 7181 for key, value := range shape { 7182 switch key { 7183 case "type": 7184 if value != nil { 7185 jtv, ok := value.(string) 7186 if !ok { 7187 return fmt.Errorf("expected EgressFilterType to be of type string, got %T instead", value) 7188 } 7189 sv.Type = types.EgressFilterType(jtv) 7190 } 7191 7192 default: 7193 _, _ = key, value 7194 7195 } 7196 } 7197 *v = sv 7198 return nil 7199} 7200 7201func awsRestjson1_deserializeDocumentFileAccessLog(v **types.FileAccessLog, value interface{}) error { 7202 if v == nil { 7203 return fmt.Errorf("unexpected nil of type %T", v) 7204 } 7205 if value == nil { 7206 return nil 7207 } 7208 7209 shape, ok := value.(map[string]interface{}) 7210 if !ok { 7211 return fmt.Errorf("unexpected JSON type %v", value) 7212 } 7213 7214 var sv *types.FileAccessLog 7215 if *v == nil { 7216 sv = &types.FileAccessLog{} 7217 } else { 7218 sv = *v 7219 } 7220 7221 for key, value := range shape { 7222 switch key { 7223 case "path": 7224 if value != nil { 7225 jtv, ok := value.(string) 7226 if !ok { 7227 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 7228 } 7229 sv.Path = ptr.String(jtv) 7230 } 7231 7232 default: 7233 _, _ = key, value 7234 7235 } 7236 } 7237 *v = sv 7238 return nil 7239} 7240 7241func awsRestjson1_deserializeDocumentForbiddenException(v **types.ForbiddenException, value interface{}) error { 7242 if v == nil { 7243 return fmt.Errorf("unexpected nil of type %T", v) 7244 } 7245 if value == nil { 7246 return nil 7247 } 7248 7249 shape, ok := value.(map[string]interface{}) 7250 if !ok { 7251 return fmt.Errorf("unexpected JSON type %v", value) 7252 } 7253 7254 var sv *types.ForbiddenException 7255 if *v == nil { 7256 sv = &types.ForbiddenException{} 7257 } else { 7258 sv = *v 7259 } 7260 7261 for key, value := range shape { 7262 switch key { 7263 case "message": 7264 if value != nil { 7265 jtv, ok := value.(string) 7266 if !ok { 7267 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7268 } 7269 sv.Message = ptr.String(jtv) 7270 } 7271 7272 default: 7273 _, _ = key, value 7274 7275 } 7276 } 7277 *v = sv 7278 return nil 7279} 7280 7281func awsRestjson1_deserializeDocumentGatewayRouteData(v **types.GatewayRouteData, value interface{}) error { 7282 if v == nil { 7283 return fmt.Errorf("unexpected nil of type %T", v) 7284 } 7285 if value == nil { 7286 return nil 7287 } 7288 7289 shape, ok := value.(map[string]interface{}) 7290 if !ok { 7291 return fmt.Errorf("unexpected JSON type %v", value) 7292 } 7293 7294 var sv *types.GatewayRouteData 7295 if *v == nil { 7296 sv = &types.GatewayRouteData{} 7297 } else { 7298 sv = *v 7299 } 7300 7301 for key, value := range shape { 7302 switch key { 7303 case "gatewayRouteName": 7304 if value != nil { 7305 jtv, ok := value.(string) 7306 if !ok { 7307 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7308 } 7309 sv.GatewayRouteName = ptr.String(jtv) 7310 } 7311 7312 case "meshName": 7313 if value != nil { 7314 jtv, ok := value.(string) 7315 if !ok { 7316 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7317 } 7318 sv.MeshName = ptr.String(jtv) 7319 } 7320 7321 case "metadata": 7322 if err := awsRestjson1_deserializeDocumentResourceMetadata(&sv.Metadata, value); err != nil { 7323 return err 7324 } 7325 7326 case "spec": 7327 if err := awsRestjson1_deserializeDocumentGatewayRouteSpec(&sv.Spec, value); err != nil { 7328 return err 7329 } 7330 7331 case "status": 7332 if err := awsRestjson1_deserializeDocumentGatewayRouteStatus(&sv.Status, value); err != nil { 7333 return err 7334 } 7335 7336 case "virtualGatewayName": 7337 if value != nil { 7338 jtv, ok := value.(string) 7339 if !ok { 7340 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7341 } 7342 sv.VirtualGatewayName = ptr.String(jtv) 7343 } 7344 7345 default: 7346 _, _ = key, value 7347 7348 } 7349 } 7350 *v = sv 7351 return nil 7352} 7353 7354func awsRestjson1_deserializeDocumentGatewayRouteList(v *[]types.GatewayRouteRef, value interface{}) error { 7355 if v == nil { 7356 return fmt.Errorf("unexpected nil of type %T", v) 7357 } 7358 if value == nil { 7359 return nil 7360 } 7361 7362 shape, ok := value.([]interface{}) 7363 if !ok { 7364 return fmt.Errorf("unexpected JSON type %v", value) 7365 } 7366 7367 var cv []types.GatewayRouteRef 7368 if *v == nil { 7369 cv = []types.GatewayRouteRef{} 7370 } else { 7371 cv = *v 7372 } 7373 7374 for _, value := range shape { 7375 var col types.GatewayRouteRef 7376 destAddr := &col 7377 if err := awsRestjson1_deserializeDocumentGatewayRouteRef(&destAddr, value); err != nil { 7378 return err 7379 } 7380 col = *destAddr 7381 cv = append(cv, col) 7382 7383 } 7384 *v = cv 7385 return nil 7386} 7387 7388func awsRestjson1_deserializeDocumentGatewayRouteRef(v **types.GatewayRouteRef, value interface{}) error { 7389 if v == nil { 7390 return fmt.Errorf("unexpected nil of type %T", v) 7391 } 7392 if value == nil { 7393 return nil 7394 } 7395 7396 shape, ok := value.(map[string]interface{}) 7397 if !ok { 7398 return fmt.Errorf("unexpected JSON type %v", value) 7399 } 7400 7401 var sv *types.GatewayRouteRef 7402 if *v == nil { 7403 sv = &types.GatewayRouteRef{} 7404 } else { 7405 sv = *v 7406 } 7407 7408 for key, value := range shape { 7409 switch key { 7410 case "arn": 7411 if value != nil { 7412 jtv, ok := value.(string) 7413 if !ok { 7414 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 7415 } 7416 sv.Arn = ptr.String(jtv) 7417 } 7418 7419 case "createdAt": 7420 if value != nil { 7421 jtv, ok := value.(json.Number) 7422 if !ok { 7423 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7424 } 7425 f64, err := jtv.Float64() 7426 if err != nil { 7427 return err 7428 } 7429 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7430 } 7431 7432 case "gatewayRouteName": 7433 if value != nil { 7434 jtv, ok := value.(string) 7435 if !ok { 7436 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7437 } 7438 sv.GatewayRouteName = ptr.String(jtv) 7439 } 7440 7441 case "lastUpdatedAt": 7442 if value != nil { 7443 jtv, ok := value.(json.Number) 7444 if !ok { 7445 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7446 } 7447 f64, err := jtv.Float64() 7448 if err != nil { 7449 return err 7450 } 7451 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7452 } 7453 7454 case "meshName": 7455 if value != nil { 7456 jtv, ok := value.(string) 7457 if !ok { 7458 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7459 } 7460 sv.MeshName = ptr.String(jtv) 7461 } 7462 7463 case "meshOwner": 7464 if value != nil { 7465 jtv, ok := value.(string) 7466 if !ok { 7467 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 7468 } 7469 sv.MeshOwner = ptr.String(jtv) 7470 } 7471 7472 case "resourceOwner": 7473 if value != nil { 7474 jtv, ok := value.(string) 7475 if !ok { 7476 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 7477 } 7478 sv.ResourceOwner = ptr.String(jtv) 7479 } 7480 7481 case "version": 7482 if value != nil { 7483 jtv, ok := value.(json.Number) 7484 if !ok { 7485 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 7486 } 7487 i64, err := jtv.Int64() 7488 if err != nil { 7489 return err 7490 } 7491 sv.Version = ptr.Int64(i64) 7492 } 7493 7494 case "virtualGatewayName": 7495 if value != nil { 7496 jtv, ok := value.(string) 7497 if !ok { 7498 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7499 } 7500 sv.VirtualGatewayName = ptr.String(jtv) 7501 } 7502 7503 default: 7504 _, _ = key, value 7505 7506 } 7507 } 7508 *v = sv 7509 return nil 7510} 7511 7512func awsRestjson1_deserializeDocumentGatewayRouteSpec(v **types.GatewayRouteSpec, value interface{}) error { 7513 if v == nil { 7514 return fmt.Errorf("unexpected nil of type %T", v) 7515 } 7516 if value == nil { 7517 return nil 7518 } 7519 7520 shape, ok := value.(map[string]interface{}) 7521 if !ok { 7522 return fmt.Errorf("unexpected JSON type %v", value) 7523 } 7524 7525 var sv *types.GatewayRouteSpec 7526 if *v == nil { 7527 sv = &types.GatewayRouteSpec{} 7528 } else { 7529 sv = *v 7530 } 7531 7532 for key, value := range shape { 7533 switch key { 7534 case "grpcRoute": 7535 if err := awsRestjson1_deserializeDocumentGrpcGatewayRoute(&sv.GrpcRoute, value); err != nil { 7536 return err 7537 } 7538 7539 case "http2Route": 7540 if err := awsRestjson1_deserializeDocumentHttpGatewayRoute(&sv.Http2Route, value); err != nil { 7541 return err 7542 } 7543 7544 case "httpRoute": 7545 if err := awsRestjson1_deserializeDocumentHttpGatewayRoute(&sv.HttpRoute, value); err != nil { 7546 return err 7547 } 7548 7549 default: 7550 _, _ = key, value 7551 7552 } 7553 } 7554 *v = sv 7555 return nil 7556} 7557 7558func awsRestjson1_deserializeDocumentGatewayRouteStatus(v **types.GatewayRouteStatus, value interface{}) error { 7559 if v == nil { 7560 return fmt.Errorf("unexpected nil of type %T", v) 7561 } 7562 if value == nil { 7563 return nil 7564 } 7565 7566 shape, ok := value.(map[string]interface{}) 7567 if !ok { 7568 return fmt.Errorf("unexpected JSON type %v", value) 7569 } 7570 7571 var sv *types.GatewayRouteStatus 7572 if *v == nil { 7573 sv = &types.GatewayRouteStatus{} 7574 } else { 7575 sv = *v 7576 } 7577 7578 for key, value := range shape { 7579 switch key { 7580 case "status": 7581 if value != nil { 7582 jtv, ok := value.(string) 7583 if !ok { 7584 return fmt.Errorf("expected GatewayRouteStatusCode to be of type string, got %T instead", value) 7585 } 7586 sv.Status = types.GatewayRouteStatusCode(jtv) 7587 } 7588 7589 default: 7590 _, _ = key, value 7591 7592 } 7593 } 7594 *v = sv 7595 return nil 7596} 7597 7598func awsRestjson1_deserializeDocumentGatewayRouteTarget(v **types.GatewayRouteTarget, value interface{}) error { 7599 if v == nil { 7600 return fmt.Errorf("unexpected nil of type %T", v) 7601 } 7602 if value == nil { 7603 return nil 7604 } 7605 7606 shape, ok := value.(map[string]interface{}) 7607 if !ok { 7608 return fmt.Errorf("unexpected JSON type %v", value) 7609 } 7610 7611 var sv *types.GatewayRouteTarget 7612 if *v == nil { 7613 sv = &types.GatewayRouteTarget{} 7614 } else { 7615 sv = *v 7616 } 7617 7618 for key, value := range shape { 7619 switch key { 7620 case "virtualService": 7621 if err := awsRestjson1_deserializeDocumentGatewayRouteVirtualService(&sv.VirtualService, value); err != nil { 7622 return err 7623 } 7624 7625 default: 7626 _, _ = key, value 7627 7628 } 7629 } 7630 *v = sv 7631 return nil 7632} 7633 7634func awsRestjson1_deserializeDocumentGatewayRouteVirtualService(v **types.GatewayRouteVirtualService, value interface{}) error { 7635 if v == nil { 7636 return fmt.Errorf("unexpected nil of type %T", v) 7637 } 7638 if value == nil { 7639 return nil 7640 } 7641 7642 shape, ok := value.(map[string]interface{}) 7643 if !ok { 7644 return fmt.Errorf("unexpected JSON type %v", value) 7645 } 7646 7647 var sv *types.GatewayRouteVirtualService 7648 if *v == nil { 7649 sv = &types.GatewayRouteVirtualService{} 7650 } else { 7651 sv = *v 7652 } 7653 7654 for key, value := range shape { 7655 switch key { 7656 case "virtualServiceName": 7657 if value != nil { 7658 jtv, ok := value.(string) 7659 if !ok { 7660 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7661 } 7662 sv.VirtualServiceName = ptr.String(jtv) 7663 } 7664 7665 default: 7666 _, _ = key, value 7667 7668 } 7669 } 7670 *v = sv 7671 return nil 7672} 7673 7674func awsRestjson1_deserializeDocumentGrpcGatewayRoute(v **types.GrpcGatewayRoute, value interface{}) error { 7675 if v == nil { 7676 return fmt.Errorf("unexpected nil of type %T", v) 7677 } 7678 if value == nil { 7679 return nil 7680 } 7681 7682 shape, ok := value.(map[string]interface{}) 7683 if !ok { 7684 return fmt.Errorf("unexpected JSON type %v", value) 7685 } 7686 7687 var sv *types.GrpcGatewayRoute 7688 if *v == nil { 7689 sv = &types.GrpcGatewayRoute{} 7690 } else { 7691 sv = *v 7692 } 7693 7694 for key, value := range shape { 7695 switch key { 7696 case "action": 7697 if err := awsRestjson1_deserializeDocumentGrpcGatewayRouteAction(&sv.Action, value); err != nil { 7698 return err 7699 } 7700 7701 case "match": 7702 if err := awsRestjson1_deserializeDocumentGrpcGatewayRouteMatch(&sv.Match, value); err != nil { 7703 return err 7704 } 7705 7706 default: 7707 _, _ = key, value 7708 7709 } 7710 } 7711 *v = sv 7712 return nil 7713} 7714 7715func awsRestjson1_deserializeDocumentGrpcGatewayRouteAction(v **types.GrpcGatewayRouteAction, value interface{}) error { 7716 if v == nil { 7717 return fmt.Errorf("unexpected nil of type %T", v) 7718 } 7719 if value == nil { 7720 return nil 7721 } 7722 7723 shape, ok := value.(map[string]interface{}) 7724 if !ok { 7725 return fmt.Errorf("unexpected JSON type %v", value) 7726 } 7727 7728 var sv *types.GrpcGatewayRouteAction 7729 if *v == nil { 7730 sv = &types.GrpcGatewayRouteAction{} 7731 } else { 7732 sv = *v 7733 } 7734 7735 for key, value := range shape { 7736 switch key { 7737 case "target": 7738 if err := awsRestjson1_deserializeDocumentGatewayRouteTarget(&sv.Target, value); err != nil { 7739 return err 7740 } 7741 7742 default: 7743 _, _ = key, value 7744 7745 } 7746 } 7747 *v = sv 7748 return nil 7749} 7750 7751func awsRestjson1_deserializeDocumentGrpcGatewayRouteMatch(v **types.GrpcGatewayRouteMatch, value interface{}) error { 7752 if v == nil { 7753 return fmt.Errorf("unexpected nil of type %T", v) 7754 } 7755 if value == nil { 7756 return nil 7757 } 7758 7759 shape, ok := value.(map[string]interface{}) 7760 if !ok { 7761 return fmt.Errorf("unexpected JSON type %v", value) 7762 } 7763 7764 var sv *types.GrpcGatewayRouteMatch 7765 if *v == nil { 7766 sv = &types.GrpcGatewayRouteMatch{} 7767 } else { 7768 sv = *v 7769 } 7770 7771 for key, value := range shape { 7772 switch key { 7773 case "serviceName": 7774 if value != nil { 7775 jtv, ok := value.(string) 7776 if !ok { 7777 return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) 7778 } 7779 sv.ServiceName = ptr.String(jtv) 7780 } 7781 7782 default: 7783 _, _ = key, value 7784 7785 } 7786 } 7787 *v = sv 7788 return nil 7789} 7790 7791func awsRestjson1_deserializeDocumentGrpcRetryPolicy(v **types.GrpcRetryPolicy, value interface{}) error { 7792 if v == nil { 7793 return fmt.Errorf("unexpected nil of type %T", v) 7794 } 7795 if value == nil { 7796 return nil 7797 } 7798 7799 shape, ok := value.(map[string]interface{}) 7800 if !ok { 7801 return fmt.Errorf("unexpected JSON type %v", value) 7802 } 7803 7804 var sv *types.GrpcRetryPolicy 7805 if *v == nil { 7806 sv = &types.GrpcRetryPolicy{} 7807 } else { 7808 sv = *v 7809 } 7810 7811 for key, value := range shape { 7812 switch key { 7813 case "grpcRetryEvents": 7814 if err := awsRestjson1_deserializeDocumentGrpcRetryPolicyEvents(&sv.GrpcRetryEvents, value); err != nil { 7815 return err 7816 } 7817 7818 case "httpRetryEvents": 7819 if err := awsRestjson1_deserializeDocumentHttpRetryPolicyEvents(&sv.HttpRetryEvents, value); err != nil { 7820 return err 7821 } 7822 7823 case "maxRetries": 7824 if value != nil { 7825 jtv, ok := value.(json.Number) 7826 if !ok { 7827 return fmt.Errorf("expected MaxRetries to be json.Number, got %T instead", value) 7828 } 7829 i64, err := jtv.Int64() 7830 if err != nil { 7831 return err 7832 } 7833 sv.MaxRetries = ptr.Int64(i64) 7834 } 7835 7836 case "perRetryTimeout": 7837 if err := awsRestjson1_deserializeDocumentDuration(&sv.PerRetryTimeout, value); err != nil { 7838 return err 7839 } 7840 7841 case "tcpRetryEvents": 7842 if err := awsRestjson1_deserializeDocumentTcpRetryPolicyEvents(&sv.TcpRetryEvents, value); err != nil { 7843 return err 7844 } 7845 7846 default: 7847 _, _ = key, value 7848 7849 } 7850 } 7851 *v = sv 7852 return nil 7853} 7854 7855func awsRestjson1_deserializeDocumentGrpcRetryPolicyEvents(v *[]types.GrpcRetryPolicyEvent, value interface{}) error { 7856 if v == nil { 7857 return fmt.Errorf("unexpected nil of type %T", v) 7858 } 7859 if value == nil { 7860 return nil 7861 } 7862 7863 shape, ok := value.([]interface{}) 7864 if !ok { 7865 return fmt.Errorf("unexpected JSON type %v", value) 7866 } 7867 7868 var cv []types.GrpcRetryPolicyEvent 7869 if *v == nil { 7870 cv = []types.GrpcRetryPolicyEvent{} 7871 } else { 7872 cv = *v 7873 } 7874 7875 for _, value := range shape { 7876 var col types.GrpcRetryPolicyEvent 7877 if value != nil { 7878 jtv, ok := value.(string) 7879 if !ok { 7880 return fmt.Errorf("expected GrpcRetryPolicyEvent to be of type string, got %T instead", value) 7881 } 7882 col = types.GrpcRetryPolicyEvent(jtv) 7883 } 7884 cv = append(cv, col) 7885 7886 } 7887 *v = cv 7888 return nil 7889} 7890 7891func awsRestjson1_deserializeDocumentGrpcRoute(v **types.GrpcRoute, value interface{}) error { 7892 if v == nil { 7893 return fmt.Errorf("unexpected nil of type %T", v) 7894 } 7895 if value == nil { 7896 return nil 7897 } 7898 7899 shape, ok := value.(map[string]interface{}) 7900 if !ok { 7901 return fmt.Errorf("unexpected JSON type %v", value) 7902 } 7903 7904 var sv *types.GrpcRoute 7905 if *v == nil { 7906 sv = &types.GrpcRoute{} 7907 } else { 7908 sv = *v 7909 } 7910 7911 for key, value := range shape { 7912 switch key { 7913 case "action": 7914 if err := awsRestjson1_deserializeDocumentGrpcRouteAction(&sv.Action, value); err != nil { 7915 return err 7916 } 7917 7918 case "match": 7919 if err := awsRestjson1_deserializeDocumentGrpcRouteMatch(&sv.Match, value); err != nil { 7920 return err 7921 } 7922 7923 case "retryPolicy": 7924 if err := awsRestjson1_deserializeDocumentGrpcRetryPolicy(&sv.RetryPolicy, value); err != nil { 7925 return err 7926 } 7927 7928 case "timeout": 7929 if err := awsRestjson1_deserializeDocumentGrpcTimeout(&sv.Timeout, value); err != nil { 7930 return err 7931 } 7932 7933 default: 7934 _, _ = key, value 7935 7936 } 7937 } 7938 *v = sv 7939 return nil 7940} 7941 7942func awsRestjson1_deserializeDocumentGrpcRouteAction(v **types.GrpcRouteAction, value interface{}) error { 7943 if v == nil { 7944 return fmt.Errorf("unexpected nil of type %T", v) 7945 } 7946 if value == nil { 7947 return nil 7948 } 7949 7950 shape, ok := value.(map[string]interface{}) 7951 if !ok { 7952 return fmt.Errorf("unexpected JSON type %v", value) 7953 } 7954 7955 var sv *types.GrpcRouteAction 7956 if *v == nil { 7957 sv = &types.GrpcRouteAction{} 7958 } else { 7959 sv = *v 7960 } 7961 7962 for key, value := range shape { 7963 switch key { 7964 case "weightedTargets": 7965 if err := awsRestjson1_deserializeDocumentWeightedTargets(&sv.WeightedTargets, value); err != nil { 7966 return err 7967 } 7968 7969 default: 7970 _, _ = key, value 7971 7972 } 7973 } 7974 *v = sv 7975 return nil 7976} 7977 7978func awsRestjson1_deserializeDocumentGrpcRouteMatch(v **types.GrpcRouteMatch, value interface{}) error { 7979 if v == nil { 7980 return fmt.Errorf("unexpected nil of type %T", v) 7981 } 7982 if value == nil { 7983 return nil 7984 } 7985 7986 shape, ok := value.(map[string]interface{}) 7987 if !ok { 7988 return fmt.Errorf("unexpected JSON type %v", value) 7989 } 7990 7991 var sv *types.GrpcRouteMatch 7992 if *v == nil { 7993 sv = &types.GrpcRouteMatch{} 7994 } else { 7995 sv = *v 7996 } 7997 7998 for key, value := range shape { 7999 switch key { 8000 case "metadata": 8001 if err := awsRestjson1_deserializeDocumentGrpcRouteMetadataList(&sv.Metadata, value); err != nil { 8002 return err 8003 } 8004 8005 case "methodName": 8006 if value != nil { 8007 jtv, ok := value.(string) 8008 if !ok { 8009 return fmt.Errorf("expected MethodName to be of type string, got %T instead", value) 8010 } 8011 sv.MethodName = ptr.String(jtv) 8012 } 8013 8014 case "serviceName": 8015 if value != nil { 8016 jtv, ok := value.(string) 8017 if !ok { 8018 return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) 8019 } 8020 sv.ServiceName = ptr.String(jtv) 8021 } 8022 8023 default: 8024 _, _ = key, value 8025 8026 } 8027 } 8028 *v = sv 8029 return nil 8030} 8031 8032func awsRestjson1_deserializeDocumentGrpcRouteMetadata(v **types.GrpcRouteMetadata, value interface{}) error { 8033 if v == nil { 8034 return fmt.Errorf("unexpected nil of type %T", v) 8035 } 8036 if value == nil { 8037 return nil 8038 } 8039 8040 shape, ok := value.(map[string]interface{}) 8041 if !ok { 8042 return fmt.Errorf("unexpected JSON type %v", value) 8043 } 8044 8045 var sv *types.GrpcRouteMetadata 8046 if *v == nil { 8047 sv = &types.GrpcRouteMetadata{} 8048 } else { 8049 sv = *v 8050 } 8051 8052 for key, value := range shape { 8053 switch key { 8054 case "invert": 8055 if value != nil { 8056 jtv, ok := value.(bool) 8057 if !ok { 8058 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 8059 } 8060 sv.Invert = ptr.Bool(jtv) 8061 } 8062 8063 case "match": 8064 if err := awsRestjson1_deserializeDocumentGrpcRouteMetadataMatchMethod(&sv.Match, value); err != nil { 8065 return err 8066 } 8067 8068 case "name": 8069 if value != nil { 8070 jtv, ok := value.(string) 8071 if !ok { 8072 return fmt.Errorf("expected HeaderName to be of type string, got %T instead", value) 8073 } 8074 sv.Name = ptr.String(jtv) 8075 } 8076 8077 default: 8078 _, _ = key, value 8079 8080 } 8081 } 8082 *v = sv 8083 return nil 8084} 8085 8086func awsRestjson1_deserializeDocumentGrpcRouteMetadataList(v *[]types.GrpcRouteMetadata, value interface{}) error { 8087 if v == nil { 8088 return fmt.Errorf("unexpected nil of type %T", v) 8089 } 8090 if value == nil { 8091 return nil 8092 } 8093 8094 shape, ok := value.([]interface{}) 8095 if !ok { 8096 return fmt.Errorf("unexpected JSON type %v", value) 8097 } 8098 8099 var cv []types.GrpcRouteMetadata 8100 if *v == nil { 8101 cv = []types.GrpcRouteMetadata{} 8102 } else { 8103 cv = *v 8104 } 8105 8106 for _, value := range shape { 8107 var col types.GrpcRouteMetadata 8108 destAddr := &col 8109 if err := awsRestjson1_deserializeDocumentGrpcRouteMetadata(&destAddr, value); err != nil { 8110 return err 8111 } 8112 col = *destAddr 8113 cv = append(cv, col) 8114 8115 } 8116 *v = cv 8117 return nil 8118} 8119 8120func awsRestjson1_deserializeDocumentGrpcRouteMetadataMatchMethod(v *types.GrpcRouteMetadataMatchMethod, value interface{}) error { 8121 if v == nil { 8122 return fmt.Errorf("unexpected nil of type %T", v) 8123 } 8124 if value == nil { 8125 return nil 8126 } 8127 8128 shape, ok := value.(map[string]interface{}) 8129 if !ok { 8130 return fmt.Errorf("unexpected JSON type %v", value) 8131 } 8132 8133 var uv types.GrpcRouteMetadataMatchMethod 8134loop: 8135 for key, value := range shape { 8136 switch key { 8137 case "exact": 8138 var mv string 8139 if value != nil { 8140 jtv, ok := value.(string) 8141 if !ok { 8142 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8143 } 8144 mv = jtv 8145 } 8146 uv = &types.GrpcRouteMetadataMatchMethodMemberExact{Value: mv} 8147 break loop 8148 8149 case "prefix": 8150 var mv string 8151 if value != nil { 8152 jtv, ok := value.(string) 8153 if !ok { 8154 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8155 } 8156 mv = jtv 8157 } 8158 uv = &types.GrpcRouteMetadataMatchMethodMemberPrefix{Value: mv} 8159 break loop 8160 8161 case "range": 8162 var mv types.MatchRange 8163 destAddr := &mv 8164 if err := awsRestjson1_deserializeDocumentMatchRange(&destAddr, value); err != nil { 8165 return err 8166 } 8167 mv = *destAddr 8168 uv = &types.GrpcRouteMetadataMatchMethodMemberRange{Value: mv} 8169 break loop 8170 8171 case "regex": 8172 var mv string 8173 if value != nil { 8174 jtv, ok := value.(string) 8175 if !ok { 8176 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8177 } 8178 mv = jtv 8179 } 8180 uv = &types.GrpcRouteMetadataMatchMethodMemberRegex{Value: mv} 8181 break loop 8182 8183 case "suffix": 8184 var mv string 8185 if value != nil { 8186 jtv, ok := value.(string) 8187 if !ok { 8188 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8189 } 8190 mv = jtv 8191 } 8192 uv = &types.GrpcRouteMetadataMatchMethodMemberSuffix{Value: mv} 8193 break loop 8194 8195 default: 8196 uv = &types.UnknownUnionMember{Tag: key} 8197 break loop 8198 8199 } 8200 } 8201 *v = uv 8202 return nil 8203} 8204 8205func awsRestjson1_deserializeDocumentGrpcTimeout(v **types.GrpcTimeout, value interface{}) error { 8206 if v == nil { 8207 return fmt.Errorf("unexpected nil of type %T", v) 8208 } 8209 if value == nil { 8210 return nil 8211 } 8212 8213 shape, ok := value.(map[string]interface{}) 8214 if !ok { 8215 return fmt.Errorf("unexpected JSON type %v", value) 8216 } 8217 8218 var sv *types.GrpcTimeout 8219 if *v == nil { 8220 sv = &types.GrpcTimeout{} 8221 } else { 8222 sv = *v 8223 } 8224 8225 for key, value := range shape { 8226 switch key { 8227 case "idle": 8228 if err := awsRestjson1_deserializeDocumentDuration(&sv.Idle, value); err != nil { 8229 return err 8230 } 8231 8232 case "perRequest": 8233 if err := awsRestjson1_deserializeDocumentDuration(&sv.PerRequest, value); err != nil { 8234 return err 8235 } 8236 8237 default: 8238 _, _ = key, value 8239 8240 } 8241 } 8242 *v = sv 8243 return nil 8244} 8245 8246func awsRestjson1_deserializeDocumentHeaderMatchMethod(v *types.HeaderMatchMethod, value interface{}) error { 8247 if v == nil { 8248 return fmt.Errorf("unexpected nil of type %T", v) 8249 } 8250 if value == nil { 8251 return nil 8252 } 8253 8254 shape, ok := value.(map[string]interface{}) 8255 if !ok { 8256 return fmt.Errorf("unexpected JSON type %v", value) 8257 } 8258 8259 var uv types.HeaderMatchMethod 8260loop: 8261 for key, value := range shape { 8262 switch key { 8263 case "exact": 8264 var mv string 8265 if value != nil { 8266 jtv, ok := value.(string) 8267 if !ok { 8268 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8269 } 8270 mv = jtv 8271 } 8272 uv = &types.HeaderMatchMethodMemberExact{Value: mv} 8273 break loop 8274 8275 case "prefix": 8276 var mv string 8277 if value != nil { 8278 jtv, ok := value.(string) 8279 if !ok { 8280 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8281 } 8282 mv = jtv 8283 } 8284 uv = &types.HeaderMatchMethodMemberPrefix{Value: mv} 8285 break loop 8286 8287 case "range": 8288 var mv types.MatchRange 8289 destAddr := &mv 8290 if err := awsRestjson1_deserializeDocumentMatchRange(&destAddr, value); err != nil { 8291 return err 8292 } 8293 mv = *destAddr 8294 uv = &types.HeaderMatchMethodMemberRange{Value: mv} 8295 break loop 8296 8297 case "regex": 8298 var mv string 8299 if value != nil { 8300 jtv, ok := value.(string) 8301 if !ok { 8302 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8303 } 8304 mv = jtv 8305 } 8306 uv = &types.HeaderMatchMethodMemberRegex{Value: mv} 8307 break loop 8308 8309 case "suffix": 8310 var mv string 8311 if value != nil { 8312 jtv, ok := value.(string) 8313 if !ok { 8314 return fmt.Errorf("expected HeaderMatch to be of type string, got %T instead", value) 8315 } 8316 mv = jtv 8317 } 8318 uv = &types.HeaderMatchMethodMemberSuffix{Value: mv} 8319 break loop 8320 8321 default: 8322 uv = &types.UnknownUnionMember{Tag: key} 8323 break loop 8324 8325 } 8326 } 8327 *v = uv 8328 return nil 8329} 8330 8331func awsRestjson1_deserializeDocumentHealthCheckPolicy(v **types.HealthCheckPolicy, value interface{}) error { 8332 if v == nil { 8333 return fmt.Errorf("unexpected nil of type %T", v) 8334 } 8335 if value == nil { 8336 return nil 8337 } 8338 8339 shape, ok := value.(map[string]interface{}) 8340 if !ok { 8341 return fmt.Errorf("unexpected JSON type %v", value) 8342 } 8343 8344 var sv *types.HealthCheckPolicy 8345 if *v == nil { 8346 sv = &types.HealthCheckPolicy{} 8347 } else { 8348 sv = *v 8349 } 8350 8351 for key, value := range shape { 8352 switch key { 8353 case "healthyThreshold": 8354 if value != nil { 8355 jtv, ok := value.(json.Number) 8356 if !ok { 8357 return fmt.Errorf("expected HealthCheckThreshold to be json.Number, got %T instead", value) 8358 } 8359 i64, err := jtv.Int64() 8360 if err != nil { 8361 return err 8362 } 8363 sv.HealthyThreshold = int32(i64) 8364 } 8365 8366 case "intervalMillis": 8367 if value != nil { 8368 jtv, ok := value.(json.Number) 8369 if !ok { 8370 return fmt.Errorf("expected HealthCheckIntervalMillis to be json.Number, got %T instead", value) 8371 } 8372 i64, err := jtv.Int64() 8373 if err != nil { 8374 return err 8375 } 8376 sv.IntervalMillis = ptr.Int64(i64) 8377 } 8378 8379 case "path": 8380 if value != nil { 8381 jtv, ok := value.(string) 8382 if !ok { 8383 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8384 } 8385 sv.Path = ptr.String(jtv) 8386 } 8387 8388 case "port": 8389 if value != nil { 8390 jtv, ok := value.(json.Number) 8391 if !ok { 8392 return fmt.Errorf("expected PortNumber to be json.Number, got %T instead", value) 8393 } 8394 i64, err := jtv.Int64() 8395 if err != nil { 8396 return err 8397 } 8398 sv.Port = int32(i64) 8399 } 8400 8401 case "protocol": 8402 if value != nil { 8403 jtv, ok := value.(string) 8404 if !ok { 8405 return fmt.Errorf("expected PortProtocol to be of type string, got %T instead", value) 8406 } 8407 sv.Protocol = types.PortProtocol(jtv) 8408 } 8409 8410 case "timeoutMillis": 8411 if value != nil { 8412 jtv, ok := value.(json.Number) 8413 if !ok { 8414 return fmt.Errorf("expected HealthCheckTimeoutMillis to be json.Number, got %T instead", value) 8415 } 8416 i64, err := jtv.Int64() 8417 if err != nil { 8418 return err 8419 } 8420 sv.TimeoutMillis = ptr.Int64(i64) 8421 } 8422 8423 case "unhealthyThreshold": 8424 if value != nil { 8425 jtv, ok := value.(json.Number) 8426 if !ok { 8427 return fmt.Errorf("expected HealthCheckThreshold to be json.Number, got %T instead", value) 8428 } 8429 i64, err := jtv.Int64() 8430 if err != nil { 8431 return err 8432 } 8433 sv.UnhealthyThreshold = int32(i64) 8434 } 8435 8436 default: 8437 _, _ = key, value 8438 8439 } 8440 } 8441 *v = sv 8442 return nil 8443} 8444 8445func awsRestjson1_deserializeDocumentHttpGatewayRoute(v **types.HttpGatewayRoute, value interface{}) error { 8446 if v == nil { 8447 return fmt.Errorf("unexpected nil of type %T", v) 8448 } 8449 if value == nil { 8450 return nil 8451 } 8452 8453 shape, ok := value.(map[string]interface{}) 8454 if !ok { 8455 return fmt.Errorf("unexpected JSON type %v", value) 8456 } 8457 8458 var sv *types.HttpGatewayRoute 8459 if *v == nil { 8460 sv = &types.HttpGatewayRoute{} 8461 } else { 8462 sv = *v 8463 } 8464 8465 for key, value := range shape { 8466 switch key { 8467 case "action": 8468 if err := awsRestjson1_deserializeDocumentHttpGatewayRouteAction(&sv.Action, value); err != nil { 8469 return err 8470 } 8471 8472 case "match": 8473 if err := awsRestjson1_deserializeDocumentHttpGatewayRouteMatch(&sv.Match, value); err != nil { 8474 return err 8475 } 8476 8477 default: 8478 _, _ = key, value 8479 8480 } 8481 } 8482 *v = sv 8483 return nil 8484} 8485 8486func awsRestjson1_deserializeDocumentHttpGatewayRouteAction(v **types.HttpGatewayRouteAction, value interface{}) error { 8487 if v == nil { 8488 return fmt.Errorf("unexpected nil of type %T", v) 8489 } 8490 if value == nil { 8491 return nil 8492 } 8493 8494 shape, ok := value.(map[string]interface{}) 8495 if !ok { 8496 return fmt.Errorf("unexpected JSON type %v", value) 8497 } 8498 8499 var sv *types.HttpGatewayRouteAction 8500 if *v == nil { 8501 sv = &types.HttpGatewayRouteAction{} 8502 } else { 8503 sv = *v 8504 } 8505 8506 for key, value := range shape { 8507 switch key { 8508 case "target": 8509 if err := awsRestjson1_deserializeDocumentGatewayRouteTarget(&sv.Target, value); err != nil { 8510 return err 8511 } 8512 8513 default: 8514 _, _ = key, value 8515 8516 } 8517 } 8518 *v = sv 8519 return nil 8520} 8521 8522func awsRestjson1_deserializeDocumentHttpGatewayRouteMatch(v **types.HttpGatewayRouteMatch, value interface{}) error { 8523 if v == nil { 8524 return fmt.Errorf("unexpected nil of type %T", v) 8525 } 8526 if value == nil { 8527 return nil 8528 } 8529 8530 shape, ok := value.(map[string]interface{}) 8531 if !ok { 8532 return fmt.Errorf("unexpected JSON type %v", value) 8533 } 8534 8535 var sv *types.HttpGatewayRouteMatch 8536 if *v == nil { 8537 sv = &types.HttpGatewayRouteMatch{} 8538 } else { 8539 sv = *v 8540 } 8541 8542 for key, value := range shape { 8543 switch key { 8544 case "prefix": 8545 if value != nil { 8546 jtv, ok := value.(string) 8547 if !ok { 8548 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8549 } 8550 sv.Prefix = ptr.String(jtv) 8551 } 8552 8553 default: 8554 _, _ = key, value 8555 8556 } 8557 } 8558 *v = sv 8559 return nil 8560} 8561 8562func awsRestjson1_deserializeDocumentHttpRetryPolicy(v **types.HttpRetryPolicy, value interface{}) error { 8563 if v == nil { 8564 return fmt.Errorf("unexpected nil of type %T", v) 8565 } 8566 if value == nil { 8567 return nil 8568 } 8569 8570 shape, ok := value.(map[string]interface{}) 8571 if !ok { 8572 return fmt.Errorf("unexpected JSON type %v", value) 8573 } 8574 8575 var sv *types.HttpRetryPolicy 8576 if *v == nil { 8577 sv = &types.HttpRetryPolicy{} 8578 } else { 8579 sv = *v 8580 } 8581 8582 for key, value := range shape { 8583 switch key { 8584 case "httpRetryEvents": 8585 if err := awsRestjson1_deserializeDocumentHttpRetryPolicyEvents(&sv.HttpRetryEvents, value); err != nil { 8586 return err 8587 } 8588 8589 case "maxRetries": 8590 if value != nil { 8591 jtv, ok := value.(json.Number) 8592 if !ok { 8593 return fmt.Errorf("expected MaxRetries to be json.Number, got %T instead", value) 8594 } 8595 i64, err := jtv.Int64() 8596 if err != nil { 8597 return err 8598 } 8599 sv.MaxRetries = ptr.Int64(i64) 8600 } 8601 8602 case "perRetryTimeout": 8603 if err := awsRestjson1_deserializeDocumentDuration(&sv.PerRetryTimeout, value); err != nil { 8604 return err 8605 } 8606 8607 case "tcpRetryEvents": 8608 if err := awsRestjson1_deserializeDocumentTcpRetryPolicyEvents(&sv.TcpRetryEvents, value); err != nil { 8609 return err 8610 } 8611 8612 default: 8613 _, _ = key, value 8614 8615 } 8616 } 8617 *v = sv 8618 return nil 8619} 8620 8621func awsRestjson1_deserializeDocumentHttpRetryPolicyEvents(v *[]string, value interface{}) error { 8622 if v == nil { 8623 return fmt.Errorf("unexpected nil of type %T", v) 8624 } 8625 if value == nil { 8626 return nil 8627 } 8628 8629 shape, ok := value.([]interface{}) 8630 if !ok { 8631 return fmt.Errorf("unexpected JSON type %v", value) 8632 } 8633 8634 var cv []string 8635 if *v == nil { 8636 cv = []string{} 8637 } else { 8638 cv = *v 8639 } 8640 8641 for _, value := range shape { 8642 var col string 8643 if value != nil { 8644 jtv, ok := value.(string) 8645 if !ok { 8646 return fmt.Errorf("expected HttpRetryPolicyEvent to be of type string, got %T instead", value) 8647 } 8648 col = jtv 8649 } 8650 cv = append(cv, col) 8651 8652 } 8653 *v = cv 8654 return nil 8655} 8656 8657func awsRestjson1_deserializeDocumentHttpRoute(v **types.HttpRoute, value interface{}) error { 8658 if v == nil { 8659 return fmt.Errorf("unexpected nil of type %T", v) 8660 } 8661 if value == nil { 8662 return nil 8663 } 8664 8665 shape, ok := value.(map[string]interface{}) 8666 if !ok { 8667 return fmt.Errorf("unexpected JSON type %v", value) 8668 } 8669 8670 var sv *types.HttpRoute 8671 if *v == nil { 8672 sv = &types.HttpRoute{} 8673 } else { 8674 sv = *v 8675 } 8676 8677 for key, value := range shape { 8678 switch key { 8679 case "action": 8680 if err := awsRestjson1_deserializeDocumentHttpRouteAction(&sv.Action, value); err != nil { 8681 return err 8682 } 8683 8684 case "match": 8685 if err := awsRestjson1_deserializeDocumentHttpRouteMatch(&sv.Match, value); err != nil { 8686 return err 8687 } 8688 8689 case "retryPolicy": 8690 if err := awsRestjson1_deserializeDocumentHttpRetryPolicy(&sv.RetryPolicy, value); err != nil { 8691 return err 8692 } 8693 8694 case "timeout": 8695 if err := awsRestjson1_deserializeDocumentHttpTimeout(&sv.Timeout, value); err != nil { 8696 return err 8697 } 8698 8699 default: 8700 _, _ = key, value 8701 8702 } 8703 } 8704 *v = sv 8705 return nil 8706} 8707 8708func awsRestjson1_deserializeDocumentHttpRouteAction(v **types.HttpRouteAction, value interface{}) error { 8709 if v == nil { 8710 return fmt.Errorf("unexpected nil of type %T", v) 8711 } 8712 if value == nil { 8713 return nil 8714 } 8715 8716 shape, ok := value.(map[string]interface{}) 8717 if !ok { 8718 return fmt.Errorf("unexpected JSON type %v", value) 8719 } 8720 8721 var sv *types.HttpRouteAction 8722 if *v == nil { 8723 sv = &types.HttpRouteAction{} 8724 } else { 8725 sv = *v 8726 } 8727 8728 for key, value := range shape { 8729 switch key { 8730 case "weightedTargets": 8731 if err := awsRestjson1_deserializeDocumentWeightedTargets(&sv.WeightedTargets, value); err != nil { 8732 return err 8733 } 8734 8735 default: 8736 _, _ = key, value 8737 8738 } 8739 } 8740 *v = sv 8741 return nil 8742} 8743 8744func awsRestjson1_deserializeDocumentHttpRouteHeader(v **types.HttpRouteHeader, value interface{}) error { 8745 if v == nil { 8746 return fmt.Errorf("unexpected nil of type %T", v) 8747 } 8748 if value == nil { 8749 return nil 8750 } 8751 8752 shape, ok := value.(map[string]interface{}) 8753 if !ok { 8754 return fmt.Errorf("unexpected JSON type %v", value) 8755 } 8756 8757 var sv *types.HttpRouteHeader 8758 if *v == nil { 8759 sv = &types.HttpRouteHeader{} 8760 } else { 8761 sv = *v 8762 } 8763 8764 for key, value := range shape { 8765 switch key { 8766 case "invert": 8767 if value != nil { 8768 jtv, ok := value.(bool) 8769 if !ok { 8770 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 8771 } 8772 sv.Invert = ptr.Bool(jtv) 8773 } 8774 8775 case "match": 8776 if err := awsRestjson1_deserializeDocumentHeaderMatchMethod(&sv.Match, value); err != nil { 8777 return err 8778 } 8779 8780 case "name": 8781 if value != nil { 8782 jtv, ok := value.(string) 8783 if !ok { 8784 return fmt.Errorf("expected HeaderName to be of type string, got %T instead", value) 8785 } 8786 sv.Name = ptr.String(jtv) 8787 } 8788 8789 default: 8790 _, _ = key, value 8791 8792 } 8793 } 8794 *v = sv 8795 return nil 8796} 8797 8798func awsRestjson1_deserializeDocumentHttpRouteHeaders(v *[]types.HttpRouteHeader, value interface{}) error { 8799 if v == nil { 8800 return fmt.Errorf("unexpected nil of type %T", v) 8801 } 8802 if value == nil { 8803 return nil 8804 } 8805 8806 shape, ok := value.([]interface{}) 8807 if !ok { 8808 return fmt.Errorf("unexpected JSON type %v", value) 8809 } 8810 8811 var cv []types.HttpRouteHeader 8812 if *v == nil { 8813 cv = []types.HttpRouteHeader{} 8814 } else { 8815 cv = *v 8816 } 8817 8818 for _, value := range shape { 8819 var col types.HttpRouteHeader 8820 destAddr := &col 8821 if err := awsRestjson1_deserializeDocumentHttpRouteHeader(&destAddr, value); err != nil { 8822 return err 8823 } 8824 col = *destAddr 8825 cv = append(cv, col) 8826 8827 } 8828 *v = cv 8829 return nil 8830} 8831 8832func awsRestjson1_deserializeDocumentHttpRouteMatch(v **types.HttpRouteMatch, value interface{}) error { 8833 if v == nil { 8834 return fmt.Errorf("unexpected nil of type %T", v) 8835 } 8836 if value == nil { 8837 return nil 8838 } 8839 8840 shape, ok := value.(map[string]interface{}) 8841 if !ok { 8842 return fmt.Errorf("unexpected JSON type %v", value) 8843 } 8844 8845 var sv *types.HttpRouteMatch 8846 if *v == nil { 8847 sv = &types.HttpRouteMatch{} 8848 } else { 8849 sv = *v 8850 } 8851 8852 for key, value := range shape { 8853 switch key { 8854 case "headers": 8855 if err := awsRestjson1_deserializeDocumentHttpRouteHeaders(&sv.Headers, value); err != nil { 8856 return err 8857 } 8858 8859 case "method": 8860 if value != nil { 8861 jtv, ok := value.(string) 8862 if !ok { 8863 return fmt.Errorf("expected HttpMethod to be of type string, got %T instead", value) 8864 } 8865 sv.Method = types.HttpMethod(jtv) 8866 } 8867 8868 case "prefix": 8869 if value != nil { 8870 jtv, ok := value.(string) 8871 if !ok { 8872 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8873 } 8874 sv.Prefix = ptr.String(jtv) 8875 } 8876 8877 case "scheme": 8878 if value != nil { 8879 jtv, ok := value.(string) 8880 if !ok { 8881 return fmt.Errorf("expected HttpScheme to be of type string, got %T instead", value) 8882 } 8883 sv.Scheme = types.HttpScheme(jtv) 8884 } 8885 8886 default: 8887 _, _ = key, value 8888 8889 } 8890 } 8891 *v = sv 8892 return nil 8893} 8894 8895func awsRestjson1_deserializeDocumentHttpTimeout(v **types.HttpTimeout, value interface{}) error { 8896 if v == nil { 8897 return fmt.Errorf("unexpected nil of type %T", v) 8898 } 8899 if value == nil { 8900 return nil 8901 } 8902 8903 shape, ok := value.(map[string]interface{}) 8904 if !ok { 8905 return fmt.Errorf("unexpected JSON type %v", value) 8906 } 8907 8908 var sv *types.HttpTimeout 8909 if *v == nil { 8910 sv = &types.HttpTimeout{} 8911 } else { 8912 sv = *v 8913 } 8914 8915 for key, value := range shape { 8916 switch key { 8917 case "idle": 8918 if err := awsRestjson1_deserializeDocumentDuration(&sv.Idle, value); err != nil { 8919 return err 8920 } 8921 8922 case "perRequest": 8923 if err := awsRestjson1_deserializeDocumentDuration(&sv.PerRequest, value); err != nil { 8924 return err 8925 } 8926 8927 default: 8928 _, _ = key, value 8929 8930 } 8931 } 8932 *v = sv 8933 return nil 8934} 8935 8936func awsRestjson1_deserializeDocumentInternalServerErrorException(v **types.InternalServerErrorException, value interface{}) error { 8937 if v == nil { 8938 return fmt.Errorf("unexpected nil of type %T", v) 8939 } 8940 if value == nil { 8941 return nil 8942 } 8943 8944 shape, ok := value.(map[string]interface{}) 8945 if !ok { 8946 return fmt.Errorf("unexpected JSON type %v", value) 8947 } 8948 8949 var sv *types.InternalServerErrorException 8950 if *v == nil { 8951 sv = &types.InternalServerErrorException{} 8952 } else { 8953 sv = *v 8954 } 8955 8956 for key, value := range shape { 8957 switch key { 8958 case "message": 8959 if value != nil { 8960 jtv, ok := value.(string) 8961 if !ok { 8962 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8963 } 8964 sv.Message = ptr.String(jtv) 8965 } 8966 8967 default: 8968 _, _ = key, value 8969 8970 } 8971 } 8972 *v = sv 8973 return nil 8974} 8975 8976func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 8977 if v == nil { 8978 return fmt.Errorf("unexpected nil of type %T", v) 8979 } 8980 if value == nil { 8981 return nil 8982 } 8983 8984 shape, ok := value.(map[string]interface{}) 8985 if !ok { 8986 return fmt.Errorf("unexpected JSON type %v", value) 8987 } 8988 8989 var sv *types.LimitExceededException 8990 if *v == nil { 8991 sv = &types.LimitExceededException{} 8992 } else { 8993 sv = *v 8994 } 8995 8996 for key, value := range shape { 8997 switch key { 8998 case "message": 8999 if value != nil { 9000 jtv, ok := value.(string) 9001 if !ok { 9002 return fmt.Errorf("expected String to be of type string, got %T instead", value) 9003 } 9004 sv.Message = ptr.String(jtv) 9005 } 9006 9007 default: 9008 _, _ = key, value 9009 9010 } 9011 } 9012 *v = sv 9013 return nil 9014} 9015 9016func awsRestjson1_deserializeDocumentListener(v **types.Listener, value interface{}) error { 9017 if v == nil { 9018 return fmt.Errorf("unexpected nil of type %T", v) 9019 } 9020 if value == nil { 9021 return nil 9022 } 9023 9024 shape, ok := value.(map[string]interface{}) 9025 if !ok { 9026 return fmt.Errorf("unexpected JSON type %v", value) 9027 } 9028 9029 var sv *types.Listener 9030 if *v == nil { 9031 sv = &types.Listener{} 9032 } else { 9033 sv = *v 9034 } 9035 9036 for key, value := range shape { 9037 switch key { 9038 case "healthCheck": 9039 if err := awsRestjson1_deserializeDocumentHealthCheckPolicy(&sv.HealthCheck, value); err != nil { 9040 return err 9041 } 9042 9043 case "portMapping": 9044 if err := awsRestjson1_deserializeDocumentPortMapping(&sv.PortMapping, value); err != nil { 9045 return err 9046 } 9047 9048 case "timeout": 9049 if err := awsRestjson1_deserializeDocumentListenerTimeout(&sv.Timeout, value); err != nil { 9050 return err 9051 } 9052 9053 case "tls": 9054 if err := awsRestjson1_deserializeDocumentListenerTls(&sv.Tls, value); err != nil { 9055 return err 9056 } 9057 9058 default: 9059 _, _ = key, value 9060 9061 } 9062 } 9063 *v = sv 9064 return nil 9065} 9066 9067func awsRestjson1_deserializeDocumentListeners(v *[]types.Listener, value interface{}) error { 9068 if v == nil { 9069 return fmt.Errorf("unexpected nil of type %T", v) 9070 } 9071 if value == nil { 9072 return nil 9073 } 9074 9075 shape, ok := value.([]interface{}) 9076 if !ok { 9077 return fmt.Errorf("unexpected JSON type %v", value) 9078 } 9079 9080 var cv []types.Listener 9081 if *v == nil { 9082 cv = []types.Listener{} 9083 } else { 9084 cv = *v 9085 } 9086 9087 for _, value := range shape { 9088 var col types.Listener 9089 destAddr := &col 9090 if err := awsRestjson1_deserializeDocumentListener(&destAddr, value); err != nil { 9091 return err 9092 } 9093 col = *destAddr 9094 cv = append(cv, col) 9095 9096 } 9097 *v = cv 9098 return nil 9099} 9100 9101func awsRestjson1_deserializeDocumentListenerTimeout(v *types.ListenerTimeout, value interface{}) error { 9102 if v == nil { 9103 return fmt.Errorf("unexpected nil of type %T", v) 9104 } 9105 if value == nil { 9106 return nil 9107 } 9108 9109 shape, ok := value.(map[string]interface{}) 9110 if !ok { 9111 return fmt.Errorf("unexpected JSON type %v", value) 9112 } 9113 9114 var uv types.ListenerTimeout 9115loop: 9116 for key, value := range shape { 9117 switch key { 9118 case "grpc": 9119 var mv types.GrpcTimeout 9120 destAddr := &mv 9121 if err := awsRestjson1_deserializeDocumentGrpcTimeout(&destAddr, value); err != nil { 9122 return err 9123 } 9124 mv = *destAddr 9125 uv = &types.ListenerTimeoutMemberGrpc{Value: mv} 9126 break loop 9127 9128 case "http": 9129 var mv types.HttpTimeout 9130 destAddr := &mv 9131 if err := awsRestjson1_deserializeDocumentHttpTimeout(&destAddr, value); err != nil { 9132 return err 9133 } 9134 mv = *destAddr 9135 uv = &types.ListenerTimeoutMemberHttp{Value: mv} 9136 break loop 9137 9138 case "http2": 9139 var mv types.HttpTimeout 9140 destAddr := &mv 9141 if err := awsRestjson1_deserializeDocumentHttpTimeout(&destAddr, value); err != nil { 9142 return err 9143 } 9144 mv = *destAddr 9145 uv = &types.ListenerTimeoutMemberHttp2{Value: mv} 9146 break loop 9147 9148 case "tcp": 9149 var mv types.TcpTimeout 9150 destAddr := &mv 9151 if err := awsRestjson1_deserializeDocumentTcpTimeout(&destAddr, value); err != nil { 9152 return err 9153 } 9154 mv = *destAddr 9155 uv = &types.ListenerTimeoutMemberTcp{Value: mv} 9156 break loop 9157 9158 default: 9159 uv = &types.UnknownUnionMember{Tag: key} 9160 break loop 9161 9162 } 9163 } 9164 *v = uv 9165 return nil 9166} 9167 9168func awsRestjson1_deserializeDocumentListenerTls(v **types.ListenerTls, value interface{}) error { 9169 if v == nil { 9170 return fmt.Errorf("unexpected nil of type %T", v) 9171 } 9172 if value == nil { 9173 return nil 9174 } 9175 9176 shape, ok := value.(map[string]interface{}) 9177 if !ok { 9178 return fmt.Errorf("unexpected JSON type %v", value) 9179 } 9180 9181 var sv *types.ListenerTls 9182 if *v == nil { 9183 sv = &types.ListenerTls{} 9184 } else { 9185 sv = *v 9186 } 9187 9188 for key, value := range shape { 9189 switch key { 9190 case "certificate": 9191 if err := awsRestjson1_deserializeDocumentListenerTlsCertificate(&sv.Certificate, value); err != nil { 9192 return err 9193 } 9194 9195 case "mode": 9196 if value != nil { 9197 jtv, ok := value.(string) 9198 if !ok { 9199 return fmt.Errorf("expected ListenerTlsMode to be of type string, got %T instead", value) 9200 } 9201 sv.Mode = types.ListenerTlsMode(jtv) 9202 } 9203 9204 default: 9205 _, _ = key, value 9206 9207 } 9208 } 9209 *v = sv 9210 return nil 9211} 9212 9213func awsRestjson1_deserializeDocumentListenerTlsAcmCertificate(v **types.ListenerTlsAcmCertificate, value interface{}) error { 9214 if v == nil { 9215 return fmt.Errorf("unexpected nil of type %T", v) 9216 } 9217 if value == nil { 9218 return nil 9219 } 9220 9221 shape, ok := value.(map[string]interface{}) 9222 if !ok { 9223 return fmt.Errorf("unexpected JSON type %v", value) 9224 } 9225 9226 var sv *types.ListenerTlsAcmCertificate 9227 if *v == nil { 9228 sv = &types.ListenerTlsAcmCertificate{} 9229 } else { 9230 sv = *v 9231 } 9232 9233 for key, value := range shape { 9234 switch key { 9235 case "certificateArn": 9236 if value != nil { 9237 jtv, ok := value.(string) 9238 if !ok { 9239 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 9240 } 9241 sv.CertificateArn = ptr.String(jtv) 9242 } 9243 9244 default: 9245 _, _ = key, value 9246 9247 } 9248 } 9249 *v = sv 9250 return nil 9251} 9252 9253func awsRestjson1_deserializeDocumentListenerTlsCertificate(v *types.ListenerTlsCertificate, value interface{}) error { 9254 if v == nil { 9255 return fmt.Errorf("unexpected nil of type %T", v) 9256 } 9257 if value == nil { 9258 return nil 9259 } 9260 9261 shape, ok := value.(map[string]interface{}) 9262 if !ok { 9263 return fmt.Errorf("unexpected JSON type %v", value) 9264 } 9265 9266 var uv types.ListenerTlsCertificate 9267loop: 9268 for key, value := range shape { 9269 switch key { 9270 case "acm": 9271 var mv types.ListenerTlsAcmCertificate 9272 destAddr := &mv 9273 if err := awsRestjson1_deserializeDocumentListenerTlsAcmCertificate(&destAddr, value); err != nil { 9274 return err 9275 } 9276 mv = *destAddr 9277 uv = &types.ListenerTlsCertificateMemberAcm{Value: mv} 9278 break loop 9279 9280 case "file": 9281 var mv types.ListenerTlsFileCertificate 9282 destAddr := &mv 9283 if err := awsRestjson1_deserializeDocumentListenerTlsFileCertificate(&destAddr, value); err != nil { 9284 return err 9285 } 9286 mv = *destAddr 9287 uv = &types.ListenerTlsCertificateMemberFile{Value: mv} 9288 break loop 9289 9290 default: 9291 uv = &types.UnknownUnionMember{Tag: key} 9292 break loop 9293 9294 } 9295 } 9296 *v = uv 9297 return nil 9298} 9299 9300func awsRestjson1_deserializeDocumentListenerTlsFileCertificate(v **types.ListenerTlsFileCertificate, value interface{}) error { 9301 if v == nil { 9302 return fmt.Errorf("unexpected nil of type %T", v) 9303 } 9304 if value == nil { 9305 return nil 9306 } 9307 9308 shape, ok := value.(map[string]interface{}) 9309 if !ok { 9310 return fmt.Errorf("unexpected JSON type %v", value) 9311 } 9312 9313 var sv *types.ListenerTlsFileCertificate 9314 if *v == nil { 9315 sv = &types.ListenerTlsFileCertificate{} 9316 } else { 9317 sv = *v 9318 } 9319 9320 for key, value := range shape { 9321 switch key { 9322 case "certificateChain": 9323 if value != nil { 9324 jtv, ok := value.(string) 9325 if !ok { 9326 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 9327 } 9328 sv.CertificateChain = ptr.String(jtv) 9329 } 9330 9331 case "privateKey": 9332 if value != nil { 9333 jtv, ok := value.(string) 9334 if !ok { 9335 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 9336 } 9337 sv.PrivateKey = ptr.String(jtv) 9338 } 9339 9340 default: 9341 _, _ = key, value 9342 9343 } 9344 } 9345 *v = sv 9346 return nil 9347} 9348 9349func awsRestjson1_deserializeDocumentLogging(v **types.Logging, value interface{}) error { 9350 if v == nil { 9351 return fmt.Errorf("unexpected nil of type %T", v) 9352 } 9353 if value == nil { 9354 return nil 9355 } 9356 9357 shape, ok := value.(map[string]interface{}) 9358 if !ok { 9359 return fmt.Errorf("unexpected JSON type %v", value) 9360 } 9361 9362 var sv *types.Logging 9363 if *v == nil { 9364 sv = &types.Logging{} 9365 } else { 9366 sv = *v 9367 } 9368 9369 for key, value := range shape { 9370 switch key { 9371 case "accessLog": 9372 if err := awsRestjson1_deserializeDocumentAccessLog(&sv.AccessLog, value); err != nil { 9373 return err 9374 } 9375 9376 default: 9377 _, _ = key, value 9378 9379 } 9380 } 9381 *v = sv 9382 return nil 9383} 9384 9385func awsRestjson1_deserializeDocumentMatchRange(v **types.MatchRange, value interface{}) error { 9386 if v == nil { 9387 return fmt.Errorf("unexpected nil of type %T", v) 9388 } 9389 if value == nil { 9390 return nil 9391 } 9392 9393 shape, ok := value.(map[string]interface{}) 9394 if !ok { 9395 return fmt.Errorf("unexpected JSON type %v", value) 9396 } 9397 9398 var sv *types.MatchRange 9399 if *v == nil { 9400 sv = &types.MatchRange{} 9401 } else { 9402 sv = *v 9403 } 9404 9405 for key, value := range shape { 9406 switch key { 9407 case "end": 9408 if value != nil { 9409 jtv, ok := value.(json.Number) 9410 if !ok { 9411 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 9412 } 9413 i64, err := jtv.Int64() 9414 if err != nil { 9415 return err 9416 } 9417 sv.End = ptr.Int64(i64) 9418 } 9419 9420 case "start": 9421 if value != nil { 9422 jtv, ok := value.(json.Number) 9423 if !ok { 9424 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 9425 } 9426 i64, err := jtv.Int64() 9427 if err != nil { 9428 return err 9429 } 9430 sv.Start = ptr.Int64(i64) 9431 } 9432 9433 default: 9434 _, _ = key, value 9435 9436 } 9437 } 9438 *v = sv 9439 return nil 9440} 9441 9442func awsRestjson1_deserializeDocumentMeshData(v **types.MeshData, value interface{}) error { 9443 if v == nil { 9444 return fmt.Errorf("unexpected nil of type %T", v) 9445 } 9446 if value == nil { 9447 return nil 9448 } 9449 9450 shape, ok := value.(map[string]interface{}) 9451 if !ok { 9452 return fmt.Errorf("unexpected JSON type %v", value) 9453 } 9454 9455 var sv *types.MeshData 9456 if *v == nil { 9457 sv = &types.MeshData{} 9458 } else { 9459 sv = *v 9460 } 9461 9462 for key, value := range shape { 9463 switch key { 9464 case "meshName": 9465 if value != nil { 9466 jtv, ok := value.(string) 9467 if !ok { 9468 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 9469 } 9470 sv.MeshName = ptr.String(jtv) 9471 } 9472 9473 case "metadata": 9474 if err := awsRestjson1_deserializeDocumentResourceMetadata(&sv.Metadata, value); err != nil { 9475 return err 9476 } 9477 9478 case "spec": 9479 if err := awsRestjson1_deserializeDocumentMeshSpec(&sv.Spec, value); err != nil { 9480 return err 9481 } 9482 9483 case "status": 9484 if err := awsRestjson1_deserializeDocumentMeshStatus(&sv.Status, value); err != nil { 9485 return err 9486 } 9487 9488 default: 9489 _, _ = key, value 9490 9491 } 9492 } 9493 *v = sv 9494 return nil 9495} 9496 9497func awsRestjson1_deserializeDocumentMeshList(v *[]types.MeshRef, value interface{}) error { 9498 if v == nil { 9499 return fmt.Errorf("unexpected nil of type %T", v) 9500 } 9501 if value == nil { 9502 return nil 9503 } 9504 9505 shape, ok := value.([]interface{}) 9506 if !ok { 9507 return fmt.Errorf("unexpected JSON type %v", value) 9508 } 9509 9510 var cv []types.MeshRef 9511 if *v == nil { 9512 cv = []types.MeshRef{} 9513 } else { 9514 cv = *v 9515 } 9516 9517 for _, value := range shape { 9518 var col types.MeshRef 9519 destAddr := &col 9520 if err := awsRestjson1_deserializeDocumentMeshRef(&destAddr, value); err != nil { 9521 return err 9522 } 9523 col = *destAddr 9524 cv = append(cv, col) 9525 9526 } 9527 *v = cv 9528 return nil 9529} 9530 9531func awsRestjson1_deserializeDocumentMeshRef(v **types.MeshRef, value interface{}) error { 9532 if v == nil { 9533 return fmt.Errorf("unexpected nil of type %T", v) 9534 } 9535 if value == nil { 9536 return nil 9537 } 9538 9539 shape, ok := value.(map[string]interface{}) 9540 if !ok { 9541 return fmt.Errorf("unexpected JSON type %v", value) 9542 } 9543 9544 var sv *types.MeshRef 9545 if *v == nil { 9546 sv = &types.MeshRef{} 9547 } else { 9548 sv = *v 9549 } 9550 9551 for key, value := range shape { 9552 switch key { 9553 case "arn": 9554 if value != nil { 9555 jtv, ok := value.(string) 9556 if !ok { 9557 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 9558 } 9559 sv.Arn = ptr.String(jtv) 9560 } 9561 9562 case "createdAt": 9563 if value != nil { 9564 jtv, ok := value.(json.Number) 9565 if !ok { 9566 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9567 } 9568 f64, err := jtv.Float64() 9569 if err != nil { 9570 return err 9571 } 9572 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9573 } 9574 9575 case "lastUpdatedAt": 9576 if value != nil { 9577 jtv, ok := value.(json.Number) 9578 if !ok { 9579 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9580 } 9581 f64, err := jtv.Float64() 9582 if err != nil { 9583 return err 9584 } 9585 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9586 } 9587 9588 case "meshName": 9589 if value != nil { 9590 jtv, ok := value.(string) 9591 if !ok { 9592 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 9593 } 9594 sv.MeshName = ptr.String(jtv) 9595 } 9596 9597 case "meshOwner": 9598 if value != nil { 9599 jtv, ok := value.(string) 9600 if !ok { 9601 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 9602 } 9603 sv.MeshOwner = ptr.String(jtv) 9604 } 9605 9606 case "resourceOwner": 9607 if value != nil { 9608 jtv, ok := value.(string) 9609 if !ok { 9610 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 9611 } 9612 sv.ResourceOwner = ptr.String(jtv) 9613 } 9614 9615 case "version": 9616 if value != nil { 9617 jtv, ok := value.(json.Number) 9618 if !ok { 9619 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 9620 } 9621 i64, err := jtv.Int64() 9622 if err != nil { 9623 return err 9624 } 9625 sv.Version = ptr.Int64(i64) 9626 } 9627 9628 default: 9629 _, _ = key, value 9630 9631 } 9632 } 9633 *v = sv 9634 return nil 9635} 9636 9637func awsRestjson1_deserializeDocumentMeshSpec(v **types.MeshSpec, value interface{}) error { 9638 if v == nil { 9639 return fmt.Errorf("unexpected nil of type %T", v) 9640 } 9641 if value == nil { 9642 return nil 9643 } 9644 9645 shape, ok := value.(map[string]interface{}) 9646 if !ok { 9647 return fmt.Errorf("unexpected JSON type %v", value) 9648 } 9649 9650 var sv *types.MeshSpec 9651 if *v == nil { 9652 sv = &types.MeshSpec{} 9653 } else { 9654 sv = *v 9655 } 9656 9657 for key, value := range shape { 9658 switch key { 9659 case "egressFilter": 9660 if err := awsRestjson1_deserializeDocumentEgressFilter(&sv.EgressFilter, value); err != nil { 9661 return err 9662 } 9663 9664 default: 9665 _, _ = key, value 9666 9667 } 9668 } 9669 *v = sv 9670 return nil 9671} 9672 9673func awsRestjson1_deserializeDocumentMeshStatus(v **types.MeshStatus, value interface{}) error { 9674 if v == nil { 9675 return fmt.Errorf("unexpected nil of type %T", v) 9676 } 9677 if value == nil { 9678 return nil 9679 } 9680 9681 shape, ok := value.(map[string]interface{}) 9682 if !ok { 9683 return fmt.Errorf("unexpected JSON type %v", value) 9684 } 9685 9686 var sv *types.MeshStatus 9687 if *v == nil { 9688 sv = &types.MeshStatus{} 9689 } else { 9690 sv = *v 9691 } 9692 9693 for key, value := range shape { 9694 switch key { 9695 case "status": 9696 if value != nil { 9697 jtv, ok := value.(string) 9698 if !ok { 9699 return fmt.Errorf("expected MeshStatusCode to be of type string, got %T instead", value) 9700 } 9701 sv.Status = types.MeshStatusCode(jtv) 9702 } 9703 9704 default: 9705 _, _ = key, value 9706 9707 } 9708 } 9709 *v = sv 9710 return nil 9711} 9712 9713func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 9714 if v == nil { 9715 return fmt.Errorf("unexpected nil of type %T", v) 9716 } 9717 if value == nil { 9718 return nil 9719 } 9720 9721 shape, ok := value.(map[string]interface{}) 9722 if !ok { 9723 return fmt.Errorf("unexpected JSON type %v", value) 9724 } 9725 9726 var sv *types.NotFoundException 9727 if *v == nil { 9728 sv = &types.NotFoundException{} 9729 } else { 9730 sv = *v 9731 } 9732 9733 for key, value := range shape { 9734 switch key { 9735 case "message": 9736 if value != nil { 9737 jtv, ok := value.(string) 9738 if !ok { 9739 return fmt.Errorf("expected String to be of type string, got %T instead", value) 9740 } 9741 sv.Message = ptr.String(jtv) 9742 } 9743 9744 default: 9745 _, _ = key, value 9746 9747 } 9748 } 9749 *v = sv 9750 return nil 9751} 9752 9753func awsRestjson1_deserializeDocumentPortMapping(v **types.PortMapping, value interface{}) error { 9754 if v == nil { 9755 return fmt.Errorf("unexpected nil of type %T", v) 9756 } 9757 if value == nil { 9758 return nil 9759 } 9760 9761 shape, ok := value.(map[string]interface{}) 9762 if !ok { 9763 return fmt.Errorf("unexpected JSON type %v", value) 9764 } 9765 9766 var sv *types.PortMapping 9767 if *v == nil { 9768 sv = &types.PortMapping{} 9769 } else { 9770 sv = *v 9771 } 9772 9773 for key, value := range shape { 9774 switch key { 9775 case "port": 9776 if value != nil { 9777 jtv, ok := value.(json.Number) 9778 if !ok { 9779 return fmt.Errorf("expected PortNumber to be json.Number, got %T instead", value) 9780 } 9781 i64, err := jtv.Int64() 9782 if err != nil { 9783 return err 9784 } 9785 sv.Port = int32(i64) 9786 } 9787 9788 case "protocol": 9789 if value != nil { 9790 jtv, ok := value.(string) 9791 if !ok { 9792 return fmt.Errorf("expected PortProtocol to be of type string, got %T instead", value) 9793 } 9794 sv.Protocol = types.PortProtocol(jtv) 9795 } 9796 9797 default: 9798 _, _ = key, value 9799 9800 } 9801 } 9802 *v = sv 9803 return nil 9804} 9805 9806func awsRestjson1_deserializeDocumentPortSet(v *[]int32, value interface{}) error { 9807 if v == nil { 9808 return fmt.Errorf("unexpected nil of type %T", v) 9809 } 9810 if value == nil { 9811 return nil 9812 } 9813 9814 shape, ok := value.([]interface{}) 9815 if !ok { 9816 return fmt.Errorf("unexpected JSON type %v", value) 9817 } 9818 9819 var cv []int32 9820 if *v == nil { 9821 cv = []int32{} 9822 } else { 9823 cv = *v 9824 } 9825 9826 for _, value := range shape { 9827 var col int32 9828 if value != nil { 9829 jtv, ok := value.(json.Number) 9830 if !ok { 9831 return fmt.Errorf("expected PortNumber to be json.Number, got %T instead", value) 9832 } 9833 i64, err := jtv.Int64() 9834 if err != nil { 9835 return err 9836 } 9837 col = int32(i64) 9838 } 9839 cv = append(cv, col) 9840 9841 } 9842 *v = cv 9843 return nil 9844} 9845 9846func awsRestjson1_deserializeDocumentResourceInUseException(v **types.ResourceInUseException, value interface{}) error { 9847 if v == nil { 9848 return fmt.Errorf("unexpected nil of type %T", v) 9849 } 9850 if value == nil { 9851 return nil 9852 } 9853 9854 shape, ok := value.(map[string]interface{}) 9855 if !ok { 9856 return fmt.Errorf("unexpected JSON type %v", value) 9857 } 9858 9859 var sv *types.ResourceInUseException 9860 if *v == nil { 9861 sv = &types.ResourceInUseException{} 9862 } else { 9863 sv = *v 9864 } 9865 9866 for key, value := range shape { 9867 switch key { 9868 case "message": 9869 if value != nil { 9870 jtv, ok := value.(string) 9871 if !ok { 9872 return fmt.Errorf("expected String to be of type string, got %T instead", value) 9873 } 9874 sv.Message = ptr.String(jtv) 9875 } 9876 9877 default: 9878 _, _ = key, value 9879 9880 } 9881 } 9882 *v = sv 9883 return nil 9884} 9885 9886func awsRestjson1_deserializeDocumentResourceMetadata(v **types.ResourceMetadata, value interface{}) error { 9887 if v == nil { 9888 return fmt.Errorf("unexpected nil of type %T", v) 9889 } 9890 if value == nil { 9891 return nil 9892 } 9893 9894 shape, ok := value.(map[string]interface{}) 9895 if !ok { 9896 return fmt.Errorf("unexpected JSON type %v", value) 9897 } 9898 9899 var sv *types.ResourceMetadata 9900 if *v == nil { 9901 sv = &types.ResourceMetadata{} 9902 } else { 9903 sv = *v 9904 } 9905 9906 for key, value := range shape { 9907 switch key { 9908 case "arn": 9909 if value != nil { 9910 jtv, ok := value.(string) 9911 if !ok { 9912 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 9913 } 9914 sv.Arn = ptr.String(jtv) 9915 } 9916 9917 case "createdAt": 9918 if value != nil { 9919 jtv, ok := value.(json.Number) 9920 if !ok { 9921 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9922 } 9923 f64, err := jtv.Float64() 9924 if err != nil { 9925 return err 9926 } 9927 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9928 } 9929 9930 case "lastUpdatedAt": 9931 if value != nil { 9932 jtv, ok := value.(json.Number) 9933 if !ok { 9934 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9935 } 9936 f64, err := jtv.Float64() 9937 if err != nil { 9938 return err 9939 } 9940 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9941 } 9942 9943 case "meshOwner": 9944 if value != nil { 9945 jtv, ok := value.(string) 9946 if !ok { 9947 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 9948 } 9949 sv.MeshOwner = ptr.String(jtv) 9950 } 9951 9952 case "resourceOwner": 9953 if value != nil { 9954 jtv, ok := value.(string) 9955 if !ok { 9956 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 9957 } 9958 sv.ResourceOwner = ptr.String(jtv) 9959 } 9960 9961 case "uid": 9962 if value != nil { 9963 jtv, ok := value.(string) 9964 if !ok { 9965 return fmt.Errorf("expected String to be of type string, got %T instead", value) 9966 } 9967 sv.Uid = ptr.String(jtv) 9968 } 9969 9970 case "version": 9971 if value != nil { 9972 jtv, ok := value.(json.Number) 9973 if !ok { 9974 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 9975 } 9976 i64, err := jtv.Int64() 9977 if err != nil { 9978 return err 9979 } 9980 sv.Version = ptr.Int64(i64) 9981 } 9982 9983 default: 9984 _, _ = key, value 9985 9986 } 9987 } 9988 *v = sv 9989 return nil 9990} 9991 9992func awsRestjson1_deserializeDocumentRouteData(v **types.RouteData, value interface{}) error { 9993 if v == nil { 9994 return fmt.Errorf("unexpected nil of type %T", v) 9995 } 9996 if value == nil { 9997 return nil 9998 } 9999 10000 shape, ok := value.(map[string]interface{}) 10001 if !ok { 10002 return fmt.Errorf("unexpected JSON type %v", value) 10003 } 10004 10005 var sv *types.RouteData 10006 if *v == nil { 10007 sv = &types.RouteData{} 10008 } else { 10009 sv = *v 10010 } 10011 10012 for key, value := range shape { 10013 switch key { 10014 case "meshName": 10015 if value != nil { 10016 jtv, ok := value.(string) 10017 if !ok { 10018 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 10019 } 10020 sv.MeshName = ptr.String(jtv) 10021 } 10022 10023 case "metadata": 10024 if err := awsRestjson1_deserializeDocumentResourceMetadata(&sv.Metadata, value); err != nil { 10025 return err 10026 } 10027 10028 case "routeName": 10029 if value != nil { 10030 jtv, ok := value.(string) 10031 if !ok { 10032 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 10033 } 10034 sv.RouteName = ptr.String(jtv) 10035 } 10036 10037 case "spec": 10038 if err := awsRestjson1_deserializeDocumentRouteSpec(&sv.Spec, value); err != nil { 10039 return err 10040 } 10041 10042 case "status": 10043 if err := awsRestjson1_deserializeDocumentRouteStatus(&sv.Status, value); err != nil { 10044 return err 10045 } 10046 10047 case "virtualRouterName": 10048 if value != nil { 10049 jtv, ok := value.(string) 10050 if !ok { 10051 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 10052 } 10053 sv.VirtualRouterName = ptr.String(jtv) 10054 } 10055 10056 default: 10057 _, _ = key, value 10058 10059 } 10060 } 10061 *v = sv 10062 return nil 10063} 10064 10065func awsRestjson1_deserializeDocumentRouteList(v *[]types.RouteRef, value interface{}) error { 10066 if v == nil { 10067 return fmt.Errorf("unexpected nil of type %T", v) 10068 } 10069 if value == nil { 10070 return nil 10071 } 10072 10073 shape, ok := value.([]interface{}) 10074 if !ok { 10075 return fmt.Errorf("unexpected JSON type %v", value) 10076 } 10077 10078 var cv []types.RouteRef 10079 if *v == nil { 10080 cv = []types.RouteRef{} 10081 } else { 10082 cv = *v 10083 } 10084 10085 for _, value := range shape { 10086 var col types.RouteRef 10087 destAddr := &col 10088 if err := awsRestjson1_deserializeDocumentRouteRef(&destAddr, value); err != nil { 10089 return err 10090 } 10091 col = *destAddr 10092 cv = append(cv, col) 10093 10094 } 10095 *v = cv 10096 return nil 10097} 10098 10099func awsRestjson1_deserializeDocumentRouteRef(v **types.RouteRef, value interface{}) error { 10100 if v == nil { 10101 return fmt.Errorf("unexpected nil of type %T", v) 10102 } 10103 if value == nil { 10104 return nil 10105 } 10106 10107 shape, ok := value.(map[string]interface{}) 10108 if !ok { 10109 return fmt.Errorf("unexpected JSON type %v", value) 10110 } 10111 10112 var sv *types.RouteRef 10113 if *v == nil { 10114 sv = &types.RouteRef{} 10115 } else { 10116 sv = *v 10117 } 10118 10119 for key, value := range shape { 10120 switch key { 10121 case "arn": 10122 if value != nil { 10123 jtv, ok := value.(string) 10124 if !ok { 10125 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 10126 } 10127 sv.Arn = ptr.String(jtv) 10128 } 10129 10130 case "createdAt": 10131 if value != nil { 10132 jtv, ok := value.(json.Number) 10133 if !ok { 10134 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 10135 } 10136 f64, err := jtv.Float64() 10137 if err != nil { 10138 return err 10139 } 10140 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10141 } 10142 10143 case "lastUpdatedAt": 10144 if value != nil { 10145 jtv, ok := value.(json.Number) 10146 if !ok { 10147 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 10148 } 10149 f64, err := jtv.Float64() 10150 if err != nil { 10151 return err 10152 } 10153 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10154 } 10155 10156 case "meshName": 10157 if value != nil { 10158 jtv, ok := value.(string) 10159 if !ok { 10160 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 10161 } 10162 sv.MeshName = ptr.String(jtv) 10163 } 10164 10165 case "meshOwner": 10166 if value != nil { 10167 jtv, ok := value.(string) 10168 if !ok { 10169 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 10170 } 10171 sv.MeshOwner = ptr.String(jtv) 10172 } 10173 10174 case "resourceOwner": 10175 if value != nil { 10176 jtv, ok := value.(string) 10177 if !ok { 10178 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 10179 } 10180 sv.ResourceOwner = ptr.String(jtv) 10181 } 10182 10183 case "routeName": 10184 if value != nil { 10185 jtv, ok := value.(string) 10186 if !ok { 10187 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 10188 } 10189 sv.RouteName = ptr.String(jtv) 10190 } 10191 10192 case "version": 10193 if value != nil { 10194 jtv, ok := value.(json.Number) 10195 if !ok { 10196 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 10197 } 10198 i64, err := jtv.Int64() 10199 if err != nil { 10200 return err 10201 } 10202 sv.Version = ptr.Int64(i64) 10203 } 10204 10205 case "virtualRouterName": 10206 if value != nil { 10207 jtv, ok := value.(string) 10208 if !ok { 10209 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 10210 } 10211 sv.VirtualRouterName = ptr.String(jtv) 10212 } 10213 10214 default: 10215 _, _ = key, value 10216 10217 } 10218 } 10219 *v = sv 10220 return nil 10221} 10222 10223func awsRestjson1_deserializeDocumentRouteSpec(v **types.RouteSpec, value interface{}) error { 10224 if v == nil { 10225 return fmt.Errorf("unexpected nil of type %T", v) 10226 } 10227 if value == nil { 10228 return nil 10229 } 10230 10231 shape, ok := value.(map[string]interface{}) 10232 if !ok { 10233 return fmt.Errorf("unexpected JSON type %v", value) 10234 } 10235 10236 var sv *types.RouteSpec 10237 if *v == nil { 10238 sv = &types.RouteSpec{} 10239 } else { 10240 sv = *v 10241 } 10242 10243 for key, value := range shape { 10244 switch key { 10245 case "grpcRoute": 10246 if err := awsRestjson1_deserializeDocumentGrpcRoute(&sv.GrpcRoute, value); err != nil { 10247 return err 10248 } 10249 10250 case "http2Route": 10251 if err := awsRestjson1_deserializeDocumentHttpRoute(&sv.Http2Route, value); err != nil { 10252 return err 10253 } 10254 10255 case "httpRoute": 10256 if err := awsRestjson1_deserializeDocumentHttpRoute(&sv.HttpRoute, value); err != nil { 10257 return err 10258 } 10259 10260 case "priority": 10261 if value != nil { 10262 jtv, ok := value.(json.Number) 10263 if !ok { 10264 return fmt.Errorf("expected RoutePriority to be json.Number, got %T instead", value) 10265 } 10266 i64, err := jtv.Int64() 10267 if err != nil { 10268 return err 10269 } 10270 sv.Priority = ptr.Int32(int32(i64)) 10271 } 10272 10273 case "tcpRoute": 10274 if err := awsRestjson1_deserializeDocumentTcpRoute(&sv.TcpRoute, value); err != nil { 10275 return err 10276 } 10277 10278 default: 10279 _, _ = key, value 10280 10281 } 10282 } 10283 *v = sv 10284 return nil 10285} 10286 10287func awsRestjson1_deserializeDocumentRouteStatus(v **types.RouteStatus, value interface{}) error { 10288 if v == nil { 10289 return fmt.Errorf("unexpected nil of type %T", v) 10290 } 10291 if value == nil { 10292 return nil 10293 } 10294 10295 shape, ok := value.(map[string]interface{}) 10296 if !ok { 10297 return fmt.Errorf("unexpected JSON type %v", value) 10298 } 10299 10300 var sv *types.RouteStatus 10301 if *v == nil { 10302 sv = &types.RouteStatus{} 10303 } else { 10304 sv = *v 10305 } 10306 10307 for key, value := range shape { 10308 switch key { 10309 case "status": 10310 if value != nil { 10311 jtv, ok := value.(string) 10312 if !ok { 10313 return fmt.Errorf("expected RouteStatusCode to be of type string, got %T instead", value) 10314 } 10315 sv.Status = types.RouteStatusCode(jtv) 10316 } 10317 10318 default: 10319 _, _ = key, value 10320 10321 } 10322 } 10323 *v = sv 10324 return nil 10325} 10326 10327func awsRestjson1_deserializeDocumentServiceDiscovery(v *types.ServiceDiscovery, value interface{}) error { 10328 if v == nil { 10329 return fmt.Errorf("unexpected nil of type %T", v) 10330 } 10331 if value == nil { 10332 return nil 10333 } 10334 10335 shape, ok := value.(map[string]interface{}) 10336 if !ok { 10337 return fmt.Errorf("unexpected JSON type %v", value) 10338 } 10339 10340 var uv types.ServiceDiscovery 10341loop: 10342 for key, value := range shape { 10343 switch key { 10344 case "awsCloudMap": 10345 var mv types.AwsCloudMapServiceDiscovery 10346 destAddr := &mv 10347 if err := awsRestjson1_deserializeDocumentAwsCloudMapServiceDiscovery(&destAddr, value); err != nil { 10348 return err 10349 } 10350 mv = *destAddr 10351 uv = &types.ServiceDiscoveryMemberAwsCloudMap{Value: mv} 10352 break loop 10353 10354 case "dns": 10355 var mv types.DnsServiceDiscovery 10356 destAddr := &mv 10357 if err := awsRestjson1_deserializeDocumentDnsServiceDiscovery(&destAddr, value); err != nil { 10358 return err 10359 } 10360 mv = *destAddr 10361 uv = &types.ServiceDiscoveryMemberDns{Value: mv} 10362 break loop 10363 10364 default: 10365 uv = &types.UnknownUnionMember{Tag: key} 10366 break loop 10367 10368 } 10369 } 10370 *v = uv 10371 return nil 10372} 10373 10374func awsRestjson1_deserializeDocumentServiceUnavailableException(v **types.ServiceUnavailableException, value interface{}) error { 10375 if v == nil { 10376 return fmt.Errorf("unexpected nil of type %T", v) 10377 } 10378 if value == nil { 10379 return nil 10380 } 10381 10382 shape, ok := value.(map[string]interface{}) 10383 if !ok { 10384 return fmt.Errorf("unexpected JSON type %v", value) 10385 } 10386 10387 var sv *types.ServiceUnavailableException 10388 if *v == nil { 10389 sv = &types.ServiceUnavailableException{} 10390 } else { 10391 sv = *v 10392 } 10393 10394 for key, value := range shape { 10395 switch key { 10396 case "message": 10397 if value != nil { 10398 jtv, ok := value.(string) 10399 if !ok { 10400 return fmt.Errorf("expected String to be of type string, got %T instead", value) 10401 } 10402 sv.Message = ptr.String(jtv) 10403 } 10404 10405 default: 10406 _, _ = key, value 10407 10408 } 10409 } 10410 *v = sv 10411 return nil 10412} 10413 10414func awsRestjson1_deserializeDocumentTagList(v *[]types.TagRef, value interface{}) error { 10415 if v == nil { 10416 return fmt.Errorf("unexpected nil of type %T", v) 10417 } 10418 if value == nil { 10419 return nil 10420 } 10421 10422 shape, ok := value.([]interface{}) 10423 if !ok { 10424 return fmt.Errorf("unexpected JSON type %v", value) 10425 } 10426 10427 var cv []types.TagRef 10428 if *v == nil { 10429 cv = []types.TagRef{} 10430 } else { 10431 cv = *v 10432 } 10433 10434 for _, value := range shape { 10435 var col types.TagRef 10436 destAddr := &col 10437 if err := awsRestjson1_deserializeDocumentTagRef(&destAddr, value); err != nil { 10438 return err 10439 } 10440 col = *destAddr 10441 cv = append(cv, col) 10442 10443 } 10444 *v = cv 10445 return nil 10446} 10447 10448func awsRestjson1_deserializeDocumentTagRef(v **types.TagRef, value interface{}) error { 10449 if v == nil { 10450 return fmt.Errorf("unexpected nil of type %T", v) 10451 } 10452 if value == nil { 10453 return nil 10454 } 10455 10456 shape, ok := value.(map[string]interface{}) 10457 if !ok { 10458 return fmt.Errorf("unexpected JSON type %v", value) 10459 } 10460 10461 var sv *types.TagRef 10462 if *v == nil { 10463 sv = &types.TagRef{} 10464 } else { 10465 sv = *v 10466 } 10467 10468 for key, value := range shape { 10469 switch key { 10470 case "key": 10471 if value != nil { 10472 jtv, ok := value.(string) 10473 if !ok { 10474 return fmt.Errorf("expected TagKey to be of type string, got %T instead", value) 10475 } 10476 sv.Key = ptr.String(jtv) 10477 } 10478 10479 case "value": 10480 if value != nil { 10481 jtv, ok := value.(string) 10482 if !ok { 10483 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 10484 } 10485 sv.Value = ptr.String(jtv) 10486 } 10487 10488 default: 10489 _, _ = key, value 10490 10491 } 10492 } 10493 *v = sv 10494 return nil 10495} 10496 10497func awsRestjson1_deserializeDocumentTcpRetryPolicyEvents(v *[]types.TcpRetryPolicyEvent, value interface{}) error { 10498 if v == nil { 10499 return fmt.Errorf("unexpected nil of type %T", v) 10500 } 10501 if value == nil { 10502 return nil 10503 } 10504 10505 shape, ok := value.([]interface{}) 10506 if !ok { 10507 return fmt.Errorf("unexpected JSON type %v", value) 10508 } 10509 10510 var cv []types.TcpRetryPolicyEvent 10511 if *v == nil { 10512 cv = []types.TcpRetryPolicyEvent{} 10513 } else { 10514 cv = *v 10515 } 10516 10517 for _, value := range shape { 10518 var col types.TcpRetryPolicyEvent 10519 if value != nil { 10520 jtv, ok := value.(string) 10521 if !ok { 10522 return fmt.Errorf("expected TcpRetryPolicyEvent to be of type string, got %T instead", value) 10523 } 10524 col = types.TcpRetryPolicyEvent(jtv) 10525 } 10526 cv = append(cv, col) 10527 10528 } 10529 *v = cv 10530 return nil 10531} 10532 10533func awsRestjson1_deserializeDocumentTcpRoute(v **types.TcpRoute, value interface{}) error { 10534 if v == nil { 10535 return fmt.Errorf("unexpected nil of type %T", v) 10536 } 10537 if value == nil { 10538 return nil 10539 } 10540 10541 shape, ok := value.(map[string]interface{}) 10542 if !ok { 10543 return fmt.Errorf("unexpected JSON type %v", value) 10544 } 10545 10546 var sv *types.TcpRoute 10547 if *v == nil { 10548 sv = &types.TcpRoute{} 10549 } else { 10550 sv = *v 10551 } 10552 10553 for key, value := range shape { 10554 switch key { 10555 case "action": 10556 if err := awsRestjson1_deserializeDocumentTcpRouteAction(&sv.Action, value); err != nil { 10557 return err 10558 } 10559 10560 case "timeout": 10561 if err := awsRestjson1_deserializeDocumentTcpTimeout(&sv.Timeout, value); err != nil { 10562 return err 10563 } 10564 10565 default: 10566 _, _ = key, value 10567 10568 } 10569 } 10570 *v = sv 10571 return nil 10572} 10573 10574func awsRestjson1_deserializeDocumentTcpRouteAction(v **types.TcpRouteAction, value interface{}) error { 10575 if v == nil { 10576 return fmt.Errorf("unexpected nil of type %T", v) 10577 } 10578 if value == nil { 10579 return nil 10580 } 10581 10582 shape, ok := value.(map[string]interface{}) 10583 if !ok { 10584 return fmt.Errorf("unexpected JSON type %v", value) 10585 } 10586 10587 var sv *types.TcpRouteAction 10588 if *v == nil { 10589 sv = &types.TcpRouteAction{} 10590 } else { 10591 sv = *v 10592 } 10593 10594 for key, value := range shape { 10595 switch key { 10596 case "weightedTargets": 10597 if err := awsRestjson1_deserializeDocumentWeightedTargets(&sv.WeightedTargets, value); err != nil { 10598 return err 10599 } 10600 10601 default: 10602 _, _ = key, value 10603 10604 } 10605 } 10606 *v = sv 10607 return nil 10608} 10609 10610func awsRestjson1_deserializeDocumentTcpTimeout(v **types.TcpTimeout, value interface{}) error { 10611 if v == nil { 10612 return fmt.Errorf("unexpected nil of type %T", v) 10613 } 10614 if value == nil { 10615 return nil 10616 } 10617 10618 shape, ok := value.(map[string]interface{}) 10619 if !ok { 10620 return fmt.Errorf("unexpected JSON type %v", value) 10621 } 10622 10623 var sv *types.TcpTimeout 10624 if *v == nil { 10625 sv = &types.TcpTimeout{} 10626 } else { 10627 sv = *v 10628 } 10629 10630 for key, value := range shape { 10631 switch key { 10632 case "idle": 10633 if err := awsRestjson1_deserializeDocumentDuration(&sv.Idle, value); err != nil { 10634 return err 10635 } 10636 10637 default: 10638 _, _ = key, value 10639 10640 } 10641 } 10642 *v = sv 10643 return nil 10644} 10645 10646func awsRestjson1_deserializeDocumentTlsValidationContext(v **types.TlsValidationContext, value interface{}) error { 10647 if v == nil { 10648 return fmt.Errorf("unexpected nil of type %T", v) 10649 } 10650 if value == nil { 10651 return nil 10652 } 10653 10654 shape, ok := value.(map[string]interface{}) 10655 if !ok { 10656 return fmt.Errorf("unexpected JSON type %v", value) 10657 } 10658 10659 var sv *types.TlsValidationContext 10660 if *v == nil { 10661 sv = &types.TlsValidationContext{} 10662 } else { 10663 sv = *v 10664 } 10665 10666 for key, value := range shape { 10667 switch key { 10668 case "trust": 10669 if err := awsRestjson1_deserializeDocumentTlsValidationContextTrust(&sv.Trust, value); err != nil { 10670 return err 10671 } 10672 10673 default: 10674 _, _ = key, value 10675 10676 } 10677 } 10678 *v = sv 10679 return nil 10680} 10681 10682func awsRestjson1_deserializeDocumentTlsValidationContextAcmTrust(v **types.TlsValidationContextAcmTrust, value interface{}) error { 10683 if v == nil { 10684 return fmt.Errorf("unexpected nil of type %T", v) 10685 } 10686 if value == nil { 10687 return nil 10688 } 10689 10690 shape, ok := value.(map[string]interface{}) 10691 if !ok { 10692 return fmt.Errorf("unexpected JSON type %v", value) 10693 } 10694 10695 var sv *types.TlsValidationContextAcmTrust 10696 if *v == nil { 10697 sv = &types.TlsValidationContextAcmTrust{} 10698 } else { 10699 sv = *v 10700 } 10701 10702 for key, value := range shape { 10703 switch key { 10704 case "certificateAuthorityArns": 10705 if err := awsRestjson1_deserializeDocumentCertificateAuthorityArns(&sv.CertificateAuthorityArns, value); err != nil { 10706 return err 10707 } 10708 10709 default: 10710 _, _ = key, value 10711 10712 } 10713 } 10714 *v = sv 10715 return nil 10716} 10717 10718func awsRestjson1_deserializeDocumentTlsValidationContextFileTrust(v **types.TlsValidationContextFileTrust, value interface{}) error { 10719 if v == nil { 10720 return fmt.Errorf("unexpected nil of type %T", v) 10721 } 10722 if value == nil { 10723 return nil 10724 } 10725 10726 shape, ok := value.(map[string]interface{}) 10727 if !ok { 10728 return fmt.Errorf("unexpected JSON type %v", value) 10729 } 10730 10731 var sv *types.TlsValidationContextFileTrust 10732 if *v == nil { 10733 sv = &types.TlsValidationContextFileTrust{} 10734 } else { 10735 sv = *v 10736 } 10737 10738 for key, value := range shape { 10739 switch key { 10740 case "certificateChain": 10741 if value != nil { 10742 jtv, ok := value.(string) 10743 if !ok { 10744 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 10745 } 10746 sv.CertificateChain = ptr.String(jtv) 10747 } 10748 10749 default: 10750 _, _ = key, value 10751 10752 } 10753 } 10754 *v = sv 10755 return nil 10756} 10757 10758func awsRestjson1_deserializeDocumentTlsValidationContextTrust(v *types.TlsValidationContextTrust, value interface{}) error { 10759 if v == nil { 10760 return fmt.Errorf("unexpected nil of type %T", v) 10761 } 10762 if value == nil { 10763 return nil 10764 } 10765 10766 shape, ok := value.(map[string]interface{}) 10767 if !ok { 10768 return fmt.Errorf("unexpected JSON type %v", value) 10769 } 10770 10771 var uv types.TlsValidationContextTrust 10772loop: 10773 for key, value := range shape { 10774 switch key { 10775 case "acm": 10776 var mv types.TlsValidationContextAcmTrust 10777 destAddr := &mv 10778 if err := awsRestjson1_deserializeDocumentTlsValidationContextAcmTrust(&destAddr, value); err != nil { 10779 return err 10780 } 10781 mv = *destAddr 10782 uv = &types.TlsValidationContextTrustMemberAcm{Value: mv} 10783 break loop 10784 10785 case "file": 10786 var mv types.TlsValidationContextFileTrust 10787 destAddr := &mv 10788 if err := awsRestjson1_deserializeDocumentTlsValidationContextFileTrust(&destAddr, value); err != nil { 10789 return err 10790 } 10791 mv = *destAddr 10792 uv = &types.TlsValidationContextTrustMemberFile{Value: mv} 10793 break loop 10794 10795 default: 10796 uv = &types.UnknownUnionMember{Tag: key} 10797 break loop 10798 10799 } 10800 } 10801 *v = uv 10802 return nil 10803} 10804 10805func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 10806 if v == nil { 10807 return fmt.Errorf("unexpected nil of type %T", v) 10808 } 10809 if value == nil { 10810 return nil 10811 } 10812 10813 shape, ok := value.(map[string]interface{}) 10814 if !ok { 10815 return fmt.Errorf("unexpected JSON type %v", value) 10816 } 10817 10818 var sv *types.TooManyRequestsException 10819 if *v == nil { 10820 sv = &types.TooManyRequestsException{} 10821 } else { 10822 sv = *v 10823 } 10824 10825 for key, value := range shape { 10826 switch key { 10827 case "message": 10828 if value != nil { 10829 jtv, ok := value.(string) 10830 if !ok { 10831 return fmt.Errorf("expected String to be of type string, got %T instead", value) 10832 } 10833 sv.Message = ptr.String(jtv) 10834 } 10835 10836 default: 10837 _, _ = key, value 10838 10839 } 10840 } 10841 *v = sv 10842 return nil 10843} 10844 10845func awsRestjson1_deserializeDocumentTooManyTagsException(v **types.TooManyTagsException, value interface{}) error { 10846 if v == nil { 10847 return fmt.Errorf("unexpected nil of type %T", v) 10848 } 10849 if value == nil { 10850 return nil 10851 } 10852 10853 shape, ok := value.(map[string]interface{}) 10854 if !ok { 10855 return fmt.Errorf("unexpected JSON type %v", value) 10856 } 10857 10858 var sv *types.TooManyTagsException 10859 if *v == nil { 10860 sv = &types.TooManyTagsException{} 10861 } else { 10862 sv = *v 10863 } 10864 10865 for key, value := range shape { 10866 switch key { 10867 case "message": 10868 if value != nil { 10869 jtv, ok := value.(string) 10870 if !ok { 10871 return fmt.Errorf("expected String to be of type string, got %T instead", value) 10872 } 10873 sv.Message = ptr.String(jtv) 10874 } 10875 10876 default: 10877 _, _ = key, value 10878 10879 } 10880 } 10881 *v = sv 10882 return nil 10883} 10884 10885func awsRestjson1_deserializeDocumentVirtualGatewayAccessLog(v *types.VirtualGatewayAccessLog, value interface{}) error { 10886 if v == nil { 10887 return fmt.Errorf("unexpected nil of type %T", v) 10888 } 10889 if value == nil { 10890 return nil 10891 } 10892 10893 shape, ok := value.(map[string]interface{}) 10894 if !ok { 10895 return fmt.Errorf("unexpected JSON type %v", value) 10896 } 10897 10898 var uv types.VirtualGatewayAccessLog 10899loop: 10900 for key, value := range shape { 10901 switch key { 10902 case "file": 10903 var mv types.VirtualGatewayFileAccessLog 10904 destAddr := &mv 10905 if err := awsRestjson1_deserializeDocumentVirtualGatewayFileAccessLog(&destAddr, value); err != nil { 10906 return err 10907 } 10908 mv = *destAddr 10909 uv = &types.VirtualGatewayAccessLogMemberFile{Value: mv} 10910 break loop 10911 10912 default: 10913 uv = &types.UnknownUnionMember{Tag: key} 10914 break loop 10915 10916 } 10917 } 10918 *v = uv 10919 return nil 10920} 10921 10922func awsRestjson1_deserializeDocumentVirtualGatewayBackendDefaults(v **types.VirtualGatewayBackendDefaults, value interface{}) error { 10923 if v == nil { 10924 return fmt.Errorf("unexpected nil of type %T", v) 10925 } 10926 if value == nil { 10927 return nil 10928 } 10929 10930 shape, ok := value.(map[string]interface{}) 10931 if !ok { 10932 return fmt.Errorf("unexpected JSON type %v", value) 10933 } 10934 10935 var sv *types.VirtualGatewayBackendDefaults 10936 if *v == nil { 10937 sv = &types.VirtualGatewayBackendDefaults{} 10938 } else { 10939 sv = *v 10940 } 10941 10942 for key, value := range shape { 10943 switch key { 10944 case "clientPolicy": 10945 if err := awsRestjson1_deserializeDocumentVirtualGatewayClientPolicy(&sv.ClientPolicy, value); err != nil { 10946 return err 10947 } 10948 10949 default: 10950 _, _ = key, value 10951 10952 } 10953 } 10954 *v = sv 10955 return nil 10956} 10957 10958func awsRestjson1_deserializeDocumentVirtualGatewayCertificateAuthorityArns(v *[]string, value interface{}) error { 10959 if v == nil { 10960 return fmt.Errorf("unexpected nil of type %T", v) 10961 } 10962 if value == nil { 10963 return nil 10964 } 10965 10966 shape, ok := value.([]interface{}) 10967 if !ok { 10968 return fmt.Errorf("unexpected JSON type %v", value) 10969 } 10970 10971 var cv []string 10972 if *v == nil { 10973 cv = []string{} 10974 } else { 10975 cv = *v 10976 } 10977 10978 for _, value := range shape { 10979 var col string 10980 if value != nil { 10981 jtv, ok := value.(string) 10982 if !ok { 10983 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 10984 } 10985 col = jtv 10986 } 10987 cv = append(cv, col) 10988 10989 } 10990 *v = cv 10991 return nil 10992} 10993 10994func awsRestjson1_deserializeDocumentVirtualGatewayClientPolicy(v **types.VirtualGatewayClientPolicy, value interface{}) error { 10995 if v == nil { 10996 return fmt.Errorf("unexpected nil of type %T", v) 10997 } 10998 if value == nil { 10999 return nil 11000 } 11001 11002 shape, ok := value.(map[string]interface{}) 11003 if !ok { 11004 return fmt.Errorf("unexpected JSON type %v", value) 11005 } 11006 11007 var sv *types.VirtualGatewayClientPolicy 11008 if *v == nil { 11009 sv = &types.VirtualGatewayClientPolicy{} 11010 } else { 11011 sv = *v 11012 } 11013 11014 for key, value := range shape { 11015 switch key { 11016 case "tls": 11017 if err := awsRestjson1_deserializeDocumentVirtualGatewayClientPolicyTls(&sv.Tls, value); err != nil { 11018 return err 11019 } 11020 11021 default: 11022 _, _ = key, value 11023 11024 } 11025 } 11026 *v = sv 11027 return nil 11028} 11029 11030func awsRestjson1_deserializeDocumentVirtualGatewayClientPolicyTls(v **types.VirtualGatewayClientPolicyTls, value interface{}) error { 11031 if v == nil { 11032 return fmt.Errorf("unexpected nil of type %T", v) 11033 } 11034 if value == nil { 11035 return nil 11036 } 11037 11038 shape, ok := value.(map[string]interface{}) 11039 if !ok { 11040 return fmt.Errorf("unexpected JSON type %v", value) 11041 } 11042 11043 var sv *types.VirtualGatewayClientPolicyTls 11044 if *v == nil { 11045 sv = &types.VirtualGatewayClientPolicyTls{} 11046 } else { 11047 sv = *v 11048 } 11049 11050 for key, value := range shape { 11051 switch key { 11052 case "enforce": 11053 if value != nil { 11054 jtv, ok := value.(bool) 11055 if !ok { 11056 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 11057 } 11058 sv.Enforce = ptr.Bool(jtv) 11059 } 11060 11061 case "ports": 11062 if err := awsRestjson1_deserializeDocumentPortSet(&sv.Ports, value); err != nil { 11063 return err 11064 } 11065 11066 case "validation": 11067 if err := awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContext(&sv.Validation, value); err != nil { 11068 return err 11069 } 11070 11071 default: 11072 _, _ = key, value 11073 11074 } 11075 } 11076 *v = sv 11077 return nil 11078} 11079 11080func awsRestjson1_deserializeDocumentVirtualGatewayData(v **types.VirtualGatewayData, value interface{}) error { 11081 if v == nil { 11082 return fmt.Errorf("unexpected nil of type %T", v) 11083 } 11084 if value == nil { 11085 return nil 11086 } 11087 11088 shape, ok := value.(map[string]interface{}) 11089 if !ok { 11090 return fmt.Errorf("unexpected JSON type %v", value) 11091 } 11092 11093 var sv *types.VirtualGatewayData 11094 if *v == nil { 11095 sv = &types.VirtualGatewayData{} 11096 } else { 11097 sv = *v 11098 } 11099 11100 for key, value := range shape { 11101 switch key { 11102 case "meshName": 11103 if value != nil { 11104 jtv, ok := value.(string) 11105 if !ok { 11106 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 11107 } 11108 sv.MeshName = ptr.String(jtv) 11109 } 11110 11111 case "metadata": 11112 if err := awsRestjson1_deserializeDocumentResourceMetadata(&sv.Metadata, value); err != nil { 11113 return err 11114 } 11115 11116 case "spec": 11117 if err := awsRestjson1_deserializeDocumentVirtualGatewaySpec(&sv.Spec, value); err != nil { 11118 return err 11119 } 11120 11121 case "status": 11122 if err := awsRestjson1_deserializeDocumentVirtualGatewayStatus(&sv.Status, value); err != nil { 11123 return err 11124 } 11125 11126 case "virtualGatewayName": 11127 if value != nil { 11128 jtv, ok := value.(string) 11129 if !ok { 11130 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 11131 } 11132 sv.VirtualGatewayName = ptr.String(jtv) 11133 } 11134 11135 default: 11136 _, _ = key, value 11137 11138 } 11139 } 11140 *v = sv 11141 return nil 11142} 11143 11144func awsRestjson1_deserializeDocumentVirtualGatewayFileAccessLog(v **types.VirtualGatewayFileAccessLog, value interface{}) error { 11145 if v == nil { 11146 return fmt.Errorf("unexpected nil of type %T", v) 11147 } 11148 if value == nil { 11149 return nil 11150 } 11151 11152 shape, ok := value.(map[string]interface{}) 11153 if !ok { 11154 return fmt.Errorf("unexpected JSON type %v", value) 11155 } 11156 11157 var sv *types.VirtualGatewayFileAccessLog 11158 if *v == nil { 11159 sv = &types.VirtualGatewayFileAccessLog{} 11160 } else { 11161 sv = *v 11162 } 11163 11164 for key, value := range shape { 11165 switch key { 11166 case "path": 11167 if value != nil { 11168 jtv, ok := value.(string) 11169 if !ok { 11170 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 11171 } 11172 sv.Path = ptr.String(jtv) 11173 } 11174 11175 default: 11176 _, _ = key, value 11177 11178 } 11179 } 11180 *v = sv 11181 return nil 11182} 11183 11184func awsRestjson1_deserializeDocumentVirtualGatewayHealthCheckPolicy(v **types.VirtualGatewayHealthCheckPolicy, value interface{}) error { 11185 if v == nil { 11186 return fmt.Errorf("unexpected nil of type %T", v) 11187 } 11188 if value == nil { 11189 return nil 11190 } 11191 11192 shape, ok := value.(map[string]interface{}) 11193 if !ok { 11194 return fmt.Errorf("unexpected JSON type %v", value) 11195 } 11196 11197 var sv *types.VirtualGatewayHealthCheckPolicy 11198 if *v == nil { 11199 sv = &types.VirtualGatewayHealthCheckPolicy{} 11200 } else { 11201 sv = *v 11202 } 11203 11204 for key, value := range shape { 11205 switch key { 11206 case "healthyThreshold": 11207 if value != nil { 11208 jtv, ok := value.(json.Number) 11209 if !ok { 11210 return fmt.Errorf("expected VirtualGatewayHealthCheckThreshold to be json.Number, got %T instead", value) 11211 } 11212 i64, err := jtv.Int64() 11213 if err != nil { 11214 return err 11215 } 11216 sv.HealthyThreshold = int32(i64) 11217 } 11218 11219 case "intervalMillis": 11220 if value != nil { 11221 jtv, ok := value.(json.Number) 11222 if !ok { 11223 return fmt.Errorf("expected VirtualGatewayHealthCheckIntervalMillis to be json.Number, got %T instead", value) 11224 } 11225 i64, err := jtv.Int64() 11226 if err != nil { 11227 return err 11228 } 11229 sv.IntervalMillis = ptr.Int64(i64) 11230 } 11231 11232 case "path": 11233 if value != nil { 11234 jtv, ok := value.(string) 11235 if !ok { 11236 return fmt.Errorf("expected String to be of type string, got %T instead", value) 11237 } 11238 sv.Path = ptr.String(jtv) 11239 } 11240 11241 case "port": 11242 if value != nil { 11243 jtv, ok := value.(json.Number) 11244 if !ok { 11245 return fmt.Errorf("expected PortNumber to be json.Number, got %T instead", value) 11246 } 11247 i64, err := jtv.Int64() 11248 if err != nil { 11249 return err 11250 } 11251 sv.Port = int32(i64) 11252 } 11253 11254 case "protocol": 11255 if value != nil { 11256 jtv, ok := value.(string) 11257 if !ok { 11258 return fmt.Errorf("expected VirtualGatewayPortProtocol to be of type string, got %T instead", value) 11259 } 11260 sv.Protocol = types.VirtualGatewayPortProtocol(jtv) 11261 } 11262 11263 case "timeoutMillis": 11264 if value != nil { 11265 jtv, ok := value.(json.Number) 11266 if !ok { 11267 return fmt.Errorf("expected VirtualGatewayHealthCheckTimeoutMillis to be json.Number, got %T instead", value) 11268 } 11269 i64, err := jtv.Int64() 11270 if err != nil { 11271 return err 11272 } 11273 sv.TimeoutMillis = ptr.Int64(i64) 11274 } 11275 11276 case "unhealthyThreshold": 11277 if value != nil { 11278 jtv, ok := value.(json.Number) 11279 if !ok { 11280 return fmt.Errorf("expected VirtualGatewayHealthCheckThreshold to be json.Number, got %T instead", value) 11281 } 11282 i64, err := jtv.Int64() 11283 if err != nil { 11284 return err 11285 } 11286 sv.UnhealthyThreshold = int32(i64) 11287 } 11288 11289 default: 11290 _, _ = key, value 11291 11292 } 11293 } 11294 *v = sv 11295 return nil 11296} 11297 11298func awsRestjson1_deserializeDocumentVirtualGatewayList(v *[]types.VirtualGatewayRef, value interface{}) error { 11299 if v == nil { 11300 return fmt.Errorf("unexpected nil of type %T", v) 11301 } 11302 if value == nil { 11303 return nil 11304 } 11305 11306 shape, ok := value.([]interface{}) 11307 if !ok { 11308 return fmt.Errorf("unexpected JSON type %v", value) 11309 } 11310 11311 var cv []types.VirtualGatewayRef 11312 if *v == nil { 11313 cv = []types.VirtualGatewayRef{} 11314 } else { 11315 cv = *v 11316 } 11317 11318 for _, value := range shape { 11319 var col types.VirtualGatewayRef 11320 destAddr := &col 11321 if err := awsRestjson1_deserializeDocumentVirtualGatewayRef(&destAddr, value); err != nil { 11322 return err 11323 } 11324 col = *destAddr 11325 cv = append(cv, col) 11326 11327 } 11328 *v = cv 11329 return nil 11330} 11331 11332func awsRestjson1_deserializeDocumentVirtualGatewayListener(v **types.VirtualGatewayListener, value interface{}) error { 11333 if v == nil { 11334 return fmt.Errorf("unexpected nil of type %T", v) 11335 } 11336 if value == nil { 11337 return nil 11338 } 11339 11340 shape, ok := value.(map[string]interface{}) 11341 if !ok { 11342 return fmt.Errorf("unexpected JSON type %v", value) 11343 } 11344 11345 var sv *types.VirtualGatewayListener 11346 if *v == nil { 11347 sv = &types.VirtualGatewayListener{} 11348 } else { 11349 sv = *v 11350 } 11351 11352 for key, value := range shape { 11353 switch key { 11354 case "healthCheck": 11355 if err := awsRestjson1_deserializeDocumentVirtualGatewayHealthCheckPolicy(&sv.HealthCheck, value); err != nil { 11356 return err 11357 } 11358 11359 case "portMapping": 11360 if err := awsRestjson1_deserializeDocumentVirtualGatewayPortMapping(&sv.PortMapping, value); err != nil { 11361 return err 11362 } 11363 11364 case "tls": 11365 if err := awsRestjson1_deserializeDocumentVirtualGatewayListenerTls(&sv.Tls, value); err != nil { 11366 return err 11367 } 11368 11369 default: 11370 _, _ = key, value 11371 11372 } 11373 } 11374 *v = sv 11375 return nil 11376} 11377 11378func awsRestjson1_deserializeDocumentVirtualGatewayListeners(v *[]types.VirtualGatewayListener, value interface{}) error { 11379 if v == nil { 11380 return fmt.Errorf("unexpected nil of type %T", v) 11381 } 11382 if value == nil { 11383 return nil 11384 } 11385 11386 shape, ok := value.([]interface{}) 11387 if !ok { 11388 return fmt.Errorf("unexpected JSON type %v", value) 11389 } 11390 11391 var cv []types.VirtualGatewayListener 11392 if *v == nil { 11393 cv = []types.VirtualGatewayListener{} 11394 } else { 11395 cv = *v 11396 } 11397 11398 for _, value := range shape { 11399 var col types.VirtualGatewayListener 11400 destAddr := &col 11401 if err := awsRestjson1_deserializeDocumentVirtualGatewayListener(&destAddr, value); err != nil { 11402 return err 11403 } 11404 col = *destAddr 11405 cv = append(cv, col) 11406 11407 } 11408 *v = cv 11409 return nil 11410} 11411 11412func awsRestjson1_deserializeDocumentVirtualGatewayListenerTls(v **types.VirtualGatewayListenerTls, value interface{}) error { 11413 if v == nil { 11414 return fmt.Errorf("unexpected nil of type %T", v) 11415 } 11416 if value == nil { 11417 return nil 11418 } 11419 11420 shape, ok := value.(map[string]interface{}) 11421 if !ok { 11422 return fmt.Errorf("unexpected JSON type %v", value) 11423 } 11424 11425 var sv *types.VirtualGatewayListenerTls 11426 if *v == nil { 11427 sv = &types.VirtualGatewayListenerTls{} 11428 } else { 11429 sv = *v 11430 } 11431 11432 for key, value := range shape { 11433 switch key { 11434 case "certificate": 11435 if err := awsRestjson1_deserializeDocumentVirtualGatewayListenerTlsCertificate(&sv.Certificate, value); err != nil { 11436 return err 11437 } 11438 11439 case "mode": 11440 if value != nil { 11441 jtv, ok := value.(string) 11442 if !ok { 11443 return fmt.Errorf("expected VirtualGatewayListenerTlsMode to be of type string, got %T instead", value) 11444 } 11445 sv.Mode = types.VirtualGatewayListenerTlsMode(jtv) 11446 } 11447 11448 default: 11449 _, _ = key, value 11450 11451 } 11452 } 11453 *v = sv 11454 return nil 11455} 11456 11457func awsRestjson1_deserializeDocumentVirtualGatewayListenerTlsAcmCertificate(v **types.VirtualGatewayListenerTlsAcmCertificate, value interface{}) error { 11458 if v == nil { 11459 return fmt.Errorf("unexpected nil of type %T", v) 11460 } 11461 if value == nil { 11462 return nil 11463 } 11464 11465 shape, ok := value.(map[string]interface{}) 11466 if !ok { 11467 return fmt.Errorf("unexpected JSON type %v", value) 11468 } 11469 11470 var sv *types.VirtualGatewayListenerTlsAcmCertificate 11471 if *v == nil { 11472 sv = &types.VirtualGatewayListenerTlsAcmCertificate{} 11473 } else { 11474 sv = *v 11475 } 11476 11477 for key, value := range shape { 11478 switch key { 11479 case "certificateArn": 11480 if value != nil { 11481 jtv, ok := value.(string) 11482 if !ok { 11483 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11484 } 11485 sv.CertificateArn = ptr.String(jtv) 11486 } 11487 11488 default: 11489 _, _ = key, value 11490 11491 } 11492 } 11493 *v = sv 11494 return nil 11495} 11496 11497func awsRestjson1_deserializeDocumentVirtualGatewayListenerTlsCertificate(v *types.VirtualGatewayListenerTlsCertificate, value interface{}) error { 11498 if v == nil { 11499 return fmt.Errorf("unexpected nil of type %T", v) 11500 } 11501 if value == nil { 11502 return nil 11503 } 11504 11505 shape, ok := value.(map[string]interface{}) 11506 if !ok { 11507 return fmt.Errorf("unexpected JSON type %v", value) 11508 } 11509 11510 var uv types.VirtualGatewayListenerTlsCertificate 11511loop: 11512 for key, value := range shape { 11513 switch key { 11514 case "acm": 11515 var mv types.VirtualGatewayListenerTlsAcmCertificate 11516 destAddr := &mv 11517 if err := awsRestjson1_deserializeDocumentVirtualGatewayListenerTlsAcmCertificate(&destAddr, value); err != nil { 11518 return err 11519 } 11520 mv = *destAddr 11521 uv = &types.VirtualGatewayListenerTlsCertificateMemberAcm{Value: mv} 11522 break loop 11523 11524 case "file": 11525 var mv types.VirtualGatewayListenerTlsFileCertificate 11526 destAddr := &mv 11527 if err := awsRestjson1_deserializeDocumentVirtualGatewayListenerTlsFileCertificate(&destAddr, value); err != nil { 11528 return err 11529 } 11530 mv = *destAddr 11531 uv = &types.VirtualGatewayListenerTlsCertificateMemberFile{Value: mv} 11532 break loop 11533 11534 default: 11535 uv = &types.UnknownUnionMember{Tag: key} 11536 break loop 11537 11538 } 11539 } 11540 *v = uv 11541 return nil 11542} 11543 11544func awsRestjson1_deserializeDocumentVirtualGatewayListenerTlsFileCertificate(v **types.VirtualGatewayListenerTlsFileCertificate, value interface{}) error { 11545 if v == nil { 11546 return fmt.Errorf("unexpected nil of type %T", v) 11547 } 11548 if value == nil { 11549 return nil 11550 } 11551 11552 shape, ok := value.(map[string]interface{}) 11553 if !ok { 11554 return fmt.Errorf("unexpected JSON type %v", value) 11555 } 11556 11557 var sv *types.VirtualGatewayListenerTlsFileCertificate 11558 if *v == nil { 11559 sv = &types.VirtualGatewayListenerTlsFileCertificate{} 11560 } else { 11561 sv = *v 11562 } 11563 11564 for key, value := range shape { 11565 switch key { 11566 case "certificateChain": 11567 if value != nil { 11568 jtv, ok := value.(string) 11569 if !ok { 11570 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 11571 } 11572 sv.CertificateChain = ptr.String(jtv) 11573 } 11574 11575 case "privateKey": 11576 if value != nil { 11577 jtv, ok := value.(string) 11578 if !ok { 11579 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 11580 } 11581 sv.PrivateKey = ptr.String(jtv) 11582 } 11583 11584 default: 11585 _, _ = key, value 11586 11587 } 11588 } 11589 *v = sv 11590 return nil 11591} 11592 11593func awsRestjson1_deserializeDocumentVirtualGatewayLogging(v **types.VirtualGatewayLogging, value interface{}) error { 11594 if v == nil { 11595 return fmt.Errorf("unexpected nil of type %T", v) 11596 } 11597 if value == nil { 11598 return nil 11599 } 11600 11601 shape, ok := value.(map[string]interface{}) 11602 if !ok { 11603 return fmt.Errorf("unexpected JSON type %v", value) 11604 } 11605 11606 var sv *types.VirtualGatewayLogging 11607 if *v == nil { 11608 sv = &types.VirtualGatewayLogging{} 11609 } else { 11610 sv = *v 11611 } 11612 11613 for key, value := range shape { 11614 switch key { 11615 case "accessLog": 11616 if err := awsRestjson1_deserializeDocumentVirtualGatewayAccessLog(&sv.AccessLog, value); err != nil { 11617 return err 11618 } 11619 11620 default: 11621 _, _ = key, value 11622 11623 } 11624 } 11625 *v = sv 11626 return nil 11627} 11628 11629func awsRestjson1_deserializeDocumentVirtualGatewayPortMapping(v **types.VirtualGatewayPortMapping, value interface{}) error { 11630 if v == nil { 11631 return fmt.Errorf("unexpected nil of type %T", v) 11632 } 11633 if value == nil { 11634 return nil 11635 } 11636 11637 shape, ok := value.(map[string]interface{}) 11638 if !ok { 11639 return fmt.Errorf("unexpected JSON type %v", value) 11640 } 11641 11642 var sv *types.VirtualGatewayPortMapping 11643 if *v == nil { 11644 sv = &types.VirtualGatewayPortMapping{} 11645 } else { 11646 sv = *v 11647 } 11648 11649 for key, value := range shape { 11650 switch key { 11651 case "port": 11652 if value != nil { 11653 jtv, ok := value.(json.Number) 11654 if !ok { 11655 return fmt.Errorf("expected PortNumber to be json.Number, got %T instead", value) 11656 } 11657 i64, err := jtv.Int64() 11658 if err != nil { 11659 return err 11660 } 11661 sv.Port = int32(i64) 11662 } 11663 11664 case "protocol": 11665 if value != nil { 11666 jtv, ok := value.(string) 11667 if !ok { 11668 return fmt.Errorf("expected VirtualGatewayPortProtocol to be of type string, got %T instead", value) 11669 } 11670 sv.Protocol = types.VirtualGatewayPortProtocol(jtv) 11671 } 11672 11673 default: 11674 _, _ = key, value 11675 11676 } 11677 } 11678 *v = sv 11679 return nil 11680} 11681 11682func awsRestjson1_deserializeDocumentVirtualGatewayRef(v **types.VirtualGatewayRef, value interface{}) error { 11683 if v == nil { 11684 return fmt.Errorf("unexpected nil of type %T", v) 11685 } 11686 if value == nil { 11687 return nil 11688 } 11689 11690 shape, ok := value.(map[string]interface{}) 11691 if !ok { 11692 return fmt.Errorf("unexpected JSON type %v", value) 11693 } 11694 11695 var sv *types.VirtualGatewayRef 11696 if *v == nil { 11697 sv = &types.VirtualGatewayRef{} 11698 } else { 11699 sv = *v 11700 } 11701 11702 for key, value := range shape { 11703 switch key { 11704 case "arn": 11705 if value != nil { 11706 jtv, ok := value.(string) 11707 if !ok { 11708 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11709 } 11710 sv.Arn = ptr.String(jtv) 11711 } 11712 11713 case "createdAt": 11714 if value != nil { 11715 jtv, ok := value.(json.Number) 11716 if !ok { 11717 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 11718 } 11719 f64, err := jtv.Float64() 11720 if err != nil { 11721 return err 11722 } 11723 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11724 } 11725 11726 case "lastUpdatedAt": 11727 if value != nil { 11728 jtv, ok := value.(json.Number) 11729 if !ok { 11730 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 11731 } 11732 f64, err := jtv.Float64() 11733 if err != nil { 11734 return err 11735 } 11736 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11737 } 11738 11739 case "meshName": 11740 if value != nil { 11741 jtv, ok := value.(string) 11742 if !ok { 11743 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 11744 } 11745 sv.MeshName = ptr.String(jtv) 11746 } 11747 11748 case "meshOwner": 11749 if value != nil { 11750 jtv, ok := value.(string) 11751 if !ok { 11752 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 11753 } 11754 sv.MeshOwner = ptr.String(jtv) 11755 } 11756 11757 case "resourceOwner": 11758 if value != nil { 11759 jtv, ok := value.(string) 11760 if !ok { 11761 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 11762 } 11763 sv.ResourceOwner = ptr.String(jtv) 11764 } 11765 11766 case "version": 11767 if value != nil { 11768 jtv, ok := value.(json.Number) 11769 if !ok { 11770 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 11771 } 11772 i64, err := jtv.Int64() 11773 if err != nil { 11774 return err 11775 } 11776 sv.Version = ptr.Int64(i64) 11777 } 11778 11779 case "virtualGatewayName": 11780 if value != nil { 11781 jtv, ok := value.(string) 11782 if !ok { 11783 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 11784 } 11785 sv.VirtualGatewayName = ptr.String(jtv) 11786 } 11787 11788 default: 11789 _, _ = key, value 11790 11791 } 11792 } 11793 *v = sv 11794 return nil 11795} 11796 11797func awsRestjson1_deserializeDocumentVirtualGatewaySpec(v **types.VirtualGatewaySpec, value interface{}) error { 11798 if v == nil { 11799 return fmt.Errorf("unexpected nil of type %T", v) 11800 } 11801 if value == nil { 11802 return nil 11803 } 11804 11805 shape, ok := value.(map[string]interface{}) 11806 if !ok { 11807 return fmt.Errorf("unexpected JSON type %v", value) 11808 } 11809 11810 var sv *types.VirtualGatewaySpec 11811 if *v == nil { 11812 sv = &types.VirtualGatewaySpec{} 11813 } else { 11814 sv = *v 11815 } 11816 11817 for key, value := range shape { 11818 switch key { 11819 case "backendDefaults": 11820 if err := awsRestjson1_deserializeDocumentVirtualGatewayBackendDefaults(&sv.BackendDefaults, value); err != nil { 11821 return err 11822 } 11823 11824 case "listeners": 11825 if err := awsRestjson1_deserializeDocumentVirtualGatewayListeners(&sv.Listeners, value); err != nil { 11826 return err 11827 } 11828 11829 case "logging": 11830 if err := awsRestjson1_deserializeDocumentVirtualGatewayLogging(&sv.Logging, value); err != nil { 11831 return err 11832 } 11833 11834 default: 11835 _, _ = key, value 11836 11837 } 11838 } 11839 *v = sv 11840 return nil 11841} 11842 11843func awsRestjson1_deserializeDocumentVirtualGatewayStatus(v **types.VirtualGatewayStatus, value interface{}) error { 11844 if v == nil { 11845 return fmt.Errorf("unexpected nil of type %T", v) 11846 } 11847 if value == nil { 11848 return nil 11849 } 11850 11851 shape, ok := value.(map[string]interface{}) 11852 if !ok { 11853 return fmt.Errorf("unexpected JSON type %v", value) 11854 } 11855 11856 var sv *types.VirtualGatewayStatus 11857 if *v == nil { 11858 sv = &types.VirtualGatewayStatus{} 11859 } else { 11860 sv = *v 11861 } 11862 11863 for key, value := range shape { 11864 switch key { 11865 case "status": 11866 if value != nil { 11867 jtv, ok := value.(string) 11868 if !ok { 11869 return fmt.Errorf("expected VirtualGatewayStatusCode to be of type string, got %T instead", value) 11870 } 11871 sv.Status = types.VirtualGatewayStatusCode(jtv) 11872 } 11873 11874 default: 11875 _, _ = key, value 11876 11877 } 11878 } 11879 *v = sv 11880 return nil 11881} 11882 11883func awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContext(v **types.VirtualGatewayTlsValidationContext, value interface{}) error { 11884 if v == nil { 11885 return fmt.Errorf("unexpected nil of type %T", v) 11886 } 11887 if value == nil { 11888 return nil 11889 } 11890 11891 shape, ok := value.(map[string]interface{}) 11892 if !ok { 11893 return fmt.Errorf("unexpected JSON type %v", value) 11894 } 11895 11896 var sv *types.VirtualGatewayTlsValidationContext 11897 if *v == nil { 11898 sv = &types.VirtualGatewayTlsValidationContext{} 11899 } else { 11900 sv = *v 11901 } 11902 11903 for key, value := range shape { 11904 switch key { 11905 case "trust": 11906 if err := awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContextTrust(&sv.Trust, value); err != nil { 11907 return err 11908 } 11909 11910 default: 11911 _, _ = key, value 11912 11913 } 11914 } 11915 *v = sv 11916 return nil 11917} 11918 11919func awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContextAcmTrust(v **types.VirtualGatewayTlsValidationContextAcmTrust, value interface{}) error { 11920 if v == nil { 11921 return fmt.Errorf("unexpected nil of type %T", v) 11922 } 11923 if value == nil { 11924 return nil 11925 } 11926 11927 shape, ok := value.(map[string]interface{}) 11928 if !ok { 11929 return fmt.Errorf("unexpected JSON type %v", value) 11930 } 11931 11932 var sv *types.VirtualGatewayTlsValidationContextAcmTrust 11933 if *v == nil { 11934 sv = &types.VirtualGatewayTlsValidationContextAcmTrust{} 11935 } else { 11936 sv = *v 11937 } 11938 11939 for key, value := range shape { 11940 switch key { 11941 case "certificateAuthorityArns": 11942 if err := awsRestjson1_deserializeDocumentVirtualGatewayCertificateAuthorityArns(&sv.CertificateAuthorityArns, value); err != nil { 11943 return err 11944 } 11945 11946 default: 11947 _, _ = key, value 11948 11949 } 11950 } 11951 *v = sv 11952 return nil 11953} 11954 11955func awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContextFileTrust(v **types.VirtualGatewayTlsValidationContextFileTrust, value interface{}) error { 11956 if v == nil { 11957 return fmt.Errorf("unexpected nil of type %T", v) 11958 } 11959 if value == nil { 11960 return nil 11961 } 11962 11963 shape, ok := value.(map[string]interface{}) 11964 if !ok { 11965 return fmt.Errorf("unexpected JSON type %v", value) 11966 } 11967 11968 var sv *types.VirtualGatewayTlsValidationContextFileTrust 11969 if *v == nil { 11970 sv = &types.VirtualGatewayTlsValidationContextFileTrust{} 11971 } else { 11972 sv = *v 11973 } 11974 11975 for key, value := range shape { 11976 switch key { 11977 case "certificateChain": 11978 if value != nil { 11979 jtv, ok := value.(string) 11980 if !ok { 11981 return fmt.Errorf("expected FilePath to be of type string, got %T instead", value) 11982 } 11983 sv.CertificateChain = ptr.String(jtv) 11984 } 11985 11986 default: 11987 _, _ = key, value 11988 11989 } 11990 } 11991 *v = sv 11992 return nil 11993} 11994 11995func awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContextTrust(v *types.VirtualGatewayTlsValidationContextTrust, value interface{}) error { 11996 if v == nil { 11997 return fmt.Errorf("unexpected nil of type %T", v) 11998 } 11999 if value == nil { 12000 return nil 12001 } 12002 12003 shape, ok := value.(map[string]interface{}) 12004 if !ok { 12005 return fmt.Errorf("unexpected JSON type %v", value) 12006 } 12007 12008 var uv types.VirtualGatewayTlsValidationContextTrust 12009loop: 12010 for key, value := range shape { 12011 switch key { 12012 case "acm": 12013 var mv types.VirtualGatewayTlsValidationContextAcmTrust 12014 destAddr := &mv 12015 if err := awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContextAcmTrust(&destAddr, value); err != nil { 12016 return err 12017 } 12018 mv = *destAddr 12019 uv = &types.VirtualGatewayTlsValidationContextTrustMemberAcm{Value: mv} 12020 break loop 12021 12022 case "file": 12023 var mv types.VirtualGatewayTlsValidationContextFileTrust 12024 destAddr := &mv 12025 if err := awsRestjson1_deserializeDocumentVirtualGatewayTlsValidationContextFileTrust(&destAddr, value); err != nil { 12026 return err 12027 } 12028 mv = *destAddr 12029 uv = &types.VirtualGatewayTlsValidationContextTrustMemberFile{Value: mv} 12030 break loop 12031 12032 default: 12033 uv = &types.UnknownUnionMember{Tag: key} 12034 break loop 12035 12036 } 12037 } 12038 *v = uv 12039 return nil 12040} 12041 12042func awsRestjson1_deserializeDocumentVirtualNodeData(v **types.VirtualNodeData, value interface{}) error { 12043 if v == nil { 12044 return fmt.Errorf("unexpected nil of type %T", v) 12045 } 12046 if value == nil { 12047 return nil 12048 } 12049 12050 shape, ok := value.(map[string]interface{}) 12051 if !ok { 12052 return fmt.Errorf("unexpected JSON type %v", value) 12053 } 12054 12055 var sv *types.VirtualNodeData 12056 if *v == nil { 12057 sv = &types.VirtualNodeData{} 12058 } else { 12059 sv = *v 12060 } 12061 12062 for key, value := range shape { 12063 switch key { 12064 case "meshName": 12065 if value != nil { 12066 jtv, ok := value.(string) 12067 if !ok { 12068 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12069 } 12070 sv.MeshName = ptr.String(jtv) 12071 } 12072 12073 case "metadata": 12074 if err := awsRestjson1_deserializeDocumentResourceMetadata(&sv.Metadata, value); err != nil { 12075 return err 12076 } 12077 12078 case "spec": 12079 if err := awsRestjson1_deserializeDocumentVirtualNodeSpec(&sv.Spec, value); err != nil { 12080 return err 12081 } 12082 12083 case "status": 12084 if err := awsRestjson1_deserializeDocumentVirtualNodeStatus(&sv.Status, value); err != nil { 12085 return err 12086 } 12087 12088 case "virtualNodeName": 12089 if value != nil { 12090 jtv, ok := value.(string) 12091 if !ok { 12092 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12093 } 12094 sv.VirtualNodeName = ptr.String(jtv) 12095 } 12096 12097 default: 12098 _, _ = key, value 12099 12100 } 12101 } 12102 *v = sv 12103 return nil 12104} 12105 12106func awsRestjson1_deserializeDocumentVirtualNodeList(v *[]types.VirtualNodeRef, value interface{}) error { 12107 if v == nil { 12108 return fmt.Errorf("unexpected nil of type %T", v) 12109 } 12110 if value == nil { 12111 return nil 12112 } 12113 12114 shape, ok := value.([]interface{}) 12115 if !ok { 12116 return fmt.Errorf("unexpected JSON type %v", value) 12117 } 12118 12119 var cv []types.VirtualNodeRef 12120 if *v == nil { 12121 cv = []types.VirtualNodeRef{} 12122 } else { 12123 cv = *v 12124 } 12125 12126 for _, value := range shape { 12127 var col types.VirtualNodeRef 12128 destAddr := &col 12129 if err := awsRestjson1_deserializeDocumentVirtualNodeRef(&destAddr, value); err != nil { 12130 return err 12131 } 12132 col = *destAddr 12133 cv = append(cv, col) 12134 12135 } 12136 *v = cv 12137 return nil 12138} 12139 12140func awsRestjson1_deserializeDocumentVirtualNodeRef(v **types.VirtualNodeRef, value interface{}) error { 12141 if v == nil { 12142 return fmt.Errorf("unexpected nil of type %T", v) 12143 } 12144 if value == nil { 12145 return nil 12146 } 12147 12148 shape, ok := value.(map[string]interface{}) 12149 if !ok { 12150 return fmt.Errorf("unexpected JSON type %v", value) 12151 } 12152 12153 var sv *types.VirtualNodeRef 12154 if *v == nil { 12155 sv = &types.VirtualNodeRef{} 12156 } else { 12157 sv = *v 12158 } 12159 12160 for key, value := range shape { 12161 switch key { 12162 case "arn": 12163 if value != nil { 12164 jtv, ok := value.(string) 12165 if !ok { 12166 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 12167 } 12168 sv.Arn = ptr.String(jtv) 12169 } 12170 12171 case "createdAt": 12172 if value != nil { 12173 jtv, ok := value.(json.Number) 12174 if !ok { 12175 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 12176 } 12177 f64, err := jtv.Float64() 12178 if err != nil { 12179 return err 12180 } 12181 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12182 } 12183 12184 case "lastUpdatedAt": 12185 if value != nil { 12186 jtv, ok := value.(json.Number) 12187 if !ok { 12188 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 12189 } 12190 f64, err := jtv.Float64() 12191 if err != nil { 12192 return err 12193 } 12194 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12195 } 12196 12197 case "meshName": 12198 if value != nil { 12199 jtv, ok := value.(string) 12200 if !ok { 12201 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12202 } 12203 sv.MeshName = ptr.String(jtv) 12204 } 12205 12206 case "meshOwner": 12207 if value != nil { 12208 jtv, ok := value.(string) 12209 if !ok { 12210 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 12211 } 12212 sv.MeshOwner = ptr.String(jtv) 12213 } 12214 12215 case "resourceOwner": 12216 if value != nil { 12217 jtv, ok := value.(string) 12218 if !ok { 12219 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 12220 } 12221 sv.ResourceOwner = ptr.String(jtv) 12222 } 12223 12224 case "version": 12225 if value != nil { 12226 jtv, ok := value.(json.Number) 12227 if !ok { 12228 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 12229 } 12230 i64, err := jtv.Int64() 12231 if err != nil { 12232 return err 12233 } 12234 sv.Version = ptr.Int64(i64) 12235 } 12236 12237 case "virtualNodeName": 12238 if value != nil { 12239 jtv, ok := value.(string) 12240 if !ok { 12241 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12242 } 12243 sv.VirtualNodeName = ptr.String(jtv) 12244 } 12245 12246 default: 12247 _, _ = key, value 12248 12249 } 12250 } 12251 *v = sv 12252 return nil 12253} 12254 12255func awsRestjson1_deserializeDocumentVirtualNodeServiceProvider(v **types.VirtualNodeServiceProvider, value interface{}) error { 12256 if v == nil { 12257 return fmt.Errorf("unexpected nil of type %T", v) 12258 } 12259 if value == nil { 12260 return nil 12261 } 12262 12263 shape, ok := value.(map[string]interface{}) 12264 if !ok { 12265 return fmt.Errorf("unexpected JSON type %v", value) 12266 } 12267 12268 var sv *types.VirtualNodeServiceProvider 12269 if *v == nil { 12270 sv = &types.VirtualNodeServiceProvider{} 12271 } else { 12272 sv = *v 12273 } 12274 12275 for key, value := range shape { 12276 switch key { 12277 case "virtualNodeName": 12278 if value != nil { 12279 jtv, ok := value.(string) 12280 if !ok { 12281 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12282 } 12283 sv.VirtualNodeName = ptr.String(jtv) 12284 } 12285 12286 default: 12287 _, _ = key, value 12288 12289 } 12290 } 12291 *v = sv 12292 return nil 12293} 12294 12295func awsRestjson1_deserializeDocumentVirtualNodeSpec(v **types.VirtualNodeSpec, value interface{}) error { 12296 if v == nil { 12297 return fmt.Errorf("unexpected nil of type %T", v) 12298 } 12299 if value == nil { 12300 return nil 12301 } 12302 12303 shape, ok := value.(map[string]interface{}) 12304 if !ok { 12305 return fmt.Errorf("unexpected JSON type %v", value) 12306 } 12307 12308 var sv *types.VirtualNodeSpec 12309 if *v == nil { 12310 sv = &types.VirtualNodeSpec{} 12311 } else { 12312 sv = *v 12313 } 12314 12315 for key, value := range shape { 12316 switch key { 12317 case "backendDefaults": 12318 if err := awsRestjson1_deserializeDocumentBackendDefaults(&sv.BackendDefaults, value); err != nil { 12319 return err 12320 } 12321 12322 case "backends": 12323 if err := awsRestjson1_deserializeDocumentBackends(&sv.Backends, value); err != nil { 12324 return err 12325 } 12326 12327 case "listeners": 12328 if err := awsRestjson1_deserializeDocumentListeners(&sv.Listeners, value); err != nil { 12329 return err 12330 } 12331 12332 case "logging": 12333 if err := awsRestjson1_deserializeDocumentLogging(&sv.Logging, value); err != nil { 12334 return err 12335 } 12336 12337 case "serviceDiscovery": 12338 if err := awsRestjson1_deserializeDocumentServiceDiscovery(&sv.ServiceDiscovery, value); err != nil { 12339 return err 12340 } 12341 12342 default: 12343 _, _ = key, value 12344 12345 } 12346 } 12347 *v = sv 12348 return nil 12349} 12350 12351func awsRestjson1_deserializeDocumentVirtualNodeStatus(v **types.VirtualNodeStatus, value interface{}) error { 12352 if v == nil { 12353 return fmt.Errorf("unexpected nil of type %T", v) 12354 } 12355 if value == nil { 12356 return nil 12357 } 12358 12359 shape, ok := value.(map[string]interface{}) 12360 if !ok { 12361 return fmt.Errorf("unexpected JSON type %v", value) 12362 } 12363 12364 var sv *types.VirtualNodeStatus 12365 if *v == nil { 12366 sv = &types.VirtualNodeStatus{} 12367 } else { 12368 sv = *v 12369 } 12370 12371 for key, value := range shape { 12372 switch key { 12373 case "status": 12374 if value != nil { 12375 jtv, ok := value.(string) 12376 if !ok { 12377 return fmt.Errorf("expected VirtualNodeStatusCode to be of type string, got %T instead", value) 12378 } 12379 sv.Status = types.VirtualNodeStatusCode(jtv) 12380 } 12381 12382 default: 12383 _, _ = key, value 12384 12385 } 12386 } 12387 *v = sv 12388 return nil 12389} 12390 12391func awsRestjson1_deserializeDocumentVirtualRouterData(v **types.VirtualRouterData, value interface{}) error { 12392 if v == nil { 12393 return fmt.Errorf("unexpected nil of type %T", v) 12394 } 12395 if value == nil { 12396 return nil 12397 } 12398 12399 shape, ok := value.(map[string]interface{}) 12400 if !ok { 12401 return fmt.Errorf("unexpected JSON type %v", value) 12402 } 12403 12404 var sv *types.VirtualRouterData 12405 if *v == nil { 12406 sv = &types.VirtualRouterData{} 12407 } else { 12408 sv = *v 12409 } 12410 12411 for key, value := range shape { 12412 switch key { 12413 case "meshName": 12414 if value != nil { 12415 jtv, ok := value.(string) 12416 if !ok { 12417 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12418 } 12419 sv.MeshName = ptr.String(jtv) 12420 } 12421 12422 case "metadata": 12423 if err := awsRestjson1_deserializeDocumentResourceMetadata(&sv.Metadata, value); err != nil { 12424 return err 12425 } 12426 12427 case "spec": 12428 if err := awsRestjson1_deserializeDocumentVirtualRouterSpec(&sv.Spec, value); err != nil { 12429 return err 12430 } 12431 12432 case "status": 12433 if err := awsRestjson1_deserializeDocumentVirtualRouterStatus(&sv.Status, value); err != nil { 12434 return err 12435 } 12436 12437 case "virtualRouterName": 12438 if value != nil { 12439 jtv, ok := value.(string) 12440 if !ok { 12441 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12442 } 12443 sv.VirtualRouterName = ptr.String(jtv) 12444 } 12445 12446 default: 12447 _, _ = key, value 12448 12449 } 12450 } 12451 *v = sv 12452 return nil 12453} 12454 12455func awsRestjson1_deserializeDocumentVirtualRouterList(v *[]types.VirtualRouterRef, value interface{}) error { 12456 if v == nil { 12457 return fmt.Errorf("unexpected nil of type %T", v) 12458 } 12459 if value == nil { 12460 return nil 12461 } 12462 12463 shape, ok := value.([]interface{}) 12464 if !ok { 12465 return fmt.Errorf("unexpected JSON type %v", value) 12466 } 12467 12468 var cv []types.VirtualRouterRef 12469 if *v == nil { 12470 cv = []types.VirtualRouterRef{} 12471 } else { 12472 cv = *v 12473 } 12474 12475 for _, value := range shape { 12476 var col types.VirtualRouterRef 12477 destAddr := &col 12478 if err := awsRestjson1_deserializeDocumentVirtualRouterRef(&destAddr, value); err != nil { 12479 return err 12480 } 12481 col = *destAddr 12482 cv = append(cv, col) 12483 12484 } 12485 *v = cv 12486 return nil 12487} 12488 12489func awsRestjson1_deserializeDocumentVirtualRouterListener(v **types.VirtualRouterListener, value interface{}) error { 12490 if v == nil { 12491 return fmt.Errorf("unexpected nil of type %T", v) 12492 } 12493 if value == nil { 12494 return nil 12495 } 12496 12497 shape, ok := value.(map[string]interface{}) 12498 if !ok { 12499 return fmt.Errorf("unexpected JSON type %v", value) 12500 } 12501 12502 var sv *types.VirtualRouterListener 12503 if *v == nil { 12504 sv = &types.VirtualRouterListener{} 12505 } else { 12506 sv = *v 12507 } 12508 12509 for key, value := range shape { 12510 switch key { 12511 case "portMapping": 12512 if err := awsRestjson1_deserializeDocumentPortMapping(&sv.PortMapping, value); err != nil { 12513 return err 12514 } 12515 12516 default: 12517 _, _ = key, value 12518 12519 } 12520 } 12521 *v = sv 12522 return nil 12523} 12524 12525func awsRestjson1_deserializeDocumentVirtualRouterListeners(v *[]types.VirtualRouterListener, value interface{}) error { 12526 if v == nil { 12527 return fmt.Errorf("unexpected nil of type %T", v) 12528 } 12529 if value == nil { 12530 return nil 12531 } 12532 12533 shape, ok := value.([]interface{}) 12534 if !ok { 12535 return fmt.Errorf("unexpected JSON type %v", value) 12536 } 12537 12538 var cv []types.VirtualRouterListener 12539 if *v == nil { 12540 cv = []types.VirtualRouterListener{} 12541 } else { 12542 cv = *v 12543 } 12544 12545 for _, value := range shape { 12546 var col types.VirtualRouterListener 12547 destAddr := &col 12548 if err := awsRestjson1_deserializeDocumentVirtualRouterListener(&destAddr, value); err != nil { 12549 return err 12550 } 12551 col = *destAddr 12552 cv = append(cv, col) 12553 12554 } 12555 *v = cv 12556 return nil 12557} 12558 12559func awsRestjson1_deserializeDocumentVirtualRouterRef(v **types.VirtualRouterRef, value interface{}) error { 12560 if v == nil { 12561 return fmt.Errorf("unexpected nil of type %T", v) 12562 } 12563 if value == nil { 12564 return nil 12565 } 12566 12567 shape, ok := value.(map[string]interface{}) 12568 if !ok { 12569 return fmt.Errorf("unexpected JSON type %v", value) 12570 } 12571 12572 var sv *types.VirtualRouterRef 12573 if *v == nil { 12574 sv = &types.VirtualRouterRef{} 12575 } else { 12576 sv = *v 12577 } 12578 12579 for key, value := range shape { 12580 switch key { 12581 case "arn": 12582 if value != nil { 12583 jtv, ok := value.(string) 12584 if !ok { 12585 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 12586 } 12587 sv.Arn = ptr.String(jtv) 12588 } 12589 12590 case "createdAt": 12591 if value != nil { 12592 jtv, ok := value.(json.Number) 12593 if !ok { 12594 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 12595 } 12596 f64, err := jtv.Float64() 12597 if err != nil { 12598 return err 12599 } 12600 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12601 } 12602 12603 case "lastUpdatedAt": 12604 if value != nil { 12605 jtv, ok := value.(json.Number) 12606 if !ok { 12607 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 12608 } 12609 f64, err := jtv.Float64() 12610 if err != nil { 12611 return err 12612 } 12613 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12614 } 12615 12616 case "meshName": 12617 if value != nil { 12618 jtv, ok := value.(string) 12619 if !ok { 12620 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12621 } 12622 sv.MeshName = ptr.String(jtv) 12623 } 12624 12625 case "meshOwner": 12626 if value != nil { 12627 jtv, ok := value.(string) 12628 if !ok { 12629 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 12630 } 12631 sv.MeshOwner = ptr.String(jtv) 12632 } 12633 12634 case "resourceOwner": 12635 if value != nil { 12636 jtv, ok := value.(string) 12637 if !ok { 12638 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 12639 } 12640 sv.ResourceOwner = ptr.String(jtv) 12641 } 12642 12643 case "version": 12644 if value != nil { 12645 jtv, ok := value.(json.Number) 12646 if !ok { 12647 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 12648 } 12649 i64, err := jtv.Int64() 12650 if err != nil { 12651 return err 12652 } 12653 sv.Version = ptr.Int64(i64) 12654 } 12655 12656 case "virtualRouterName": 12657 if value != nil { 12658 jtv, ok := value.(string) 12659 if !ok { 12660 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12661 } 12662 sv.VirtualRouterName = ptr.String(jtv) 12663 } 12664 12665 default: 12666 _, _ = key, value 12667 12668 } 12669 } 12670 *v = sv 12671 return nil 12672} 12673 12674func awsRestjson1_deserializeDocumentVirtualRouterServiceProvider(v **types.VirtualRouterServiceProvider, value interface{}) error { 12675 if v == nil { 12676 return fmt.Errorf("unexpected nil of type %T", v) 12677 } 12678 if value == nil { 12679 return nil 12680 } 12681 12682 shape, ok := value.(map[string]interface{}) 12683 if !ok { 12684 return fmt.Errorf("unexpected JSON type %v", value) 12685 } 12686 12687 var sv *types.VirtualRouterServiceProvider 12688 if *v == nil { 12689 sv = &types.VirtualRouterServiceProvider{} 12690 } else { 12691 sv = *v 12692 } 12693 12694 for key, value := range shape { 12695 switch key { 12696 case "virtualRouterName": 12697 if value != nil { 12698 jtv, ok := value.(string) 12699 if !ok { 12700 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12701 } 12702 sv.VirtualRouterName = ptr.String(jtv) 12703 } 12704 12705 default: 12706 _, _ = key, value 12707 12708 } 12709 } 12710 *v = sv 12711 return nil 12712} 12713 12714func awsRestjson1_deserializeDocumentVirtualRouterSpec(v **types.VirtualRouterSpec, value interface{}) error { 12715 if v == nil { 12716 return fmt.Errorf("unexpected nil of type %T", v) 12717 } 12718 if value == nil { 12719 return nil 12720 } 12721 12722 shape, ok := value.(map[string]interface{}) 12723 if !ok { 12724 return fmt.Errorf("unexpected JSON type %v", value) 12725 } 12726 12727 var sv *types.VirtualRouterSpec 12728 if *v == nil { 12729 sv = &types.VirtualRouterSpec{} 12730 } else { 12731 sv = *v 12732 } 12733 12734 for key, value := range shape { 12735 switch key { 12736 case "listeners": 12737 if err := awsRestjson1_deserializeDocumentVirtualRouterListeners(&sv.Listeners, value); err != nil { 12738 return err 12739 } 12740 12741 default: 12742 _, _ = key, value 12743 12744 } 12745 } 12746 *v = sv 12747 return nil 12748} 12749 12750func awsRestjson1_deserializeDocumentVirtualRouterStatus(v **types.VirtualRouterStatus, value interface{}) error { 12751 if v == nil { 12752 return fmt.Errorf("unexpected nil of type %T", v) 12753 } 12754 if value == nil { 12755 return nil 12756 } 12757 12758 shape, ok := value.(map[string]interface{}) 12759 if !ok { 12760 return fmt.Errorf("unexpected JSON type %v", value) 12761 } 12762 12763 var sv *types.VirtualRouterStatus 12764 if *v == nil { 12765 sv = &types.VirtualRouterStatus{} 12766 } else { 12767 sv = *v 12768 } 12769 12770 for key, value := range shape { 12771 switch key { 12772 case "status": 12773 if value != nil { 12774 jtv, ok := value.(string) 12775 if !ok { 12776 return fmt.Errorf("expected VirtualRouterStatusCode to be of type string, got %T instead", value) 12777 } 12778 sv.Status = types.VirtualRouterStatusCode(jtv) 12779 } 12780 12781 default: 12782 _, _ = key, value 12783 12784 } 12785 } 12786 *v = sv 12787 return nil 12788} 12789 12790func awsRestjson1_deserializeDocumentVirtualServiceBackend(v **types.VirtualServiceBackend, value interface{}) error { 12791 if v == nil { 12792 return fmt.Errorf("unexpected nil of type %T", v) 12793 } 12794 if value == nil { 12795 return nil 12796 } 12797 12798 shape, ok := value.(map[string]interface{}) 12799 if !ok { 12800 return fmt.Errorf("unexpected JSON type %v", value) 12801 } 12802 12803 var sv *types.VirtualServiceBackend 12804 if *v == nil { 12805 sv = &types.VirtualServiceBackend{} 12806 } else { 12807 sv = *v 12808 } 12809 12810 for key, value := range shape { 12811 switch key { 12812 case "clientPolicy": 12813 if err := awsRestjson1_deserializeDocumentClientPolicy(&sv.ClientPolicy, value); err != nil { 12814 return err 12815 } 12816 12817 case "virtualServiceName": 12818 if value != nil { 12819 jtv, ok := value.(string) 12820 if !ok { 12821 return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) 12822 } 12823 sv.VirtualServiceName = ptr.String(jtv) 12824 } 12825 12826 default: 12827 _, _ = key, value 12828 12829 } 12830 } 12831 *v = sv 12832 return nil 12833} 12834 12835func awsRestjson1_deserializeDocumentVirtualServiceData(v **types.VirtualServiceData, value interface{}) error { 12836 if v == nil { 12837 return fmt.Errorf("unexpected nil of type %T", v) 12838 } 12839 if value == nil { 12840 return nil 12841 } 12842 12843 shape, ok := value.(map[string]interface{}) 12844 if !ok { 12845 return fmt.Errorf("unexpected JSON type %v", value) 12846 } 12847 12848 var sv *types.VirtualServiceData 12849 if *v == nil { 12850 sv = &types.VirtualServiceData{} 12851 } else { 12852 sv = *v 12853 } 12854 12855 for key, value := range shape { 12856 switch key { 12857 case "meshName": 12858 if value != nil { 12859 jtv, ok := value.(string) 12860 if !ok { 12861 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 12862 } 12863 sv.MeshName = ptr.String(jtv) 12864 } 12865 12866 case "metadata": 12867 if err := awsRestjson1_deserializeDocumentResourceMetadata(&sv.Metadata, value); err != nil { 12868 return err 12869 } 12870 12871 case "spec": 12872 if err := awsRestjson1_deserializeDocumentVirtualServiceSpec(&sv.Spec, value); err != nil { 12873 return err 12874 } 12875 12876 case "status": 12877 if err := awsRestjson1_deserializeDocumentVirtualServiceStatus(&sv.Status, value); err != nil { 12878 return err 12879 } 12880 12881 case "virtualServiceName": 12882 if value != nil { 12883 jtv, ok := value.(string) 12884 if !ok { 12885 return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) 12886 } 12887 sv.VirtualServiceName = ptr.String(jtv) 12888 } 12889 12890 default: 12891 _, _ = key, value 12892 12893 } 12894 } 12895 *v = sv 12896 return nil 12897} 12898 12899func awsRestjson1_deserializeDocumentVirtualServiceList(v *[]types.VirtualServiceRef, value interface{}) error { 12900 if v == nil { 12901 return fmt.Errorf("unexpected nil of type %T", v) 12902 } 12903 if value == nil { 12904 return nil 12905 } 12906 12907 shape, ok := value.([]interface{}) 12908 if !ok { 12909 return fmt.Errorf("unexpected JSON type %v", value) 12910 } 12911 12912 var cv []types.VirtualServiceRef 12913 if *v == nil { 12914 cv = []types.VirtualServiceRef{} 12915 } else { 12916 cv = *v 12917 } 12918 12919 for _, value := range shape { 12920 var col types.VirtualServiceRef 12921 destAddr := &col 12922 if err := awsRestjson1_deserializeDocumentVirtualServiceRef(&destAddr, value); err != nil { 12923 return err 12924 } 12925 col = *destAddr 12926 cv = append(cv, col) 12927 12928 } 12929 *v = cv 12930 return nil 12931} 12932 12933func awsRestjson1_deserializeDocumentVirtualServiceProvider(v *types.VirtualServiceProvider, value interface{}) error { 12934 if v == nil { 12935 return fmt.Errorf("unexpected nil of type %T", v) 12936 } 12937 if value == nil { 12938 return nil 12939 } 12940 12941 shape, ok := value.(map[string]interface{}) 12942 if !ok { 12943 return fmt.Errorf("unexpected JSON type %v", value) 12944 } 12945 12946 var uv types.VirtualServiceProvider 12947loop: 12948 for key, value := range shape { 12949 switch key { 12950 case "virtualNode": 12951 var mv types.VirtualNodeServiceProvider 12952 destAddr := &mv 12953 if err := awsRestjson1_deserializeDocumentVirtualNodeServiceProvider(&destAddr, value); err != nil { 12954 return err 12955 } 12956 mv = *destAddr 12957 uv = &types.VirtualServiceProviderMemberVirtualNode{Value: mv} 12958 break loop 12959 12960 case "virtualRouter": 12961 var mv types.VirtualRouterServiceProvider 12962 destAddr := &mv 12963 if err := awsRestjson1_deserializeDocumentVirtualRouterServiceProvider(&destAddr, value); err != nil { 12964 return err 12965 } 12966 mv = *destAddr 12967 uv = &types.VirtualServiceProviderMemberVirtualRouter{Value: mv} 12968 break loop 12969 12970 default: 12971 uv = &types.UnknownUnionMember{Tag: key} 12972 break loop 12973 12974 } 12975 } 12976 *v = uv 12977 return nil 12978} 12979 12980func awsRestjson1_deserializeDocumentVirtualServiceRef(v **types.VirtualServiceRef, value interface{}) error { 12981 if v == nil { 12982 return fmt.Errorf("unexpected nil of type %T", v) 12983 } 12984 if value == nil { 12985 return nil 12986 } 12987 12988 shape, ok := value.(map[string]interface{}) 12989 if !ok { 12990 return fmt.Errorf("unexpected JSON type %v", value) 12991 } 12992 12993 var sv *types.VirtualServiceRef 12994 if *v == nil { 12995 sv = &types.VirtualServiceRef{} 12996 } else { 12997 sv = *v 12998 } 12999 13000 for key, value := range shape { 13001 switch key { 13002 case "arn": 13003 if value != nil { 13004 jtv, ok := value.(string) 13005 if !ok { 13006 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13007 } 13008 sv.Arn = ptr.String(jtv) 13009 } 13010 13011 case "createdAt": 13012 if value != nil { 13013 jtv, ok := value.(json.Number) 13014 if !ok { 13015 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 13016 } 13017 f64, err := jtv.Float64() 13018 if err != nil { 13019 return err 13020 } 13021 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13022 } 13023 13024 case "lastUpdatedAt": 13025 if value != nil { 13026 jtv, ok := value.(json.Number) 13027 if !ok { 13028 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 13029 } 13030 f64, err := jtv.Float64() 13031 if err != nil { 13032 return err 13033 } 13034 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13035 } 13036 13037 case "meshName": 13038 if value != nil { 13039 jtv, ok := value.(string) 13040 if !ok { 13041 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 13042 } 13043 sv.MeshName = ptr.String(jtv) 13044 } 13045 13046 case "meshOwner": 13047 if value != nil { 13048 jtv, ok := value.(string) 13049 if !ok { 13050 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 13051 } 13052 sv.MeshOwner = ptr.String(jtv) 13053 } 13054 13055 case "resourceOwner": 13056 if value != nil { 13057 jtv, ok := value.(string) 13058 if !ok { 13059 return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) 13060 } 13061 sv.ResourceOwner = ptr.String(jtv) 13062 } 13063 13064 case "version": 13065 if value != nil { 13066 jtv, ok := value.(json.Number) 13067 if !ok { 13068 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 13069 } 13070 i64, err := jtv.Int64() 13071 if err != nil { 13072 return err 13073 } 13074 sv.Version = ptr.Int64(i64) 13075 } 13076 13077 case "virtualServiceName": 13078 if value != nil { 13079 jtv, ok := value.(string) 13080 if !ok { 13081 return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) 13082 } 13083 sv.VirtualServiceName = ptr.String(jtv) 13084 } 13085 13086 default: 13087 _, _ = key, value 13088 13089 } 13090 } 13091 *v = sv 13092 return nil 13093} 13094 13095func awsRestjson1_deserializeDocumentVirtualServiceSpec(v **types.VirtualServiceSpec, value interface{}) error { 13096 if v == nil { 13097 return fmt.Errorf("unexpected nil of type %T", v) 13098 } 13099 if value == nil { 13100 return nil 13101 } 13102 13103 shape, ok := value.(map[string]interface{}) 13104 if !ok { 13105 return fmt.Errorf("unexpected JSON type %v", value) 13106 } 13107 13108 var sv *types.VirtualServiceSpec 13109 if *v == nil { 13110 sv = &types.VirtualServiceSpec{} 13111 } else { 13112 sv = *v 13113 } 13114 13115 for key, value := range shape { 13116 switch key { 13117 case "provider": 13118 if err := awsRestjson1_deserializeDocumentVirtualServiceProvider(&sv.Provider, value); err != nil { 13119 return err 13120 } 13121 13122 default: 13123 _, _ = key, value 13124 13125 } 13126 } 13127 *v = sv 13128 return nil 13129} 13130 13131func awsRestjson1_deserializeDocumentVirtualServiceStatus(v **types.VirtualServiceStatus, value interface{}) error { 13132 if v == nil { 13133 return fmt.Errorf("unexpected nil of type %T", v) 13134 } 13135 if value == nil { 13136 return nil 13137 } 13138 13139 shape, ok := value.(map[string]interface{}) 13140 if !ok { 13141 return fmt.Errorf("unexpected JSON type %v", value) 13142 } 13143 13144 var sv *types.VirtualServiceStatus 13145 if *v == nil { 13146 sv = &types.VirtualServiceStatus{} 13147 } else { 13148 sv = *v 13149 } 13150 13151 for key, value := range shape { 13152 switch key { 13153 case "status": 13154 if value != nil { 13155 jtv, ok := value.(string) 13156 if !ok { 13157 return fmt.Errorf("expected VirtualServiceStatusCode to be of type string, got %T instead", value) 13158 } 13159 sv.Status = types.VirtualServiceStatusCode(jtv) 13160 } 13161 13162 default: 13163 _, _ = key, value 13164 13165 } 13166 } 13167 *v = sv 13168 return nil 13169} 13170 13171func awsRestjson1_deserializeDocumentWeightedTarget(v **types.WeightedTarget, value interface{}) error { 13172 if v == nil { 13173 return fmt.Errorf("unexpected nil of type %T", v) 13174 } 13175 if value == nil { 13176 return nil 13177 } 13178 13179 shape, ok := value.(map[string]interface{}) 13180 if !ok { 13181 return fmt.Errorf("unexpected JSON type %v", value) 13182 } 13183 13184 var sv *types.WeightedTarget 13185 if *v == nil { 13186 sv = &types.WeightedTarget{} 13187 } else { 13188 sv = *v 13189 } 13190 13191 for key, value := range shape { 13192 switch key { 13193 case "virtualNode": 13194 if value != nil { 13195 jtv, ok := value.(string) 13196 if !ok { 13197 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 13198 } 13199 sv.VirtualNode = ptr.String(jtv) 13200 } 13201 13202 case "weight": 13203 if value != nil { 13204 jtv, ok := value.(json.Number) 13205 if !ok { 13206 return fmt.Errorf("expected PercentInt to be json.Number, got %T instead", value) 13207 } 13208 i64, err := jtv.Int64() 13209 if err != nil { 13210 return err 13211 } 13212 sv.Weight = int32(i64) 13213 } 13214 13215 default: 13216 _, _ = key, value 13217 13218 } 13219 } 13220 *v = sv 13221 return nil 13222} 13223 13224func awsRestjson1_deserializeDocumentWeightedTargets(v *[]types.WeightedTarget, value interface{}) error { 13225 if v == nil { 13226 return fmt.Errorf("unexpected nil of type %T", v) 13227 } 13228 if value == nil { 13229 return nil 13230 } 13231 13232 shape, ok := value.([]interface{}) 13233 if !ok { 13234 return fmt.Errorf("unexpected JSON type %v", value) 13235 } 13236 13237 var cv []types.WeightedTarget 13238 if *v == nil { 13239 cv = []types.WeightedTarget{} 13240 } else { 13241 cv = *v 13242 } 13243 13244 for _, value := range shape { 13245 var col types.WeightedTarget 13246 destAddr := &col 13247 if err := awsRestjson1_deserializeDocumentWeightedTarget(&destAddr, value); err != nil { 13248 return err 13249 } 13250 col = *destAddr 13251 cv = append(cv, col) 13252 13253 } 13254 *v = cv 13255 return nil 13256} 13257