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