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 "Pending": 1168 if err := awsRestjson1_deserializeDocumentPendingResourceList(&sv.Pending, value); err != nil { 1169 return err 1170 } 1171 1172 case "Succeeded": 1173 if err := awsRestjson1_deserializeDocumentResourceArnList(&sv.Succeeded, value); err != nil { 1174 return err 1175 } 1176 1177 default: 1178 _, _ = key, value 1179 1180 } 1181 } 1182 *v = sv 1183 return nil 1184} 1185 1186type awsRestjson1_deserializeOpListGroupResources struct { 1187} 1188 1189func (*awsRestjson1_deserializeOpListGroupResources) ID() string { 1190 return "OperationDeserializer" 1191} 1192 1193func (m *awsRestjson1_deserializeOpListGroupResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1194 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1195) { 1196 out, metadata, err = next.HandleDeserialize(ctx, in) 1197 if err != nil { 1198 return out, metadata, err 1199 } 1200 1201 response, ok := out.RawResponse.(*smithyhttp.Response) 1202 if !ok { 1203 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1204 } 1205 1206 if response.StatusCode < 200 || response.StatusCode >= 300 { 1207 return out, metadata, awsRestjson1_deserializeOpErrorListGroupResources(response, &metadata) 1208 } 1209 output := &ListGroupResourcesOutput{} 1210 out.Result = output 1211 1212 var buff [1024]byte 1213 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1214 1215 body := io.TeeReader(response.Body, ringBuffer) 1216 1217 decoder := json.NewDecoder(body) 1218 decoder.UseNumber() 1219 var shape interface{} 1220 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1221 var snapshot bytes.Buffer 1222 io.Copy(&snapshot, ringBuffer) 1223 err = &smithy.DeserializationError{ 1224 Err: fmt.Errorf("failed to decode response body, %w", err), 1225 Snapshot: snapshot.Bytes(), 1226 } 1227 return out, metadata, err 1228 } 1229 1230 err = awsRestjson1_deserializeOpDocumentListGroupResourcesOutput(&output, shape) 1231 if err != nil { 1232 var snapshot bytes.Buffer 1233 io.Copy(&snapshot, ringBuffer) 1234 return out, metadata, &smithy.DeserializationError{ 1235 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1236 Snapshot: snapshot.Bytes(), 1237 } 1238 } 1239 1240 return out, metadata, err 1241} 1242 1243func awsRestjson1_deserializeOpErrorListGroupResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1244 var errorBuffer bytes.Buffer 1245 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1246 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1247 } 1248 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1249 1250 errorCode := "UnknownError" 1251 errorMessage := errorCode 1252 1253 code := response.Header.Get("X-Amzn-ErrorType") 1254 if len(code) != 0 { 1255 errorCode = restjson.SanitizeErrorCode(code) 1256 } 1257 1258 var buff [1024]byte 1259 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1260 1261 body := io.TeeReader(errorBody, ringBuffer) 1262 decoder := json.NewDecoder(body) 1263 decoder.UseNumber() 1264 code, message, err := restjson.GetErrorInfo(decoder) 1265 if err != nil { 1266 var snapshot bytes.Buffer 1267 io.Copy(&snapshot, ringBuffer) 1268 err = &smithy.DeserializationError{ 1269 Err: fmt.Errorf("failed to decode response body, %w", err), 1270 Snapshot: snapshot.Bytes(), 1271 } 1272 return err 1273 } 1274 1275 errorBody.Seek(0, io.SeekStart) 1276 if len(code) != 0 { 1277 errorCode = restjson.SanitizeErrorCode(code) 1278 } 1279 if len(message) != 0 { 1280 errorMessage = message 1281 } 1282 1283 switch { 1284 case strings.EqualFold("BadRequestException", errorCode): 1285 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1286 1287 case strings.EqualFold("ForbiddenException", errorCode): 1288 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1289 1290 case strings.EqualFold("InternalServerErrorException", errorCode): 1291 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1292 1293 case strings.EqualFold("MethodNotAllowedException", errorCode): 1294 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1295 1296 case strings.EqualFold("NotFoundException", errorCode): 1297 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1298 1299 case strings.EqualFold("TooManyRequestsException", errorCode): 1300 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1301 1302 case strings.EqualFold("UnauthorizedException", errorCode): 1303 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1304 1305 default: 1306 genericError := &smithy.GenericAPIError{ 1307 Code: errorCode, 1308 Message: errorMessage, 1309 } 1310 return genericError 1311 1312 } 1313} 1314 1315func awsRestjson1_deserializeOpDocumentListGroupResourcesOutput(v **ListGroupResourcesOutput, value interface{}) error { 1316 if v == nil { 1317 return fmt.Errorf("unexpected nil of type %T", v) 1318 } 1319 if value == nil { 1320 return nil 1321 } 1322 1323 shape, ok := value.(map[string]interface{}) 1324 if !ok { 1325 return fmt.Errorf("unexpected JSON type %v", value) 1326 } 1327 1328 var sv *ListGroupResourcesOutput 1329 if *v == nil { 1330 sv = &ListGroupResourcesOutput{} 1331 } else { 1332 sv = *v 1333 } 1334 1335 for key, value := range shape { 1336 switch key { 1337 case "NextToken": 1338 if value != nil { 1339 jtv, ok := value.(string) 1340 if !ok { 1341 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 1342 } 1343 sv.NextToken = ptr.String(jtv) 1344 } 1345 1346 case "QueryErrors": 1347 if err := awsRestjson1_deserializeDocumentQueryErrorList(&sv.QueryErrors, value); err != nil { 1348 return err 1349 } 1350 1351 case "ResourceIdentifiers": 1352 if err := awsRestjson1_deserializeDocumentResourceIdentifierList(&sv.ResourceIdentifiers, value); err != nil { 1353 return err 1354 } 1355 1356 case "Resources": 1357 if err := awsRestjson1_deserializeDocumentListGroupResourcesItemList(&sv.Resources, value); err != nil { 1358 return err 1359 } 1360 1361 default: 1362 _, _ = key, value 1363 1364 } 1365 } 1366 *v = sv 1367 return nil 1368} 1369 1370type awsRestjson1_deserializeOpListGroups struct { 1371} 1372 1373func (*awsRestjson1_deserializeOpListGroups) ID() string { 1374 return "OperationDeserializer" 1375} 1376 1377func (m *awsRestjson1_deserializeOpListGroups) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1378 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1379) { 1380 out, metadata, err = next.HandleDeserialize(ctx, in) 1381 if err != nil { 1382 return out, metadata, err 1383 } 1384 1385 response, ok := out.RawResponse.(*smithyhttp.Response) 1386 if !ok { 1387 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1388 } 1389 1390 if response.StatusCode < 200 || response.StatusCode >= 300 { 1391 return out, metadata, awsRestjson1_deserializeOpErrorListGroups(response, &metadata) 1392 } 1393 output := &ListGroupsOutput{} 1394 out.Result = output 1395 1396 var buff [1024]byte 1397 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1398 1399 body := io.TeeReader(response.Body, ringBuffer) 1400 1401 decoder := json.NewDecoder(body) 1402 decoder.UseNumber() 1403 var shape interface{} 1404 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1405 var snapshot bytes.Buffer 1406 io.Copy(&snapshot, ringBuffer) 1407 err = &smithy.DeserializationError{ 1408 Err: fmt.Errorf("failed to decode response body, %w", err), 1409 Snapshot: snapshot.Bytes(), 1410 } 1411 return out, metadata, err 1412 } 1413 1414 err = awsRestjson1_deserializeOpDocumentListGroupsOutput(&output, shape) 1415 if err != nil { 1416 var snapshot bytes.Buffer 1417 io.Copy(&snapshot, ringBuffer) 1418 return out, metadata, &smithy.DeserializationError{ 1419 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1420 Snapshot: snapshot.Bytes(), 1421 } 1422 } 1423 1424 return out, metadata, err 1425} 1426 1427func awsRestjson1_deserializeOpErrorListGroups(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1428 var errorBuffer bytes.Buffer 1429 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1430 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1431 } 1432 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1433 1434 errorCode := "UnknownError" 1435 errorMessage := errorCode 1436 1437 code := response.Header.Get("X-Amzn-ErrorType") 1438 if len(code) != 0 { 1439 errorCode = restjson.SanitizeErrorCode(code) 1440 } 1441 1442 var buff [1024]byte 1443 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1444 1445 body := io.TeeReader(errorBody, ringBuffer) 1446 decoder := json.NewDecoder(body) 1447 decoder.UseNumber() 1448 code, message, err := restjson.GetErrorInfo(decoder) 1449 if err != nil { 1450 var snapshot bytes.Buffer 1451 io.Copy(&snapshot, ringBuffer) 1452 err = &smithy.DeserializationError{ 1453 Err: fmt.Errorf("failed to decode response body, %w", err), 1454 Snapshot: snapshot.Bytes(), 1455 } 1456 return err 1457 } 1458 1459 errorBody.Seek(0, io.SeekStart) 1460 if len(code) != 0 { 1461 errorCode = restjson.SanitizeErrorCode(code) 1462 } 1463 if len(message) != 0 { 1464 errorMessage = message 1465 } 1466 1467 switch { 1468 case strings.EqualFold("BadRequestException", errorCode): 1469 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1470 1471 case strings.EqualFold("ForbiddenException", errorCode): 1472 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1473 1474 case strings.EqualFold("InternalServerErrorException", errorCode): 1475 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1476 1477 case strings.EqualFold("MethodNotAllowedException", errorCode): 1478 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1479 1480 case strings.EqualFold("TooManyRequestsException", errorCode): 1481 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1482 1483 default: 1484 genericError := &smithy.GenericAPIError{ 1485 Code: errorCode, 1486 Message: errorMessage, 1487 } 1488 return genericError 1489 1490 } 1491} 1492 1493func awsRestjson1_deserializeOpDocumentListGroupsOutput(v **ListGroupsOutput, value interface{}) error { 1494 if v == nil { 1495 return fmt.Errorf("unexpected nil of type %T", v) 1496 } 1497 if value == nil { 1498 return nil 1499 } 1500 1501 shape, ok := value.(map[string]interface{}) 1502 if !ok { 1503 return fmt.Errorf("unexpected JSON type %v", value) 1504 } 1505 1506 var sv *ListGroupsOutput 1507 if *v == nil { 1508 sv = &ListGroupsOutput{} 1509 } else { 1510 sv = *v 1511 } 1512 1513 for key, value := range shape { 1514 switch key { 1515 case "GroupIdentifiers": 1516 if err := awsRestjson1_deserializeDocumentGroupIdentifierList(&sv.GroupIdentifiers, value); err != nil { 1517 return err 1518 } 1519 1520 case "Groups": 1521 if err := awsRestjson1_deserializeDocumentGroupList(&sv.Groups, value); err != nil { 1522 return err 1523 } 1524 1525 case "NextToken": 1526 if value != nil { 1527 jtv, ok := value.(string) 1528 if !ok { 1529 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 1530 } 1531 sv.NextToken = ptr.String(jtv) 1532 } 1533 1534 default: 1535 _, _ = key, value 1536 1537 } 1538 } 1539 *v = sv 1540 return nil 1541} 1542 1543type awsRestjson1_deserializeOpPutGroupConfiguration struct { 1544} 1545 1546func (*awsRestjson1_deserializeOpPutGroupConfiguration) ID() string { 1547 return "OperationDeserializer" 1548} 1549 1550func (m *awsRestjson1_deserializeOpPutGroupConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1551 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1552) { 1553 out, metadata, err = next.HandleDeserialize(ctx, in) 1554 if err != nil { 1555 return out, metadata, err 1556 } 1557 1558 response, ok := out.RawResponse.(*smithyhttp.Response) 1559 if !ok { 1560 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1561 } 1562 1563 if response.StatusCode < 200 || response.StatusCode >= 300 { 1564 return out, metadata, awsRestjson1_deserializeOpErrorPutGroupConfiguration(response, &metadata) 1565 } 1566 output := &PutGroupConfigurationOutput{} 1567 out.Result = output 1568 1569 return out, metadata, err 1570} 1571 1572func awsRestjson1_deserializeOpErrorPutGroupConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1573 var errorBuffer bytes.Buffer 1574 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1575 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1576 } 1577 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1578 1579 errorCode := "UnknownError" 1580 errorMessage := errorCode 1581 1582 code := response.Header.Get("X-Amzn-ErrorType") 1583 if len(code) != 0 { 1584 errorCode = restjson.SanitizeErrorCode(code) 1585 } 1586 1587 var buff [1024]byte 1588 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1589 1590 body := io.TeeReader(errorBody, ringBuffer) 1591 decoder := json.NewDecoder(body) 1592 decoder.UseNumber() 1593 code, message, err := restjson.GetErrorInfo(decoder) 1594 if err != nil { 1595 var snapshot bytes.Buffer 1596 io.Copy(&snapshot, ringBuffer) 1597 err = &smithy.DeserializationError{ 1598 Err: fmt.Errorf("failed to decode response body, %w", err), 1599 Snapshot: snapshot.Bytes(), 1600 } 1601 return err 1602 } 1603 1604 errorBody.Seek(0, io.SeekStart) 1605 if len(code) != 0 { 1606 errorCode = restjson.SanitizeErrorCode(code) 1607 } 1608 if len(message) != 0 { 1609 errorMessage = message 1610 } 1611 1612 switch { 1613 case strings.EqualFold("BadRequestException", errorCode): 1614 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1615 1616 case strings.EqualFold("ForbiddenException", errorCode): 1617 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1618 1619 case strings.EqualFold("InternalServerErrorException", errorCode): 1620 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1621 1622 case strings.EqualFold("MethodNotAllowedException", errorCode): 1623 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1624 1625 case strings.EqualFold("NotFoundException", errorCode): 1626 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1627 1628 case strings.EqualFold("TooManyRequestsException", errorCode): 1629 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1630 1631 default: 1632 genericError := &smithy.GenericAPIError{ 1633 Code: errorCode, 1634 Message: errorMessage, 1635 } 1636 return genericError 1637 1638 } 1639} 1640 1641type awsRestjson1_deserializeOpSearchResources struct { 1642} 1643 1644func (*awsRestjson1_deserializeOpSearchResources) ID() string { 1645 return "OperationDeserializer" 1646} 1647 1648func (m *awsRestjson1_deserializeOpSearchResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1649 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1650) { 1651 out, metadata, err = next.HandleDeserialize(ctx, in) 1652 if err != nil { 1653 return out, metadata, err 1654 } 1655 1656 response, ok := out.RawResponse.(*smithyhttp.Response) 1657 if !ok { 1658 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1659 } 1660 1661 if response.StatusCode < 200 || response.StatusCode >= 300 { 1662 return out, metadata, awsRestjson1_deserializeOpErrorSearchResources(response, &metadata) 1663 } 1664 output := &SearchResourcesOutput{} 1665 out.Result = output 1666 1667 var buff [1024]byte 1668 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1669 1670 body := io.TeeReader(response.Body, ringBuffer) 1671 1672 decoder := json.NewDecoder(body) 1673 decoder.UseNumber() 1674 var shape interface{} 1675 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1676 var snapshot bytes.Buffer 1677 io.Copy(&snapshot, ringBuffer) 1678 err = &smithy.DeserializationError{ 1679 Err: fmt.Errorf("failed to decode response body, %w", err), 1680 Snapshot: snapshot.Bytes(), 1681 } 1682 return out, metadata, err 1683 } 1684 1685 err = awsRestjson1_deserializeOpDocumentSearchResourcesOutput(&output, shape) 1686 if err != nil { 1687 var snapshot bytes.Buffer 1688 io.Copy(&snapshot, ringBuffer) 1689 return out, metadata, &smithy.DeserializationError{ 1690 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1691 Snapshot: snapshot.Bytes(), 1692 } 1693 } 1694 1695 return out, metadata, err 1696} 1697 1698func awsRestjson1_deserializeOpErrorSearchResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1699 var errorBuffer bytes.Buffer 1700 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1701 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1702 } 1703 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1704 1705 errorCode := "UnknownError" 1706 errorMessage := errorCode 1707 1708 code := response.Header.Get("X-Amzn-ErrorType") 1709 if len(code) != 0 { 1710 errorCode = restjson.SanitizeErrorCode(code) 1711 } 1712 1713 var buff [1024]byte 1714 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1715 1716 body := io.TeeReader(errorBody, ringBuffer) 1717 decoder := json.NewDecoder(body) 1718 decoder.UseNumber() 1719 code, message, err := restjson.GetErrorInfo(decoder) 1720 if err != nil { 1721 var snapshot bytes.Buffer 1722 io.Copy(&snapshot, ringBuffer) 1723 err = &smithy.DeserializationError{ 1724 Err: fmt.Errorf("failed to decode response body, %w", err), 1725 Snapshot: snapshot.Bytes(), 1726 } 1727 return err 1728 } 1729 1730 errorBody.Seek(0, io.SeekStart) 1731 if len(code) != 0 { 1732 errorCode = restjson.SanitizeErrorCode(code) 1733 } 1734 if len(message) != 0 { 1735 errorMessage = message 1736 } 1737 1738 switch { 1739 case strings.EqualFold("BadRequestException", errorCode): 1740 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1741 1742 case strings.EqualFold("ForbiddenException", errorCode): 1743 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1744 1745 case strings.EqualFold("InternalServerErrorException", errorCode): 1746 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1747 1748 case strings.EqualFold("MethodNotAllowedException", errorCode): 1749 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1750 1751 case strings.EqualFold("TooManyRequestsException", errorCode): 1752 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1753 1754 case strings.EqualFold("UnauthorizedException", errorCode): 1755 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1756 1757 default: 1758 genericError := &smithy.GenericAPIError{ 1759 Code: errorCode, 1760 Message: errorMessage, 1761 } 1762 return genericError 1763 1764 } 1765} 1766 1767func awsRestjson1_deserializeOpDocumentSearchResourcesOutput(v **SearchResourcesOutput, value interface{}) error { 1768 if v == nil { 1769 return fmt.Errorf("unexpected nil of type %T", v) 1770 } 1771 if value == nil { 1772 return nil 1773 } 1774 1775 shape, ok := value.(map[string]interface{}) 1776 if !ok { 1777 return fmt.Errorf("unexpected JSON type %v", value) 1778 } 1779 1780 var sv *SearchResourcesOutput 1781 if *v == nil { 1782 sv = &SearchResourcesOutput{} 1783 } else { 1784 sv = *v 1785 } 1786 1787 for key, value := range shape { 1788 switch key { 1789 case "NextToken": 1790 if value != nil { 1791 jtv, ok := value.(string) 1792 if !ok { 1793 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 1794 } 1795 sv.NextToken = ptr.String(jtv) 1796 } 1797 1798 case "QueryErrors": 1799 if err := awsRestjson1_deserializeDocumentQueryErrorList(&sv.QueryErrors, value); err != nil { 1800 return err 1801 } 1802 1803 case "ResourceIdentifiers": 1804 if err := awsRestjson1_deserializeDocumentResourceIdentifierList(&sv.ResourceIdentifiers, value); err != nil { 1805 return err 1806 } 1807 1808 default: 1809 _, _ = key, value 1810 1811 } 1812 } 1813 *v = sv 1814 return nil 1815} 1816 1817type awsRestjson1_deserializeOpTag struct { 1818} 1819 1820func (*awsRestjson1_deserializeOpTag) ID() string { 1821 return "OperationDeserializer" 1822} 1823 1824func (m *awsRestjson1_deserializeOpTag) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1825 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1826) { 1827 out, metadata, err = next.HandleDeserialize(ctx, in) 1828 if err != nil { 1829 return out, metadata, err 1830 } 1831 1832 response, ok := out.RawResponse.(*smithyhttp.Response) 1833 if !ok { 1834 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1835 } 1836 1837 if response.StatusCode < 200 || response.StatusCode >= 300 { 1838 return out, metadata, awsRestjson1_deserializeOpErrorTag(response, &metadata) 1839 } 1840 output := &TagOutput{} 1841 out.Result = output 1842 1843 var buff [1024]byte 1844 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1845 1846 body := io.TeeReader(response.Body, ringBuffer) 1847 1848 decoder := json.NewDecoder(body) 1849 decoder.UseNumber() 1850 var shape interface{} 1851 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1852 var snapshot bytes.Buffer 1853 io.Copy(&snapshot, ringBuffer) 1854 err = &smithy.DeserializationError{ 1855 Err: fmt.Errorf("failed to decode response body, %w", err), 1856 Snapshot: snapshot.Bytes(), 1857 } 1858 return out, metadata, err 1859 } 1860 1861 err = awsRestjson1_deserializeOpDocumentTagOutput(&output, shape) 1862 if err != nil { 1863 var snapshot bytes.Buffer 1864 io.Copy(&snapshot, ringBuffer) 1865 return out, metadata, &smithy.DeserializationError{ 1866 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1867 Snapshot: snapshot.Bytes(), 1868 } 1869 } 1870 1871 return out, metadata, err 1872} 1873 1874func awsRestjson1_deserializeOpErrorTag(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1875 var errorBuffer bytes.Buffer 1876 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1877 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1878 } 1879 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1880 1881 errorCode := "UnknownError" 1882 errorMessage := errorCode 1883 1884 code := response.Header.Get("X-Amzn-ErrorType") 1885 if len(code) != 0 { 1886 errorCode = restjson.SanitizeErrorCode(code) 1887 } 1888 1889 var buff [1024]byte 1890 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1891 1892 body := io.TeeReader(errorBody, ringBuffer) 1893 decoder := json.NewDecoder(body) 1894 decoder.UseNumber() 1895 code, message, err := restjson.GetErrorInfo(decoder) 1896 if err != nil { 1897 var snapshot bytes.Buffer 1898 io.Copy(&snapshot, ringBuffer) 1899 err = &smithy.DeserializationError{ 1900 Err: fmt.Errorf("failed to decode response body, %w", err), 1901 Snapshot: snapshot.Bytes(), 1902 } 1903 return err 1904 } 1905 1906 errorBody.Seek(0, io.SeekStart) 1907 if len(code) != 0 { 1908 errorCode = restjson.SanitizeErrorCode(code) 1909 } 1910 if len(message) != 0 { 1911 errorMessage = message 1912 } 1913 1914 switch { 1915 case strings.EqualFold("BadRequestException", errorCode): 1916 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1917 1918 case strings.EqualFold("ForbiddenException", errorCode): 1919 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1920 1921 case strings.EqualFold("InternalServerErrorException", errorCode): 1922 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1923 1924 case strings.EqualFold("MethodNotAllowedException", errorCode): 1925 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 1926 1927 case strings.EqualFold("NotFoundException", errorCode): 1928 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1929 1930 case strings.EqualFold("TooManyRequestsException", errorCode): 1931 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1932 1933 default: 1934 genericError := &smithy.GenericAPIError{ 1935 Code: errorCode, 1936 Message: errorMessage, 1937 } 1938 return genericError 1939 1940 } 1941} 1942 1943func awsRestjson1_deserializeOpDocumentTagOutput(v **TagOutput, value interface{}) error { 1944 if v == nil { 1945 return fmt.Errorf("unexpected nil of type %T", v) 1946 } 1947 if value == nil { 1948 return nil 1949 } 1950 1951 shape, ok := value.(map[string]interface{}) 1952 if !ok { 1953 return fmt.Errorf("unexpected JSON type %v", value) 1954 } 1955 1956 var sv *TagOutput 1957 if *v == nil { 1958 sv = &TagOutput{} 1959 } else { 1960 sv = *v 1961 } 1962 1963 for key, value := range shape { 1964 switch key { 1965 case "Arn": 1966 if value != nil { 1967 jtv, ok := value.(string) 1968 if !ok { 1969 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 1970 } 1971 sv.Arn = ptr.String(jtv) 1972 } 1973 1974 case "Tags": 1975 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 1976 return err 1977 } 1978 1979 default: 1980 _, _ = key, value 1981 1982 } 1983 } 1984 *v = sv 1985 return nil 1986} 1987 1988type awsRestjson1_deserializeOpUngroupResources struct { 1989} 1990 1991func (*awsRestjson1_deserializeOpUngroupResources) ID() string { 1992 return "OperationDeserializer" 1993} 1994 1995func (m *awsRestjson1_deserializeOpUngroupResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1996 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1997) { 1998 out, metadata, err = next.HandleDeserialize(ctx, in) 1999 if err != nil { 2000 return out, metadata, err 2001 } 2002 2003 response, ok := out.RawResponse.(*smithyhttp.Response) 2004 if !ok { 2005 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2006 } 2007 2008 if response.StatusCode < 200 || response.StatusCode >= 300 { 2009 return out, metadata, awsRestjson1_deserializeOpErrorUngroupResources(response, &metadata) 2010 } 2011 output := &UngroupResourcesOutput{} 2012 out.Result = output 2013 2014 var buff [1024]byte 2015 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2016 2017 body := io.TeeReader(response.Body, ringBuffer) 2018 2019 decoder := json.NewDecoder(body) 2020 decoder.UseNumber() 2021 var shape interface{} 2022 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2023 var snapshot bytes.Buffer 2024 io.Copy(&snapshot, ringBuffer) 2025 err = &smithy.DeserializationError{ 2026 Err: fmt.Errorf("failed to decode response body, %w", err), 2027 Snapshot: snapshot.Bytes(), 2028 } 2029 return out, metadata, err 2030 } 2031 2032 err = awsRestjson1_deserializeOpDocumentUngroupResourcesOutput(&output, shape) 2033 if err != nil { 2034 var snapshot bytes.Buffer 2035 io.Copy(&snapshot, ringBuffer) 2036 return out, metadata, &smithy.DeserializationError{ 2037 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2038 Snapshot: snapshot.Bytes(), 2039 } 2040 } 2041 2042 return out, metadata, err 2043} 2044 2045func awsRestjson1_deserializeOpErrorUngroupResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2046 var errorBuffer bytes.Buffer 2047 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2048 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2049 } 2050 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2051 2052 errorCode := "UnknownError" 2053 errorMessage := errorCode 2054 2055 code := response.Header.Get("X-Amzn-ErrorType") 2056 if len(code) != 0 { 2057 errorCode = restjson.SanitizeErrorCode(code) 2058 } 2059 2060 var buff [1024]byte 2061 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2062 2063 body := io.TeeReader(errorBody, ringBuffer) 2064 decoder := json.NewDecoder(body) 2065 decoder.UseNumber() 2066 code, message, err := restjson.GetErrorInfo(decoder) 2067 if err != nil { 2068 var snapshot bytes.Buffer 2069 io.Copy(&snapshot, ringBuffer) 2070 err = &smithy.DeserializationError{ 2071 Err: fmt.Errorf("failed to decode response body, %w", err), 2072 Snapshot: snapshot.Bytes(), 2073 } 2074 return err 2075 } 2076 2077 errorBody.Seek(0, io.SeekStart) 2078 if len(code) != 0 { 2079 errorCode = restjson.SanitizeErrorCode(code) 2080 } 2081 if len(message) != 0 { 2082 errorMessage = message 2083 } 2084 2085 switch { 2086 case strings.EqualFold("BadRequestException", errorCode): 2087 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2088 2089 case strings.EqualFold("ForbiddenException", errorCode): 2090 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2091 2092 case strings.EqualFold("InternalServerErrorException", errorCode): 2093 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2094 2095 case strings.EqualFold("MethodNotAllowedException", errorCode): 2096 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 2097 2098 case strings.EqualFold("NotFoundException", errorCode): 2099 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2100 2101 case strings.EqualFold("TooManyRequestsException", errorCode): 2102 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2103 2104 default: 2105 genericError := &smithy.GenericAPIError{ 2106 Code: errorCode, 2107 Message: errorMessage, 2108 } 2109 return genericError 2110 2111 } 2112} 2113 2114func awsRestjson1_deserializeOpDocumentUngroupResourcesOutput(v **UngroupResourcesOutput, value interface{}) error { 2115 if v == nil { 2116 return fmt.Errorf("unexpected nil of type %T", v) 2117 } 2118 if value == nil { 2119 return nil 2120 } 2121 2122 shape, ok := value.(map[string]interface{}) 2123 if !ok { 2124 return fmt.Errorf("unexpected JSON type %v", value) 2125 } 2126 2127 var sv *UngroupResourcesOutput 2128 if *v == nil { 2129 sv = &UngroupResourcesOutput{} 2130 } else { 2131 sv = *v 2132 } 2133 2134 for key, value := range shape { 2135 switch key { 2136 case "Failed": 2137 if err := awsRestjson1_deserializeDocumentFailedResourceList(&sv.Failed, value); err != nil { 2138 return err 2139 } 2140 2141 case "Pending": 2142 if err := awsRestjson1_deserializeDocumentPendingResourceList(&sv.Pending, value); err != nil { 2143 return err 2144 } 2145 2146 case "Succeeded": 2147 if err := awsRestjson1_deserializeDocumentResourceArnList(&sv.Succeeded, value); err != nil { 2148 return err 2149 } 2150 2151 default: 2152 _, _ = key, value 2153 2154 } 2155 } 2156 *v = sv 2157 return nil 2158} 2159 2160type awsRestjson1_deserializeOpUntag struct { 2161} 2162 2163func (*awsRestjson1_deserializeOpUntag) ID() string { 2164 return "OperationDeserializer" 2165} 2166 2167func (m *awsRestjson1_deserializeOpUntag) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2168 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2169) { 2170 out, metadata, err = next.HandleDeserialize(ctx, in) 2171 if err != nil { 2172 return out, metadata, err 2173 } 2174 2175 response, ok := out.RawResponse.(*smithyhttp.Response) 2176 if !ok { 2177 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2178 } 2179 2180 if response.StatusCode < 200 || response.StatusCode >= 300 { 2181 return out, metadata, awsRestjson1_deserializeOpErrorUntag(response, &metadata) 2182 } 2183 output := &UntagOutput{} 2184 out.Result = output 2185 2186 var buff [1024]byte 2187 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2188 2189 body := io.TeeReader(response.Body, ringBuffer) 2190 2191 decoder := json.NewDecoder(body) 2192 decoder.UseNumber() 2193 var shape interface{} 2194 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2195 var snapshot bytes.Buffer 2196 io.Copy(&snapshot, ringBuffer) 2197 err = &smithy.DeserializationError{ 2198 Err: fmt.Errorf("failed to decode response body, %w", err), 2199 Snapshot: snapshot.Bytes(), 2200 } 2201 return out, metadata, err 2202 } 2203 2204 err = awsRestjson1_deserializeOpDocumentUntagOutput(&output, shape) 2205 if err != nil { 2206 var snapshot bytes.Buffer 2207 io.Copy(&snapshot, ringBuffer) 2208 return out, metadata, &smithy.DeserializationError{ 2209 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2210 Snapshot: snapshot.Bytes(), 2211 } 2212 } 2213 2214 return out, metadata, err 2215} 2216 2217func awsRestjson1_deserializeOpErrorUntag(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2218 var errorBuffer bytes.Buffer 2219 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2220 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2221 } 2222 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2223 2224 errorCode := "UnknownError" 2225 errorMessage := errorCode 2226 2227 code := response.Header.Get("X-Amzn-ErrorType") 2228 if len(code) != 0 { 2229 errorCode = restjson.SanitizeErrorCode(code) 2230 } 2231 2232 var buff [1024]byte 2233 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2234 2235 body := io.TeeReader(errorBody, ringBuffer) 2236 decoder := json.NewDecoder(body) 2237 decoder.UseNumber() 2238 code, message, err := restjson.GetErrorInfo(decoder) 2239 if err != nil { 2240 var snapshot bytes.Buffer 2241 io.Copy(&snapshot, ringBuffer) 2242 err = &smithy.DeserializationError{ 2243 Err: fmt.Errorf("failed to decode response body, %w", err), 2244 Snapshot: snapshot.Bytes(), 2245 } 2246 return err 2247 } 2248 2249 errorBody.Seek(0, io.SeekStart) 2250 if len(code) != 0 { 2251 errorCode = restjson.SanitizeErrorCode(code) 2252 } 2253 if len(message) != 0 { 2254 errorMessage = message 2255 } 2256 2257 switch { 2258 case strings.EqualFold("BadRequestException", errorCode): 2259 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2260 2261 case strings.EqualFold("ForbiddenException", errorCode): 2262 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2263 2264 case strings.EqualFold("InternalServerErrorException", errorCode): 2265 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2266 2267 case strings.EqualFold("MethodNotAllowedException", errorCode): 2268 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 2269 2270 case strings.EqualFold("NotFoundException", errorCode): 2271 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2272 2273 case strings.EqualFold("TooManyRequestsException", errorCode): 2274 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2275 2276 default: 2277 genericError := &smithy.GenericAPIError{ 2278 Code: errorCode, 2279 Message: errorMessage, 2280 } 2281 return genericError 2282 2283 } 2284} 2285 2286func awsRestjson1_deserializeOpDocumentUntagOutput(v **UntagOutput, value interface{}) error { 2287 if v == nil { 2288 return fmt.Errorf("unexpected nil of type %T", v) 2289 } 2290 if value == nil { 2291 return nil 2292 } 2293 2294 shape, ok := value.(map[string]interface{}) 2295 if !ok { 2296 return fmt.Errorf("unexpected JSON type %v", value) 2297 } 2298 2299 var sv *UntagOutput 2300 if *v == nil { 2301 sv = &UntagOutput{} 2302 } else { 2303 sv = *v 2304 } 2305 2306 for key, value := range shape { 2307 switch key { 2308 case "Arn": 2309 if value != nil { 2310 jtv, ok := value.(string) 2311 if !ok { 2312 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 2313 } 2314 sv.Arn = ptr.String(jtv) 2315 } 2316 2317 case "Keys": 2318 if err := awsRestjson1_deserializeDocumentTagKeyList(&sv.Keys, value); err != nil { 2319 return err 2320 } 2321 2322 default: 2323 _, _ = key, value 2324 2325 } 2326 } 2327 *v = sv 2328 return nil 2329} 2330 2331type awsRestjson1_deserializeOpUpdateGroup struct { 2332} 2333 2334func (*awsRestjson1_deserializeOpUpdateGroup) ID() string { 2335 return "OperationDeserializer" 2336} 2337 2338func (m *awsRestjson1_deserializeOpUpdateGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2339 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2340) { 2341 out, metadata, err = next.HandleDeserialize(ctx, in) 2342 if err != nil { 2343 return out, metadata, err 2344 } 2345 2346 response, ok := out.RawResponse.(*smithyhttp.Response) 2347 if !ok { 2348 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2349 } 2350 2351 if response.StatusCode < 200 || response.StatusCode >= 300 { 2352 return out, metadata, awsRestjson1_deserializeOpErrorUpdateGroup(response, &metadata) 2353 } 2354 output := &UpdateGroupOutput{} 2355 out.Result = output 2356 2357 var buff [1024]byte 2358 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2359 2360 body := io.TeeReader(response.Body, ringBuffer) 2361 2362 decoder := json.NewDecoder(body) 2363 decoder.UseNumber() 2364 var shape interface{} 2365 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2366 var snapshot bytes.Buffer 2367 io.Copy(&snapshot, ringBuffer) 2368 err = &smithy.DeserializationError{ 2369 Err: fmt.Errorf("failed to decode response body, %w", err), 2370 Snapshot: snapshot.Bytes(), 2371 } 2372 return out, metadata, err 2373 } 2374 2375 err = awsRestjson1_deserializeOpDocumentUpdateGroupOutput(&output, shape) 2376 if err != nil { 2377 var snapshot bytes.Buffer 2378 io.Copy(&snapshot, ringBuffer) 2379 return out, metadata, &smithy.DeserializationError{ 2380 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2381 Snapshot: snapshot.Bytes(), 2382 } 2383 } 2384 2385 return out, metadata, err 2386} 2387 2388func awsRestjson1_deserializeOpErrorUpdateGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2389 var errorBuffer bytes.Buffer 2390 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2391 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2392 } 2393 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2394 2395 errorCode := "UnknownError" 2396 errorMessage := errorCode 2397 2398 code := response.Header.Get("X-Amzn-ErrorType") 2399 if len(code) != 0 { 2400 errorCode = restjson.SanitizeErrorCode(code) 2401 } 2402 2403 var buff [1024]byte 2404 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2405 2406 body := io.TeeReader(errorBody, ringBuffer) 2407 decoder := json.NewDecoder(body) 2408 decoder.UseNumber() 2409 code, message, err := restjson.GetErrorInfo(decoder) 2410 if err != nil { 2411 var snapshot bytes.Buffer 2412 io.Copy(&snapshot, ringBuffer) 2413 err = &smithy.DeserializationError{ 2414 Err: fmt.Errorf("failed to decode response body, %w", err), 2415 Snapshot: snapshot.Bytes(), 2416 } 2417 return err 2418 } 2419 2420 errorBody.Seek(0, io.SeekStart) 2421 if len(code) != 0 { 2422 errorCode = restjson.SanitizeErrorCode(code) 2423 } 2424 if len(message) != 0 { 2425 errorMessage = message 2426 } 2427 2428 switch { 2429 case strings.EqualFold("BadRequestException", errorCode): 2430 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2431 2432 case strings.EqualFold("ForbiddenException", errorCode): 2433 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2434 2435 case strings.EqualFold("InternalServerErrorException", errorCode): 2436 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2437 2438 case strings.EqualFold("MethodNotAllowedException", errorCode): 2439 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 2440 2441 case strings.EqualFold("NotFoundException", errorCode): 2442 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2443 2444 case strings.EqualFold("TooManyRequestsException", errorCode): 2445 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2446 2447 default: 2448 genericError := &smithy.GenericAPIError{ 2449 Code: errorCode, 2450 Message: errorMessage, 2451 } 2452 return genericError 2453 2454 } 2455} 2456 2457func awsRestjson1_deserializeOpDocumentUpdateGroupOutput(v **UpdateGroupOutput, value interface{}) error { 2458 if v == nil { 2459 return fmt.Errorf("unexpected nil of type %T", v) 2460 } 2461 if value == nil { 2462 return nil 2463 } 2464 2465 shape, ok := value.(map[string]interface{}) 2466 if !ok { 2467 return fmt.Errorf("unexpected JSON type %v", value) 2468 } 2469 2470 var sv *UpdateGroupOutput 2471 if *v == nil { 2472 sv = &UpdateGroupOutput{} 2473 } else { 2474 sv = *v 2475 } 2476 2477 for key, value := range shape { 2478 switch key { 2479 case "Group": 2480 if err := awsRestjson1_deserializeDocumentGroup(&sv.Group, value); err != nil { 2481 return err 2482 } 2483 2484 default: 2485 _, _ = key, value 2486 2487 } 2488 } 2489 *v = sv 2490 return nil 2491} 2492 2493type awsRestjson1_deserializeOpUpdateGroupQuery struct { 2494} 2495 2496func (*awsRestjson1_deserializeOpUpdateGroupQuery) ID() string { 2497 return "OperationDeserializer" 2498} 2499 2500func (m *awsRestjson1_deserializeOpUpdateGroupQuery) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2501 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2502) { 2503 out, metadata, err = next.HandleDeserialize(ctx, in) 2504 if err != nil { 2505 return out, metadata, err 2506 } 2507 2508 response, ok := out.RawResponse.(*smithyhttp.Response) 2509 if !ok { 2510 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2511 } 2512 2513 if response.StatusCode < 200 || response.StatusCode >= 300 { 2514 return out, metadata, awsRestjson1_deserializeOpErrorUpdateGroupQuery(response, &metadata) 2515 } 2516 output := &UpdateGroupQueryOutput{} 2517 out.Result = output 2518 2519 var buff [1024]byte 2520 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2521 2522 body := io.TeeReader(response.Body, ringBuffer) 2523 2524 decoder := json.NewDecoder(body) 2525 decoder.UseNumber() 2526 var shape interface{} 2527 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2528 var snapshot bytes.Buffer 2529 io.Copy(&snapshot, ringBuffer) 2530 err = &smithy.DeserializationError{ 2531 Err: fmt.Errorf("failed to decode response body, %w", err), 2532 Snapshot: snapshot.Bytes(), 2533 } 2534 return out, metadata, err 2535 } 2536 2537 err = awsRestjson1_deserializeOpDocumentUpdateGroupQueryOutput(&output, shape) 2538 if err != nil { 2539 var snapshot bytes.Buffer 2540 io.Copy(&snapshot, ringBuffer) 2541 return out, metadata, &smithy.DeserializationError{ 2542 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2543 Snapshot: snapshot.Bytes(), 2544 } 2545 } 2546 2547 return out, metadata, err 2548} 2549 2550func awsRestjson1_deserializeOpErrorUpdateGroupQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2551 var errorBuffer bytes.Buffer 2552 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2553 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2554 } 2555 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2556 2557 errorCode := "UnknownError" 2558 errorMessage := errorCode 2559 2560 code := response.Header.Get("X-Amzn-ErrorType") 2561 if len(code) != 0 { 2562 errorCode = restjson.SanitizeErrorCode(code) 2563 } 2564 2565 var buff [1024]byte 2566 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2567 2568 body := io.TeeReader(errorBody, ringBuffer) 2569 decoder := json.NewDecoder(body) 2570 decoder.UseNumber() 2571 code, message, err := restjson.GetErrorInfo(decoder) 2572 if err != nil { 2573 var snapshot bytes.Buffer 2574 io.Copy(&snapshot, ringBuffer) 2575 err = &smithy.DeserializationError{ 2576 Err: fmt.Errorf("failed to decode response body, %w", err), 2577 Snapshot: snapshot.Bytes(), 2578 } 2579 return err 2580 } 2581 2582 errorBody.Seek(0, io.SeekStart) 2583 if len(code) != 0 { 2584 errorCode = restjson.SanitizeErrorCode(code) 2585 } 2586 if len(message) != 0 { 2587 errorMessage = message 2588 } 2589 2590 switch { 2591 case strings.EqualFold("BadRequestException", errorCode): 2592 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2593 2594 case strings.EqualFold("ForbiddenException", errorCode): 2595 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2596 2597 case strings.EqualFold("InternalServerErrorException", errorCode): 2598 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2599 2600 case strings.EqualFold("MethodNotAllowedException", errorCode): 2601 return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) 2602 2603 case strings.EqualFold("NotFoundException", errorCode): 2604 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2605 2606 case strings.EqualFold("TooManyRequestsException", errorCode): 2607 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2608 2609 default: 2610 genericError := &smithy.GenericAPIError{ 2611 Code: errorCode, 2612 Message: errorMessage, 2613 } 2614 return genericError 2615 2616 } 2617} 2618 2619func awsRestjson1_deserializeOpDocumentUpdateGroupQueryOutput(v **UpdateGroupQueryOutput, value interface{}) error { 2620 if v == nil { 2621 return fmt.Errorf("unexpected nil of type %T", v) 2622 } 2623 if value == nil { 2624 return nil 2625 } 2626 2627 shape, ok := value.(map[string]interface{}) 2628 if !ok { 2629 return fmt.Errorf("unexpected JSON type %v", value) 2630 } 2631 2632 var sv *UpdateGroupQueryOutput 2633 if *v == nil { 2634 sv = &UpdateGroupQueryOutput{} 2635 } else { 2636 sv = *v 2637 } 2638 2639 for key, value := range shape { 2640 switch key { 2641 case "GroupQuery": 2642 if err := awsRestjson1_deserializeDocumentGroupQuery(&sv.GroupQuery, value); err != nil { 2643 return err 2644 } 2645 2646 default: 2647 _, _ = key, value 2648 2649 } 2650 } 2651 *v = sv 2652 return nil 2653} 2654 2655func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2656 output := &types.BadRequestException{} 2657 var buff [1024]byte 2658 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2659 2660 body := io.TeeReader(errorBody, ringBuffer) 2661 decoder := json.NewDecoder(body) 2662 decoder.UseNumber() 2663 var shape interface{} 2664 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2665 var snapshot bytes.Buffer 2666 io.Copy(&snapshot, ringBuffer) 2667 err = &smithy.DeserializationError{ 2668 Err: fmt.Errorf("failed to decode response body, %w", err), 2669 Snapshot: snapshot.Bytes(), 2670 } 2671 return err 2672 } 2673 2674 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 2675 2676 if err != nil { 2677 var snapshot bytes.Buffer 2678 io.Copy(&snapshot, ringBuffer) 2679 err = &smithy.DeserializationError{ 2680 Err: fmt.Errorf("failed to decode response body, %w", err), 2681 Snapshot: snapshot.Bytes(), 2682 } 2683 return err 2684 } 2685 2686 errorBody.Seek(0, io.SeekStart) 2687 2688 return output 2689} 2690 2691func awsRestjson1_deserializeErrorForbiddenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2692 output := &types.ForbiddenException{} 2693 var buff [1024]byte 2694 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2695 2696 body := io.TeeReader(errorBody, ringBuffer) 2697 decoder := json.NewDecoder(body) 2698 decoder.UseNumber() 2699 var shape interface{} 2700 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2701 var snapshot bytes.Buffer 2702 io.Copy(&snapshot, ringBuffer) 2703 err = &smithy.DeserializationError{ 2704 Err: fmt.Errorf("failed to decode response body, %w", err), 2705 Snapshot: snapshot.Bytes(), 2706 } 2707 return err 2708 } 2709 2710 err := awsRestjson1_deserializeDocumentForbiddenException(&output, shape) 2711 2712 if err != nil { 2713 var snapshot bytes.Buffer 2714 io.Copy(&snapshot, ringBuffer) 2715 err = &smithy.DeserializationError{ 2716 Err: fmt.Errorf("failed to decode response body, %w", err), 2717 Snapshot: snapshot.Bytes(), 2718 } 2719 return err 2720 } 2721 2722 errorBody.Seek(0, io.SeekStart) 2723 2724 return output 2725} 2726 2727func awsRestjson1_deserializeErrorInternalServerErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2728 output := &types.InternalServerErrorException{} 2729 var buff [1024]byte 2730 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2731 2732 body := io.TeeReader(errorBody, ringBuffer) 2733 decoder := json.NewDecoder(body) 2734 decoder.UseNumber() 2735 var shape interface{} 2736 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2737 var snapshot bytes.Buffer 2738 io.Copy(&snapshot, ringBuffer) 2739 err = &smithy.DeserializationError{ 2740 Err: fmt.Errorf("failed to decode response body, %w", err), 2741 Snapshot: snapshot.Bytes(), 2742 } 2743 return err 2744 } 2745 2746 err := awsRestjson1_deserializeDocumentInternalServerErrorException(&output, shape) 2747 2748 if err != nil { 2749 var snapshot bytes.Buffer 2750 io.Copy(&snapshot, ringBuffer) 2751 err = &smithy.DeserializationError{ 2752 Err: fmt.Errorf("failed to decode response body, %w", err), 2753 Snapshot: snapshot.Bytes(), 2754 } 2755 return err 2756 } 2757 2758 errorBody.Seek(0, io.SeekStart) 2759 2760 return output 2761} 2762 2763func awsRestjson1_deserializeErrorMethodNotAllowedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2764 output := &types.MethodNotAllowedException{} 2765 var buff [1024]byte 2766 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2767 2768 body := io.TeeReader(errorBody, ringBuffer) 2769 decoder := json.NewDecoder(body) 2770 decoder.UseNumber() 2771 var shape interface{} 2772 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2773 var snapshot bytes.Buffer 2774 io.Copy(&snapshot, ringBuffer) 2775 err = &smithy.DeserializationError{ 2776 Err: fmt.Errorf("failed to decode response body, %w", err), 2777 Snapshot: snapshot.Bytes(), 2778 } 2779 return err 2780 } 2781 2782 err := awsRestjson1_deserializeDocumentMethodNotAllowedException(&output, shape) 2783 2784 if err != nil { 2785 var snapshot bytes.Buffer 2786 io.Copy(&snapshot, ringBuffer) 2787 err = &smithy.DeserializationError{ 2788 Err: fmt.Errorf("failed to decode response body, %w", err), 2789 Snapshot: snapshot.Bytes(), 2790 } 2791 return err 2792 } 2793 2794 errorBody.Seek(0, io.SeekStart) 2795 2796 return output 2797} 2798 2799func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2800 output := &types.NotFoundException{} 2801 var buff [1024]byte 2802 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2803 2804 body := io.TeeReader(errorBody, ringBuffer) 2805 decoder := json.NewDecoder(body) 2806 decoder.UseNumber() 2807 var shape interface{} 2808 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2809 var snapshot bytes.Buffer 2810 io.Copy(&snapshot, ringBuffer) 2811 err = &smithy.DeserializationError{ 2812 Err: fmt.Errorf("failed to decode response body, %w", err), 2813 Snapshot: snapshot.Bytes(), 2814 } 2815 return err 2816 } 2817 2818 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 2819 2820 if err != nil { 2821 var snapshot bytes.Buffer 2822 io.Copy(&snapshot, ringBuffer) 2823 err = &smithy.DeserializationError{ 2824 Err: fmt.Errorf("failed to decode response body, %w", err), 2825 Snapshot: snapshot.Bytes(), 2826 } 2827 return err 2828 } 2829 2830 errorBody.Seek(0, io.SeekStart) 2831 2832 return output 2833} 2834 2835func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2836 output := &types.TooManyRequestsException{} 2837 var buff [1024]byte 2838 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2839 2840 body := io.TeeReader(errorBody, ringBuffer) 2841 decoder := json.NewDecoder(body) 2842 decoder.UseNumber() 2843 var shape interface{} 2844 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2845 var snapshot bytes.Buffer 2846 io.Copy(&snapshot, ringBuffer) 2847 err = &smithy.DeserializationError{ 2848 Err: fmt.Errorf("failed to decode response body, %w", err), 2849 Snapshot: snapshot.Bytes(), 2850 } 2851 return err 2852 } 2853 2854 err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) 2855 2856 if err != nil { 2857 var snapshot bytes.Buffer 2858 io.Copy(&snapshot, ringBuffer) 2859 err = &smithy.DeserializationError{ 2860 Err: fmt.Errorf("failed to decode response body, %w", err), 2861 Snapshot: snapshot.Bytes(), 2862 } 2863 return err 2864 } 2865 2866 errorBody.Seek(0, io.SeekStart) 2867 2868 return output 2869} 2870 2871func awsRestjson1_deserializeErrorUnauthorizedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2872 output := &types.UnauthorizedException{} 2873 var buff [1024]byte 2874 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2875 2876 body := io.TeeReader(errorBody, ringBuffer) 2877 decoder := json.NewDecoder(body) 2878 decoder.UseNumber() 2879 var shape interface{} 2880 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2881 var snapshot bytes.Buffer 2882 io.Copy(&snapshot, ringBuffer) 2883 err = &smithy.DeserializationError{ 2884 Err: fmt.Errorf("failed to decode response body, %w", err), 2885 Snapshot: snapshot.Bytes(), 2886 } 2887 return err 2888 } 2889 2890 err := awsRestjson1_deserializeDocumentUnauthorizedException(&output, shape) 2891 2892 if err != nil { 2893 var snapshot bytes.Buffer 2894 io.Copy(&snapshot, ringBuffer) 2895 err = &smithy.DeserializationError{ 2896 Err: fmt.Errorf("failed to decode response body, %w", err), 2897 Snapshot: snapshot.Bytes(), 2898 } 2899 return err 2900 } 2901 2902 errorBody.Seek(0, io.SeekStart) 2903 2904 return output 2905} 2906 2907func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 2908 if v == nil { 2909 return fmt.Errorf("unexpected nil of type %T", v) 2910 } 2911 if value == nil { 2912 return nil 2913 } 2914 2915 shape, ok := value.(map[string]interface{}) 2916 if !ok { 2917 return fmt.Errorf("unexpected JSON type %v", value) 2918 } 2919 2920 var sv *types.BadRequestException 2921 if *v == nil { 2922 sv = &types.BadRequestException{} 2923 } else { 2924 sv = *v 2925 } 2926 2927 for key, value := range shape { 2928 switch key { 2929 case "Message": 2930 if value != nil { 2931 jtv, ok := value.(string) 2932 if !ok { 2933 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 2934 } 2935 sv.Message = ptr.String(jtv) 2936 } 2937 2938 default: 2939 _, _ = key, value 2940 2941 } 2942 } 2943 *v = sv 2944 return nil 2945} 2946 2947func awsRestjson1_deserializeDocumentFailedResource(v **types.FailedResource, value interface{}) error { 2948 if v == nil { 2949 return fmt.Errorf("unexpected nil of type %T", v) 2950 } 2951 if value == nil { 2952 return nil 2953 } 2954 2955 shape, ok := value.(map[string]interface{}) 2956 if !ok { 2957 return fmt.Errorf("unexpected JSON type %v", value) 2958 } 2959 2960 var sv *types.FailedResource 2961 if *v == nil { 2962 sv = &types.FailedResource{} 2963 } else { 2964 sv = *v 2965 } 2966 2967 for key, value := range shape { 2968 switch key { 2969 case "ErrorCode": 2970 if value != nil { 2971 jtv, ok := value.(string) 2972 if !ok { 2973 return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value) 2974 } 2975 sv.ErrorCode = ptr.String(jtv) 2976 } 2977 2978 case "ErrorMessage": 2979 if value != nil { 2980 jtv, ok := value.(string) 2981 if !ok { 2982 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 2983 } 2984 sv.ErrorMessage = ptr.String(jtv) 2985 } 2986 2987 case "ResourceArn": 2988 if value != nil { 2989 jtv, ok := value.(string) 2990 if !ok { 2991 return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) 2992 } 2993 sv.ResourceArn = ptr.String(jtv) 2994 } 2995 2996 default: 2997 _, _ = key, value 2998 2999 } 3000 } 3001 *v = sv 3002 return nil 3003} 3004 3005func awsRestjson1_deserializeDocumentFailedResourceList(v *[]types.FailedResource, value interface{}) error { 3006 if v == nil { 3007 return fmt.Errorf("unexpected nil of type %T", v) 3008 } 3009 if value == nil { 3010 return nil 3011 } 3012 3013 shape, ok := value.([]interface{}) 3014 if !ok { 3015 return fmt.Errorf("unexpected JSON type %v", value) 3016 } 3017 3018 var cv []types.FailedResource 3019 if *v == nil { 3020 cv = []types.FailedResource{} 3021 } else { 3022 cv = *v 3023 } 3024 3025 for _, value := range shape { 3026 var col types.FailedResource 3027 destAddr := &col 3028 if err := awsRestjson1_deserializeDocumentFailedResource(&destAddr, value); err != nil { 3029 return err 3030 } 3031 col = *destAddr 3032 cv = append(cv, col) 3033 3034 } 3035 *v = cv 3036 return nil 3037} 3038 3039func awsRestjson1_deserializeDocumentForbiddenException(v **types.ForbiddenException, value interface{}) error { 3040 if v == nil { 3041 return fmt.Errorf("unexpected nil of type %T", v) 3042 } 3043 if value == nil { 3044 return nil 3045 } 3046 3047 shape, ok := value.(map[string]interface{}) 3048 if !ok { 3049 return fmt.Errorf("unexpected JSON type %v", value) 3050 } 3051 3052 var sv *types.ForbiddenException 3053 if *v == nil { 3054 sv = &types.ForbiddenException{} 3055 } else { 3056 sv = *v 3057 } 3058 3059 for key, value := range shape { 3060 switch key { 3061 case "Message": 3062 if value != nil { 3063 jtv, ok := value.(string) 3064 if !ok { 3065 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3066 } 3067 sv.Message = ptr.String(jtv) 3068 } 3069 3070 default: 3071 _, _ = key, value 3072 3073 } 3074 } 3075 *v = sv 3076 return nil 3077} 3078 3079func awsRestjson1_deserializeDocumentGroup(v **types.Group, value interface{}) error { 3080 if v == nil { 3081 return fmt.Errorf("unexpected nil of type %T", v) 3082 } 3083 if value == nil { 3084 return nil 3085 } 3086 3087 shape, ok := value.(map[string]interface{}) 3088 if !ok { 3089 return fmt.Errorf("unexpected JSON type %v", value) 3090 } 3091 3092 var sv *types.Group 3093 if *v == nil { 3094 sv = &types.Group{} 3095 } else { 3096 sv = *v 3097 } 3098 3099 for key, value := range shape { 3100 switch key { 3101 case "Description": 3102 if value != nil { 3103 jtv, ok := value.(string) 3104 if !ok { 3105 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 3106 } 3107 sv.Description = ptr.String(jtv) 3108 } 3109 3110 case "GroupArn": 3111 if value != nil { 3112 jtv, ok := value.(string) 3113 if !ok { 3114 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 3115 } 3116 sv.GroupArn = ptr.String(jtv) 3117 } 3118 3119 case "Name": 3120 if value != nil { 3121 jtv, ok := value.(string) 3122 if !ok { 3123 return fmt.Errorf("expected GroupName to be of type string, got %T instead", value) 3124 } 3125 sv.Name = ptr.String(jtv) 3126 } 3127 3128 default: 3129 _, _ = key, value 3130 3131 } 3132 } 3133 *v = sv 3134 return nil 3135} 3136 3137func awsRestjson1_deserializeDocumentGroupConfiguration(v **types.GroupConfiguration, value interface{}) error { 3138 if v == nil { 3139 return fmt.Errorf("unexpected nil of type %T", v) 3140 } 3141 if value == nil { 3142 return nil 3143 } 3144 3145 shape, ok := value.(map[string]interface{}) 3146 if !ok { 3147 return fmt.Errorf("unexpected JSON type %v", value) 3148 } 3149 3150 var sv *types.GroupConfiguration 3151 if *v == nil { 3152 sv = &types.GroupConfiguration{} 3153 } else { 3154 sv = *v 3155 } 3156 3157 for key, value := range shape { 3158 switch key { 3159 case "Configuration": 3160 if err := awsRestjson1_deserializeDocumentGroupConfigurationList(&sv.Configuration, value); err != nil { 3161 return err 3162 } 3163 3164 case "FailureReason": 3165 if value != nil { 3166 jtv, ok := value.(string) 3167 if !ok { 3168 return fmt.Errorf("expected GroupConfigurationFailureReason to be of type string, got %T instead", value) 3169 } 3170 sv.FailureReason = ptr.String(jtv) 3171 } 3172 3173 case "ProposedConfiguration": 3174 if err := awsRestjson1_deserializeDocumentGroupConfigurationList(&sv.ProposedConfiguration, value); err != nil { 3175 return err 3176 } 3177 3178 case "Status": 3179 if value != nil { 3180 jtv, ok := value.(string) 3181 if !ok { 3182 return fmt.Errorf("expected GroupConfigurationStatus to be of type string, got %T instead", value) 3183 } 3184 sv.Status = types.GroupConfigurationStatus(jtv) 3185 } 3186 3187 default: 3188 _, _ = key, value 3189 3190 } 3191 } 3192 *v = sv 3193 return nil 3194} 3195 3196func awsRestjson1_deserializeDocumentGroupConfigurationItem(v **types.GroupConfigurationItem, value interface{}) error { 3197 if v == nil { 3198 return fmt.Errorf("unexpected nil of type %T", v) 3199 } 3200 if value == nil { 3201 return nil 3202 } 3203 3204 shape, ok := value.(map[string]interface{}) 3205 if !ok { 3206 return fmt.Errorf("unexpected JSON type %v", value) 3207 } 3208 3209 var sv *types.GroupConfigurationItem 3210 if *v == nil { 3211 sv = &types.GroupConfigurationItem{} 3212 } else { 3213 sv = *v 3214 } 3215 3216 for key, value := range shape { 3217 switch key { 3218 case "Parameters": 3219 if err := awsRestjson1_deserializeDocumentGroupParameterList(&sv.Parameters, value); err != nil { 3220 return err 3221 } 3222 3223 case "Type": 3224 if value != nil { 3225 jtv, ok := value.(string) 3226 if !ok { 3227 return fmt.Errorf("expected GroupConfigurationType to be of type string, got %T instead", value) 3228 } 3229 sv.Type = ptr.String(jtv) 3230 } 3231 3232 default: 3233 _, _ = key, value 3234 3235 } 3236 } 3237 *v = sv 3238 return nil 3239} 3240 3241func awsRestjson1_deserializeDocumentGroupConfigurationList(v *[]types.GroupConfigurationItem, value interface{}) error { 3242 if v == nil { 3243 return fmt.Errorf("unexpected nil of type %T", v) 3244 } 3245 if value == nil { 3246 return nil 3247 } 3248 3249 shape, ok := value.([]interface{}) 3250 if !ok { 3251 return fmt.Errorf("unexpected JSON type %v", value) 3252 } 3253 3254 var cv []types.GroupConfigurationItem 3255 if *v == nil { 3256 cv = []types.GroupConfigurationItem{} 3257 } else { 3258 cv = *v 3259 } 3260 3261 for _, value := range shape { 3262 var col types.GroupConfigurationItem 3263 destAddr := &col 3264 if err := awsRestjson1_deserializeDocumentGroupConfigurationItem(&destAddr, value); err != nil { 3265 return err 3266 } 3267 col = *destAddr 3268 cv = append(cv, col) 3269 3270 } 3271 *v = cv 3272 return nil 3273} 3274 3275func awsRestjson1_deserializeDocumentGroupConfigurationParameter(v **types.GroupConfigurationParameter, value interface{}) error { 3276 if v == nil { 3277 return fmt.Errorf("unexpected nil of type %T", v) 3278 } 3279 if value == nil { 3280 return nil 3281 } 3282 3283 shape, ok := value.(map[string]interface{}) 3284 if !ok { 3285 return fmt.Errorf("unexpected JSON type %v", value) 3286 } 3287 3288 var sv *types.GroupConfigurationParameter 3289 if *v == nil { 3290 sv = &types.GroupConfigurationParameter{} 3291 } else { 3292 sv = *v 3293 } 3294 3295 for key, value := range shape { 3296 switch key { 3297 case "Name": 3298 if value != nil { 3299 jtv, ok := value.(string) 3300 if !ok { 3301 return fmt.Errorf("expected GroupConfigurationParameterName to be of type string, got %T instead", value) 3302 } 3303 sv.Name = ptr.String(jtv) 3304 } 3305 3306 case "Values": 3307 if err := awsRestjson1_deserializeDocumentGroupConfigurationParameterValueList(&sv.Values, value); err != nil { 3308 return err 3309 } 3310 3311 default: 3312 _, _ = key, value 3313 3314 } 3315 } 3316 *v = sv 3317 return nil 3318} 3319 3320func awsRestjson1_deserializeDocumentGroupConfigurationParameterValueList(v *[]string, value interface{}) error { 3321 if v == nil { 3322 return fmt.Errorf("unexpected nil of type %T", v) 3323 } 3324 if value == nil { 3325 return nil 3326 } 3327 3328 shape, ok := value.([]interface{}) 3329 if !ok { 3330 return fmt.Errorf("unexpected JSON type %v", value) 3331 } 3332 3333 var cv []string 3334 if *v == nil { 3335 cv = []string{} 3336 } else { 3337 cv = *v 3338 } 3339 3340 for _, value := range shape { 3341 var col string 3342 if value != nil { 3343 jtv, ok := value.(string) 3344 if !ok { 3345 return fmt.Errorf("expected GroupConfigurationParameterValue to be of type string, got %T instead", value) 3346 } 3347 col = jtv 3348 } 3349 cv = append(cv, col) 3350 3351 } 3352 *v = cv 3353 return nil 3354} 3355 3356func awsRestjson1_deserializeDocumentGroupIdentifier(v **types.GroupIdentifier, value interface{}) error { 3357 if v == nil { 3358 return fmt.Errorf("unexpected nil of type %T", v) 3359 } 3360 if value == nil { 3361 return nil 3362 } 3363 3364 shape, ok := value.(map[string]interface{}) 3365 if !ok { 3366 return fmt.Errorf("unexpected JSON type %v", value) 3367 } 3368 3369 var sv *types.GroupIdentifier 3370 if *v == nil { 3371 sv = &types.GroupIdentifier{} 3372 } else { 3373 sv = *v 3374 } 3375 3376 for key, value := range shape { 3377 switch key { 3378 case "GroupArn": 3379 if value != nil { 3380 jtv, ok := value.(string) 3381 if !ok { 3382 return fmt.Errorf("expected GroupArn to be of type string, got %T instead", value) 3383 } 3384 sv.GroupArn = ptr.String(jtv) 3385 } 3386 3387 case "GroupName": 3388 if value != nil { 3389 jtv, ok := value.(string) 3390 if !ok { 3391 return fmt.Errorf("expected GroupName to be of type string, got %T instead", value) 3392 } 3393 sv.GroupName = ptr.String(jtv) 3394 } 3395 3396 default: 3397 _, _ = key, value 3398 3399 } 3400 } 3401 *v = sv 3402 return nil 3403} 3404 3405func awsRestjson1_deserializeDocumentGroupIdentifierList(v *[]types.GroupIdentifier, value interface{}) error { 3406 if v == nil { 3407 return fmt.Errorf("unexpected nil of type %T", v) 3408 } 3409 if value == nil { 3410 return nil 3411 } 3412 3413 shape, ok := value.([]interface{}) 3414 if !ok { 3415 return fmt.Errorf("unexpected JSON type %v", value) 3416 } 3417 3418 var cv []types.GroupIdentifier 3419 if *v == nil { 3420 cv = []types.GroupIdentifier{} 3421 } else { 3422 cv = *v 3423 } 3424 3425 for _, value := range shape { 3426 var col types.GroupIdentifier 3427 destAddr := &col 3428 if err := awsRestjson1_deserializeDocumentGroupIdentifier(&destAddr, value); err != nil { 3429 return err 3430 } 3431 col = *destAddr 3432 cv = append(cv, col) 3433 3434 } 3435 *v = cv 3436 return nil 3437} 3438 3439func awsRestjson1_deserializeDocumentGroupList(v *[]types.Group, 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.([]interface{}) 3448 if !ok { 3449 return fmt.Errorf("unexpected JSON type %v", value) 3450 } 3451 3452 var cv []types.Group 3453 if *v == nil { 3454 cv = []types.Group{} 3455 } else { 3456 cv = *v 3457 } 3458 3459 for _, value := range shape { 3460 var col types.Group 3461 destAddr := &col 3462 if err := awsRestjson1_deserializeDocumentGroup(&destAddr, value); err != nil { 3463 return err 3464 } 3465 col = *destAddr 3466 cv = append(cv, col) 3467 3468 } 3469 *v = cv 3470 return nil 3471} 3472 3473func awsRestjson1_deserializeDocumentGroupParameterList(v *[]types.GroupConfigurationParameter, value interface{}) error { 3474 if v == nil { 3475 return fmt.Errorf("unexpected nil of type %T", v) 3476 } 3477 if value == nil { 3478 return nil 3479 } 3480 3481 shape, ok := value.([]interface{}) 3482 if !ok { 3483 return fmt.Errorf("unexpected JSON type %v", value) 3484 } 3485 3486 var cv []types.GroupConfigurationParameter 3487 if *v == nil { 3488 cv = []types.GroupConfigurationParameter{} 3489 } else { 3490 cv = *v 3491 } 3492 3493 for _, value := range shape { 3494 var col types.GroupConfigurationParameter 3495 destAddr := &col 3496 if err := awsRestjson1_deserializeDocumentGroupConfigurationParameter(&destAddr, value); err != nil { 3497 return err 3498 } 3499 col = *destAddr 3500 cv = append(cv, col) 3501 3502 } 3503 *v = cv 3504 return nil 3505} 3506 3507func awsRestjson1_deserializeDocumentGroupQuery(v **types.GroupQuery, value interface{}) error { 3508 if v == nil { 3509 return fmt.Errorf("unexpected nil of type %T", v) 3510 } 3511 if value == nil { 3512 return nil 3513 } 3514 3515 shape, ok := value.(map[string]interface{}) 3516 if !ok { 3517 return fmt.Errorf("unexpected JSON type %v", value) 3518 } 3519 3520 var sv *types.GroupQuery 3521 if *v == nil { 3522 sv = &types.GroupQuery{} 3523 } else { 3524 sv = *v 3525 } 3526 3527 for key, value := range shape { 3528 switch key { 3529 case "GroupName": 3530 if value != nil { 3531 jtv, ok := value.(string) 3532 if !ok { 3533 return fmt.Errorf("expected GroupName to be of type string, got %T instead", value) 3534 } 3535 sv.GroupName = ptr.String(jtv) 3536 } 3537 3538 case "ResourceQuery": 3539 if err := awsRestjson1_deserializeDocumentResourceQuery(&sv.ResourceQuery, value); err != nil { 3540 return err 3541 } 3542 3543 default: 3544 _, _ = key, value 3545 3546 } 3547 } 3548 *v = sv 3549 return nil 3550} 3551 3552func awsRestjson1_deserializeDocumentInternalServerErrorException(v **types.InternalServerErrorException, value interface{}) error { 3553 if v == nil { 3554 return fmt.Errorf("unexpected nil of type %T", v) 3555 } 3556 if value == nil { 3557 return nil 3558 } 3559 3560 shape, ok := value.(map[string]interface{}) 3561 if !ok { 3562 return fmt.Errorf("unexpected JSON type %v", value) 3563 } 3564 3565 var sv *types.InternalServerErrorException 3566 if *v == nil { 3567 sv = &types.InternalServerErrorException{} 3568 } else { 3569 sv = *v 3570 } 3571 3572 for key, value := range shape { 3573 switch key { 3574 case "Message": 3575 if value != nil { 3576 jtv, ok := value.(string) 3577 if !ok { 3578 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3579 } 3580 sv.Message = ptr.String(jtv) 3581 } 3582 3583 default: 3584 _, _ = key, value 3585 3586 } 3587 } 3588 *v = sv 3589 return nil 3590} 3591 3592func awsRestjson1_deserializeDocumentListGroupResourcesItem(v **types.ListGroupResourcesItem, value interface{}) error { 3593 if v == nil { 3594 return fmt.Errorf("unexpected nil of type %T", v) 3595 } 3596 if value == nil { 3597 return nil 3598 } 3599 3600 shape, ok := value.(map[string]interface{}) 3601 if !ok { 3602 return fmt.Errorf("unexpected JSON type %v", value) 3603 } 3604 3605 var sv *types.ListGroupResourcesItem 3606 if *v == nil { 3607 sv = &types.ListGroupResourcesItem{} 3608 } else { 3609 sv = *v 3610 } 3611 3612 for key, value := range shape { 3613 switch key { 3614 case "Identifier": 3615 if err := awsRestjson1_deserializeDocumentResourceIdentifier(&sv.Identifier, value); err != nil { 3616 return err 3617 } 3618 3619 case "Status": 3620 if err := awsRestjson1_deserializeDocumentResourceStatus(&sv.Status, value); err != nil { 3621 return err 3622 } 3623 3624 default: 3625 _, _ = key, value 3626 3627 } 3628 } 3629 *v = sv 3630 return nil 3631} 3632 3633func awsRestjson1_deserializeDocumentListGroupResourcesItemList(v *[]types.ListGroupResourcesItem, value interface{}) error { 3634 if v == nil { 3635 return fmt.Errorf("unexpected nil of type %T", v) 3636 } 3637 if value == nil { 3638 return nil 3639 } 3640 3641 shape, ok := value.([]interface{}) 3642 if !ok { 3643 return fmt.Errorf("unexpected JSON type %v", value) 3644 } 3645 3646 var cv []types.ListGroupResourcesItem 3647 if *v == nil { 3648 cv = []types.ListGroupResourcesItem{} 3649 } else { 3650 cv = *v 3651 } 3652 3653 for _, value := range shape { 3654 var col types.ListGroupResourcesItem 3655 destAddr := &col 3656 if err := awsRestjson1_deserializeDocumentListGroupResourcesItem(&destAddr, value); err != nil { 3657 return err 3658 } 3659 col = *destAddr 3660 cv = append(cv, col) 3661 3662 } 3663 *v = cv 3664 return nil 3665} 3666 3667func awsRestjson1_deserializeDocumentMethodNotAllowedException(v **types.MethodNotAllowedException, value interface{}) error { 3668 if v == nil { 3669 return fmt.Errorf("unexpected nil of type %T", v) 3670 } 3671 if value == nil { 3672 return nil 3673 } 3674 3675 shape, ok := value.(map[string]interface{}) 3676 if !ok { 3677 return fmt.Errorf("unexpected JSON type %v", value) 3678 } 3679 3680 var sv *types.MethodNotAllowedException 3681 if *v == nil { 3682 sv = &types.MethodNotAllowedException{} 3683 } else { 3684 sv = *v 3685 } 3686 3687 for key, value := range shape { 3688 switch key { 3689 case "Message": 3690 if value != nil { 3691 jtv, ok := value.(string) 3692 if !ok { 3693 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3694 } 3695 sv.Message = ptr.String(jtv) 3696 } 3697 3698 default: 3699 _, _ = key, value 3700 3701 } 3702 } 3703 *v = sv 3704 return nil 3705} 3706 3707func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 3708 if v == nil { 3709 return fmt.Errorf("unexpected nil of type %T", v) 3710 } 3711 if value == nil { 3712 return nil 3713 } 3714 3715 shape, ok := value.(map[string]interface{}) 3716 if !ok { 3717 return fmt.Errorf("unexpected JSON type %v", value) 3718 } 3719 3720 var sv *types.NotFoundException 3721 if *v == nil { 3722 sv = &types.NotFoundException{} 3723 } else { 3724 sv = *v 3725 } 3726 3727 for key, value := range shape { 3728 switch key { 3729 case "Message": 3730 if value != nil { 3731 jtv, ok := value.(string) 3732 if !ok { 3733 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 3734 } 3735 sv.Message = ptr.String(jtv) 3736 } 3737 3738 default: 3739 _, _ = key, value 3740 3741 } 3742 } 3743 *v = sv 3744 return nil 3745} 3746 3747func awsRestjson1_deserializeDocumentPendingResource(v **types.PendingResource, value interface{}) error { 3748 if v == nil { 3749 return fmt.Errorf("unexpected nil of type %T", v) 3750 } 3751 if value == nil { 3752 return nil 3753 } 3754 3755 shape, ok := value.(map[string]interface{}) 3756 if !ok { 3757 return fmt.Errorf("unexpected JSON type %v", value) 3758 } 3759 3760 var sv *types.PendingResource 3761 if *v == nil { 3762 sv = &types.PendingResource{} 3763 } else { 3764 sv = *v 3765 } 3766 3767 for key, value := range shape { 3768 switch key { 3769 case "ResourceArn": 3770 if value != nil { 3771 jtv, ok := value.(string) 3772 if !ok { 3773 return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) 3774 } 3775 sv.ResourceArn = ptr.String(jtv) 3776 } 3777 3778 default: 3779 _, _ = key, value 3780 3781 } 3782 } 3783 *v = sv 3784 return nil 3785} 3786 3787func awsRestjson1_deserializeDocumentPendingResourceList(v *[]types.PendingResource, value interface{}) error { 3788 if v == nil { 3789 return fmt.Errorf("unexpected nil of type %T", v) 3790 } 3791 if value == nil { 3792 return nil 3793 } 3794 3795 shape, ok := value.([]interface{}) 3796 if !ok { 3797 return fmt.Errorf("unexpected JSON type %v", value) 3798 } 3799 3800 var cv []types.PendingResource 3801 if *v == nil { 3802 cv = []types.PendingResource{} 3803 } else { 3804 cv = *v 3805 } 3806 3807 for _, value := range shape { 3808 var col types.PendingResource 3809 destAddr := &col 3810 if err := awsRestjson1_deserializeDocumentPendingResource(&destAddr, value); err != nil { 3811 return err 3812 } 3813 col = *destAddr 3814 cv = append(cv, col) 3815 3816 } 3817 *v = cv 3818 return nil 3819} 3820 3821func awsRestjson1_deserializeDocumentQueryError(v **types.QueryError, value interface{}) error { 3822 if v == nil { 3823 return fmt.Errorf("unexpected nil of type %T", v) 3824 } 3825 if value == nil { 3826 return nil 3827 } 3828 3829 shape, ok := value.(map[string]interface{}) 3830 if !ok { 3831 return fmt.Errorf("unexpected JSON type %v", value) 3832 } 3833 3834 var sv *types.QueryError 3835 if *v == nil { 3836 sv = &types.QueryError{} 3837 } else { 3838 sv = *v 3839 } 3840 3841 for key, value := range shape { 3842 switch key { 3843 case "ErrorCode": 3844 if value != nil { 3845 jtv, ok := value.(string) 3846 if !ok { 3847 return fmt.Errorf("expected QueryErrorCode to be of type string, got %T instead", value) 3848 } 3849 sv.ErrorCode = types.QueryErrorCode(jtv) 3850 } 3851 3852 case "Message": 3853 if value != nil { 3854 jtv, ok := value.(string) 3855 if !ok { 3856 return fmt.Errorf("expected QueryErrorMessage to be of type string, got %T instead", value) 3857 } 3858 sv.Message = ptr.String(jtv) 3859 } 3860 3861 default: 3862 _, _ = key, value 3863 3864 } 3865 } 3866 *v = sv 3867 return nil 3868} 3869 3870func awsRestjson1_deserializeDocumentQueryErrorList(v *[]types.QueryError, value interface{}) error { 3871 if v == nil { 3872 return fmt.Errorf("unexpected nil of type %T", v) 3873 } 3874 if value == nil { 3875 return nil 3876 } 3877 3878 shape, ok := value.([]interface{}) 3879 if !ok { 3880 return fmt.Errorf("unexpected JSON type %v", value) 3881 } 3882 3883 var cv []types.QueryError 3884 if *v == nil { 3885 cv = []types.QueryError{} 3886 } else { 3887 cv = *v 3888 } 3889 3890 for _, value := range shape { 3891 var col types.QueryError 3892 destAddr := &col 3893 if err := awsRestjson1_deserializeDocumentQueryError(&destAddr, value); err != nil { 3894 return err 3895 } 3896 col = *destAddr 3897 cv = append(cv, col) 3898 3899 } 3900 *v = cv 3901 return nil 3902} 3903 3904func awsRestjson1_deserializeDocumentResourceArnList(v *[]string, value interface{}) error { 3905 if v == nil { 3906 return fmt.Errorf("unexpected nil of type %T", v) 3907 } 3908 if value == nil { 3909 return nil 3910 } 3911 3912 shape, ok := value.([]interface{}) 3913 if !ok { 3914 return fmt.Errorf("unexpected JSON type %v", value) 3915 } 3916 3917 var cv []string 3918 if *v == nil { 3919 cv = []string{} 3920 } else { 3921 cv = *v 3922 } 3923 3924 for _, value := range shape { 3925 var col string 3926 if value != nil { 3927 jtv, ok := value.(string) 3928 if !ok { 3929 return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) 3930 } 3931 col = jtv 3932 } 3933 cv = append(cv, col) 3934 3935 } 3936 *v = cv 3937 return nil 3938} 3939 3940func awsRestjson1_deserializeDocumentResourceIdentifier(v **types.ResourceIdentifier, value interface{}) error { 3941 if v == nil { 3942 return fmt.Errorf("unexpected nil of type %T", v) 3943 } 3944 if value == nil { 3945 return nil 3946 } 3947 3948 shape, ok := value.(map[string]interface{}) 3949 if !ok { 3950 return fmt.Errorf("unexpected JSON type %v", value) 3951 } 3952 3953 var sv *types.ResourceIdentifier 3954 if *v == nil { 3955 sv = &types.ResourceIdentifier{} 3956 } else { 3957 sv = *v 3958 } 3959 3960 for key, value := range shape { 3961 switch key { 3962 case "ResourceArn": 3963 if value != nil { 3964 jtv, ok := value.(string) 3965 if !ok { 3966 return fmt.Errorf("expected ResourceArn to be of type string, got %T instead", value) 3967 } 3968 sv.ResourceArn = ptr.String(jtv) 3969 } 3970 3971 case "ResourceType": 3972 if value != nil { 3973 jtv, ok := value.(string) 3974 if !ok { 3975 return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value) 3976 } 3977 sv.ResourceType = ptr.String(jtv) 3978 } 3979 3980 default: 3981 _, _ = key, value 3982 3983 } 3984 } 3985 *v = sv 3986 return nil 3987} 3988 3989func awsRestjson1_deserializeDocumentResourceIdentifierList(v *[]types.ResourceIdentifier, value interface{}) error { 3990 if v == nil { 3991 return fmt.Errorf("unexpected nil of type %T", v) 3992 } 3993 if value == nil { 3994 return nil 3995 } 3996 3997 shape, ok := value.([]interface{}) 3998 if !ok { 3999 return fmt.Errorf("unexpected JSON type %v", value) 4000 } 4001 4002 var cv []types.ResourceIdentifier 4003 if *v == nil { 4004 cv = []types.ResourceIdentifier{} 4005 } else { 4006 cv = *v 4007 } 4008 4009 for _, value := range shape { 4010 var col types.ResourceIdentifier 4011 destAddr := &col 4012 if err := awsRestjson1_deserializeDocumentResourceIdentifier(&destAddr, value); err != nil { 4013 return err 4014 } 4015 col = *destAddr 4016 cv = append(cv, col) 4017 4018 } 4019 *v = cv 4020 return nil 4021} 4022 4023func awsRestjson1_deserializeDocumentResourceQuery(v **types.ResourceQuery, value interface{}) error { 4024 if v == nil { 4025 return fmt.Errorf("unexpected nil of type %T", v) 4026 } 4027 if value == nil { 4028 return nil 4029 } 4030 4031 shape, ok := value.(map[string]interface{}) 4032 if !ok { 4033 return fmt.Errorf("unexpected JSON type %v", value) 4034 } 4035 4036 var sv *types.ResourceQuery 4037 if *v == nil { 4038 sv = &types.ResourceQuery{} 4039 } else { 4040 sv = *v 4041 } 4042 4043 for key, value := range shape { 4044 switch key { 4045 case "Query": 4046 if value != nil { 4047 jtv, ok := value.(string) 4048 if !ok { 4049 return fmt.Errorf("expected Query to be of type string, got %T instead", value) 4050 } 4051 sv.Query = ptr.String(jtv) 4052 } 4053 4054 case "Type": 4055 if value != nil { 4056 jtv, ok := value.(string) 4057 if !ok { 4058 return fmt.Errorf("expected QueryType to be of type string, got %T instead", value) 4059 } 4060 sv.Type = types.QueryType(jtv) 4061 } 4062 4063 default: 4064 _, _ = key, value 4065 4066 } 4067 } 4068 *v = sv 4069 return nil 4070} 4071 4072func awsRestjson1_deserializeDocumentResourceStatus(v **types.ResourceStatus, value interface{}) error { 4073 if v == nil { 4074 return fmt.Errorf("unexpected nil of type %T", v) 4075 } 4076 if value == nil { 4077 return nil 4078 } 4079 4080 shape, ok := value.(map[string]interface{}) 4081 if !ok { 4082 return fmt.Errorf("unexpected JSON type %v", value) 4083 } 4084 4085 var sv *types.ResourceStatus 4086 if *v == nil { 4087 sv = &types.ResourceStatus{} 4088 } else { 4089 sv = *v 4090 } 4091 4092 for key, value := range shape { 4093 switch key { 4094 case "Name": 4095 if value != nil { 4096 jtv, ok := value.(string) 4097 if !ok { 4098 return fmt.Errorf("expected ResourceStatusValue to be of type string, got %T instead", value) 4099 } 4100 sv.Name = types.ResourceStatusValue(jtv) 4101 } 4102 4103 default: 4104 _, _ = key, value 4105 4106 } 4107 } 4108 *v = sv 4109 return nil 4110} 4111 4112func awsRestjson1_deserializeDocumentTagKeyList(v *[]string, value interface{}) error { 4113 if v == nil { 4114 return fmt.Errorf("unexpected nil of type %T", v) 4115 } 4116 if value == nil { 4117 return nil 4118 } 4119 4120 shape, ok := value.([]interface{}) 4121 if !ok { 4122 return fmt.Errorf("unexpected JSON type %v", value) 4123 } 4124 4125 var cv []string 4126 if *v == nil { 4127 cv = []string{} 4128 } else { 4129 cv = *v 4130 } 4131 4132 for _, value := range shape { 4133 var col string 4134 if value != nil { 4135 jtv, ok := value.(string) 4136 if !ok { 4137 return fmt.Errorf("expected TagKey to be of type string, got %T instead", value) 4138 } 4139 col = jtv 4140 } 4141 cv = append(cv, col) 4142 4143 } 4144 *v = cv 4145 return nil 4146} 4147 4148func awsRestjson1_deserializeDocumentTags(v *map[string]string, value interface{}) error { 4149 if v == nil { 4150 return fmt.Errorf("unexpected nil of type %T", v) 4151 } 4152 if value == nil { 4153 return nil 4154 } 4155 4156 shape, ok := value.(map[string]interface{}) 4157 if !ok { 4158 return fmt.Errorf("unexpected JSON type %v", value) 4159 } 4160 4161 var mv map[string]string 4162 if *v == nil { 4163 mv = map[string]string{} 4164 } else { 4165 mv = *v 4166 } 4167 4168 for key, value := range shape { 4169 var parsedVal string 4170 if value != nil { 4171 jtv, ok := value.(string) 4172 if !ok { 4173 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 4174 } 4175 parsedVal = jtv 4176 } 4177 mv[key] = parsedVal 4178 4179 } 4180 *v = mv 4181 return nil 4182} 4183 4184func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 4185 if v == nil { 4186 return fmt.Errorf("unexpected nil of type %T", v) 4187 } 4188 if value == nil { 4189 return nil 4190 } 4191 4192 shape, ok := value.(map[string]interface{}) 4193 if !ok { 4194 return fmt.Errorf("unexpected JSON type %v", value) 4195 } 4196 4197 var sv *types.TooManyRequestsException 4198 if *v == nil { 4199 sv = &types.TooManyRequestsException{} 4200 } else { 4201 sv = *v 4202 } 4203 4204 for key, value := range shape { 4205 switch key { 4206 case "Message": 4207 if value != nil { 4208 jtv, ok := value.(string) 4209 if !ok { 4210 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 4211 } 4212 sv.Message = ptr.String(jtv) 4213 } 4214 4215 default: 4216 _, _ = key, value 4217 4218 } 4219 } 4220 *v = sv 4221 return nil 4222} 4223 4224func awsRestjson1_deserializeDocumentUnauthorizedException(v **types.UnauthorizedException, value interface{}) error { 4225 if v == nil { 4226 return fmt.Errorf("unexpected nil of type %T", v) 4227 } 4228 if value == nil { 4229 return nil 4230 } 4231 4232 shape, ok := value.(map[string]interface{}) 4233 if !ok { 4234 return fmt.Errorf("unexpected JSON type %v", value) 4235 } 4236 4237 var sv *types.UnauthorizedException 4238 if *v == nil { 4239 sv = &types.UnauthorizedException{} 4240 } else { 4241 sv = *v 4242 } 4243 4244 for key, value := range shape { 4245 switch key { 4246 case "Message": 4247 if value != nil { 4248 jtv, ok := value.(string) 4249 if !ok { 4250 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 4251 } 4252 sv.Message = ptr.String(jtv) 4253 } 4254 4255 default: 4256 _, _ = key, value 4257 4258 } 4259 } 4260 *v = sv 4261 return nil 4262} 4263