1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package location 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/location/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithytime "github.com/aws/smithy-go/time" 17 smithyhttp "github.com/aws/smithy-go/transport/http" 18 "io" 19 "io/ioutil" 20 "strings" 21) 22 23type awsRestjson1_deserializeOpAssociateTrackerConsumer struct { 24} 25 26func (*awsRestjson1_deserializeOpAssociateTrackerConsumer) ID() string { 27 return "OperationDeserializer" 28} 29 30func (m *awsRestjson1_deserializeOpAssociateTrackerConsumer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 31 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 32) { 33 out, metadata, err = next.HandleDeserialize(ctx, in) 34 if err != nil { 35 return out, metadata, err 36 } 37 38 response, ok := out.RawResponse.(*smithyhttp.Response) 39 if !ok { 40 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 41 } 42 43 if response.StatusCode < 200 || response.StatusCode >= 300 { 44 return out, metadata, awsRestjson1_deserializeOpErrorAssociateTrackerConsumer(response, &metadata) 45 } 46 output := &AssociateTrackerConsumerOutput{} 47 out.Result = output 48 49 return out, metadata, err 50} 51 52func awsRestjson1_deserializeOpErrorAssociateTrackerConsumer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 53 var errorBuffer bytes.Buffer 54 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 55 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 56 } 57 errorBody := bytes.NewReader(errorBuffer.Bytes()) 58 59 errorCode := "UnknownError" 60 errorMessage := errorCode 61 62 code := response.Header.Get("X-Amzn-ErrorType") 63 if len(code) != 0 { 64 errorCode = restjson.SanitizeErrorCode(code) 65 } 66 67 var buff [1024]byte 68 ringBuffer := smithyio.NewRingBuffer(buff[:]) 69 70 body := io.TeeReader(errorBody, ringBuffer) 71 decoder := json.NewDecoder(body) 72 decoder.UseNumber() 73 code, message, err := restjson.GetErrorInfo(decoder) 74 if err != nil { 75 var snapshot bytes.Buffer 76 io.Copy(&snapshot, ringBuffer) 77 err = &smithy.DeserializationError{ 78 Err: fmt.Errorf("failed to decode response body, %w", err), 79 Snapshot: snapshot.Bytes(), 80 } 81 return err 82 } 83 84 errorBody.Seek(0, io.SeekStart) 85 if len(code) != 0 { 86 errorCode = restjson.SanitizeErrorCode(code) 87 } 88 if len(message) != 0 { 89 errorMessage = message 90 } 91 92 switch { 93 case strings.EqualFold("AccessDeniedException", errorCode): 94 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 95 96 case strings.EqualFold("ConflictException", errorCode): 97 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 98 99 case strings.EqualFold("InternalServerException", errorCode): 100 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 101 102 case strings.EqualFold("ResourceNotFoundException", errorCode): 103 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 104 105 case strings.EqualFold("ThrottlingException", errorCode): 106 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 107 108 case strings.EqualFold("ValidationException", errorCode): 109 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 110 111 default: 112 genericError := &smithy.GenericAPIError{ 113 Code: errorCode, 114 Message: errorMessage, 115 } 116 return genericError 117 118 } 119} 120 121type awsRestjson1_deserializeOpBatchDeleteGeofence struct { 122} 123 124func (*awsRestjson1_deserializeOpBatchDeleteGeofence) ID() string { 125 return "OperationDeserializer" 126} 127 128func (m *awsRestjson1_deserializeOpBatchDeleteGeofence) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 129 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 130) { 131 out, metadata, err = next.HandleDeserialize(ctx, in) 132 if err != nil { 133 return out, metadata, err 134 } 135 136 response, ok := out.RawResponse.(*smithyhttp.Response) 137 if !ok { 138 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 139 } 140 141 if response.StatusCode < 200 || response.StatusCode >= 300 { 142 return out, metadata, awsRestjson1_deserializeOpErrorBatchDeleteGeofence(response, &metadata) 143 } 144 output := &BatchDeleteGeofenceOutput{} 145 out.Result = output 146 147 var buff [1024]byte 148 ringBuffer := smithyio.NewRingBuffer(buff[:]) 149 150 body := io.TeeReader(response.Body, ringBuffer) 151 152 decoder := json.NewDecoder(body) 153 decoder.UseNumber() 154 var shape interface{} 155 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 156 var snapshot bytes.Buffer 157 io.Copy(&snapshot, ringBuffer) 158 err = &smithy.DeserializationError{ 159 Err: fmt.Errorf("failed to decode response body, %w", err), 160 Snapshot: snapshot.Bytes(), 161 } 162 return out, metadata, err 163 } 164 165 err = awsRestjson1_deserializeOpDocumentBatchDeleteGeofenceOutput(&output, shape) 166 if err != nil { 167 var snapshot bytes.Buffer 168 io.Copy(&snapshot, ringBuffer) 169 return out, metadata, &smithy.DeserializationError{ 170 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 171 Snapshot: snapshot.Bytes(), 172 } 173 } 174 175 return out, metadata, err 176} 177 178func awsRestjson1_deserializeOpErrorBatchDeleteGeofence(response *smithyhttp.Response, metadata *middleware.Metadata) error { 179 var errorBuffer bytes.Buffer 180 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 181 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 182 } 183 errorBody := bytes.NewReader(errorBuffer.Bytes()) 184 185 errorCode := "UnknownError" 186 errorMessage := errorCode 187 188 code := response.Header.Get("X-Amzn-ErrorType") 189 if len(code) != 0 { 190 errorCode = restjson.SanitizeErrorCode(code) 191 } 192 193 var buff [1024]byte 194 ringBuffer := smithyio.NewRingBuffer(buff[:]) 195 196 body := io.TeeReader(errorBody, ringBuffer) 197 decoder := json.NewDecoder(body) 198 decoder.UseNumber() 199 code, message, err := restjson.GetErrorInfo(decoder) 200 if err != nil { 201 var snapshot bytes.Buffer 202 io.Copy(&snapshot, ringBuffer) 203 err = &smithy.DeserializationError{ 204 Err: fmt.Errorf("failed to decode response body, %w", err), 205 Snapshot: snapshot.Bytes(), 206 } 207 return err 208 } 209 210 errorBody.Seek(0, io.SeekStart) 211 if len(code) != 0 { 212 errorCode = restjson.SanitizeErrorCode(code) 213 } 214 if len(message) != 0 { 215 errorMessage = message 216 } 217 218 switch { 219 case strings.EqualFold("AccessDeniedException", errorCode): 220 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 221 222 case strings.EqualFold("InternalServerException", errorCode): 223 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 224 225 case strings.EqualFold("ResourceNotFoundException", errorCode): 226 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 227 228 case strings.EqualFold("ThrottlingException", errorCode): 229 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 230 231 case strings.EqualFold("ValidationException", errorCode): 232 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 233 234 default: 235 genericError := &smithy.GenericAPIError{ 236 Code: errorCode, 237 Message: errorMessage, 238 } 239 return genericError 240 241 } 242} 243 244func awsRestjson1_deserializeOpDocumentBatchDeleteGeofenceOutput(v **BatchDeleteGeofenceOutput, value interface{}) error { 245 if v == nil { 246 return fmt.Errorf("unexpected nil of type %T", v) 247 } 248 if value == nil { 249 return nil 250 } 251 252 shape, ok := value.(map[string]interface{}) 253 if !ok { 254 return fmt.Errorf("unexpected JSON type %v", value) 255 } 256 257 var sv *BatchDeleteGeofenceOutput 258 if *v == nil { 259 sv = &BatchDeleteGeofenceOutput{} 260 } else { 261 sv = *v 262 } 263 264 for key, value := range shape { 265 switch key { 266 case "Errors": 267 if err := awsRestjson1_deserializeDocumentBatchDeleteGeofenceErrorList(&sv.Errors, value); err != nil { 268 return err 269 } 270 271 default: 272 _, _ = key, value 273 274 } 275 } 276 *v = sv 277 return nil 278} 279 280type awsRestjson1_deserializeOpBatchEvaluateGeofences struct { 281} 282 283func (*awsRestjson1_deserializeOpBatchEvaluateGeofences) ID() string { 284 return "OperationDeserializer" 285} 286 287func (m *awsRestjson1_deserializeOpBatchEvaluateGeofences) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 288 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 289) { 290 out, metadata, err = next.HandleDeserialize(ctx, in) 291 if err != nil { 292 return out, metadata, err 293 } 294 295 response, ok := out.RawResponse.(*smithyhttp.Response) 296 if !ok { 297 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 298 } 299 300 if response.StatusCode < 200 || response.StatusCode >= 300 { 301 return out, metadata, awsRestjson1_deserializeOpErrorBatchEvaluateGeofences(response, &metadata) 302 } 303 output := &BatchEvaluateGeofencesOutput{} 304 out.Result = output 305 306 var buff [1024]byte 307 ringBuffer := smithyio.NewRingBuffer(buff[:]) 308 309 body := io.TeeReader(response.Body, ringBuffer) 310 311 decoder := json.NewDecoder(body) 312 decoder.UseNumber() 313 var shape interface{} 314 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 315 var snapshot bytes.Buffer 316 io.Copy(&snapshot, ringBuffer) 317 err = &smithy.DeserializationError{ 318 Err: fmt.Errorf("failed to decode response body, %w", err), 319 Snapshot: snapshot.Bytes(), 320 } 321 return out, metadata, err 322 } 323 324 err = awsRestjson1_deserializeOpDocumentBatchEvaluateGeofencesOutput(&output, shape) 325 if err != nil { 326 var snapshot bytes.Buffer 327 io.Copy(&snapshot, ringBuffer) 328 return out, metadata, &smithy.DeserializationError{ 329 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 330 Snapshot: snapshot.Bytes(), 331 } 332 } 333 334 return out, metadata, err 335} 336 337func awsRestjson1_deserializeOpErrorBatchEvaluateGeofences(response *smithyhttp.Response, metadata *middleware.Metadata) error { 338 var errorBuffer bytes.Buffer 339 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 340 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 341 } 342 errorBody := bytes.NewReader(errorBuffer.Bytes()) 343 344 errorCode := "UnknownError" 345 errorMessage := errorCode 346 347 code := response.Header.Get("X-Amzn-ErrorType") 348 if len(code) != 0 { 349 errorCode = restjson.SanitizeErrorCode(code) 350 } 351 352 var buff [1024]byte 353 ringBuffer := smithyio.NewRingBuffer(buff[:]) 354 355 body := io.TeeReader(errorBody, ringBuffer) 356 decoder := json.NewDecoder(body) 357 decoder.UseNumber() 358 code, message, err := restjson.GetErrorInfo(decoder) 359 if err != nil { 360 var snapshot bytes.Buffer 361 io.Copy(&snapshot, ringBuffer) 362 err = &smithy.DeserializationError{ 363 Err: fmt.Errorf("failed to decode response body, %w", err), 364 Snapshot: snapshot.Bytes(), 365 } 366 return err 367 } 368 369 errorBody.Seek(0, io.SeekStart) 370 if len(code) != 0 { 371 errorCode = restjson.SanitizeErrorCode(code) 372 } 373 if len(message) != 0 { 374 errorMessage = message 375 } 376 377 switch { 378 case strings.EqualFold("AccessDeniedException", errorCode): 379 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 380 381 case strings.EqualFold("InternalServerException", errorCode): 382 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 383 384 case strings.EqualFold("ResourceNotFoundException", errorCode): 385 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 386 387 case strings.EqualFold("ThrottlingException", errorCode): 388 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 389 390 case strings.EqualFold("ValidationException", errorCode): 391 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 392 393 default: 394 genericError := &smithy.GenericAPIError{ 395 Code: errorCode, 396 Message: errorMessage, 397 } 398 return genericError 399 400 } 401} 402 403func awsRestjson1_deserializeOpDocumentBatchEvaluateGeofencesOutput(v **BatchEvaluateGeofencesOutput, value interface{}) error { 404 if v == nil { 405 return fmt.Errorf("unexpected nil of type %T", v) 406 } 407 if value == nil { 408 return nil 409 } 410 411 shape, ok := value.(map[string]interface{}) 412 if !ok { 413 return fmt.Errorf("unexpected JSON type %v", value) 414 } 415 416 var sv *BatchEvaluateGeofencesOutput 417 if *v == nil { 418 sv = &BatchEvaluateGeofencesOutput{} 419 } else { 420 sv = *v 421 } 422 423 for key, value := range shape { 424 switch key { 425 case "Errors": 426 if err := awsRestjson1_deserializeDocumentBatchEvaluateGeofencesErrorList(&sv.Errors, value); err != nil { 427 return err 428 } 429 430 default: 431 _, _ = key, value 432 433 } 434 } 435 *v = sv 436 return nil 437} 438 439type awsRestjson1_deserializeOpBatchGetDevicePosition struct { 440} 441 442func (*awsRestjson1_deserializeOpBatchGetDevicePosition) ID() string { 443 return "OperationDeserializer" 444} 445 446func (m *awsRestjson1_deserializeOpBatchGetDevicePosition) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 447 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 448) { 449 out, metadata, err = next.HandleDeserialize(ctx, in) 450 if err != nil { 451 return out, metadata, err 452 } 453 454 response, ok := out.RawResponse.(*smithyhttp.Response) 455 if !ok { 456 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 457 } 458 459 if response.StatusCode < 200 || response.StatusCode >= 300 { 460 return out, metadata, awsRestjson1_deserializeOpErrorBatchGetDevicePosition(response, &metadata) 461 } 462 output := &BatchGetDevicePositionOutput{} 463 out.Result = output 464 465 var buff [1024]byte 466 ringBuffer := smithyio.NewRingBuffer(buff[:]) 467 468 body := io.TeeReader(response.Body, ringBuffer) 469 470 decoder := json.NewDecoder(body) 471 decoder.UseNumber() 472 var shape interface{} 473 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 474 var snapshot bytes.Buffer 475 io.Copy(&snapshot, ringBuffer) 476 err = &smithy.DeserializationError{ 477 Err: fmt.Errorf("failed to decode response body, %w", err), 478 Snapshot: snapshot.Bytes(), 479 } 480 return out, metadata, err 481 } 482 483 err = awsRestjson1_deserializeOpDocumentBatchGetDevicePositionOutput(&output, shape) 484 if err != nil { 485 var snapshot bytes.Buffer 486 io.Copy(&snapshot, ringBuffer) 487 return out, metadata, &smithy.DeserializationError{ 488 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 489 Snapshot: snapshot.Bytes(), 490 } 491 } 492 493 return out, metadata, err 494} 495 496func awsRestjson1_deserializeOpErrorBatchGetDevicePosition(response *smithyhttp.Response, metadata *middleware.Metadata) error { 497 var errorBuffer bytes.Buffer 498 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 499 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 500 } 501 errorBody := bytes.NewReader(errorBuffer.Bytes()) 502 503 errorCode := "UnknownError" 504 errorMessage := errorCode 505 506 code := response.Header.Get("X-Amzn-ErrorType") 507 if len(code) != 0 { 508 errorCode = restjson.SanitizeErrorCode(code) 509 } 510 511 var buff [1024]byte 512 ringBuffer := smithyio.NewRingBuffer(buff[:]) 513 514 body := io.TeeReader(errorBody, ringBuffer) 515 decoder := json.NewDecoder(body) 516 decoder.UseNumber() 517 code, message, err := restjson.GetErrorInfo(decoder) 518 if err != nil { 519 var snapshot bytes.Buffer 520 io.Copy(&snapshot, ringBuffer) 521 err = &smithy.DeserializationError{ 522 Err: fmt.Errorf("failed to decode response body, %w", err), 523 Snapshot: snapshot.Bytes(), 524 } 525 return err 526 } 527 528 errorBody.Seek(0, io.SeekStart) 529 if len(code) != 0 { 530 errorCode = restjson.SanitizeErrorCode(code) 531 } 532 if len(message) != 0 { 533 errorMessage = message 534 } 535 536 switch { 537 case strings.EqualFold("AccessDeniedException", errorCode): 538 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 539 540 case strings.EqualFold("InternalServerException", errorCode): 541 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 542 543 case strings.EqualFold("ResourceNotFoundException", errorCode): 544 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 545 546 case strings.EqualFold("ThrottlingException", errorCode): 547 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 548 549 case strings.EqualFold("ValidationException", errorCode): 550 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 551 552 default: 553 genericError := &smithy.GenericAPIError{ 554 Code: errorCode, 555 Message: errorMessage, 556 } 557 return genericError 558 559 } 560} 561 562func awsRestjson1_deserializeOpDocumentBatchGetDevicePositionOutput(v **BatchGetDevicePositionOutput, value interface{}) error { 563 if v == nil { 564 return fmt.Errorf("unexpected nil of type %T", v) 565 } 566 if value == nil { 567 return nil 568 } 569 570 shape, ok := value.(map[string]interface{}) 571 if !ok { 572 return fmt.Errorf("unexpected JSON type %v", value) 573 } 574 575 var sv *BatchGetDevicePositionOutput 576 if *v == nil { 577 sv = &BatchGetDevicePositionOutput{} 578 } else { 579 sv = *v 580 } 581 582 for key, value := range shape { 583 switch key { 584 case "DevicePositions": 585 if err := awsRestjson1_deserializeDocumentDevicePositionList(&sv.DevicePositions, value); err != nil { 586 return err 587 } 588 589 case "Errors": 590 if err := awsRestjson1_deserializeDocumentBatchGetDevicePositionErrorList(&sv.Errors, value); err != nil { 591 return err 592 } 593 594 default: 595 _, _ = key, value 596 597 } 598 } 599 *v = sv 600 return nil 601} 602 603type awsRestjson1_deserializeOpBatchPutGeofence struct { 604} 605 606func (*awsRestjson1_deserializeOpBatchPutGeofence) ID() string { 607 return "OperationDeserializer" 608} 609 610func (m *awsRestjson1_deserializeOpBatchPutGeofence) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 611 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 612) { 613 out, metadata, err = next.HandleDeserialize(ctx, in) 614 if err != nil { 615 return out, metadata, err 616 } 617 618 response, ok := out.RawResponse.(*smithyhttp.Response) 619 if !ok { 620 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 621 } 622 623 if response.StatusCode < 200 || response.StatusCode >= 300 { 624 return out, metadata, awsRestjson1_deserializeOpErrorBatchPutGeofence(response, &metadata) 625 } 626 output := &BatchPutGeofenceOutput{} 627 out.Result = output 628 629 var buff [1024]byte 630 ringBuffer := smithyio.NewRingBuffer(buff[:]) 631 632 body := io.TeeReader(response.Body, ringBuffer) 633 634 decoder := json.NewDecoder(body) 635 decoder.UseNumber() 636 var shape interface{} 637 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 638 var snapshot bytes.Buffer 639 io.Copy(&snapshot, ringBuffer) 640 err = &smithy.DeserializationError{ 641 Err: fmt.Errorf("failed to decode response body, %w", err), 642 Snapshot: snapshot.Bytes(), 643 } 644 return out, metadata, err 645 } 646 647 err = awsRestjson1_deserializeOpDocumentBatchPutGeofenceOutput(&output, shape) 648 if err != nil { 649 var snapshot bytes.Buffer 650 io.Copy(&snapshot, ringBuffer) 651 return out, metadata, &smithy.DeserializationError{ 652 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 653 Snapshot: snapshot.Bytes(), 654 } 655 } 656 657 return out, metadata, err 658} 659 660func awsRestjson1_deserializeOpErrorBatchPutGeofence(response *smithyhttp.Response, metadata *middleware.Metadata) error { 661 var errorBuffer bytes.Buffer 662 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 663 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 664 } 665 errorBody := bytes.NewReader(errorBuffer.Bytes()) 666 667 errorCode := "UnknownError" 668 errorMessage := errorCode 669 670 code := response.Header.Get("X-Amzn-ErrorType") 671 if len(code) != 0 { 672 errorCode = restjson.SanitizeErrorCode(code) 673 } 674 675 var buff [1024]byte 676 ringBuffer := smithyio.NewRingBuffer(buff[:]) 677 678 body := io.TeeReader(errorBody, ringBuffer) 679 decoder := json.NewDecoder(body) 680 decoder.UseNumber() 681 code, message, err := restjson.GetErrorInfo(decoder) 682 if err != nil { 683 var snapshot bytes.Buffer 684 io.Copy(&snapshot, ringBuffer) 685 err = &smithy.DeserializationError{ 686 Err: fmt.Errorf("failed to decode response body, %w", err), 687 Snapshot: snapshot.Bytes(), 688 } 689 return err 690 } 691 692 errorBody.Seek(0, io.SeekStart) 693 if len(code) != 0 { 694 errorCode = restjson.SanitizeErrorCode(code) 695 } 696 if len(message) != 0 { 697 errorMessage = message 698 } 699 700 switch { 701 case strings.EqualFold("AccessDeniedException", errorCode): 702 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 703 704 case strings.EqualFold("InternalServerException", errorCode): 705 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 706 707 case strings.EqualFold("ResourceNotFoundException", errorCode): 708 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 709 710 case strings.EqualFold("ThrottlingException", errorCode): 711 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 712 713 case strings.EqualFold("ValidationException", errorCode): 714 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 715 716 default: 717 genericError := &smithy.GenericAPIError{ 718 Code: errorCode, 719 Message: errorMessage, 720 } 721 return genericError 722 723 } 724} 725 726func awsRestjson1_deserializeOpDocumentBatchPutGeofenceOutput(v **BatchPutGeofenceOutput, value interface{}) error { 727 if v == nil { 728 return fmt.Errorf("unexpected nil of type %T", v) 729 } 730 if value == nil { 731 return nil 732 } 733 734 shape, ok := value.(map[string]interface{}) 735 if !ok { 736 return fmt.Errorf("unexpected JSON type %v", value) 737 } 738 739 var sv *BatchPutGeofenceOutput 740 if *v == nil { 741 sv = &BatchPutGeofenceOutput{} 742 } else { 743 sv = *v 744 } 745 746 for key, value := range shape { 747 switch key { 748 case "Errors": 749 if err := awsRestjson1_deserializeDocumentBatchPutGeofenceErrorList(&sv.Errors, value); err != nil { 750 return err 751 } 752 753 case "Successes": 754 if err := awsRestjson1_deserializeDocumentBatchPutGeofenceSuccessList(&sv.Successes, value); err != nil { 755 return err 756 } 757 758 default: 759 _, _ = key, value 760 761 } 762 } 763 *v = sv 764 return nil 765} 766 767type awsRestjson1_deserializeOpBatchUpdateDevicePosition struct { 768} 769 770func (*awsRestjson1_deserializeOpBatchUpdateDevicePosition) ID() string { 771 return "OperationDeserializer" 772} 773 774func (m *awsRestjson1_deserializeOpBatchUpdateDevicePosition) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 775 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 776) { 777 out, metadata, err = next.HandleDeserialize(ctx, in) 778 if err != nil { 779 return out, metadata, err 780 } 781 782 response, ok := out.RawResponse.(*smithyhttp.Response) 783 if !ok { 784 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 785 } 786 787 if response.StatusCode < 200 || response.StatusCode >= 300 { 788 return out, metadata, awsRestjson1_deserializeOpErrorBatchUpdateDevicePosition(response, &metadata) 789 } 790 output := &BatchUpdateDevicePositionOutput{} 791 out.Result = output 792 793 var buff [1024]byte 794 ringBuffer := smithyio.NewRingBuffer(buff[:]) 795 796 body := io.TeeReader(response.Body, ringBuffer) 797 798 decoder := json.NewDecoder(body) 799 decoder.UseNumber() 800 var shape interface{} 801 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 802 var snapshot bytes.Buffer 803 io.Copy(&snapshot, ringBuffer) 804 err = &smithy.DeserializationError{ 805 Err: fmt.Errorf("failed to decode response body, %w", err), 806 Snapshot: snapshot.Bytes(), 807 } 808 return out, metadata, err 809 } 810 811 err = awsRestjson1_deserializeOpDocumentBatchUpdateDevicePositionOutput(&output, shape) 812 if err != nil { 813 var snapshot bytes.Buffer 814 io.Copy(&snapshot, ringBuffer) 815 return out, metadata, &smithy.DeserializationError{ 816 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 817 Snapshot: snapshot.Bytes(), 818 } 819 } 820 821 return out, metadata, err 822} 823 824func awsRestjson1_deserializeOpErrorBatchUpdateDevicePosition(response *smithyhttp.Response, metadata *middleware.Metadata) error { 825 var errorBuffer bytes.Buffer 826 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 827 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 828 } 829 errorBody := bytes.NewReader(errorBuffer.Bytes()) 830 831 errorCode := "UnknownError" 832 errorMessage := errorCode 833 834 code := response.Header.Get("X-Amzn-ErrorType") 835 if len(code) != 0 { 836 errorCode = restjson.SanitizeErrorCode(code) 837 } 838 839 var buff [1024]byte 840 ringBuffer := smithyio.NewRingBuffer(buff[:]) 841 842 body := io.TeeReader(errorBody, ringBuffer) 843 decoder := json.NewDecoder(body) 844 decoder.UseNumber() 845 code, message, err := restjson.GetErrorInfo(decoder) 846 if err != nil { 847 var snapshot bytes.Buffer 848 io.Copy(&snapshot, ringBuffer) 849 err = &smithy.DeserializationError{ 850 Err: fmt.Errorf("failed to decode response body, %w", err), 851 Snapshot: snapshot.Bytes(), 852 } 853 return err 854 } 855 856 errorBody.Seek(0, io.SeekStart) 857 if len(code) != 0 { 858 errorCode = restjson.SanitizeErrorCode(code) 859 } 860 if len(message) != 0 { 861 errorMessage = message 862 } 863 864 switch { 865 case strings.EqualFold("AccessDeniedException", errorCode): 866 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 867 868 case strings.EqualFold("InternalServerException", errorCode): 869 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 870 871 case strings.EqualFold("ResourceNotFoundException", errorCode): 872 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 873 874 case strings.EqualFold("ThrottlingException", errorCode): 875 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 876 877 case strings.EqualFold("ValidationException", errorCode): 878 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 879 880 default: 881 genericError := &smithy.GenericAPIError{ 882 Code: errorCode, 883 Message: errorMessage, 884 } 885 return genericError 886 887 } 888} 889 890func awsRestjson1_deserializeOpDocumentBatchUpdateDevicePositionOutput(v **BatchUpdateDevicePositionOutput, value interface{}) error { 891 if v == nil { 892 return fmt.Errorf("unexpected nil of type %T", v) 893 } 894 if value == nil { 895 return nil 896 } 897 898 shape, ok := value.(map[string]interface{}) 899 if !ok { 900 return fmt.Errorf("unexpected JSON type %v", value) 901 } 902 903 var sv *BatchUpdateDevicePositionOutput 904 if *v == nil { 905 sv = &BatchUpdateDevicePositionOutput{} 906 } else { 907 sv = *v 908 } 909 910 for key, value := range shape { 911 switch key { 912 case "Errors": 913 if err := awsRestjson1_deserializeDocumentBatchUpdateDevicePositionErrorList(&sv.Errors, value); err != nil { 914 return err 915 } 916 917 default: 918 _, _ = key, value 919 920 } 921 } 922 *v = sv 923 return nil 924} 925 926type awsRestjson1_deserializeOpCreateGeofenceCollection struct { 927} 928 929func (*awsRestjson1_deserializeOpCreateGeofenceCollection) ID() string { 930 return "OperationDeserializer" 931} 932 933func (m *awsRestjson1_deserializeOpCreateGeofenceCollection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 934 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 935) { 936 out, metadata, err = next.HandleDeserialize(ctx, in) 937 if err != nil { 938 return out, metadata, err 939 } 940 941 response, ok := out.RawResponse.(*smithyhttp.Response) 942 if !ok { 943 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 944 } 945 946 if response.StatusCode < 200 || response.StatusCode >= 300 { 947 return out, metadata, awsRestjson1_deserializeOpErrorCreateGeofenceCollection(response, &metadata) 948 } 949 output := &CreateGeofenceCollectionOutput{} 950 out.Result = output 951 952 var buff [1024]byte 953 ringBuffer := smithyio.NewRingBuffer(buff[:]) 954 955 body := io.TeeReader(response.Body, ringBuffer) 956 957 decoder := json.NewDecoder(body) 958 decoder.UseNumber() 959 var shape interface{} 960 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 961 var snapshot bytes.Buffer 962 io.Copy(&snapshot, ringBuffer) 963 err = &smithy.DeserializationError{ 964 Err: fmt.Errorf("failed to decode response body, %w", err), 965 Snapshot: snapshot.Bytes(), 966 } 967 return out, metadata, err 968 } 969 970 err = awsRestjson1_deserializeOpDocumentCreateGeofenceCollectionOutput(&output, shape) 971 if err != nil { 972 var snapshot bytes.Buffer 973 io.Copy(&snapshot, ringBuffer) 974 return out, metadata, &smithy.DeserializationError{ 975 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 976 Snapshot: snapshot.Bytes(), 977 } 978 } 979 980 return out, metadata, err 981} 982 983func awsRestjson1_deserializeOpErrorCreateGeofenceCollection(response *smithyhttp.Response, metadata *middleware.Metadata) error { 984 var errorBuffer bytes.Buffer 985 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 986 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 987 } 988 errorBody := bytes.NewReader(errorBuffer.Bytes()) 989 990 errorCode := "UnknownError" 991 errorMessage := errorCode 992 993 code := response.Header.Get("X-Amzn-ErrorType") 994 if len(code) != 0 { 995 errorCode = restjson.SanitizeErrorCode(code) 996 } 997 998 var buff [1024]byte 999 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1000 1001 body := io.TeeReader(errorBody, ringBuffer) 1002 decoder := json.NewDecoder(body) 1003 decoder.UseNumber() 1004 code, message, err := restjson.GetErrorInfo(decoder) 1005 if err != nil { 1006 var snapshot bytes.Buffer 1007 io.Copy(&snapshot, ringBuffer) 1008 err = &smithy.DeserializationError{ 1009 Err: fmt.Errorf("failed to decode response body, %w", err), 1010 Snapshot: snapshot.Bytes(), 1011 } 1012 return err 1013 } 1014 1015 errorBody.Seek(0, io.SeekStart) 1016 if len(code) != 0 { 1017 errorCode = restjson.SanitizeErrorCode(code) 1018 } 1019 if len(message) != 0 { 1020 errorMessage = message 1021 } 1022 1023 switch { 1024 case strings.EqualFold("AccessDeniedException", errorCode): 1025 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1026 1027 case strings.EqualFold("ConflictException", errorCode): 1028 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1029 1030 case strings.EqualFold("InternalServerException", errorCode): 1031 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1032 1033 case strings.EqualFold("ThrottlingException", errorCode): 1034 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1035 1036 case strings.EqualFold("ValidationException", errorCode): 1037 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1038 1039 default: 1040 genericError := &smithy.GenericAPIError{ 1041 Code: errorCode, 1042 Message: errorMessage, 1043 } 1044 return genericError 1045 1046 } 1047} 1048 1049func awsRestjson1_deserializeOpDocumentCreateGeofenceCollectionOutput(v **CreateGeofenceCollectionOutput, value interface{}) error { 1050 if v == nil { 1051 return fmt.Errorf("unexpected nil of type %T", v) 1052 } 1053 if value == nil { 1054 return nil 1055 } 1056 1057 shape, ok := value.(map[string]interface{}) 1058 if !ok { 1059 return fmt.Errorf("unexpected JSON type %v", value) 1060 } 1061 1062 var sv *CreateGeofenceCollectionOutput 1063 if *v == nil { 1064 sv = &CreateGeofenceCollectionOutput{} 1065 } else { 1066 sv = *v 1067 } 1068 1069 for key, value := range shape { 1070 switch key { 1071 case "CollectionArn": 1072 if value != nil { 1073 jtv, ok := value.(string) 1074 if !ok { 1075 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1076 } 1077 sv.CollectionArn = ptr.String(jtv) 1078 } 1079 1080 case "CollectionName": 1081 if value != nil { 1082 jtv, ok := value.(string) 1083 if !ok { 1084 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 1085 } 1086 sv.CollectionName = ptr.String(jtv) 1087 } 1088 1089 case "CreateTime": 1090 if value != nil { 1091 jtv, ok := value.(string) 1092 if !ok { 1093 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1094 } 1095 t, err := smithytime.ParseDateTime(jtv) 1096 if err != nil { 1097 return err 1098 } 1099 sv.CreateTime = ptr.Time(t) 1100 } 1101 1102 default: 1103 _, _ = key, value 1104 1105 } 1106 } 1107 *v = sv 1108 return nil 1109} 1110 1111type awsRestjson1_deserializeOpCreateMap struct { 1112} 1113 1114func (*awsRestjson1_deserializeOpCreateMap) ID() string { 1115 return "OperationDeserializer" 1116} 1117 1118func (m *awsRestjson1_deserializeOpCreateMap) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1119 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1120) { 1121 out, metadata, err = next.HandleDeserialize(ctx, in) 1122 if err != nil { 1123 return out, metadata, err 1124 } 1125 1126 response, ok := out.RawResponse.(*smithyhttp.Response) 1127 if !ok { 1128 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1129 } 1130 1131 if response.StatusCode < 200 || response.StatusCode >= 300 { 1132 return out, metadata, awsRestjson1_deserializeOpErrorCreateMap(response, &metadata) 1133 } 1134 output := &CreateMapOutput{} 1135 out.Result = output 1136 1137 var buff [1024]byte 1138 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1139 1140 body := io.TeeReader(response.Body, ringBuffer) 1141 1142 decoder := json.NewDecoder(body) 1143 decoder.UseNumber() 1144 var shape interface{} 1145 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1146 var snapshot bytes.Buffer 1147 io.Copy(&snapshot, ringBuffer) 1148 err = &smithy.DeserializationError{ 1149 Err: fmt.Errorf("failed to decode response body, %w", err), 1150 Snapshot: snapshot.Bytes(), 1151 } 1152 return out, metadata, err 1153 } 1154 1155 err = awsRestjson1_deserializeOpDocumentCreateMapOutput(&output, shape) 1156 if err != nil { 1157 var snapshot bytes.Buffer 1158 io.Copy(&snapshot, ringBuffer) 1159 return out, metadata, &smithy.DeserializationError{ 1160 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1161 Snapshot: snapshot.Bytes(), 1162 } 1163 } 1164 1165 return out, metadata, err 1166} 1167 1168func awsRestjson1_deserializeOpErrorCreateMap(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1169 var errorBuffer bytes.Buffer 1170 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1171 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1172 } 1173 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1174 1175 errorCode := "UnknownError" 1176 errorMessage := errorCode 1177 1178 code := response.Header.Get("X-Amzn-ErrorType") 1179 if len(code) != 0 { 1180 errorCode = restjson.SanitizeErrorCode(code) 1181 } 1182 1183 var buff [1024]byte 1184 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1185 1186 body := io.TeeReader(errorBody, ringBuffer) 1187 decoder := json.NewDecoder(body) 1188 decoder.UseNumber() 1189 code, message, err := restjson.GetErrorInfo(decoder) 1190 if err != nil { 1191 var snapshot bytes.Buffer 1192 io.Copy(&snapshot, ringBuffer) 1193 err = &smithy.DeserializationError{ 1194 Err: fmt.Errorf("failed to decode response body, %w", err), 1195 Snapshot: snapshot.Bytes(), 1196 } 1197 return err 1198 } 1199 1200 errorBody.Seek(0, io.SeekStart) 1201 if len(code) != 0 { 1202 errorCode = restjson.SanitizeErrorCode(code) 1203 } 1204 if len(message) != 0 { 1205 errorMessage = message 1206 } 1207 1208 switch { 1209 case strings.EqualFold("AccessDeniedException", errorCode): 1210 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1211 1212 case strings.EqualFold("ConflictException", errorCode): 1213 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1214 1215 case strings.EqualFold("InternalServerException", errorCode): 1216 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1217 1218 case strings.EqualFold("ThrottlingException", errorCode): 1219 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1220 1221 case strings.EqualFold("ValidationException", errorCode): 1222 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1223 1224 default: 1225 genericError := &smithy.GenericAPIError{ 1226 Code: errorCode, 1227 Message: errorMessage, 1228 } 1229 return genericError 1230 1231 } 1232} 1233 1234func awsRestjson1_deserializeOpDocumentCreateMapOutput(v **CreateMapOutput, value interface{}) error { 1235 if v == nil { 1236 return fmt.Errorf("unexpected nil of type %T", v) 1237 } 1238 if value == nil { 1239 return nil 1240 } 1241 1242 shape, ok := value.(map[string]interface{}) 1243 if !ok { 1244 return fmt.Errorf("unexpected JSON type %v", value) 1245 } 1246 1247 var sv *CreateMapOutput 1248 if *v == nil { 1249 sv = &CreateMapOutput{} 1250 } else { 1251 sv = *v 1252 } 1253 1254 for key, value := range shape { 1255 switch key { 1256 case "CreateTime": 1257 if value != nil { 1258 jtv, ok := value.(string) 1259 if !ok { 1260 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1261 } 1262 t, err := smithytime.ParseDateTime(jtv) 1263 if err != nil { 1264 return err 1265 } 1266 sv.CreateTime = ptr.Time(t) 1267 } 1268 1269 case "MapArn": 1270 if value != nil { 1271 jtv, ok := value.(string) 1272 if !ok { 1273 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1274 } 1275 sv.MapArn = ptr.String(jtv) 1276 } 1277 1278 case "MapName": 1279 if value != nil { 1280 jtv, ok := value.(string) 1281 if !ok { 1282 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 1283 } 1284 sv.MapName = ptr.String(jtv) 1285 } 1286 1287 default: 1288 _, _ = key, value 1289 1290 } 1291 } 1292 *v = sv 1293 return nil 1294} 1295 1296type awsRestjson1_deserializeOpCreatePlaceIndex struct { 1297} 1298 1299func (*awsRestjson1_deserializeOpCreatePlaceIndex) ID() string { 1300 return "OperationDeserializer" 1301} 1302 1303func (m *awsRestjson1_deserializeOpCreatePlaceIndex) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1304 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1305) { 1306 out, metadata, err = next.HandleDeserialize(ctx, in) 1307 if err != nil { 1308 return out, metadata, err 1309 } 1310 1311 response, ok := out.RawResponse.(*smithyhttp.Response) 1312 if !ok { 1313 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1314 } 1315 1316 if response.StatusCode < 200 || response.StatusCode >= 300 { 1317 return out, metadata, awsRestjson1_deserializeOpErrorCreatePlaceIndex(response, &metadata) 1318 } 1319 output := &CreatePlaceIndexOutput{} 1320 out.Result = output 1321 1322 var buff [1024]byte 1323 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1324 1325 body := io.TeeReader(response.Body, ringBuffer) 1326 1327 decoder := json.NewDecoder(body) 1328 decoder.UseNumber() 1329 var shape interface{} 1330 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1331 var snapshot bytes.Buffer 1332 io.Copy(&snapshot, ringBuffer) 1333 err = &smithy.DeserializationError{ 1334 Err: fmt.Errorf("failed to decode response body, %w", err), 1335 Snapshot: snapshot.Bytes(), 1336 } 1337 return out, metadata, err 1338 } 1339 1340 err = awsRestjson1_deserializeOpDocumentCreatePlaceIndexOutput(&output, shape) 1341 if err != nil { 1342 var snapshot bytes.Buffer 1343 io.Copy(&snapshot, ringBuffer) 1344 return out, metadata, &smithy.DeserializationError{ 1345 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1346 Snapshot: snapshot.Bytes(), 1347 } 1348 } 1349 1350 return out, metadata, err 1351} 1352 1353func awsRestjson1_deserializeOpErrorCreatePlaceIndex(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1354 var errorBuffer bytes.Buffer 1355 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1356 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1357 } 1358 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1359 1360 errorCode := "UnknownError" 1361 errorMessage := errorCode 1362 1363 code := response.Header.Get("X-Amzn-ErrorType") 1364 if len(code) != 0 { 1365 errorCode = restjson.SanitizeErrorCode(code) 1366 } 1367 1368 var buff [1024]byte 1369 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1370 1371 body := io.TeeReader(errorBody, ringBuffer) 1372 decoder := json.NewDecoder(body) 1373 decoder.UseNumber() 1374 code, message, err := restjson.GetErrorInfo(decoder) 1375 if err != nil { 1376 var snapshot bytes.Buffer 1377 io.Copy(&snapshot, ringBuffer) 1378 err = &smithy.DeserializationError{ 1379 Err: fmt.Errorf("failed to decode response body, %w", err), 1380 Snapshot: snapshot.Bytes(), 1381 } 1382 return err 1383 } 1384 1385 errorBody.Seek(0, io.SeekStart) 1386 if len(code) != 0 { 1387 errorCode = restjson.SanitizeErrorCode(code) 1388 } 1389 if len(message) != 0 { 1390 errorMessage = message 1391 } 1392 1393 switch { 1394 case strings.EqualFold("AccessDeniedException", errorCode): 1395 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1396 1397 case strings.EqualFold("ConflictException", errorCode): 1398 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1399 1400 case strings.EqualFold("InternalServerException", errorCode): 1401 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1402 1403 case strings.EqualFold("ThrottlingException", errorCode): 1404 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1405 1406 case strings.EqualFold("ValidationException", errorCode): 1407 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1408 1409 default: 1410 genericError := &smithy.GenericAPIError{ 1411 Code: errorCode, 1412 Message: errorMessage, 1413 } 1414 return genericError 1415 1416 } 1417} 1418 1419func awsRestjson1_deserializeOpDocumentCreatePlaceIndexOutput(v **CreatePlaceIndexOutput, value interface{}) error { 1420 if v == nil { 1421 return fmt.Errorf("unexpected nil of type %T", v) 1422 } 1423 if value == nil { 1424 return nil 1425 } 1426 1427 shape, ok := value.(map[string]interface{}) 1428 if !ok { 1429 return fmt.Errorf("unexpected JSON type %v", value) 1430 } 1431 1432 var sv *CreatePlaceIndexOutput 1433 if *v == nil { 1434 sv = &CreatePlaceIndexOutput{} 1435 } else { 1436 sv = *v 1437 } 1438 1439 for key, value := range shape { 1440 switch key { 1441 case "CreateTime": 1442 if value != nil { 1443 jtv, ok := value.(string) 1444 if !ok { 1445 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1446 } 1447 t, err := smithytime.ParseDateTime(jtv) 1448 if err != nil { 1449 return err 1450 } 1451 sv.CreateTime = ptr.Time(t) 1452 } 1453 1454 case "IndexArn": 1455 if value != nil { 1456 jtv, ok := value.(string) 1457 if !ok { 1458 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1459 } 1460 sv.IndexArn = ptr.String(jtv) 1461 } 1462 1463 case "IndexName": 1464 if value != nil { 1465 jtv, ok := value.(string) 1466 if !ok { 1467 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 1468 } 1469 sv.IndexName = ptr.String(jtv) 1470 } 1471 1472 default: 1473 _, _ = key, value 1474 1475 } 1476 } 1477 *v = sv 1478 return nil 1479} 1480 1481type awsRestjson1_deserializeOpCreateTracker struct { 1482} 1483 1484func (*awsRestjson1_deserializeOpCreateTracker) ID() string { 1485 return "OperationDeserializer" 1486} 1487 1488func (m *awsRestjson1_deserializeOpCreateTracker) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1489 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1490) { 1491 out, metadata, err = next.HandleDeserialize(ctx, in) 1492 if err != nil { 1493 return out, metadata, err 1494 } 1495 1496 response, ok := out.RawResponse.(*smithyhttp.Response) 1497 if !ok { 1498 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1499 } 1500 1501 if response.StatusCode < 200 || response.StatusCode >= 300 { 1502 return out, metadata, awsRestjson1_deserializeOpErrorCreateTracker(response, &metadata) 1503 } 1504 output := &CreateTrackerOutput{} 1505 out.Result = output 1506 1507 var buff [1024]byte 1508 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1509 1510 body := io.TeeReader(response.Body, ringBuffer) 1511 1512 decoder := json.NewDecoder(body) 1513 decoder.UseNumber() 1514 var shape interface{} 1515 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1516 var snapshot bytes.Buffer 1517 io.Copy(&snapshot, ringBuffer) 1518 err = &smithy.DeserializationError{ 1519 Err: fmt.Errorf("failed to decode response body, %w", err), 1520 Snapshot: snapshot.Bytes(), 1521 } 1522 return out, metadata, err 1523 } 1524 1525 err = awsRestjson1_deserializeOpDocumentCreateTrackerOutput(&output, shape) 1526 if err != nil { 1527 var snapshot bytes.Buffer 1528 io.Copy(&snapshot, ringBuffer) 1529 return out, metadata, &smithy.DeserializationError{ 1530 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1531 Snapshot: snapshot.Bytes(), 1532 } 1533 } 1534 1535 return out, metadata, err 1536} 1537 1538func awsRestjson1_deserializeOpErrorCreateTracker(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1539 var errorBuffer bytes.Buffer 1540 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1541 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1542 } 1543 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1544 1545 errorCode := "UnknownError" 1546 errorMessage := errorCode 1547 1548 code := response.Header.Get("X-Amzn-ErrorType") 1549 if len(code) != 0 { 1550 errorCode = restjson.SanitizeErrorCode(code) 1551 } 1552 1553 var buff [1024]byte 1554 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1555 1556 body := io.TeeReader(errorBody, ringBuffer) 1557 decoder := json.NewDecoder(body) 1558 decoder.UseNumber() 1559 code, message, err := restjson.GetErrorInfo(decoder) 1560 if err != nil { 1561 var snapshot bytes.Buffer 1562 io.Copy(&snapshot, ringBuffer) 1563 err = &smithy.DeserializationError{ 1564 Err: fmt.Errorf("failed to decode response body, %w", err), 1565 Snapshot: snapshot.Bytes(), 1566 } 1567 return err 1568 } 1569 1570 errorBody.Seek(0, io.SeekStart) 1571 if len(code) != 0 { 1572 errorCode = restjson.SanitizeErrorCode(code) 1573 } 1574 if len(message) != 0 { 1575 errorMessage = message 1576 } 1577 1578 switch { 1579 case strings.EqualFold("AccessDeniedException", errorCode): 1580 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1581 1582 case strings.EqualFold("ConflictException", errorCode): 1583 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1584 1585 case strings.EqualFold("InternalServerException", errorCode): 1586 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1587 1588 case strings.EqualFold("ThrottlingException", errorCode): 1589 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1590 1591 case strings.EqualFold("ValidationException", errorCode): 1592 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1593 1594 default: 1595 genericError := &smithy.GenericAPIError{ 1596 Code: errorCode, 1597 Message: errorMessage, 1598 } 1599 return genericError 1600 1601 } 1602} 1603 1604func awsRestjson1_deserializeOpDocumentCreateTrackerOutput(v **CreateTrackerOutput, value interface{}) error { 1605 if v == nil { 1606 return fmt.Errorf("unexpected nil of type %T", v) 1607 } 1608 if value == nil { 1609 return nil 1610 } 1611 1612 shape, ok := value.(map[string]interface{}) 1613 if !ok { 1614 return fmt.Errorf("unexpected JSON type %v", value) 1615 } 1616 1617 var sv *CreateTrackerOutput 1618 if *v == nil { 1619 sv = &CreateTrackerOutput{} 1620 } else { 1621 sv = *v 1622 } 1623 1624 for key, value := range shape { 1625 switch key { 1626 case "CreateTime": 1627 if value != nil { 1628 jtv, ok := value.(string) 1629 if !ok { 1630 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1631 } 1632 t, err := smithytime.ParseDateTime(jtv) 1633 if err != nil { 1634 return err 1635 } 1636 sv.CreateTime = ptr.Time(t) 1637 } 1638 1639 case "TrackerArn": 1640 if value != nil { 1641 jtv, ok := value.(string) 1642 if !ok { 1643 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1644 } 1645 sv.TrackerArn = ptr.String(jtv) 1646 } 1647 1648 case "TrackerName": 1649 if value != nil { 1650 jtv, ok := value.(string) 1651 if !ok { 1652 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 1653 } 1654 sv.TrackerName = ptr.String(jtv) 1655 } 1656 1657 default: 1658 _, _ = key, value 1659 1660 } 1661 } 1662 *v = sv 1663 return nil 1664} 1665 1666type awsRestjson1_deserializeOpDeleteGeofenceCollection struct { 1667} 1668 1669func (*awsRestjson1_deserializeOpDeleteGeofenceCollection) ID() string { 1670 return "OperationDeserializer" 1671} 1672 1673func (m *awsRestjson1_deserializeOpDeleteGeofenceCollection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1674 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1675) { 1676 out, metadata, err = next.HandleDeserialize(ctx, in) 1677 if err != nil { 1678 return out, metadata, err 1679 } 1680 1681 response, ok := out.RawResponse.(*smithyhttp.Response) 1682 if !ok { 1683 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1684 } 1685 1686 if response.StatusCode < 200 || response.StatusCode >= 300 { 1687 return out, metadata, awsRestjson1_deserializeOpErrorDeleteGeofenceCollection(response, &metadata) 1688 } 1689 output := &DeleteGeofenceCollectionOutput{} 1690 out.Result = output 1691 1692 return out, metadata, err 1693} 1694 1695func awsRestjson1_deserializeOpErrorDeleteGeofenceCollection(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1696 var errorBuffer bytes.Buffer 1697 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1698 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1699 } 1700 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1701 1702 errorCode := "UnknownError" 1703 errorMessage := errorCode 1704 1705 code := response.Header.Get("X-Amzn-ErrorType") 1706 if len(code) != 0 { 1707 errorCode = restjson.SanitizeErrorCode(code) 1708 } 1709 1710 var buff [1024]byte 1711 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1712 1713 body := io.TeeReader(errorBody, ringBuffer) 1714 decoder := json.NewDecoder(body) 1715 decoder.UseNumber() 1716 code, message, err := restjson.GetErrorInfo(decoder) 1717 if err != nil { 1718 var snapshot bytes.Buffer 1719 io.Copy(&snapshot, ringBuffer) 1720 err = &smithy.DeserializationError{ 1721 Err: fmt.Errorf("failed to decode response body, %w", err), 1722 Snapshot: snapshot.Bytes(), 1723 } 1724 return err 1725 } 1726 1727 errorBody.Seek(0, io.SeekStart) 1728 if len(code) != 0 { 1729 errorCode = restjson.SanitizeErrorCode(code) 1730 } 1731 if len(message) != 0 { 1732 errorMessage = message 1733 } 1734 1735 switch { 1736 case strings.EqualFold("AccessDeniedException", errorCode): 1737 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1738 1739 case strings.EqualFold("InternalServerException", errorCode): 1740 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1741 1742 case strings.EqualFold("ResourceNotFoundException", errorCode): 1743 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1744 1745 case strings.EqualFold("ThrottlingException", errorCode): 1746 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1747 1748 case strings.EqualFold("ValidationException", errorCode): 1749 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1750 1751 default: 1752 genericError := &smithy.GenericAPIError{ 1753 Code: errorCode, 1754 Message: errorMessage, 1755 } 1756 return genericError 1757 1758 } 1759} 1760 1761type awsRestjson1_deserializeOpDeleteMap struct { 1762} 1763 1764func (*awsRestjson1_deserializeOpDeleteMap) ID() string { 1765 return "OperationDeserializer" 1766} 1767 1768func (m *awsRestjson1_deserializeOpDeleteMap) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1769 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1770) { 1771 out, metadata, err = next.HandleDeserialize(ctx, in) 1772 if err != nil { 1773 return out, metadata, err 1774 } 1775 1776 response, ok := out.RawResponse.(*smithyhttp.Response) 1777 if !ok { 1778 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1779 } 1780 1781 if response.StatusCode < 200 || response.StatusCode >= 300 { 1782 return out, metadata, awsRestjson1_deserializeOpErrorDeleteMap(response, &metadata) 1783 } 1784 output := &DeleteMapOutput{} 1785 out.Result = output 1786 1787 return out, metadata, err 1788} 1789 1790func awsRestjson1_deserializeOpErrorDeleteMap(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1791 var errorBuffer bytes.Buffer 1792 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1793 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1794 } 1795 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1796 1797 errorCode := "UnknownError" 1798 errorMessage := errorCode 1799 1800 code := response.Header.Get("X-Amzn-ErrorType") 1801 if len(code) != 0 { 1802 errorCode = restjson.SanitizeErrorCode(code) 1803 } 1804 1805 var buff [1024]byte 1806 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1807 1808 body := io.TeeReader(errorBody, ringBuffer) 1809 decoder := json.NewDecoder(body) 1810 decoder.UseNumber() 1811 code, message, err := restjson.GetErrorInfo(decoder) 1812 if err != nil { 1813 var snapshot bytes.Buffer 1814 io.Copy(&snapshot, ringBuffer) 1815 err = &smithy.DeserializationError{ 1816 Err: fmt.Errorf("failed to decode response body, %w", err), 1817 Snapshot: snapshot.Bytes(), 1818 } 1819 return err 1820 } 1821 1822 errorBody.Seek(0, io.SeekStart) 1823 if len(code) != 0 { 1824 errorCode = restjson.SanitizeErrorCode(code) 1825 } 1826 if len(message) != 0 { 1827 errorMessage = message 1828 } 1829 1830 switch { 1831 case strings.EqualFold("AccessDeniedException", errorCode): 1832 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1833 1834 case strings.EqualFold("InternalServerException", errorCode): 1835 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1836 1837 case strings.EqualFold("ResourceNotFoundException", errorCode): 1838 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1839 1840 case strings.EqualFold("ThrottlingException", errorCode): 1841 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1842 1843 case strings.EqualFold("ValidationException", errorCode): 1844 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1845 1846 default: 1847 genericError := &smithy.GenericAPIError{ 1848 Code: errorCode, 1849 Message: errorMessage, 1850 } 1851 return genericError 1852 1853 } 1854} 1855 1856type awsRestjson1_deserializeOpDeletePlaceIndex struct { 1857} 1858 1859func (*awsRestjson1_deserializeOpDeletePlaceIndex) ID() string { 1860 return "OperationDeserializer" 1861} 1862 1863func (m *awsRestjson1_deserializeOpDeletePlaceIndex) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1864 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1865) { 1866 out, metadata, err = next.HandleDeserialize(ctx, in) 1867 if err != nil { 1868 return out, metadata, err 1869 } 1870 1871 response, ok := out.RawResponse.(*smithyhttp.Response) 1872 if !ok { 1873 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1874 } 1875 1876 if response.StatusCode < 200 || response.StatusCode >= 300 { 1877 return out, metadata, awsRestjson1_deserializeOpErrorDeletePlaceIndex(response, &metadata) 1878 } 1879 output := &DeletePlaceIndexOutput{} 1880 out.Result = output 1881 1882 return out, metadata, err 1883} 1884 1885func awsRestjson1_deserializeOpErrorDeletePlaceIndex(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1886 var errorBuffer bytes.Buffer 1887 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1888 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1889 } 1890 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1891 1892 errorCode := "UnknownError" 1893 errorMessage := errorCode 1894 1895 code := response.Header.Get("X-Amzn-ErrorType") 1896 if len(code) != 0 { 1897 errorCode = restjson.SanitizeErrorCode(code) 1898 } 1899 1900 var buff [1024]byte 1901 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1902 1903 body := io.TeeReader(errorBody, ringBuffer) 1904 decoder := json.NewDecoder(body) 1905 decoder.UseNumber() 1906 code, message, err := restjson.GetErrorInfo(decoder) 1907 if err != nil { 1908 var snapshot bytes.Buffer 1909 io.Copy(&snapshot, ringBuffer) 1910 err = &smithy.DeserializationError{ 1911 Err: fmt.Errorf("failed to decode response body, %w", err), 1912 Snapshot: snapshot.Bytes(), 1913 } 1914 return err 1915 } 1916 1917 errorBody.Seek(0, io.SeekStart) 1918 if len(code) != 0 { 1919 errorCode = restjson.SanitizeErrorCode(code) 1920 } 1921 if len(message) != 0 { 1922 errorMessage = message 1923 } 1924 1925 switch { 1926 case strings.EqualFold("AccessDeniedException", errorCode): 1927 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1928 1929 case strings.EqualFold("InternalServerException", errorCode): 1930 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1931 1932 case strings.EqualFold("ResourceNotFoundException", errorCode): 1933 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1934 1935 case strings.EqualFold("ThrottlingException", errorCode): 1936 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1937 1938 case strings.EqualFold("ValidationException", errorCode): 1939 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1940 1941 default: 1942 genericError := &smithy.GenericAPIError{ 1943 Code: errorCode, 1944 Message: errorMessage, 1945 } 1946 return genericError 1947 1948 } 1949} 1950 1951type awsRestjson1_deserializeOpDeleteTracker struct { 1952} 1953 1954func (*awsRestjson1_deserializeOpDeleteTracker) ID() string { 1955 return "OperationDeserializer" 1956} 1957 1958func (m *awsRestjson1_deserializeOpDeleteTracker) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1959 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1960) { 1961 out, metadata, err = next.HandleDeserialize(ctx, in) 1962 if err != nil { 1963 return out, metadata, err 1964 } 1965 1966 response, ok := out.RawResponse.(*smithyhttp.Response) 1967 if !ok { 1968 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1969 } 1970 1971 if response.StatusCode < 200 || response.StatusCode >= 300 { 1972 return out, metadata, awsRestjson1_deserializeOpErrorDeleteTracker(response, &metadata) 1973 } 1974 output := &DeleteTrackerOutput{} 1975 out.Result = output 1976 1977 return out, metadata, err 1978} 1979 1980func awsRestjson1_deserializeOpErrorDeleteTracker(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1981 var errorBuffer bytes.Buffer 1982 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1983 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1984 } 1985 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1986 1987 errorCode := "UnknownError" 1988 errorMessage := errorCode 1989 1990 code := response.Header.Get("X-Amzn-ErrorType") 1991 if len(code) != 0 { 1992 errorCode = restjson.SanitizeErrorCode(code) 1993 } 1994 1995 var buff [1024]byte 1996 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1997 1998 body := io.TeeReader(errorBody, ringBuffer) 1999 decoder := json.NewDecoder(body) 2000 decoder.UseNumber() 2001 code, message, err := restjson.GetErrorInfo(decoder) 2002 if err != nil { 2003 var snapshot bytes.Buffer 2004 io.Copy(&snapshot, ringBuffer) 2005 err = &smithy.DeserializationError{ 2006 Err: fmt.Errorf("failed to decode response body, %w", err), 2007 Snapshot: snapshot.Bytes(), 2008 } 2009 return err 2010 } 2011 2012 errorBody.Seek(0, io.SeekStart) 2013 if len(code) != 0 { 2014 errorCode = restjson.SanitizeErrorCode(code) 2015 } 2016 if len(message) != 0 { 2017 errorMessage = message 2018 } 2019 2020 switch { 2021 case strings.EqualFold("AccessDeniedException", errorCode): 2022 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2023 2024 case strings.EqualFold("InternalServerException", errorCode): 2025 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2026 2027 case strings.EqualFold("ResourceNotFoundException", errorCode): 2028 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2029 2030 case strings.EqualFold("ThrottlingException", errorCode): 2031 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2032 2033 case strings.EqualFold("ValidationException", errorCode): 2034 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2035 2036 default: 2037 genericError := &smithy.GenericAPIError{ 2038 Code: errorCode, 2039 Message: errorMessage, 2040 } 2041 return genericError 2042 2043 } 2044} 2045 2046type awsRestjson1_deserializeOpDescribeGeofenceCollection struct { 2047} 2048 2049func (*awsRestjson1_deserializeOpDescribeGeofenceCollection) ID() string { 2050 return "OperationDeserializer" 2051} 2052 2053func (m *awsRestjson1_deserializeOpDescribeGeofenceCollection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2054 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2055) { 2056 out, metadata, err = next.HandleDeserialize(ctx, in) 2057 if err != nil { 2058 return out, metadata, err 2059 } 2060 2061 response, ok := out.RawResponse.(*smithyhttp.Response) 2062 if !ok { 2063 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2064 } 2065 2066 if response.StatusCode < 200 || response.StatusCode >= 300 { 2067 return out, metadata, awsRestjson1_deserializeOpErrorDescribeGeofenceCollection(response, &metadata) 2068 } 2069 output := &DescribeGeofenceCollectionOutput{} 2070 out.Result = output 2071 2072 var buff [1024]byte 2073 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2074 2075 body := io.TeeReader(response.Body, ringBuffer) 2076 2077 decoder := json.NewDecoder(body) 2078 decoder.UseNumber() 2079 var shape interface{} 2080 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2081 var snapshot bytes.Buffer 2082 io.Copy(&snapshot, ringBuffer) 2083 err = &smithy.DeserializationError{ 2084 Err: fmt.Errorf("failed to decode response body, %w", err), 2085 Snapshot: snapshot.Bytes(), 2086 } 2087 return out, metadata, err 2088 } 2089 2090 err = awsRestjson1_deserializeOpDocumentDescribeGeofenceCollectionOutput(&output, shape) 2091 if err != nil { 2092 var snapshot bytes.Buffer 2093 io.Copy(&snapshot, ringBuffer) 2094 return out, metadata, &smithy.DeserializationError{ 2095 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2096 Snapshot: snapshot.Bytes(), 2097 } 2098 } 2099 2100 return out, metadata, err 2101} 2102 2103func awsRestjson1_deserializeOpErrorDescribeGeofenceCollection(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2104 var errorBuffer bytes.Buffer 2105 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2106 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2107 } 2108 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2109 2110 errorCode := "UnknownError" 2111 errorMessage := errorCode 2112 2113 code := response.Header.Get("X-Amzn-ErrorType") 2114 if len(code) != 0 { 2115 errorCode = restjson.SanitizeErrorCode(code) 2116 } 2117 2118 var buff [1024]byte 2119 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2120 2121 body := io.TeeReader(errorBody, ringBuffer) 2122 decoder := json.NewDecoder(body) 2123 decoder.UseNumber() 2124 code, message, err := restjson.GetErrorInfo(decoder) 2125 if err != nil { 2126 var snapshot bytes.Buffer 2127 io.Copy(&snapshot, ringBuffer) 2128 err = &smithy.DeserializationError{ 2129 Err: fmt.Errorf("failed to decode response body, %w", err), 2130 Snapshot: snapshot.Bytes(), 2131 } 2132 return err 2133 } 2134 2135 errorBody.Seek(0, io.SeekStart) 2136 if len(code) != 0 { 2137 errorCode = restjson.SanitizeErrorCode(code) 2138 } 2139 if len(message) != 0 { 2140 errorMessage = message 2141 } 2142 2143 switch { 2144 case strings.EqualFold("AccessDeniedException", errorCode): 2145 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2146 2147 case strings.EqualFold("InternalServerException", errorCode): 2148 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2149 2150 case strings.EqualFold("ResourceNotFoundException", errorCode): 2151 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2152 2153 case strings.EqualFold("ThrottlingException", errorCode): 2154 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2155 2156 case strings.EqualFold("ValidationException", errorCode): 2157 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2158 2159 default: 2160 genericError := &smithy.GenericAPIError{ 2161 Code: errorCode, 2162 Message: errorMessage, 2163 } 2164 return genericError 2165 2166 } 2167} 2168 2169func awsRestjson1_deserializeOpDocumentDescribeGeofenceCollectionOutput(v **DescribeGeofenceCollectionOutput, value interface{}) error { 2170 if v == nil { 2171 return fmt.Errorf("unexpected nil of type %T", v) 2172 } 2173 if value == nil { 2174 return nil 2175 } 2176 2177 shape, ok := value.(map[string]interface{}) 2178 if !ok { 2179 return fmt.Errorf("unexpected JSON type %v", value) 2180 } 2181 2182 var sv *DescribeGeofenceCollectionOutput 2183 if *v == nil { 2184 sv = &DescribeGeofenceCollectionOutput{} 2185 } else { 2186 sv = *v 2187 } 2188 2189 for key, value := range shape { 2190 switch key { 2191 case "CollectionArn": 2192 if value != nil { 2193 jtv, ok := value.(string) 2194 if !ok { 2195 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2196 } 2197 sv.CollectionArn = ptr.String(jtv) 2198 } 2199 2200 case "CollectionName": 2201 if value != nil { 2202 jtv, ok := value.(string) 2203 if !ok { 2204 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 2205 } 2206 sv.CollectionName = ptr.String(jtv) 2207 } 2208 2209 case "CreateTime": 2210 if value != nil { 2211 jtv, ok := value.(string) 2212 if !ok { 2213 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2214 } 2215 t, err := smithytime.ParseDateTime(jtv) 2216 if err != nil { 2217 return err 2218 } 2219 sv.CreateTime = ptr.Time(t) 2220 } 2221 2222 case "Description": 2223 if value != nil { 2224 jtv, ok := value.(string) 2225 if !ok { 2226 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 2227 } 2228 sv.Description = ptr.String(jtv) 2229 } 2230 2231 case "PricingPlan": 2232 if value != nil { 2233 jtv, ok := value.(string) 2234 if !ok { 2235 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 2236 } 2237 sv.PricingPlan = types.PricingPlan(jtv) 2238 } 2239 2240 case "PricingPlanDataSource": 2241 if value != nil { 2242 jtv, ok := value.(string) 2243 if !ok { 2244 return fmt.Errorf("expected String to be of type string, got %T instead", value) 2245 } 2246 sv.PricingPlanDataSource = ptr.String(jtv) 2247 } 2248 2249 case "UpdateTime": 2250 if value != nil { 2251 jtv, ok := value.(string) 2252 if !ok { 2253 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2254 } 2255 t, err := smithytime.ParseDateTime(jtv) 2256 if err != nil { 2257 return err 2258 } 2259 sv.UpdateTime = ptr.Time(t) 2260 } 2261 2262 default: 2263 _, _ = key, value 2264 2265 } 2266 } 2267 *v = sv 2268 return nil 2269} 2270 2271type awsRestjson1_deserializeOpDescribeMap struct { 2272} 2273 2274func (*awsRestjson1_deserializeOpDescribeMap) ID() string { 2275 return "OperationDeserializer" 2276} 2277 2278func (m *awsRestjson1_deserializeOpDescribeMap) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2279 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2280) { 2281 out, metadata, err = next.HandleDeserialize(ctx, in) 2282 if err != nil { 2283 return out, metadata, err 2284 } 2285 2286 response, ok := out.RawResponse.(*smithyhttp.Response) 2287 if !ok { 2288 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2289 } 2290 2291 if response.StatusCode < 200 || response.StatusCode >= 300 { 2292 return out, metadata, awsRestjson1_deserializeOpErrorDescribeMap(response, &metadata) 2293 } 2294 output := &DescribeMapOutput{} 2295 out.Result = output 2296 2297 var buff [1024]byte 2298 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2299 2300 body := io.TeeReader(response.Body, ringBuffer) 2301 2302 decoder := json.NewDecoder(body) 2303 decoder.UseNumber() 2304 var shape interface{} 2305 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2306 var snapshot bytes.Buffer 2307 io.Copy(&snapshot, ringBuffer) 2308 err = &smithy.DeserializationError{ 2309 Err: fmt.Errorf("failed to decode response body, %w", err), 2310 Snapshot: snapshot.Bytes(), 2311 } 2312 return out, metadata, err 2313 } 2314 2315 err = awsRestjson1_deserializeOpDocumentDescribeMapOutput(&output, shape) 2316 if err != nil { 2317 var snapshot bytes.Buffer 2318 io.Copy(&snapshot, ringBuffer) 2319 return out, metadata, &smithy.DeserializationError{ 2320 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2321 Snapshot: snapshot.Bytes(), 2322 } 2323 } 2324 2325 return out, metadata, err 2326} 2327 2328func awsRestjson1_deserializeOpErrorDescribeMap(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2329 var errorBuffer bytes.Buffer 2330 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2331 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2332 } 2333 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2334 2335 errorCode := "UnknownError" 2336 errorMessage := errorCode 2337 2338 code := response.Header.Get("X-Amzn-ErrorType") 2339 if len(code) != 0 { 2340 errorCode = restjson.SanitizeErrorCode(code) 2341 } 2342 2343 var buff [1024]byte 2344 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2345 2346 body := io.TeeReader(errorBody, ringBuffer) 2347 decoder := json.NewDecoder(body) 2348 decoder.UseNumber() 2349 code, message, err := restjson.GetErrorInfo(decoder) 2350 if err != nil { 2351 var snapshot bytes.Buffer 2352 io.Copy(&snapshot, ringBuffer) 2353 err = &smithy.DeserializationError{ 2354 Err: fmt.Errorf("failed to decode response body, %w", err), 2355 Snapshot: snapshot.Bytes(), 2356 } 2357 return err 2358 } 2359 2360 errorBody.Seek(0, io.SeekStart) 2361 if len(code) != 0 { 2362 errorCode = restjson.SanitizeErrorCode(code) 2363 } 2364 if len(message) != 0 { 2365 errorMessage = message 2366 } 2367 2368 switch { 2369 case strings.EqualFold("AccessDeniedException", errorCode): 2370 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2371 2372 case strings.EqualFold("InternalServerException", errorCode): 2373 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2374 2375 case strings.EqualFold("ResourceNotFoundException", errorCode): 2376 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2377 2378 case strings.EqualFold("ThrottlingException", errorCode): 2379 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2380 2381 case strings.EqualFold("ValidationException", errorCode): 2382 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2383 2384 default: 2385 genericError := &smithy.GenericAPIError{ 2386 Code: errorCode, 2387 Message: errorMessage, 2388 } 2389 return genericError 2390 2391 } 2392} 2393 2394func awsRestjson1_deserializeOpDocumentDescribeMapOutput(v **DescribeMapOutput, value interface{}) error { 2395 if v == nil { 2396 return fmt.Errorf("unexpected nil of type %T", v) 2397 } 2398 if value == nil { 2399 return nil 2400 } 2401 2402 shape, ok := value.(map[string]interface{}) 2403 if !ok { 2404 return fmt.Errorf("unexpected JSON type %v", value) 2405 } 2406 2407 var sv *DescribeMapOutput 2408 if *v == nil { 2409 sv = &DescribeMapOutput{} 2410 } else { 2411 sv = *v 2412 } 2413 2414 for key, value := range shape { 2415 switch key { 2416 case "Configuration": 2417 if err := awsRestjson1_deserializeDocumentMapConfiguration(&sv.Configuration, value); err != nil { 2418 return err 2419 } 2420 2421 case "CreateTime": 2422 if value != nil { 2423 jtv, ok := value.(string) 2424 if !ok { 2425 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2426 } 2427 t, err := smithytime.ParseDateTime(jtv) 2428 if err != nil { 2429 return err 2430 } 2431 sv.CreateTime = ptr.Time(t) 2432 } 2433 2434 case "DataSource": 2435 if value != nil { 2436 jtv, ok := value.(string) 2437 if !ok { 2438 return fmt.Errorf("expected String to be of type string, got %T instead", value) 2439 } 2440 sv.DataSource = ptr.String(jtv) 2441 } 2442 2443 case "Description": 2444 if value != nil { 2445 jtv, ok := value.(string) 2446 if !ok { 2447 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 2448 } 2449 sv.Description = ptr.String(jtv) 2450 } 2451 2452 case "MapArn": 2453 if value != nil { 2454 jtv, ok := value.(string) 2455 if !ok { 2456 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2457 } 2458 sv.MapArn = ptr.String(jtv) 2459 } 2460 2461 case "MapName": 2462 if value != nil { 2463 jtv, ok := value.(string) 2464 if !ok { 2465 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 2466 } 2467 sv.MapName = ptr.String(jtv) 2468 } 2469 2470 case "PricingPlan": 2471 if value != nil { 2472 jtv, ok := value.(string) 2473 if !ok { 2474 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 2475 } 2476 sv.PricingPlan = types.PricingPlan(jtv) 2477 } 2478 2479 case "UpdateTime": 2480 if value != nil { 2481 jtv, ok := value.(string) 2482 if !ok { 2483 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2484 } 2485 t, err := smithytime.ParseDateTime(jtv) 2486 if err != nil { 2487 return err 2488 } 2489 sv.UpdateTime = ptr.Time(t) 2490 } 2491 2492 default: 2493 _, _ = key, value 2494 2495 } 2496 } 2497 *v = sv 2498 return nil 2499} 2500 2501type awsRestjson1_deserializeOpDescribePlaceIndex struct { 2502} 2503 2504func (*awsRestjson1_deserializeOpDescribePlaceIndex) ID() string { 2505 return "OperationDeserializer" 2506} 2507 2508func (m *awsRestjson1_deserializeOpDescribePlaceIndex) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2509 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2510) { 2511 out, metadata, err = next.HandleDeserialize(ctx, in) 2512 if err != nil { 2513 return out, metadata, err 2514 } 2515 2516 response, ok := out.RawResponse.(*smithyhttp.Response) 2517 if !ok { 2518 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2519 } 2520 2521 if response.StatusCode < 200 || response.StatusCode >= 300 { 2522 return out, metadata, awsRestjson1_deserializeOpErrorDescribePlaceIndex(response, &metadata) 2523 } 2524 output := &DescribePlaceIndexOutput{} 2525 out.Result = output 2526 2527 var buff [1024]byte 2528 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2529 2530 body := io.TeeReader(response.Body, ringBuffer) 2531 2532 decoder := json.NewDecoder(body) 2533 decoder.UseNumber() 2534 var shape interface{} 2535 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2536 var snapshot bytes.Buffer 2537 io.Copy(&snapshot, ringBuffer) 2538 err = &smithy.DeserializationError{ 2539 Err: fmt.Errorf("failed to decode response body, %w", err), 2540 Snapshot: snapshot.Bytes(), 2541 } 2542 return out, metadata, err 2543 } 2544 2545 err = awsRestjson1_deserializeOpDocumentDescribePlaceIndexOutput(&output, shape) 2546 if err != nil { 2547 var snapshot bytes.Buffer 2548 io.Copy(&snapshot, ringBuffer) 2549 return out, metadata, &smithy.DeserializationError{ 2550 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2551 Snapshot: snapshot.Bytes(), 2552 } 2553 } 2554 2555 return out, metadata, err 2556} 2557 2558func awsRestjson1_deserializeOpErrorDescribePlaceIndex(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2559 var errorBuffer bytes.Buffer 2560 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2561 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2562 } 2563 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2564 2565 errorCode := "UnknownError" 2566 errorMessage := errorCode 2567 2568 code := response.Header.Get("X-Amzn-ErrorType") 2569 if len(code) != 0 { 2570 errorCode = restjson.SanitizeErrorCode(code) 2571 } 2572 2573 var buff [1024]byte 2574 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2575 2576 body := io.TeeReader(errorBody, ringBuffer) 2577 decoder := json.NewDecoder(body) 2578 decoder.UseNumber() 2579 code, message, err := restjson.GetErrorInfo(decoder) 2580 if err != nil { 2581 var snapshot bytes.Buffer 2582 io.Copy(&snapshot, ringBuffer) 2583 err = &smithy.DeserializationError{ 2584 Err: fmt.Errorf("failed to decode response body, %w", err), 2585 Snapshot: snapshot.Bytes(), 2586 } 2587 return err 2588 } 2589 2590 errorBody.Seek(0, io.SeekStart) 2591 if len(code) != 0 { 2592 errorCode = restjson.SanitizeErrorCode(code) 2593 } 2594 if len(message) != 0 { 2595 errorMessage = message 2596 } 2597 2598 switch { 2599 case strings.EqualFold("AccessDeniedException", errorCode): 2600 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2601 2602 case strings.EqualFold("InternalServerException", errorCode): 2603 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2604 2605 case strings.EqualFold("ResourceNotFoundException", errorCode): 2606 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2607 2608 case strings.EqualFold("ThrottlingException", errorCode): 2609 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2610 2611 case strings.EqualFold("ValidationException", errorCode): 2612 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2613 2614 default: 2615 genericError := &smithy.GenericAPIError{ 2616 Code: errorCode, 2617 Message: errorMessage, 2618 } 2619 return genericError 2620 2621 } 2622} 2623 2624func awsRestjson1_deserializeOpDocumentDescribePlaceIndexOutput(v **DescribePlaceIndexOutput, value interface{}) error { 2625 if v == nil { 2626 return fmt.Errorf("unexpected nil of type %T", v) 2627 } 2628 if value == nil { 2629 return nil 2630 } 2631 2632 shape, ok := value.(map[string]interface{}) 2633 if !ok { 2634 return fmt.Errorf("unexpected JSON type %v", value) 2635 } 2636 2637 var sv *DescribePlaceIndexOutput 2638 if *v == nil { 2639 sv = &DescribePlaceIndexOutput{} 2640 } else { 2641 sv = *v 2642 } 2643 2644 for key, value := range shape { 2645 switch key { 2646 case "CreateTime": 2647 if value != nil { 2648 jtv, ok := value.(string) 2649 if !ok { 2650 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2651 } 2652 t, err := smithytime.ParseDateTime(jtv) 2653 if err != nil { 2654 return err 2655 } 2656 sv.CreateTime = ptr.Time(t) 2657 } 2658 2659 case "DataSource": 2660 if value != nil { 2661 jtv, ok := value.(string) 2662 if !ok { 2663 return fmt.Errorf("expected String to be of type string, got %T instead", value) 2664 } 2665 sv.DataSource = ptr.String(jtv) 2666 } 2667 2668 case "DataSourceConfiguration": 2669 if err := awsRestjson1_deserializeDocumentDataSourceConfiguration(&sv.DataSourceConfiguration, value); err != nil { 2670 return err 2671 } 2672 2673 case "Description": 2674 if value != nil { 2675 jtv, ok := value.(string) 2676 if !ok { 2677 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 2678 } 2679 sv.Description = ptr.String(jtv) 2680 } 2681 2682 case "IndexArn": 2683 if value != nil { 2684 jtv, ok := value.(string) 2685 if !ok { 2686 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2687 } 2688 sv.IndexArn = ptr.String(jtv) 2689 } 2690 2691 case "IndexName": 2692 if value != nil { 2693 jtv, ok := value.(string) 2694 if !ok { 2695 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 2696 } 2697 sv.IndexName = ptr.String(jtv) 2698 } 2699 2700 case "PricingPlan": 2701 if value != nil { 2702 jtv, ok := value.(string) 2703 if !ok { 2704 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 2705 } 2706 sv.PricingPlan = types.PricingPlan(jtv) 2707 } 2708 2709 case "UpdateTime": 2710 if value != nil { 2711 jtv, ok := value.(string) 2712 if !ok { 2713 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2714 } 2715 t, err := smithytime.ParseDateTime(jtv) 2716 if err != nil { 2717 return err 2718 } 2719 sv.UpdateTime = ptr.Time(t) 2720 } 2721 2722 default: 2723 _, _ = key, value 2724 2725 } 2726 } 2727 *v = sv 2728 return nil 2729} 2730 2731type awsRestjson1_deserializeOpDescribeTracker struct { 2732} 2733 2734func (*awsRestjson1_deserializeOpDescribeTracker) ID() string { 2735 return "OperationDeserializer" 2736} 2737 2738func (m *awsRestjson1_deserializeOpDescribeTracker) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2739 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2740) { 2741 out, metadata, err = next.HandleDeserialize(ctx, in) 2742 if err != nil { 2743 return out, metadata, err 2744 } 2745 2746 response, ok := out.RawResponse.(*smithyhttp.Response) 2747 if !ok { 2748 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2749 } 2750 2751 if response.StatusCode < 200 || response.StatusCode >= 300 { 2752 return out, metadata, awsRestjson1_deserializeOpErrorDescribeTracker(response, &metadata) 2753 } 2754 output := &DescribeTrackerOutput{} 2755 out.Result = output 2756 2757 var buff [1024]byte 2758 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2759 2760 body := io.TeeReader(response.Body, ringBuffer) 2761 2762 decoder := json.NewDecoder(body) 2763 decoder.UseNumber() 2764 var shape interface{} 2765 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2766 var snapshot bytes.Buffer 2767 io.Copy(&snapshot, ringBuffer) 2768 err = &smithy.DeserializationError{ 2769 Err: fmt.Errorf("failed to decode response body, %w", err), 2770 Snapshot: snapshot.Bytes(), 2771 } 2772 return out, metadata, err 2773 } 2774 2775 err = awsRestjson1_deserializeOpDocumentDescribeTrackerOutput(&output, shape) 2776 if err != nil { 2777 var snapshot bytes.Buffer 2778 io.Copy(&snapshot, ringBuffer) 2779 return out, metadata, &smithy.DeserializationError{ 2780 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2781 Snapshot: snapshot.Bytes(), 2782 } 2783 } 2784 2785 return out, metadata, err 2786} 2787 2788func awsRestjson1_deserializeOpErrorDescribeTracker(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2789 var errorBuffer bytes.Buffer 2790 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2791 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2792 } 2793 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2794 2795 errorCode := "UnknownError" 2796 errorMessage := errorCode 2797 2798 code := response.Header.Get("X-Amzn-ErrorType") 2799 if len(code) != 0 { 2800 errorCode = restjson.SanitizeErrorCode(code) 2801 } 2802 2803 var buff [1024]byte 2804 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2805 2806 body := io.TeeReader(errorBody, ringBuffer) 2807 decoder := json.NewDecoder(body) 2808 decoder.UseNumber() 2809 code, message, err := restjson.GetErrorInfo(decoder) 2810 if err != nil { 2811 var snapshot bytes.Buffer 2812 io.Copy(&snapshot, ringBuffer) 2813 err = &smithy.DeserializationError{ 2814 Err: fmt.Errorf("failed to decode response body, %w", err), 2815 Snapshot: snapshot.Bytes(), 2816 } 2817 return err 2818 } 2819 2820 errorBody.Seek(0, io.SeekStart) 2821 if len(code) != 0 { 2822 errorCode = restjson.SanitizeErrorCode(code) 2823 } 2824 if len(message) != 0 { 2825 errorMessage = message 2826 } 2827 2828 switch { 2829 case strings.EqualFold("AccessDeniedException", errorCode): 2830 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2831 2832 case strings.EqualFold("InternalServerException", errorCode): 2833 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2834 2835 case strings.EqualFold("ResourceNotFoundException", errorCode): 2836 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2837 2838 case strings.EqualFold("ThrottlingException", errorCode): 2839 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2840 2841 case strings.EqualFold("ValidationException", errorCode): 2842 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2843 2844 default: 2845 genericError := &smithy.GenericAPIError{ 2846 Code: errorCode, 2847 Message: errorMessage, 2848 } 2849 return genericError 2850 2851 } 2852} 2853 2854func awsRestjson1_deserializeOpDocumentDescribeTrackerOutput(v **DescribeTrackerOutput, value interface{}) error { 2855 if v == nil { 2856 return fmt.Errorf("unexpected nil of type %T", v) 2857 } 2858 if value == nil { 2859 return nil 2860 } 2861 2862 shape, ok := value.(map[string]interface{}) 2863 if !ok { 2864 return fmt.Errorf("unexpected JSON type %v", value) 2865 } 2866 2867 var sv *DescribeTrackerOutput 2868 if *v == nil { 2869 sv = &DescribeTrackerOutput{} 2870 } else { 2871 sv = *v 2872 } 2873 2874 for key, value := range shape { 2875 switch key { 2876 case "CreateTime": 2877 if value != nil { 2878 jtv, ok := value.(string) 2879 if !ok { 2880 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2881 } 2882 t, err := smithytime.ParseDateTime(jtv) 2883 if err != nil { 2884 return err 2885 } 2886 sv.CreateTime = ptr.Time(t) 2887 } 2888 2889 case "Description": 2890 if value != nil { 2891 jtv, ok := value.(string) 2892 if !ok { 2893 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 2894 } 2895 sv.Description = ptr.String(jtv) 2896 } 2897 2898 case "PricingPlan": 2899 if value != nil { 2900 jtv, ok := value.(string) 2901 if !ok { 2902 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 2903 } 2904 sv.PricingPlan = types.PricingPlan(jtv) 2905 } 2906 2907 case "PricingPlanDataSource": 2908 if value != nil { 2909 jtv, ok := value.(string) 2910 if !ok { 2911 return fmt.Errorf("expected String to be of type string, got %T instead", value) 2912 } 2913 sv.PricingPlanDataSource = ptr.String(jtv) 2914 } 2915 2916 case "TrackerArn": 2917 if value != nil { 2918 jtv, ok := value.(string) 2919 if !ok { 2920 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2921 } 2922 sv.TrackerArn = ptr.String(jtv) 2923 } 2924 2925 case "TrackerName": 2926 if value != nil { 2927 jtv, ok := value.(string) 2928 if !ok { 2929 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 2930 } 2931 sv.TrackerName = ptr.String(jtv) 2932 } 2933 2934 case "UpdateTime": 2935 if value != nil { 2936 jtv, ok := value.(string) 2937 if !ok { 2938 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2939 } 2940 t, err := smithytime.ParseDateTime(jtv) 2941 if err != nil { 2942 return err 2943 } 2944 sv.UpdateTime = ptr.Time(t) 2945 } 2946 2947 default: 2948 _, _ = key, value 2949 2950 } 2951 } 2952 *v = sv 2953 return nil 2954} 2955 2956type awsRestjson1_deserializeOpDisassociateTrackerConsumer struct { 2957} 2958 2959func (*awsRestjson1_deserializeOpDisassociateTrackerConsumer) ID() string { 2960 return "OperationDeserializer" 2961} 2962 2963func (m *awsRestjson1_deserializeOpDisassociateTrackerConsumer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2964 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2965) { 2966 out, metadata, err = next.HandleDeserialize(ctx, in) 2967 if err != nil { 2968 return out, metadata, err 2969 } 2970 2971 response, ok := out.RawResponse.(*smithyhttp.Response) 2972 if !ok { 2973 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2974 } 2975 2976 if response.StatusCode < 200 || response.StatusCode >= 300 { 2977 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateTrackerConsumer(response, &metadata) 2978 } 2979 output := &DisassociateTrackerConsumerOutput{} 2980 out.Result = output 2981 2982 return out, metadata, err 2983} 2984 2985func awsRestjson1_deserializeOpErrorDisassociateTrackerConsumer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2986 var errorBuffer bytes.Buffer 2987 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2988 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2989 } 2990 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2991 2992 errorCode := "UnknownError" 2993 errorMessage := errorCode 2994 2995 code := response.Header.Get("X-Amzn-ErrorType") 2996 if len(code) != 0 { 2997 errorCode = restjson.SanitizeErrorCode(code) 2998 } 2999 3000 var buff [1024]byte 3001 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3002 3003 body := io.TeeReader(errorBody, ringBuffer) 3004 decoder := json.NewDecoder(body) 3005 decoder.UseNumber() 3006 code, message, err := restjson.GetErrorInfo(decoder) 3007 if err != nil { 3008 var snapshot bytes.Buffer 3009 io.Copy(&snapshot, ringBuffer) 3010 err = &smithy.DeserializationError{ 3011 Err: fmt.Errorf("failed to decode response body, %w", err), 3012 Snapshot: snapshot.Bytes(), 3013 } 3014 return err 3015 } 3016 3017 errorBody.Seek(0, io.SeekStart) 3018 if len(code) != 0 { 3019 errorCode = restjson.SanitizeErrorCode(code) 3020 } 3021 if len(message) != 0 { 3022 errorMessage = message 3023 } 3024 3025 switch { 3026 case strings.EqualFold("AccessDeniedException", errorCode): 3027 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3028 3029 case strings.EqualFold("InternalServerException", errorCode): 3030 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3031 3032 case strings.EqualFold("ResourceNotFoundException", errorCode): 3033 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3034 3035 case strings.EqualFold("ThrottlingException", errorCode): 3036 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3037 3038 case strings.EqualFold("ValidationException", errorCode): 3039 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3040 3041 default: 3042 genericError := &smithy.GenericAPIError{ 3043 Code: errorCode, 3044 Message: errorMessage, 3045 } 3046 return genericError 3047 3048 } 3049} 3050 3051type awsRestjson1_deserializeOpGetDevicePosition struct { 3052} 3053 3054func (*awsRestjson1_deserializeOpGetDevicePosition) ID() string { 3055 return "OperationDeserializer" 3056} 3057 3058func (m *awsRestjson1_deserializeOpGetDevicePosition) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3059 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3060) { 3061 out, metadata, err = next.HandleDeserialize(ctx, in) 3062 if err != nil { 3063 return out, metadata, err 3064 } 3065 3066 response, ok := out.RawResponse.(*smithyhttp.Response) 3067 if !ok { 3068 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3069 } 3070 3071 if response.StatusCode < 200 || response.StatusCode >= 300 { 3072 return out, metadata, awsRestjson1_deserializeOpErrorGetDevicePosition(response, &metadata) 3073 } 3074 output := &GetDevicePositionOutput{} 3075 out.Result = output 3076 3077 var buff [1024]byte 3078 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3079 3080 body := io.TeeReader(response.Body, ringBuffer) 3081 3082 decoder := json.NewDecoder(body) 3083 decoder.UseNumber() 3084 var shape interface{} 3085 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3086 var snapshot bytes.Buffer 3087 io.Copy(&snapshot, ringBuffer) 3088 err = &smithy.DeserializationError{ 3089 Err: fmt.Errorf("failed to decode response body, %w", err), 3090 Snapshot: snapshot.Bytes(), 3091 } 3092 return out, metadata, err 3093 } 3094 3095 err = awsRestjson1_deserializeOpDocumentGetDevicePositionOutput(&output, shape) 3096 if err != nil { 3097 var snapshot bytes.Buffer 3098 io.Copy(&snapshot, ringBuffer) 3099 return out, metadata, &smithy.DeserializationError{ 3100 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3101 Snapshot: snapshot.Bytes(), 3102 } 3103 } 3104 3105 return out, metadata, err 3106} 3107 3108func awsRestjson1_deserializeOpErrorGetDevicePosition(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3109 var errorBuffer bytes.Buffer 3110 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3111 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3112 } 3113 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3114 3115 errorCode := "UnknownError" 3116 errorMessage := errorCode 3117 3118 code := response.Header.Get("X-Amzn-ErrorType") 3119 if len(code) != 0 { 3120 errorCode = restjson.SanitizeErrorCode(code) 3121 } 3122 3123 var buff [1024]byte 3124 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3125 3126 body := io.TeeReader(errorBody, ringBuffer) 3127 decoder := json.NewDecoder(body) 3128 decoder.UseNumber() 3129 code, message, err := restjson.GetErrorInfo(decoder) 3130 if err != nil { 3131 var snapshot bytes.Buffer 3132 io.Copy(&snapshot, ringBuffer) 3133 err = &smithy.DeserializationError{ 3134 Err: fmt.Errorf("failed to decode response body, %w", err), 3135 Snapshot: snapshot.Bytes(), 3136 } 3137 return err 3138 } 3139 3140 errorBody.Seek(0, io.SeekStart) 3141 if len(code) != 0 { 3142 errorCode = restjson.SanitizeErrorCode(code) 3143 } 3144 if len(message) != 0 { 3145 errorMessage = message 3146 } 3147 3148 switch { 3149 case strings.EqualFold("AccessDeniedException", errorCode): 3150 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3151 3152 case strings.EqualFold("InternalServerException", errorCode): 3153 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3154 3155 case strings.EqualFold("ResourceNotFoundException", errorCode): 3156 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3157 3158 case strings.EqualFold("ThrottlingException", errorCode): 3159 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3160 3161 case strings.EqualFold("ValidationException", errorCode): 3162 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3163 3164 default: 3165 genericError := &smithy.GenericAPIError{ 3166 Code: errorCode, 3167 Message: errorMessage, 3168 } 3169 return genericError 3170 3171 } 3172} 3173 3174func awsRestjson1_deserializeOpDocumentGetDevicePositionOutput(v **GetDevicePositionOutput, value interface{}) error { 3175 if v == nil { 3176 return fmt.Errorf("unexpected nil of type %T", v) 3177 } 3178 if value == nil { 3179 return nil 3180 } 3181 3182 shape, ok := value.(map[string]interface{}) 3183 if !ok { 3184 return fmt.Errorf("unexpected JSON type %v", value) 3185 } 3186 3187 var sv *GetDevicePositionOutput 3188 if *v == nil { 3189 sv = &GetDevicePositionOutput{} 3190 } else { 3191 sv = *v 3192 } 3193 3194 for key, value := range shape { 3195 switch key { 3196 case "DeviceId": 3197 if value != nil { 3198 jtv, ok := value.(string) 3199 if !ok { 3200 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3201 } 3202 sv.DeviceId = ptr.String(jtv) 3203 } 3204 3205 case "Position": 3206 if err := awsRestjson1_deserializeDocumentPosition(&sv.Position, value); err != nil { 3207 return err 3208 } 3209 3210 case "ReceivedTime": 3211 if value != nil { 3212 jtv, ok := value.(string) 3213 if !ok { 3214 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3215 } 3216 t, err := smithytime.ParseDateTime(jtv) 3217 if err != nil { 3218 return err 3219 } 3220 sv.ReceivedTime = ptr.Time(t) 3221 } 3222 3223 case "SampleTime": 3224 if value != nil { 3225 jtv, ok := value.(string) 3226 if !ok { 3227 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3228 } 3229 t, err := smithytime.ParseDateTime(jtv) 3230 if err != nil { 3231 return err 3232 } 3233 sv.SampleTime = ptr.Time(t) 3234 } 3235 3236 default: 3237 _, _ = key, value 3238 3239 } 3240 } 3241 *v = sv 3242 return nil 3243} 3244 3245type awsRestjson1_deserializeOpGetDevicePositionHistory struct { 3246} 3247 3248func (*awsRestjson1_deserializeOpGetDevicePositionHistory) ID() string { 3249 return "OperationDeserializer" 3250} 3251 3252func (m *awsRestjson1_deserializeOpGetDevicePositionHistory) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3253 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3254) { 3255 out, metadata, err = next.HandleDeserialize(ctx, in) 3256 if err != nil { 3257 return out, metadata, err 3258 } 3259 3260 response, ok := out.RawResponse.(*smithyhttp.Response) 3261 if !ok { 3262 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3263 } 3264 3265 if response.StatusCode < 200 || response.StatusCode >= 300 { 3266 return out, metadata, awsRestjson1_deserializeOpErrorGetDevicePositionHistory(response, &metadata) 3267 } 3268 output := &GetDevicePositionHistoryOutput{} 3269 out.Result = output 3270 3271 var buff [1024]byte 3272 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3273 3274 body := io.TeeReader(response.Body, ringBuffer) 3275 3276 decoder := json.NewDecoder(body) 3277 decoder.UseNumber() 3278 var shape interface{} 3279 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3280 var snapshot bytes.Buffer 3281 io.Copy(&snapshot, ringBuffer) 3282 err = &smithy.DeserializationError{ 3283 Err: fmt.Errorf("failed to decode response body, %w", err), 3284 Snapshot: snapshot.Bytes(), 3285 } 3286 return out, metadata, err 3287 } 3288 3289 err = awsRestjson1_deserializeOpDocumentGetDevicePositionHistoryOutput(&output, shape) 3290 if err != nil { 3291 var snapshot bytes.Buffer 3292 io.Copy(&snapshot, ringBuffer) 3293 return out, metadata, &smithy.DeserializationError{ 3294 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3295 Snapshot: snapshot.Bytes(), 3296 } 3297 } 3298 3299 return out, metadata, err 3300} 3301 3302func awsRestjson1_deserializeOpErrorGetDevicePositionHistory(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3303 var errorBuffer bytes.Buffer 3304 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3305 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3306 } 3307 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3308 3309 errorCode := "UnknownError" 3310 errorMessage := errorCode 3311 3312 code := response.Header.Get("X-Amzn-ErrorType") 3313 if len(code) != 0 { 3314 errorCode = restjson.SanitizeErrorCode(code) 3315 } 3316 3317 var buff [1024]byte 3318 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3319 3320 body := io.TeeReader(errorBody, ringBuffer) 3321 decoder := json.NewDecoder(body) 3322 decoder.UseNumber() 3323 code, message, err := restjson.GetErrorInfo(decoder) 3324 if err != nil { 3325 var snapshot bytes.Buffer 3326 io.Copy(&snapshot, ringBuffer) 3327 err = &smithy.DeserializationError{ 3328 Err: fmt.Errorf("failed to decode response body, %w", err), 3329 Snapshot: snapshot.Bytes(), 3330 } 3331 return err 3332 } 3333 3334 errorBody.Seek(0, io.SeekStart) 3335 if len(code) != 0 { 3336 errorCode = restjson.SanitizeErrorCode(code) 3337 } 3338 if len(message) != 0 { 3339 errorMessage = message 3340 } 3341 3342 switch { 3343 case strings.EqualFold("AccessDeniedException", errorCode): 3344 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3345 3346 case strings.EqualFold("InternalServerException", errorCode): 3347 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3348 3349 case strings.EqualFold("ResourceNotFoundException", errorCode): 3350 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3351 3352 case strings.EqualFold("ThrottlingException", errorCode): 3353 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3354 3355 case strings.EqualFold("ValidationException", errorCode): 3356 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3357 3358 default: 3359 genericError := &smithy.GenericAPIError{ 3360 Code: errorCode, 3361 Message: errorMessage, 3362 } 3363 return genericError 3364 3365 } 3366} 3367 3368func awsRestjson1_deserializeOpDocumentGetDevicePositionHistoryOutput(v **GetDevicePositionHistoryOutput, value interface{}) error { 3369 if v == nil { 3370 return fmt.Errorf("unexpected nil of type %T", v) 3371 } 3372 if value == nil { 3373 return nil 3374 } 3375 3376 shape, ok := value.(map[string]interface{}) 3377 if !ok { 3378 return fmt.Errorf("unexpected JSON type %v", value) 3379 } 3380 3381 var sv *GetDevicePositionHistoryOutput 3382 if *v == nil { 3383 sv = &GetDevicePositionHistoryOutput{} 3384 } else { 3385 sv = *v 3386 } 3387 3388 for key, value := range shape { 3389 switch key { 3390 case "DevicePositions": 3391 if err := awsRestjson1_deserializeDocumentDevicePositionList(&sv.DevicePositions, value); err != nil { 3392 return err 3393 } 3394 3395 case "NextToken": 3396 if value != nil { 3397 jtv, ok := value.(string) 3398 if !ok { 3399 return fmt.Errorf("expected Token to be of type string, got %T instead", value) 3400 } 3401 sv.NextToken = ptr.String(jtv) 3402 } 3403 3404 default: 3405 _, _ = key, value 3406 3407 } 3408 } 3409 *v = sv 3410 return nil 3411} 3412 3413type awsRestjson1_deserializeOpGetGeofence struct { 3414} 3415 3416func (*awsRestjson1_deserializeOpGetGeofence) ID() string { 3417 return "OperationDeserializer" 3418} 3419 3420func (m *awsRestjson1_deserializeOpGetGeofence) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3421 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3422) { 3423 out, metadata, err = next.HandleDeserialize(ctx, in) 3424 if err != nil { 3425 return out, metadata, err 3426 } 3427 3428 response, ok := out.RawResponse.(*smithyhttp.Response) 3429 if !ok { 3430 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3431 } 3432 3433 if response.StatusCode < 200 || response.StatusCode >= 300 { 3434 return out, metadata, awsRestjson1_deserializeOpErrorGetGeofence(response, &metadata) 3435 } 3436 output := &GetGeofenceOutput{} 3437 out.Result = output 3438 3439 var buff [1024]byte 3440 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3441 3442 body := io.TeeReader(response.Body, ringBuffer) 3443 3444 decoder := json.NewDecoder(body) 3445 decoder.UseNumber() 3446 var shape interface{} 3447 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3448 var snapshot bytes.Buffer 3449 io.Copy(&snapshot, ringBuffer) 3450 err = &smithy.DeserializationError{ 3451 Err: fmt.Errorf("failed to decode response body, %w", err), 3452 Snapshot: snapshot.Bytes(), 3453 } 3454 return out, metadata, err 3455 } 3456 3457 err = awsRestjson1_deserializeOpDocumentGetGeofenceOutput(&output, shape) 3458 if err != nil { 3459 var snapshot bytes.Buffer 3460 io.Copy(&snapshot, ringBuffer) 3461 return out, metadata, &smithy.DeserializationError{ 3462 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3463 Snapshot: snapshot.Bytes(), 3464 } 3465 } 3466 3467 return out, metadata, err 3468} 3469 3470func awsRestjson1_deserializeOpErrorGetGeofence(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3471 var errorBuffer bytes.Buffer 3472 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3473 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3474 } 3475 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3476 3477 errorCode := "UnknownError" 3478 errorMessage := errorCode 3479 3480 code := response.Header.Get("X-Amzn-ErrorType") 3481 if len(code) != 0 { 3482 errorCode = restjson.SanitizeErrorCode(code) 3483 } 3484 3485 var buff [1024]byte 3486 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3487 3488 body := io.TeeReader(errorBody, ringBuffer) 3489 decoder := json.NewDecoder(body) 3490 decoder.UseNumber() 3491 code, message, err := restjson.GetErrorInfo(decoder) 3492 if err != nil { 3493 var snapshot bytes.Buffer 3494 io.Copy(&snapshot, ringBuffer) 3495 err = &smithy.DeserializationError{ 3496 Err: fmt.Errorf("failed to decode response body, %w", err), 3497 Snapshot: snapshot.Bytes(), 3498 } 3499 return err 3500 } 3501 3502 errorBody.Seek(0, io.SeekStart) 3503 if len(code) != 0 { 3504 errorCode = restjson.SanitizeErrorCode(code) 3505 } 3506 if len(message) != 0 { 3507 errorMessage = message 3508 } 3509 3510 switch { 3511 case strings.EqualFold("AccessDeniedException", errorCode): 3512 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3513 3514 case strings.EqualFold("InternalServerException", errorCode): 3515 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3516 3517 case strings.EqualFold("ResourceNotFoundException", errorCode): 3518 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3519 3520 case strings.EqualFold("ThrottlingException", errorCode): 3521 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3522 3523 case strings.EqualFold("ValidationException", errorCode): 3524 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3525 3526 default: 3527 genericError := &smithy.GenericAPIError{ 3528 Code: errorCode, 3529 Message: errorMessage, 3530 } 3531 return genericError 3532 3533 } 3534} 3535 3536func awsRestjson1_deserializeOpDocumentGetGeofenceOutput(v **GetGeofenceOutput, value interface{}) error { 3537 if v == nil { 3538 return fmt.Errorf("unexpected nil of type %T", v) 3539 } 3540 if value == nil { 3541 return nil 3542 } 3543 3544 shape, ok := value.(map[string]interface{}) 3545 if !ok { 3546 return fmt.Errorf("unexpected JSON type %v", value) 3547 } 3548 3549 var sv *GetGeofenceOutput 3550 if *v == nil { 3551 sv = &GetGeofenceOutput{} 3552 } else { 3553 sv = *v 3554 } 3555 3556 for key, value := range shape { 3557 switch key { 3558 case "CreateTime": 3559 if value != nil { 3560 jtv, ok := value.(string) 3561 if !ok { 3562 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3563 } 3564 t, err := smithytime.ParseDateTime(jtv) 3565 if err != nil { 3566 return err 3567 } 3568 sv.CreateTime = ptr.Time(t) 3569 } 3570 3571 case "GeofenceId": 3572 if value != nil { 3573 jtv, ok := value.(string) 3574 if !ok { 3575 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3576 } 3577 sv.GeofenceId = ptr.String(jtv) 3578 } 3579 3580 case "Geometry": 3581 if err := awsRestjson1_deserializeDocumentGeofenceGeometry(&sv.Geometry, value); err != nil { 3582 return err 3583 } 3584 3585 case "Status": 3586 if value != nil { 3587 jtv, ok := value.(string) 3588 if !ok { 3589 return fmt.Errorf("expected String to be of type string, got %T instead", value) 3590 } 3591 sv.Status = ptr.String(jtv) 3592 } 3593 3594 case "UpdateTime": 3595 if value != nil { 3596 jtv, ok := value.(string) 3597 if !ok { 3598 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3599 } 3600 t, err := smithytime.ParseDateTime(jtv) 3601 if err != nil { 3602 return err 3603 } 3604 sv.UpdateTime = ptr.Time(t) 3605 } 3606 3607 default: 3608 _, _ = key, value 3609 3610 } 3611 } 3612 *v = sv 3613 return nil 3614} 3615 3616type awsRestjson1_deserializeOpGetMapGlyphs struct { 3617} 3618 3619func (*awsRestjson1_deserializeOpGetMapGlyphs) ID() string { 3620 return "OperationDeserializer" 3621} 3622 3623func (m *awsRestjson1_deserializeOpGetMapGlyphs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3624 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3625) { 3626 out, metadata, err = next.HandleDeserialize(ctx, in) 3627 if err != nil { 3628 return out, metadata, err 3629 } 3630 3631 response, ok := out.RawResponse.(*smithyhttp.Response) 3632 if !ok { 3633 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3634 } 3635 3636 if response.StatusCode < 200 || response.StatusCode >= 300 { 3637 return out, metadata, awsRestjson1_deserializeOpErrorGetMapGlyphs(response, &metadata) 3638 } 3639 output := &GetMapGlyphsOutput{} 3640 out.Result = output 3641 3642 err = awsRestjson1_deserializeOpHttpBindingsGetMapGlyphsOutput(output, response) 3643 if err != nil { 3644 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 3645 } 3646 3647 err = awsRestjson1_deserializeOpDocumentGetMapGlyphsOutput(output, response.Body) 3648 if err != nil { 3649 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 3650 } 3651 3652 return out, metadata, err 3653} 3654 3655func awsRestjson1_deserializeOpErrorGetMapGlyphs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3656 var errorBuffer bytes.Buffer 3657 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3658 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3659 } 3660 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3661 3662 errorCode := "UnknownError" 3663 errorMessage := errorCode 3664 3665 code := response.Header.Get("X-Amzn-ErrorType") 3666 if len(code) != 0 { 3667 errorCode = restjson.SanitizeErrorCode(code) 3668 } 3669 3670 var buff [1024]byte 3671 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3672 3673 body := io.TeeReader(errorBody, ringBuffer) 3674 decoder := json.NewDecoder(body) 3675 decoder.UseNumber() 3676 code, message, err := restjson.GetErrorInfo(decoder) 3677 if err != nil { 3678 var snapshot bytes.Buffer 3679 io.Copy(&snapshot, ringBuffer) 3680 err = &smithy.DeserializationError{ 3681 Err: fmt.Errorf("failed to decode response body, %w", err), 3682 Snapshot: snapshot.Bytes(), 3683 } 3684 return err 3685 } 3686 3687 errorBody.Seek(0, io.SeekStart) 3688 if len(code) != 0 { 3689 errorCode = restjson.SanitizeErrorCode(code) 3690 } 3691 if len(message) != 0 { 3692 errorMessage = message 3693 } 3694 3695 switch { 3696 case strings.EqualFold("AccessDeniedException", errorCode): 3697 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3698 3699 case strings.EqualFold("InternalServerException", errorCode): 3700 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3701 3702 case strings.EqualFold("ResourceNotFoundException", errorCode): 3703 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3704 3705 case strings.EqualFold("ThrottlingException", errorCode): 3706 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3707 3708 case strings.EqualFold("ValidationException", errorCode): 3709 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3710 3711 default: 3712 genericError := &smithy.GenericAPIError{ 3713 Code: errorCode, 3714 Message: errorMessage, 3715 } 3716 return genericError 3717 3718 } 3719} 3720 3721func awsRestjson1_deserializeOpHttpBindingsGetMapGlyphsOutput(v *GetMapGlyphsOutput, response *smithyhttp.Response) error { 3722 if v == nil { 3723 return fmt.Errorf("unsupported deserialization for nil %T", v) 3724 } 3725 3726 if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 { 3727 headerValues[0] = strings.TrimSpace(headerValues[0]) 3728 v.ContentType = ptr.String(headerValues[0]) 3729 } 3730 3731 return nil 3732} 3733func awsRestjson1_deserializeOpDocumentGetMapGlyphsOutput(v *GetMapGlyphsOutput, body io.ReadCloser) error { 3734 if v == nil { 3735 return fmt.Errorf("unsupported deserialization of nil %T", v) 3736 } 3737 3738 bs, err := ioutil.ReadAll(body) 3739 if err != nil { 3740 return err 3741 } 3742 if len(bs) > 0 { 3743 v.Blob = bs 3744 } 3745 return nil 3746} 3747 3748type awsRestjson1_deserializeOpGetMapSprites struct { 3749} 3750 3751func (*awsRestjson1_deserializeOpGetMapSprites) ID() string { 3752 return "OperationDeserializer" 3753} 3754 3755func (m *awsRestjson1_deserializeOpGetMapSprites) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3756 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3757) { 3758 out, metadata, err = next.HandleDeserialize(ctx, in) 3759 if err != nil { 3760 return out, metadata, err 3761 } 3762 3763 response, ok := out.RawResponse.(*smithyhttp.Response) 3764 if !ok { 3765 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3766 } 3767 3768 if response.StatusCode < 200 || response.StatusCode >= 300 { 3769 return out, metadata, awsRestjson1_deserializeOpErrorGetMapSprites(response, &metadata) 3770 } 3771 output := &GetMapSpritesOutput{} 3772 out.Result = output 3773 3774 err = awsRestjson1_deserializeOpHttpBindingsGetMapSpritesOutput(output, response) 3775 if err != nil { 3776 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 3777 } 3778 3779 err = awsRestjson1_deserializeOpDocumentGetMapSpritesOutput(output, response.Body) 3780 if err != nil { 3781 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 3782 } 3783 3784 return out, metadata, err 3785} 3786 3787func awsRestjson1_deserializeOpErrorGetMapSprites(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3788 var errorBuffer bytes.Buffer 3789 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3790 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3791 } 3792 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3793 3794 errorCode := "UnknownError" 3795 errorMessage := errorCode 3796 3797 code := response.Header.Get("X-Amzn-ErrorType") 3798 if len(code) != 0 { 3799 errorCode = restjson.SanitizeErrorCode(code) 3800 } 3801 3802 var buff [1024]byte 3803 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3804 3805 body := io.TeeReader(errorBody, ringBuffer) 3806 decoder := json.NewDecoder(body) 3807 decoder.UseNumber() 3808 code, message, err := restjson.GetErrorInfo(decoder) 3809 if err != nil { 3810 var snapshot bytes.Buffer 3811 io.Copy(&snapshot, ringBuffer) 3812 err = &smithy.DeserializationError{ 3813 Err: fmt.Errorf("failed to decode response body, %w", err), 3814 Snapshot: snapshot.Bytes(), 3815 } 3816 return err 3817 } 3818 3819 errorBody.Seek(0, io.SeekStart) 3820 if len(code) != 0 { 3821 errorCode = restjson.SanitizeErrorCode(code) 3822 } 3823 if len(message) != 0 { 3824 errorMessage = message 3825 } 3826 3827 switch { 3828 case strings.EqualFold("AccessDeniedException", errorCode): 3829 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3830 3831 case strings.EqualFold("InternalServerException", errorCode): 3832 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3833 3834 case strings.EqualFold("ResourceNotFoundException", errorCode): 3835 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3836 3837 case strings.EqualFold("ThrottlingException", errorCode): 3838 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3839 3840 case strings.EqualFold("ValidationException", errorCode): 3841 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3842 3843 default: 3844 genericError := &smithy.GenericAPIError{ 3845 Code: errorCode, 3846 Message: errorMessage, 3847 } 3848 return genericError 3849 3850 } 3851} 3852 3853func awsRestjson1_deserializeOpHttpBindingsGetMapSpritesOutput(v *GetMapSpritesOutput, response *smithyhttp.Response) error { 3854 if v == nil { 3855 return fmt.Errorf("unsupported deserialization for nil %T", v) 3856 } 3857 3858 if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 { 3859 headerValues[0] = strings.TrimSpace(headerValues[0]) 3860 v.ContentType = ptr.String(headerValues[0]) 3861 } 3862 3863 return nil 3864} 3865func awsRestjson1_deserializeOpDocumentGetMapSpritesOutput(v *GetMapSpritesOutput, body io.ReadCloser) error { 3866 if v == nil { 3867 return fmt.Errorf("unsupported deserialization of nil %T", v) 3868 } 3869 3870 bs, err := ioutil.ReadAll(body) 3871 if err != nil { 3872 return err 3873 } 3874 if len(bs) > 0 { 3875 v.Blob = bs 3876 } 3877 return nil 3878} 3879 3880type awsRestjson1_deserializeOpGetMapStyleDescriptor struct { 3881} 3882 3883func (*awsRestjson1_deserializeOpGetMapStyleDescriptor) ID() string { 3884 return "OperationDeserializer" 3885} 3886 3887func (m *awsRestjson1_deserializeOpGetMapStyleDescriptor) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3888 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3889) { 3890 out, metadata, err = next.HandleDeserialize(ctx, in) 3891 if err != nil { 3892 return out, metadata, err 3893 } 3894 3895 response, ok := out.RawResponse.(*smithyhttp.Response) 3896 if !ok { 3897 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3898 } 3899 3900 if response.StatusCode < 200 || response.StatusCode >= 300 { 3901 return out, metadata, awsRestjson1_deserializeOpErrorGetMapStyleDescriptor(response, &metadata) 3902 } 3903 output := &GetMapStyleDescriptorOutput{} 3904 out.Result = output 3905 3906 err = awsRestjson1_deserializeOpHttpBindingsGetMapStyleDescriptorOutput(output, response) 3907 if err != nil { 3908 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 3909 } 3910 3911 err = awsRestjson1_deserializeOpDocumentGetMapStyleDescriptorOutput(output, response.Body) 3912 if err != nil { 3913 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 3914 } 3915 3916 return out, metadata, err 3917} 3918 3919func awsRestjson1_deserializeOpErrorGetMapStyleDescriptor(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3920 var errorBuffer bytes.Buffer 3921 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3922 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3923 } 3924 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3925 3926 errorCode := "UnknownError" 3927 errorMessage := errorCode 3928 3929 code := response.Header.Get("X-Amzn-ErrorType") 3930 if len(code) != 0 { 3931 errorCode = restjson.SanitizeErrorCode(code) 3932 } 3933 3934 var buff [1024]byte 3935 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3936 3937 body := io.TeeReader(errorBody, ringBuffer) 3938 decoder := json.NewDecoder(body) 3939 decoder.UseNumber() 3940 code, message, err := restjson.GetErrorInfo(decoder) 3941 if err != nil { 3942 var snapshot bytes.Buffer 3943 io.Copy(&snapshot, ringBuffer) 3944 err = &smithy.DeserializationError{ 3945 Err: fmt.Errorf("failed to decode response body, %w", err), 3946 Snapshot: snapshot.Bytes(), 3947 } 3948 return err 3949 } 3950 3951 errorBody.Seek(0, io.SeekStart) 3952 if len(code) != 0 { 3953 errorCode = restjson.SanitizeErrorCode(code) 3954 } 3955 if len(message) != 0 { 3956 errorMessage = message 3957 } 3958 3959 switch { 3960 case strings.EqualFold("AccessDeniedException", errorCode): 3961 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3962 3963 case strings.EqualFold("InternalServerException", errorCode): 3964 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3965 3966 case strings.EqualFold("ResourceNotFoundException", errorCode): 3967 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3968 3969 case strings.EqualFold("ThrottlingException", errorCode): 3970 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3971 3972 case strings.EqualFold("ValidationException", errorCode): 3973 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3974 3975 default: 3976 genericError := &smithy.GenericAPIError{ 3977 Code: errorCode, 3978 Message: errorMessage, 3979 } 3980 return genericError 3981 3982 } 3983} 3984 3985func awsRestjson1_deserializeOpHttpBindingsGetMapStyleDescriptorOutput(v *GetMapStyleDescriptorOutput, response *smithyhttp.Response) error { 3986 if v == nil { 3987 return fmt.Errorf("unsupported deserialization for nil %T", v) 3988 } 3989 3990 if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 { 3991 headerValues[0] = strings.TrimSpace(headerValues[0]) 3992 v.ContentType = ptr.String(headerValues[0]) 3993 } 3994 3995 return nil 3996} 3997func awsRestjson1_deserializeOpDocumentGetMapStyleDescriptorOutput(v *GetMapStyleDescriptorOutput, body io.ReadCloser) error { 3998 if v == nil { 3999 return fmt.Errorf("unsupported deserialization of nil %T", v) 4000 } 4001 4002 bs, err := ioutil.ReadAll(body) 4003 if err != nil { 4004 return err 4005 } 4006 if len(bs) > 0 { 4007 v.Blob = bs 4008 } 4009 return nil 4010} 4011 4012type awsRestjson1_deserializeOpGetMapTile struct { 4013} 4014 4015func (*awsRestjson1_deserializeOpGetMapTile) ID() string { 4016 return "OperationDeserializer" 4017} 4018 4019func (m *awsRestjson1_deserializeOpGetMapTile) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4020 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4021) { 4022 out, metadata, err = next.HandleDeserialize(ctx, in) 4023 if err != nil { 4024 return out, metadata, err 4025 } 4026 4027 response, ok := out.RawResponse.(*smithyhttp.Response) 4028 if !ok { 4029 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4030 } 4031 4032 if response.StatusCode < 200 || response.StatusCode >= 300 { 4033 return out, metadata, awsRestjson1_deserializeOpErrorGetMapTile(response, &metadata) 4034 } 4035 output := &GetMapTileOutput{} 4036 out.Result = output 4037 4038 err = awsRestjson1_deserializeOpHttpBindingsGetMapTileOutput(output, response) 4039 if err != nil { 4040 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 4041 } 4042 4043 err = awsRestjson1_deserializeOpDocumentGetMapTileOutput(output, response.Body) 4044 if err != nil { 4045 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 4046 } 4047 4048 return out, metadata, err 4049} 4050 4051func awsRestjson1_deserializeOpErrorGetMapTile(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4052 var errorBuffer bytes.Buffer 4053 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4054 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4055 } 4056 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4057 4058 errorCode := "UnknownError" 4059 errorMessage := errorCode 4060 4061 code := response.Header.Get("X-Amzn-ErrorType") 4062 if len(code) != 0 { 4063 errorCode = restjson.SanitizeErrorCode(code) 4064 } 4065 4066 var buff [1024]byte 4067 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4068 4069 body := io.TeeReader(errorBody, ringBuffer) 4070 decoder := json.NewDecoder(body) 4071 decoder.UseNumber() 4072 code, message, err := restjson.GetErrorInfo(decoder) 4073 if err != nil { 4074 var snapshot bytes.Buffer 4075 io.Copy(&snapshot, ringBuffer) 4076 err = &smithy.DeserializationError{ 4077 Err: fmt.Errorf("failed to decode response body, %w", err), 4078 Snapshot: snapshot.Bytes(), 4079 } 4080 return err 4081 } 4082 4083 errorBody.Seek(0, io.SeekStart) 4084 if len(code) != 0 { 4085 errorCode = restjson.SanitizeErrorCode(code) 4086 } 4087 if len(message) != 0 { 4088 errorMessage = message 4089 } 4090 4091 switch { 4092 case strings.EqualFold("AccessDeniedException", errorCode): 4093 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4094 4095 case strings.EqualFold("InternalServerException", errorCode): 4096 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4097 4098 case strings.EqualFold("ResourceNotFoundException", errorCode): 4099 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4100 4101 case strings.EqualFold("ThrottlingException", errorCode): 4102 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4103 4104 case strings.EqualFold("ValidationException", errorCode): 4105 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4106 4107 default: 4108 genericError := &smithy.GenericAPIError{ 4109 Code: errorCode, 4110 Message: errorMessage, 4111 } 4112 return genericError 4113 4114 } 4115} 4116 4117func awsRestjson1_deserializeOpHttpBindingsGetMapTileOutput(v *GetMapTileOutput, response *smithyhttp.Response) error { 4118 if v == nil { 4119 return fmt.Errorf("unsupported deserialization for nil %T", v) 4120 } 4121 4122 if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 { 4123 headerValues[0] = strings.TrimSpace(headerValues[0]) 4124 v.ContentType = ptr.String(headerValues[0]) 4125 } 4126 4127 return nil 4128} 4129func awsRestjson1_deserializeOpDocumentGetMapTileOutput(v *GetMapTileOutput, body io.ReadCloser) error { 4130 if v == nil { 4131 return fmt.Errorf("unsupported deserialization of nil %T", v) 4132 } 4133 4134 bs, err := ioutil.ReadAll(body) 4135 if err != nil { 4136 return err 4137 } 4138 if len(bs) > 0 { 4139 v.Blob = bs 4140 } 4141 return nil 4142} 4143 4144type awsRestjson1_deserializeOpListGeofenceCollections struct { 4145} 4146 4147func (*awsRestjson1_deserializeOpListGeofenceCollections) ID() string { 4148 return "OperationDeserializer" 4149} 4150 4151func (m *awsRestjson1_deserializeOpListGeofenceCollections) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4152 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4153) { 4154 out, metadata, err = next.HandleDeserialize(ctx, in) 4155 if err != nil { 4156 return out, metadata, err 4157 } 4158 4159 response, ok := out.RawResponse.(*smithyhttp.Response) 4160 if !ok { 4161 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4162 } 4163 4164 if response.StatusCode < 200 || response.StatusCode >= 300 { 4165 return out, metadata, awsRestjson1_deserializeOpErrorListGeofenceCollections(response, &metadata) 4166 } 4167 output := &ListGeofenceCollectionsOutput{} 4168 out.Result = output 4169 4170 var buff [1024]byte 4171 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4172 4173 body := io.TeeReader(response.Body, ringBuffer) 4174 4175 decoder := json.NewDecoder(body) 4176 decoder.UseNumber() 4177 var shape interface{} 4178 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4179 var snapshot bytes.Buffer 4180 io.Copy(&snapshot, ringBuffer) 4181 err = &smithy.DeserializationError{ 4182 Err: fmt.Errorf("failed to decode response body, %w", err), 4183 Snapshot: snapshot.Bytes(), 4184 } 4185 return out, metadata, err 4186 } 4187 4188 err = awsRestjson1_deserializeOpDocumentListGeofenceCollectionsOutput(&output, shape) 4189 if err != nil { 4190 var snapshot bytes.Buffer 4191 io.Copy(&snapshot, ringBuffer) 4192 return out, metadata, &smithy.DeserializationError{ 4193 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4194 Snapshot: snapshot.Bytes(), 4195 } 4196 } 4197 4198 return out, metadata, err 4199} 4200 4201func awsRestjson1_deserializeOpErrorListGeofenceCollections(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4202 var errorBuffer bytes.Buffer 4203 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4204 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4205 } 4206 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4207 4208 errorCode := "UnknownError" 4209 errorMessage := errorCode 4210 4211 code := response.Header.Get("X-Amzn-ErrorType") 4212 if len(code) != 0 { 4213 errorCode = restjson.SanitizeErrorCode(code) 4214 } 4215 4216 var buff [1024]byte 4217 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4218 4219 body := io.TeeReader(errorBody, ringBuffer) 4220 decoder := json.NewDecoder(body) 4221 decoder.UseNumber() 4222 code, message, err := restjson.GetErrorInfo(decoder) 4223 if err != nil { 4224 var snapshot bytes.Buffer 4225 io.Copy(&snapshot, ringBuffer) 4226 err = &smithy.DeserializationError{ 4227 Err: fmt.Errorf("failed to decode response body, %w", err), 4228 Snapshot: snapshot.Bytes(), 4229 } 4230 return err 4231 } 4232 4233 errorBody.Seek(0, io.SeekStart) 4234 if len(code) != 0 { 4235 errorCode = restjson.SanitizeErrorCode(code) 4236 } 4237 if len(message) != 0 { 4238 errorMessage = message 4239 } 4240 4241 switch { 4242 case strings.EqualFold("AccessDeniedException", errorCode): 4243 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4244 4245 case strings.EqualFold("InternalServerException", errorCode): 4246 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4247 4248 case strings.EqualFold("ThrottlingException", errorCode): 4249 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4250 4251 case strings.EqualFold("ValidationException", errorCode): 4252 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4253 4254 default: 4255 genericError := &smithy.GenericAPIError{ 4256 Code: errorCode, 4257 Message: errorMessage, 4258 } 4259 return genericError 4260 4261 } 4262} 4263 4264func awsRestjson1_deserializeOpDocumentListGeofenceCollectionsOutput(v **ListGeofenceCollectionsOutput, value interface{}) error { 4265 if v == nil { 4266 return fmt.Errorf("unexpected nil of type %T", v) 4267 } 4268 if value == nil { 4269 return nil 4270 } 4271 4272 shape, ok := value.(map[string]interface{}) 4273 if !ok { 4274 return fmt.Errorf("unexpected JSON type %v", value) 4275 } 4276 4277 var sv *ListGeofenceCollectionsOutput 4278 if *v == nil { 4279 sv = &ListGeofenceCollectionsOutput{} 4280 } else { 4281 sv = *v 4282 } 4283 4284 for key, value := range shape { 4285 switch key { 4286 case "Entries": 4287 if err := awsRestjson1_deserializeDocumentListGeofenceCollectionsResponseEntryList(&sv.Entries, value); err != nil { 4288 return err 4289 } 4290 4291 case "NextToken": 4292 if value != nil { 4293 jtv, ok := value.(string) 4294 if !ok { 4295 return fmt.Errorf("expected Token to be of type string, got %T instead", value) 4296 } 4297 sv.NextToken = ptr.String(jtv) 4298 } 4299 4300 default: 4301 _, _ = key, value 4302 4303 } 4304 } 4305 *v = sv 4306 return nil 4307} 4308 4309type awsRestjson1_deserializeOpListGeofences struct { 4310} 4311 4312func (*awsRestjson1_deserializeOpListGeofences) ID() string { 4313 return "OperationDeserializer" 4314} 4315 4316func (m *awsRestjson1_deserializeOpListGeofences) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4317 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4318) { 4319 out, metadata, err = next.HandleDeserialize(ctx, in) 4320 if err != nil { 4321 return out, metadata, err 4322 } 4323 4324 response, ok := out.RawResponse.(*smithyhttp.Response) 4325 if !ok { 4326 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4327 } 4328 4329 if response.StatusCode < 200 || response.StatusCode >= 300 { 4330 return out, metadata, awsRestjson1_deserializeOpErrorListGeofences(response, &metadata) 4331 } 4332 output := &ListGeofencesOutput{} 4333 out.Result = output 4334 4335 var buff [1024]byte 4336 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4337 4338 body := io.TeeReader(response.Body, ringBuffer) 4339 4340 decoder := json.NewDecoder(body) 4341 decoder.UseNumber() 4342 var shape interface{} 4343 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4344 var snapshot bytes.Buffer 4345 io.Copy(&snapshot, ringBuffer) 4346 err = &smithy.DeserializationError{ 4347 Err: fmt.Errorf("failed to decode response body, %w", err), 4348 Snapshot: snapshot.Bytes(), 4349 } 4350 return out, metadata, err 4351 } 4352 4353 err = awsRestjson1_deserializeOpDocumentListGeofencesOutput(&output, shape) 4354 if err != nil { 4355 var snapshot bytes.Buffer 4356 io.Copy(&snapshot, ringBuffer) 4357 return out, metadata, &smithy.DeserializationError{ 4358 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4359 Snapshot: snapshot.Bytes(), 4360 } 4361 } 4362 4363 return out, metadata, err 4364} 4365 4366func awsRestjson1_deserializeOpErrorListGeofences(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4367 var errorBuffer bytes.Buffer 4368 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4369 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4370 } 4371 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4372 4373 errorCode := "UnknownError" 4374 errorMessage := errorCode 4375 4376 code := response.Header.Get("X-Amzn-ErrorType") 4377 if len(code) != 0 { 4378 errorCode = restjson.SanitizeErrorCode(code) 4379 } 4380 4381 var buff [1024]byte 4382 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4383 4384 body := io.TeeReader(errorBody, ringBuffer) 4385 decoder := json.NewDecoder(body) 4386 decoder.UseNumber() 4387 code, message, err := restjson.GetErrorInfo(decoder) 4388 if err != nil { 4389 var snapshot bytes.Buffer 4390 io.Copy(&snapshot, ringBuffer) 4391 err = &smithy.DeserializationError{ 4392 Err: fmt.Errorf("failed to decode response body, %w", err), 4393 Snapshot: snapshot.Bytes(), 4394 } 4395 return err 4396 } 4397 4398 errorBody.Seek(0, io.SeekStart) 4399 if len(code) != 0 { 4400 errorCode = restjson.SanitizeErrorCode(code) 4401 } 4402 if len(message) != 0 { 4403 errorMessage = message 4404 } 4405 4406 switch { 4407 case strings.EqualFold("AccessDeniedException", errorCode): 4408 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4409 4410 case strings.EqualFold("InternalServerException", errorCode): 4411 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4412 4413 case strings.EqualFold("ResourceNotFoundException", errorCode): 4414 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4415 4416 case strings.EqualFold("ThrottlingException", errorCode): 4417 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4418 4419 case strings.EqualFold("ValidationException", errorCode): 4420 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4421 4422 default: 4423 genericError := &smithy.GenericAPIError{ 4424 Code: errorCode, 4425 Message: errorMessage, 4426 } 4427 return genericError 4428 4429 } 4430} 4431 4432func awsRestjson1_deserializeOpDocumentListGeofencesOutput(v **ListGeofencesOutput, value interface{}) error { 4433 if v == nil { 4434 return fmt.Errorf("unexpected nil of type %T", v) 4435 } 4436 if value == nil { 4437 return nil 4438 } 4439 4440 shape, ok := value.(map[string]interface{}) 4441 if !ok { 4442 return fmt.Errorf("unexpected JSON type %v", value) 4443 } 4444 4445 var sv *ListGeofencesOutput 4446 if *v == nil { 4447 sv = &ListGeofencesOutput{} 4448 } else { 4449 sv = *v 4450 } 4451 4452 for key, value := range shape { 4453 switch key { 4454 case "Entries": 4455 if err := awsRestjson1_deserializeDocumentListGeofenceResponseEntryList(&sv.Entries, value); err != nil { 4456 return err 4457 } 4458 4459 case "NextToken": 4460 if value != nil { 4461 jtv, ok := value.(string) 4462 if !ok { 4463 return fmt.Errorf("expected Token to be of type string, got %T instead", value) 4464 } 4465 sv.NextToken = ptr.String(jtv) 4466 } 4467 4468 default: 4469 _, _ = key, value 4470 4471 } 4472 } 4473 *v = sv 4474 return nil 4475} 4476 4477type awsRestjson1_deserializeOpListMaps struct { 4478} 4479 4480func (*awsRestjson1_deserializeOpListMaps) ID() string { 4481 return "OperationDeserializer" 4482} 4483 4484func (m *awsRestjson1_deserializeOpListMaps) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4485 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4486) { 4487 out, metadata, err = next.HandleDeserialize(ctx, in) 4488 if err != nil { 4489 return out, metadata, err 4490 } 4491 4492 response, ok := out.RawResponse.(*smithyhttp.Response) 4493 if !ok { 4494 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4495 } 4496 4497 if response.StatusCode < 200 || response.StatusCode >= 300 { 4498 return out, metadata, awsRestjson1_deserializeOpErrorListMaps(response, &metadata) 4499 } 4500 output := &ListMapsOutput{} 4501 out.Result = output 4502 4503 var buff [1024]byte 4504 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4505 4506 body := io.TeeReader(response.Body, ringBuffer) 4507 4508 decoder := json.NewDecoder(body) 4509 decoder.UseNumber() 4510 var shape interface{} 4511 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4512 var snapshot bytes.Buffer 4513 io.Copy(&snapshot, ringBuffer) 4514 err = &smithy.DeserializationError{ 4515 Err: fmt.Errorf("failed to decode response body, %w", err), 4516 Snapshot: snapshot.Bytes(), 4517 } 4518 return out, metadata, err 4519 } 4520 4521 err = awsRestjson1_deserializeOpDocumentListMapsOutput(&output, shape) 4522 if err != nil { 4523 var snapshot bytes.Buffer 4524 io.Copy(&snapshot, ringBuffer) 4525 return out, metadata, &smithy.DeserializationError{ 4526 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4527 Snapshot: snapshot.Bytes(), 4528 } 4529 } 4530 4531 return out, metadata, err 4532} 4533 4534func awsRestjson1_deserializeOpErrorListMaps(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4535 var errorBuffer bytes.Buffer 4536 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4537 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4538 } 4539 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4540 4541 errorCode := "UnknownError" 4542 errorMessage := errorCode 4543 4544 code := response.Header.Get("X-Amzn-ErrorType") 4545 if len(code) != 0 { 4546 errorCode = restjson.SanitizeErrorCode(code) 4547 } 4548 4549 var buff [1024]byte 4550 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4551 4552 body := io.TeeReader(errorBody, ringBuffer) 4553 decoder := json.NewDecoder(body) 4554 decoder.UseNumber() 4555 code, message, err := restjson.GetErrorInfo(decoder) 4556 if err != nil { 4557 var snapshot bytes.Buffer 4558 io.Copy(&snapshot, ringBuffer) 4559 err = &smithy.DeserializationError{ 4560 Err: fmt.Errorf("failed to decode response body, %w", err), 4561 Snapshot: snapshot.Bytes(), 4562 } 4563 return err 4564 } 4565 4566 errorBody.Seek(0, io.SeekStart) 4567 if len(code) != 0 { 4568 errorCode = restjson.SanitizeErrorCode(code) 4569 } 4570 if len(message) != 0 { 4571 errorMessage = message 4572 } 4573 4574 switch { 4575 case strings.EqualFold("AccessDeniedException", errorCode): 4576 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4577 4578 case strings.EqualFold("InternalServerException", errorCode): 4579 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4580 4581 case strings.EqualFold("ThrottlingException", errorCode): 4582 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4583 4584 case strings.EqualFold("ValidationException", errorCode): 4585 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4586 4587 default: 4588 genericError := &smithy.GenericAPIError{ 4589 Code: errorCode, 4590 Message: errorMessage, 4591 } 4592 return genericError 4593 4594 } 4595} 4596 4597func awsRestjson1_deserializeOpDocumentListMapsOutput(v **ListMapsOutput, value interface{}) error { 4598 if v == nil { 4599 return fmt.Errorf("unexpected nil of type %T", v) 4600 } 4601 if value == nil { 4602 return nil 4603 } 4604 4605 shape, ok := value.(map[string]interface{}) 4606 if !ok { 4607 return fmt.Errorf("unexpected JSON type %v", value) 4608 } 4609 4610 var sv *ListMapsOutput 4611 if *v == nil { 4612 sv = &ListMapsOutput{} 4613 } else { 4614 sv = *v 4615 } 4616 4617 for key, value := range shape { 4618 switch key { 4619 case "Entries": 4620 if err := awsRestjson1_deserializeDocumentListMapsResponseEntryList(&sv.Entries, value); err != nil { 4621 return err 4622 } 4623 4624 case "NextToken": 4625 if value != nil { 4626 jtv, ok := value.(string) 4627 if !ok { 4628 return fmt.Errorf("expected Token to be of type string, got %T instead", value) 4629 } 4630 sv.NextToken = ptr.String(jtv) 4631 } 4632 4633 default: 4634 _, _ = key, value 4635 4636 } 4637 } 4638 *v = sv 4639 return nil 4640} 4641 4642type awsRestjson1_deserializeOpListPlaceIndexes struct { 4643} 4644 4645func (*awsRestjson1_deserializeOpListPlaceIndexes) ID() string { 4646 return "OperationDeserializer" 4647} 4648 4649func (m *awsRestjson1_deserializeOpListPlaceIndexes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4650 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4651) { 4652 out, metadata, err = next.HandleDeserialize(ctx, in) 4653 if err != nil { 4654 return out, metadata, err 4655 } 4656 4657 response, ok := out.RawResponse.(*smithyhttp.Response) 4658 if !ok { 4659 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4660 } 4661 4662 if response.StatusCode < 200 || response.StatusCode >= 300 { 4663 return out, metadata, awsRestjson1_deserializeOpErrorListPlaceIndexes(response, &metadata) 4664 } 4665 output := &ListPlaceIndexesOutput{} 4666 out.Result = output 4667 4668 var buff [1024]byte 4669 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4670 4671 body := io.TeeReader(response.Body, ringBuffer) 4672 4673 decoder := json.NewDecoder(body) 4674 decoder.UseNumber() 4675 var shape interface{} 4676 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4677 var snapshot bytes.Buffer 4678 io.Copy(&snapshot, ringBuffer) 4679 err = &smithy.DeserializationError{ 4680 Err: fmt.Errorf("failed to decode response body, %w", err), 4681 Snapshot: snapshot.Bytes(), 4682 } 4683 return out, metadata, err 4684 } 4685 4686 err = awsRestjson1_deserializeOpDocumentListPlaceIndexesOutput(&output, shape) 4687 if err != nil { 4688 var snapshot bytes.Buffer 4689 io.Copy(&snapshot, ringBuffer) 4690 return out, metadata, &smithy.DeserializationError{ 4691 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4692 Snapshot: snapshot.Bytes(), 4693 } 4694 } 4695 4696 return out, metadata, err 4697} 4698 4699func awsRestjson1_deserializeOpErrorListPlaceIndexes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4700 var errorBuffer bytes.Buffer 4701 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4702 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4703 } 4704 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4705 4706 errorCode := "UnknownError" 4707 errorMessage := errorCode 4708 4709 code := response.Header.Get("X-Amzn-ErrorType") 4710 if len(code) != 0 { 4711 errorCode = restjson.SanitizeErrorCode(code) 4712 } 4713 4714 var buff [1024]byte 4715 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4716 4717 body := io.TeeReader(errorBody, ringBuffer) 4718 decoder := json.NewDecoder(body) 4719 decoder.UseNumber() 4720 code, message, err := restjson.GetErrorInfo(decoder) 4721 if err != nil { 4722 var snapshot bytes.Buffer 4723 io.Copy(&snapshot, ringBuffer) 4724 err = &smithy.DeserializationError{ 4725 Err: fmt.Errorf("failed to decode response body, %w", err), 4726 Snapshot: snapshot.Bytes(), 4727 } 4728 return err 4729 } 4730 4731 errorBody.Seek(0, io.SeekStart) 4732 if len(code) != 0 { 4733 errorCode = restjson.SanitizeErrorCode(code) 4734 } 4735 if len(message) != 0 { 4736 errorMessage = message 4737 } 4738 4739 switch { 4740 case strings.EqualFold("AccessDeniedException", errorCode): 4741 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4742 4743 case strings.EqualFold("InternalServerException", errorCode): 4744 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4745 4746 case strings.EqualFold("ThrottlingException", errorCode): 4747 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4748 4749 case strings.EqualFold("ValidationException", errorCode): 4750 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4751 4752 default: 4753 genericError := &smithy.GenericAPIError{ 4754 Code: errorCode, 4755 Message: errorMessage, 4756 } 4757 return genericError 4758 4759 } 4760} 4761 4762func awsRestjson1_deserializeOpDocumentListPlaceIndexesOutput(v **ListPlaceIndexesOutput, value interface{}) error { 4763 if v == nil { 4764 return fmt.Errorf("unexpected nil of type %T", v) 4765 } 4766 if value == nil { 4767 return nil 4768 } 4769 4770 shape, ok := value.(map[string]interface{}) 4771 if !ok { 4772 return fmt.Errorf("unexpected JSON type %v", value) 4773 } 4774 4775 var sv *ListPlaceIndexesOutput 4776 if *v == nil { 4777 sv = &ListPlaceIndexesOutput{} 4778 } else { 4779 sv = *v 4780 } 4781 4782 for key, value := range shape { 4783 switch key { 4784 case "Entries": 4785 if err := awsRestjson1_deserializeDocumentListPlaceIndexesResponseEntryList(&sv.Entries, value); err != nil { 4786 return err 4787 } 4788 4789 case "NextToken": 4790 if value != nil { 4791 jtv, ok := value.(string) 4792 if !ok { 4793 return fmt.Errorf("expected Token to be of type string, got %T instead", value) 4794 } 4795 sv.NextToken = ptr.String(jtv) 4796 } 4797 4798 default: 4799 _, _ = key, value 4800 4801 } 4802 } 4803 *v = sv 4804 return nil 4805} 4806 4807type awsRestjson1_deserializeOpListTrackerConsumers struct { 4808} 4809 4810func (*awsRestjson1_deserializeOpListTrackerConsumers) ID() string { 4811 return "OperationDeserializer" 4812} 4813 4814func (m *awsRestjson1_deserializeOpListTrackerConsumers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4815 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4816) { 4817 out, metadata, err = next.HandleDeserialize(ctx, in) 4818 if err != nil { 4819 return out, metadata, err 4820 } 4821 4822 response, ok := out.RawResponse.(*smithyhttp.Response) 4823 if !ok { 4824 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4825 } 4826 4827 if response.StatusCode < 200 || response.StatusCode >= 300 { 4828 return out, metadata, awsRestjson1_deserializeOpErrorListTrackerConsumers(response, &metadata) 4829 } 4830 output := &ListTrackerConsumersOutput{} 4831 out.Result = output 4832 4833 var buff [1024]byte 4834 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4835 4836 body := io.TeeReader(response.Body, ringBuffer) 4837 4838 decoder := json.NewDecoder(body) 4839 decoder.UseNumber() 4840 var shape interface{} 4841 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4842 var snapshot bytes.Buffer 4843 io.Copy(&snapshot, ringBuffer) 4844 err = &smithy.DeserializationError{ 4845 Err: fmt.Errorf("failed to decode response body, %w", err), 4846 Snapshot: snapshot.Bytes(), 4847 } 4848 return out, metadata, err 4849 } 4850 4851 err = awsRestjson1_deserializeOpDocumentListTrackerConsumersOutput(&output, shape) 4852 if err != nil { 4853 var snapshot bytes.Buffer 4854 io.Copy(&snapshot, ringBuffer) 4855 return out, metadata, &smithy.DeserializationError{ 4856 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4857 Snapshot: snapshot.Bytes(), 4858 } 4859 } 4860 4861 return out, metadata, err 4862} 4863 4864func awsRestjson1_deserializeOpErrorListTrackerConsumers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4865 var errorBuffer bytes.Buffer 4866 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4867 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4868 } 4869 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4870 4871 errorCode := "UnknownError" 4872 errorMessage := errorCode 4873 4874 code := response.Header.Get("X-Amzn-ErrorType") 4875 if len(code) != 0 { 4876 errorCode = restjson.SanitizeErrorCode(code) 4877 } 4878 4879 var buff [1024]byte 4880 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4881 4882 body := io.TeeReader(errorBody, ringBuffer) 4883 decoder := json.NewDecoder(body) 4884 decoder.UseNumber() 4885 code, message, err := restjson.GetErrorInfo(decoder) 4886 if err != nil { 4887 var snapshot bytes.Buffer 4888 io.Copy(&snapshot, ringBuffer) 4889 err = &smithy.DeserializationError{ 4890 Err: fmt.Errorf("failed to decode response body, %w", err), 4891 Snapshot: snapshot.Bytes(), 4892 } 4893 return err 4894 } 4895 4896 errorBody.Seek(0, io.SeekStart) 4897 if len(code) != 0 { 4898 errorCode = restjson.SanitizeErrorCode(code) 4899 } 4900 if len(message) != 0 { 4901 errorMessage = message 4902 } 4903 4904 switch { 4905 case strings.EqualFold("AccessDeniedException", errorCode): 4906 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4907 4908 case strings.EqualFold("InternalServerException", errorCode): 4909 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4910 4911 case strings.EqualFold("ResourceNotFoundException", errorCode): 4912 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4913 4914 case strings.EqualFold("ThrottlingException", errorCode): 4915 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4916 4917 case strings.EqualFold("ValidationException", errorCode): 4918 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4919 4920 default: 4921 genericError := &smithy.GenericAPIError{ 4922 Code: errorCode, 4923 Message: errorMessage, 4924 } 4925 return genericError 4926 4927 } 4928} 4929 4930func awsRestjson1_deserializeOpDocumentListTrackerConsumersOutput(v **ListTrackerConsumersOutput, value interface{}) error { 4931 if v == nil { 4932 return fmt.Errorf("unexpected nil of type %T", v) 4933 } 4934 if value == nil { 4935 return nil 4936 } 4937 4938 shape, ok := value.(map[string]interface{}) 4939 if !ok { 4940 return fmt.Errorf("unexpected JSON type %v", value) 4941 } 4942 4943 var sv *ListTrackerConsumersOutput 4944 if *v == nil { 4945 sv = &ListTrackerConsumersOutput{} 4946 } else { 4947 sv = *v 4948 } 4949 4950 for key, value := range shape { 4951 switch key { 4952 case "ConsumerArns": 4953 if err := awsRestjson1_deserializeDocumentArnList(&sv.ConsumerArns, value); err != nil { 4954 return err 4955 } 4956 4957 case "NextToken": 4958 if value != nil { 4959 jtv, ok := value.(string) 4960 if !ok { 4961 return fmt.Errorf("expected Token to be of type string, got %T instead", value) 4962 } 4963 sv.NextToken = ptr.String(jtv) 4964 } 4965 4966 default: 4967 _, _ = key, value 4968 4969 } 4970 } 4971 *v = sv 4972 return nil 4973} 4974 4975type awsRestjson1_deserializeOpListTrackers struct { 4976} 4977 4978func (*awsRestjson1_deserializeOpListTrackers) ID() string { 4979 return "OperationDeserializer" 4980} 4981 4982func (m *awsRestjson1_deserializeOpListTrackers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4983 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4984) { 4985 out, metadata, err = next.HandleDeserialize(ctx, in) 4986 if err != nil { 4987 return out, metadata, err 4988 } 4989 4990 response, ok := out.RawResponse.(*smithyhttp.Response) 4991 if !ok { 4992 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4993 } 4994 4995 if response.StatusCode < 200 || response.StatusCode >= 300 { 4996 return out, metadata, awsRestjson1_deserializeOpErrorListTrackers(response, &metadata) 4997 } 4998 output := &ListTrackersOutput{} 4999 out.Result = output 5000 5001 var buff [1024]byte 5002 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5003 5004 body := io.TeeReader(response.Body, ringBuffer) 5005 5006 decoder := json.NewDecoder(body) 5007 decoder.UseNumber() 5008 var shape interface{} 5009 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5010 var snapshot bytes.Buffer 5011 io.Copy(&snapshot, ringBuffer) 5012 err = &smithy.DeserializationError{ 5013 Err: fmt.Errorf("failed to decode response body, %w", err), 5014 Snapshot: snapshot.Bytes(), 5015 } 5016 return out, metadata, err 5017 } 5018 5019 err = awsRestjson1_deserializeOpDocumentListTrackersOutput(&output, shape) 5020 if err != nil { 5021 var snapshot bytes.Buffer 5022 io.Copy(&snapshot, ringBuffer) 5023 return out, metadata, &smithy.DeserializationError{ 5024 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5025 Snapshot: snapshot.Bytes(), 5026 } 5027 } 5028 5029 return out, metadata, err 5030} 5031 5032func awsRestjson1_deserializeOpErrorListTrackers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5033 var errorBuffer bytes.Buffer 5034 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5035 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5036 } 5037 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5038 5039 errorCode := "UnknownError" 5040 errorMessage := errorCode 5041 5042 code := response.Header.Get("X-Amzn-ErrorType") 5043 if len(code) != 0 { 5044 errorCode = restjson.SanitizeErrorCode(code) 5045 } 5046 5047 var buff [1024]byte 5048 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5049 5050 body := io.TeeReader(errorBody, ringBuffer) 5051 decoder := json.NewDecoder(body) 5052 decoder.UseNumber() 5053 code, message, err := restjson.GetErrorInfo(decoder) 5054 if err != nil { 5055 var snapshot bytes.Buffer 5056 io.Copy(&snapshot, ringBuffer) 5057 err = &smithy.DeserializationError{ 5058 Err: fmt.Errorf("failed to decode response body, %w", err), 5059 Snapshot: snapshot.Bytes(), 5060 } 5061 return err 5062 } 5063 5064 errorBody.Seek(0, io.SeekStart) 5065 if len(code) != 0 { 5066 errorCode = restjson.SanitizeErrorCode(code) 5067 } 5068 if len(message) != 0 { 5069 errorMessage = message 5070 } 5071 5072 switch { 5073 case strings.EqualFold("AccessDeniedException", errorCode): 5074 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 5075 5076 case strings.EqualFold("InternalServerException", errorCode): 5077 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5078 5079 case strings.EqualFold("ThrottlingException", errorCode): 5080 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5081 5082 case strings.EqualFold("ValidationException", errorCode): 5083 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5084 5085 default: 5086 genericError := &smithy.GenericAPIError{ 5087 Code: errorCode, 5088 Message: errorMessage, 5089 } 5090 return genericError 5091 5092 } 5093} 5094 5095func awsRestjson1_deserializeOpDocumentListTrackersOutput(v **ListTrackersOutput, value interface{}) error { 5096 if v == nil { 5097 return fmt.Errorf("unexpected nil of type %T", v) 5098 } 5099 if value == nil { 5100 return nil 5101 } 5102 5103 shape, ok := value.(map[string]interface{}) 5104 if !ok { 5105 return fmt.Errorf("unexpected JSON type %v", value) 5106 } 5107 5108 var sv *ListTrackersOutput 5109 if *v == nil { 5110 sv = &ListTrackersOutput{} 5111 } else { 5112 sv = *v 5113 } 5114 5115 for key, value := range shape { 5116 switch key { 5117 case "Entries": 5118 if err := awsRestjson1_deserializeDocumentListTrackersResponseEntryList(&sv.Entries, value); err != nil { 5119 return err 5120 } 5121 5122 case "NextToken": 5123 if value != nil { 5124 jtv, ok := value.(string) 5125 if !ok { 5126 return fmt.Errorf("expected Token to be of type string, got %T instead", value) 5127 } 5128 sv.NextToken = ptr.String(jtv) 5129 } 5130 5131 default: 5132 _, _ = key, value 5133 5134 } 5135 } 5136 *v = sv 5137 return nil 5138} 5139 5140type awsRestjson1_deserializeOpPutGeofence struct { 5141} 5142 5143func (*awsRestjson1_deserializeOpPutGeofence) ID() string { 5144 return "OperationDeserializer" 5145} 5146 5147func (m *awsRestjson1_deserializeOpPutGeofence) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5148 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5149) { 5150 out, metadata, err = next.HandleDeserialize(ctx, in) 5151 if err != nil { 5152 return out, metadata, err 5153 } 5154 5155 response, ok := out.RawResponse.(*smithyhttp.Response) 5156 if !ok { 5157 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5158 } 5159 5160 if response.StatusCode < 200 || response.StatusCode >= 300 { 5161 return out, metadata, awsRestjson1_deserializeOpErrorPutGeofence(response, &metadata) 5162 } 5163 output := &PutGeofenceOutput{} 5164 out.Result = output 5165 5166 var buff [1024]byte 5167 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5168 5169 body := io.TeeReader(response.Body, ringBuffer) 5170 5171 decoder := json.NewDecoder(body) 5172 decoder.UseNumber() 5173 var shape interface{} 5174 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5175 var snapshot bytes.Buffer 5176 io.Copy(&snapshot, ringBuffer) 5177 err = &smithy.DeserializationError{ 5178 Err: fmt.Errorf("failed to decode response body, %w", err), 5179 Snapshot: snapshot.Bytes(), 5180 } 5181 return out, metadata, err 5182 } 5183 5184 err = awsRestjson1_deserializeOpDocumentPutGeofenceOutput(&output, shape) 5185 if err != nil { 5186 var snapshot bytes.Buffer 5187 io.Copy(&snapshot, ringBuffer) 5188 return out, metadata, &smithy.DeserializationError{ 5189 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5190 Snapshot: snapshot.Bytes(), 5191 } 5192 } 5193 5194 return out, metadata, err 5195} 5196 5197func awsRestjson1_deserializeOpErrorPutGeofence(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5198 var errorBuffer bytes.Buffer 5199 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5200 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5201 } 5202 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5203 5204 errorCode := "UnknownError" 5205 errorMessage := errorCode 5206 5207 code := response.Header.Get("X-Amzn-ErrorType") 5208 if len(code) != 0 { 5209 errorCode = restjson.SanitizeErrorCode(code) 5210 } 5211 5212 var buff [1024]byte 5213 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5214 5215 body := io.TeeReader(errorBody, ringBuffer) 5216 decoder := json.NewDecoder(body) 5217 decoder.UseNumber() 5218 code, message, err := restjson.GetErrorInfo(decoder) 5219 if err != nil { 5220 var snapshot bytes.Buffer 5221 io.Copy(&snapshot, ringBuffer) 5222 err = &smithy.DeserializationError{ 5223 Err: fmt.Errorf("failed to decode response body, %w", err), 5224 Snapshot: snapshot.Bytes(), 5225 } 5226 return err 5227 } 5228 5229 errorBody.Seek(0, io.SeekStart) 5230 if len(code) != 0 { 5231 errorCode = restjson.SanitizeErrorCode(code) 5232 } 5233 if len(message) != 0 { 5234 errorMessage = message 5235 } 5236 5237 switch { 5238 case strings.EqualFold("AccessDeniedException", errorCode): 5239 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 5240 5241 case strings.EqualFold("ConflictException", errorCode): 5242 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 5243 5244 case strings.EqualFold("InternalServerException", errorCode): 5245 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5246 5247 case strings.EqualFold("ResourceNotFoundException", errorCode): 5248 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5249 5250 case strings.EqualFold("ThrottlingException", errorCode): 5251 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5252 5253 case strings.EqualFold("ValidationException", errorCode): 5254 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5255 5256 default: 5257 genericError := &smithy.GenericAPIError{ 5258 Code: errorCode, 5259 Message: errorMessage, 5260 } 5261 return genericError 5262 5263 } 5264} 5265 5266func awsRestjson1_deserializeOpDocumentPutGeofenceOutput(v **PutGeofenceOutput, value interface{}) error { 5267 if v == nil { 5268 return fmt.Errorf("unexpected nil of type %T", v) 5269 } 5270 if value == nil { 5271 return nil 5272 } 5273 5274 shape, ok := value.(map[string]interface{}) 5275 if !ok { 5276 return fmt.Errorf("unexpected JSON type %v", value) 5277 } 5278 5279 var sv *PutGeofenceOutput 5280 if *v == nil { 5281 sv = &PutGeofenceOutput{} 5282 } else { 5283 sv = *v 5284 } 5285 5286 for key, value := range shape { 5287 switch key { 5288 case "CreateTime": 5289 if value != nil { 5290 jtv, ok := value.(string) 5291 if !ok { 5292 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 5293 } 5294 t, err := smithytime.ParseDateTime(jtv) 5295 if err != nil { 5296 return err 5297 } 5298 sv.CreateTime = ptr.Time(t) 5299 } 5300 5301 case "GeofenceId": 5302 if value != nil { 5303 jtv, ok := value.(string) 5304 if !ok { 5305 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5306 } 5307 sv.GeofenceId = ptr.String(jtv) 5308 } 5309 5310 case "UpdateTime": 5311 if value != nil { 5312 jtv, ok := value.(string) 5313 if !ok { 5314 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 5315 } 5316 t, err := smithytime.ParseDateTime(jtv) 5317 if err != nil { 5318 return err 5319 } 5320 sv.UpdateTime = ptr.Time(t) 5321 } 5322 5323 default: 5324 _, _ = key, value 5325 5326 } 5327 } 5328 *v = sv 5329 return nil 5330} 5331 5332type awsRestjson1_deserializeOpSearchPlaceIndexForPosition struct { 5333} 5334 5335func (*awsRestjson1_deserializeOpSearchPlaceIndexForPosition) ID() string { 5336 return "OperationDeserializer" 5337} 5338 5339func (m *awsRestjson1_deserializeOpSearchPlaceIndexForPosition) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5340 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5341) { 5342 out, metadata, err = next.HandleDeserialize(ctx, in) 5343 if err != nil { 5344 return out, metadata, err 5345 } 5346 5347 response, ok := out.RawResponse.(*smithyhttp.Response) 5348 if !ok { 5349 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5350 } 5351 5352 if response.StatusCode < 200 || response.StatusCode >= 300 { 5353 return out, metadata, awsRestjson1_deserializeOpErrorSearchPlaceIndexForPosition(response, &metadata) 5354 } 5355 output := &SearchPlaceIndexForPositionOutput{} 5356 out.Result = output 5357 5358 var buff [1024]byte 5359 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5360 5361 body := io.TeeReader(response.Body, ringBuffer) 5362 5363 decoder := json.NewDecoder(body) 5364 decoder.UseNumber() 5365 var shape interface{} 5366 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5367 var snapshot bytes.Buffer 5368 io.Copy(&snapshot, ringBuffer) 5369 err = &smithy.DeserializationError{ 5370 Err: fmt.Errorf("failed to decode response body, %w", err), 5371 Snapshot: snapshot.Bytes(), 5372 } 5373 return out, metadata, err 5374 } 5375 5376 err = awsRestjson1_deserializeOpDocumentSearchPlaceIndexForPositionOutput(&output, shape) 5377 if err != nil { 5378 var snapshot bytes.Buffer 5379 io.Copy(&snapshot, ringBuffer) 5380 return out, metadata, &smithy.DeserializationError{ 5381 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5382 Snapshot: snapshot.Bytes(), 5383 } 5384 } 5385 5386 return out, metadata, err 5387} 5388 5389func awsRestjson1_deserializeOpErrorSearchPlaceIndexForPosition(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5390 var errorBuffer bytes.Buffer 5391 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5392 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5393 } 5394 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5395 5396 errorCode := "UnknownError" 5397 errorMessage := errorCode 5398 5399 code := response.Header.Get("X-Amzn-ErrorType") 5400 if len(code) != 0 { 5401 errorCode = restjson.SanitizeErrorCode(code) 5402 } 5403 5404 var buff [1024]byte 5405 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5406 5407 body := io.TeeReader(errorBody, ringBuffer) 5408 decoder := json.NewDecoder(body) 5409 decoder.UseNumber() 5410 code, message, err := restjson.GetErrorInfo(decoder) 5411 if err != nil { 5412 var snapshot bytes.Buffer 5413 io.Copy(&snapshot, ringBuffer) 5414 err = &smithy.DeserializationError{ 5415 Err: fmt.Errorf("failed to decode response body, %w", err), 5416 Snapshot: snapshot.Bytes(), 5417 } 5418 return err 5419 } 5420 5421 errorBody.Seek(0, io.SeekStart) 5422 if len(code) != 0 { 5423 errorCode = restjson.SanitizeErrorCode(code) 5424 } 5425 if len(message) != 0 { 5426 errorMessage = message 5427 } 5428 5429 switch { 5430 case strings.EqualFold("AccessDeniedException", errorCode): 5431 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 5432 5433 case strings.EqualFold("InternalServerException", errorCode): 5434 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5435 5436 case strings.EqualFold("ResourceNotFoundException", errorCode): 5437 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5438 5439 case strings.EqualFold("ThrottlingException", errorCode): 5440 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5441 5442 case strings.EqualFold("ValidationException", errorCode): 5443 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5444 5445 default: 5446 genericError := &smithy.GenericAPIError{ 5447 Code: errorCode, 5448 Message: errorMessage, 5449 } 5450 return genericError 5451 5452 } 5453} 5454 5455func awsRestjson1_deserializeOpDocumentSearchPlaceIndexForPositionOutput(v **SearchPlaceIndexForPositionOutput, value interface{}) error { 5456 if v == nil { 5457 return fmt.Errorf("unexpected nil of type %T", v) 5458 } 5459 if value == nil { 5460 return nil 5461 } 5462 5463 shape, ok := value.(map[string]interface{}) 5464 if !ok { 5465 return fmt.Errorf("unexpected JSON type %v", value) 5466 } 5467 5468 var sv *SearchPlaceIndexForPositionOutput 5469 if *v == nil { 5470 sv = &SearchPlaceIndexForPositionOutput{} 5471 } else { 5472 sv = *v 5473 } 5474 5475 for key, value := range shape { 5476 switch key { 5477 case "Results": 5478 if err := awsRestjson1_deserializeDocumentSearchForPositionResultList(&sv.Results, value); err != nil { 5479 return err 5480 } 5481 5482 case "Summary": 5483 if err := awsRestjson1_deserializeDocumentSearchPlaceIndexForPositionSummary(&sv.Summary, value); err != nil { 5484 return err 5485 } 5486 5487 default: 5488 _, _ = key, value 5489 5490 } 5491 } 5492 *v = sv 5493 return nil 5494} 5495 5496type awsRestjson1_deserializeOpSearchPlaceIndexForText struct { 5497} 5498 5499func (*awsRestjson1_deserializeOpSearchPlaceIndexForText) ID() string { 5500 return "OperationDeserializer" 5501} 5502 5503func (m *awsRestjson1_deserializeOpSearchPlaceIndexForText) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5504 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5505) { 5506 out, metadata, err = next.HandleDeserialize(ctx, in) 5507 if err != nil { 5508 return out, metadata, err 5509 } 5510 5511 response, ok := out.RawResponse.(*smithyhttp.Response) 5512 if !ok { 5513 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5514 } 5515 5516 if response.StatusCode < 200 || response.StatusCode >= 300 { 5517 return out, metadata, awsRestjson1_deserializeOpErrorSearchPlaceIndexForText(response, &metadata) 5518 } 5519 output := &SearchPlaceIndexForTextOutput{} 5520 out.Result = output 5521 5522 var buff [1024]byte 5523 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5524 5525 body := io.TeeReader(response.Body, ringBuffer) 5526 5527 decoder := json.NewDecoder(body) 5528 decoder.UseNumber() 5529 var shape interface{} 5530 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5531 var snapshot bytes.Buffer 5532 io.Copy(&snapshot, ringBuffer) 5533 err = &smithy.DeserializationError{ 5534 Err: fmt.Errorf("failed to decode response body, %w", err), 5535 Snapshot: snapshot.Bytes(), 5536 } 5537 return out, metadata, err 5538 } 5539 5540 err = awsRestjson1_deserializeOpDocumentSearchPlaceIndexForTextOutput(&output, shape) 5541 if err != nil { 5542 var snapshot bytes.Buffer 5543 io.Copy(&snapshot, ringBuffer) 5544 return out, metadata, &smithy.DeserializationError{ 5545 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5546 Snapshot: snapshot.Bytes(), 5547 } 5548 } 5549 5550 return out, metadata, err 5551} 5552 5553func awsRestjson1_deserializeOpErrorSearchPlaceIndexForText(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5554 var errorBuffer bytes.Buffer 5555 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5556 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5557 } 5558 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5559 5560 errorCode := "UnknownError" 5561 errorMessage := errorCode 5562 5563 code := response.Header.Get("X-Amzn-ErrorType") 5564 if len(code) != 0 { 5565 errorCode = restjson.SanitizeErrorCode(code) 5566 } 5567 5568 var buff [1024]byte 5569 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5570 5571 body := io.TeeReader(errorBody, ringBuffer) 5572 decoder := json.NewDecoder(body) 5573 decoder.UseNumber() 5574 code, message, err := restjson.GetErrorInfo(decoder) 5575 if err != nil { 5576 var snapshot bytes.Buffer 5577 io.Copy(&snapshot, ringBuffer) 5578 err = &smithy.DeserializationError{ 5579 Err: fmt.Errorf("failed to decode response body, %w", err), 5580 Snapshot: snapshot.Bytes(), 5581 } 5582 return err 5583 } 5584 5585 errorBody.Seek(0, io.SeekStart) 5586 if len(code) != 0 { 5587 errorCode = restjson.SanitizeErrorCode(code) 5588 } 5589 if len(message) != 0 { 5590 errorMessage = message 5591 } 5592 5593 switch { 5594 case strings.EqualFold("AccessDeniedException", errorCode): 5595 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 5596 5597 case strings.EqualFold("InternalServerException", errorCode): 5598 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5599 5600 case strings.EqualFold("ResourceNotFoundException", errorCode): 5601 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5602 5603 case strings.EqualFold("ThrottlingException", errorCode): 5604 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5605 5606 case strings.EqualFold("ValidationException", errorCode): 5607 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5608 5609 default: 5610 genericError := &smithy.GenericAPIError{ 5611 Code: errorCode, 5612 Message: errorMessage, 5613 } 5614 return genericError 5615 5616 } 5617} 5618 5619func awsRestjson1_deserializeOpDocumentSearchPlaceIndexForTextOutput(v **SearchPlaceIndexForTextOutput, value interface{}) error { 5620 if v == nil { 5621 return fmt.Errorf("unexpected nil of type %T", v) 5622 } 5623 if value == nil { 5624 return nil 5625 } 5626 5627 shape, ok := value.(map[string]interface{}) 5628 if !ok { 5629 return fmt.Errorf("unexpected JSON type %v", value) 5630 } 5631 5632 var sv *SearchPlaceIndexForTextOutput 5633 if *v == nil { 5634 sv = &SearchPlaceIndexForTextOutput{} 5635 } else { 5636 sv = *v 5637 } 5638 5639 for key, value := range shape { 5640 switch key { 5641 case "Results": 5642 if err := awsRestjson1_deserializeDocumentSearchForTextResultList(&sv.Results, value); err != nil { 5643 return err 5644 } 5645 5646 case "Summary": 5647 if err := awsRestjson1_deserializeDocumentSearchPlaceIndexForTextSummary(&sv.Summary, value); err != nil { 5648 return err 5649 } 5650 5651 default: 5652 _, _ = key, value 5653 5654 } 5655 } 5656 *v = sv 5657 return nil 5658} 5659 5660func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5661 output := &types.AccessDeniedException{} 5662 var buff [1024]byte 5663 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5664 5665 body := io.TeeReader(errorBody, ringBuffer) 5666 decoder := json.NewDecoder(body) 5667 decoder.UseNumber() 5668 var shape interface{} 5669 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5670 var snapshot bytes.Buffer 5671 io.Copy(&snapshot, ringBuffer) 5672 err = &smithy.DeserializationError{ 5673 Err: fmt.Errorf("failed to decode response body, %w", err), 5674 Snapshot: snapshot.Bytes(), 5675 } 5676 return err 5677 } 5678 5679 err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) 5680 5681 if err != nil { 5682 var snapshot bytes.Buffer 5683 io.Copy(&snapshot, ringBuffer) 5684 err = &smithy.DeserializationError{ 5685 Err: fmt.Errorf("failed to decode response body, %w", err), 5686 Snapshot: snapshot.Bytes(), 5687 } 5688 return err 5689 } 5690 5691 errorBody.Seek(0, io.SeekStart) 5692 5693 return output 5694} 5695 5696func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5697 output := &types.ConflictException{} 5698 var buff [1024]byte 5699 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5700 5701 body := io.TeeReader(errorBody, ringBuffer) 5702 decoder := json.NewDecoder(body) 5703 decoder.UseNumber() 5704 var shape interface{} 5705 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5706 var snapshot bytes.Buffer 5707 io.Copy(&snapshot, ringBuffer) 5708 err = &smithy.DeserializationError{ 5709 Err: fmt.Errorf("failed to decode response body, %w", err), 5710 Snapshot: snapshot.Bytes(), 5711 } 5712 return err 5713 } 5714 5715 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 5716 5717 if err != nil { 5718 var snapshot bytes.Buffer 5719 io.Copy(&snapshot, ringBuffer) 5720 err = &smithy.DeserializationError{ 5721 Err: fmt.Errorf("failed to decode response body, %w", err), 5722 Snapshot: snapshot.Bytes(), 5723 } 5724 return err 5725 } 5726 5727 errorBody.Seek(0, io.SeekStart) 5728 5729 return output 5730} 5731 5732func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5733 output := &types.InternalServerException{} 5734 var buff [1024]byte 5735 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5736 5737 body := io.TeeReader(errorBody, ringBuffer) 5738 decoder := json.NewDecoder(body) 5739 decoder.UseNumber() 5740 var shape interface{} 5741 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5742 var snapshot bytes.Buffer 5743 io.Copy(&snapshot, ringBuffer) 5744 err = &smithy.DeserializationError{ 5745 Err: fmt.Errorf("failed to decode response body, %w", err), 5746 Snapshot: snapshot.Bytes(), 5747 } 5748 return err 5749 } 5750 5751 err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) 5752 5753 if err != nil { 5754 var snapshot bytes.Buffer 5755 io.Copy(&snapshot, ringBuffer) 5756 err = &smithy.DeserializationError{ 5757 Err: fmt.Errorf("failed to decode response body, %w", err), 5758 Snapshot: snapshot.Bytes(), 5759 } 5760 return err 5761 } 5762 5763 errorBody.Seek(0, io.SeekStart) 5764 5765 return output 5766} 5767 5768func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5769 output := &types.ResourceNotFoundException{} 5770 var buff [1024]byte 5771 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5772 5773 body := io.TeeReader(errorBody, ringBuffer) 5774 decoder := json.NewDecoder(body) 5775 decoder.UseNumber() 5776 var shape interface{} 5777 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5778 var snapshot bytes.Buffer 5779 io.Copy(&snapshot, ringBuffer) 5780 err = &smithy.DeserializationError{ 5781 Err: fmt.Errorf("failed to decode response body, %w", err), 5782 Snapshot: snapshot.Bytes(), 5783 } 5784 return err 5785 } 5786 5787 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 5788 5789 if err != nil { 5790 var snapshot bytes.Buffer 5791 io.Copy(&snapshot, ringBuffer) 5792 err = &smithy.DeserializationError{ 5793 Err: fmt.Errorf("failed to decode response body, %w", err), 5794 Snapshot: snapshot.Bytes(), 5795 } 5796 return err 5797 } 5798 5799 errorBody.Seek(0, io.SeekStart) 5800 5801 return output 5802} 5803 5804func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5805 output := &types.ThrottlingException{} 5806 var buff [1024]byte 5807 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5808 5809 body := io.TeeReader(errorBody, ringBuffer) 5810 decoder := json.NewDecoder(body) 5811 decoder.UseNumber() 5812 var shape interface{} 5813 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5814 var snapshot bytes.Buffer 5815 io.Copy(&snapshot, ringBuffer) 5816 err = &smithy.DeserializationError{ 5817 Err: fmt.Errorf("failed to decode response body, %w", err), 5818 Snapshot: snapshot.Bytes(), 5819 } 5820 return err 5821 } 5822 5823 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 5824 5825 if err != nil { 5826 var snapshot bytes.Buffer 5827 io.Copy(&snapshot, ringBuffer) 5828 err = &smithy.DeserializationError{ 5829 Err: fmt.Errorf("failed to decode response body, %w", err), 5830 Snapshot: snapshot.Bytes(), 5831 } 5832 return err 5833 } 5834 5835 errorBody.Seek(0, io.SeekStart) 5836 5837 return output 5838} 5839 5840func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5841 output := &types.ValidationException{} 5842 var buff [1024]byte 5843 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5844 5845 body := io.TeeReader(errorBody, ringBuffer) 5846 decoder := json.NewDecoder(body) 5847 decoder.UseNumber() 5848 var shape interface{} 5849 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5850 var snapshot bytes.Buffer 5851 io.Copy(&snapshot, ringBuffer) 5852 err = &smithy.DeserializationError{ 5853 Err: fmt.Errorf("failed to decode response body, %w", err), 5854 Snapshot: snapshot.Bytes(), 5855 } 5856 return err 5857 } 5858 5859 err := awsRestjson1_deserializeDocumentValidationException(&output, shape) 5860 5861 if err != nil { 5862 var snapshot bytes.Buffer 5863 io.Copy(&snapshot, ringBuffer) 5864 err = &smithy.DeserializationError{ 5865 Err: fmt.Errorf("failed to decode response body, %w", err), 5866 Snapshot: snapshot.Bytes(), 5867 } 5868 return err 5869 } 5870 5871 errorBody.Seek(0, io.SeekStart) 5872 5873 return output 5874} 5875 5876func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { 5877 if v == nil { 5878 return fmt.Errorf("unexpected nil of type %T", v) 5879 } 5880 if value == nil { 5881 return nil 5882 } 5883 5884 shape, ok := value.(map[string]interface{}) 5885 if !ok { 5886 return fmt.Errorf("unexpected JSON type %v", value) 5887 } 5888 5889 var sv *types.AccessDeniedException 5890 if *v == nil { 5891 sv = &types.AccessDeniedException{} 5892 } else { 5893 sv = *v 5894 } 5895 5896 for key, value := range shape { 5897 switch key { 5898 case "message": 5899 if value != nil { 5900 jtv, ok := value.(string) 5901 if !ok { 5902 return fmt.Errorf("expected String to be of type string, got %T instead", value) 5903 } 5904 sv.Message = ptr.String(jtv) 5905 } 5906 5907 default: 5908 _, _ = key, value 5909 5910 } 5911 } 5912 *v = sv 5913 return nil 5914} 5915 5916func awsRestjson1_deserializeDocumentArnList(v *[]string, value interface{}) error { 5917 if v == nil { 5918 return fmt.Errorf("unexpected nil of type %T", v) 5919 } 5920 if value == nil { 5921 return nil 5922 } 5923 5924 shape, ok := value.([]interface{}) 5925 if !ok { 5926 return fmt.Errorf("unexpected JSON type %v", value) 5927 } 5928 5929 var cv []string 5930 if *v == nil { 5931 cv = []string{} 5932 } else { 5933 cv = *v 5934 } 5935 5936 for _, value := range shape { 5937 var col string 5938 if value != nil { 5939 jtv, ok := value.(string) 5940 if !ok { 5941 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5942 } 5943 col = jtv 5944 } 5945 cv = append(cv, col) 5946 5947 } 5948 *v = cv 5949 return nil 5950} 5951 5952func awsRestjson1_deserializeDocumentBatchDeleteGeofenceError(v **types.BatchDeleteGeofenceError, value interface{}) error { 5953 if v == nil { 5954 return fmt.Errorf("unexpected nil of type %T", v) 5955 } 5956 if value == nil { 5957 return nil 5958 } 5959 5960 shape, ok := value.(map[string]interface{}) 5961 if !ok { 5962 return fmt.Errorf("unexpected JSON type %v", value) 5963 } 5964 5965 var sv *types.BatchDeleteGeofenceError 5966 if *v == nil { 5967 sv = &types.BatchDeleteGeofenceError{} 5968 } else { 5969 sv = *v 5970 } 5971 5972 for key, value := range shape { 5973 switch key { 5974 case "Error": 5975 if err := awsRestjson1_deserializeDocumentBatchItemError(&sv.Error, value); err != nil { 5976 return err 5977 } 5978 5979 case "GeofenceId": 5980 if value != nil { 5981 jtv, ok := value.(string) 5982 if !ok { 5983 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5984 } 5985 sv.GeofenceId = ptr.String(jtv) 5986 } 5987 5988 default: 5989 _, _ = key, value 5990 5991 } 5992 } 5993 *v = sv 5994 return nil 5995} 5996 5997func awsRestjson1_deserializeDocumentBatchDeleteGeofenceErrorList(v *[]types.BatchDeleteGeofenceError, value interface{}) error { 5998 if v == nil { 5999 return fmt.Errorf("unexpected nil of type %T", v) 6000 } 6001 if value == nil { 6002 return nil 6003 } 6004 6005 shape, ok := value.([]interface{}) 6006 if !ok { 6007 return fmt.Errorf("unexpected JSON type %v", value) 6008 } 6009 6010 var cv []types.BatchDeleteGeofenceError 6011 if *v == nil { 6012 cv = []types.BatchDeleteGeofenceError{} 6013 } else { 6014 cv = *v 6015 } 6016 6017 for _, value := range shape { 6018 var col types.BatchDeleteGeofenceError 6019 destAddr := &col 6020 if err := awsRestjson1_deserializeDocumentBatchDeleteGeofenceError(&destAddr, value); err != nil { 6021 return err 6022 } 6023 col = *destAddr 6024 cv = append(cv, col) 6025 6026 } 6027 *v = cv 6028 return nil 6029} 6030 6031func awsRestjson1_deserializeDocumentBatchEvaluateGeofencesError(v **types.BatchEvaluateGeofencesError, value interface{}) error { 6032 if v == nil { 6033 return fmt.Errorf("unexpected nil of type %T", v) 6034 } 6035 if value == nil { 6036 return nil 6037 } 6038 6039 shape, ok := value.(map[string]interface{}) 6040 if !ok { 6041 return fmt.Errorf("unexpected JSON type %v", value) 6042 } 6043 6044 var sv *types.BatchEvaluateGeofencesError 6045 if *v == nil { 6046 sv = &types.BatchEvaluateGeofencesError{} 6047 } else { 6048 sv = *v 6049 } 6050 6051 for key, value := range shape { 6052 switch key { 6053 case "DeviceId": 6054 if value != nil { 6055 jtv, ok := value.(string) 6056 if !ok { 6057 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6058 } 6059 sv.DeviceId = ptr.String(jtv) 6060 } 6061 6062 case "Error": 6063 if err := awsRestjson1_deserializeDocumentBatchItemError(&sv.Error, value); err != nil { 6064 return err 6065 } 6066 6067 case "SampleTime": 6068 if value != nil { 6069 jtv, ok := value.(string) 6070 if !ok { 6071 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6072 } 6073 t, err := smithytime.ParseDateTime(jtv) 6074 if err != nil { 6075 return err 6076 } 6077 sv.SampleTime = ptr.Time(t) 6078 } 6079 6080 default: 6081 _, _ = key, value 6082 6083 } 6084 } 6085 *v = sv 6086 return nil 6087} 6088 6089func awsRestjson1_deserializeDocumentBatchEvaluateGeofencesErrorList(v *[]types.BatchEvaluateGeofencesError, value interface{}) error { 6090 if v == nil { 6091 return fmt.Errorf("unexpected nil of type %T", v) 6092 } 6093 if value == nil { 6094 return nil 6095 } 6096 6097 shape, ok := value.([]interface{}) 6098 if !ok { 6099 return fmt.Errorf("unexpected JSON type %v", value) 6100 } 6101 6102 var cv []types.BatchEvaluateGeofencesError 6103 if *v == nil { 6104 cv = []types.BatchEvaluateGeofencesError{} 6105 } else { 6106 cv = *v 6107 } 6108 6109 for _, value := range shape { 6110 var col types.BatchEvaluateGeofencesError 6111 destAddr := &col 6112 if err := awsRestjson1_deserializeDocumentBatchEvaluateGeofencesError(&destAddr, value); err != nil { 6113 return err 6114 } 6115 col = *destAddr 6116 cv = append(cv, col) 6117 6118 } 6119 *v = cv 6120 return nil 6121} 6122 6123func awsRestjson1_deserializeDocumentBatchGetDevicePositionError(v **types.BatchGetDevicePositionError, value interface{}) error { 6124 if v == nil { 6125 return fmt.Errorf("unexpected nil of type %T", v) 6126 } 6127 if value == nil { 6128 return nil 6129 } 6130 6131 shape, ok := value.(map[string]interface{}) 6132 if !ok { 6133 return fmt.Errorf("unexpected JSON type %v", value) 6134 } 6135 6136 var sv *types.BatchGetDevicePositionError 6137 if *v == nil { 6138 sv = &types.BatchGetDevicePositionError{} 6139 } else { 6140 sv = *v 6141 } 6142 6143 for key, value := range shape { 6144 switch key { 6145 case "DeviceId": 6146 if value != nil { 6147 jtv, ok := value.(string) 6148 if !ok { 6149 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6150 } 6151 sv.DeviceId = ptr.String(jtv) 6152 } 6153 6154 case "Error": 6155 if err := awsRestjson1_deserializeDocumentBatchItemError(&sv.Error, value); err != nil { 6156 return err 6157 } 6158 6159 default: 6160 _, _ = key, value 6161 6162 } 6163 } 6164 *v = sv 6165 return nil 6166} 6167 6168func awsRestjson1_deserializeDocumentBatchGetDevicePositionErrorList(v *[]types.BatchGetDevicePositionError, value interface{}) error { 6169 if v == nil { 6170 return fmt.Errorf("unexpected nil of type %T", v) 6171 } 6172 if value == nil { 6173 return nil 6174 } 6175 6176 shape, ok := value.([]interface{}) 6177 if !ok { 6178 return fmt.Errorf("unexpected JSON type %v", value) 6179 } 6180 6181 var cv []types.BatchGetDevicePositionError 6182 if *v == nil { 6183 cv = []types.BatchGetDevicePositionError{} 6184 } else { 6185 cv = *v 6186 } 6187 6188 for _, value := range shape { 6189 var col types.BatchGetDevicePositionError 6190 destAddr := &col 6191 if err := awsRestjson1_deserializeDocumentBatchGetDevicePositionError(&destAddr, value); err != nil { 6192 return err 6193 } 6194 col = *destAddr 6195 cv = append(cv, col) 6196 6197 } 6198 *v = cv 6199 return nil 6200} 6201 6202func awsRestjson1_deserializeDocumentBatchItemError(v **types.BatchItemError, value interface{}) error { 6203 if v == nil { 6204 return fmt.Errorf("unexpected nil of type %T", v) 6205 } 6206 if value == nil { 6207 return nil 6208 } 6209 6210 shape, ok := value.(map[string]interface{}) 6211 if !ok { 6212 return fmt.Errorf("unexpected JSON type %v", value) 6213 } 6214 6215 var sv *types.BatchItemError 6216 if *v == nil { 6217 sv = &types.BatchItemError{} 6218 } else { 6219 sv = *v 6220 } 6221 6222 for key, value := range shape { 6223 switch key { 6224 case "Code": 6225 if value != nil { 6226 jtv, ok := value.(string) 6227 if !ok { 6228 return fmt.Errorf("expected BatchItemErrorCode to be of type string, got %T instead", value) 6229 } 6230 sv.Code = types.BatchItemErrorCode(jtv) 6231 } 6232 6233 case "Message": 6234 if value != nil { 6235 jtv, ok := value.(string) 6236 if !ok { 6237 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6238 } 6239 sv.Message = ptr.String(jtv) 6240 } 6241 6242 default: 6243 _, _ = key, value 6244 6245 } 6246 } 6247 *v = sv 6248 return nil 6249} 6250 6251func awsRestjson1_deserializeDocumentBatchPutGeofenceError(v **types.BatchPutGeofenceError, value interface{}) error { 6252 if v == nil { 6253 return fmt.Errorf("unexpected nil of type %T", v) 6254 } 6255 if value == nil { 6256 return nil 6257 } 6258 6259 shape, ok := value.(map[string]interface{}) 6260 if !ok { 6261 return fmt.Errorf("unexpected JSON type %v", value) 6262 } 6263 6264 var sv *types.BatchPutGeofenceError 6265 if *v == nil { 6266 sv = &types.BatchPutGeofenceError{} 6267 } else { 6268 sv = *v 6269 } 6270 6271 for key, value := range shape { 6272 switch key { 6273 case "Error": 6274 if err := awsRestjson1_deserializeDocumentBatchItemError(&sv.Error, value); err != nil { 6275 return err 6276 } 6277 6278 case "GeofenceId": 6279 if value != nil { 6280 jtv, ok := value.(string) 6281 if !ok { 6282 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6283 } 6284 sv.GeofenceId = ptr.String(jtv) 6285 } 6286 6287 default: 6288 _, _ = key, value 6289 6290 } 6291 } 6292 *v = sv 6293 return nil 6294} 6295 6296func awsRestjson1_deserializeDocumentBatchPutGeofenceErrorList(v *[]types.BatchPutGeofenceError, value interface{}) error { 6297 if v == nil { 6298 return fmt.Errorf("unexpected nil of type %T", v) 6299 } 6300 if value == nil { 6301 return nil 6302 } 6303 6304 shape, ok := value.([]interface{}) 6305 if !ok { 6306 return fmt.Errorf("unexpected JSON type %v", value) 6307 } 6308 6309 var cv []types.BatchPutGeofenceError 6310 if *v == nil { 6311 cv = []types.BatchPutGeofenceError{} 6312 } else { 6313 cv = *v 6314 } 6315 6316 for _, value := range shape { 6317 var col types.BatchPutGeofenceError 6318 destAddr := &col 6319 if err := awsRestjson1_deserializeDocumentBatchPutGeofenceError(&destAddr, value); err != nil { 6320 return err 6321 } 6322 col = *destAddr 6323 cv = append(cv, col) 6324 6325 } 6326 *v = cv 6327 return nil 6328} 6329 6330func awsRestjson1_deserializeDocumentBatchPutGeofenceSuccess(v **types.BatchPutGeofenceSuccess, value interface{}) error { 6331 if v == nil { 6332 return fmt.Errorf("unexpected nil of type %T", v) 6333 } 6334 if value == nil { 6335 return nil 6336 } 6337 6338 shape, ok := value.(map[string]interface{}) 6339 if !ok { 6340 return fmt.Errorf("unexpected JSON type %v", value) 6341 } 6342 6343 var sv *types.BatchPutGeofenceSuccess 6344 if *v == nil { 6345 sv = &types.BatchPutGeofenceSuccess{} 6346 } else { 6347 sv = *v 6348 } 6349 6350 for key, value := range shape { 6351 switch key { 6352 case "CreateTime": 6353 if value != nil { 6354 jtv, ok := value.(string) 6355 if !ok { 6356 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6357 } 6358 t, err := smithytime.ParseDateTime(jtv) 6359 if err != nil { 6360 return err 6361 } 6362 sv.CreateTime = ptr.Time(t) 6363 } 6364 6365 case "GeofenceId": 6366 if value != nil { 6367 jtv, ok := value.(string) 6368 if !ok { 6369 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6370 } 6371 sv.GeofenceId = ptr.String(jtv) 6372 } 6373 6374 case "UpdateTime": 6375 if value != nil { 6376 jtv, ok := value.(string) 6377 if !ok { 6378 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6379 } 6380 t, err := smithytime.ParseDateTime(jtv) 6381 if err != nil { 6382 return err 6383 } 6384 sv.UpdateTime = ptr.Time(t) 6385 } 6386 6387 default: 6388 _, _ = key, value 6389 6390 } 6391 } 6392 *v = sv 6393 return nil 6394} 6395 6396func awsRestjson1_deserializeDocumentBatchPutGeofenceSuccessList(v *[]types.BatchPutGeofenceSuccess, value interface{}) error { 6397 if v == nil { 6398 return fmt.Errorf("unexpected nil of type %T", v) 6399 } 6400 if value == nil { 6401 return nil 6402 } 6403 6404 shape, ok := value.([]interface{}) 6405 if !ok { 6406 return fmt.Errorf("unexpected JSON type %v", value) 6407 } 6408 6409 var cv []types.BatchPutGeofenceSuccess 6410 if *v == nil { 6411 cv = []types.BatchPutGeofenceSuccess{} 6412 } else { 6413 cv = *v 6414 } 6415 6416 for _, value := range shape { 6417 var col types.BatchPutGeofenceSuccess 6418 destAddr := &col 6419 if err := awsRestjson1_deserializeDocumentBatchPutGeofenceSuccess(&destAddr, value); err != nil { 6420 return err 6421 } 6422 col = *destAddr 6423 cv = append(cv, col) 6424 6425 } 6426 *v = cv 6427 return nil 6428} 6429 6430func awsRestjson1_deserializeDocumentBatchUpdateDevicePositionError(v **types.BatchUpdateDevicePositionError, value interface{}) error { 6431 if v == nil { 6432 return fmt.Errorf("unexpected nil of type %T", v) 6433 } 6434 if value == nil { 6435 return nil 6436 } 6437 6438 shape, ok := value.(map[string]interface{}) 6439 if !ok { 6440 return fmt.Errorf("unexpected JSON type %v", value) 6441 } 6442 6443 var sv *types.BatchUpdateDevicePositionError 6444 if *v == nil { 6445 sv = &types.BatchUpdateDevicePositionError{} 6446 } else { 6447 sv = *v 6448 } 6449 6450 for key, value := range shape { 6451 switch key { 6452 case "DeviceId": 6453 if value != nil { 6454 jtv, ok := value.(string) 6455 if !ok { 6456 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6457 } 6458 sv.DeviceId = ptr.String(jtv) 6459 } 6460 6461 case "Error": 6462 if err := awsRestjson1_deserializeDocumentBatchItemError(&sv.Error, value); err != nil { 6463 return err 6464 } 6465 6466 case "SampleTime": 6467 if value != nil { 6468 jtv, ok := value.(string) 6469 if !ok { 6470 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6471 } 6472 t, err := smithytime.ParseDateTime(jtv) 6473 if err != nil { 6474 return err 6475 } 6476 sv.SampleTime = ptr.Time(t) 6477 } 6478 6479 default: 6480 _, _ = key, value 6481 6482 } 6483 } 6484 *v = sv 6485 return nil 6486} 6487 6488func awsRestjson1_deserializeDocumentBatchUpdateDevicePositionErrorList(v *[]types.BatchUpdateDevicePositionError, value interface{}) error { 6489 if v == nil { 6490 return fmt.Errorf("unexpected nil of type %T", v) 6491 } 6492 if value == nil { 6493 return nil 6494 } 6495 6496 shape, ok := value.([]interface{}) 6497 if !ok { 6498 return fmt.Errorf("unexpected JSON type %v", value) 6499 } 6500 6501 var cv []types.BatchUpdateDevicePositionError 6502 if *v == nil { 6503 cv = []types.BatchUpdateDevicePositionError{} 6504 } else { 6505 cv = *v 6506 } 6507 6508 for _, value := range shape { 6509 var col types.BatchUpdateDevicePositionError 6510 destAddr := &col 6511 if err := awsRestjson1_deserializeDocumentBatchUpdateDevicePositionError(&destAddr, value); err != nil { 6512 return err 6513 } 6514 col = *destAddr 6515 cv = append(cv, col) 6516 6517 } 6518 *v = cv 6519 return nil 6520} 6521 6522func awsRestjson1_deserializeDocumentBoundingBox(v *[]float64, value interface{}) error { 6523 if v == nil { 6524 return fmt.Errorf("unexpected nil of type %T", v) 6525 } 6526 if value == nil { 6527 return nil 6528 } 6529 6530 shape, ok := value.([]interface{}) 6531 if !ok { 6532 return fmt.Errorf("unexpected JSON type %v", value) 6533 } 6534 6535 var cv []float64 6536 if *v == nil { 6537 cv = []float64{} 6538 } else { 6539 cv = *v 6540 } 6541 6542 for _, value := range shape { 6543 var col float64 6544 if value != nil { 6545 jtv, ok := value.(json.Number) 6546 if !ok { 6547 return fmt.Errorf("expected Double to be json.Number, got %T instead", value) 6548 } 6549 f64, err := jtv.Float64() 6550 if err != nil { 6551 return err 6552 } 6553 col = f64 6554 } 6555 cv = append(cv, col) 6556 6557 } 6558 *v = cv 6559 return nil 6560} 6561 6562func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 6563 if v == nil { 6564 return fmt.Errorf("unexpected nil of type %T", v) 6565 } 6566 if value == nil { 6567 return nil 6568 } 6569 6570 shape, ok := value.(map[string]interface{}) 6571 if !ok { 6572 return fmt.Errorf("unexpected JSON type %v", value) 6573 } 6574 6575 var sv *types.ConflictException 6576 if *v == nil { 6577 sv = &types.ConflictException{} 6578 } else { 6579 sv = *v 6580 } 6581 6582 for key, value := range shape { 6583 switch key { 6584 case "message": 6585 if value != nil { 6586 jtv, ok := value.(string) 6587 if !ok { 6588 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6589 } 6590 sv.Message = ptr.String(jtv) 6591 } 6592 6593 default: 6594 _, _ = key, value 6595 6596 } 6597 } 6598 *v = sv 6599 return nil 6600} 6601 6602func awsRestjson1_deserializeDocumentCountryCodeList(v *[]string, value interface{}) error { 6603 if v == nil { 6604 return fmt.Errorf("unexpected nil of type %T", v) 6605 } 6606 if value == nil { 6607 return nil 6608 } 6609 6610 shape, ok := value.([]interface{}) 6611 if !ok { 6612 return fmt.Errorf("unexpected JSON type %v", value) 6613 } 6614 6615 var cv []string 6616 if *v == nil { 6617 cv = []string{} 6618 } else { 6619 cv = *v 6620 } 6621 6622 for _, value := range shape { 6623 var col string 6624 if value != nil { 6625 jtv, ok := value.(string) 6626 if !ok { 6627 return fmt.Errorf("expected CountryCode to be of type string, got %T instead", value) 6628 } 6629 col = jtv 6630 } 6631 cv = append(cv, col) 6632 6633 } 6634 *v = cv 6635 return nil 6636} 6637 6638func awsRestjson1_deserializeDocumentDataSourceConfiguration(v **types.DataSourceConfiguration, value interface{}) error { 6639 if v == nil { 6640 return fmt.Errorf("unexpected nil of type %T", v) 6641 } 6642 if value == nil { 6643 return nil 6644 } 6645 6646 shape, ok := value.(map[string]interface{}) 6647 if !ok { 6648 return fmt.Errorf("unexpected JSON type %v", value) 6649 } 6650 6651 var sv *types.DataSourceConfiguration 6652 if *v == nil { 6653 sv = &types.DataSourceConfiguration{} 6654 } else { 6655 sv = *v 6656 } 6657 6658 for key, value := range shape { 6659 switch key { 6660 case "IntendedUse": 6661 if value != nil { 6662 jtv, ok := value.(string) 6663 if !ok { 6664 return fmt.Errorf("expected IntendedUse to be of type string, got %T instead", value) 6665 } 6666 sv.IntendedUse = types.IntendedUse(jtv) 6667 } 6668 6669 default: 6670 _, _ = key, value 6671 6672 } 6673 } 6674 *v = sv 6675 return nil 6676} 6677 6678func awsRestjson1_deserializeDocumentDevicePosition(v **types.DevicePosition, value interface{}) error { 6679 if v == nil { 6680 return fmt.Errorf("unexpected nil of type %T", v) 6681 } 6682 if value == nil { 6683 return nil 6684 } 6685 6686 shape, ok := value.(map[string]interface{}) 6687 if !ok { 6688 return fmt.Errorf("unexpected JSON type %v", value) 6689 } 6690 6691 var sv *types.DevicePosition 6692 if *v == nil { 6693 sv = &types.DevicePosition{} 6694 } else { 6695 sv = *v 6696 } 6697 6698 for key, value := range shape { 6699 switch key { 6700 case "DeviceId": 6701 if value != nil { 6702 jtv, ok := value.(string) 6703 if !ok { 6704 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6705 } 6706 sv.DeviceId = ptr.String(jtv) 6707 } 6708 6709 case "Position": 6710 if err := awsRestjson1_deserializeDocumentPosition(&sv.Position, value); err != nil { 6711 return err 6712 } 6713 6714 case "ReceivedTime": 6715 if value != nil { 6716 jtv, ok := value.(string) 6717 if !ok { 6718 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6719 } 6720 t, err := smithytime.ParseDateTime(jtv) 6721 if err != nil { 6722 return err 6723 } 6724 sv.ReceivedTime = ptr.Time(t) 6725 } 6726 6727 case "SampleTime": 6728 if value != nil { 6729 jtv, ok := value.(string) 6730 if !ok { 6731 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6732 } 6733 t, err := smithytime.ParseDateTime(jtv) 6734 if err != nil { 6735 return err 6736 } 6737 sv.SampleTime = ptr.Time(t) 6738 } 6739 6740 default: 6741 _, _ = key, value 6742 6743 } 6744 } 6745 *v = sv 6746 return nil 6747} 6748 6749func awsRestjson1_deserializeDocumentDevicePositionList(v *[]types.DevicePosition, value interface{}) error { 6750 if v == nil { 6751 return fmt.Errorf("unexpected nil of type %T", v) 6752 } 6753 if value == nil { 6754 return nil 6755 } 6756 6757 shape, ok := value.([]interface{}) 6758 if !ok { 6759 return fmt.Errorf("unexpected JSON type %v", value) 6760 } 6761 6762 var cv []types.DevicePosition 6763 if *v == nil { 6764 cv = []types.DevicePosition{} 6765 } else { 6766 cv = *v 6767 } 6768 6769 for _, value := range shape { 6770 var col types.DevicePosition 6771 destAddr := &col 6772 if err := awsRestjson1_deserializeDocumentDevicePosition(&destAddr, value); err != nil { 6773 return err 6774 } 6775 col = *destAddr 6776 cv = append(cv, col) 6777 6778 } 6779 *v = cv 6780 return nil 6781} 6782 6783func awsRestjson1_deserializeDocumentGeofenceGeometry(v **types.GeofenceGeometry, value interface{}) error { 6784 if v == nil { 6785 return fmt.Errorf("unexpected nil of type %T", v) 6786 } 6787 if value == nil { 6788 return nil 6789 } 6790 6791 shape, ok := value.(map[string]interface{}) 6792 if !ok { 6793 return fmt.Errorf("unexpected JSON type %v", value) 6794 } 6795 6796 var sv *types.GeofenceGeometry 6797 if *v == nil { 6798 sv = &types.GeofenceGeometry{} 6799 } else { 6800 sv = *v 6801 } 6802 6803 for key, value := range shape { 6804 switch key { 6805 case "Polygon": 6806 if err := awsRestjson1_deserializeDocumentLinearRings(&sv.Polygon, value); err != nil { 6807 return err 6808 } 6809 6810 default: 6811 _, _ = key, value 6812 6813 } 6814 } 6815 *v = sv 6816 return nil 6817} 6818 6819func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 6820 if v == nil { 6821 return fmt.Errorf("unexpected nil of type %T", v) 6822 } 6823 if value == nil { 6824 return nil 6825 } 6826 6827 shape, ok := value.(map[string]interface{}) 6828 if !ok { 6829 return fmt.Errorf("unexpected JSON type %v", value) 6830 } 6831 6832 var sv *types.InternalServerException 6833 if *v == nil { 6834 sv = &types.InternalServerException{} 6835 } else { 6836 sv = *v 6837 } 6838 6839 for key, value := range shape { 6840 switch key { 6841 case "message": 6842 if value != nil { 6843 jtv, ok := value.(string) 6844 if !ok { 6845 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6846 } 6847 sv.Message = ptr.String(jtv) 6848 } 6849 6850 default: 6851 _, _ = key, value 6852 6853 } 6854 } 6855 *v = sv 6856 return nil 6857} 6858 6859func awsRestjson1_deserializeDocumentLinearRing(v *[][]float64, value interface{}) error { 6860 if v == nil { 6861 return fmt.Errorf("unexpected nil of type %T", v) 6862 } 6863 if value == nil { 6864 return nil 6865 } 6866 6867 shape, ok := value.([]interface{}) 6868 if !ok { 6869 return fmt.Errorf("unexpected JSON type %v", value) 6870 } 6871 6872 var cv [][]float64 6873 if *v == nil { 6874 cv = [][]float64{} 6875 } else { 6876 cv = *v 6877 } 6878 6879 for _, value := range shape { 6880 var col []float64 6881 if err := awsRestjson1_deserializeDocumentPosition(&col, value); err != nil { 6882 return err 6883 } 6884 cv = append(cv, col) 6885 6886 } 6887 *v = cv 6888 return nil 6889} 6890 6891func awsRestjson1_deserializeDocumentLinearRings(v *[][][]float64, value interface{}) error { 6892 if v == nil { 6893 return fmt.Errorf("unexpected nil of type %T", v) 6894 } 6895 if value == nil { 6896 return nil 6897 } 6898 6899 shape, ok := value.([]interface{}) 6900 if !ok { 6901 return fmt.Errorf("unexpected JSON type %v", value) 6902 } 6903 6904 var cv [][][]float64 6905 if *v == nil { 6906 cv = [][][]float64{} 6907 } else { 6908 cv = *v 6909 } 6910 6911 for _, value := range shape { 6912 var col [][]float64 6913 if err := awsRestjson1_deserializeDocumentLinearRing(&col, value); err != nil { 6914 return err 6915 } 6916 cv = append(cv, col) 6917 6918 } 6919 *v = cv 6920 return nil 6921} 6922 6923func awsRestjson1_deserializeDocumentListGeofenceCollectionsResponseEntry(v **types.ListGeofenceCollectionsResponseEntry, value interface{}) error { 6924 if v == nil { 6925 return fmt.Errorf("unexpected nil of type %T", v) 6926 } 6927 if value == nil { 6928 return nil 6929 } 6930 6931 shape, ok := value.(map[string]interface{}) 6932 if !ok { 6933 return fmt.Errorf("unexpected JSON type %v", value) 6934 } 6935 6936 var sv *types.ListGeofenceCollectionsResponseEntry 6937 if *v == nil { 6938 sv = &types.ListGeofenceCollectionsResponseEntry{} 6939 } else { 6940 sv = *v 6941 } 6942 6943 for key, value := range shape { 6944 switch key { 6945 case "CollectionName": 6946 if value != nil { 6947 jtv, ok := value.(string) 6948 if !ok { 6949 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 6950 } 6951 sv.CollectionName = ptr.String(jtv) 6952 } 6953 6954 case "CreateTime": 6955 if value != nil { 6956 jtv, ok := value.(string) 6957 if !ok { 6958 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6959 } 6960 t, err := smithytime.ParseDateTime(jtv) 6961 if err != nil { 6962 return err 6963 } 6964 sv.CreateTime = ptr.Time(t) 6965 } 6966 6967 case "Description": 6968 if value != nil { 6969 jtv, ok := value.(string) 6970 if !ok { 6971 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 6972 } 6973 sv.Description = ptr.String(jtv) 6974 } 6975 6976 case "PricingPlan": 6977 if value != nil { 6978 jtv, ok := value.(string) 6979 if !ok { 6980 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 6981 } 6982 sv.PricingPlan = types.PricingPlan(jtv) 6983 } 6984 6985 case "PricingPlanDataSource": 6986 if value != nil { 6987 jtv, ok := value.(string) 6988 if !ok { 6989 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6990 } 6991 sv.PricingPlanDataSource = ptr.String(jtv) 6992 } 6993 6994 case "UpdateTime": 6995 if value != nil { 6996 jtv, ok := value.(string) 6997 if !ok { 6998 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 6999 } 7000 t, err := smithytime.ParseDateTime(jtv) 7001 if err != nil { 7002 return err 7003 } 7004 sv.UpdateTime = ptr.Time(t) 7005 } 7006 7007 default: 7008 _, _ = key, value 7009 7010 } 7011 } 7012 *v = sv 7013 return nil 7014} 7015 7016func awsRestjson1_deserializeDocumentListGeofenceCollectionsResponseEntryList(v *[]types.ListGeofenceCollectionsResponseEntry, value interface{}) error { 7017 if v == nil { 7018 return fmt.Errorf("unexpected nil of type %T", v) 7019 } 7020 if value == nil { 7021 return nil 7022 } 7023 7024 shape, ok := value.([]interface{}) 7025 if !ok { 7026 return fmt.Errorf("unexpected JSON type %v", value) 7027 } 7028 7029 var cv []types.ListGeofenceCollectionsResponseEntry 7030 if *v == nil { 7031 cv = []types.ListGeofenceCollectionsResponseEntry{} 7032 } else { 7033 cv = *v 7034 } 7035 7036 for _, value := range shape { 7037 var col types.ListGeofenceCollectionsResponseEntry 7038 destAddr := &col 7039 if err := awsRestjson1_deserializeDocumentListGeofenceCollectionsResponseEntry(&destAddr, value); err != nil { 7040 return err 7041 } 7042 col = *destAddr 7043 cv = append(cv, col) 7044 7045 } 7046 *v = cv 7047 return nil 7048} 7049 7050func awsRestjson1_deserializeDocumentListGeofenceResponseEntry(v **types.ListGeofenceResponseEntry, value interface{}) error { 7051 if v == nil { 7052 return fmt.Errorf("unexpected nil of type %T", v) 7053 } 7054 if value == nil { 7055 return nil 7056 } 7057 7058 shape, ok := value.(map[string]interface{}) 7059 if !ok { 7060 return fmt.Errorf("unexpected JSON type %v", value) 7061 } 7062 7063 var sv *types.ListGeofenceResponseEntry 7064 if *v == nil { 7065 sv = &types.ListGeofenceResponseEntry{} 7066 } else { 7067 sv = *v 7068 } 7069 7070 for key, value := range shape { 7071 switch key { 7072 case "CreateTime": 7073 if value != nil { 7074 jtv, ok := value.(string) 7075 if !ok { 7076 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7077 } 7078 t, err := smithytime.ParseDateTime(jtv) 7079 if err != nil { 7080 return err 7081 } 7082 sv.CreateTime = ptr.Time(t) 7083 } 7084 7085 case "GeofenceId": 7086 if value != nil { 7087 jtv, ok := value.(string) 7088 if !ok { 7089 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7090 } 7091 sv.GeofenceId = ptr.String(jtv) 7092 } 7093 7094 case "Geometry": 7095 if err := awsRestjson1_deserializeDocumentGeofenceGeometry(&sv.Geometry, value); err != nil { 7096 return err 7097 } 7098 7099 case "Status": 7100 if value != nil { 7101 jtv, ok := value.(string) 7102 if !ok { 7103 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7104 } 7105 sv.Status = ptr.String(jtv) 7106 } 7107 7108 case "UpdateTime": 7109 if value != nil { 7110 jtv, ok := value.(string) 7111 if !ok { 7112 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7113 } 7114 t, err := smithytime.ParseDateTime(jtv) 7115 if err != nil { 7116 return err 7117 } 7118 sv.UpdateTime = ptr.Time(t) 7119 } 7120 7121 default: 7122 _, _ = key, value 7123 7124 } 7125 } 7126 *v = sv 7127 return nil 7128} 7129 7130func awsRestjson1_deserializeDocumentListGeofenceResponseEntryList(v *[]types.ListGeofenceResponseEntry, value interface{}) error { 7131 if v == nil { 7132 return fmt.Errorf("unexpected nil of type %T", v) 7133 } 7134 if value == nil { 7135 return nil 7136 } 7137 7138 shape, ok := value.([]interface{}) 7139 if !ok { 7140 return fmt.Errorf("unexpected JSON type %v", value) 7141 } 7142 7143 var cv []types.ListGeofenceResponseEntry 7144 if *v == nil { 7145 cv = []types.ListGeofenceResponseEntry{} 7146 } else { 7147 cv = *v 7148 } 7149 7150 for _, value := range shape { 7151 var col types.ListGeofenceResponseEntry 7152 destAddr := &col 7153 if err := awsRestjson1_deserializeDocumentListGeofenceResponseEntry(&destAddr, value); err != nil { 7154 return err 7155 } 7156 col = *destAddr 7157 cv = append(cv, col) 7158 7159 } 7160 *v = cv 7161 return nil 7162} 7163 7164func awsRestjson1_deserializeDocumentListMapsResponseEntry(v **types.ListMapsResponseEntry, value interface{}) error { 7165 if v == nil { 7166 return fmt.Errorf("unexpected nil of type %T", v) 7167 } 7168 if value == nil { 7169 return nil 7170 } 7171 7172 shape, ok := value.(map[string]interface{}) 7173 if !ok { 7174 return fmt.Errorf("unexpected JSON type %v", value) 7175 } 7176 7177 var sv *types.ListMapsResponseEntry 7178 if *v == nil { 7179 sv = &types.ListMapsResponseEntry{} 7180 } else { 7181 sv = *v 7182 } 7183 7184 for key, value := range shape { 7185 switch key { 7186 case "CreateTime": 7187 if value != nil { 7188 jtv, ok := value.(string) 7189 if !ok { 7190 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7191 } 7192 t, err := smithytime.ParseDateTime(jtv) 7193 if err != nil { 7194 return err 7195 } 7196 sv.CreateTime = ptr.Time(t) 7197 } 7198 7199 case "DataSource": 7200 if value != nil { 7201 jtv, ok := value.(string) 7202 if !ok { 7203 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7204 } 7205 sv.DataSource = ptr.String(jtv) 7206 } 7207 7208 case "Description": 7209 if value != nil { 7210 jtv, ok := value.(string) 7211 if !ok { 7212 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 7213 } 7214 sv.Description = ptr.String(jtv) 7215 } 7216 7217 case "MapName": 7218 if value != nil { 7219 jtv, ok := value.(string) 7220 if !ok { 7221 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7222 } 7223 sv.MapName = ptr.String(jtv) 7224 } 7225 7226 case "PricingPlan": 7227 if value != nil { 7228 jtv, ok := value.(string) 7229 if !ok { 7230 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 7231 } 7232 sv.PricingPlan = types.PricingPlan(jtv) 7233 } 7234 7235 case "UpdateTime": 7236 if value != nil { 7237 jtv, ok := value.(string) 7238 if !ok { 7239 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7240 } 7241 t, err := smithytime.ParseDateTime(jtv) 7242 if err != nil { 7243 return err 7244 } 7245 sv.UpdateTime = ptr.Time(t) 7246 } 7247 7248 default: 7249 _, _ = key, value 7250 7251 } 7252 } 7253 *v = sv 7254 return nil 7255} 7256 7257func awsRestjson1_deserializeDocumentListMapsResponseEntryList(v *[]types.ListMapsResponseEntry, value interface{}) error { 7258 if v == nil { 7259 return fmt.Errorf("unexpected nil of type %T", v) 7260 } 7261 if value == nil { 7262 return nil 7263 } 7264 7265 shape, ok := value.([]interface{}) 7266 if !ok { 7267 return fmt.Errorf("unexpected JSON type %v", value) 7268 } 7269 7270 var cv []types.ListMapsResponseEntry 7271 if *v == nil { 7272 cv = []types.ListMapsResponseEntry{} 7273 } else { 7274 cv = *v 7275 } 7276 7277 for _, value := range shape { 7278 var col types.ListMapsResponseEntry 7279 destAddr := &col 7280 if err := awsRestjson1_deserializeDocumentListMapsResponseEntry(&destAddr, value); err != nil { 7281 return err 7282 } 7283 col = *destAddr 7284 cv = append(cv, col) 7285 7286 } 7287 *v = cv 7288 return nil 7289} 7290 7291func awsRestjson1_deserializeDocumentListPlaceIndexesResponseEntry(v **types.ListPlaceIndexesResponseEntry, value interface{}) error { 7292 if v == nil { 7293 return fmt.Errorf("unexpected nil of type %T", v) 7294 } 7295 if value == nil { 7296 return nil 7297 } 7298 7299 shape, ok := value.(map[string]interface{}) 7300 if !ok { 7301 return fmt.Errorf("unexpected JSON type %v", value) 7302 } 7303 7304 var sv *types.ListPlaceIndexesResponseEntry 7305 if *v == nil { 7306 sv = &types.ListPlaceIndexesResponseEntry{} 7307 } else { 7308 sv = *v 7309 } 7310 7311 for key, value := range shape { 7312 switch key { 7313 case "CreateTime": 7314 if value != nil { 7315 jtv, ok := value.(string) 7316 if !ok { 7317 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7318 } 7319 t, err := smithytime.ParseDateTime(jtv) 7320 if err != nil { 7321 return err 7322 } 7323 sv.CreateTime = ptr.Time(t) 7324 } 7325 7326 case "DataSource": 7327 if value != nil { 7328 jtv, ok := value.(string) 7329 if !ok { 7330 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7331 } 7332 sv.DataSource = ptr.String(jtv) 7333 } 7334 7335 case "Description": 7336 if value != nil { 7337 jtv, ok := value.(string) 7338 if !ok { 7339 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 7340 } 7341 sv.Description = ptr.String(jtv) 7342 } 7343 7344 case "IndexName": 7345 if value != nil { 7346 jtv, ok := value.(string) 7347 if !ok { 7348 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7349 } 7350 sv.IndexName = ptr.String(jtv) 7351 } 7352 7353 case "PricingPlan": 7354 if value != nil { 7355 jtv, ok := value.(string) 7356 if !ok { 7357 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 7358 } 7359 sv.PricingPlan = types.PricingPlan(jtv) 7360 } 7361 7362 case "UpdateTime": 7363 if value != nil { 7364 jtv, ok := value.(string) 7365 if !ok { 7366 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7367 } 7368 t, err := smithytime.ParseDateTime(jtv) 7369 if err != nil { 7370 return err 7371 } 7372 sv.UpdateTime = ptr.Time(t) 7373 } 7374 7375 default: 7376 _, _ = key, value 7377 7378 } 7379 } 7380 *v = sv 7381 return nil 7382} 7383 7384func awsRestjson1_deserializeDocumentListPlaceIndexesResponseEntryList(v *[]types.ListPlaceIndexesResponseEntry, value interface{}) error { 7385 if v == nil { 7386 return fmt.Errorf("unexpected nil of type %T", v) 7387 } 7388 if value == nil { 7389 return nil 7390 } 7391 7392 shape, ok := value.([]interface{}) 7393 if !ok { 7394 return fmt.Errorf("unexpected JSON type %v", value) 7395 } 7396 7397 var cv []types.ListPlaceIndexesResponseEntry 7398 if *v == nil { 7399 cv = []types.ListPlaceIndexesResponseEntry{} 7400 } else { 7401 cv = *v 7402 } 7403 7404 for _, value := range shape { 7405 var col types.ListPlaceIndexesResponseEntry 7406 destAddr := &col 7407 if err := awsRestjson1_deserializeDocumentListPlaceIndexesResponseEntry(&destAddr, value); err != nil { 7408 return err 7409 } 7410 col = *destAddr 7411 cv = append(cv, col) 7412 7413 } 7414 *v = cv 7415 return nil 7416} 7417 7418func awsRestjson1_deserializeDocumentListTrackersResponseEntry(v **types.ListTrackersResponseEntry, value interface{}) error { 7419 if v == nil { 7420 return fmt.Errorf("unexpected nil of type %T", v) 7421 } 7422 if value == nil { 7423 return nil 7424 } 7425 7426 shape, ok := value.(map[string]interface{}) 7427 if !ok { 7428 return fmt.Errorf("unexpected JSON type %v", value) 7429 } 7430 7431 var sv *types.ListTrackersResponseEntry 7432 if *v == nil { 7433 sv = &types.ListTrackersResponseEntry{} 7434 } else { 7435 sv = *v 7436 } 7437 7438 for key, value := range shape { 7439 switch key { 7440 case "CreateTime": 7441 if value != nil { 7442 jtv, ok := value.(string) 7443 if !ok { 7444 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7445 } 7446 t, err := smithytime.ParseDateTime(jtv) 7447 if err != nil { 7448 return err 7449 } 7450 sv.CreateTime = ptr.Time(t) 7451 } 7452 7453 case "Description": 7454 if value != nil { 7455 jtv, ok := value.(string) 7456 if !ok { 7457 return fmt.Errorf("expected ResourceDescription to be of type string, got %T instead", value) 7458 } 7459 sv.Description = ptr.String(jtv) 7460 } 7461 7462 case "PricingPlan": 7463 if value != nil { 7464 jtv, ok := value.(string) 7465 if !ok { 7466 return fmt.Errorf("expected PricingPlan to be of type string, got %T instead", value) 7467 } 7468 sv.PricingPlan = types.PricingPlan(jtv) 7469 } 7470 7471 case "PricingPlanDataSource": 7472 if value != nil { 7473 jtv, ok := value.(string) 7474 if !ok { 7475 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7476 } 7477 sv.PricingPlanDataSource = ptr.String(jtv) 7478 } 7479 7480 case "TrackerName": 7481 if value != nil { 7482 jtv, ok := value.(string) 7483 if !ok { 7484 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7485 } 7486 sv.TrackerName = ptr.String(jtv) 7487 } 7488 7489 case "UpdateTime": 7490 if value != nil { 7491 jtv, ok := value.(string) 7492 if !ok { 7493 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 7494 } 7495 t, err := smithytime.ParseDateTime(jtv) 7496 if err != nil { 7497 return err 7498 } 7499 sv.UpdateTime = ptr.Time(t) 7500 } 7501 7502 default: 7503 _, _ = key, value 7504 7505 } 7506 } 7507 *v = sv 7508 return nil 7509} 7510 7511func awsRestjson1_deserializeDocumentListTrackersResponseEntryList(v *[]types.ListTrackersResponseEntry, value interface{}) error { 7512 if v == nil { 7513 return fmt.Errorf("unexpected nil of type %T", v) 7514 } 7515 if value == nil { 7516 return nil 7517 } 7518 7519 shape, ok := value.([]interface{}) 7520 if !ok { 7521 return fmt.Errorf("unexpected JSON type %v", value) 7522 } 7523 7524 var cv []types.ListTrackersResponseEntry 7525 if *v == nil { 7526 cv = []types.ListTrackersResponseEntry{} 7527 } else { 7528 cv = *v 7529 } 7530 7531 for _, value := range shape { 7532 var col types.ListTrackersResponseEntry 7533 destAddr := &col 7534 if err := awsRestjson1_deserializeDocumentListTrackersResponseEntry(&destAddr, value); err != nil { 7535 return err 7536 } 7537 col = *destAddr 7538 cv = append(cv, col) 7539 7540 } 7541 *v = cv 7542 return nil 7543} 7544 7545func awsRestjson1_deserializeDocumentMapConfiguration(v **types.MapConfiguration, value interface{}) error { 7546 if v == nil { 7547 return fmt.Errorf("unexpected nil of type %T", v) 7548 } 7549 if value == nil { 7550 return nil 7551 } 7552 7553 shape, ok := value.(map[string]interface{}) 7554 if !ok { 7555 return fmt.Errorf("unexpected JSON type %v", value) 7556 } 7557 7558 var sv *types.MapConfiguration 7559 if *v == nil { 7560 sv = &types.MapConfiguration{} 7561 } else { 7562 sv = *v 7563 } 7564 7565 for key, value := range shape { 7566 switch key { 7567 case "Style": 7568 if value != nil { 7569 jtv, ok := value.(string) 7570 if !ok { 7571 return fmt.Errorf("expected MapStyle to be of type string, got %T instead", value) 7572 } 7573 sv.Style = ptr.String(jtv) 7574 } 7575 7576 default: 7577 _, _ = key, value 7578 7579 } 7580 } 7581 *v = sv 7582 return nil 7583} 7584 7585func awsRestjson1_deserializeDocumentPlace(v **types.Place, value interface{}) error { 7586 if v == nil { 7587 return fmt.Errorf("unexpected nil of type %T", v) 7588 } 7589 if value == nil { 7590 return nil 7591 } 7592 7593 shape, ok := value.(map[string]interface{}) 7594 if !ok { 7595 return fmt.Errorf("unexpected JSON type %v", value) 7596 } 7597 7598 var sv *types.Place 7599 if *v == nil { 7600 sv = &types.Place{} 7601 } else { 7602 sv = *v 7603 } 7604 7605 for key, value := range shape { 7606 switch key { 7607 case "AddressNumber": 7608 if value != nil { 7609 jtv, ok := value.(string) 7610 if !ok { 7611 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7612 } 7613 sv.AddressNumber = ptr.String(jtv) 7614 } 7615 7616 case "Country": 7617 if value != nil { 7618 jtv, ok := value.(string) 7619 if !ok { 7620 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7621 } 7622 sv.Country = ptr.String(jtv) 7623 } 7624 7625 case "Geometry": 7626 if err := awsRestjson1_deserializeDocumentPlaceGeometry(&sv.Geometry, value); err != nil { 7627 return err 7628 } 7629 7630 case "Label": 7631 if value != nil { 7632 jtv, ok := value.(string) 7633 if !ok { 7634 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7635 } 7636 sv.Label = ptr.String(jtv) 7637 } 7638 7639 case "Municipality": 7640 if value != nil { 7641 jtv, ok := value.(string) 7642 if !ok { 7643 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7644 } 7645 sv.Municipality = ptr.String(jtv) 7646 } 7647 7648 case "Neighborhood": 7649 if value != nil { 7650 jtv, ok := value.(string) 7651 if !ok { 7652 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7653 } 7654 sv.Neighborhood = ptr.String(jtv) 7655 } 7656 7657 case "PostalCode": 7658 if value != nil { 7659 jtv, ok := value.(string) 7660 if !ok { 7661 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7662 } 7663 sv.PostalCode = ptr.String(jtv) 7664 } 7665 7666 case "Region": 7667 if value != nil { 7668 jtv, ok := value.(string) 7669 if !ok { 7670 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7671 } 7672 sv.Region = ptr.String(jtv) 7673 } 7674 7675 case "Street": 7676 if value != nil { 7677 jtv, ok := value.(string) 7678 if !ok { 7679 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7680 } 7681 sv.Street = ptr.String(jtv) 7682 } 7683 7684 case "SubRegion": 7685 if value != nil { 7686 jtv, ok := value.(string) 7687 if !ok { 7688 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7689 } 7690 sv.SubRegion = ptr.String(jtv) 7691 } 7692 7693 default: 7694 _, _ = key, value 7695 7696 } 7697 } 7698 *v = sv 7699 return nil 7700} 7701 7702func awsRestjson1_deserializeDocumentPlaceGeometry(v **types.PlaceGeometry, value interface{}) error { 7703 if v == nil { 7704 return fmt.Errorf("unexpected nil of type %T", v) 7705 } 7706 if value == nil { 7707 return nil 7708 } 7709 7710 shape, ok := value.(map[string]interface{}) 7711 if !ok { 7712 return fmt.Errorf("unexpected JSON type %v", value) 7713 } 7714 7715 var sv *types.PlaceGeometry 7716 if *v == nil { 7717 sv = &types.PlaceGeometry{} 7718 } else { 7719 sv = *v 7720 } 7721 7722 for key, value := range shape { 7723 switch key { 7724 case "Point": 7725 if err := awsRestjson1_deserializeDocumentPosition(&sv.Point, value); err != nil { 7726 return err 7727 } 7728 7729 default: 7730 _, _ = key, value 7731 7732 } 7733 } 7734 *v = sv 7735 return nil 7736} 7737 7738func awsRestjson1_deserializeDocumentPosition(v *[]float64, value interface{}) error { 7739 if v == nil { 7740 return fmt.Errorf("unexpected nil of type %T", v) 7741 } 7742 if value == nil { 7743 return nil 7744 } 7745 7746 shape, ok := value.([]interface{}) 7747 if !ok { 7748 return fmt.Errorf("unexpected JSON type %v", value) 7749 } 7750 7751 var cv []float64 7752 if *v == nil { 7753 cv = []float64{} 7754 } else { 7755 cv = *v 7756 } 7757 7758 for _, value := range shape { 7759 var col float64 7760 if value != nil { 7761 jtv, ok := value.(json.Number) 7762 if !ok { 7763 return fmt.Errorf("expected Double to be json.Number, got %T instead", value) 7764 } 7765 f64, err := jtv.Float64() 7766 if err != nil { 7767 return err 7768 } 7769 col = f64 7770 } 7771 cv = append(cv, col) 7772 7773 } 7774 *v = cv 7775 return nil 7776} 7777 7778func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 7779 if v == nil { 7780 return fmt.Errorf("unexpected nil of type %T", v) 7781 } 7782 if value == nil { 7783 return nil 7784 } 7785 7786 shape, ok := value.(map[string]interface{}) 7787 if !ok { 7788 return fmt.Errorf("unexpected JSON type %v", value) 7789 } 7790 7791 var sv *types.ResourceNotFoundException 7792 if *v == nil { 7793 sv = &types.ResourceNotFoundException{} 7794 } else { 7795 sv = *v 7796 } 7797 7798 for key, value := range shape { 7799 switch key { 7800 case "message": 7801 if value != nil { 7802 jtv, ok := value.(string) 7803 if !ok { 7804 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7805 } 7806 sv.Message = ptr.String(jtv) 7807 } 7808 7809 default: 7810 _, _ = key, value 7811 7812 } 7813 } 7814 *v = sv 7815 return nil 7816} 7817 7818func awsRestjson1_deserializeDocumentSearchForPositionResult(v **types.SearchForPositionResult, value interface{}) error { 7819 if v == nil { 7820 return fmt.Errorf("unexpected nil of type %T", v) 7821 } 7822 if value == nil { 7823 return nil 7824 } 7825 7826 shape, ok := value.(map[string]interface{}) 7827 if !ok { 7828 return fmt.Errorf("unexpected JSON type %v", value) 7829 } 7830 7831 var sv *types.SearchForPositionResult 7832 if *v == nil { 7833 sv = &types.SearchForPositionResult{} 7834 } else { 7835 sv = *v 7836 } 7837 7838 for key, value := range shape { 7839 switch key { 7840 case "Place": 7841 if err := awsRestjson1_deserializeDocumentPlace(&sv.Place, value); err != nil { 7842 return err 7843 } 7844 7845 default: 7846 _, _ = key, value 7847 7848 } 7849 } 7850 *v = sv 7851 return nil 7852} 7853 7854func awsRestjson1_deserializeDocumentSearchForPositionResultList(v *[]types.SearchForPositionResult, value interface{}) error { 7855 if v == nil { 7856 return fmt.Errorf("unexpected nil of type %T", v) 7857 } 7858 if value == nil { 7859 return nil 7860 } 7861 7862 shape, ok := value.([]interface{}) 7863 if !ok { 7864 return fmt.Errorf("unexpected JSON type %v", value) 7865 } 7866 7867 var cv []types.SearchForPositionResult 7868 if *v == nil { 7869 cv = []types.SearchForPositionResult{} 7870 } else { 7871 cv = *v 7872 } 7873 7874 for _, value := range shape { 7875 var col types.SearchForPositionResult 7876 destAddr := &col 7877 if err := awsRestjson1_deserializeDocumentSearchForPositionResult(&destAddr, value); err != nil { 7878 return err 7879 } 7880 col = *destAddr 7881 cv = append(cv, col) 7882 7883 } 7884 *v = cv 7885 return nil 7886} 7887 7888func awsRestjson1_deserializeDocumentSearchForTextResult(v **types.SearchForTextResult, value interface{}) error { 7889 if v == nil { 7890 return fmt.Errorf("unexpected nil of type %T", v) 7891 } 7892 if value == nil { 7893 return nil 7894 } 7895 7896 shape, ok := value.(map[string]interface{}) 7897 if !ok { 7898 return fmt.Errorf("unexpected JSON type %v", value) 7899 } 7900 7901 var sv *types.SearchForTextResult 7902 if *v == nil { 7903 sv = &types.SearchForTextResult{} 7904 } else { 7905 sv = *v 7906 } 7907 7908 for key, value := range shape { 7909 switch key { 7910 case "Place": 7911 if err := awsRestjson1_deserializeDocumentPlace(&sv.Place, value); err != nil { 7912 return err 7913 } 7914 7915 default: 7916 _, _ = key, value 7917 7918 } 7919 } 7920 *v = sv 7921 return nil 7922} 7923 7924func awsRestjson1_deserializeDocumentSearchForTextResultList(v *[]types.SearchForTextResult, value interface{}) error { 7925 if v == nil { 7926 return fmt.Errorf("unexpected nil of type %T", v) 7927 } 7928 if value == nil { 7929 return nil 7930 } 7931 7932 shape, ok := value.([]interface{}) 7933 if !ok { 7934 return fmt.Errorf("unexpected JSON type %v", value) 7935 } 7936 7937 var cv []types.SearchForTextResult 7938 if *v == nil { 7939 cv = []types.SearchForTextResult{} 7940 } else { 7941 cv = *v 7942 } 7943 7944 for _, value := range shape { 7945 var col types.SearchForTextResult 7946 destAddr := &col 7947 if err := awsRestjson1_deserializeDocumentSearchForTextResult(&destAddr, value); err != nil { 7948 return err 7949 } 7950 col = *destAddr 7951 cv = append(cv, col) 7952 7953 } 7954 *v = cv 7955 return nil 7956} 7957 7958func awsRestjson1_deserializeDocumentSearchPlaceIndexForPositionSummary(v **types.SearchPlaceIndexForPositionSummary, value interface{}) error { 7959 if v == nil { 7960 return fmt.Errorf("unexpected nil of type %T", v) 7961 } 7962 if value == nil { 7963 return nil 7964 } 7965 7966 shape, ok := value.(map[string]interface{}) 7967 if !ok { 7968 return fmt.Errorf("unexpected JSON type %v", value) 7969 } 7970 7971 var sv *types.SearchPlaceIndexForPositionSummary 7972 if *v == nil { 7973 sv = &types.SearchPlaceIndexForPositionSummary{} 7974 } else { 7975 sv = *v 7976 } 7977 7978 for key, value := range shape { 7979 switch key { 7980 case "DataSource": 7981 if value != nil { 7982 jtv, ok := value.(string) 7983 if !ok { 7984 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7985 } 7986 sv.DataSource = ptr.String(jtv) 7987 } 7988 7989 case "MaxResults": 7990 if value != nil { 7991 jtv, ok := value.(json.Number) 7992 if !ok { 7993 return fmt.Errorf("expected PlaceIndexSearchResultLimit to be json.Number, got %T instead", value) 7994 } 7995 i64, err := jtv.Int64() 7996 if err != nil { 7997 return err 7998 } 7999 sv.MaxResults = int32(i64) 8000 } 8001 8002 case "Position": 8003 if err := awsRestjson1_deserializeDocumentPosition(&sv.Position, value); err != nil { 8004 return err 8005 } 8006 8007 default: 8008 _, _ = key, value 8009 8010 } 8011 } 8012 *v = sv 8013 return nil 8014} 8015 8016func awsRestjson1_deserializeDocumentSearchPlaceIndexForTextSummary(v **types.SearchPlaceIndexForTextSummary, value interface{}) error { 8017 if v == nil { 8018 return fmt.Errorf("unexpected nil of type %T", v) 8019 } 8020 if value == nil { 8021 return nil 8022 } 8023 8024 shape, ok := value.(map[string]interface{}) 8025 if !ok { 8026 return fmt.Errorf("unexpected JSON type %v", value) 8027 } 8028 8029 var sv *types.SearchPlaceIndexForTextSummary 8030 if *v == nil { 8031 sv = &types.SearchPlaceIndexForTextSummary{} 8032 } else { 8033 sv = *v 8034 } 8035 8036 for key, value := range shape { 8037 switch key { 8038 case "BiasPosition": 8039 if err := awsRestjson1_deserializeDocumentPosition(&sv.BiasPosition, value); err != nil { 8040 return err 8041 } 8042 8043 case "DataSource": 8044 if value != nil { 8045 jtv, ok := value.(string) 8046 if !ok { 8047 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8048 } 8049 sv.DataSource = ptr.String(jtv) 8050 } 8051 8052 case "FilterBBox": 8053 if err := awsRestjson1_deserializeDocumentBoundingBox(&sv.FilterBBox, value); err != nil { 8054 return err 8055 } 8056 8057 case "FilterCountries": 8058 if err := awsRestjson1_deserializeDocumentCountryCodeList(&sv.FilterCountries, value); err != nil { 8059 return err 8060 } 8061 8062 case "MaxResults": 8063 if value != nil { 8064 jtv, ok := value.(json.Number) 8065 if !ok { 8066 return fmt.Errorf("expected PlaceIndexSearchResultLimit to be json.Number, got %T instead", value) 8067 } 8068 i64, err := jtv.Int64() 8069 if err != nil { 8070 return err 8071 } 8072 sv.MaxResults = int32(i64) 8073 } 8074 8075 case "ResultBBox": 8076 if err := awsRestjson1_deserializeDocumentBoundingBox(&sv.ResultBBox, value); err != nil { 8077 return err 8078 } 8079 8080 case "Text": 8081 if value != nil { 8082 jtv, ok := value.(string) 8083 if !ok { 8084 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8085 } 8086 sv.Text = ptr.String(jtv) 8087 } 8088 8089 default: 8090 _, _ = key, value 8091 8092 } 8093 } 8094 *v = sv 8095 return nil 8096} 8097 8098func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 8099 if v == nil { 8100 return fmt.Errorf("unexpected nil of type %T", v) 8101 } 8102 if value == nil { 8103 return nil 8104 } 8105 8106 shape, ok := value.(map[string]interface{}) 8107 if !ok { 8108 return fmt.Errorf("unexpected JSON type %v", value) 8109 } 8110 8111 var sv *types.ThrottlingException 8112 if *v == nil { 8113 sv = &types.ThrottlingException{} 8114 } else { 8115 sv = *v 8116 } 8117 8118 for key, value := range shape { 8119 switch key { 8120 case "message": 8121 if value != nil { 8122 jtv, ok := value.(string) 8123 if !ok { 8124 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8125 } 8126 sv.Message = ptr.String(jtv) 8127 } 8128 8129 default: 8130 _, _ = key, value 8131 8132 } 8133 } 8134 *v = sv 8135 return nil 8136} 8137 8138func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { 8139 if v == nil { 8140 return fmt.Errorf("unexpected nil of type %T", v) 8141 } 8142 if value == nil { 8143 return nil 8144 } 8145 8146 shape, ok := value.(map[string]interface{}) 8147 if !ok { 8148 return fmt.Errorf("unexpected JSON type %v", value) 8149 } 8150 8151 var sv *types.ValidationException 8152 if *v == nil { 8153 sv = &types.ValidationException{} 8154 } else { 8155 sv = *v 8156 } 8157 8158 for key, value := range shape { 8159 switch key { 8160 case "fieldList": 8161 if err := awsRestjson1_deserializeDocumentValidationExceptionFieldList(&sv.FieldList, value); err != nil { 8162 return err 8163 } 8164 8165 case "message": 8166 if value != nil { 8167 jtv, ok := value.(string) 8168 if !ok { 8169 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8170 } 8171 sv.Message = ptr.String(jtv) 8172 } 8173 8174 case "reason": 8175 if value != nil { 8176 jtv, ok := value.(string) 8177 if !ok { 8178 return fmt.Errorf("expected ValidationExceptionReason to be of type string, got %T instead", value) 8179 } 8180 sv.Reason = types.ValidationExceptionReason(jtv) 8181 } 8182 8183 default: 8184 _, _ = key, value 8185 8186 } 8187 } 8188 *v = sv 8189 return nil 8190} 8191 8192func awsRestjson1_deserializeDocumentValidationExceptionField(v **types.ValidationExceptionField, value interface{}) error { 8193 if v == nil { 8194 return fmt.Errorf("unexpected nil of type %T", v) 8195 } 8196 if value == nil { 8197 return nil 8198 } 8199 8200 shape, ok := value.(map[string]interface{}) 8201 if !ok { 8202 return fmt.Errorf("unexpected JSON type %v", value) 8203 } 8204 8205 var sv *types.ValidationExceptionField 8206 if *v == nil { 8207 sv = &types.ValidationExceptionField{} 8208 } else { 8209 sv = *v 8210 } 8211 8212 for key, value := range shape { 8213 switch key { 8214 case "message": 8215 if value != nil { 8216 jtv, ok := value.(string) 8217 if !ok { 8218 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8219 } 8220 sv.Message = ptr.String(jtv) 8221 } 8222 8223 case "name": 8224 if value != nil { 8225 jtv, ok := value.(string) 8226 if !ok { 8227 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8228 } 8229 sv.Name = ptr.String(jtv) 8230 } 8231 8232 default: 8233 _, _ = key, value 8234 8235 } 8236 } 8237 *v = sv 8238 return nil 8239} 8240 8241func awsRestjson1_deserializeDocumentValidationExceptionFieldList(v *[]types.ValidationExceptionField, value interface{}) error { 8242 if v == nil { 8243 return fmt.Errorf("unexpected nil of type %T", v) 8244 } 8245 if value == nil { 8246 return nil 8247 } 8248 8249 shape, ok := value.([]interface{}) 8250 if !ok { 8251 return fmt.Errorf("unexpected JSON type %v", value) 8252 } 8253 8254 var cv []types.ValidationExceptionField 8255 if *v == nil { 8256 cv = []types.ValidationExceptionField{} 8257 } else { 8258 cv = *v 8259 } 8260 8261 for _, value := range shape { 8262 var col types.ValidationExceptionField 8263 destAddr := &col 8264 if err := awsRestjson1_deserializeDocumentValidationExceptionField(&destAddr, value); err != nil { 8265 return err 8266 } 8267 col = *destAddr 8268 cv = append(cv, col) 8269 8270 } 8271 *v = cv 8272 return nil 8273} 8274