1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package resourcegroups 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/resourcegroups/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithyhttp "github.com/aws/smithy-go/transport/http" 17 "io" 18 "strings" 19) 20 21type awsRestjson1_deserializeOpCreateGroup struct { 22} 23 24func (*awsRestjson1_deserializeOpCreateGroup) ID() string { 25 return "OperationDeserializer" 26} 27 28func (m *awsRestjson1_deserializeOpCreateGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 29 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 30) { 31 out, metadata, err = next.HandleDeserialize(ctx, in) 32 if err != nil { 33 return out, metadata, err 34 } 35 36 response, ok := out.RawResponse.(*smithyhttp.Response) 37 if !ok { 38 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 39 } 40 41 if response.StatusCode < 200 || response.StatusCode >= 300 { 42 return out, metadata, awsRestjson1_deserializeOpErrorCreateGroup(response, &metadata) 43 } 44 output := &CreateGroupOutput{} 45 out.Result = output 46 47 var buff [1024]byte 48 ringBuffer := smithyio.NewRingBuffer(buff[:]) 49 50 body := io.TeeReader(response.Body, ringBuffer) 51 52 decoder := json.NewDecoder(body) 53 decoder.UseNumber() 54 var shape interface{} 55 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 56 var snapshot bytes.Buffer 57 io.Copy(&snapshot, ringBuffer) 58 err = &smithy.DeserializationError{ 59 Err: fmt.Errorf("failed to decode response body, %w", err), 60 Snapshot: snapshot.Bytes(), 61 } 62 return out, metadata, err 63 } 64 65 err = awsRestjson1_deserializeOpDocumentCreateGroupOutput(&output, shape) 66 if err != nil { 67 var snapshot bytes.Buffer 68 io.Copy(&snapshot, ringBuffer) 69 return out, metadata, &smithy.DeserializationError{ 70 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 71 Snapshot: snapshot.Bytes(), 72 } 73 } 74 75 return out, metadata, err 76} 77 78func awsRestjson1_deserializeOpErrorCreateGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 79 var errorBuffer bytes.Buffer 80 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 81 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 82 } 83 errorBody := bytes.NewReader(errorBuffer.Bytes()) 84 85 errorCode := "UnknownError" 86 errorMessage := errorCode 87 88 code := response.Header.Get("X-Amzn-ErrorType") 89 if len(code) != 0 { 90 errorCode = restjson.SanitizeErrorCode(code) 91 } 92 93 var buff [1024]byte 94 ringBuffer := smithyio.NewRingBuffer(buff[:]) 95 96 body := io.TeeReader(errorBody, ringBuffer) 97 decoder := json.NewDecoder(body) 98 decoder.UseNumber() 99 code, message, err := restjson.GetErrorInfo(decoder) 100 if err != nil { 101 var snapshot bytes.Buffer 102 io.Copy(&snapshot, ringBuffer) 103 err = &smithy.DeserializationError{ 104 Err: fmt.Errorf("failed to decode response body, %w", err), 105 Snapshot: snapshot.Bytes(), 106 } 107 return err 108 } 109 110 errorBody.Seek(0, io.SeekStart) 111 if len(code) != 0 { 112 errorCode = restjson.SanitizeErrorCode(code) 113 } 114 if len(message) != 0 { 115 errorMessage = message 116 } 117 118 switch { 119 case strings.EqualFold("BadRequestException", errorCode): 120 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 121 122 case strings.EqualFold("ForbiddenException", errorCode): 123 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 124 125 case strings.EqualFold("InternalServerErrorException", errorCode): 126 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 127 128 case strings.EqualFold("MethodNotAllowedException", errorCode): 129 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 130 131 case strings.EqualFold("TooManyRequestsException", errorCode): 132 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 133 134 default: 135 genericError := &smithy.GenericAPIError{ 136 Code: errorCode, 137 Message: errorMessage, 138 } 139 return genericError 140 141 } 142} 143 144func awsRestjson1_deserializeOpDocumentCreateGroupOutput(v **CreateGroupOutput, value interface{}) error { 145 if v == nil { 146 return fmt.Errorf("unexpected nil of type %T", v) 147 } 148 if value == nil { 149 return nil 150 } 151 152 shape, ok := value.(map[string]interface{}) 153 if !ok { 154 return fmt.Errorf("unexpected JSON type %v", value) 155 } 156 157 var sv *CreateGroupOutput 158 if *v == nil { 159 sv = &CreateGroupOutput{} 160 } else { 161 sv = *v 162 } 163 164 for key, value := range shape { 165 switch key { 166 case "Group": 167 if err := awsRestjson1_deserializeDocumentGroup(&sv.Group, value); err != nil { 168 return err 169 } 170 171 case "GroupConfiguration": 172 if err := awsRestjson1_deserializeDocumentGroupConfiguration(&sv.GroupConfiguration, value); err != nil { 173 return err 174 } 175 176 case "ResourceQuery": 177 if err := awsRestjson1_deserializeDocumentResourceQuery(&sv.ResourceQuery, value); err != nil { 178 return err 179 } 180 181 case "Tags": 182 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 183 return err 184 } 185 186 default: 187 _, _ = key, value 188 189 } 190 } 191 *v = sv 192 return nil 193} 194 195type awsRestjson1_deserializeOpDeleteGroup struct { 196} 197 198func (*awsRestjson1_deserializeOpDeleteGroup) ID() string { 199 return "OperationDeserializer" 200} 201 202func (m *awsRestjson1_deserializeOpDeleteGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 203 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 204) { 205 out, metadata, err = next.HandleDeserialize(ctx, in) 206 if err != nil { 207 return out, metadata, err 208 } 209 210 response, ok := out.RawResponse.(*smithyhttp.Response) 211 if !ok { 212 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 213 } 214 215 if response.StatusCode < 200 || response.StatusCode >= 300 { 216 return out, metadata, awsRestjson1_deserializeOpErrorDeleteGroup(response, &metadata) 217 } 218 output := &DeleteGroupOutput{} 219 out.Result = output 220 221 var buff [1024]byte 222 ringBuffer := smithyio.NewRingBuffer(buff[:]) 223 224 body := io.TeeReader(response.Body, ringBuffer) 225 226 decoder := json.NewDecoder(body) 227 decoder.UseNumber() 228 var shape interface{} 229 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 230 var snapshot bytes.Buffer 231 io.Copy(&snapshot, ringBuffer) 232 err = &smithy.DeserializationError{ 233 Err: fmt.Errorf("failed to decode response body, %w", err), 234 Snapshot: snapshot.Bytes(), 235 } 236 return out, metadata, err 237 } 238 239 err = awsRestjson1_deserializeOpDocumentDeleteGroupOutput(&output, shape) 240 if err != nil { 241 var snapshot bytes.Buffer 242 io.Copy(&snapshot, ringBuffer) 243 return out, metadata, &smithy.DeserializationError{ 244 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 245 Snapshot: snapshot.Bytes(), 246 } 247 } 248 249 return out, metadata, err 250} 251 252func awsRestjson1_deserializeOpErrorDeleteGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 253 var errorBuffer bytes.Buffer 254 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 255 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 256 } 257 errorBody := bytes.NewReader(errorBuffer.Bytes()) 258 259 errorCode := "UnknownError" 260 errorMessage := errorCode 261 262 code := response.Header.Get("X-Amzn-ErrorType") 263 if len(code) != 0 { 264 errorCode = restjson.SanitizeErrorCode(code) 265 } 266 267 var buff [1024]byte 268 ringBuffer := smithyio.NewRingBuffer(buff[:]) 269 270 body := io.TeeReader(errorBody, ringBuffer) 271 decoder := json.NewDecoder(body) 272 decoder.UseNumber() 273 code, message, err := restjson.GetErrorInfo(decoder) 274 if err != nil { 275 var snapshot bytes.Buffer 276 io.Copy(&snapshot, ringBuffer) 277 err = &smithy.DeserializationError{ 278 Err: fmt.Errorf("failed to decode response body, %w", err), 279 Snapshot: snapshot.Bytes(), 280 } 281 return err 282 } 283 284 errorBody.Seek(0, io.SeekStart) 285 if len(code) != 0 { 286 errorCode = restjson.SanitizeErrorCode(code) 287 } 288 if len(message) != 0 { 289 errorMessage = message 290 } 291 292 switch { 293 case strings.EqualFold("BadRequestException", errorCode): 294 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 295 296 case strings.EqualFold("ForbiddenException", errorCode): 297 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 298 299 case strings.EqualFold("InternalServerErrorException", errorCode): 300 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 301 302 case strings.EqualFold("MethodNotAllowedException", errorCode): 303 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 304 305 case strings.EqualFold("NotFoundException", errorCode): 306 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 307 308 case strings.EqualFold("TooManyRequestsException", errorCode): 309 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 310 311 default: 312 genericError := &smithy.GenericAPIError{ 313 Code: errorCode, 314 Message: errorMessage, 315 } 316 return genericError 317 318 } 319} 320 321func awsRestjson1_deserializeOpDocumentDeleteGroupOutput(v **DeleteGroupOutput, value interface{}) error { 322 if v == nil { 323 return fmt.Errorf("unexpected nil of type %T", v) 324 } 325 if value == nil { 326 return nil 327 } 328 329 shape, ok := value.(map[string]interface{}) 330 if !ok { 331 return fmt.Errorf("unexpected JSON type %v", value) 332 } 333 334 var sv *DeleteGroupOutput 335 if *v == nil { 336 sv = &DeleteGroupOutput{} 337 } else { 338 sv = *v 339 } 340 341 for key, value := range shape { 342 switch key { 343 case "Group": 344 if err := awsRestjson1_deserializeDocumentGroup(&sv.Group, value); err != nil { 345 return err 346 } 347 348 default: 349 _, _ = key, value 350 351 } 352 } 353 *v = sv 354 return nil 355} 356 357type awsRestjson1_deserializeOpGetGroup struct { 358} 359 360func (*awsRestjson1_deserializeOpGetGroup) ID() string { 361 return "OperationDeserializer" 362} 363 364func (m *awsRestjson1_deserializeOpGetGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 365 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 366) { 367 out, metadata, err = next.HandleDeserialize(ctx, in) 368 if err != nil { 369 return out, metadata, err 370 } 371 372 response, ok := out.RawResponse.(*smithyhttp.Response) 373 if !ok { 374 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 375 } 376 377 if response.StatusCode < 200 || response.StatusCode >= 300 { 378 return out, metadata, awsRestjson1_deserializeOpErrorGetGroup(response, &metadata) 379 } 380 output := &GetGroupOutput{} 381 out.Result = output 382 383 var buff [1024]byte 384 ringBuffer := smithyio.NewRingBuffer(buff[:]) 385 386 body := io.TeeReader(response.Body, ringBuffer) 387 388 decoder := json.NewDecoder(body) 389 decoder.UseNumber() 390 var shape interface{} 391 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 392 var snapshot bytes.Buffer 393 io.Copy(&snapshot, ringBuffer) 394 err = &smithy.DeserializationError{ 395 Err: fmt.Errorf("failed to decode response body, %w", err), 396 Snapshot: snapshot.Bytes(), 397 } 398 return out, metadata, err 399 } 400 401 err = awsRestjson1_deserializeOpDocumentGetGroupOutput(&output, shape) 402 if err != nil { 403 var snapshot bytes.Buffer 404 io.Copy(&snapshot, ringBuffer) 405 return out, metadata, &smithy.DeserializationError{ 406 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 407 Snapshot: snapshot.Bytes(), 408 } 409 } 410 411 return out, metadata, err 412} 413 414func awsRestjson1_deserializeOpErrorGetGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 415 var errorBuffer bytes.Buffer 416 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 417 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 418 } 419 errorBody := bytes.NewReader(errorBuffer.Bytes()) 420 421 errorCode := "UnknownError" 422 errorMessage := errorCode 423 424 code := response.Header.Get("X-Amzn-ErrorType") 425 if len(code) != 0 { 426 errorCode = restjson.SanitizeErrorCode(code) 427 } 428 429 var buff [1024]byte 430 ringBuffer := smithyio.NewRingBuffer(buff[:]) 431 432 body := io.TeeReader(errorBody, ringBuffer) 433 decoder := json.NewDecoder(body) 434 decoder.UseNumber() 435 code, message, err := restjson.GetErrorInfo(decoder) 436 if err != nil { 437 var snapshot bytes.Buffer 438 io.Copy(&snapshot, ringBuffer) 439 err = &smithy.DeserializationError{ 440 Err: fmt.Errorf("failed to decode response body, %w", err), 441 Snapshot: snapshot.Bytes(), 442 } 443 return err 444 } 445 446 errorBody.Seek(0, io.SeekStart) 447 if len(code) != 0 { 448 errorCode = restjson.SanitizeErrorCode(code) 449 } 450 if len(message) != 0 { 451 errorMessage = message 452 } 453 454 switch { 455 case strings.EqualFold("BadRequestException", errorCode): 456 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 457 458 case strings.EqualFold("ForbiddenException", errorCode): 459 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 460 461 case strings.EqualFold("InternalServerErrorException", errorCode): 462 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 463 464 case strings.EqualFold("MethodNotAllowedException", errorCode): 465 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 466 467 case strings.EqualFold("NotFoundException", errorCode): 468 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 469 470 case strings.EqualFold("TooManyRequestsException", errorCode): 471 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 472 473 default: 474 genericError := &smithy.GenericAPIError{ 475 Code: errorCode, 476 Message: errorMessage, 477 } 478 return genericError 479 480 } 481} 482 483func awsRestjson1_deserializeOpDocumentGetGroupOutput(v **GetGroupOutput, value interface{}) error { 484 if v == nil { 485 return fmt.Errorf("unexpected nil of type %T", v) 486 } 487 if value == nil { 488 return nil 489 } 490 491 shape, ok := value.(map[string]interface{}) 492 if !ok { 493 return fmt.Errorf("unexpected JSON type %v", value) 494 } 495 496 var sv *GetGroupOutput 497 if *v == nil { 498 sv = &GetGroupOutput{} 499 } else { 500 sv = *v 501 } 502 503 for key, value := range shape { 504 switch key { 505 case "Group": 506 if err := awsRestjson1_deserializeDocumentGroup(&sv.Group, value); err != nil { 507 return err 508 } 509 510 default: 511 _, _ = key, value 512 513 } 514 } 515 *v = sv 516 return nil 517} 518 519type awsRestjson1_deserializeOpGetGroupConfiguration struct { 520} 521 522func (*awsRestjson1_deserializeOpGetGroupConfiguration) ID() string { 523 return "OperationDeserializer" 524} 525 526func (m *awsRestjson1_deserializeOpGetGroupConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 527 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 528) { 529 out, metadata, err = next.HandleDeserialize(ctx, in) 530 if err != nil { 531 return out, metadata, err 532 } 533 534 response, ok := out.RawResponse.(*smithyhttp.Response) 535 if !ok { 536 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 537 } 538 539 if response.StatusCode < 200 || response.StatusCode >= 300 { 540 return out, metadata, awsRestjson1_deserializeOpErrorGetGroupConfiguration(response, &metadata) 541 } 542 output := &GetGroupConfigurationOutput{} 543 out.Result = output 544 545 var buff [1024]byte 546 ringBuffer := smithyio.NewRingBuffer(buff[:]) 547 548 body := io.TeeReader(response.Body, ringBuffer) 549 550 decoder := json.NewDecoder(body) 551 decoder.UseNumber() 552 var shape interface{} 553 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 554 var snapshot bytes.Buffer 555 io.Copy(&snapshot, ringBuffer) 556 err = &smithy.DeserializationError{ 557 Err: fmt.Errorf("failed to decode response body, %w", err), 558 Snapshot: snapshot.Bytes(), 559 } 560 return out, metadata, err 561 } 562 563 err = awsRestjson1_deserializeOpDocumentGetGroupConfigurationOutput(&output, shape) 564 if err != nil { 565 var snapshot bytes.Buffer 566 io.Copy(&snapshot, ringBuffer) 567 return out, metadata, &smithy.DeserializationError{ 568 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 569 Snapshot: snapshot.Bytes(), 570 } 571 } 572 573 return out, metadata, err 574} 575 576func awsRestjson1_deserializeOpErrorGetGroupConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 577 var errorBuffer bytes.Buffer 578 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 579 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 580 } 581 errorBody := bytes.NewReader(errorBuffer.Bytes()) 582 583 errorCode := "UnknownError" 584 errorMessage := errorCode 585 586 code := response.Header.Get("X-Amzn-ErrorType") 587 if len(code) != 0 { 588 errorCode = restjson.SanitizeErrorCode(code) 589 } 590 591 var buff [1024]byte 592 ringBuffer := smithyio.NewRingBuffer(buff[:]) 593 594 body := io.TeeReader(errorBody, ringBuffer) 595 decoder := json.NewDecoder(body) 596 decoder.UseNumber() 597 code, message, err := restjson.GetErrorInfo(decoder) 598 if err != nil { 599 var snapshot bytes.Buffer 600 io.Copy(&snapshot, ringBuffer) 601 err = &smithy.DeserializationError{ 602 Err: fmt.Errorf("failed to decode response body, %w", err), 603 Snapshot: snapshot.Bytes(), 604 } 605 return err 606 } 607 608 errorBody.Seek(0, io.SeekStart) 609 if len(code) != 0 { 610 errorCode = restjson.SanitizeErrorCode(code) 611 } 612 if len(message) != 0 { 613 errorMessage = message 614 } 615 616 switch { 617 case strings.EqualFold("BadRequestException", errorCode): 618 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 619 620 case strings.EqualFold("ForbiddenException", errorCode): 621 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 622 623 case strings.EqualFold("InternalServerErrorException", errorCode): 624 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 625 626 case strings.EqualFold("MethodNotAllowedException", errorCode): 627 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 628 629 case strings.EqualFold("NotFoundException", errorCode): 630 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 631 632 case strings.EqualFold("TooManyRequestsException", errorCode): 633 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 634 635 default: 636 genericError := &smithy.GenericAPIError{ 637 Code: errorCode, 638 Message: errorMessage, 639 } 640 return genericError 641 642 } 643} 644 645func awsRestjson1_deserializeOpDocumentGetGroupConfigurationOutput(v **GetGroupConfigurationOutput, value interface{}) error { 646 if v == nil { 647 return fmt.Errorf("unexpected nil of type %T", v) 648 } 649 if value == nil { 650 return nil 651 } 652 653 shape, ok := value.(map[string]interface{}) 654 if !ok { 655 return fmt.Errorf("unexpected JSON type %v", value) 656 } 657 658 var sv *GetGroupConfigurationOutput 659 if *v == nil { 660 sv = &GetGroupConfigurationOutput{} 661 } else { 662 sv = *v 663 } 664 665 for key, value := range shape { 666 switch key { 667 case "GroupConfiguration": 668 if err := awsRestjson1_deserializeDocumentGroupConfiguration(&sv.GroupConfiguration, value); err != nil { 669 return err 670 } 671 672 default: 673 _, _ = key, value 674 675 } 676 } 677 *v = sv 678 return nil 679} 680 681type awsRestjson1_deserializeOpGetGroupQuery struct { 682} 683 684func (*awsRestjson1_deserializeOpGetGroupQuery) ID() string { 685 return "OperationDeserializer" 686} 687 688func (m *awsRestjson1_deserializeOpGetGroupQuery) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 689 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 690) { 691 out, metadata, err = next.HandleDeserialize(ctx, in) 692 if err != nil { 693 return out, metadata, err 694 } 695 696 response, ok := out.RawResponse.(*smithyhttp.Response) 697 if !ok { 698 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 699 } 700 701 if response.StatusCode < 200 || response.StatusCode >= 300 { 702 return out, metadata, awsRestjson1_deserializeOpErrorGetGroupQuery(response, &metadata) 703 } 704 output := &GetGroupQueryOutput{} 705 out.Result = output 706 707 var buff [1024]byte 708 ringBuffer := smithyio.NewRingBuffer(buff[:]) 709 710 body := io.TeeReader(response.Body, ringBuffer) 711 712 decoder := json.NewDecoder(body) 713 decoder.UseNumber() 714 var shape interface{} 715 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 716 var snapshot bytes.Buffer 717 io.Copy(&snapshot, ringBuffer) 718 err = &smithy.DeserializationError{ 719 Err: fmt.Errorf("failed to decode response body, %w", err), 720 Snapshot: snapshot.Bytes(), 721 } 722 return out, metadata, err 723 } 724 725 err = awsRestjson1_deserializeOpDocumentGetGroupQueryOutput(&output, shape) 726 if err != nil { 727 var snapshot bytes.Buffer 728 io.Copy(&snapshot, ringBuffer) 729 return out, metadata, &smithy.DeserializationError{ 730 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 731 Snapshot: snapshot.Bytes(), 732 } 733 } 734 735 return out, metadata, err 736} 737 738func awsRestjson1_deserializeOpErrorGetGroupQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { 739 var errorBuffer bytes.Buffer 740 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 741 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 742 } 743 errorBody := bytes.NewReader(errorBuffer.Bytes()) 744 745 errorCode := "UnknownError" 746 errorMessage := errorCode 747 748 code := response.Header.Get("X-Amzn-ErrorType") 749 if len(code) != 0 { 750 errorCode = restjson.SanitizeErrorCode(code) 751 } 752 753 var buff [1024]byte 754 ringBuffer := smithyio.NewRingBuffer(buff[:]) 755 756 body := io.TeeReader(errorBody, ringBuffer) 757 decoder := json.NewDecoder(body) 758 decoder.UseNumber() 759 code, message, err := restjson.GetErrorInfo(decoder) 760 if err != nil { 761 var snapshot bytes.Buffer 762 io.Copy(&snapshot, ringBuffer) 763 err = &smithy.DeserializationError{ 764 Err: fmt.Errorf("failed to decode response body, %w", err), 765 Snapshot: snapshot.Bytes(), 766 } 767 return err 768 } 769 770 errorBody.Seek(0, io.SeekStart) 771 if len(code) != 0 { 772 errorCode = restjson.SanitizeErrorCode(code) 773 } 774 if len(message) != 0 { 775 errorMessage = message 776 } 777 778 switch { 779 case strings.EqualFold("BadRequestException", errorCode): 780 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 781 782 case strings.EqualFold("ForbiddenException", errorCode): 783 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 784 785 case strings.EqualFold("InternalServerErrorException", errorCode): 786 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 787 788 case strings.EqualFold("MethodNotAllowedException", errorCode): 789 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 790 791 case strings.EqualFold("NotFoundException", errorCode): 792 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 793 794 case strings.EqualFold("TooManyRequestsException", errorCode): 795 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 796 797 default: 798 genericError := &smithy.GenericAPIError{ 799 Code: errorCode, 800 Message: errorMessage, 801 } 802 return genericError 803 804 } 805} 806 807func awsRestjson1_deserializeOpDocumentGetGroupQueryOutput(v **GetGroupQueryOutput, value interface{}) error { 808 if v == nil { 809 return fmt.Errorf("unexpected nil of type %T", v) 810 } 811 if value == nil { 812 return nil 813 } 814 815 shape, ok := value.(map[string]interface{}) 816 if !ok { 817 return fmt.Errorf("unexpected JSON type %v", value) 818 } 819 820 var sv *GetGroupQueryOutput 821 if *v == nil { 822 sv = &GetGroupQueryOutput{} 823 } else { 824 sv = *v 825 } 826 827 for key, value := range shape { 828 switch key { 829 case "GroupQuery": 830 if err := awsRestjson1_deserializeDocumentGroupQuery(&sv.GroupQuery, value); err != nil { 831 return err 832 } 833 834 default: 835 _, _ = key, value 836 837 } 838 } 839 *v = sv 840 return nil 841} 842 843type awsRestjson1_deserializeOpGetTags struct { 844} 845 846func (*awsRestjson1_deserializeOpGetTags) ID() string { 847 return "OperationDeserializer" 848} 849 850func (m *awsRestjson1_deserializeOpGetTags) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 851 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 852) { 853 out, metadata, err = next.HandleDeserialize(ctx, in) 854 if err != nil { 855 return out, metadata, err 856 } 857 858 response, ok := out.RawResponse.(*smithyhttp.Response) 859 if !ok { 860 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 861 } 862 863 if response.StatusCode < 200 || response.StatusCode >= 300 { 864 return out, metadata, awsRestjson1_deserializeOpErrorGetTags(response, &metadata) 865 } 866 output := &GetTagsOutput{} 867 out.Result = output 868 869 var buff [1024]byte 870 ringBuffer := smithyio.NewRingBuffer(buff[:]) 871 872 body := io.TeeReader(response.Body, ringBuffer) 873 874 decoder := json.NewDecoder(body) 875 decoder.UseNumber() 876 var shape interface{} 877 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 878 var snapshot bytes.Buffer 879 io.Copy(&snapshot, ringBuffer) 880 err = &smithy.DeserializationError{ 881 Err: fmt.Errorf("failed to decode response body, %w", err), 882 Snapshot: snapshot.Bytes(), 883 } 884 return out, metadata, err 885 } 886 887 err = awsRestjson1_deserializeOpDocumentGetTagsOutput(&output, shape) 888 if err != nil { 889 var snapshot bytes.Buffer 890 io.Copy(&snapshot, ringBuffer) 891 return out, metadata, &smithy.DeserializationError{ 892 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 893 Snapshot: snapshot.Bytes(), 894 } 895 } 896 897 return out, metadata, err 898} 899 900func awsRestjson1_deserializeOpErrorGetTags(response *smithyhttp.Response, metadata *middleware.Metadata) error { 901 var errorBuffer bytes.Buffer 902 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 903 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 904 } 905 errorBody := bytes.NewReader(errorBuffer.Bytes()) 906 907 errorCode := "UnknownError" 908 errorMessage := errorCode 909 910 code := response.Header.Get("X-Amzn-ErrorType") 911 if len(code) != 0 { 912 errorCode = restjson.SanitizeErrorCode(code) 913 } 914 915 var buff [1024]byte 916 ringBuffer := smithyio.NewRingBuffer(buff[:]) 917 918 body := io.TeeReader(errorBody, ringBuffer) 919 decoder := json.NewDecoder(body) 920 decoder.UseNumber() 921 code, message, err := restjson.GetErrorInfo(decoder) 922 if err != nil { 923 var snapshot bytes.Buffer 924 io.Copy(&snapshot, ringBuffer) 925 err = &smithy.DeserializationError{ 926 Err: fmt.Errorf("failed to decode response body, %w", err), 927 Snapshot: snapshot.Bytes(), 928 } 929 return err 930 } 931 932 errorBody.Seek(0, io.SeekStart) 933 if len(code) != 0 { 934 errorCode = restjson.SanitizeErrorCode(code) 935 } 936 if len(message) != 0 { 937 errorMessage = message 938 } 939 940 switch { 941 case strings.EqualFold("BadRequestException", errorCode): 942 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 943 944 case strings.EqualFold("ForbiddenException", errorCode): 945 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 946 947 case strings.EqualFold("InternalServerErrorException", errorCode): 948 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 949 950 case strings.EqualFold("MethodNotAllowedException", errorCode): 951 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 952 953 case strings.EqualFold("NotFoundException", errorCode): 954 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 955 956 case strings.EqualFold("TooManyRequestsException", errorCode): 957 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 958 959 default: 960 genericError := &smithy.GenericAPIError{ 961 Code: errorCode, 962 Message: errorMessage, 963 } 964 return genericError 965 966 } 967} 968 969func awsRestjson1_deserializeOpDocumentGetTagsOutput(v **GetTagsOutput, value interface{}) error { 970 if v == nil { 971 return fmt.Errorf("unexpected nil of type %T", v) 972 } 973 if value == nil { 974 return nil 975 } 976 977 shape, ok := value.(map[string]interface{}) 978 if !ok { 979 return fmt.Errorf("unexpected JSON type %v", value) 980 } 981 982 var sv *GetTagsOutput 983 if *v == nil { 984 sv = &GetTagsOutput{} 985 } else { 986 sv = *v 987 } 988 989 for key, value := range shape { 990 switch key { 991 case "Arn": 992 if value != nil { 993 jtv, ok := value.(string) 994 if !ok { 995 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 996 } 997 sv.Arn = ptr.String(jtv) 998 } 999 1000 case "Tags": 1001 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 1002 return err 1003 } 1004 1005 default: 1006 _, _ = key, value 1007 1008 } 1009 } 1010 *v = sv 1011 return nil 1012} 1013 1014type awsRestjson1_deserializeOpGroupResources struct { 1015} 1016 1017func (*awsRestjson1_deserializeOpGroupResources) ID() string { 1018 return "OperationDeserializer" 1019} 1020 1021func (m *awsRestjson1_deserializeOpGroupResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1022 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1023) { 1024 out, metadata, err = next.HandleDeserialize(ctx, in) 1025 if err != nil { 1026 return out, metadata, err 1027 } 1028 1029 response, ok := out.RawResponse.(*smithyhttp.Response) 1030 if !ok { 1031 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1032 } 1033 1034 if response.StatusCode < 200 || response.StatusCode >= 300 { 1035 return out, metadata, awsRestjson1_deserializeOpErrorGroupResources(response, &metadata) 1036 } 1037 output := &GroupResourcesOutput{} 1038 out.Result = output 1039 1040 var buff [1024]byte 1041 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1042 1043 body := io.TeeReader(response.Body, ringBuffer) 1044 1045 decoder := json.NewDecoder(body) 1046 decoder.UseNumber() 1047 var shape interface{} 1048 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1049 var snapshot bytes.Buffer 1050 io.Copy(&snapshot, ringBuffer) 1051 err = &smithy.DeserializationError{ 1052 Err: fmt.Errorf("failed to decode response body, %w", err), 1053 Snapshot: snapshot.Bytes(), 1054 } 1055 return out, metadata, err 1056 } 1057 1058 err = awsRestjson1_deserializeOpDocumentGroupResourcesOutput(&output, shape) 1059 if err != nil { 1060 var snapshot bytes.Buffer 1061 io.Copy(&snapshot, ringBuffer) 1062 return out, metadata, &smithy.DeserializationError{ 1063 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1064 Snapshot: snapshot.Bytes(), 1065 } 1066 } 1067 1068 return out, metadata, err 1069} 1070 1071func awsRestjson1_deserializeOpErrorGroupResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1072 var errorBuffer bytes.Buffer 1073 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1074 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1075 } 1076 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1077 1078 errorCode := "UnknownError" 1079 errorMessage := errorCode 1080 1081 code := response.Header.Get("X-Amzn-ErrorType") 1082 if len(code) != 0 { 1083 errorCode = restjson.SanitizeErrorCode(code) 1084 } 1085 1086 var buff [1024]byte 1087 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1088 1089 body := io.TeeReader(errorBody, ringBuffer) 1090 decoder := json.NewDecoder(body) 1091 decoder.UseNumber() 1092 code, message, err := restjson.GetErrorInfo(decoder) 1093 if err != nil { 1094 var snapshot bytes.Buffer 1095 io.Copy(&snapshot, ringBuffer) 1096 err = &smithy.DeserializationError{ 1097 Err: fmt.Errorf("failed to decode response body, %w", err), 1098 Snapshot: snapshot.Bytes(), 1099 } 1100 return err 1101 } 1102 1103 errorBody.Seek(0, io.SeekStart) 1104 if len(code) != 0 { 1105 errorCode = restjson.SanitizeErrorCode(code) 1106 } 1107 if len(message) != 0 { 1108 errorMessage = message 1109 } 1110 1111 switch { 1112 case strings.EqualFold("BadRequestException", errorCode): 1113 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1114 1115 case strings.EqualFold("ForbiddenException", errorCode): 1116 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1117 1118 case strings.EqualFold("InternalServerErrorException", errorCode): 1119 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1120 1121 case strings.EqualFold("MethodNotAllowedException", errorCode): 1122 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1123 1124 case strings.EqualFold("NotFoundException", errorCode): 1125 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1126 1127 case strings.EqualFold("TooManyRequestsException", errorCode): 1128 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1129 1130 default: 1131 genericError := &smithy.GenericAPIError{ 1132 Code: errorCode, 1133 Message: errorMessage, 1134 } 1135 return genericError 1136 1137 } 1138} 1139 1140func awsRestjson1_deserializeOpDocumentGroupResourcesOutput(v **GroupResourcesOutput, value interface{}) error { 1141 if v == nil { 1142 return fmt.Errorf("unexpected nil of type %T", v) 1143 } 1144 if value == nil { 1145 return nil 1146 } 1147 1148 shape, ok := value.(map[string]interface{}) 1149 if !ok { 1150 return fmt.Errorf("unexpected JSON type %v", value) 1151 } 1152 1153 var sv *GroupResourcesOutput 1154 if *v == nil { 1155 sv = &GroupResourcesOutput{} 1156 } else { 1157 sv = *v 1158 } 1159 1160 for key, value := range shape { 1161 switch key { 1162 case "Failed": 1163 if err := awsRestjson1_deserializeDocumentFailedResourceList(&sv.Failed, value); err != nil { 1164 return err 1165 } 1166 1167 case "Succeeded": 1168 if err := awsRestjson1_deserializeDocumentResourceArnList(&sv.Succeeded, value); err != nil { 1169 return err 1170 } 1171 1172 default: 1173 _, _ = key, value 1174 1175 } 1176 } 1177 *v = sv 1178 return nil 1179} 1180 1181type awsRestjson1_deserializeOpListGroupResources struct { 1182} 1183 1184func (*awsRestjson1_deserializeOpListGroupResources) ID() string { 1185 return "OperationDeserializer" 1186} 1187 1188func (m *awsRestjson1_deserializeOpListGroupResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1189 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1190) { 1191 out, metadata, err = next.HandleDeserialize(ctx, in) 1192 if err != nil { 1193 return out, metadata, err 1194 } 1195 1196 response, ok := out.RawResponse.(*smithyhttp.Response) 1197 if !ok { 1198 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1199 } 1200 1201 if response.StatusCode < 200 || response.StatusCode >= 300 { 1202 return out, metadata, awsRestjson1_deserializeOpErrorListGroupResources(response, &metadata) 1203 } 1204 output := &ListGroupResourcesOutput{} 1205 out.Result = output 1206 1207 var buff [1024]byte 1208 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1209 1210 body := io.TeeReader(response.Body, ringBuffer) 1211 1212 decoder := json.NewDecoder(body) 1213 decoder.UseNumber() 1214 var shape interface{} 1215 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1216 var snapshot bytes.Buffer 1217 io.Copy(&snapshot, ringBuffer) 1218 err = &smithy.DeserializationError{ 1219 Err: fmt.Errorf("failed to decode response body, %w", err), 1220 Snapshot: snapshot.Bytes(), 1221 } 1222 return out, metadata, err 1223 } 1224 1225 err = awsRestjson1_deserializeOpDocumentListGroupResourcesOutput(&output, shape) 1226 if err != nil { 1227 var snapshot bytes.Buffer 1228 io.Copy(&snapshot, ringBuffer) 1229 return out, metadata, &smithy.DeserializationError{ 1230 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1231 Snapshot: snapshot.Bytes(), 1232 } 1233 } 1234 1235 return out, metadata, err 1236} 1237 1238func awsRestjson1_deserializeOpErrorListGroupResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1239 var errorBuffer bytes.Buffer 1240 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1241 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1242 } 1243 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1244 1245 errorCode := "UnknownError" 1246 errorMessage := errorCode 1247 1248 code := response.Header.Get("X-Amzn-ErrorType") 1249 if len(code) != 0 { 1250 errorCode = restjson.SanitizeErrorCode(code) 1251 } 1252 1253 var buff [1024]byte 1254 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1255 1256 body := io.TeeReader(errorBody, ringBuffer) 1257 decoder := json.NewDecoder(body) 1258 decoder.UseNumber() 1259 code, message, err := restjson.GetErrorInfo(decoder) 1260 if err != nil { 1261 var snapshot bytes.Buffer 1262 io.Copy(&snapshot, ringBuffer) 1263 err = &smithy.DeserializationError{ 1264 Err: fmt.Errorf("failed to decode response body, %w", err), 1265 Snapshot: snapshot.Bytes(), 1266 } 1267 return err 1268 } 1269 1270 errorBody.Seek(0, io.SeekStart) 1271 if len(code) != 0 { 1272 errorCode = restjson.SanitizeErrorCode(code) 1273 } 1274 if len(message) != 0 { 1275 errorMessage = message 1276 } 1277 1278 switch { 1279 case strings.EqualFold("BadRequestException", errorCode): 1280 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1281 1282 case strings.EqualFold("ForbiddenException", errorCode): 1283 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1284 1285 case strings.EqualFold("InternalServerErrorException", errorCode): 1286 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1287 1288 case strings.EqualFold("MethodNotAllowedException", errorCode): 1289 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1290 1291 case strings.EqualFold("NotFoundException", errorCode): 1292 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1293 1294 case strings.EqualFold("TooManyRequestsException", errorCode): 1295 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1296 1297 case strings.EqualFold("UnauthorizedException", errorCode): 1298 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1299 1300 default: 1301 genericError := &smithy.GenericAPIError{ 1302 Code: errorCode, 1303 Message: errorMessage, 1304 } 1305 return genericError 1306 1307 } 1308} 1309 1310func awsRestjson1_deserializeOpDocumentListGroupResourcesOutput(v **ListGroupResourcesOutput, value interface{}) error { 1311 if v == nil { 1312 return fmt.Errorf("unexpected nil of type %T", v) 1313 } 1314 if value == nil { 1315 return nil 1316 } 1317 1318 shape, ok := value.(map[string]interface{}) 1319 if !ok { 1320 return fmt.Errorf("unexpected JSON type %v", value) 1321 } 1322 1323 var sv *ListGroupResourcesOutput 1324 if *v == nil { 1325 sv = &ListGroupResourcesOutput{} 1326 } else { 1327 sv = *v 1328 } 1329 1330 for key, value := range shape { 1331 switch key { 1332 case "NextToken": 1333 if value != nil { 1334 jtv, ok := value.(string) 1335 if !ok { 1336 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 1337 } 1338 sv.NextToken = ptr.String(jtv) 1339 } 1340 1341 case "QueryErrors": 1342 if err := awsRestjson1_deserializeDocumentQueryErrorList(&sv.QueryErrors, value); err != nil { 1343 return err 1344 } 1345 1346 case "ResourceIdentifiers": 1347 if err := awsRestjson1_deserializeDocumentResourceIdentifierList(&sv.ResourceIdentifiers, value); err != nil { 1348 return err 1349 } 1350 1351 default: 1352 _, _ = key, value 1353 1354 } 1355 } 1356 *v = sv 1357 return nil 1358} 1359 1360type awsRestjson1_deserializeOpListGroups struct { 1361} 1362 1363func (*awsRestjson1_deserializeOpListGroups) ID() string { 1364 return "OperationDeserializer" 1365} 1366 1367func (m *awsRestjson1_deserializeOpListGroups) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1368 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1369) { 1370 out, metadata, err = next.HandleDeserialize(ctx, in) 1371 if err != nil { 1372 return out, metadata, err 1373 } 1374 1375 response, ok := out.RawResponse.(*smithyhttp.Response) 1376 if !ok { 1377 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1378 } 1379 1380 if response.StatusCode < 200 || response.StatusCode >= 300 { 1381 return out, metadata, awsRestjson1_deserializeOpErrorListGroups(response, &metadata) 1382 } 1383 output := &ListGroupsOutput{} 1384 out.Result = output 1385 1386 var buff [1024]byte 1387 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1388 1389 body := io.TeeReader(response.Body, ringBuffer) 1390 1391 decoder := json.NewDecoder(body) 1392 decoder.UseNumber() 1393 var shape interface{} 1394 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1395 var snapshot bytes.Buffer 1396 io.Copy(&snapshot, ringBuffer) 1397 err = &smithy.DeserializationError{ 1398 Err: fmt.Errorf("failed to decode response body, %w", err), 1399 Snapshot: snapshot.Bytes(), 1400 } 1401 return out, metadata, err 1402 } 1403 1404 err = awsRestjson1_deserializeOpDocumentListGroupsOutput(&output, shape) 1405 if err != nil { 1406 var snapshot bytes.Buffer 1407 io.Copy(&snapshot, ringBuffer) 1408 return out, metadata, &smithy.DeserializationError{ 1409 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1410 Snapshot: snapshot.Bytes(), 1411 } 1412 } 1413 1414 return out, metadata, err 1415} 1416 1417func awsRestjson1_deserializeOpErrorListGroups(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1418 var errorBuffer bytes.Buffer 1419 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1420 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1421 } 1422 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1423 1424 errorCode := "UnknownError" 1425 errorMessage := errorCode 1426 1427 code := response.Header.Get("X-Amzn-ErrorType") 1428 if len(code) != 0 { 1429 errorCode = restjson.SanitizeErrorCode(code) 1430 } 1431 1432 var buff [1024]byte 1433 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1434 1435 body := io.TeeReader(errorBody, ringBuffer) 1436 decoder := json.NewDecoder(body) 1437 decoder.UseNumber() 1438 code, message, err := restjson.GetErrorInfo(decoder) 1439 if err != nil { 1440 var snapshot bytes.Buffer 1441 io.Copy(&snapshot, ringBuffer) 1442 err = &smithy.DeserializationError{ 1443 Err: fmt.Errorf("failed to decode response body, %w", err), 1444 Snapshot: snapshot.Bytes(), 1445 } 1446 return err 1447 } 1448 1449 errorBody.Seek(0, io.SeekStart) 1450 if len(code) != 0 { 1451 errorCode = restjson.SanitizeErrorCode(code) 1452 } 1453 if len(message) != 0 { 1454 errorMessage = message 1455 } 1456 1457 switch { 1458 case strings.EqualFold("BadRequestException", errorCode): 1459 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1460 1461 case strings.EqualFold("ForbiddenException", errorCode): 1462 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1463 1464 case strings.EqualFold("InternalServerErrorException", errorCode): 1465 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1466 1467 case strings.EqualFold("MethodNotAllowedException", errorCode): 1468 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1469 1470 case strings.EqualFold("TooManyRequestsException", errorCode): 1471 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1472 1473 default: 1474 genericError := &smithy.GenericAPIError{ 1475 Code: errorCode, 1476 Message: errorMessage, 1477 } 1478 return genericError 1479 1480 } 1481} 1482 1483func awsRestjson1_deserializeOpDocumentListGroupsOutput(v **ListGroupsOutput, value interface{}) error { 1484 if v == nil { 1485 return fmt.Errorf("unexpected nil of type %T", v) 1486 } 1487 if value == nil { 1488 return nil 1489 } 1490 1491 shape, ok := value.(map[string]interface{}) 1492 if !ok { 1493 return fmt.Errorf("unexpected JSON type %v", value) 1494 } 1495 1496 var sv *ListGroupsOutput 1497 if *v == nil { 1498 sv = &ListGroupsOutput{} 1499 } else { 1500 sv = *v 1501 } 1502 1503 for key, value := range shape { 1504 switch key { 1505 case "GroupIdentifiers": 1506 if err := awsRestjson1_deserializeDocumentGroupIdentifierList(&sv.GroupIdentifiers, value); err != nil { 1507 return err 1508 } 1509 1510 case "Groups": 1511 if err := awsRestjson1_deserializeDocumentGroupList(&sv.Groups, value); err != nil { 1512 return err 1513 } 1514 1515 case "NextToken": 1516 if value != nil { 1517 jtv, ok := value.(string) 1518 if !ok { 1519 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 1520 } 1521 sv.NextToken = ptr.String(jtv) 1522 } 1523 1524 default: 1525 _, _ = key, value 1526 1527 } 1528 } 1529 *v = sv 1530 return nil 1531} 1532 1533type awsRestjson1_deserializeOpSearchResources struct { 1534} 1535 1536func (*awsRestjson1_deserializeOpSearchResources) ID() string { 1537 return "OperationDeserializer" 1538} 1539 1540func (m *awsRestjson1_deserializeOpSearchResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1541 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1542) { 1543 out, metadata, err = next.HandleDeserialize(ctx, in) 1544 if err != nil { 1545 return out, metadata, err 1546 } 1547 1548 response, ok := out.RawResponse.(*smithyhttp.Response) 1549 if !ok { 1550 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1551 } 1552 1553 if response.StatusCode < 200 || response.StatusCode >= 300 { 1554 return out, metadata, awsRestjson1_deserializeOpErrorSearchResources(response, &metadata) 1555 } 1556 output := &SearchResourcesOutput{} 1557 out.Result = output 1558 1559 var buff [1024]byte 1560 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1561 1562 body := io.TeeReader(response.Body, ringBuffer) 1563 1564 decoder := json.NewDecoder(body) 1565 decoder.UseNumber() 1566 var shape interface{} 1567 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1568 var snapshot bytes.Buffer 1569 io.Copy(&snapshot, ringBuffer) 1570 err = &smithy.DeserializationError{ 1571 Err: fmt.Errorf("failed to decode response body, %w", err), 1572 Snapshot: snapshot.Bytes(), 1573 } 1574 return out, metadata, err 1575 } 1576 1577 err = awsRestjson1_deserializeOpDocumentSearchResourcesOutput(&output, shape) 1578 if err != nil { 1579 var snapshot bytes.Buffer 1580 io.Copy(&snapshot, ringBuffer) 1581 return out, metadata, &smithy.DeserializationError{ 1582 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1583 Snapshot: snapshot.Bytes(), 1584 } 1585 } 1586 1587 return out, metadata, err 1588} 1589 1590func awsRestjson1_deserializeOpErrorSearchResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1591 var errorBuffer bytes.Buffer 1592 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1593 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1594 } 1595 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1596 1597 errorCode := "UnknownError" 1598 errorMessage := errorCode 1599 1600 code := response.Header.Get("X-Amzn-ErrorType") 1601 if len(code) != 0 { 1602 errorCode = restjson.SanitizeErrorCode(code) 1603 } 1604 1605 var buff [1024]byte 1606 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1607 1608 body := io.TeeReader(errorBody, ringBuffer) 1609 decoder := json.NewDecoder(body) 1610 decoder.UseNumber() 1611 code, message, err := restjson.GetErrorInfo(decoder) 1612 if err != nil { 1613 var snapshot bytes.Buffer 1614 io.Copy(&snapshot, ringBuffer) 1615 err = &smithy.DeserializationError{ 1616 Err: fmt.Errorf("failed to decode response body, %w", err), 1617 Snapshot: snapshot.Bytes(), 1618 } 1619 return err 1620 } 1621 1622 errorBody.Seek(0, io.SeekStart) 1623 if len(code) != 0 { 1624 errorCode = restjson.SanitizeErrorCode(code) 1625 } 1626 if len(message) != 0 { 1627 errorMessage = message 1628 } 1629 1630 switch { 1631 case strings.EqualFold("BadRequestException", errorCode): 1632 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1633 1634 case strings.EqualFold("ForbiddenException", errorCode): 1635 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1636 1637 case strings.EqualFold("InternalServerErrorException", errorCode): 1638 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1639 1640 case strings.EqualFold("MethodNotAllowedException", errorCode): 1641 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1642 1643 case strings.EqualFold("TooManyRequestsException", errorCode): 1644 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1645 1646 case strings.EqualFold("UnauthorizedException", errorCode): 1647 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1648 1649 default: 1650 genericError := &smithy.GenericAPIError{ 1651 Code: errorCode, 1652 Message: errorMessage, 1653 } 1654 return genericError 1655 1656 } 1657} 1658 1659func awsRestjson1_deserializeOpDocumentSearchResourcesOutput(v **SearchResourcesOutput, value interface{}) error { 1660 if v == nil { 1661 return fmt.Errorf("unexpected nil of type %T", v) 1662 } 1663 if value == nil { 1664 return nil 1665 } 1666 1667 shape, ok := value.(map[string]interface{}) 1668 if !ok { 1669 return fmt.Errorf("unexpected JSON type %v", value) 1670 } 1671 1672 var sv *SearchResourcesOutput 1673 if *v == nil { 1674 sv = &SearchResourcesOutput{} 1675 } else { 1676 sv = *v 1677 } 1678 1679 for key, value := range shape { 1680 switch key { 1681 case "NextToken": 1682 if value != nil { 1683 jtv, ok := value.(string) 1684 if !ok { 1685 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 1686 } 1687 sv.NextToken = ptr.String(jtv) 1688 } 1689 1690 case "QueryErrors": 1691 if err := awsRestjson1_deserializeDocumentQueryErrorList(&sv.QueryErrors, value); err != nil { 1692 return err 1693 } 1694 1695 case "ResourceIdentifiers": 1696 if err := awsRestjson1_deserializeDocumentResourceIdentifierList(&sv.ResourceIdentifiers, value); err != nil { 1697 return err 1698 } 1699 1700 default: 1701 _, _ = key, value 1702 1703 } 1704 } 1705 *v = sv 1706 return nil 1707} 1708 1709type awsRestjson1_deserializeOpTag struct { 1710} 1711 1712func (*awsRestjson1_deserializeOpTag) ID() string { 1713 return "OperationDeserializer" 1714} 1715 1716func (m *awsRestjson1_deserializeOpTag) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1717 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1718) { 1719 out, metadata, err = next.HandleDeserialize(ctx, in) 1720 if err != nil { 1721 return out, metadata, err 1722 } 1723 1724 response, ok := out.RawResponse.(*smithyhttp.Response) 1725 if !ok { 1726 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1727 } 1728 1729 if response.StatusCode < 200 || response.StatusCode >= 300 { 1730 return out, metadata, awsRestjson1_deserializeOpErrorTag(response, &metadata) 1731 } 1732 output := &TagOutput{} 1733 out.Result = output 1734 1735 var buff [1024]byte 1736 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1737 1738 body := io.TeeReader(response.Body, ringBuffer) 1739 1740 decoder := json.NewDecoder(body) 1741 decoder.UseNumber() 1742 var shape interface{} 1743 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1744 var snapshot bytes.Buffer 1745 io.Copy(&snapshot, ringBuffer) 1746 err = &smithy.DeserializationError{ 1747 Err: fmt.Errorf("failed to decode response body, %w", err), 1748 Snapshot: snapshot.Bytes(), 1749 } 1750 return out, metadata, err 1751 } 1752 1753 err = awsRestjson1_deserializeOpDocumentTagOutput(&output, shape) 1754 if err != nil { 1755 var snapshot bytes.Buffer 1756 io.Copy(&snapshot, ringBuffer) 1757 return out, metadata, &smithy.DeserializationError{ 1758 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1759 Snapshot: snapshot.Bytes(), 1760 } 1761 } 1762 1763 return out, metadata, err 1764} 1765 1766func awsRestjson1_deserializeOpErrorTag(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1767 var errorBuffer bytes.Buffer 1768 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1769 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1770 } 1771 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1772 1773 errorCode := "UnknownError" 1774 errorMessage := errorCode 1775 1776 code := response.Header.Get("X-Amzn-ErrorType") 1777 if len(code) != 0 { 1778 errorCode = restjson.SanitizeErrorCode(code) 1779 } 1780 1781 var buff [1024]byte 1782 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1783 1784 body := io.TeeReader(errorBody, ringBuffer) 1785 decoder := json.NewDecoder(body) 1786 decoder.UseNumber() 1787 code, message, err := restjson.GetErrorInfo(decoder) 1788 if err != nil { 1789 var snapshot bytes.Buffer 1790 io.Copy(&snapshot, ringBuffer) 1791 err = &smithy.DeserializationError{ 1792 Err: fmt.Errorf("failed to decode response body, %w", err), 1793 Snapshot: snapshot.Bytes(), 1794 } 1795 return err 1796 } 1797 1798 errorBody.Seek(0, io.SeekStart) 1799 if len(code) != 0 { 1800 errorCode = restjson.SanitizeErrorCode(code) 1801 } 1802 if len(message) != 0 { 1803 errorMessage = message 1804 } 1805 1806 switch { 1807 case strings.EqualFold("BadRequestException", errorCode): 1808 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1809 1810 case strings.EqualFold("ForbiddenException", errorCode): 1811 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1812 1813 case strings.EqualFold("InternalServerErrorException", errorCode): 1814 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1815 1816 case strings.EqualFold("MethodNotAllowedException", errorCode): 1817 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1818 1819 case strings.EqualFold("NotFoundException", errorCode): 1820 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1821 1822 case strings.EqualFold("TooManyRequestsException", errorCode): 1823 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1824 1825 default: 1826 genericError := &smithy.GenericAPIError{ 1827 Code: errorCode, 1828 Message: errorMessage, 1829 } 1830 return genericError 1831 1832 } 1833} 1834 1835func awsRestjson1_deserializeOpDocumentTagOutput(v **TagOutput, value interface{}) error { 1836 if v == nil { 1837 return fmt.Errorf("unexpected nil of type %T", v) 1838 } 1839 if value == nil { 1840 return nil 1841 } 1842 1843 shape, ok := value.(map[string]interface{}) 1844 if !ok { 1845 return fmt.Errorf("unexpected JSON type %v", value) 1846 } 1847 1848 var sv *TagOutput 1849 if *v == nil { 1850 sv = &TagOutput{} 1851 } else { 1852 sv = *v 1853 } 1854 1855 for key, value := range shape { 1856 switch key { 1857 case "Arn": 1858 if value != nil { 1859 jtv, ok := value.(string) 1860 if !ok { 1861 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 1862 } 1863 sv.Arn = ptr.String(jtv) 1864 } 1865 1866 case "Tags": 1867 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 1868 return err 1869 } 1870 1871 default: 1872 _, _ = key, value 1873 1874 } 1875 } 1876 *v = sv 1877 return nil 1878} 1879 1880type awsRestjson1_deserializeOpUngroupResources struct { 1881} 1882 1883func (*awsRestjson1_deserializeOpUngroupResources) ID() string { 1884 return "OperationDeserializer" 1885} 1886 1887func (m *awsRestjson1_deserializeOpUngroupResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1888 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1889) { 1890 out, metadata, err = next.HandleDeserialize(ctx, in) 1891 if err != nil { 1892 return out, metadata, err 1893 } 1894 1895 response, ok := out.RawResponse.(*smithyhttp.Response) 1896 if !ok { 1897 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1898 } 1899 1900 if response.StatusCode < 200 || response.StatusCode >= 300 { 1901 return out, metadata, awsRestjson1_deserializeOpErrorUngroupResources(response, &metadata) 1902 } 1903 output := &UngroupResourcesOutput{} 1904 out.Result = output 1905 1906 var buff [1024]byte 1907 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1908 1909 body := io.TeeReader(response.Body, ringBuffer) 1910 1911 decoder := json.NewDecoder(body) 1912 decoder.UseNumber() 1913 var shape interface{} 1914 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1915 var snapshot bytes.Buffer 1916 io.Copy(&snapshot, ringBuffer) 1917 err = &smithy.DeserializationError{ 1918 Err: fmt.Errorf("failed to decode response body, %w", err), 1919 Snapshot: snapshot.Bytes(), 1920 } 1921 return out, metadata, err 1922 } 1923 1924 err = awsRestjson1_deserializeOpDocumentUngroupResourcesOutput(&output, shape) 1925 if err != nil { 1926 var snapshot bytes.Buffer 1927 io.Copy(&snapshot, ringBuffer) 1928 return out, metadata, &smithy.DeserializationError{ 1929 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1930 Snapshot: snapshot.Bytes(), 1931 } 1932 } 1933 1934 return out, metadata, err 1935} 1936 1937func awsRestjson1_deserializeOpErrorUngroupResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1938 var errorBuffer bytes.Buffer 1939 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1940 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1941 } 1942 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1943 1944 errorCode := "UnknownError" 1945 errorMessage := errorCode 1946 1947 code := response.Header.Get("X-Amzn-ErrorType") 1948 if len(code) != 0 { 1949 errorCode = restjson.SanitizeErrorCode(code) 1950 } 1951 1952 var buff [1024]byte 1953 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1954 1955 body := io.TeeReader(errorBody, ringBuffer) 1956 decoder := json.NewDecoder(body) 1957 decoder.UseNumber() 1958 code, message, err := restjson.GetErrorInfo(decoder) 1959 if err != nil { 1960 var snapshot bytes.Buffer 1961 io.Copy(&snapshot, ringBuffer) 1962 err = &smithy.DeserializationError{ 1963 Err: fmt.Errorf("failed to decode response body, %w", err), 1964 Snapshot: snapshot.Bytes(), 1965 } 1966 return err 1967 } 1968 1969 errorBody.Seek(0, io.SeekStart) 1970 if len(code) != 0 { 1971 errorCode = restjson.SanitizeErrorCode(code) 1972 } 1973 if len(message) != 0 { 1974 errorMessage = message 1975 } 1976 1977 switch { 1978 case strings.EqualFold("BadRequestException", errorCode): 1979 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1980 1981 case strings.EqualFold("ForbiddenException", errorCode): 1982 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1983 1984 case strings.EqualFold("InternalServerErrorException", errorCode): 1985 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1986 1987 case strings.EqualFold("MethodNotAllowedException", errorCode): 1988 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1989 1990 case strings.EqualFold("NotFoundException", errorCode): 1991 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1992 1993 case strings.EqualFold("TooManyRequestsException", errorCode): 1994 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1995 1996 default: 1997 genericError := &smithy.GenericAPIError{ 1998 Code: errorCode, 1999 Message: errorMessage, 2000 } 2001 return genericError 2002 2003 } 2004} 2005 2006func awsRestjson1_deserializeOpDocumentUngroupResourcesOutput(v **UngroupResourcesOutput, value interface{}) error { 2007 if v == nil { 2008 return fmt.Errorf("unexpected nil of type %T", v) 2009 } 2010 if value == nil { 2011 return nil 2012 } 2013 2014 shape, ok := value.(map[string]interface{}) 2015 if !ok { 2016 return fmt.Errorf("unexpected JSON type %v", value) 2017 } 2018 2019 var sv *UngroupResourcesOutput 2020 if *v == nil { 2021 sv = &UngroupResourcesOutput{} 2022 } else { 2023 sv = *v 2024 } 2025 2026 for key, value := range shape { 2027 switch key { 2028 case "Failed": 2029 if err := awsRestjson1_deserializeDocumentFailedResourceList(&sv.Failed, value); err != nil { 2030 return err 2031 } 2032 2033 case "Succeeded": 2034 if err := awsRestjson1_deserializeDocumentResourceArnList(&sv.Succeeded, value); err != nil { 2035 return err 2036 } 2037 2038 default: 2039 _, _ = key, value 2040 2041 } 2042 } 2043 *v = sv 2044 return nil 2045} 2046 2047type awsRestjson1_deserializeOpUntag struct { 2048} 2049 2050func (*awsRestjson1_deserializeOpUntag) ID() string { 2051 return "OperationDeserializer" 2052} 2053 2054func (m *awsRestjson1_deserializeOpUntag) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2055 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2056) { 2057 out, metadata, err = next.HandleDeserialize(ctx, in) 2058 if err != nil { 2059 return out, metadata, err 2060 } 2061 2062 response, ok := out.RawResponse.(*smithyhttp.Response) 2063 if !ok { 2064 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2065 } 2066 2067 if response.StatusCode < 200 || response.StatusCode >= 300 { 2068 return out, metadata, awsRestjson1_deserializeOpErrorUntag(response, &metadata) 2069 } 2070 output := &UntagOutput{} 2071 out.Result = output 2072 2073 var buff [1024]byte 2074 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2075 2076 body := io.TeeReader(response.Body, ringBuffer) 2077 2078 decoder := json.NewDecoder(body) 2079 decoder.UseNumber() 2080 var shape interface{} 2081 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2082 var snapshot bytes.Buffer 2083 io.Copy(&snapshot, ringBuffer) 2084 err = &smithy.DeserializationError{ 2085 Err: fmt.Errorf("failed to decode response body, %w", err), 2086 Snapshot: snapshot.Bytes(), 2087 } 2088 return out, metadata, err 2089 } 2090 2091 err = awsRestjson1_deserializeOpDocumentUntagOutput(&output, shape) 2092 if err != nil { 2093 var snapshot bytes.Buffer 2094 io.Copy(&snapshot, ringBuffer) 2095 return out, metadata, &smithy.DeserializationError{ 2096 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2097 Snapshot: snapshot.Bytes(), 2098 } 2099 } 2100 2101 return out, metadata, err 2102} 2103 2104func awsRestjson1_deserializeOpErrorUntag(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2105 var errorBuffer bytes.Buffer 2106 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2107 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2108 } 2109 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2110 2111 errorCode := "UnknownError" 2112 errorMessage := errorCode 2113 2114 code := response.Header.Get("X-Amzn-ErrorType") 2115 if len(code) != 0 { 2116 errorCode = restjson.SanitizeErrorCode(code) 2117 } 2118 2119 var buff [1024]byte 2120 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2121 2122 body := io.TeeReader(errorBody, ringBuffer) 2123 decoder := json.NewDecoder(body) 2124 decoder.UseNumber() 2125 code, message, err := restjson.GetErrorInfo(decoder) 2126 if err != nil { 2127 var snapshot bytes.Buffer 2128 io.Copy(&snapshot, ringBuffer) 2129 err = &smithy.DeserializationError{ 2130 Err: fmt.Errorf("failed to decode response body, %w", err), 2131 Snapshot: snapshot.Bytes(), 2132 } 2133 return err 2134 } 2135 2136 errorBody.Seek(0, io.SeekStart) 2137 if len(code) != 0 { 2138 errorCode = restjson.SanitizeErrorCode(code) 2139 } 2140 if len(message) != 0 { 2141 errorMessage = message 2142 } 2143 2144 switch { 2145 case strings.EqualFold("BadRequestException", errorCode): 2146 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2147 2148 case strings.EqualFold("ForbiddenException", errorCode): 2149 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2150 2151 case strings.EqualFold("InternalServerErrorException", errorCode): 2152 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2153 2154 case strings.EqualFold("MethodNotAllowedException", errorCode): 2155 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 2156 2157 case strings.EqualFold("NotFoundException", errorCode): 2158 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2159 2160 case strings.EqualFold("TooManyRequestsException", errorCode): 2161 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2162 2163 default: 2164 genericError := &smithy.GenericAPIError{ 2165 Code: errorCode, 2166 Message: errorMessage, 2167 } 2168 return genericError 2169 2170 } 2171} 2172 2173func awsRestjson1_deserializeOpDocumentUntagOutput(v **UntagOutput, value interface{}) error { 2174 if v == nil { 2175 return fmt.Errorf("unexpected nil of type %T", v) 2176 } 2177 if value == nil { 2178 return nil 2179 } 2180 2181 shape, ok := value.(map[string]interface{}) 2182 if !ok { 2183 return fmt.Errorf("unexpected JSON type %v", value) 2184 } 2185 2186 var sv *UntagOutput 2187 if *v == nil { 2188 sv = &UntagOutput{} 2189 } else { 2190 sv = *v 2191 } 2192 2193 for key, value := range shape { 2194 switch key { 2195 case "Arn": 2196 if value != nil { 2197 jtv, ok := value.(string) 2198 if !ok { 2199 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 2200 } 2201 sv.Arn = ptr.String(jtv) 2202 } 2203 2204 case "Keys": 2205 if err := awsRestjson1_deserializeDocumentTagKeyList(&sv.Keys, value); err != nil { 2206 return err 2207 } 2208 2209 default: 2210 _, _ = key, value 2211 2212 } 2213 } 2214 *v = sv 2215 return nil 2216} 2217 2218type awsRestjson1_deserializeOpUpdateGroup struct { 2219} 2220 2221func (*awsRestjson1_deserializeOpUpdateGroup) ID() string { 2222 return "OperationDeserializer" 2223} 2224 2225func (m *awsRestjson1_deserializeOpUpdateGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2226 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2227) { 2228 out, metadata, err = next.HandleDeserialize(ctx, in) 2229 if err != nil { 2230 return out, metadata, err 2231 } 2232 2233 response, ok := out.RawResponse.(*smithyhttp.Response) 2234 if !ok { 2235 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2236 } 2237 2238 if response.StatusCode < 200 || response.StatusCode >= 300 { 2239 return out, metadata, awsRestjson1_deserializeOpErrorUpdateGroup(response, &metadata) 2240 } 2241 output := &UpdateGroupOutput{} 2242 out.Result = output 2243 2244 var buff [1024]byte 2245 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2246 2247 body := io.TeeReader(response.Body, ringBuffer) 2248 2249 decoder := json.NewDecoder(body) 2250 decoder.UseNumber() 2251 var shape interface{} 2252 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2253 var snapshot bytes.Buffer 2254 io.Copy(&snapshot, ringBuffer) 2255 err = &smithy.DeserializationError{ 2256 Err: fmt.Errorf("failed to decode response body, %w", err), 2257 Snapshot: snapshot.Bytes(), 2258 } 2259 return out, metadata, err 2260 } 2261 2262 err = awsRestjson1_deserializeOpDocumentUpdateGroupOutput(&output, shape) 2263 if err != nil { 2264 var snapshot bytes.Buffer 2265 io.Copy(&snapshot, ringBuffer) 2266 return out, metadata, &smithy.DeserializationError{ 2267 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2268 Snapshot: snapshot.Bytes(), 2269 } 2270 } 2271 2272 return out, metadata, err 2273} 2274 2275func awsRestjson1_deserializeOpErrorUpdateGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2276 var errorBuffer bytes.Buffer 2277 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2278 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2279 } 2280 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2281 2282 errorCode := "UnknownError" 2283 errorMessage := errorCode 2284 2285 code := response.Header.Get("X-Amzn-ErrorType") 2286 if len(code) != 0 { 2287 errorCode = restjson.SanitizeErrorCode(code) 2288 } 2289 2290 var buff [1024]byte 2291 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2292 2293 body := io.TeeReader(errorBody, ringBuffer) 2294 decoder := json.NewDecoder(body) 2295 decoder.UseNumber() 2296 code, message, err := restjson.GetErrorInfo(decoder) 2297 if err != nil { 2298 var snapshot bytes.Buffer 2299 io.Copy(&snapshot, ringBuffer) 2300 err = &smithy.DeserializationError{ 2301 Err: fmt.Errorf("failed to decode response body, %w", err), 2302 Snapshot: snapshot.Bytes(), 2303 } 2304 return err 2305 } 2306 2307 errorBody.Seek(0, io.SeekStart) 2308 if len(code) != 0 { 2309 errorCode = restjson.SanitizeErrorCode(code) 2310 } 2311 if len(message) != 0 { 2312 errorMessage = message 2313 } 2314 2315 switch { 2316 case strings.EqualFold("BadRequestException", errorCode): 2317 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2318 2319 case strings.EqualFold("ForbiddenException", errorCode): 2320 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2321 2322 case strings.EqualFold("InternalServerErrorException", errorCode): 2323 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2324 2325 case strings.EqualFold("MethodNotAllowedException", errorCode): 2326 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 2327 2328 case strings.EqualFold("NotFoundException", errorCode): 2329 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2330 2331 case strings.EqualFold("TooManyRequestsException", errorCode): 2332 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2333 2334 default: 2335 genericError := &smithy.GenericAPIError{ 2336 Code: errorCode, 2337 Message: errorMessage, 2338 } 2339 return genericError 2340 2341 } 2342} 2343 2344func awsRestjson1_deserializeOpDocumentUpdateGroupOutput(v **UpdateGroupOutput, value interface{}) error { 2345 if v == nil { 2346 return fmt.Errorf("unexpected nil of type %T", v) 2347 } 2348 if value == nil { 2349 return nil 2350 } 2351 2352 shape, ok := value.(map[string]interface{}) 2353 if !ok { 2354 return fmt.Errorf("unexpected JSON type %v", value) 2355 } 2356 2357 var sv *UpdateGroupOutput 2358 if *v == nil { 2359 sv = &UpdateGroupOutput{} 2360 } else { 2361 sv = *v 2362 } 2363 2364 for key, value := range shape { 2365 switch key { 2366 case "Group": 2367 if err := awsRestjson1_deserializeDocumentGroup(&sv.Group, value); err != nil { 2368 return err 2369 } 2370 2371 default: 2372 _, _ = key, value 2373 2374 } 2375 } 2376 *v = sv 2377 return nil 2378} 2379 2380type awsRestjson1_deserializeOpUpdateGroupQuery struct { 2381} 2382 2383func (*awsRestjson1_deserializeOpUpdateGroupQuery) ID() string { 2384 return "OperationDeserializer" 2385} 2386 2387func (m *awsRestjson1_deserializeOpUpdateGroupQuery) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2388 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2389) { 2390 out, metadata, err = next.HandleDeserialize(ctx, in) 2391 if err != nil { 2392 return out, metadata, err 2393 } 2394 2395 response, ok := out.RawResponse.(*smithyhttp.Response) 2396 if !ok { 2397 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2398 } 2399 2400 if response.StatusCode < 200 || response.StatusCode >= 300 { 2401 return out, metadata, awsRestjson1_deserializeOpErrorUpdateGroupQuery(response, &metadata) 2402 } 2403 output := &UpdateGroupQueryOutput{} 2404 out.Result = output 2405 2406 var buff [1024]byte 2407 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2408 2409 body := io.TeeReader(response.Body, ringBuffer) 2410 2411 decoder := json.NewDecoder(body) 2412 decoder.UseNumber() 2413 var shape interface{} 2414 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2415 var snapshot bytes.Buffer 2416 io.Copy(&snapshot, ringBuffer) 2417 err = &smithy.DeserializationError{ 2418 Err: fmt.Errorf("failed to decode response body, %w", err), 2419 Snapshot: snapshot.Bytes(), 2420 } 2421 return out, metadata, err 2422 } 2423 2424 err = awsRestjson1_deserializeOpDocumentUpdateGroupQueryOutput(&output, shape) 2425 if err != nil { 2426 var snapshot bytes.Buffer 2427 io.Copy(&snapshot, ringBuffer) 2428 return out, metadata, &smithy.DeserializationError{ 2429 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2430 Snapshot: snapshot.Bytes(), 2431 } 2432 } 2433 2434 return out, metadata, err 2435} 2436 2437func awsRestjson1_deserializeOpErrorUpdateGroupQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2438 var errorBuffer bytes.Buffer 2439 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2440 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2441 } 2442 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2443 2444 errorCode := "UnknownError" 2445 errorMessage := errorCode 2446 2447 code := response.Header.Get("X-Amzn-ErrorType") 2448 if len(code) != 0 { 2449 errorCode = restjson.SanitizeErrorCode(code) 2450 } 2451 2452 var buff [1024]byte 2453 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2454 2455 body := io.TeeReader(errorBody, ringBuffer) 2456 decoder := json.NewDecoder(body) 2457 decoder.UseNumber() 2458 code, message, err := restjson.GetErrorInfo(decoder) 2459 if err != nil { 2460 var snapshot bytes.Buffer 2461 io.Copy(&snapshot, ringBuffer) 2462 err = &smithy.DeserializationError{ 2463 Err: fmt.Errorf("failed to decode response body, %w", err), 2464 Snapshot: snapshot.Bytes(), 2465 } 2466 return err 2467 } 2468 2469 errorBody.Seek(0, io.SeekStart) 2470 if len(code) != 0 { 2471 errorCode = restjson.SanitizeErrorCode(code) 2472 } 2473 if len(message) != 0 { 2474 errorMessage = message 2475 } 2476 2477 switch { 2478 case strings.EqualFold("BadRequestException", errorCode): 2479 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2480 2481 case strings.EqualFold("ForbiddenException", errorCode): 2482 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2483 2484 case strings.EqualFold("InternalServerErrorException", errorCode): 2485 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2486 2487 case strings.EqualFold("MethodNotAllowedException", errorCode): 2488 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 2489 2490 case strings.EqualFold("NotFoundException", errorCode): 2491 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2492 2493 case strings.EqualFold("TooManyRequestsException", errorCode): 2494 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2495 2496 default: 2497 genericError := &smithy.GenericAPIError{ 2498 Code: errorCode, 2499 Message: errorMessage, 2500 } 2501 return genericError 2502 2503 } 2504} 2505 2506func awsRestjson1_deserializeOpDocumentUpdateGroupQueryOutput(v **UpdateGroupQueryOutput, value interface{}) error { 2507 if v == nil { 2508 return fmt.Errorf("unexpected nil of type %T", v) 2509 } 2510 if value == nil { 2511 return nil 2512 } 2513 2514 shape, ok := value.(map[string]interface{}) 2515 if !ok { 2516 return fmt.Errorf("unexpected JSON type %v", value) 2517 } 2518 2519 var sv *UpdateGroupQueryOutput 2520 if *v == nil { 2521 sv = &UpdateGroupQueryOutput{} 2522 } else { 2523 sv = *v 2524 } 2525 2526 for key, value := range shape { 2527 switch key { 2528 case "GroupQuery": 2529 if err := awsRestjson1_deserializeDocumentGroupQuery(&sv.GroupQuery, value); err != nil { 2530 return err 2531 } 2532 2533 default: 2534 _, _ = key, value 2535 2536 } 2537 } 2538 *v = sv 2539 return nil 2540} 2541 2542func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2543 output := &types.BadRequestException{} 2544 var buff [1024]byte 2545 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2546 2547 body := io.TeeReader(errorBody, ringBuffer) 2548 decoder := json.NewDecoder(body) 2549 decoder.UseNumber() 2550 var shape interface{} 2551 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2552 var snapshot bytes.Buffer 2553 io.Copy(&snapshot, ringBuffer) 2554 err = &smithy.DeserializationError{ 2555 Err: fmt.Errorf("failed to decode response body, %w", err), 2556 Snapshot: snapshot.Bytes(), 2557 } 2558 return err 2559 } 2560 2561 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 2562 2563 if err != nil { 2564 var snapshot bytes.Buffer 2565 io.Copy(&snapshot, ringBuffer) 2566 err = &smithy.DeserializationError{ 2567 Err: fmt.Errorf("failed to decode response body, %w", err), 2568 Snapshot: snapshot.Bytes(), 2569 } 2570 return err 2571 } 2572 2573 errorBody.Seek(0, io.SeekStart) 2574 2575 return output 2576} 2577 2578func awsRestjson1_deserializeErrorForbiddenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2579 output := &types.ForbiddenException{} 2580 var buff [1024]byte 2581 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2582 2583 body := io.TeeReader(errorBody, ringBuffer) 2584 decoder := json.NewDecoder(body) 2585 decoder.UseNumber() 2586 var shape interface{} 2587 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2588 var snapshot bytes.Buffer 2589 io.Copy(&snapshot, ringBuffer) 2590 err = &smithy.DeserializationError{ 2591 Err: fmt.Errorf("failed to decode response body, %w", err), 2592 Snapshot: snapshot.Bytes(), 2593 } 2594 return err 2595 } 2596 2597 err := awsRestjson1_deserializeDocumentForbiddenException(&output, shape) 2598 2599 if err != nil { 2600 var snapshot bytes.Buffer 2601 io.Copy(&snapshot, ringBuffer) 2602 err = &smithy.DeserializationError{ 2603 Err: fmt.Errorf("failed to decode response body, %w", err), 2604 Snapshot: snapshot.Bytes(), 2605 } 2606 return err 2607 } 2608 2609 errorBody.Seek(0, io.SeekStart) 2610 2611 return output 2612} 2613 2614func awsRestjson1_deserializeErrorInternalServerErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2615 output := &types.InternalServerErrorException{} 2616 var buff [1024]byte 2617 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2618 2619 body := io.TeeReader(errorBody, ringBuffer) 2620 decoder := json.NewDecoder(body) 2621 decoder.UseNumber() 2622 var shape interface{} 2623 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2624 var snapshot bytes.Buffer 2625 io.Copy(&snapshot, ringBuffer) 2626 err = &smithy.DeserializationError{ 2627 Err: fmt.Errorf("failed to decode response body, %w", err), 2628 Snapshot: snapshot.Bytes(), 2629 } 2630 return err 2631 } 2632 2633 err := awsRestjson1_deserializeDocumentInternalServerErrorException(&output, shape) 2634 2635 if err != nil { 2636 var snapshot bytes.Buffer 2637 io.Copy(&snapshot, ringBuffer) 2638 err = &smithy.DeserializationError{ 2639 Err: fmt.Errorf("failed to decode response body, %w", err), 2640 Snapshot: snapshot.Bytes(), 2641 } 2642 return err 2643 } 2644 2645 errorBody.Seek(0, io.SeekStart) 2646 2647 return output 2648} 2649 2650func awsRestjson1_deserializeErrorMethodNotAllowedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2651 output := &types.MethodNotAllowedException{} 2652 var buff [1024]byte 2653 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2654 2655 body := io.TeeReader(errorBody, ringBuffer) 2656 decoder := json.NewDecoder(body) 2657 decoder.UseNumber() 2658 var shape interface{} 2659 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2660 var snapshot bytes.Buffer 2661 io.Copy(&snapshot, ringBuffer) 2662 err = &smithy.DeserializationError{ 2663 Err: fmt.Errorf("failed to decode response body, %w", err), 2664 Snapshot: snapshot.Bytes(), 2665 } 2666 return err 2667 } 2668 2669 err := awsRestjson1_deserializeDocumentMethodNotAllowedException(&output, shape) 2670 2671 if err != nil { 2672 var snapshot bytes.Buffer 2673 io.Copy(&snapshot, ringBuffer) 2674 err = &smithy.DeserializationError{ 2675 Err: fmt.Errorf("failed to decode response body, %w", err), 2676 Snapshot: snapshot.Bytes(), 2677 } 2678 return err 2679 } 2680 2681 errorBody.Seek(0, io.SeekStart) 2682 2683 return output 2684} 2685 2686func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2687 output := &types.NotFoundException{} 2688 var buff [1024]byte 2689 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2690 2691 body := io.TeeReader(errorBody, ringBuffer) 2692 decoder := json.NewDecoder(body) 2693 decoder.UseNumber() 2694 var shape interface{} 2695 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2696 var snapshot bytes.Buffer 2697 io.Copy(&snapshot, ringBuffer) 2698 err = &smithy.DeserializationError{ 2699 Err: fmt.Errorf("failed to decode response body, %w", err), 2700 Snapshot: snapshot.Bytes(), 2701 } 2702 return err 2703 } 2704 2705 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 2706 2707 if err != nil { 2708 var snapshot bytes.Buffer 2709 io.Copy(&snapshot, ringBuffer) 2710 err = &smithy.DeserializationError{ 2711 Err: fmt.Errorf("failed to decode response body, %w", err), 2712 Snapshot: snapshot.Bytes(), 2713 } 2714 return err 2715 } 2716 2717 errorBody.Seek(0, io.SeekStart) 2718 2719 return output 2720} 2721 2722func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2723 output := &types.TooManyRequestsException{} 2724 var buff [1024]byte 2725 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2726 2727 body := io.TeeReader(errorBody, ringBuffer) 2728 decoder := json.NewDecoder(body) 2729 decoder.UseNumber() 2730 var shape interface{} 2731 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2732 var snapshot bytes.Buffer 2733 io.Copy(&snapshot, ringBuffer) 2734 err = &smithy.DeserializationError{ 2735 Err: fmt.Errorf("failed to decode response body, %w", err), 2736 Snapshot: snapshot.Bytes(), 2737 } 2738 return err 2739 } 2740 2741 err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) 2742 2743 if err != nil { 2744 var snapshot bytes.Buffer 2745 io.Copy(&snapshot, ringBuffer) 2746 err = &smithy.DeserializationError{ 2747 Err: fmt.Errorf("failed to decode response body, %w", err), 2748 Snapshot: snapshot.Bytes(), 2749 } 2750 return err 2751 } 2752 2753 errorBody.Seek(0, io.SeekStart) 2754 2755 return output 2756} 2757 2758func awsRestjson1_deserializeErrorUnauthorizedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2759 output := &types.UnauthorizedException{} 2760 var buff [1024]byte 2761 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2762 2763 body := io.TeeReader(errorBody, ringBuffer) 2764 decoder := json.NewDecoder(body) 2765 decoder.UseNumber() 2766 var shape interface{} 2767 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2768 var snapshot bytes.Buffer 2769 io.Copy(&snapshot, ringBuffer) 2770 err = &smithy.DeserializationError{ 2771 Err: fmt.Errorf("failed to decode response body, %w", err), 2772 Snapshot: snapshot.Bytes(), 2773 } 2774 return err 2775 } 2776 2777 err := awsRestjson1_deserializeDocumentUnauthorizedException(&output, shape) 2778 2779 if err != nil { 2780 var snapshot bytes.Buffer 2781 io.Copy(&snapshot, ringBuffer) 2782 err = &smithy.DeserializationError{ 2783 Err: fmt.Errorf("failed to decode response body, %w", err), 2784 Snapshot: snapshot.Bytes(), 2785 } 2786 return err 2787 } 2788 2789 errorBody.Seek(0, io.SeekStart) 2790 2791 return output 2792} 2793 2794func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 2795 if v == nil { 2796 return fmt.Errorf("unexpected nil of type %T", v) 2797 } 2798 if value == nil { 2799 return nil 2800 } 2801 2802 shape, ok := value.(map[string]interface{}) 2803 if !ok { 2804 return fmt.Errorf("unexpected JSON type %v", value) 2805 } 2806 2807 var sv *types.BadRequestException 2808 if *v == nil { 2809 sv = &types.BadRequestException{} 2810 } else { 2811 sv = *v 2812 } 2813 2814 for key, value := range shape { 2815 switch key { 2816 case "Message": 2817 if value != nil { 2818 jtv, ok := value.(string) 2819 if !ok { 2820 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 2821 } 2822 sv.Message = ptr.String(jtv) 2823 } 2824 2825 default: 2826 _, _ = key, value 2827 2828 } 2829 } 2830 *v = sv 2831 return nil 2832} 2833 2834func awsRestjson1_deserializeDocumentFailedResource(v **types.FailedResource, value interface{}) error { 2835 if v == nil { 2836 return fmt.Errorf("unexpected nil of type %T", v) 2837 } 2838 if value == nil { 2839 return nil 2840 } 2841 2842 shape, ok := value.(map[string]interface{}) 2843 if !ok { 2844 return fmt.Errorf("unexpected JSON type %v", value) 2845 } 2846 2847 var sv *types.FailedResource 2848 if *v == nil { 2849 sv = &types.FailedResource{} 2850 } else { 2851 sv = *v 2852 } 2853 2854 for key, value := range shape { 2855 switch key { 2856 case "ErrorCode": 2857 if value != nil { 2858 jtv, ok := value.(string) 2859 if !ok { 2860 return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value) 2861 } 2862 sv.ErrorCode = ptr.String(jtv) 2863 } 2864 2865 case "ErrorMessage": 2866 if value != nil { 2867 jtv, ok := value.(string) 2868 if !ok { 2869 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 2870 } 2871 sv.ErrorMessage = ptr.String(jtv) 2872 } 2873 2874 case "ResourceArn": 2875 if value != nil { 2876 jtv, ok := value.(string) 2877 if !ok { 2878 return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) 2879 } 2880 sv.ResourceArn = ptr.String(jtv) 2881 } 2882 2883 default: 2884 _, _ = key, value 2885 2886 } 2887 } 2888 *v = sv 2889 return nil 2890} 2891 2892func awsRestjson1_deserializeDocumentFailedResourceList(v *[]types.FailedResource, value interface{}) error { 2893 if v == nil { 2894 return fmt.Errorf("unexpected nil of type %T", v) 2895 } 2896 if value == nil { 2897 return nil 2898 } 2899 2900 shape, ok := value.([]interface{}) 2901 if !ok { 2902 return fmt.Errorf("unexpected JSON type %v", value) 2903 } 2904 2905 var cv []types.FailedResource 2906 if *v == nil { 2907 cv = []types.FailedResource{} 2908 } else { 2909 cv = *v 2910 } 2911 2912 for _, value := range shape { 2913 var col types.FailedResource 2914 destAddr := &col 2915 if err := awsRestjson1_deserializeDocumentFailedResource(&destAddr, value); err != nil { 2916 return err 2917 } 2918 col = *destAddr 2919 cv = append(cv, col) 2920 2921 } 2922 *v = cv 2923 return nil 2924} 2925 2926func awsRestjson1_deserializeDocumentForbiddenException(v **types.ForbiddenException, value interface{}) error { 2927 if v == nil { 2928 return fmt.Errorf("unexpected nil of type %T", v) 2929 } 2930 if value == nil { 2931 return nil 2932 } 2933 2934 shape, ok := value.(map[string]interface{}) 2935 if !ok { 2936 return fmt.Errorf("unexpected JSON type %v", value) 2937 } 2938 2939 var sv *types.ForbiddenException 2940 if *v == nil { 2941 sv = &types.ForbiddenException{} 2942 } else { 2943 sv = *v 2944 } 2945 2946 for key, value := range shape { 2947 switch key { 2948 case "Message": 2949 if value != nil { 2950 jtv, ok := value.(string) 2951 if !ok { 2952 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 2953 } 2954 sv.Message = ptr.String(jtv) 2955 } 2956 2957 default: 2958 _, _ = key, value 2959 2960 } 2961 } 2962 *v = sv 2963 return nil 2964} 2965 2966func awsRestjson1_deserializeDocumentGroup(v **types.Group, value interface{}) error { 2967 if v == nil { 2968 return fmt.Errorf("unexpected nil of type %T", v) 2969 } 2970 if value == nil { 2971 return nil 2972 } 2973 2974 shape, ok := value.(map[string]interface{}) 2975 if !ok { 2976 return fmt.Errorf("unexpected JSON type %v", value) 2977 } 2978 2979 var sv *types.Group 2980 if *v == nil { 2981 sv = &types.Group{} 2982 } else { 2983 sv = *v 2984 } 2985 2986 for key, value := range shape { 2987 switch key { 2988 case "Description": 2989 if value != nil { 2990 jtv, ok := value.(string) 2991 if !ok { 2992 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 2993 } 2994 sv.Description = ptr.String(jtv) 2995 } 2996 2997 case "GroupArn": 2998 if value != nil { 2999 jtv, ok := value.(string) 3000 if !ok { 3001 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 3002 } 3003 sv.GroupArn = ptr.String(jtv) 3004 } 3005 3006 case "Name": 3007 if value != nil { 3008 jtv, ok := value.(string) 3009 if !ok { 3010 return fmt.Errorf("expected GroupName to be of type string, got %T instead", value) 3011 } 3012 sv.Name = ptr.String(jtv) 3013 } 3014 3015 default: 3016 _, _ = key, value 3017 3018 } 3019 } 3020 *v = sv 3021 return nil 3022} 3023 3024func awsRestjson1_deserializeDocumentGroupConfiguration(v **types.GroupConfiguration, value interface{}) error { 3025 if v == nil { 3026 return fmt.Errorf("unexpected nil of type %T", v) 3027 } 3028 if value == nil { 3029 return nil 3030 } 3031 3032 shape, ok := value.(map[string]interface{}) 3033 if !ok { 3034 return fmt.Errorf("unexpected JSON type %v", value) 3035 } 3036 3037 var sv *types.GroupConfiguration 3038 if *v == nil { 3039 sv = &types.GroupConfiguration{} 3040 } else { 3041 sv = *v 3042 } 3043 3044 for key, value := range shape { 3045 switch key { 3046 case "Configuration": 3047 if err := awsRestjson1_deserializeDocumentGroupConfigurationList(&sv.Configuration, value); err != nil { 3048 return err 3049 } 3050 3051 case "FailureReason": 3052 if value != nil { 3053 jtv, ok := value.(string) 3054 if !ok { 3055 return fmt.Errorf("expected GroupConfigurationFailureReason to be of type string, got %T instead", value) 3056 } 3057 sv.FailureReason = ptr.String(jtv) 3058 } 3059 3060 case "ProposedConfiguration": 3061 if err := awsRestjson1_deserializeDocumentGroupConfigurationList(&sv.ProposedConfiguration, value); err != nil { 3062 return err 3063 } 3064 3065 case "Status": 3066 if value != nil { 3067 jtv, ok := value.(string) 3068 if !ok { 3069 return fmt.Errorf("expected GroupConfigurationStatus to be of type string, got %T instead", value) 3070 } 3071 sv.Status = types.GroupConfigurationStatus(jtv) 3072 } 3073 3074 default: 3075 _, _ = key, value 3076 3077 } 3078 } 3079 *v = sv 3080 return nil 3081} 3082 3083func awsRestjson1_deserializeDocumentGroupConfigurationItem(v **types.GroupConfigurationItem, value interface{}) error { 3084 if v == nil { 3085 return fmt.Errorf("unexpected nil of type %T", v) 3086 } 3087 if value == nil { 3088 return nil 3089 } 3090 3091 shape, ok := value.(map[string]interface{}) 3092 if !ok { 3093 return fmt.Errorf("unexpected JSON type %v", value) 3094 } 3095 3096 var sv *types.GroupConfigurationItem 3097 if *v == nil { 3098 sv = &types.GroupConfigurationItem{} 3099 } else { 3100 sv = *v 3101 } 3102 3103 for key, value := range shape { 3104 switch key { 3105 case "Parameters": 3106 if err := awsRestjson1_deserializeDocumentGroupParameterList(&sv.Parameters, value); err != nil { 3107 return err 3108 } 3109 3110 case "Type": 3111 if value != nil { 3112 jtv, ok := value.(string) 3113 if !ok { 3114 return fmt.Errorf("expected GroupConfigurationType to be of type string, got %T instead", value) 3115 } 3116 sv.Type = ptr.String(jtv) 3117 } 3118 3119 default: 3120 _, _ = key, value 3121 3122 } 3123 } 3124 *v = sv 3125 return nil 3126} 3127 3128func awsRestjson1_deserializeDocumentGroupConfigurationList(v *[]types.GroupConfigurationItem, value interface{}) error { 3129 if v == nil { 3130 return fmt.Errorf("unexpected nil of type %T", v) 3131 } 3132 if value == nil { 3133 return nil 3134 } 3135 3136 shape, ok := value.([]interface{}) 3137 if !ok { 3138 return fmt.Errorf("unexpected JSON type %v", value) 3139 } 3140 3141 var cv []types.GroupConfigurationItem 3142 if *v == nil { 3143 cv = []types.GroupConfigurationItem{} 3144 } else { 3145 cv = *v 3146 } 3147 3148 for _, value := range shape { 3149 var col types.GroupConfigurationItem 3150 destAddr := &col 3151 if err := awsRestjson1_deserializeDocumentGroupConfigurationItem(&destAddr, value); err != nil { 3152 return err 3153 } 3154 col = *destAddr 3155 cv = append(cv, col) 3156 3157 } 3158 *v = cv 3159 return nil 3160} 3161 3162func awsRestjson1_deserializeDocumentGroupConfigurationParameter(v **types.GroupConfigurationParameter, value interface{}) error { 3163 if v == nil { 3164 return fmt.Errorf("unexpected nil of type %T", v) 3165 } 3166 if value == nil { 3167 return nil 3168 } 3169 3170 shape, ok := value.(map[string]interface{}) 3171 if !ok { 3172 return fmt.Errorf("unexpected JSON type %v", value) 3173 } 3174 3175 var sv *types.GroupConfigurationParameter 3176 if *v == nil { 3177 sv = &types.GroupConfigurationParameter{} 3178 } else { 3179 sv = *v 3180 } 3181 3182 for key, value := range shape { 3183 switch key { 3184 case "Name": 3185 if value != nil { 3186 jtv, ok := value.(string) 3187 if !ok { 3188 return fmt.Errorf("expected GroupConfigurationParameterName to be of type string, got %T instead", value) 3189 } 3190 sv.Name = ptr.String(jtv) 3191 } 3192 3193 case "Values": 3194 if err := awsRestjson1_deserializeDocumentGroupConfigurationParameterValueList(&sv.Values, value); err != nil { 3195 return err 3196 } 3197 3198 default: 3199 _, _ = key, value 3200 3201 } 3202 } 3203 *v = sv 3204 return nil 3205} 3206 3207func awsRestjson1_deserializeDocumentGroupConfigurationParameterValueList(v *[]string, value interface{}) error { 3208 if v == nil { 3209 return fmt.Errorf("unexpected nil of type %T", v) 3210 } 3211 if value == nil { 3212 return nil 3213 } 3214 3215 shape, ok := value.([]interface{}) 3216 if !ok { 3217 return fmt.Errorf("unexpected JSON type %v", value) 3218 } 3219 3220 var cv []string 3221 if *v == nil { 3222 cv = []string{} 3223 } else { 3224 cv = *v 3225 } 3226 3227 for _, value := range shape { 3228 var col string 3229 if value != nil { 3230 jtv, ok := value.(string) 3231 if !ok { 3232 return fmt.Errorf("expected GroupConfigurationParameterValue to be of type string, got %T instead", value) 3233 } 3234 col = jtv 3235 } 3236 cv = append(cv, col) 3237 3238 } 3239 *v = cv 3240 return nil 3241} 3242 3243func awsRestjson1_deserializeDocumentGroupIdentifier(v **types.GroupIdentifier, value interface{}) error { 3244 if v == nil { 3245 return fmt.Errorf("unexpected nil of type %T", v) 3246 } 3247 if value == nil { 3248 return nil 3249 } 3250 3251 shape, ok := value.(map[string]interface{}) 3252 if !ok { 3253 return fmt.Errorf("unexpected JSON type %v", value) 3254 } 3255 3256 var sv *types.GroupIdentifier 3257 if *v == nil { 3258 sv = &types.GroupIdentifier{} 3259 } else { 3260 sv = *v 3261 } 3262 3263 for key, value := range shape { 3264 switch key { 3265 case "GroupArn": 3266 if value != nil { 3267 jtv, ok := value.(string) 3268 if !ok { 3269 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 3270 } 3271 sv.GroupArn = ptr.String(jtv) 3272 } 3273 3274 case "GroupName": 3275 if value != nil { 3276 jtv, ok := value.(string) 3277 if !ok { 3278 return fmt.Errorf("expected GroupName to be of type string, got %T instead", value) 3279 } 3280 sv.GroupName = ptr.String(jtv) 3281 } 3282 3283 default: 3284 _, _ = key, value 3285 3286 } 3287 } 3288 *v = sv 3289 return nil 3290} 3291 3292func awsRestjson1_deserializeDocumentGroupIdentifierList(v *[]types.GroupIdentifier, value interface{}) error { 3293 if v == nil { 3294 return fmt.Errorf("unexpected nil of type %T", v) 3295 } 3296 if value == nil { 3297 return nil 3298 } 3299 3300 shape, ok := value.([]interface{}) 3301 if !ok { 3302 return fmt.Errorf("unexpected JSON type %v", value) 3303 } 3304 3305 var cv []types.GroupIdentifier 3306 if *v == nil { 3307 cv = []types.GroupIdentifier{} 3308 } else { 3309 cv = *v 3310 } 3311 3312 for _, value := range shape { 3313 var col types.GroupIdentifier 3314 destAddr := &col 3315 if err := awsRestjson1_deserializeDocumentGroupIdentifier(&destAddr, value); err != nil { 3316 return err 3317 } 3318 col = *destAddr 3319 cv = append(cv, col) 3320 3321 } 3322 *v = cv 3323 return nil 3324} 3325 3326func awsRestjson1_deserializeDocumentGroupList(v *[]types.Group, value interface{}) error { 3327 if v == nil { 3328 return fmt.Errorf("unexpected nil of type %T", v) 3329 } 3330 if value == nil { 3331 return nil 3332 } 3333 3334 shape, ok := value.([]interface{}) 3335 if !ok { 3336 return fmt.Errorf("unexpected JSON type %v", value) 3337 } 3338 3339 var cv []types.Group 3340 if *v == nil { 3341 cv = []types.Group{} 3342 } else { 3343 cv = *v 3344 } 3345 3346 for _, value := range shape { 3347 var col types.Group 3348 destAddr := &col 3349 if err := awsRestjson1_deserializeDocumentGroup(&destAddr, value); err != nil { 3350 return err 3351 } 3352 col = *destAddr 3353 cv = append(cv, col) 3354 3355 } 3356 *v = cv 3357 return nil 3358} 3359 3360func awsRestjson1_deserializeDocumentGroupParameterList(v *[]types.GroupConfigurationParameter, value interface{}) error { 3361 if v == nil { 3362 return fmt.Errorf("unexpected nil of type %T", v) 3363 } 3364 if value == nil { 3365 return nil 3366 } 3367 3368 shape, ok := value.([]interface{}) 3369 if !ok { 3370 return fmt.Errorf("unexpected JSON type %v", value) 3371 } 3372 3373 var cv []types.GroupConfigurationParameter 3374 if *v == nil { 3375 cv = []types.GroupConfigurationParameter{} 3376 } else { 3377 cv = *v 3378 } 3379 3380 for _, value := range shape { 3381 var col types.GroupConfigurationParameter 3382 destAddr := &col 3383 if err := awsRestjson1_deserializeDocumentGroupConfigurationParameter(&destAddr, value); err != nil { 3384 return err 3385 } 3386 col = *destAddr 3387 cv = append(cv, col) 3388 3389 } 3390 *v = cv 3391 return nil 3392} 3393 3394func awsRestjson1_deserializeDocumentGroupQuery(v **types.GroupQuery, value interface{}) error { 3395 if v == nil { 3396 return fmt.Errorf("unexpected nil of type %T", v) 3397 } 3398 if value == nil { 3399 return nil 3400 } 3401 3402 shape, ok := value.(map[string]interface{}) 3403 if !ok { 3404 return fmt.Errorf("unexpected JSON type %v", value) 3405 } 3406 3407 var sv *types.GroupQuery 3408 if *v == nil { 3409 sv = &types.GroupQuery{} 3410 } else { 3411 sv = *v 3412 } 3413 3414 for key, value := range shape { 3415 switch key { 3416 case "GroupName": 3417 if value != nil { 3418 jtv, ok := value.(string) 3419 if !ok { 3420 return fmt.Errorf("expected GroupName to be of type string, got %T instead", value) 3421 } 3422 sv.GroupName = ptr.String(jtv) 3423 } 3424 3425 case "ResourceQuery": 3426 if err := awsRestjson1_deserializeDocumentResourceQuery(&sv.ResourceQuery, value); err != nil { 3427 return err 3428 } 3429 3430 default: 3431 _, _ = key, value 3432 3433 } 3434 } 3435 *v = sv 3436 return nil 3437} 3438 3439func awsRestjson1_deserializeDocumentInternalServerErrorException(v **types.InternalServerErrorException, value interface{}) error { 3440 if v == nil { 3441 return fmt.Errorf("unexpected nil of type %T", v) 3442 } 3443 if value == nil { 3444 return nil 3445 } 3446 3447 shape, ok := value.(map[string]interface{}) 3448 if !ok { 3449 return fmt.Errorf("unexpected JSON type %v", value) 3450 } 3451 3452 var sv *types.InternalServerErrorException 3453 if *v == nil { 3454 sv = &types.InternalServerErrorException{} 3455 } else { 3456 sv = *v 3457 } 3458 3459 for key, value := range shape { 3460 switch key { 3461 case "Message": 3462 if value != nil { 3463 jtv, ok := value.(string) 3464 if !ok { 3465 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3466 } 3467 sv.Message = ptr.String(jtv) 3468 } 3469 3470 default: 3471 _, _ = key, value 3472 3473 } 3474 } 3475 *v = sv 3476 return nil 3477} 3478 3479func awsRestjson1_deserializeDocumentMethodNotAllowedException(v **types.MethodNotAllowedException, value interface{}) error { 3480 if v == nil { 3481 return fmt.Errorf("unexpected nil of type %T", v) 3482 } 3483 if value == nil { 3484 return nil 3485 } 3486 3487 shape, ok := value.(map[string]interface{}) 3488 if !ok { 3489 return fmt.Errorf("unexpected JSON type %v", value) 3490 } 3491 3492 var sv *types.MethodNotAllowedException 3493 if *v == nil { 3494 sv = &types.MethodNotAllowedException{} 3495 } else { 3496 sv = *v 3497 } 3498 3499 for key, value := range shape { 3500 switch key { 3501 case "Message": 3502 if value != nil { 3503 jtv, ok := value.(string) 3504 if !ok { 3505 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3506 } 3507 sv.Message = ptr.String(jtv) 3508 } 3509 3510 default: 3511 _, _ = key, value 3512 3513 } 3514 } 3515 *v = sv 3516 return nil 3517} 3518 3519func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 3520 if v == nil { 3521 return fmt.Errorf("unexpected nil of type %T", v) 3522 } 3523 if value == nil { 3524 return nil 3525 } 3526 3527 shape, ok := value.(map[string]interface{}) 3528 if !ok { 3529 return fmt.Errorf("unexpected JSON type %v", value) 3530 } 3531 3532 var sv *types.NotFoundException 3533 if *v == nil { 3534 sv = &types.NotFoundException{} 3535 } else { 3536 sv = *v 3537 } 3538 3539 for key, value := range shape { 3540 switch key { 3541 case "Message": 3542 if value != nil { 3543 jtv, ok := value.(string) 3544 if !ok { 3545 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3546 } 3547 sv.Message = ptr.String(jtv) 3548 } 3549 3550 default: 3551 _, _ = key, value 3552 3553 } 3554 } 3555 *v = sv 3556 return nil 3557} 3558 3559func awsRestjson1_deserializeDocumentQueryError(v **types.QueryError, value interface{}) error { 3560 if v == nil { 3561 return fmt.Errorf("unexpected nil of type %T", v) 3562 } 3563 if value == nil { 3564 return nil 3565 } 3566 3567 shape, ok := value.(map[string]interface{}) 3568 if !ok { 3569 return fmt.Errorf("unexpected JSON type %v", value) 3570 } 3571 3572 var sv *types.QueryError 3573 if *v == nil { 3574 sv = &types.QueryError{} 3575 } else { 3576 sv = *v 3577 } 3578 3579 for key, value := range shape { 3580 switch key { 3581 case "ErrorCode": 3582 if value != nil { 3583 jtv, ok := value.(string) 3584 if !ok { 3585 return fmt.Errorf("expected QueryErrorCode to be of type string, got %T instead", value) 3586 } 3587 sv.ErrorCode = types.QueryErrorCode(jtv) 3588 } 3589 3590 case "Message": 3591 if value != nil { 3592 jtv, ok := value.(string) 3593 if !ok { 3594 return fmt.Errorf("expected QueryErrorMessage to be of type string, got %T instead", value) 3595 } 3596 sv.Message = ptr.String(jtv) 3597 } 3598 3599 default: 3600 _, _ = key, value 3601 3602 } 3603 } 3604 *v = sv 3605 return nil 3606} 3607 3608func awsRestjson1_deserializeDocumentQueryErrorList(v *[]types.QueryError, value interface{}) error { 3609 if v == nil { 3610 return fmt.Errorf("unexpected nil of type %T", v) 3611 } 3612 if value == nil { 3613 return nil 3614 } 3615 3616 shape, ok := value.([]interface{}) 3617 if !ok { 3618 return fmt.Errorf("unexpected JSON type %v", value) 3619 } 3620 3621 var cv []types.QueryError 3622 if *v == nil { 3623 cv = []types.QueryError{} 3624 } else { 3625 cv = *v 3626 } 3627 3628 for _, value := range shape { 3629 var col types.QueryError 3630 destAddr := &col 3631 if err := awsRestjson1_deserializeDocumentQueryError(&destAddr, value); err != nil { 3632 return err 3633 } 3634 col = *destAddr 3635 cv = append(cv, col) 3636 3637 } 3638 *v = cv 3639 return nil 3640} 3641 3642func awsRestjson1_deserializeDocumentResourceArnList(v *[]string, value interface{}) error { 3643 if v == nil { 3644 return fmt.Errorf("unexpected nil of type %T", v) 3645 } 3646 if value == nil { 3647 return nil 3648 } 3649 3650 shape, ok := value.([]interface{}) 3651 if !ok { 3652 return fmt.Errorf("unexpected JSON type %v", value) 3653 } 3654 3655 var cv []string 3656 if *v == nil { 3657 cv = []string{} 3658 } else { 3659 cv = *v 3660 } 3661 3662 for _, value := range shape { 3663 var col string 3664 if value != nil { 3665 jtv, ok := value.(string) 3666 if !ok { 3667 return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) 3668 } 3669 col = jtv 3670 } 3671 cv = append(cv, col) 3672 3673 } 3674 *v = cv 3675 return nil 3676} 3677 3678func awsRestjson1_deserializeDocumentResourceIdentifier(v **types.ResourceIdentifier, value interface{}) error { 3679 if v == nil { 3680 return fmt.Errorf("unexpected nil of type %T", v) 3681 } 3682 if value == nil { 3683 return nil 3684 } 3685 3686 shape, ok := value.(map[string]interface{}) 3687 if !ok { 3688 return fmt.Errorf("unexpected JSON type %v", value) 3689 } 3690 3691 var sv *types.ResourceIdentifier 3692 if *v == nil { 3693 sv = &types.ResourceIdentifier{} 3694 } else { 3695 sv = *v 3696 } 3697 3698 for key, value := range shape { 3699 switch key { 3700 case "ResourceArn": 3701 if value != nil { 3702 jtv, ok := value.(string) 3703 if !ok { 3704 return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) 3705 } 3706 sv.ResourceArn = ptr.String(jtv) 3707 } 3708 3709 case "ResourceType": 3710 if value != nil { 3711 jtv, ok := value.(string) 3712 if !ok { 3713 return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value) 3714 } 3715 sv.ResourceType = ptr.String(jtv) 3716 } 3717 3718 default: 3719 _, _ = key, value 3720 3721 } 3722 } 3723 *v = sv 3724 return nil 3725} 3726 3727func awsRestjson1_deserializeDocumentResourceIdentifierList(v *[]types.ResourceIdentifier, value interface{}) error { 3728 if v == nil { 3729 return fmt.Errorf("unexpected nil of type %T", v) 3730 } 3731 if value == nil { 3732 return nil 3733 } 3734 3735 shape, ok := value.([]interface{}) 3736 if !ok { 3737 return fmt.Errorf("unexpected JSON type %v", value) 3738 } 3739 3740 var cv []types.ResourceIdentifier 3741 if *v == nil { 3742 cv = []types.ResourceIdentifier{} 3743 } else { 3744 cv = *v 3745 } 3746 3747 for _, value := range shape { 3748 var col types.ResourceIdentifier 3749 destAddr := &col 3750 if err := awsRestjson1_deserializeDocumentResourceIdentifier(&destAddr, value); err != nil { 3751 return err 3752 } 3753 col = *destAddr 3754 cv = append(cv, col) 3755 3756 } 3757 *v = cv 3758 return nil 3759} 3760 3761func awsRestjson1_deserializeDocumentResourceQuery(v **types.ResourceQuery, value interface{}) error { 3762 if v == nil { 3763 return fmt.Errorf("unexpected nil of type %T", v) 3764 } 3765 if value == nil { 3766 return nil 3767 } 3768 3769 shape, ok := value.(map[string]interface{}) 3770 if !ok { 3771 return fmt.Errorf("unexpected JSON type %v", value) 3772 } 3773 3774 var sv *types.ResourceQuery 3775 if *v == nil { 3776 sv = &types.ResourceQuery{} 3777 } else { 3778 sv = *v 3779 } 3780 3781 for key, value := range shape { 3782 switch key { 3783 case "Query": 3784 if value != nil { 3785 jtv, ok := value.(string) 3786 if !ok { 3787 return fmt.Errorf("expected Query to be of type string, got %T instead", value) 3788 } 3789 sv.Query = ptr.String(jtv) 3790 } 3791 3792 case "Type": 3793 if value != nil { 3794 jtv, ok := value.(string) 3795 if !ok { 3796 return fmt.Errorf("expected QueryType to be of type string, got %T instead", value) 3797 } 3798 sv.Type = types.QueryType(jtv) 3799 } 3800 3801 default: 3802 _, _ = key, value 3803 3804 } 3805 } 3806 *v = sv 3807 return nil 3808} 3809 3810func awsRestjson1_deserializeDocumentTagKeyList(v *[]string, value interface{}) error { 3811 if v == nil { 3812 return fmt.Errorf("unexpected nil of type %T", v) 3813 } 3814 if value == nil { 3815 return nil 3816 } 3817 3818 shape, ok := value.([]interface{}) 3819 if !ok { 3820 return fmt.Errorf("unexpected JSON type %v", value) 3821 } 3822 3823 var cv []string 3824 if *v == nil { 3825 cv = []string{} 3826 } else { 3827 cv = *v 3828 } 3829 3830 for _, value := range shape { 3831 var col string 3832 if value != nil { 3833 jtv, ok := value.(string) 3834 if !ok { 3835 return fmt.Errorf("expected TagKey to be of type string, got %T instead", value) 3836 } 3837 col = jtv 3838 } 3839 cv = append(cv, col) 3840 3841 } 3842 *v = cv 3843 return nil 3844} 3845 3846func awsRestjson1_deserializeDocumentTags(v *map[string]string, value interface{}) error { 3847 if v == nil { 3848 return fmt.Errorf("unexpected nil of type %T", v) 3849 } 3850 if value == nil { 3851 return nil 3852 } 3853 3854 shape, ok := value.(map[string]interface{}) 3855 if !ok { 3856 return fmt.Errorf("unexpected JSON type %v", value) 3857 } 3858 3859 var mv map[string]string 3860 if *v == nil { 3861 mv = map[string]string{} 3862 } else { 3863 mv = *v 3864 } 3865 3866 for key, value := range shape { 3867 var parsedVal string 3868 if value != nil { 3869 jtv, ok := value.(string) 3870 if !ok { 3871 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 3872 } 3873 parsedVal = jtv 3874 } 3875 mv[key] = parsedVal 3876 3877 } 3878 *v = mv 3879 return nil 3880} 3881 3882func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 3883 if v == nil { 3884 return fmt.Errorf("unexpected nil of type %T", v) 3885 } 3886 if value == nil { 3887 return nil 3888 } 3889 3890 shape, ok := value.(map[string]interface{}) 3891 if !ok { 3892 return fmt.Errorf("unexpected JSON type %v", value) 3893 } 3894 3895 var sv *types.TooManyRequestsException 3896 if *v == nil { 3897 sv = &types.TooManyRequestsException{} 3898 } else { 3899 sv = *v 3900 } 3901 3902 for key, value := range shape { 3903 switch key { 3904 case "Message": 3905 if value != nil { 3906 jtv, ok := value.(string) 3907 if !ok { 3908 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3909 } 3910 sv.Message = ptr.String(jtv) 3911 } 3912 3913 default: 3914 _, _ = key, value 3915 3916 } 3917 } 3918 *v = sv 3919 return nil 3920} 3921 3922func awsRestjson1_deserializeDocumentUnauthorizedException(v **types.UnauthorizedException, value interface{}) error { 3923 if v == nil { 3924 return fmt.Errorf("unexpected nil of type %T", v) 3925 } 3926 if value == nil { 3927 return nil 3928 } 3929 3930 shape, ok := value.(map[string]interface{}) 3931 if !ok { 3932 return fmt.Errorf("unexpected JSON type %v", value) 3933 } 3934 3935 var sv *types.UnauthorizedException 3936 if *v == nil { 3937 sv = &types.UnauthorizedException{} 3938 } else { 3939 sv = *v 3940 } 3941 3942 for key, value := range shape { 3943 switch key { 3944 case "Message": 3945 if value != nil { 3946 jtv, ok := value.(string) 3947 if !ok { 3948 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3949 } 3950 sv.Message = ptr.String(jtv) 3951 } 3952 3953 default: 3954 _, _ = key, value 3955 3956 } 3957 } 3958 *v = sv 3959 return nil 3960} 3961