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