1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package robomaker 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/robomaker/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 "math" 20 "strings" 21) 22 23type awsRestjson1_deserializeOpBatchDeleteWorlds struct { 24} 25 26func (*awsRestjson1_deserializeOpBatchDeleteWorlds) ID() string { 27 return "OperationDeserializer" 28} 29 30func (m *awsRestjson1_deserializeOpBatchDeleteWorlds) 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_deserializeOpErrorBatchDeleteWorlds(response, &metadata) 45 } 46 output := &BatchDeleteWorldsOutput{} 47 out.Result = output 48 49 var buff [1024]byte 50 ringBuffer := smithyio.NewRingBuffer(buff[:]) 51 52 body := io.TeeReader(response.Body, ringBuffer) 53 54 decoder := json.NewDecoder(body) 55 decoder.UseNumber() 56 var shape interface{} 57 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 58 var snapshot bytes.Buffer 59 io.Copy(&snapshot, ringBuffer) 60 err = &smithy.DeserializationError{ 61 Err: fmt.Errorf("failed to decode response body, %w", err), 62 Snapshot: snapshot.Bytes(), 63 } 64 return out, metadata, err 65 } 66 67 err = awsRestjson1_deserializeOpDocumentBatchDeleteWorldsOutput(&output, shape) 68 if err != nil { 69 var snapshot bytes.Buffer 70 io.Copy(&snapshot, ringBuffer) 71 return out, metadata, &smithy.DeserializationError{ 72 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 73 Snapshot: snapshot.Bytes(), 74 } 75 } 76 77 return out, metadata, err 78} 79 80func awsRestjson1_deserializeOpErrorBatchDeleteWorlds(response *smithyhttp.Response, metadata *middleware.Metadata) error { 81 var errorBuffer bytes.Buffer 82 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 83 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 84 } 85 errorBody := bytes.NewReader(errorBuffer.Bytes()) 86 87 errorCode := "UnknownError" 88 errorMessage := errorCode 89 90 code := response.Header.Get("X-Amzn-ErrorType") 91 if len(code) != 0 { 92 errorCode = restjson.SanitizeErrorCode(code) 93 } 94 95 var buff [1024]byte 96 ringBuffer := smithyio.NewRingBuffer(buff[:]) 97 98 body := io.TeeReader(errorBody, ringBuffer) 99 decoder := json.NewDecoder(body) 100 decoder.UseNumber() 101 code, message, err := restjson.GetErrorInfo(decoder) 102 if err != nil { 103 var snapshot bytes.Buffer 104 io.Copy(&snapshot, ringBuffer) 105 err = &smithy.DeserializationError{ 106 Err: fmt.Errorf("failed to decode response body, %w", err), 107 Snapshot: snapshot.Bytes(), 108 } 109 return err 110 } 111 112 errorBody.Seek(0, io.SeekStart) 113 if len(code) != 0 { 114 errorCode = restjson.SanitizeErrorCode(code) 115 } 116 if len(message) != 0 { 117 errorMessage = message 118 } 119 120 switch { 121 case strings.EqualFold("InternalServerException", errorCode): 122 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 123 124 case strings.EqualFold("InvalidParameterException", errorCode): 125 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 126 127 case strings.EqualFold("ThrottlingException", errorCode): 128 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 129 130 default: 131 genericError := &smithy.GenericAPIError{ 132 Code: errorCode, 133 Message: errorMessage, 134 } 135 return genericError 136 137 } 138} 139 140func awsRestjson1_deserializeOpDocumentBatchDeleteWorldsOutput(v **BatchDeleteWorldsOutput, value interface{}) error { 141 if v == nil { 142 return fmt.Errorf("unexpected nil of type %T", v) 143 } 144 if value == nil { 145 return nil 146 } 147 148 shape, ok := value.(map[string]interface{}) 149 if !ok { 150 return fmt.Errorf("unexpected JSON type %v", value) 151 } 152 153 var sv *BatchDeleteWorldsOutput 154 if *v == nil { 155 sv = &BatchDeleteWorldsOutput{} 156 } else { 157 sv = *v 158 } 159 160 for key, value := range shape { 161 switch key { 162 case "unprocessedWorlds": 163 if err := awsRestjson1_deserializeDocumentArns(&sv.UnprocessedWorlds, value); err != nil { 164 return err 165 } 166 167 default: 168 _, _ = key, value 169 170 } 171 } 172 *v = sv 173 return nil 174} 175 176type awsRestjson1_deserializeOpBatchDescribeSimulationJob struct { 177} 178 179func (*awsRestjson1_deserializeOpBatchDescribeSimulationJob) ID() string { 180 return "OperationDeserializer" 181} 182 183func (m *awsRestjson1_deserializeOpBatchDescribeSimulationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 184 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 185) { 186 out, metadata, err = next.HandleDeserialize(ctx, in) 187 if err != nil { 188 return out, metadata, err 189 } 190 191 response, ok := out.RawResponse.(*smithyhttp.Response) 192 if !ok { 193 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 194 } 195 196 if response.StatusCode < 200 || response.StatusCode >= 300 { 197 return out, metadata, awsRestjson1_deserializeOpErrorBatchDescribeSimulationJob(response, &metadata) 198 } 199 output := &BatchDescribeSimulationJobOutput{} 200 out.Result = output 201 202 var buff [1024]byte 203 ringBuffer := smithyio.NewRingBuffer(buff[:]) 204 205 body := io.TeeReader(response.Body, ringBuffer) 206 207 decoder := json.NewDecoder(body) 208 decoder.UseNumber() 209 var shape interface{} 210 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 211 var snapshot bytes.Buffer 212 io.Copy(&snapshot, ringBuffer) 213 err = &smithy.DeserializationError{ 214 Err: fmt.Errorf("failed to decode response body, %w", err), 215 Snapshot: snapshot.Bytes(), 216 } 217 return out, metadata, err 218 } 219 220 err = awsRestjson1_deserializeOpDocumentBatchDescribeSimulationJobOutput(&output, shape) 221 if err != nil { 222 var snapshot bytes.Buffer 223 io.Copy(&snapshot, ringBuffer) 224 return out, metadata, &smithy.DeserializationError{ 225 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 226 Snapshot: snapshot.Bytes(), 227 } 228 } 229 230 return out, metadata, err 231} 232 233func awsRestjson1_deserializeOpErrorBatchDescribeSimulationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 234 var errorBuffer bytes.Buffer 235 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 236 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 237 } 238 errorBody := bytes.NewReader(errorBuffer.Bytes()) 239 240 errorCode := "UnknownError" 241 errorMessage := errorCode 242 243 code := response.Header.Get("X-Amzn-ErrorType") 244 if len(code) != 0 { 245 errorCode = restjson.SanitizeErrorCode(code) 246 } 247 248 var buff [1024]byte 249 ringBuffer := smithyio.NewRingBuffer(buff[:]) 250 251 body := io.TeeReader(errorBody, ringBuffer) 252 decoder := json.NewDecoder(body) 253 decoder.UseNumber() 254 code, message, err := restjson.GetErrorInfo(decoder) 255 if err != nil { 256 var snapshot bytes.Buffer 257 io.Copy(&snapshot, ringBuffer) 258 err = &smithy.DeserializationError{ 259 Err: fmt.Errorf("failed to decode response body, %w", err), 260 Snapshot: snapshot.Bytes(), 261 } 262 return err 263 } 264 265 errorBody.Seek(0, io.SeekStart) 266 if len(code) != 0 { 267 errorCode = restjson.SanitizeErrorCode(code) 268 } 269 if len(message) != 0 { 270 errorMessage = message 271 } 272 273 switch { 274 case strings.EqualFold("InternalServerException", errorCode): 275 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 276 277 case strings.EqualFold("InvalidParameterException", errorCode): 278 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 279 280 case strings.EqualFold("ResourceNotFoundException", errorCode): 281 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 282 283 case strings.EqualFold("ThrottlingException", errorCode): 284 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 285 286 default: 287 genericError := &smithy.GenericAPIError{ 288 Code: errorCode, 289 Message: errorMessage, 290 } 291 return genericError 292 293 } 294} 295 296func awsRestjson1_deserializeOpDocumentBatchDescribeSimulationJobOutput(v **BatchDescribeSimulationJobOutput, value interface{}) error { 297 if v == nil { 298 return fmt.Errorf("unexpected nil of type %T", v) 299 } 300 if value == nil { 301 return nil 302 } 303 304 shape, ok := value.(map[string]interface{}) 305 if !ok { 306 return fmt.Errorf("unexpected JSON type %v", value) 307 } 308 309 var sv *BatchDescribeSimulationJobOutput 310 if *v == nil { 311 sv = &BatchDescribeSimulationJobOutput{} 312 } else { 313 sv = *v 314 } 315 316 for key, value := range shape { 317 switch key { 318 case "jobs": 319 if err := awsRestjson1_deserializeDocumentSimulationJobs(&sv.Jobs, value); err != nil { 320 return err 321 } 322 323 case "unprocessedJobs": 324 if err := awsRestjson1_deserializeDocumentArns(&sv.UnprocessedJobs, value); err != nil { 325 return err 326 } 327 328 default: 329 _, _ = key, value 330 331 } 332 } 333 *v = sv 334 return nil 335} 336 337type awsRestjson1_deserializeOpCancelDeploymentJob struct { 338} 339 340func (*awsRestjson1_deserializeOpCancelDeploymentJob) ID() string { 341 return "OperationDeserializer" 342} 343 344func (m *awsRestjson1_deserializeOpCancelDeploymentJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 345 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 346) { 347 out, metadata, err = next.HandleDeserialize(ctx, in) 348 if err != nil { 349 return out, metadata, err 350 } 351 352 response, ok := out.RawResponse.(*smithyhttp.Response) 353 if !ok { 354 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 355 } 356 357 if response.StatusCode < 200 || response.StatusCode >= 300 { 358 return out, metadata, awsRestjson1_deserializeOpErrorCancelDeploymentJob(response, &metadata) 359 } 360 output := &CancelDeploymentJobOutput{} 361 out.Result = output 362 363 return out, metadata, err 364} 365 366func awsRestjson1_deserializeOpErrorCancelDeploymentJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 367 var errorBuffer bytes.Buffer 368 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 369 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 370 } 371 errorBody := bytes.NewReader(errorBuffer.Bytes()) 372 373 errorCode := "UnknownError" 374 errorMessage := errorCode 375 376 code := response.Header.Get("X-Amzn-ErrorType") 377 if len(code) != 0 { 378 errorCode = restjson.SanitizeErrorCode(code) 379 } 380 381 var buff [1024]byte 382 ringBuffer := smithyio.NewRingBuffer(buff[:]) 383 384 body := io.TeeReader(errorBody, ringBuffer) 385 decoder := json.NewDecoder(body) 386 decoder.UseNumber() 387 code, message, err := restjson.GetErrorInfo(decoder) 388 if err != nil { 389 var snapshot bytes.Buffer 390 io.Copy(&snapshot, ringBuffer) 391 err = &smithy.DeserializationError{ 392 Err: fmt.Errorf("failed to decode response body, %w", err), 393 Snapshot: snapshot.Bytes(), 394 } 395 return err 396 } 397 398 errorBody.Seek(0, io.SeekStart) 399 if len(code) != 0 { 400 errorCode = restjson.SanitizeErrorCode(code) 401 } 402 if len(message) != 0 { 403 errorMessage = message 404 } 405 406 switch { 407 case strings.EqualFold("InternalServerException", errorCode): 408 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 409 410 case strings.EqualFold("InvalidParameterException", errorCode): 411 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 412 413 case strings.EqualFold("ResourceNotFoundException", errorCode): 414 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 415 416 case strings.EqualFold("ThrottlingException", errorCode): 417 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 418 419 default: 420 genericError := &smithy.GenericAPIError{ 421 Code: errorCode, 422 Message: errorMessage, 423 } 424 return genericError 425 426 } 427} 428 429type awsRestjson1_deserializeOpCancelSimulationJob struct { 430} 431 432func (*awsRestjson1_deserializeOpCancelSimulationJob) ID() string { 433 return "OperationDeserializer" 434} 435 436func (m *awsRestjson1_deserializeOpCancelSimulationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 437 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 438) { 439 out, metadata, err = next.HandleDeserialize(ctx, in) 440 if err != nil { 441 return out, metadata, err 442 } 443 444 response, ok := out.RawResponse.(*smithyhttp.Response) 445 if !ok { 446 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 447 } 448 449 if response.StatusCode < 200 || response.StatusCode >= 300 { 450 return out, metadata, awsRestjson1_deserializeOpErrorCancelSimulationJob(response, &metadata) 451 } 452 output := &CancelSimulationJobOutput{} 453 out.Result = output 454 455 return out, metadata, err 456} 457 458func awsRestjson1_deserializeOpErrorCancelSimulationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 459 var errorBuffer bytes.Buffer 460 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 461 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 462 } 463 errorBody := bytes.NewReader(errorBuffer.Bytes()) 464 465 errorCode := "UnknownError" 466 errorMessage := errorCode 467 468 code := response.Header.Get("X-Amzn-ErrorType") 469 if len(code) != 0 { 470 errorCode = restjson.SanitizeErrorCode(code) 471 } 472 473 var buff [1024]byte 474 ringBuffer := smithyio.NewRingBuffer(buff[:]) 475 476 body := io.TeeReader(errorBody, ringBuffer) 477 decoder := json.NewDecoder(body) 478 decoder.UseNumber() 479 code, message, err := restjson.GetErrorInfo(decoder) 480 if err != nil { 481 var snapshot bytes.Buffer 482 io.Copy(&snapshot, ringBuffer) 483 err = &smithy.DeserializationError{ 484 Err: fmt.Errorf("failed to decode response body, %w", err), 485 Snapshot: snapshot.Bytes(), 486 } 487 return err 488 } 489 490 errorBody.Seek(0, io.SeekStart) 491 if len(code) != 0 { 492 errorCode = restjson.SanitizeErrorCode(code) 493 } 494 if len(message) != 0 { 495 errorMessage = message 496 } 497 498 switch { 499 case strings.EqualFold("InternalServerException", errorCode): 500 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 501 502 case strings.EqualFold("InvalidParameterException", errorCode): 503 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 504 505 case strings.EqualFold("ResourceNotFoundException", errorCode): 506 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 507 508 case strings.EqualFold("ThrottlingException", errorCode): 509 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 510 511 default: 512 genericError := &smithy.GenericAPIError{ 513 Code: errorCode, 514 Message: errorMessage, 515 } 516 return genericError 517 518 } 519} 520 521type awsRestjson1_deserializeOpCancelSimulationJobBatch struct { 522} 523 524func (*awsRestjson1_deserializeOpCancelSimulationJobBatch) ID() string { 525 return "OperationDeserializer" 526} 527 528func (m *awsRestjson1_deserializeOpCancelSimulationJobBatch) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 529 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 530) { 531 out, metadata, err = next.HandleDeserialize(ctx, in) 532 if err != nil { 533 return out, metadata, err 534 } 535 536 response, ok := out.RawResponse.(*smithyhttp.Response) 537 if !ok { 538 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 539 } 540 541 if response.StatusCode < 200 || response.StatusCode >= 300 { 542 return out, metadata, awsRestjson1_deserializeOpErrorCancelSimulationJobBatch(response, &metadata) 543 } 544 output := &CancelSimulationJobBatchOutput{} 545 out.Result = output 546 547 return out, metadata, err 548} 549 550func awsRestjson1_deserializeOpErrorCancelSimulationJobBatch(response *smithyhttp.Response, metadata *middleware.Metadata) error { 551 var errorBuffer bytes.Buffer 552 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 553 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 554 } 555 errorBody := bytes.NewReader(errorBuffer.Bytes()) 556 557 errorCode := "UnknownError" 558 errorMessage := errorCode 559 560 code := response.Header.Get("X-Amzn-ErrorType") 561 if len(code) != 0 { 562 errorCode = restjson.SanitizeErrorCode(code) 563 } 564 565 var buff [1024]byte 566 ringBuffer := smithyio.NewRingBuffer(buff[:]) 567 568 body := io.TeeReader(errorBody, ringBuffer) 569 decoder := json.NewDecoder(body) 570 decoder.UseNumber() 571 code, message, err := restjson.GetErrorInfo(decoder) 572 if err != nil { 573 var snapshot bytes.Buffer 574 io.Copy(&snapshot, ringBuffer) 575 err = &smithy.DeserializationError{ 576 Err: fmt.Errorf("failed to decode response body, %w", err), 577 Snapshot: snapshot.Bytes(), 578 } 579 return err 580 } 581 582 errorBody.Seek(0, io.SeekStart) 583 if len(code) != 0 { 584 errorCode = restjson.SanitizeErrorCode(code) 585 } 586 if len(message) != 0 { 587 errorMessage = message 588 } 589 590 switch { 591 case strings.EqualFold("InternalServerException", errorCode): 592 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 593 594 case strings.EqualFold("InvalidParameterException", errorCode): 595 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 596 597 case strings.EqualFold("ResourceNotFoundException", errorCode): 598 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 599 600 case strings.EqualFold("ThrottlingException", errorCode): 601 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 602 603 default: 604 genericError := &smithy.GenericAPIError{ 605 Code: errorCode, 606 Message: errorMessage, 607 } 608 return genericError 609 610 } 611} 612 613type awsRestjson1_deserializeOpCancelWorldExportJob struct { 614} 615 616func (*awsRestjson1_deserializeOpCancelWorldExportJob) ID() string { 617 return "OperationDeserializer" 618} 619 620func (m *awsRestjson1_deserializeOpCancelWorldExportJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 621 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 622) { 623 out, metadata, err = next.HandleDeserialize(ctx, in) 624 if err != nil { 625 return out, metadata, err 626 } 627 628 response, ok := out.RawResponse.(*smithyhttp.Response) 629 if !ok { 630 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 631 } 632 633 if response.StatusCode < 200 || response.StatusCode >= 300 { 634 return out, metadata, awsRestjson1_deserializeOpErrorCancelWorldExportJob(response, &metadata) 635 } 636 output := &CancelWorldExportJobOutput{} 637 out.Result = output 638 639 return out, metadata, err 640} 641 642func awsRestjson1_deserializeOpErrorCancelWorldExportJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 643 var errorBuffer bytes.Buffer 644 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 645 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 646 } 647 errorBody := bytes.NewReader(errorBuffer.Bytes()) 648 649 errorCode := "UnknownError" 650 errorMessage := errorCode 651 652 code := response.Header.Get("X-Amzn-ErrorType") 653 if len(code) != 0 { 654 errorCode = restjson.SanitizeErrorCode(code) 655 } 656 657 var buff [1024]byte 658 ringBuffer := smithyio.NewRingBuffer(buff[:]) 659 660 body := io.TeeReader(errorBody, ringBuffer) 661 decoder := json.NewDecoder(body) 662 decoder.UseNumber() 663 code, message, err := restjson.GetErrorInfo(decoder) 664 if err != nil { 665 var snapshot bytes.Buffer 666 io.Copy(&snapshot, ringBuffer) 667 err = &smithy.DeserializationError{ 668 Err: fmt.Errorf("failed to decode response body, %w", err), 669 Snapshot: snapshot.Bytes(), 670 } 671 return err 672 } 673 674 errorBody.Seek(0, io.SeekStart) 675 if len(code) != 0 { 676 errorCode = restjson.SanitizeErrorCode(code) 677 } 678 if len(message) != 0 { 679 errorMessage = message 680 } 681 682 switch { 683 case strings.EqualFold("InternalServerException", errorCode): 684 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 685 686 case strings.EqualFold("InvalidParameterException", errorCode): 687 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 688 689 case strings.EqualFold("ResourceNotFoundException", errorCode): 690 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 691 692 case strings.EqualFold("ThrottlingException", errorCode): 693 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 694 695 default: 696 genericError := &smithy.GenericAPIError{ 697 Code: errorCode, 698 Message: errorMessage, 699 } 700 return genericError 701 702 } 703} 704 705type awsRestjson1_deserializeOpCancelWorldGenerationJob struct { 706} 707 708func (*awsRestjson1_deserializeOpCancelWorldGenerationJob) ID() string { 709 return "OperationDeserializer" 710} 711 712func (m *awsRestjson1_deserializeOpCancelWorldGenerationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 713 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 714) { 715 out, metadata, err = next.HandleDeserialize(ctx, in) 716 if err != nil { 717 return out, metadata, err 718 } 719 720 response, ok := out.RawResponse.(*smithyhttp.Response) 721 if !ok { 722 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 723 } 724 725 if response.StatusCode < 200 || response.StatusCode >= 300 { 726 return out, metadata, awsRestjson1_deserializeOpErrorCancelWorldGenerationJob(response, &metadata) 727 } 728 output := &CancelWorldGenerationJobOutput{} 729 out.Result = output 730 731 return out, metadata, err 732} 733 734func awsRestjson1_deserializeOpErrorCancelWorldGenerationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 735 var errorBuffer bytes.Buffer 736 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 737 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 738 } 739 errorBody := bytes.NewReader(errorBuffer.Bytes()) 740 741 errorCode := "UnknownError" 742 errorMessage := errorCode 743 744 code := response.Header.Get("X-Amzn-ErrorType") 745 if len(code) != 0 { 746 errorCode = restjson.SanitizeErrorCode(code) 747 } 748 749 var buff [1024]byte 750 ringBuffer := smithyio.NewRingBuffer(buff[:]) 751 752 body := io.TeeReader(errorBody, ringBuffer) 753 decoder := json.NewDecoder(body) 754 decoder.UseNumber() 755 code, message, err := restjson.GetErrorInfo(decoder) 756 if err != nil { 757 var snapshot bytes.Buffer 758 io.Copy(&snapshot, ringBuffer) 759 err = &smithy.DeserializationError{ 760 Err: fmt.Errorf("failed to decode response body, %w", err), 761 Snapshot: snapshot.Bytes(), 762 } 763 return err 764 } 765 766 errorBody.Seek(0, io.SeekStart) 767 if len(code) != 0 { 768 errorCode = restjson.SanitizeErrorCode(code) 769 } 770 if len(message) != 0 { 771 errorMessage = message 772 } 773 774 switch { 775 case strings.EqualFold("InternalServerException", errorCode): 776 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 777 778 case strings.EqualFold("InvalidParameterException", errorCode): 779 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 780 781 case strings.EqualFold("ResourceNotFoundException", errorCode): 782 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 783 784 case strings.EqualFold("ThrottlingException", errorCode): 785 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 786 787 default: 788 genericError := &smithy.GenericAPIError{ 789 Code: errorCode, 790 Message: errorMessage, 791 } 792 return genericError 793 794 } 795} 796 797type awsRestjson1_deserializeOpCreateDeploymentJob struct { 798} 799 800func (*awsRestjson1_deserializeOpCreateDeploymentJob) ID() string { 801 return "OperationDeserializer" 802} 803 804func (m *awsRestjson1_deserializeOpCreateDeploymentJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 805 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 806) { 807 out, metadata, err = next.HandleDeserialize(ctx, in) 808 if err != nil { 809 return out, metadata, err 810 } 811 812 response, ok := out.RawResponse.(*smithyhttp.Response) 813 if !ok { 814 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 815 } 816 817 if response.StatusCode < 200 || response.StatusCode >= 300 { 818 return out, metadata, awsRestjson1_deserializeOpErrorCreateDeploymentJob(response, &metadata) 819 } 820 output := &CreateDeploymentJobOutput{} 821 out.Result = output 822 823 var buff [1024]byte 824 ringBuffer := smithyio.NewRingBuffer(buff[:]) 825 826 body := io.TeeReader(response.Body, ringBuffer) 827 828 decoder := json.NewDecoder(body) 829 decoder.UseNumber() 830 var shape interface{} 831 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 832 var snapshot bytes.Buffer 833 io.Copy(&snapshot, ringBuffer) 834 err = &smithy.DeserializationError{ 835 Err: fmt.Errorf("failed to decode response body, %w", err), 836 Snapshot: snapshot.Bytes(), 837 } 838 return out, metadata, err 839 } 840 841 err = awsRestjson1_deserializeOpDocumentCreateDeploymentJobOutput(&output, shape) 842 if err != nil { 843 var snapshot bytes.Buffer 844 io.Copy(&snapshot, ringBuffer) 845 return out, metadata, &smithy.DeserializationError{ 846 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 847 Snapshot: snapshot.Bytes(), 848 } 849 } 850 851 return out, metadata, err 852} 853 854func awsRestjson1_deserializeOpErrorCreateDeploymentJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 855 var errorBuffer bytes.Buffer 856 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 857 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 858 } 859 errorBody := bytes.NewReader(errorBuffer.Bytes()) 860 861 errorCode := "UnknownError" 862 errorMessage := errorCode 863 864 code := response.Header.Get("X-Amzn-ErrorType") 865 if len(code) != 0 { 866 errorCode = restjson.SanitizeErrorCode(code) 867 } 868 869 var buff [1024]byte 870 ringBuffer := smithyio.NewRingBuffer(buff[:]) 871 872 body := io.TeeReader(errorBody, ringBuffer) 873 decoder := json.NewDecoder(body) 874 decoder.UseNumber() 875 code, message, err := restjson.GetErrorInfo(decoder) 876 if err != nil { 877 var snapshot bytes.Buffer 878 io.Copy(&snapshot, ringBuffer) 879 err = &smithy.DeserializationError{ 880 Err: fmt.Errorf("failed to decode response body, %w", err), 881 Snapshot: snapshot.Bytes(), 882 } 883 return err 884 } 885 886 errorBody.Seek(0, io.SeekStart) 887 if len(code) != 0 { 888 errorCode = restjson.SanitizeErrorCode(code) 889 } 890 if len(message) != 0 { 891 errorMessage = message 892 } 893 894 switch { 895 case strings.EqualFold("ConcurrentDeploymentException", errorCode): 896 return awsRestjson1_deserializeErrorConcurrentDeploymentException(response, errorBody) 897 898 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 899 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 900 901 case strings.EqualFold("InternalServerException", errorCode): 902 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 903 904 case strings.EqualFold("InvalidParameterException", errorCode): 905 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 906 907 case strings.EqualFold("LimitExceededException", errorCode): 908 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 909 910 case strings.EqualFold("ResourceNotFoundException", errorCode): 911 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 912 913 case strings.EqualFold("ThrottlingException", errorCode): 914 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 915 916 default: 917 genericError := &smithy.GenericAPIError{ 918 Code: errorCode, 919 Message: errorMessage, 920 } 921 return genericError 922 923 } 924} 925 926func awsRestjson1_deserializeOpDocumentCreateDeploymentJobOutput(v **CreateDeploymentJobOutput, value interface{}) error { 927 if v == nil { 928 return fmt.Errorf("unexpected nil of type %T", v) 929 } 930 if value == nil { 931 return nil 932 } 933 934 shape, ok := value.(map[string]interface{}) 935 if !ok { 936 return fmt.Errorf("unexpected JSON type %v", value) 937 } 938 939 var sv *CreateDeploymentJobOutput 940 if *v == nil { 941 sv = &CreateDeploymentJobOutput{} 942 } else { 943 sv = *v 944 } 945 946 for key, value := range shape { 947 switch key { 948 case "arn": 949 if value != nil { 950 jtv, ok := value.(string) 951 if !ok { 952 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 953 } 954 sv.Arn = ptr.String(jtv) 955 } 956 957 case "createdAt": 958 if value != nil { 959 switch jtv := value.(type) { 960 case json.Number: 961 f64, err := jtv.Float64() 962 if err != nil { 963 return err 964 } 965 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 966 967 default: 968 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 969 970 } 971 } 972 973 case "deploymentApplicationConfigs": 974 if err := awsRestjson1_deserializeDocumentDeploymentApplicationConfigs(&sv.DeploymentApplicationConfigs, value); err != nil { 975 return err 976 } 977 978 case "deploymentConfig": 979 if err := awsRestjson1_deserializeDocumentDeploymentConfig(&sv.DeploymentConfig, value); err != nil { 980 return err 981 } 982 983 case "failureCode": 984 if value != nil { 985 jtv, ok := value.(string) 986 if !ok { 987 return fmt.Errorf("expected DeploymentJobErrorCode to be of type string, got %T instead", value) 988 } 989 sv.FailureCode = types.DeploymentJobErrorCode(jtv) 990 } 991 992 case "failureReason": 993 if value != nil { 994 jtv, ok := value.(string) 995 if !ok { 996 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 997 } 998 sv.FailureReason = ptr.String(jtv) 999 } 1000 1001 case "fleet": 1002 if value != nil { 1003 jtv, ok := value.(string) 1004 if !ok { 1005 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1006 } 1007 sv.Fleet = ptr.String(jtv) 1008 } 1009 1010 case "status": 1011 if value != nil { 1012 jtv, ok := value.(string) 1013 if !ok { 1014 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 1015 } 1016 sv.Status = types.DeploymentStatus(jtv) 1017 } 1018 1019 case "tags": 1020 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 1021 return err 1022 } 1023 1024 default: 1025 _, _ = key, value 1026 1027 } 1028 } 1029 *v = sv 1030 return nil 1031} 1032 1033type awsRestjson1_deserializeOpCreateFleet struct { 1034} 1035 1036func (*awsRestjson1_deserializeOpCreateFleet) ID() string { 1037 return "OperationDeserializer" 1038} 1039 1040func (m *awsRestjson1_deserializeOpCreateFleet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1041 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1042) { 1043 out, metadata, err = next.HandleDeserialize(ctx, in) 1044 if err != nil { 1045 return out, metadata, err 1046 } 1047 1048 response, ok := out.RawResponse.(*smithyhttp.Response) 1049 if !ok { 1050 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1051 } 1052 1053 if response.StatusCode < 200 || response.StatusCode >= 300 { 1054 return out, metadata, awsRestjson1_deserializeOpErrorCreateFleet(response, &metadata) 1055 } 1056 output := &CreateFleetOutput{} 1057 out.Result = output 1058 1059 var buff [1024]byte 1060 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1061 1062 body := io.TeeReader(response.Body, ringBuffer) 1063 1064 decoder := json.NewDecoder(body) 1065 decoder.UseNumber() 1066 var shape interface{} 1067 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1068 var snapshot bytes.Buffer 1069 io.Copy(&snapshot, ringBuffer) 1070 err = &smithy.DeserializationError{ 1071 Err: fmt.Errorf("failed to decode response body, %w", err), 1072 Snapshot: snapshot.Bytes(), 1073 } 1074 return out, metadata, err 1075 } 1076 1077 err = awsRestjson1_deserializeOpDocumentCreateFleetOutput(&output, shape) 1078 if err != nil { 1079 var snapshot bytes.Buffer 1080 io.Copy(&snapshot, ringBuffer) 1081 return out, metadata, &smithy.DeserializationError{ 1082 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1083 Snapshot: snapshot.Bytes(), 1084 } 1085 } 1086 1087 return out, metadata, err 1088} 1089 1090func awsRestjson1_deserializeOpErrorCreateFleet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1091 var errorBuffer bytes.Buffer 1092 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1093 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1094 } 1095 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1096 1097 errorCode := "UnknownError" 1098 errorMessage := errorCode 1099 1100 code := response.Header.Get("X-Amzn-ErrorType") 1101 if len(code) != 0 { 1102 errorCode = restjson.SanitizeErrorCode(code) 1103 } 1104 1105 var buff [1024]byte 1106 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1107 1108 body := io.TeeReader(errorBody, ringBuffer) 1109 decoder := json.NewDecoder(body) 1110 decoder.UseNumber() 1111 code, message, err := restjson.GetErrorInfo(decoder) 1112 if err != nil { 1113 var snapshot bytes.Buffer 1114 io.Copy(&snapshot, ringBuffer) 1115 err = &smithy.DeserializationError{ 1116 Err: fmt.Errorf("failed to decode response body, %w", err), 1117 Snapshot: snapshot.Bytes(), 1118 } 1119 return err 1120 } 1121 1122 errorBody.Seek(0, io.SeekStart) 1123 if len(code) != 0 { 1124 errorCode = restjson.SanitizeErrorCode(code) 1125 } 1126 if len(message) != 0 { 1127 errorMessage = message 1128 } 1129 1130 switch { 1131 case strings.EqualFold("InternalServerException", errorCode): 1132 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1133 1134 case strings.EqualFold("InvalidParameterException", errorCode): 1135 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1136 1137 case strings.EqualFold("LimitExceededException", errorCode): 1138 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1139 1140 case strings.EqualFold("ThrottlingException", errorCode): 1141 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1142 1143 default: 1144 genericError := &smithy.GenericAPIError{ 1145 Code: errorCode, 1146 Message: errorMessage, 1147 } 1148 return genericError 1149 1150 } 1151} 1152 1153func awsRestjson1_deserializeOpDocumentCreateFleetOutput(v **CreateFleetOutput, value interface{}) error { 1154 if v == nil { 1155 return fmt.Errorf("unexpected nil of type %T", v) 1156 } 1157 if value == nil { 1158 return nil 1159 } 1160 1161 shape, ok := value.(map[string]interface{}) 1162 if !ok { 1163 return fmt.Errorf("unexpected JSON type %v", value) 1164 } 1165 1166 var sv *CreateFleetOutput 1167 if *v == nil { 1168 sv = &CreateFleetOutput{} 1169 } else { 1170 sv = *v 1171 } 1172 1173 for key, value := range shape { 1174 switch key { 1175 case "arn": 1176 if value != nil { 1177 jtv, ok := value.(string) 1178 if !ok { 1179 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1180 } 1181 sv.Arn = ptr.String(jtv) 1182 } 1183 1184 case "createdAt": 1185 if value != nil { 1186 switch jtv := value.(type) { 1187 case json.Number: 1188 f64, err := jtv.Float64() 1189 if err != nil { 1190 return err 1191 } 1192 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1193 1194 default: 1195 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 1196 1197 } 1198 } 1199 1200 case "name": 1201 if value != nil { 1202 jtv, ok := value.(string) 1203 if !ok { 1204 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1205 } 1206 sv.Name = ptr.String(jtv) 1207 } 1208 1209 case "tags": 1210 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 1211 return err 1212 } 1213 1214 default: 1215 _, _ = key, value 1216 1217 } 1218 } 1219 *v = sv 1220 return nil 1221} 1222 1223type awsRestjson1_deserializeOpCreateRobot struct { 1224} 1225 1226func (*awsRestjson1_deserializeOpCreateRobot) ID() string { 1227 return "OperationDeserializer" 1228} 1229 1230func (m *awsRestjson1_deserializeOpCreateRobot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1231 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1232) { 1233 out, metadata, err = next.HandleDeserialize(ctx, in) 1234 if err != nil { 1235 return out, metadata, err 1236 } 1237 1238 response, ok := out.RawResponse.(*smithyhttp.Response) 1239 if !ok { 1240 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1241 } 1242 1243 if response.StatusCode < 200 || response.StatusCode >= 300 { 1244 return out, metadata, awsRestjson1_deserializeOpErrorCreateRobot(response, &metadata) 1245 } 1246 output := &CreateRobotOutput{} 1247 out.Result = output 1248 1249 var buff [1024]byte 1250 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1251 1252 body := io.TeeReader(response.Body, ringBuffer) 1253 1254 decoder := json.NewDecoder(body) 1255 decoder.UseNumber() 1256 var shape interface{} 1257 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1258 var snapshot bytes.Buffer 1259 io.Copy(&snapshot, ringBuffer) 1260 err = &smithy.DeserializationError{ 1261 Err: fmt.Errorf("failed to decode response body, %w", err), 1262 Snapshot: snapshot.Bytes(), 1263 } 1264 return out, metadata, err 1265 } 1266 1267 err = awsRestjson1_deserializeOpDocumentCreateRobotOutput(&output, shape) 1268 if err != nil { 1269 var snapshot bytes.Buffer 1270 io.Copy(&snapshot, ringBuffer) 1271 return out, metadata, &smithy.DeserializationError{ 1272 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1273 Snapshot: snapshot.Bytes(), 1274 } 1275 } 1276 1277 return out, metadata, err 1278} 1279 1280func awsRestjson1_deserializeOpErrorCreateRobot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1281 var errorBuffer bytes.Buffer 1282 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1283 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1284 } 1285 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1286 1287 errorCode := "UnknownError" 1288 errorMessage := errorCode 1289 1290 code := response.Header.Get("X-Amzn-ErrorType") 1291 if len(code) != 0 { 1292 errorCode = restjson.SanitizeErrorCode(code) 1293 } 1294 1295 var buff [1024]byte 1296 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1297 1298 body := io.TeeReader(errorBody, ringBuffer) 1299 decoder := json.NewDecoder(body) 1300 decoder.UseNumber() 1301 code, message, err := restjson.GetErrorInfo(decoder) 1302 if err != nil { 1303 var snapshot bytes.Buffer 1304 io.Copy(&snapshot, ringBuffer) 1305 err = &smithy.DeserializationError{ 1306 Err: fmt.Errorf("failed to decode response body, %w", err), 1307 Snapshot: snapshot.Bytes(), 1308 } 1309 return err 1310 } 1311 1312 errorBody.Seek(0, io.SeekStart) 1313 if len(code) != 0 { 1314 errorCode = restjson.SanitizeErrorCode(code) 1315 } 1316 if len(message) != 0 { 1317 errorMessage = message 1318 } 1319 1320 switch { 1321 case strings.EqualFold("InternalServerException", errorCode): 1322 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1323 1324 case strings.EqualFold("InvalidParameterException", errorCode): 1325 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1326 1327 case strings.EqualFold("LimitExceededException", errorCode): 1328 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1329 1330 case strings.EqualFold("ResourceAlreadyExistsException", errorCode): 1331 return awsRestjson1_deserializeErrorResourceAlreadyExistsException(response, errorBody) 1332 1333 case strings.EqualFold("ThrottlingException", errorCode): 1334 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1335 1336 default: 1337 genericError := &smithy.GenericAPIError{ 1338 Code: errorCode, 1339 Message: errorMessage, 1340 } 1341 return genericError 1342 1343 } 1344} 1345 1346func awsRestjson1_deserializeOpDocumentCreateRobotOutput(v **CreateRobotOutput, value interface{}) error { 1347 if v == nil { 1348 return fmt.Errorf("unexpected nil of type %T", v) 1349 } 1350 if value == nil { 1351 return nil 1352 } 1353 1354 shape, ok := value.(map[string]interface{}) 1355 if !ok { 1356 return fmt.Errorf("unexpected JSON type %v", value) 1357 } 1358 1359 var sv *CreateRobotOutput 1360 if *v == nil { 1361 sv = &CreateRobotOutput{} 1362 } else { 1363 sv = *v 1364 } 1365 1366 for key, value := range shape { 1367 switch key { 1368 case "architecture": 1369 if value != nil { 1370 jtv, ok := value.(string) 1371 if !ok { 1372 return fmt.Errorf("expected Architecture to be of type string, got %T instead", value) 1373 } 1374 sv.Architecture = types.Architecture(jtv) 1375 } 1376 1377 case "arn": 1378 if value != nil { 1379 jtv, ok := value.(string) 1380 if !ok { 1381 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1382 } 1383 sv.Arn = ptr.String(jtv) 1384 } 1385 1386 case "createdAt": 1387 if value != nil { 1388 switch jtv := value.(type) { 1389 case json.Number: 1390 f64, err := jtv.Float64() 1391 if err != nil { 1392 return err 1393 } 1394 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1395 1396 default: 1397 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 1398 1399 } 1400 } 1401 1402 case "greengrassGroupId": 1403 if value != nil { 1404 jtv, ok := value.(string) 1405 if !ok { 1406 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1407 } 1408 sv.GreengrassGroupId = ptr.String(jtv) 1409 } 1410 1411 case "name": 1412 if value != nil { 1413 jtv, ok := value.(string) 1414 if !ok { 1415 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1416 } 1417 sv.Name = ptr.String(jtv) 1418 } 1419 1420 case "tags": 1421 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 1422 return err 1423 } 1424 1425 default: 1426 _, _ = key, value 1427 1428 } 1429 } 1430 *v = sv 1431 return nil 1432} 1433 1434type awsRestjson1_deserializeOpCreateRobotApplication struct { 1435} 1436 1437func (*awsRestjson1_deserializeOpCreateRobotApplication) ID() string { 1438 return "OperationDeserializer" 1439} 1440 1441func (m *awsRestjson1_deserializeOpCreateRobotApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1442 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1443) { 1444 out, metadata, err = next.HandleDeserialize(ctx, in) 1445 if err != nil { 1446 return out, metadata, err 1447 } 1448 1449 response, ok := out.RawResponse.(*smithyhttp.Response) 1450 if !ok { 1451 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1452 } 1453 1454 if response.StatusCode < 200 || response.StatusCode >= 300 { 1455 return out, metadata, awsRestjson1_deserializeOpErrorCreateRobotApplication(response, &metadata) 1456 } 1457 output := &CreateRobotApplicationOutput{} 1458 out.Result = output 1459 1460 var buff [1024]byte 1461 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1462 1463 body := io.TeeReader(response.Body, ringBuffer) 1464 1465 decoder := json.NewDecoder(body) 1466 decoder.UseNumber() 1467 var shape interface{} 1468 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1469 var snapshot bytes.Buffer 1470 io.Copy(&snapshot, ringBuffer) 1471 err = &smithy.DeserializationError{ 1472 Err: fmt.Errorf("failed to decode response body, %w", err), 1473 Snapshot: snapshot.Bytes(), 1474 } 1475 return out, metadata, err 1476 } 1477 1478 err = awsRestjson1_deserializeOpDocumentCreateRobotApplicationOutput(&output, shape) 1479 if err != nil { 1480 var snapshot bytes.Buffer 1481 io.Copy(&snapshot, ringBuffer) 1482 return out, metadata, &smithy.DeserializationError{ 1483 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1484 Snapshot: snapshot.Bytes(), 1485 } 1486 } 1487 1488 return out, metadata, err 1489} 1490 1491func awsRestjson1_deserializeOpErrorCreateRobotApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1492 var errorBuffer bytes.Buffer 1493 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1494 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1495 } 1496 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1497 1498 errorCode := "UnknownError" 1499 errorMessage := errorCode 1500 1501 code := response.Header.Get("X-Amzn-ErrorType") 1502 if len(code) != 0 { 1503 errorCode = restjson.SanitizeErrorCode(code) 1504 } 1505 1506 var buff [1024]byte 1507 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1508 1509 body := io.TeeReader(errorBody, ringBuffer) 1510 decoder := json.NewDecoder(body) 1511 decoder.UseNumber() 1512 code, message, err := restjson.GetErrorInfo(decoder) 1513 if err != nil { 1514 var snapshot bytes.Buffer 1515 io.Copy(&snapshot, ringBuffer) 1516 err = &smithy.DeserializationError{ 1517 Err: fmt.Errorf("failed to decode response body, %w", err), 1518 Snapshot: snapshot.Bytes(), 1519 } 1520 return err 1521 } 1522 1523 errorBody.Seek(0, io.SeekStart) 1524 if len(code) != 0 { 1525 errorCode = restjson.SanitizeErrorCode(code) 1526 } 1527 if len(message) != 0 { 1528 errorMessage = message 1529 } 1530 1531 switch { 1532 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 1533 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 1534 1535 case strings.EqualFold("InternalServerException", errorCode): 1536 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1537 1538 case strings.EqualFold("InvalidParameterException", errorCode): 1539 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1540 1541 case strings.EqualFold("LimitExceededException", errorCode): 1542 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1543 1544 case strings.EqualFold("ResourceAlreadyExistsException", errorCode): 1545 return awsRestjson1_deserializeErrorResourceAlreadyExistsException(response, errorBody) 1546 1547 case strings.EqualFold("ThrottlingException", errorCode): 1548 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1549 1550 default: 1551 genericError := &smithy.GenericAPIError{ 1552 Code: errorCode, 1553 Message: errorMessage, 1554 } 1555 return genericError 1556 1557 } 1558} 1559 1560func awsRestjson1_deserializeOpDocumentCreateRobotApplicationOutput(v **CreateRobotApplicationOutput, value interface{}) error { 1561 if v == nil { 1562 return fmt.Errorf("unexpected nil of type %T", v) 1563 } 1564 if value == nil { 1565 return nil 1566 } 1567 1568 shape, ok := value.(map[string]interface{}) 1569 if !ok { 1570 return fmt.Errorf("unexpected JSON type %v", value) 1571 } 1572 1573 var sv *CreateRobotApplicationOutput 1574 if *v == nil { 1575 sv = &CreateRobotApplicationOutput{} 1576 } else { 1577 sv = *v 1578 } 1579 1580 for key, value := range shape { 1581 switch key { 1582 case "arn": 1583 if value != nil { 1584 jtv, ok := value.(string) 1585 if !ok { 1586 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1587 } 1588 sv.Arn = ptr.String(jtv) 1589 } 1590 1591 case "environment": 1592 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 1593 return err 1594 } 1595 1596 case "lastUpdatedAt": 1597 if value != nil { 1598 switch jtv := value.(type) { 1599 case json.Number: 1600 f64, err := jtv.Float64() 1601 if err != nil { 1602 return err 1603 } 1604 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1605 1606 default: 1607 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 1608 1609 } 1610 } 1611 1612 case "name": 1613 if value != nil { 1614 jtv, ok := value.(string) 1615 if !ok { 1616 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1617 } 1618 sv.Name = ptr.String(jtv) 1619 } 1620 1621 case "revisionId": 1622 if value != nil { 1623 jtv, ok := value.(string) 1624 if !ok { 1625 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 1626 } 1627 sv.RevisionId = ptr.String(jtv) 1628 } 1629 1630 case "robotSoftwareSuite": 1631 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 1632 return err 1633 } 1634 1635 case "sources": 1636 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 1637 return err 1638 } 1639 1640 case "tags": 1641 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 1642 return err 1643 } 1644 1645 case "version": 1646 if value != nil { 1647 jtv, ok := value.(string) 1648 if !ok { 1649 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 1650 } 1651 sv.Version = ptr.String(jtv) 1652 } 1653 1654 default: 1655 _, _ = key, value 1656 1657 } 1658 } 1659 *v = sv 1660 return nil 1661} 1662 1663type awsRestjson1_deserializeOpCreateRobotApplicationVersion struct { 1664} 1665 1666func (*awsRestjson1_deserializeOpCreateRobotApplicationVersion) ID() string { 1667 return "OperationDeserializer" 1668} 1669 1670func (m *awsRestjson1_deserializeOpCreateRobotApplicationVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1671 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1672) { 1673 out, metadata, err = next.HandleDeserialize(ctx, in) 1674 if err != nil { 1675 return out, metadata, err 1676 } 1677 1678 response, ok := out.RawResponse.(*smithyhttp.Response) 1679 if !ok { 1680 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1681 } 1682 1683 if response.StatusCode < 200 || response.StatusCode >= 300 { 1684 return out, metadata, awsRestjson1_deserializeOpErrorCreateRobotApplicationVersion(response, &metadata) 1685 } 1686 output := &CreateRobotApplicationVersionOutput{} 1687 out.Result = output 1688 1689 var buff [1024]byte 1690 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1691 1692 body := io.TeeReader(response.Body, ringBuffer) 1693 1694 decoder := json.NewDecoder(body) 1695 decoder.UseNumber() 1696 var shape interface{} 1697 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1698 var snapshot bytes.Buffer 1699 io.Copy(&snapshot, ringBuffer) 1700 err = &smithy.DeserializationError{ 1701 Err: fmt.Errorf("failed to decode response body, %w", err), 1702 Snapshot: snapshot.Bytes(), 1703 } 1704 return out, metadata, err 1705 } 1706 1707 err = awsRestjson1_deserializeOpDocumentCreateRobotApplicationVersionOutput(&output, shape) 1708 if err != nil { 1709 var snapshot bytes.Buffer 1710 io.Copy(&snapshot, ringBuffer) 1711 return out, metadata, &smithy.DeserializationError{ 1712 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1713 Snapshot: snapshot.Bytes(), 1714 } 1715 } 1716 1717 return out, metadata, err 1718} 1719 1720func awsRestjson1_deserializeOpErrorCreateRobotApplicationVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1721 var errorBuffer bytes.Buffer 1722 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1723 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1724 } 1725 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1726 1727 errorCode := "UnknownError" 1728 errorMessage := errorCode 1729 1730 code := response.Header.Get("X-Amzn-ErrorType") 1731 if len(code) != 0 { 1732 errorCode = restjson.SanitizeErrorCode(code) 1733 } 1734 1735 var buff [1024]byte 1736 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1737 1738 body := io.TeeReader(errorBody, ringBuffer) 1739 decoder := json.NewDecoder(body) 1740 decoder.UseNumber() 1741 code, message, err := restjson.GetErrorInfo(decoder) 1742 if err != nil { 1743 var snapshot bytes.Buffer 1744 io.Copy(&snapshot, ringBuffer) 1745 err = &smithy.DeserializationError{ 1746 Err: fmt.Errorf("failed to decode response body, %w", err), 1747 Snapshot: snapshot.Bytes(), 1748 } 1749 return err 1750 } 1751 1752 errorBody.Seek(0, io.SeekStart) 1753 if len(code) != 0 { 1754 errorCode = restjson.SanitizeErrorCode(code) 1755 } 1756 if len(message) != 0 { 1757 errorMessage = message 1758 } 1759 1760 switch { 1761 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 1762 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 1763 1764 case strings.EqualFold("InternalServerException", errorCode): 1765 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1766 1767 case strings.EqualFold("InvalidParameterException", errorCode): 1768 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1769 1770 case strings.EqualFold("LimitExceededException", errorCode): 1771 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1772 1773 case strings.EqualFold("ThrottlingException", errorCode): 1774 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1775 1776 default: 1777 genericError := &smithy.GenericAPIError{ 1778 Code: errorCode, 1779 Message: errorMessage, 1780 } 1781 return genericError 1782 1783 } 1784} 1785 1786func awsRestjson1_deserializeOpDocumentCreateRobotApplicationVersionOutput(v **CreateRobotApplicationVersionOutput, value interface{}) error { 1787 if v == nil { 1788 return fmt.Errorf("unexpected nil of type %T", v) 1789 } 1790 if value == nil { 1791 return nil 1792 } 1793 1794 shape, ok := value.(map[string]interface{}) 1795 if !ok { 1796 return fmt.Errorf("unexpected JSON type %v", value) 1797 } 1798 1799 var sv *CreateRobotApplicationVersionOutput 1800 if *v == nil { 1801 sv = &CreateRobotApplicationVersionOutput{} 1802 } else { 1803 sv = *v 1804 } 1805 1806 for key, value := range shape { 1807 switch key { 1808 case "arn": 1809 if value != nil { 1810 jtv, ok := value.(string) 1811 if !ok { 1812 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1813 } 1814 sv.Arn = ptr.String(jtv) 1815 } 1816 1817 case "environment": 1818 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 1819 return err 1820 } 1821 1822 case "lastUpdatedAt": 1823 if value != nil { 1824 switch jtv := value.(type) { 1825 case json.Number: 1826 f64, err := jtv.Float64() 1827 if err != nil { 1828 return err 1829 } 1830 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1831 1832 default: 1833 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 1834 1835 } 1836 } 1837 1838 case "name": 1839 if value != nil { 1840 jtv, ok := value.(string) 1841 if !ok { 1842 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1843 } 1844 sv.Name = ptr.String(jtv) 1845 } 1846 1847 case "revisionId": 1848 if value != nil { 1849 jtv, ok := value.(string) 1850 if !ok { 1851 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 1852 } 1853 sv.RevisionId = ptr.String(jtv) 1854 } 1855 1856 case "robotSoftwareSuite": 1857 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 1858 return err 1859 } 1860 1861 case "sources": 1862 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 1863 return err 1864 } 1865 1866 case "version": 1867 if value != nil { 1868 jtv, ok := value.(string) 1869 if !ok { 1870 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 1871 } 1872 sv.Version = ptr.String(jtv) 1873 } 1874 1875 default: 1876 _, _ = key, value 1877 1878 } 1879 } 1880 *v = sv 1881 return nil 1882} 1883 1884type awsRestjson1_deserializeOpCreateSimulationApplication struct { 1885} 1886 1887func (*awsRestjson1_deserializeOpCreateSimulationApplication) ID() string { 1888 return "OperationDeserializer" 1889} 1890 1891func (m *awsRestjson1_deserializeOpCreateSimulationApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1892 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1893) { 1894 out, metadata, err = next.HandleDeserialize(ctx, in) 1895 if err != nil { 1896 return out, metadata, err 1897 } 1898 1899 response, ok := out.RawResponse.(*smithyhttp.Response) 1900 if !ok { 1901 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1902 } 1903 1904 if response.StatusCode < 200 || response.StatusCode >= 300 { 1905 return out, metadata, awsRestjson1_deserializeOpErrorCreateSimulationApplication(response, &metadata) 1906 } 1907 output := &CreateSimulationApplicationOutput{} 1908 out.Result = output 1909 1910 var buff [1024]byte 1911 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1912 1913 body := io.TeeReader(response.Body, ringBuffer) 1914 1915 decoder := json.NewDecoder(body) 1916 decoder.UseNumber() 1917 var shape interface{} 1918 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1919 var snapshot bytes.Buffer 1920 io.Copy(&snapshot, ringBuffer) 1921 err = &smithy.DeserializationError{ 1922 Err: fmt.Errorf("failed to decode response body, %w", err), 1923 Snapshot: snapshot.Bytes(), 1924 } 1925 return out, metadata, err 1926 } 1927 1928 err = awsRestjson1_deserializeOpDocumentCreateSimulationApplicationOutput(&output, shape) 1929 if err != nil { 1930 var snapshot bytes.Buffer 1931 io.Copy(&snapshot, ringBuffer) 1932 return out, metadata, &smithy.DeserializationError{ 1933 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1934 Snapshot: snapshot.Bytes(), 1935 } 1936 } 1937 1938 return out, metadata, err 1939} 1940 1941func awsRestjson1_deserializeOpErrorCreateSimulationApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1942 var errorBuffer bytes.Buffer 1943 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1944 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1945 } 1946 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1947 1948 errorCode := "UnknownError" 1949 errorMessage := errorCode 1950 1951 code := response.Header.Get("X-Amzn-ErrorType") 1952 if len(code) != 0 { 1953 errorCode = restjson.SanitizeErrorCode(code) 1954 } 1955 1956 var buff [1024]byte 1957 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1958 1959 body := io.TeeReader(errorBody, ringBuffer) 1960 decoder := json.NewDecoder(body) 1961 decoder.UseNumber() 1962 code, message, err := restjson.GetErrorInfo(decoder) 1963 if err != nil { 1964 var snapshot bytes.Buffer 1965 io.Copy(&snapshot, ringBuffer) 1966 err = &smithy.DeserializationError{ 1967 Err: fmt.Errorf("failed to decode response body, %w", err), 1968 Snapshot: snapshot.Bytes(), 1969 } 1970 return err 1971 } 1972 1973 errorBody.Seek(0, io.SeekStart) 1974 if len(code) != 0 { 1975 errorCode = restjson.SanitizeErrorCode(code) 1976 } 1977 if len(message) != 0 { 1978 errorMessage = message 1979 } 1980 1981 switch { 1982 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 1983 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 1984 1985 case strings.EqualFold("InternalServerException", errorCode): 1986 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1987 1988 case strings.EqualFold("InvalidParameterException", errorCode): 1989 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1990 1991 case strings.EqualFold("LimitExceededException", errorCode): 1992 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1993 1994 case strings.EqualFold("ResourceAlreadyExistsException", errorCode): 1995 return awsRestjson1_deserializeErrorResourceAlreadyExistsException(response, errorBody) 1996 1997 case strings.EqualFold("ThrottlingException", errorCode): 1998 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1999 2000 default: 2001 genericError := &smithy.GenericAPIError{ 2002 Code: errorCode, 2003 Message: errorMessage, 2004 } 2005 return genericError 2006 2007 } 2008} 2009 2010func awsRestjson1_deserializeOpDocumentCreateSimulationApplicationOutput(v **CreateSimulationApplicationOutput, value interface{}) error { 2011 if v == nil { 2012 return fmt.Errorf("unexpected nil of type %T", v) 2013 } 2014 if value == nil { 2015 return nil 2016 } 2017 2018 shape, ok := value.(map[string]interface{}) 2019 if !ok { 2020 return fmt.Errorf("unexpected JSON type %v", value) 2021 } 2022 2023 var sv *CreateSimulationApplicationOutput 2024 if *v == nil { 2025 sv = &CreateSimulationApplicationOutput{} 2026 } else { 2027 sv = *v 2028 } 2029 2030 for key, value := range shape { 2031 switch key { 2032 case "arn": 2033 if value != nil { 2034 jtv, ok := value.(string) 2035 if !ok { 2036 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2037 } 2038 sv.Arn = ptr.String(jtv) 2039 } 2040 2041 case "environment": 2042 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 2043 return err 2044 } 2045 2046 case "lastUpdatedAt": 2047 if value != nil { 2048 switch jtv := value.(type) { 2049 case json.Number: 2050 f64, err := jtv.Float64() 2051 if err != nil { 2052 return err 2053 } 2054 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 2055 2056 default: 2057 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 2058 2059 } 2060 } 2061 2062 case "name": 2063 if value != nil { 2064 jtv, ok := value.(string) 2065 if !ok { 2066 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 2067 } 2068 sv.Name = ptr.String(jtv) 2069 } 2070 2071 case "renderingEngine": 2072 if err := awsRestjson1_deserializeDocumentRenderingEngine(&sv.RenderingEngine, value); err != nil { 2073 return err 2074 } 2075 2076 case "revisionId": 2077 if value != nil { 2078 jtv, ok := value.(string) 2079 if !ok { 2080 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 2081 } 2082 sv.RevisionId = ptr.String(jtv) 2083 } 2084 2085 case "robotSoftwareSuite": 2086 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 2087 return err 2088 } 2089 2090 case "simulationSoftwareSuite": 2091 if err := awsRestjson1_deserializeDocumentSimulationSoftwareSuite(&sv.SimulationSoftwareSuite, value); err != nil { 2092 return err 2093 } 2094 2095 case "sources": 2096 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 2097 return err 2098 } 2099 2100 case "tags": 2101 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 2102 return err 2103 } 2104 2105 case "version": 2106 if value != nil { 2107 jtv, ok := value.(string) 2108 if !ok { 2109 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 2110 } 2111 sv.Version = ptr.String(jtv) 2112 } 2113 2114 default: 2115 _, _ = key, value 2116 2117 } 2118 } 2119 *v = sv 2120 return nil 2121} 2122 2123type awsRestjson1_deserializeOpCreateSimulationApplicationVersion struct { 2124} 2125 2126func (*awsRestjson1_deserializeOpCreateSimulationApplicationVersion) ID() string { 2127 return "OperationDeserializer" 2128} 2129 2130func (m *awsRestjson1_deserializeOpCreateSimulationApplicationVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2131 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2132) { 2133 out, metadata, err = next.HandleDeserialize(ctx, in) 2134 if err != nil { 2135 return out, metadata, err 2136 } 2137 2138 response, ok := out.RawResponse.(*smithyhttp.Response) 2139 if !ok { 2140 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2141 } 2142 2143 if response.StatusCode < 200 || response.StatusCode >= 300 { 2144 return out, metadata, awsRestjson1_deserializeOpErrorCreateSimulationApplicationVersion(response, &metadata) 2145 } 2146 output := &CreateSimulationApplicationVersionOutput{} 2147 out.Result = output 2148 2149 var buff [1024]byte 2150 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2151 2152 body := io.TeeReader(response.Body, ringBuffer) 2153 2154 decoder := json.NewDecoder(body) 2155 decoder.UseNumber() 2156 var shape interface{} 2157 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2158 var snapshot bytes.Buffer 2159 io.Copy(&snapshot, ringBuffer) 2160 err = &smithy.DeserializationError{ 2161 Err: fmt.Errorf("failed to decode response body, %w", err), 2162 Snapshot: snapshot.Bytes(), 2163 } 2164 return out, metadata, err 2165 } 2166 2167 err = awsRestjson1_deserializeOpDocumentCreateSimulationApplicationVersionOutput(&output, shape) 2168 if err != nil { 2169 var snapshot bytes.Buffer 2170 io.Copy(&snapshot, ringBuffer) 2171 return out, metadata, &smithy.DeserializationError{ 2172 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2173 Snapshot: snapshot.Bytes(), 2174 } 2175 } 2176 2177 return out, metadata, err 2178} 2179 2180func awsRestjson1_deserializeOpErrorCreateSimulationApplicationVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2181 var errorBuffer bytes.Buffer 2182 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2183 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2184 } 2185 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2186 2187 errorCode := "UnknownError" 2188 errorMessage := errorCode 2189 2190 code := response.Header.Get("X-Amzn-ErrorType") 2191 if len(code) != 0 { 2192 errorCode = restjson.SanitizeErrorCode(code) 2193 } 2194 2195 var buff [1024]byte 2196 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2197 2198 body := io.TeeReader(errorBody, ringBuffer) 2199 decoder := json.NewDecoder(body) 2200 decoder.UseNumber() 2201 code, message, err := restjson.GetErrorInfo(decoder) 2202 if err != nil { 2203 var snapshot bytes.Buffer 2204 io.Copy(&snapshot, ringBuffer) 2205 err = &smithy.DeserializationError{ 2206 Err: fmt.Errorf("failed to decode response body, %w", err), 2207 Snapshot: snapshot.Bytes(), 2208 } 2209 return err 2210 } 2211 2212 errorBody.Seek(0, io.SeekStart) 2213 if len(code) != 0 { 2214 errorCode = restjson.SanitizeErrorCode(code) 2215 } 2216 if len(message) != 0 { 2217 errorMessage = message 2218 } 2219 2220 switch { 2221 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 2222 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 2223 2224 case strings.EqualFold("InternalServerException", errorCode): 2225 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2226 2227 case strings.EqualFold("InvalidParameterException", errorCode): 2228 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 2229 2230 case strings.EqualFold("LimitExceededException", errorCode): 2231 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 2232 2233 case strings.EqualFold("ThrottlingException", errorCode): 2234 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2235 2236 default: 2237 genericError := &smithy.GenericAPIError{ 2238 Code: errorCode, 2239 Message: errorMessage, 2240 } 2241 return genericError 2242 2243 } 2244} 2245 2246func awsRestjson1_deserializeOpDocumentCreateSimulationApplicationVersionOutput(v **CreateSimulationApplicationVersionOutput, value interface{}) error { 2247 if v == nil { 2248 return fmt.Errorf("unexpected nil of type %T", v) 2249 } 2250 if value == nil { 2251 return nil 2252 } 2253 2254 shape, ok := value.(map[string]interface{}) 2255 if !ok { 2256 return fmt.Errorf("unexpected JSON type %v", value) 2257 } 2258 2259 var sv *CreateSimulationApplicationVersionOutput 2260 if *v == nil { 2261 sv = &CreateSimulationApplicationVersionOutput{} 2262 } else { 2263 sv = *v 2264 } 2265 2266 for key, value := range shape { 2267 switch key { 2268 case "arn": 2269 if value != nil { 2270 jtv, ok := value.(string) 2271 if !ok { 2272 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2273 } 2274 sv.Arn = ptr.String(jtv) 2275 } 2276 2277 case "environment": 2278 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 2279 return err 2280 } 2281 2282 case "lastUpdatedAt": 2283 if value != nil { 2284 switch jtv := value.(type) { 2285 case json.Number: 2286 f64, err := jtv.Float64() 2287 if err != nil { 2288 return err 2289 } 2290 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 2291 2292 default: 2293 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 2294 2295 } 2296 } 2297 2298 case "name": 2299 if value != nil { 2300 jtv, ok := value.(string) 2301 if !ok { 2302 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 2303 } 2304 sv.Name = ptr.String(jtv) 2305 } 2306 2307 case "renderingEngine": 2308 if err := awsRestjson1_deserializeDocumentRenderingEngine(&sv.RenderingEngine, value); err != nil { 2309 return err 2310 } 2311 2312 case "revisionId": 2313 if value != nil { 2314 jtv, ok := value.(string) 2315 if !ok { 2316 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 2317 } 2318 sv.RevisionId = ptr.String(jtv) 2319 } 2320 2321 case "robotSoftwareSuite": 2322 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 2323 return err 2324 } 2325 2326 case "simulationSoftwareSuite": 2327 if err := awsRestjson1_deserializeDocumentSimulationSoftwareSuite(&sv.SimulationSoftwareSuite, value); err != nil { 2328 return err 2329 } 2330 2331 case "sources": 2332 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 2333 return err 2334 } 2335 2336 case "version": 2337 if value != nil { 2338 jtv, ok := value.(string) 2339 if !ok { 2340 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 2341 } 2342 sv.Version = ptr.String(jtv) 2343 } 2344 2345 default: 2346 _, _ = key, value 2347 2348 } 2349 } 2350 *v = sv 2351 return nil 2352} 2353 2354type awsRestjson1_deserializeOpCreateSimulationJob struct { 2355} 2356 2357func (*awsRestjson1_deserializeOpCreateSimulationJob) ID() string { 2358 return "OperationDeserializer" 2359} 2360 2361func (m *awsRestjson1_deserializeOpCreateSimulationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2362 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2363) { 2364 out, metadata, err = next.HandleDeserialize(ctx, in) 2365 if err != nil { 2366 return out, metadata, err 2367 } 2368 2369 response, ok := out.RawResponse.(*smithyhttp.Response) 2370 if !ok { 2371 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2372 } 2373 2374 if response.StatusCode < 200 || response.StatusCode >= 300 { 2375 return out, metadata, awsRestjson1_deserializeOpErrorCreateSimulationJob(response, &metadata) 2376 } 2377 output := &CreateSimulationJobOutput{} 2378 out.Result = output 2379 2380 var buff [1024]byte 2381 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2382 2383 body := io.TeeReader(response.Body, ringBuffer) 2384 2385 decoder := json.NewDecoder(body) 2386 decoder.UseNumber() 2387 var shape interface{} 2388 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2389 var snapshot bytes.Buffer 2390 io.Copy(&snapshot, ringBuffer) 2391 err = &smithy.DeserializationError{ 2392 Err: fmt.Errorf("failed to decode response body, %w", err), 2393 Snapshot: snapshot.Bytes(), 2394 } 2395 return out, metadata, err 2396 } 2397 2398 err = awsRestjson1_deserializeOpDocumentCreateSimulationJobOutput(&output, shape) 2399 if err != nil { 2400 var snapshot bytes.Buffer 2401 io.Copy(&snapshot, ringBuffer) 2402 return out, metadata, &smithy.DeserializationError{ 2403 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2404 Snapshot: snapshot.Bytes(), 2405 } 2406 } 2407 2408 return out, metadata, err 2409} 2410 2411func awsRestjson1_deserializeOpErrorCreateSimulationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2412 var errorBuffer bytes.Buffer 2413 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2414 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2415 } 2416 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2417 2418 errorCode := "UnknownError" 2419 errorMessage := errorCode 2420 2421 code := response.Header.Get("X-Amzn-ErrorType") 2422 if len(code) != 0 { 2423 errorCode = restjson.SanitizeErrorCode(code) 2424 } 2425 2426 var buff [1024]byte 2427 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2428 2429 body := io.TeeReader(errorBody, ringBuffer) 2430 decoder := json.NewDecoder(body) 2431 decoder.UseNumber() 2432 code, message, err := restjson.GetErrorInfo(decoder) 2433 if err != nil { 2434 var snapshot bytes.Buffer 2435 io.Copy(&snapshot, ringBuffer) 2436 err = &smithy.DeserializationError{ 2437 Err: fmt.Errorf("failed to decode response body, %w", err), 2438 Snapshot: snapshot.Bytes(), 2439 } 2440 return err 2441 } 2442 2443 errorBody.Seek(0, io.SeekStart) 2444 if len(code) != 0 { 2445 errorCode = restjson.SanitizeErrorCode(code) 2446 } 2447 if len(message) != 0 { 2448 errorMessage = message 2449 } 2450 2451 switch { 2452 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 2453 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 2454 2455 case strings.EqualFold("InternalServerException", errorCode): 2456 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2457 2458 case strings.EqualFold("InvalidParameterException", errorCode): 2459 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 2460 2461 case strings.EqualFold("LimitExceededException", errorCode): 2462 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 2463 2464 case strings.EqualFold("ResourceNotFoundException", errorCode): 2465 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2466 2467 case strings.EqualFold("ServiceUnavailableException", errorCode): 2468 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2469 2470 case strings.EqualFold("ThrottlingException", errorCode): 2471 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2472 2473 default: 2474 genericError := &smithy.GenericAPIError{ 2475 Code: errorCode, 2476 Message: errorMessage, 2477 } 2478 return genericError 2479 2480 } 2481} 2482 2483func awsRestjson1_deserializeOpDocumentCreateSimulationJobOutput(v **CreateSimulationJobOutput, value interface{}) error { 2484 if v == nil { 2485 return fmt.Errorf("unexpected nil of type %T", v) 2486 } 2487 if value == nil { 2488 return nil 2489 } 2490 2491 shape, ok := value.(map[string]interface{}) 2492 if !ok { 2493 return fmt.Errorf("unexpected JSON type %v", value) 2494 } 2495 2496 var sv *CreateSimulationJobOutput 2497 if *v == nil { 2498 sv = &CreateSimulationJobOutput{} 2499 } else { 2500 sv = *v 2501 } 2502 2503 for key, value := range shape { 2504 switch key { 2505 case "arn": 2506 if value != nil { 2507 jtv, ok := value.(string) 2508 if !ok { 2509 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2510 } 2511 sv.Arn = ptr.String(jtv) 2512 } 2513 2514 case "clientRequestToken": 2515 if value != nil { 2516 jtv, ok := value.(string) 2517 if !ok { 2518 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 2519 } 2520 sv.ClientRequestToken = ptr.String(jtv) 2521 } 2522 2523 case "compute": 2524 if err := awsRestjson1_deserializeDocumentComputeResponse(&sv.Compute, value); err != nil { 2525 return err 2526 } 2527 2528 case "dataSources": 2529 if err := awsRestjson1_deserializeDocumentDataSources(&sv.DataSources, value); err != nil { 2530 return err 2531 } 2532 2533 case "failureBehavior": 2534 if value != nil { 2535 jtv, ok := value.(string) 2536 if !ok { 2537 return fmt.Errorf("expected FailureBehavior to be of type string, got %T instead", value) 2538 } 2539 sv.FailureBehavior = types.FailureBehavior(jtv) 2540 } 2541 2542 case "failureCode": 2543 if value != nil { 2544 jtv, ok := value.(string) 2545 if !ok { 2546 return fmt.Errorf("expected SimulationJobErrorCode to be of type string, got %T instead", value) 2547 } 2548 sv.FailureCode = types.SimulationJobErrorCode(jtv) 2549 } 2550 2551 case "iamRole": 2552 if value != nil { 2553 jtv, ok := value.(string) 2554 if !ok { 2555 return fmt.Errorf("expected IamRole to be of type string, got %T instead", value) 2556 } 2557 sv.IamRole = ptr.String(jtv) 2558 } 2559 2560 case "lastStartedAt": 2561 if value != nil { 2562 switch jtv := value.(type) { 2563 case json.Number: 2564 f64, err := jtv.Float64() 2565 if err != nil { 2566 return err 2567 } 2568 sv.LastStartedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 2569 2570 default: 2571 return fmt.Errorf("expected LastStartedAt to be a JSON Number, got %T instead", value) 2572 2573 } 2574 } 2575 2576 case "lastUpdatedAt": 2577 if value != nil { 2578 switch jtv := value.(type) { 2579 case json.Number: 2580 f64, err := jtv.Float64() 2581 if err != nil { 2582 return err 2583 } 2584 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 2585 2586 default: 2587 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 2588 2589 } 2590 } 2591 2592 case "loggingConfig": 2593 if err := awsRestjson1_deserializeDocumentLoggingConfig(&sv.LoggingConfig, value); err != nil { 2594 return err 2595 } 2596 2597 case "maxJobDurationInSeconds": 2598 if value != nil { 2599 jtv, ok := value.(json.Number) 2600 if !ok { 2601 return fmt.Errorf("expected JobDuration to be json.Number, got %T instead", value) 2602 } 2603 i64, err := jtv.Int64() 2604 if err != nil { 2605 return err 2606 } 2607 sv.MaxJobDurationInSeconds = i64 2608 } 2609 2610 case "outputLocation": 2611 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 2612 return err 2613 } 2614 2615 case "robotApplications": 2616 if err := awsRestjson1_deserializeDocumentRobotApplicationConfigs(&sv.RobotApplications, value); err != nil { 2617 return err 2618 } 2619 2620 case "simulationApplications": 2621 if err := awsRestjson1_deserializeDocumentSimulationApplicationConfigs(&sv.SimulationApplications, value); err != nil { 2622 return err 2623 } 2624 2625 case "simulationTimeMillis": 2626 if value != nil { 2627 jtv, ok := value.(json.Number) 2628 if !ok { 2629 return fmt.Errorf("expected SimulationTimeMillis to be json.Number, got %T instead", value) 2630 } 2631 i64, err := jtv.Int64() 2632 if err != nil { 2633 return err 2634 } 2635 sv.SimulationTimeMillis = i64 2636 } 2637 2638 case "status": 2639 if value != nil { 2640 jtv, ok := value.(string) 2641 if !ok { 2642 return fmt.Errorf("expected SimulationJobStatus to be of type string, got %T instead", value) 2643 } 2644 sv.Status = types.SimulationJobStatus(jtv) 2645 } 2646 2647 case "tags": 2648 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 2649 return err 2650 } 2651 2652 case "vpcConfig": 2653 if err := awsRestjson1_deserializeDocumentVPCConfigResponse(&sv.VpcConfig, value); err != nil { 2654 return err 2655 } 2656 2657 default: 2658 _, _ = key, value 2659 2660 } 2661 } 2662 *v = sv 2663 return nil 2664} 2665 2666type awsRestjson1_deserializeOpCreateWorldExportJob struct { 2667} 2668 2669func (*awsRestjson1_deserializeOpCreateWorldExportJob) ID() string { 2670 return "OperationDeserializer" 2671} 2672 2673func (m *awsRestjson1_deserializeOpCreateWorldExportJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2674 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2675) { 2676 out, metadata, err = next.HandleDeserialize(ctx, in) 2677 if err != nil { 2678 return out, metadata, err 2679 } 2680 2681 response, ok := out.RawResponse.(*smithyhttp.Response) 2682 if !ok { 2683 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2684 } 2685 2686 if response.StatusCode < 200 || response.StatusCode >= 300 { 2687 return out, metadata, awsRestjson1_deserializeOpErrorCreateWorldExportJob(response, &metadata) 2688 } 2689 output := &CreateWorldExportJobOutput{} 2690 out.Result = output 2691 2692 var buff [1024]byte 2693 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2694 2695 body := io.TeeReader(response.Body, ringBuffer) 2696 2697 decoder := json.NewDecoder(body) 2698 decoder.UseNumber() 2699 var shape interface{} 2700 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2701 var snapshot bytes.Buffer 2702 io.Copy(&snapshot, ringBuffer) 2703 err = &smithy.DeserializationError{ 2704 Err: fmt.Errorf("failed to decode response body, %w", err), 2705 Snapshot: snapshot.Bytes(), 2706 } 2707 return out, metadata, err 2708 } 2709 2710 err = awsRestjson1_deserializeOpDocumentCreateWorldExportJobOutput(&output, shape) 2711 if err != nil { 2712 var snapshot bytes.Buffer 2713 io.Copy(&snapshot, ringBuffer) 2714 return out, metadata, &smithy.DeserializationError{ 2715 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2716 Snapshot: snapshot.Bytes(), 2717 } 2718 } 2719 2720 return out, metadata, err 2721} 2722 2723func awsRestjson1_deserializeOpErrorCreateWorldExportJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2724 var errorBuffer bytes.Buffer 2725 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2726 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2727 } 2728 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2729 2730 errorCode := "UnknownError" 2731 errorMessage := errorCode 2732 2733 code := response.Header.Get("X-Amzn-ErrorType") 2734 if len(code) != 0 { 2735 errorCode = restjson.SanitizeErrorCode(code) 2736 } 2737 2738 var buff [1024]byte 2739 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2740 2741 body := io.TeeReader(errorBody, ringBuffer) 2742 decoder := json.NewDecoder(body) 2743 decoder.UseNumber() 2744 code, message, err := restjson.GetErrorInfo(decoder) 2745 if err != nil { 2746 var snapshot bytes.Buffer 2747 io.Copy(&snapshot, ringBuffer) 2748 err = &smithy.DeserializationError{ 2749 Err: fmt.Errorf("failed to decode response body, %w", err), 2750 Snapshot: snapshot.Bytes(), 2751 } 2752 return err 2753 } 2754 2755 errorBody.Seek(0, io.SeekStart) 2756 if len(code) != 0 { 2757 errorCode = restjson.SanitizeErrorCode(code) 2758 } 2759 if len(message) != 0 { 2760 errorMessage = message 2761 } 2762 2763 switch { 2764 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 2765 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 2766 2767 case strings.EqualFold("InternalServerException", errorCode): 2768 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2769 2770 case strings.EqualFold("InvalidParameterException", errorCode): 2771 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 2772 2773 case strings.EqualFold("ResourceNotFoundException", errorCode): 2774 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2775 2776 case strings.EqualFold("ServiceUnavailableException", errorCode): 2777 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2778 2779 case strings.EqualFold("ThrottlingException", errorCode): 2780 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2781 2782 default: 2783 genericError := &smithy.GenericAPIError{ 2784 Code: errorCode, 2785 Message: errorMessage, 2786 } 2787 return genericError 2788 2789 } 2790} 2791 2792func awsRestjson1_deserializeOpDocumentCreateWorldExportJobOutput(v **CreateWorldExportJobOutput, value interface{}) error { 2793 if v == nil { 2794 return fmt.Errorf("unexpected nil of type %T", v) 2795 } 2796 if value == nil { 2797 return nil 2798 } 2799 2800 shape, ok := value.(map[string]interface{}) 2801 if !ok { 2802 return fmt.Errorf("unexpected JSON type %v", value) 2803 } 2804 2805 var sv *CreateWorldExportJobOutput 2806 if *v == nil { 2807 sv = &CreateWorldExportJobOutput{} 2808 } else { 2809 sv = *v 2810 } 2811 2812 for key, value := range shape { 2813 switch key { 2814 case "arn": 2815 if value != nil { 2816 jtv, ok := value.(string) 2817 if !ok { 2818 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2819 } 2820 sv.Arn = ptr.String(jtv) 2821 } 2822 2823 case "clientRequestToken": 2824 if value != nil { 2825 jtv, ok := value.(string) 2826 if !ok { 2827 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 2828 } 2829 sv.ClientRequestToken = ptr.String(jtv) 2830 } 2831 2832 case "createdAt": 2833 if value != nil { 2834 switch jtv := value.(type) { 2835 case json.Number: 2836 f64, err := jtv.Float64() 2837 if err != nil { 2838 return err 2839 } 2840 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 2841 2842 default: 2843 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 2844 2845 } 2846 } 2847 2848 case "failureCode": 2849 if value != nil { 2850 jtv, ok := value.(string) 2851 if !ok { 2852 return fmt.Errorf("expected WorldExportJobErrorCode to be of type string, got %T instead", value) 2853 } 2854 sv.FailureCode = types.WorldExportJobErrorCode(jtv) 2855 } 2856 2857 case "iamRole": 2858 if value != nil { 2859 jtv, ok := value.(string) 2860 if !ok { 2861 return fmt.Errorf("expected IamRole to be of type string, got %T instead", value) 2862 } 2863 sv.IamRole = ptr.String(jtv) 2864 } 2865 2866 case "outputLocation": 2867 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 2868 return err 2869 } 2870 2871 case "status": 2872 if value != nil { 2873 jtv, ok := value.(string) 2874 if !ok { 2875 return fmt.Errorf("expected WorldExportJobStatus to be of type string, got %T instead", value) 2876 } 2877 sv.Status = types.WorldExportJobStatus(jtv) 2878 } 2879 2880 case "tags": 2881 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 2882 return err 2883 } 2884 2885 default: 2886 _, _ = key, value 2887 2888 } 2889 } 2890 *v = sv 2891 return nil 2892} 2893 2894type awsRestjson1_deserializeOpCreateWorldGenerationJob struct { 2895} 2896 2897func (*awsRestjson1_deserializeOpCreateWorldGenerationJob) ID() string { 2898 return "OperationDeserializer" 2899} 2900 2901func (m *awsRestjson1_deserializeOpCreateWorldGenerationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2902 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2903) { 2904 out, metadata, err = next.HandleDeserialize(ctx, in) 2905 if err != nil { 2906 return out, metadata, err 2907 } 2908 2909 response, ok := out.RawResponse.(*smithyhttp.Response) 2910 if !ok { 2911 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2912 } 2913 2914 if response.StatusCode < 200 || response.StatusCode >= 300 { 2915 return out, metadata, awsRestjson1_deserializeOpErrorCreateWorldGenerationJob(response, &metadata) 2916 } 2917 output := &CreateWorldGenerationJobOutput{} 2918 out.Result = output 2919 2920 var buff [1024]byte 2921 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2922 2923 body := io.TeeReader(response.Body, ringBuffer) 2924 2925 decoder := json.NewDecoder(body) 2926 decoder.UseNumber() 2927 var shape interface{} 2928 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2929 var snapshot bytes.Buffer 2930 io.Copy(&snapshot, ringBuffer) 2931 err = &smithy.DeserializationError{ 2932 Err: fmt.Errorf("failed to decode response body, %w", err), 2933 Snapshot: snapshot.Bytes(), 2934 } 2935 return out, metadata, err 2936 } 2937 2938 err = awsRestjson1_deserializeOpDocumentCreateWorldGenerationJobOutput(&output, shape) 2939 if err != nil { 2940 var snapshot bytes.Buffer 2941 io.Copy(&snapshot, ringBuffer) 2942 return out, metadata, &smithy.DeserializationError{ 2943 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2944 Snapshot: snapshot.Bytes(), 2945 } 2946 } 2947 2948 return out, metadata, err 2949} 2950 2951func awsRestjson1_deserializeOpErrorCreateWorldGenerationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2952 var errorBuffer bytes.Buffer 2953 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2954 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2955 } 2956 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2957 2958 errorCode := "UnknownError" 2959 errorMessage := errorCode 2960 2961 code := response.Header.Get("X-Amzn-ErrorType") 2962 if len(code) != 0 { 2963 errorCode = restjson.SanitizeErrorCode(code) 2964 } 2965 2966 var buff [1024]byte 2967 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2968 2969 body := io.TeeReader(errorBody, ringBuffer) 2970 decoder := json.NewDecoder(body) 2971 decoder.UseNumber() 2972 code, message, err := restjson.GetErrorInfo(decoder) 2973 if err != nil { 2974 var snapshot bytes.Buffer 2975 io.Copy(&snapshot, ringBuffer) 2976 err = &smithy.DeserializationError{ 2977 Err: fmt.Errorf("failed to decode response body, %w", err), 2978 Snapshot: snapshot.Bytes(), 2979 } 2980 return err 2981 } 2982 2983 errorBody.Seek(0, io.SeekStart) 2984 if len(code) != 0 { 2985 errorCode = restjson.SanitizeErrorCode(code) 2986 } 2987 if len(message) != 0 { 2988 errorMessage = message 2989 } 2990 2991 switch { 2992 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 2993 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 2994 2995 case strings.EqualFold("InternalServerException", errorCode): 2996 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2997 2998 case strings.EqualFold("InvalidParameterException", errorCode): 2999 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3000 3001 case strings.EqualFold("LimitExceededException", errorCode): 3002 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 3003 3004 case strings.EqualFold("ResourceNotFoundException", errorCode): 3005 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3006 3007 case strings.EqualFold("ServiceUnavailableException", errorCode): 3008 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3009 3010 case strings.EqualFold("ThrottlingException", errorCode): 3011 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3012 3013 default: 3014 genericError := &smithy.GenericAPIError{ 3015 Code: errorCode, 3016 Message: errorMessage, 3017 } 3018 return genericError 3019 3020 } 3021} 3022 3023func awsRestjson1_deserializeOpDocumentCreateWorldGenerationJobOutput(v **CreateWorldGenerationJobOutput, value interface{}) error { 3024 if v == nil { 3025 return fmt.Errorf("unexpected nil of type %T", v) 3026 } 3027 if value == nil { 3028 return nil 3029 } 3030 3031 shape, ok := value.(map[string]interface{}) 3032 if !ok { 3033 return fmt.Errorf("unexpected JSON type %v", value) 3034 } 3035 3036 var sv *CreateWorldGenerationJobOutput 3037 if *v == nil { 3038 sv = &CreateWorldGenerationJobOutput{} 3039 } else { 3040 sv = *v 3041 } 3042 3043 for key, value := range shape { 3044 switch key { 3045 case "arn": 3046 if value != nil { 3047 jtv, ok := value.(string) 3048 if !ok { 3049 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3050 } 3051 sv.Arn = ptr.String(jtv) 3052 } 3053 3054 case "clientRequestToken": 3055 if value != nil { 3056 jtv, ok := value.(string) 3057 if !ok { 3058 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 3059 } 3060 sv.ClientRequestToken = ptr.String(jtv) 3061 } 3062 3063 case "createdAt": 3064 if value != nil { 3065 switch jtv := value.(type) { 3066 case json.Number: 3067 f64, err := jtv.Float64() 3068 if err != nil { 3069 return err 3070 } 3071 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3072 3073 default: 3074 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 3075 3076 } 3077 } 3078 3079 case "failureCode": 3080 if value != nil { 3081 jtv, ok := value.(string) 3082 if !ok { 3083 return fmt.Errorf("expected WorldGenerationJobErrorCode to be of type string, got %T instead", value) 3084 } 3085 sv.FailureCode = types.WorldGenerationJobErrorCode(jtv) 3086 } 3087 3088 case "status": 3089 if value != nil { 3090 jtv, ok := value.(string) 3091 if !ok { 3092 return fmt.Errorf("expected WorldGenerationJobStatus to be of type string, got %T instead", value) 3093 } 3094 sv.Status = types.WorldGenerationJobStatus(jtv) 3095 } 3096 3097 case "tags": 3098 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 3099 return err 3100 } 3101 3102 case "template": 3103 if value != nil { 3104 jtv, ok := value.(string) 3105 if !ok { 3106 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3107 } 3108 sv.Template = ptr.String(jtv) 3109 } 3110 3111 case "worldCount": 3112 if err := awsRestjson1_deserializeDocumentWorldCount(&sv.WorldCount, value); err != nil { 3113 return err 3114 } 3115 3116 case "worldTags": 3117 if err := awsRestjson1_deserializeDocumentTagMap(&sv.WorldTags, value); err != nil { 3118 return err 3119 } 3120 3121 default: 3122 _, _ = key, value 3123 3124 } 3125 } 3126 *v = sv 3127 return nil 3128} 3129 3130type awsRestjson1_deserializeOpCreateWorldTemplate struct { 3131} 3132 3133func (*awsRestjson1_deserializeOpCreateWorldTemplate) ID() string { 3134 return "OperationDeserializer" 3135} 3136 3137func (m *awsRestjson1_deserializeOpCreateWorldTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3138 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3139) { 3140 out, metadata, err = next.HandleDeserialize(ctx, in) 3141 if err != nil { 3142 return out, metadata, err 3143 } 3144 3145 response, ok := out.RawResponse.(*smithyhttp.Response) 3146 if !ok { 3147 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3148 } 3149 3150 if response.StatusCode < 200 || response.StatusCode >= 300 { 3151 return out, metadata, awsRestjson1_deserializeOpErrorCreateWorldTemplate(response, &metadata) 3152 } 3153 output := &CreateWorldTemplateOutput{} 3154 out.Result = output 3155 3156 var buff [1024]byte 3157 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3158 3159 body := io.TeeReader(response.Body, ringBuffer) 3160 3161 decoder := json.NewDecoder(body) 3162 decoder.UseNumber() 3163 var shape interface{} 3164 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3165 var snapshot bytes.Buffer 3166 io.Copy(&snapshot, ringBuffer) 3167 err = &smithy.DeserializationError{ 3168 Err: fmt.Errorf("failed to decode response body, %w", err), 3169 Snapshot: snapshot.Bytes(), 3170 } 3171 return out, metadata, err 3172 } 3173 3174 err = awsRestjson1_deserializeOpDocumentCreateWorldTemplateOutput(&output, shape) 3175 if err != nil { 3176 var snapshot bytes.Buffer 3177 io.Copy(&snapshot, ringBuffer) 3178 return out, metadata, &smithy.DeserializationError{ 3179 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3180 Snapshot: snapshot.Bytes(), 3181 } 3182 } 3183 3184 return out, metadata, err 3185} 3186 3187func awsRestjson1_deserializeOpErrorCreateWorldTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3188 var errorBuffer bytes.Buffer 3189 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3190 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3191 } 3192 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3193 3194 errorCode := "UnknownError" 3195 errorMessage := errorCode 3196 3197 code := response.Header.Get("X-Amzn-ErrorType") 3198 if len(code) != 0 { 3199 errorCode = restjson.SanitizeErrorCode(code) 3200 } 3201 3202 var buff [1024]byte 3203 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3204 3205 body := io.TeeReader(errorBody, ringBuffer) 3206 decoder := json.NewDecoder(body) 3207 decoder.UseNumber() 3208 code, message, err := restjson.GetErrorInfo(decoder) 3209 if err != nil { 3210 var snapshot bytes.Buffer 3211 io.Copy(&snapshot, ringBuffer) 3212 err = &smithy.DeserializationError{ 3213 Err: fmt.Errorf("failed to decode response body, %w", err), 3214 Snapshot: snapshot.Bytes(), 3215 } 3216 return err 3217 } 3218 3219 errorBody.Seek(0, io.SeekStart) 3220 if len(code) != 0 { 3221 errorCode = restjson.SanitizeErrorCode(code) 3222 } 3223 if len(message) != 0 { 3224 errorMessage = message 3225 } 3226 3227 switch { 3228 case strings.EqualFold("InternalServerException", errorCode): 3229 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3230 3231 case strings.EqualFold("InvalidParameterException", errorCode): 3232 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3233 3234 case strings.EqualFold("LimitExceededException", errorCode): 3235 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 3236 3237 case strings.EqualFold("ResourceAlreadyExistsException", errorCode): 3238 return awsRestjson1_deserializeErrorResourceAlreadyExistsException(response, errorBody) 3239 3240 case strings.EqualFold("ResourceNotFoundException", errorCode): 3241 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3242 3243 case strings.EqualFold("ThrottlingException", errorCode): 3244 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3245 3246 default: 3247 genericError := &smithy.GenericAPIError{ 3248 Code: errorCode, 3249 Message: errorMessage, 3250 } 3251 return genericError 3252 3253 } 3254} 3255 3256func awsRestjson1_deserializeOpDocumentCreateWorldTemplateOutput(v **CreateWorldTemplateOutput, value interface{}) error { 3257 if v == nil { 3258 return fmt.Errorf("unexpected nil of type %T", v) 3259 } 3260 if value == nil { 3261 return nil 3262 } 3263 3264 shape, ok := value.(map[string]interface{}) 3265 if !ok { 3266 return fmt.Errorf("unexpected JSON type %v", value) 3267 } 3268 3269 var sv *CreateWorldTemplateOutput 3270 if *v == nil { 3271 sv = &CreateWorldTemplateOutput{} 3272 } else { 3273 sv = *v 3274 } 3275 3276 for key, value := range shape { 3277 switch key { 3278 case "arn": 3279 if value != nil { 3280 jtv, ok := value.(string) 3281 if !ok { 3282 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3283 } 3284 sv.Arn = ptr.String(jtv) 3285 } 3286 3287 case "clientRequestToken": 3288 if value != nil { 3289 jtv, ok := value.(string) 3290 if !ok { 3291 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 3292 } 3293 sv.ClientRequestToken = ptr.String(jtv) 3294 } 3295 3296 case "createdAt": 3297 if value != nil { 3298 switch jtv := value.(type) { 3299 case json.Number: 3300 f64, err := jtv.Float64() 3301 if err != nil { 3302 return err 3303 } 3304 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3305 3306 default: 3307 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 3308 3309 } 3310 } 3311 3312 case "name": 3313 if value != nil { 3314 jtv, ok := value.(string) 3315 if !ok { 3316 return fmt.Errorf("expected TemplateName to be of type string, got %T instead", value) 3317 } 3318 sv.Name = ptr.String(jtv) 3319 } 3320 3321 case "tags": 3322 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 3323 return err 3324 } 3325 3326 default: 3327 _, _ = key, value 3328 3329 } 3330 } 3331 *v = sv 3332 return nil 3333} 3334 3335type awsRestjson1_deserializeOpDeleteFleet struct { 3336} 3337 3338func (*awsRestjson1_deserializeOpDeleteFleet) ID() string { 3339 return "OperationDeserializer" 3340} 3341 3342func (m *awsRestjson1_deserializeOpDeleteFleet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3343 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3344) { 3345 out, metadata, err = next.HandleDeserialize(ctx, in) 3346 if err != nil { 3347 return out, metadata, err 3348 } 3349 3350 response, ok := out.RawResponse.(*smithyhttp.Response) 3351 if !ok { 3352 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3353 } 3354 3355 if response.StatusCode < 200 || response.StatusCode >= 300 { 3356 return out, metadata, awsRestjson1_deserializeOpErrorDeleteFleet(response, &metadata) 3357 } 3358 output := &DeleteFleetOutput{} 3359 out.Result = output 3360 3361 return out, metadata, err 3362} 3363 3364func awsRestjson1_deserializeOpErrorDeleteFleet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3365 var errorBuffer bytes.Buffer 3366 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3367 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3368 } 3369 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3370 3371 errorCode := "UnknownError" 3372 errorMessage := errorCode 3373 3374 code := response.Header.Get("X-Amzn-ErrorType") 3375 if len(code) != 0 { 3376 errorCode = restjson.SanitizeErrorCode(code) 3377 } 3378 3379 var buff [1024]byte 3380 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3381 3382 body := io.TeeReader(errorBody, ringBuffer) 3383 decoder := json.NewDecoder(body) 3384 decoder.UseNumber() 3385 code, message, err := restjson.GetErrorInfo(decoder) 3386 if err != nil { 3387 var snapshot bytes.Buffer 3388 io.Copy(&snapshot, ringBuffer) 3389 err = &smithy.DeserializationError{ 3390 Err: fmt.Errorf("failed to decode response body, %w", err), 3391 Snapshot: snapshot.Bytes(), 3392 } 3393 return err 3394 } 3395 3396 errorBody.Seek(0, io.SeekStart) 3397 if len(code) != 0 { 3398 errorCode = restjson.SanitizeErrorCode(code) 3399 } 3400 if len(message) != 0 { 3401 errorMessage = message 3402 } 3403 3404 switch { 3405 case strings.EqualFold("InternalServerException", errorCode): 3406 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3407 3408 case strings.EqualFold("InvalidParameterException", errorCode): 3409 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3410 3411 case strings.EqualFold("ThrottlingException", errorCode): 3412 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3413 3414 default: 3415 genericError := &smithy.GenericAPIError{ 3416 Code: errorCode, 3417 Message: errorMessage, 3418 } 3419 return genericError 3420 3421 } 3422} 3423 3424type awsRestjson1_deserializeOpDeleteRobot struct { 3425} 3426 3427func (*awsRestjson1_deserializeOpDeleteRobot) ID() string { 3428 return "OperationDeserializer" 3429} 3430 3431func (m *awsRestjson1_deserializeOpDeleteRobot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3432 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3433) { 3434 out, metadata, err = next.HandleDeserialize(ctx, in) 3435 if err != nil { 3436 return out, metadata, err 3437 } 3438 3439 response, ok := out.RawResponse.(*smithyhttp.Response) 3440 if !ok { 3441 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3442 } 3443 3444 if response.StatusCode < 200 || response.StatusCode >= 300 { 3445 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRobot(response, &metadata) 3446 } 3447 output := &DeleteRobotOutput{} 3448 out.Result = output 3449 3450 return out, metadata, err 3451} 3452 3453func awsRestjson1_deserializeOpErrorDeleteRobot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3454 var errorBuffer bytes.Buffer 3455 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3456 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3457 } 3458 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3459 3460 errorCode := "UnknownError" 3461 errorMessage := errorCode 3462 3463 code := response.Header.Get("X-Amzn-ErrorType") 3464 if len(code) != 0 { 3465 errorCode = restjson.SanitizeErrorCode(code) 3466 } 3467 3468 var buff [1024]byte 3469 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3470 3471 body := io.TeeReader(errorBody, ringBuffer) 3472 decoder := json.NewDecoder(body) 3473 decoder.UseNumber() 3474 code, message, err := restjson.GetErrorInfo(decoder) 3475 if err != nil { 3476 var snapshot bytes.Buffer 3477 io.Copy(&snapshot, ringBuffer) 3478 err = &smithy.DeserializationError{ 3479 Err: fmt.Errorf("failed to decode response body, %w", err), 3480 Snapshot: snapshot.Bytes(), 3481 } 3482 return err 3483 } 3484 3485 errorBody.Seek(0, io.SeekStart) 3486 if len(code) != 0 { 3487 errorCode = restjson.SanitizeErrorCode(code) 3488 } 3489 if len(message) != 0 { 3490 errorMessage = message 3491 } 3492 3493 switch { 3494 case strings.EqualFold("InternalServerException", errorCode): 3495 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3496 3497 case strings.EqualFold("InvalidParameterException", errorCode): 3498 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3499 3500 case strings.EqualFold("ThrottlingException", errorCode): 3501 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3502 3503 default: 3504 genericError := &smithy.GenericAPIError{ 3505 Code: errorCode, 3506 Message: errorMessage, 3507 } 3508 return genericError 3509 3510 } 3511} 3512 3513type awsRestjson1_deserializeOpDeleteRobotApplication struct { 3514} 3515 3516func (*awsRestjson1_deserializeOpDeleteRobotApplication) ID() string { 3517 return "OperationDeserializer" 3518} 3519 3520func (m *awsRestjson1_deserializeOpDeleteRobotApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3521 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3522) { 3523 out, metadata, err = next.HandleDeserialize(ctx, in) 3524 if err != nil { 3525 return out, metadata, err 3526 } 3527 3528 response, ok := out.RawResponse.(*smithyhttp.Response) 3529 if !ok { 3530 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3531 } 3532 3533 if response.StatusCode < 200 || response.StatusCode >= 300 { 3534 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRobotApplication(response, &metadata) 3535 } 3536 output := &DeleteRobotApplicationOutput{} 3537 out.Result = output 3538 3539 return out, metadata, err 3540} 3541 3542func awsRestjson1_deserializeOpErrorDeleteRobotApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3543 var errorBuffer bytes.Buffer 3544 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3545 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3546 } 3547 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3548 3549 errorCode := "UnknownError" 3550 errorMessage := errorCode 3551 3552 code := response.Header.Get("X-Amzn-ErrorType") 3553 if len(code) != 0 { 3554 errorCode = restjson.SanitizeErrorCode(code) 3555 } 3556 3557 var buff [1024]byte 3558 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3559 3560 body := io.TeeReader(errorBody, ringBuffer) 3561 decoder := json.NewDecoder(body) 3562 decoder.UseNumber() 3563 code, message, err := restjson.GetErrorInfo(decoder) 3564 if err != nil { 3565 var snapshot bytes.Buffer 3566 io.Copy(&snapshot, ringBuffer) 3567 err = &smithy.DeserializationError{ 3568 Err: fmt.Errorf("failed to decode response body, %w", err), 3569 Snapshot: snapshot.Bytes(), 3570 } 3571 return err 3572 } 3573 3574 errorBody.Seek(0, io.SeekStart) 3575 if len(code) != 0 { 3576 errorCode = restjson.SanitizeErrorCode(code) 3577 } 3578 if len(message) != 0 { 3579 errorMessage = message 3580 } 3581 3582 switch { 3583 case strings.EqualFold("InternalServerException", errorCode): 3584 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3585 3586 case strings.EqualFold("InvalidParameterException", errorCode): 3587 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3588 3589 case strings.EqualFold("ThrottlingException", errorCode): 3590 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3591 3592 default: 3593 genericError := &smithy.GenericAPIError{ 3594 Code: errorCode, 3595 Message: errorMessage, 3596 } 3597 return genericError 3598 3599 } 3600} 3601 3602type awsRestjson1_deserializeOpDeleteSimulationApplication struct { 3603} 3604 3605func (*awsRestjson1_deserializeOpDeleteSimulationApplication) ID() string { 3606 return "OperationDeserializer" 3607} 3608 3609func (m *awsRestjson1_deserializeOpDeleteSimulationApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3610 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3611) { 3612 out, metadata, err = next.HandleDeserialize(ctx, in) 3613 if err != nil { 3614 return out, metadata, err 3615 } 3616 3617 response, ok := out.RawResponse.(*smithyhttp.Response) 3618 if !ok { 3619 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3620 } 3621 3622 if response.StatusCode < 200 || response.StatusCode >= 300 { 3623 return out, metadata, awsRestjson1_deserializeOpErrorDeleteSimulationApplication(response, &metadata) 3624 } 3625 output := &DeleteSimulationApplicationOutput{} 3626 out.Result = output 3627 3628 return out, metadata, err 3629} 3630 3631func awsRestjson1_deserializeOpErrorDeleteSimulationApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3632 var errorBuffer bytes.Buffer 3633 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3634 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3635 } 3636 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3637 3638 errorCode := "UnknownError" 3639 errorMessage := errorCode 3640 3641 code := response.Header.Get("X-Amzn-ErrorType") 3642 if len(code) != 0 { 3643 errorCode = restjson.SanitizeErrorCode(code) 3644 } 3645 3646 var buff [1024]byte 3647 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3648 3649 body := io.TeeReader(errorBody, ringBuffer) 3650 decoder := json.NewDecoder(body) 3651 decoder.UseNumber() 3652 code, message, err := restjson.GetErrorInfo(decoder) 3653 if err != nil { 3654 var snapshot bytes.Buffer 3655 io.Copy(&snapshot, ringBuffer) 3656 err = &smithy.DeserializationError{ 3657 Err: fmt.Errorf("failed to decode response body, %w", err), 3658 Snapshot: snapshot.Bytes(), 3659 } 3660 return err 3661 } 3662 3663 errorBody.Seek(0, io.SeekStart) 3664 if len(code) != 0 { 3665 errorCode = restjson.SanitizeErrorCode(code) 3666 } 3667 if len(message) != 0 { 3668 errorMessage = message 3669 } 3670 3671 switch { 3672 case strings.EqualFold("InternalServerException", errorCode): 3673 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3674 3675 case strings.EqualFold("InvalidParameterException", errorCode): 3676 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3677 3678 case strings.EqualFold("ThrottlingException", errorCode): 3679 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3680 3681 default: 3682 genericError := &smithy.GenericAPIError{ 3683 Code: errorCode, 3684 Message: errorMessage, 3685 } 3686 return genericError 3687 3688 } 3689} 3690 3691type awsRestjson1_deserializeOpDeleteWorldTemplate struct { 3692} 3693 3694func (*awsRestjson1_deserializeOpDeleteWorldTemplate) ID() string { 3695 return "OperationDeserializer" 3696} 3697 3698func (m *awsRestjson1_deserializeOpDeleteWorldTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3699 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3700) { 3701 out, metadata, err = next.HandleDeserialize(ctx, in) 3702 if err != nil { 3703 return out, metadata, err 3704 } 3705 3706 response, ok := out.RawResponse.(*smithyhttp.Response) 3707 if !ok { 3708 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3709 } 3710 3711 if response.StatusCode < 200 || response.StatusCode >= 300 { 3712 return out, metadata, awsRestjson1_deserializeOpErrorDeleteWorldTemplate(response, &metadata) 3713 } 3714 output := &DeleteWorldTemplateOutput{} 3715 out.Result = output 3716 3717 return out, metadata, err 3718} 3719 3720func awsRestjson1_deserializeOpErrorDeleteWorldTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3721 var errorBuffer bytes.Buffer 3722 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3723 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3724 } 3725 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3726 3727 errorCode := "UnknownError" 3728 errorMessage := errorCode 3729 3730 code := response.Header.Get("X-Amzn-ErrorType") 3731 if len(code) != 0 { 3732 errorCode = restjson.SanitizeErrorCode(code) 3733 } 3734 3735 var buff [1024]byte 3736 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3737 3738 body := io.TeeReader(errorBody, ringBuffer) 3739 decoder := json.NewDecoder(body) 3740 decoder.UseNumber() 3741 code, message, err := restjson.GetErrorInfo(decoder) 3742 if err != nil { 3743 var snapshot bytes.Buffer 3744 io.Copy(&snapshot, ringBuffer) 3745 err = &smithy.DeserializationError{ 3746 Err: fmt.Errorf("failed to decode response body, %w", err), 3747 Snapshot: snapshot.Bytes(), 3748 } 3749 return err 3750 } 3751 3752 errorBody.Seek(0, io.SeekStart) 3753 if len(code) != 0 { 3754 errorCode = restjson.SanitizeErrorCode(code) 3755 } 3756 if len(message) != 0 { 3757 errorMessage = message 3758 } 3759 3760 switch { 3761 case strings.EqualFold("InternalServerException", errorCode): 3762 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3763 3764 case strings.EqualFold("InvalidParameterException", errorCode): 3765 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3766 3767 case strings.EqualFold("ResourceNotFoundException", errorCode): 3768 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3769 3770 case strings.EqualFold("ThrottlingException", errorCode): 3771 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3772 3773 default: 3774 genericError := &smithy.GenericAPIError{ 3775 Code: errorCode, 3776 Message: errorMessage, 3777 } 3778 return genericError 3779 3780 } 3781} 3782 3783type awsRestjson1_deserializeOpDeregisterRobot struct { 3784} 3785 3786func (*awsRestjson1_deserializeOpDeregisterRobot) ID() string { 3787 return "OperationDeserializer" 3788} 3789 3790func (m *awsRestjson1_deserializeOpDeregisterRobot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3791 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3792) { 3793 out, metadata, err = next.HandleDeserialize(ctx, in) 3794 if err != nil { 3795 return out, metadata, err 3796 } 3797 3798 response, ok := out.RawResponse.(*smithyhttp.Response) 3799 if !ok { 3800 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3801 } 3802 3803 if response.StatusCode < 200 || response.StatusCode >= 300 { 3804 return out, metadata, awsRestjson1_deserializeOpErrorDeregisterRobot(response, &metadata) 3805 } 3806 output := &DeregisterRobotOutput{} 3807 out.Result = output 3808 3809 var buff [1024]byte 3810 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3811 3812 body := io.TeeReader(response.Body, ringBuffer) 3813 3814 decoder := json.NewDecoder(body) 3815 decoder.UseNumber() 3816 var shape interface{} 3817 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3818 var snapshot bytes.Buffer 3819 io.Copy(&snapshot, ringBuffer) 3820 err = &smithy.DeserializationError{ 3821 Err: fmt.Errorf("failed to decode response body, %w", err), 3822 Snapshot: snapshot.Bytes(), 3823 } 3824 return out, metadata, err 3825 } 3826 3827 err = awsRestjson1_deserializeOpDocumentDeregisterRobotOutput(&output, shape) 3828 if err != nil { 3829 var snapshot bytes.Buffer 3830 io.Copy(&snapshot, ringBuffer) 3831 return out, metadata, &smithy.DeserializationError{ 3832 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3833 Snapshot: snapshot.Bytes(), 3834 } 3835 } 3836 3837 return out, metadata, err 3838} 3839 3840func awsRestjson1_deserializeOpErrorDeregisterRobot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3841 var errorBuffer bytes.Buffer 3842 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3843 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3844 } 3845 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3846 3847 errorCode := "UnknownError" 3848 errorMessage := errorCode 3849 3850 code := response.Header.Get("X-Amzn-ErrorType") 3851 if len(code) != 0 { 3852 errorCode = restjson.SanitizeErrorCode(code) 3853 } 3854 3855 var buff [1024]byte 3856 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3857 3858 body := io.TeeReader(errorBody, ringBuffer) 3859 decoder := json.NewDecoder(body) 3860 decoder.UseNumber() 3861 code, message, err := restjson.GetErrorInfo(decoder) 3862 if err != nil { 3863 var snapshot bytes.Buffer 3864 io.Copy(&snapshot, ringBuffer) 3865 err = &smithy.DeserializationError{ 3866 Err: fmt.Errorf("failed to decode response body, %w", err), 3867 Snapshot: snapshot.Bytes(), 3868 } 3869 return err 3870 } 3871 3872 errorBody.Seek(0, io.SeekStart) 3873 if len(code) != 0 { 3874 errorCode = restjson.SanitizeErrorCode(code) 3875 } 3876 if len(message) != 0 { 3877 errorMessage = message 3878 } 3879 3880 switch { 3881 case strings.EqualFold("InternalServerException", errorCode): 3882 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3883 3884 case strings.EqualFold("InvalidParameterException", errorCode): 3885 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3886 3887 case strings.EqualFold("ResourceNotFoundException", errorCode): 3888 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3889 3890 case strings.EqualFold("ThrottlingException", errorCode): 3891 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3892 3893 default: 3894 genericError := &smithy.GenericAPIError{ 3895 Code: errorCode, 3896 Message: errorMessage, 3897 } 3898 return genericError 3899 3900 } 3901} 3902 3903func awsRestjson1_deserializeOpDocumentDeregisterRobotOutput(v **DeregisterRobotOutput, value interface{}) error { 3904 if v == nil { 3905 return fmt.Errorf("unexpected nil of type %T", v) 3906 } 3907 if value == nil { 3908 return nil 3909 } 3910 3911 shape, ok := value.(map[string]interface{}) 3912 if !ok { 3913 return fmt.Errorf("unexpected JSON type %v", value) 3914 } 3915 3916 var sv *DeregisterRobotOutput 3917 if *v == nil { 3918 sv = &DeregisterRobotOutput{} 3919 } else { 3920 sv = *v 3921 } 3922 3923 for key, value := range shape { 3924 switch key { 3925 case "fleet": 3926 if value != nil { 3927 jtv, ok := value.(string) 3928 if !ok { 3929 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3930 } 3931 sv.Fleet = ptr.String(jtv) 3932 } 3933 3934 case "robot": 3935 if value != nil { 3936 jtv, ok := value.(string) 3937 if !ok { 3938 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3939 } 3940 sv.Robot = ptr.String(jtv) 3941 } 3942 3943 default: 3944 _, _ = key, value 3945 3946 } 3947 } 3948 *v = sv 3949 return nil 3950} 3951 3952type awsRestjson1_deserializeOpDescribeDeploymentJob struct { 3953} 3954 3955func (*awsRestjson1_deserializeOpDescribeDeploymentJob) ID() string { 3956 return "OperationDeserializer" 3957} 3958 3959func (m *awsRestjson1_deserializeOpDescribeDeploymentJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3960 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3961) { 3962 out, metadata, err = next.HandleDeserialize(ctx, in) 3963 if err != nil { 3964 return out, metadata, err 3965 } 3966 3967 response, ok := out.RawResponse.(*smithyhttp.Response) 3968 if !ok { 3969 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3970 } 3971 3972 if response.StatusCode < 200 || response.StatusCode >= 300 { 3973 return out, metadata, awsRestjson1_deserializeOpErrorDescribeDeploymentJob(response, &metadata) 3974 } 3975 output := &DescribeDeploymentJobOutput{} 3976 out.Result = output 3977 3978 var buff [1024]byte 3979 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3980 3981 body := io.TeeReader(response.Body, ringBuffer) 3982 3983 decoder := json.NewDecoder(body) 3984 decoder.UseNumber() 3985 var shape interface{} 3986 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3987 var snapshot bytes.Buffer 3988 io.Copy(&snapshot, ringBuffer) 3989 err = &smithy.DeserializationError{ 3990 Err: fmt.Errorf("failed to decode response body, %w", err), 3991 Snapshot: snapshot.Bytes(), 3992 } 3993 return out, metadata, err 3994 } 3995 3996 err = awsRestjson1_deserializeOpDocumentDescribeDeploymentJobOutput(&output, shape) 3997 if err != nil { 3998 var snapshot bytes.Buffer 3999 io.Copy(&snapshot, ringBuffer) 4000 return out, metadata, &smithy.DeserializationError{ 4001 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4002 Snapshot: snapshot.Bytes(), 4003 } 4004 } 4005 4006 return out, metadata, err 4007} 4008 4009func awsRestjson1_deserializeOpErrorDescribeDeploymentJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4010 var errorBuffer bytes.Buffer 4011 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4012 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4013 } 4014 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4015 4016 errorCode := "UnknownError" 4017 errorMessage := errorCode 4018 4019 code := response.Header.Get("X-Amzn-ErrorType") 4020 if len(code) != 0 { 4021 errorCode = restjson.SanitizeErrorCode(code) 4022 } 4023 4024 var buff [1024]byte 4025 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4026 4027 body := io.TeeReader(errorBody, ringBuffer) 4028 decoder := json.NewDecoder(body) 4029 decoder.UseNumber() 4030 code, message, err := restjson.GetErrorInfo(decoder) 4031 if err != nil { 4032 var snapshot bytes.Buffer 4033 io.Copy(&snapshot, ringBuffer) 4034 err = &smithy.DeserializationError{ 4035 Err: fmt.Errorf("failed to decode response body, %w", err), 4036 Snapshot: snapshot.Bytes(), 4037 } 4038 return err 4039 } 4040 4041 errorBody.Seek(0, io.SeekStart) 4042 if len(code) != 0 { 4043 errorCode = restjson.SanitizeErrorCode(code) 4044 } 4045 if len(message) != 0 { 4046 errorMessage = message 4047 } 4048 4049 switch { 4050 case strings.EqualFold("InternalServerException", errorCode): 4051 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4052 4053 case strings.EqualFold("InvalidParameterException", errorCode): 4054 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4055 4056 case strings.EqualFold("ResourceNotFoundException", errorCode): 4057 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4058 4059 case strings.EqualFold("ThrottlingException", errorCode): 4060 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4061 4062 default: 4063 genericError := &smithy.GenericAPIError{ 4064 Code: errorCode, 4065 Message: errorMessage, 4066 } 4067 return genericError 4068 4069 } 4070} 4071 4072func awsRestjson1_deserializeOpDocumentDescribeDeploymentJobOutput(v **DescribeDeploymentJobOutput, value interface{}) error { 4073 if v == nil { 4074 return fmt.Errorf("unexpected nil of type %T", v) 4075 } 4076 if value == nil { 4077 return nil 4078 } 4079 4080 shape, ok := value.(map[string]interface{}) 4081 if !ok { 4082 return fmt.Errorf("unexpected JSON type %v", value) 4083 } 4084 4085 var sv *DescribeDeploymentJobOutput 4086 if *v == nil { 4087 sv = &DescribeDeploymentJobOutput{} 4088 } else { 4089 sv = *v 4090 } 4091 4092 for key, value := range shape { 4093 switch key { 4094 case "arn": 4095 if value != nil { 4096 jtv, ok := value.(string) 4097 if !ok { 4098 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4099 } 4100 sv.Arn = ptr.String(jtv) 4101 } 4102 4103 case "createdAt": 4104 if value != nil { 4105 switch jtv := value.(type) { 4106 case json.Number: 4107 f64, err := jtv.Float64() 4108 if err != nil { 4109 return err 4110 } 4111 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4112 4113 default: 4114 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 4115 4116 } 4117 } 4118 4119 case "deploymentApplicationConfigs": 4120 if err := awsRestjson1_deserializeDocumentDeploymentApplicationConfigs(&sv.DeploymentApplicationConfigs, value); err != nil { 4121 return err 4122 } 4123 4124 case "deploymentConfig": 4125 if err := awsRestjson1_deserializeDocumentDeploymentConfig(&sv.DeploymentConfig, value); err != nil { 4126 return err 4127 } 4128 4129 case "failureCode": 4130 if value != nil { 4131 jtv, ok := value.(string) 4132 if !ok { 4133 return fmt.Errorf("expected DeploymentJobErrorCode to be of type string, got %T instead", value) 4134 } 4135 sv.FailureCode = types.DeploymentJobErrorCode(jtv) 4136 } 4137 4138 case "failureReason": 4139 if value != nil { 4140 jtv, ok := value.(string) 4141 if !ok { 4142 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 4143 } 4144 sv.FailureReason = ptr.String(jtv) 4145 } 4146 4147 case "fleet": 4148 if value != nil { 4149 jtv, ok := value.(string) 4150 if !ok { 4151 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4152 } 4153 sv.Fleet = ptr.String(jtv) 4154 } 4155 4156 case "robotDeploymentSummary": 4157 if err := awsRestjson1_deserializeDocumentRobotDeploymentSummary(&sv.RobotDeploymentSummary, value); err != nil { 4158 return err 4159 } 4160 4161 case "status": 4162 if value != nil { 4163 jtv, ok := value.(string) 4164 if !ok { 4165 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 4166 } 4167 sv.Status = types.DeploymentStatus(jtv) 4168 } 4169 4170 case "tags": 4171 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 4172 return err 4173 } 4174 4175 default: 4176 _, _ = key, value 4177 4178 } 4179 } 4180 *v = sv 4181 return nil 4182} 4183 4184type awsRestjson1_deserializeOpDescribeFleet struct { 4185} 4186 4187func (*awsRestjson1_deserializeOpDescribeFleet) ID() string { 4188 return "OperationDeserializer" 4189} 4190 4191func (m *awsRestjson1_deserializeOpDescribeFleet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4192 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4193) { 4194 out, metadata, err = next.HandleDeserialize(ctx, in) 4195 if err != nil { 4196 return out, metadata, err 4197 } 4198 4199 response, ok := out.RawResponse.(*smithyhttp.Response) 4200 if !ok { 4201 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4202 } 4203 4204 if response.StatusCode < 200 || response.StatusCode >= 300 { 4205 return out, metadata, awsRestjson1_deserializeOpErrorDescribeFleet(response, &metadata) 4206 } 4207 output := &DescribeFleetOutput{} 4208 out.Result = output 4209 4210 var buff [1024]byte 4211 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4212 4213 body := io.TeeReader(response.Body, ringBuffer) 4214 4215 decoder := json.NewDecoder(body) 4216 decoder.UseNumber() 4217 var shape interface{} 4218 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4219 var snapshot bytes.Buffer 4220 io.Copy(&snapshot, ringBuffer) 4221 err = &smithy.DeserializationError{ 4222 Err: fmt.Errorf("failed to decode response body, %w", err), 4223 Snapshot: snapshot.Bytes(), 4224 } 4225 return out, metadata, err 4226 } 4227 4228 err = awsRestjson1_deserializeOpDocumentDescribeFleetOutput(&output, shape) 4229 if err != nil { 4230 var snapshot bytes.Buffer 4231 io.Copy(&snapshot, ringBuffer) 4232 return out, metadata, &smithy.DeserializationError{ 4233 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4234 Snapshot: snapshot.Bytes(), 4235 } 4236 } 4237 4238 return out, metadata, err 4239} 4240 4241func awsRestjson1_deserializeOpErrorDescribeFleet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4242 var errorBuffer bytes.Buffer 4243 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4244 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4245 } 4246 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4247 4248 errorCode := "UnknownError" 4249 errorMessage := errorCode 4250 4251 code := response.Header.Get("X-Amzn-ErrorType") 4252 if len(code) != 0 { 4253 errorCode = restjson.SanitizeErrorCode(code) 4254 } 4255 4256 var buff [1024]byte 4257 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4258 4259 body := io.TeeReader(errorBody, ringBuffer) 4260 decoder := json.NewDecoder(body) 4261 decoder.UseNumber() 4262 code, message, err := restjson.GetErrorInfo(decoder) 4263 if err != nil { 4264 var snapshot bytes.Buffer 4265 io.Copy(&snapshot, ringBuffer) 4266 err = &smithy.DeserializationError{ 4267 Err: fmt.Errorf("failed to decode response body, %w", err), 4268 Snapshot: snapshot.Bytes(), 4269 } 4270 return err 4271 } 4272 4273 errorBody.Seek(0, io.SeekStart) 4274 if len(code) != 0 { 4275 errorCode = restjson.SanitizeErrorCode(code) 4276 } 4277 if len(message) != 0 { 4278 errorMessage = message 4279 } 4280 4281 switch { 4282 case strings.EqualFold("InternalServerException", errorCode): 4283 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4284 4285 case strings.EqualFold("InvalidParameterException", errorCode): 4286 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4287 4288 case strings.EqualFold("ResourceNotFoundException", errorCode): 4289 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4290 4291 case strings.EqualFold("ThrottlingException", errorCode): 4292 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4293 4294 default: 4295 genericError := &smithy.GenericAPIError{ 4296 Code: errorCode, 4297 Message: errorMessage, 4298 } 4299 return genericError 4300 4301 } 4302} 4303 4304func awsRestjson1_deserializeOpDocumentDescribeFleetOutput(v **DescribeFleetOutput, value interface{}) error { 4305 if v == nil { 4306 return fmt.Errorf("unexpected nil of type %T", v) 4307 } 4308 if value == nil { 4309 return nil 4310 } 4311 4312 shape, ok := value.(map[string]interface{}) 4313 if !ok { 4314 return fmt.Errorf("unexpected JSON type %v", value) 4315 } 4316 4317 var sv *DescribeFleetOutput 4318 if *v == nil { 4319 sv = &DescribeFleetOutput{} 4320 } else { 4321 sv = *v 4322 } 4323 4324 for key, value := range shape { 4325 switch key { 4326 case "arn": 4327 if value != nil { 4328 jtv, ok := value.(string) 4329 if !ok { 4330 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4331 } 4332 sv.Arn = ptr.String(jtv) 4333 } 4334 4335 case "createdAt": 4336 if value != nil { 4337 switch jtv := value.(type) { 4338 case json.Number: 4339 f64, err := jtv.Float64() 4340 if err != nil { 4341 return err 4342 } 4343 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4344 4345 default: 4346 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 4347 4348 } 4349 } 4350 4351 case "lastDeploymentJob": 4352 if value != nil { 4353 jtv, ok := value.(string) 4354 if !ok { 4355 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4356 } 4357 sv.LastDeploymentJob = ptr.String(jtv) 4358 } 4359 4360 case "lastDeploymentStatus": 4361 if value != nil { 4362 jtv, ok := value.(string) 4363 if !ok { 4364 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 4365 } 4366 sv.LastDeploymentStatus = types.DeploymentStatus(jtv) 4367 } 4368 4369 case "lastDeploymentTime": 4370 if value != nil { 4371 switch jtv := value.(type) { 4372 case json.Number: 4373 f64, err := jtv.Float64() 4374 if err != nil { 4375 return err 4376 } 4377 sv.LastDeploymentTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4378 4379 default: 4380 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 4381 4382 } 4383 } 4384 4385 case "name": 4386 if value != nil { 4387 jtv, ok := value.(string) 4388 if !ok { 4389 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4390 } 4391 sv.Name = ptr.String(jtv) 4392 } 4393 4394 case "robots": 4395 if err := awsRestjson1_deserializeDocumentRobots(&sv.Robots, value); err != nil { 4396 return err 4397 } 4398 4399 case "tags": 4400 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 4401 return err 4402 } 4403 4404 default: 4405 _, _ = key, value 4406 4407 } 4408 } 4409 *v = sv 4410 return nil 4411} 4412 4413type awsRestjson1_deserializeOpDescribeRobot struct { 4414} 4415 4416func (*awsRestjson1_deserializeOpDescribeRobot) ID() string { 4417 return "OperationDeserializer" 4418} 4419 4420func (m *awsRestjson1_deserializeOpDescribeRobot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4421 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4422) { 4423 out, metadata, err = next.HandleDeserialize(ctx, in) 4424 if err != nil { 4425 return out, metadata, err 4426 } 4427 4428 response, ok := out.RawResponse.(*smithyhttp.Response) 4429 if !ok { 4430 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4431 } 4432 4433 if response.StatusCode < 200 || response.StatusCode >= 300 { 4434 return out, metadata, awsRestjson1_deserializeOpErrorDescribeRobot(response, &metadata) 4435 } 4436 output := &DescribeRobotOutput{} 4437 out.Result = output 4438 4439 var buff [1024]byte 4440 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4441 4442 body := io.TeeReader(response.Body, ringBuffer) 4443 4444 decoder := json.NewDecoder(body) 4445 decoder.UseNumber() 4446 var shape interface{} 4447 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4448 var snapshot bytes.Buffer 4449 io.Copy(&snapshot, ringBuffer) 4450 err = &smithy.DeserializationError{ 4451 Err: fmt.Errorf("failed to decode response body, %w", err), 4452 Snapshot: snapshot.Bytes(), 4453 } 4454 return out, metadata, err 4455 } 4456 4457 err = awsRestjson1_deserializeOpDocumentDescribeRobotOutput(&output, shape) 4458 if err != nil { 4459 var snapshot bytes.Buffer 4460 io.Copy(&snapshot, ringBuffer) 4461 return out, metadata, &smithy.DeserializationError{ 4462 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4463 Snapshot: snapshot.Bytes(), 4464 } 4465 } 4466 4467 return out, metadata, err 4468} 4469 4470func awsRestjson1_deserializeOpErrorDescribeRobot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4471 var errorBuffer bytes.Buffer 4472 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4473 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4474 } 4475 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4476 4477 errorCode := "UnknownError" 4478 errorMessage := errorCode 4479 4480 code := response.Header.Get("X-Amzn-ErrorType") 4481 if len(code) != 0 { 4482 errorCode = restjson.SanitizeErrorCode(code) 4483 } 4484 4485 var buff [1024]byte 4486 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4487 4488 body := io.TeeReader(errorBody, ringBuffer) 4489 decoder := json.NewDecoder(body) 4490 decoder.UseNumber() 4491 code, message, err := restjson.GetErrorInfo(decoder) 4492 if err != nil { 4493 var snapshot bytes.Buffer 4494 io.Copy(&snapshot, ringBuffer) 4495 err = &smithy.DeserializationError{ 4496 Err: fmt.Errorf("failed to decode response body, %w", err), 4497 Snapshot: snapshot.Bytes(), 4498 } 4499 return err 4500 } 4501 4502 errorBody.Seek(0, io.SeekStart) 4503 if len(code) != 0 { 4504 errorCode = restjson.SanitizeErrorCode(code) 4505 } 4506 if len(message) != 0 { 4507 errorMessage = message 4508 } 4509 4510 switch { 4511 case strings.EqualFold("InternalServerException", errorCode): 4512 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4513 4514 case strings.EqualFold("InvalidParameterException", errorCode): 4515 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4516 4517 case strings.EqualFold("ResourceNotFoundException", errorCode): 4518 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4519 4520 case strings.EqualFold("ThrottlingException", errorCode): 4521 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4522 4523 default: 4524 genericError := &smithy.GenericAPIError{ 4525 Code: errorCode, 4526 Message: errorMessage, 4527 } 4528 return genericError 4529 4530 } 4531} 4532 4533func awsRestjson1_deserializeOpDocumentDescribeRobotOutput(v **DescribeRobotOutput, value interface{}) error { 4534 if v == nil { 4535 return fmt.Errorf("unexpected nil of type %T", v) 4536 } 4537 if value == nil { 4538 return nil 4539 } 4540 4541 shape, ok := value.(map[string]interface{}) 4542 if !ok { 4543 return fmt.Errorf("unexpected JSON type %v", value) 4544 } 4545 4546 var sv *DescribeRobotOutput 4547 if *v == nil { 4548 sv = &DescribeRobotOutput{} 4549 } else { 4550 sv = *v 4551 } 4552 4553 for key, value := range shape { 4554 switch key { 4555 case "architecture": 4556 if value != nil { 4557 jtv, ok := value.(string) 4558 if !ok { 4559 return fmt.Errorf("expected Architecture to be of type string, got %T instead", value) 4560 } 4561 sv.Architecture = types.Architecture(jtv) 4562 } 4563 4564 case "arn": 4565 if value != nil { 4566 jtv, ok := value.(string) 4567 if !ok { 4568 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4569 } 4570 sv.Arn = ptr.String(jtv) 4571 } 4572 4573 case "createdAt": 4574 if value != nil { 4575 switch jtv := value.(type) { 4576 case json.Number: 4577 f64, err := jtv.Float64() 4578 if err != nil { 4579 return err 4580 } 4581 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4582 4583 default: 4584 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 4585 4586 } 4587 } 4588 4589 case "fleetArn": 4590 if value != nil { 4591 jtv, ok := value.(string) 4592 if !ok { 4593 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4594 } 4595 sv.FleetArn = ptr.String(jtv) 4596 } 4597 4598 case "greengrassGroupId": 4599 if value != nil { 4600 jtv, ok := value.(string) 4601 if !ok { 4602 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4603 } 4604 sv.GreengrassGroupId = ptr.String(jtv) 4605 } 4606 4607 case "lastDeploymentJob": 4608 if value != nil { 4609 jtv, ok := value.(string) 4610 if !ok { 4611 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4612 } 4613 sv.LastDeploymentJob = ptr.String(jtv) 4614 } 4615 4616 case "lastDeploymentTime": 4617 if value != nil { 4618 switch jtv := value.(type) { 4619 case json.Number: 4620 f64, err := jtv.Float64() 4621 if err != nil { 4622 return err 4623 } 4624 sv.LastDeploymentTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4625 4626 default: 4627 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 4628 4629 } 4630 } 4631 4632 case "name": 4633 if value != nil { 4634 jtv, ok := value.(string) 4635 if !ok { 4636 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4637 } 4638 sv.Name = ptr.String(jtv) 4639 } 4640 4641 case "status": 4642 if value != nil { 4643 jtv, ok := value.(string) 4644 if !ok { 4645 return fmt.Errorf("expected RobotStatus to be of type string, got %T instead", value) 4646 } 4647 sv.Status = types.RobotStatus(jtv) 4648 } 4649 4650 case "tags": 4651 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 4652 return err 4653 } 4654 4655 default: 4656 _, _ = key, value 4657 4658 } 4659 } 4660 *v = sv 4661 return nil 4662} 4663 4664type awsRestjson1_deserializeOpDescribeRobotApplication struct { 4665} 4666 4667func (*awsRestjson1_deserializeOpDescribeRobotApplication) ID() string { 4668 return "OperationDeserializer" 4669} 4670 4671func (m *awsRestjson1_deserializeOpDescribeRobotApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4672 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4673) { 4674 out, metadata, err = next.HandleDeserialize(ctx, in) 4675 if err != nil { 4676 return out, metadata, err 4677 } 4678 4679 response, ok := out.RawResponse.(*smithyhttp.Response) 4680 if !ok { 4681 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4682 } 4683 4684 if response.StatusCode < 200 || response.StatusCode >= 300 { 4685 return out, metadata, awsRestjson1_deserializeOpErrorDescribeRobotApplication(response, &metadata) 4686 } 4687 output := &DescribeRobotApplicationOutput{} 4688 out.Result = output 4689 4690 var buff [1024]byte 4691 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4692 4693 body := io.TeeReader(response.Body, ringBuffer) 4694 4695 decoder := json.NewDecoder(body) 4696 decoder.UseNumber() 4697 var shape interface{} 4698 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4699 var snapshot bytes.Buffer 4700 io.Copy(&snapshot, ringBuffer) 4701 err = &smithy.DeserializationError{ 4702 Err: fmt.Errorf("failed to decode response body, %w", err), 4703 Snapshot: snapshot.Bytes(), 4704 } 4705 return out, metadata, err 4706 } 4707 4708 err = awsRestjson1_deserializeOpDocumentDescribeRobotApplicationOutput(&output, shape) 4709 if err != nil { 4710 var snapshot bytes.Buffer 4711 io.Copy(&snapshot, ringBuffer) 4712 return out, metadata, &smithy.DeserializationError{ 4713 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4714 Snapshot: snapshot.Bytes(), 4715 } 4716 } 4717 4718 return out, metadata, err 4719} 4720 4721func awsRestjson1_deserializeOpErrorDescribeRobotApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4722 var errorBuffer bytes.Buffer 4723 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4724 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4725 } 4726 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4727 4728 errorCode := "UnknownError" 4729 errorMessage := errorCode 4730 4731 code := response.Header.Get("X-Amzn-ErrorType") 4732 if len(code) != 0 { 4733 errorCode = restjson.SanitizeErrorCode(code) 4734 } 4735 4736 var buff [1024]byte 4737 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4738 4739 body := io.TeeReader(errorBody, ringBuffer) 4740 decoder := json.NewDecoder(body) 4741 decoder.UseNumber() 4742 code, message, err := restjson.GetErrorInfo(decoder) 4743 if err != nil { 4744 var snapshot bytes.Buffer 4745 io.Copy(&snapshot, ringBuffer) 4746 err = &smithy.DeserializationError{ 4747 Err: fmt.Errorf("failed to decode response body, %w", err), 4748 Snapshot: snapshot.Bytes(), 4749 } 4750 return err 4751 } 4752 4753 errorBody.Seek(0, io.SeekStart) 4754 if len(code) != 0 { 4755 errorCode = restjson.SanitizeErrorCode(code) 4756 } 4757 if len(message) != 0 { 4758 errorMessage = message 4759 } 4760 4761 switch { 4762 case strings.EqualFold("InternalServerException", errorCode): 4763 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4764 4765 case strings.EqualFold("InvalidParameterException", errorCode): 4766 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4767 4768 case strings.EqualFold("ResourceNotFoundException", errorCode): 4769 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4770 4771 case strings.EqualFold("ThrottlingException", errorCode): 4772 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4773 4774 default: 4775 genericError := &smithy.GenericAPIError{ 4776 Code: errorCode, 4777 Message: errorMessage, 4778 } 4779 return genericError 4780 4781 } 4782} 4783 4784func awsRestjson1_deserializeOpDocumentDescribeRobotApplicationOutput(v **DescribeRobotApplicationOutput, value interface{}) error { 4785 if v == nil { 4786 return fmt.Errorf("unexpected nil of type %T", v) 4787 } 4788 if value == nil { 4789 return nil 4790 } 4791 4792 shape, ok := value.(map[string]interface{}) 4793 if !ok { 4794 return fmt.Errorf("unexpected JSON type %v", value) 4795 } 4796 4797 var sv *DescribeRobotApplicationOutput 4798 if *v == nil { 4799 sv = &DescribeRobotApplicationOutput{} 4800 } else { 4801 sv = *v 4802 } 4803 4804 for key, value := range shape { 4805 switch key { 4806 case "arn": 4807 if value != nil { 4808 jtv, ok := value.(string) 4809 if !ok { 4810 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4811 } 4812 sv.Arn = ptr.String(jtv) 4813 } 4814 4815 case "environment": 4816 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 4817 return err 4818 } 4819 4820 case "imageDigest": 4821 if value != nil { 4822 jtv, ok := value.(string) 4823 if !ok { 4824 return fmt.Errorf("expected ImageDigest to be of type string, got %T instead", value) 4825 } 4826 sv.ImageDigest = ptr.String(jtv) 4827 } 4828 4829 case "lastUpdatedAt": 4830 if value != nil { 4831 switch jtv := value.(type) { 4832 case json.Number: 4833 f64, err := jtv.Float64() 4834 if err != nil { 4835 return err 4836 } 4837 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4838 4839 default: 4840 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 4841 4842 } 4843 } 4844 4845 case "name": 4846 if value != nil { 4847 jtv, ok := value.(string) 4848 if !ok { 4849 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4850 } 4851 sv.Name = ptr.String(jtv) 4852 } 4853 4854 case "revisionId": 4855 if value != nil { 4856 jtv, ok := value.(string) 4857 if !ok { 4858 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 4859 } 4860 sv.RevisionId = ptr.String(jtv) 4861 } 4862 4863 case "robotSoftwareSuite": 4864 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 4865 return err 4866 } 4867 4868 case "sources": 4869 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 4870 return err 4871 } 4872 4873 case "tags": 4874 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 4875 return err 4876 } 4877 4878 case "version": 4879 if value != nil { 4880 jtv, ok := value.(string) 4881 if !ok { 4882 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 4883 } 4884 sv.Version = ptr.String(jtv) 4885 } 4886 4887 default: 4888 _, _ = key, value 4889 4890 } 4891 } 4892 *v = sv 4893 return nil 4894} 4895 4896type awsRestjson1_deserializeOpDescribeSimulationApplication struct { 4897} 4898 4899func (*awsRestjson1_deserializeOpDescribeSimulationApplication) ID() string { 4900 return "OperationDeserializer" 4901} 4902 4903func (m *awsRestjson1_deserializeOpDescribeSimulationApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4904 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4905) { 4906 out, metadata, err = next.HandleDeserialize(ctx, in) 4907 if err != nil { 4908 return out, metadata, err 4909 } 4910 4911 response, ok := out.RawResponse.(*smithyhttp.Response) 4912 if !ok { 4913 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4914 } 4915 4916 if response.StatusCode < 200 || response.StatusCode >= 300 { 4917 return out, metadata, awsRestjson1_deserializeOpErrorDescribeSimulationApplication(response, &metadata) 4918 } 4919 output := &DescribeSimulationApplicationOutput{} 4920 out.Result = output 4921 4922 var buff [1024]byte 4923 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4924 4925 body := io.TeeReader(response.Body, ringBuffer) 4926 4927 decoder := json.NewDecoder(body) 4928 decoder.UseNumber() 4929 var shape interface{} 4930 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4931 var snapshot bytes.Buffer 4932 io.Copy(&snapshot, ringBuffer) 4933 err = &smithy.DeserializationError{ 4934 Err: fmt.Errorf("failed to decode response body, %w", err), 4935 Snapshot: snapshot.Bytes(), 4936 } 4937 return out, metadata, err 4938 } 4939 4940 err = awsRestjson1_deserializeOpDocumentDescribeSimulationApplicationOutput(&output, shape) 4941 if err != nil { 4942 var snapshot bytes.Buffer 4943 io.Copy(&snapshot, ringBuffer) 4944 return out, metadata, &smithy.DeserializationError{ 4945 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4946 Snapshot: snapshot.Bytes(), 4947 } 4948 } 4949 4950 return out, metadata, err 4951} 4952 4953func awsRestjson1_deserializeOpErrorDescribeSimulationApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4954 var errorBuffer bytes.Buffer 4955 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4956 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4957 } 4958 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4959 4960 errorCode := "UnknownError" 4961 errorMessage := errorCode 4962 4963 code := response.Header.Get("X-Amzn-ErrorType") 4964 if len(code) != 0 { 4965 errorCode = restjson.SanitizeErrorCode(code) 4966 } 4967 4968 var buff [1024]byte 4969 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4970 4971 body := io.TeeReader(errorBody, ringBuffer) 4972 decoder := json.NewDecoder(body) 4973 decoder.UseNumber() 4974 code, message, err := restjson.GetErrorInfo(decoder) 4975 if err != nil { 4976 var snapshot bytes.Buffer 4977 io.Copy(&snapshot, ringBuffer) 4978 err = &smithy.DeserializationError{ 4979 Err: fmt.Errorf("failed to decode response body, %w", err), 4980 Snapshot: snapshot.Bytes(), 4981 } 4982 return err 4983 } 4984 4985 errorBody.Seek(0, io.SeekStart) 4986 if len(code) != 0 { 4987 errorCode = restjson.SanitizeErrorCode(code) 4988 } 4989 if len(message) != 0 { 4990 errorMessage = message 4991 } 4992 4993 switch { 4994 case strings.EqualFold("InternalServerException", errorCode): 4995 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4996 4997 case strings.EqualFold("InvalidParameterException", errorCode): 4998 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4999 5000 case strings.EqualFold("ResourceNotFoundException", errorCode): 5001 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5002 5003 case strings.EqualFold("ThrottlingException", errorCode): 5004 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5005 5006 default: 5007 genericError := &smithy.GenericAPIError{ 5008 Code: errorCode, 5009 Message: errorMessage, 5010 } 5011 return genericError 5012 5013 } 5014} 5015 5016func awsRestjson1_deserializeOpDocumentDescribeSimulationApplicationOutput(v **DescribeSimulationApplicationOutput, value interface{}) error { 5017 if v == nil { 5018 return fmt.Errorf("unexpected nil of type %T", v) 5019 } 5020 if value == nil { 5021 return nil 5022 } 5023 5024 shape, ok := value.(map[string]interface{}) 5025 if !ok { 5026 return fmt.Errorf("unexpected JSON type %v", value) 5027 } 5028 5029 var sv *DescribeSimulationApplicationOutput 5030 if *v == nil { 5031 sv = &DescribeSimulationApplicationOutput{} 5032 } else { 5033 sv = *v 5034 } 5035 5036 for key, value := range shape { 5037 switch key { 5038 case "arn": 5039 if value != nil { 5040 jtv, ok := value.(string) 5041 if !ok { 5042 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5043 } 5044 sv.Arn = ptr.String(jtv) 5045 } 5046 5047 case "environment": 5048 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 5049 return err 5050 } 5051 5052 case "imageDigest": 5053 if value != nil { 5054 jtv, ok := value.(string) 5055 if !ok { 5056 return fmt.Errorf("expected ImageDigest to be of type string, got %T instead", value) 5057 } 5058 sv.ImageDigest = ptr.String(jtv) 5059 } 5060 5061 case "lastUpdatedAt": 5062 if value != nil { 5063 switch jtv := value.(type) { 5064 case json.Number: 5065 f64, err := jtv.Float64() 5066 if err != nil { 5067 return err 5068 } 5069 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5070 5071 default: 5072 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 5073 5074 } 5075 } 5076 5077 case "name": 5078 if value != nil { 5079 jtv, ok := value.(string) 5080 if !ok { 5081 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 5082 } 5083 sv.Name = ptr.String(jtv) 5084 } 5085 5086 case "renderingEngine": 5087 if err := awsRestjson1_deserializeDocumentRenderingEngine(&sv.RenderingEngine, value); err != nil { 5088 return err 5089 } 5090 5091 case "revisionId": 5092 if value != nil { 5093 jtv, ok := value.(string) 5094 if !ok { 5095 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 5096 } 5097 sv.RevisionId = ptr.String(jtv) 5098 } 5099 5100 case "robotSoftwareSuite": 5101 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 5102 return err 5103 } 5104 5105 case "simulationSoftwareSuite": 5106 if err := awsRestjson1_deserializeDocumentSimulationSoftwareSuite(&sv.SimulationSoftwareSuite, value); err != nil { 5107 return err 5108 } 5109 5110 case "sources": 5111 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 5112 return err 5113 } 5114 5115 case "tags": 5116 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 5117 return err 5118 } 5119 5120 case "version": 5121 if value != nil { 5122 jtv, ok := value.(string) 5123 if !ok { 5124 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 5125 } 5126 sv.Version = ptr.String(jtv) 5127 } 5128 5129 default: 5130 _, _ = key, value 5131 5132 } 5133 } 5134 *v = sv 5135 return nil 5136} 5137 5138type awsRestjson1_deserializeOpDescribeSimulationJob struct { 5139} 5140 5141func (*awsRestjson1_deserializeOpDescribeSimulationJob) ID() string { 5142 return "OperationDeserializer" 5143} 5144 5145func (m *awsRestjson1_deserializeOpDescribeSimulationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5146 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5147) { 5148 out, metadata, err = next.HandleDeserialize(ctx, in) 5149 if err != nil { 5150 return out, metadata, err 5151 } 5152 5153 response, ok := out.RawResponse.(*smithyhttp.Response) 5154 if !ok { 5155 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5156 } 5157 5158 if response.StatusCode < 200 || response.StatusCode >= 300 { 5159 return out, metadata, awsRestjson1_deserializeOpErrorDescribeSimulationJob(response, &metadata) 5160 } 5161 output := &DescribeSimulationJobOutput{} 5162 out.Result = output 5163 5164 var buff [1024]byte 5165 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5166 5167 body := io.TeeReader(response.Body, ringBuffer) 5168 5169 decoder := json.NewDecoder(body) 5170 decoder.UseNumber() 5171 var shape interface{} 5172 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5173 var snapshot bytes.Buffer 5174 io.Copy(&snapshot, ringBuffer) 5175 err = &smithy.DeserializationError{ 5176 Err: fmt.Errorf("failed to decode response body, %w", err), 5177 Snapshot: snapshot.Bytes(), 5178 } 5179 return out, metadata, err 5180 } 5181 5182 err = awsRestjson1_deserializeOpDocumentDescribeSimulationJobOutput(&output, shape) 5183 if err != nil { 5184 var snapshot bytes.Buffer 5185 io.Copy(&snapshot, ringBuffer) 5186 return out, metadata, &smithy.DeserializationError{ 5187 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5188 Snapshot: snapshot.Bytes(), 5189 } 5190 } 5191 5192 return out, metadata, err 5193} 5194 5195func awsRestjson1_deserializeOpErrorDescribeSimulationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5196 var errorBuffer bytes.Buffer 5197 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5198 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5199 } 5200 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5201 5202 errorCode := "UnknownError" 5203 errorMessage := errorCode 5204 5205 code := response.Header.Get("X-Amzn-ErrorType") 5206 if len(code) != 0 { 5207 errorCode = restjson.SanitizeErrorCode(code) 5208 } 5209 5210 var buff [1024]byte 5211 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5212 5213 body := io.TeeReader(errorBody, ringBuffer) 5214 decoder := json.NewDecoder(body) 5215 decoder.UseNumber() 5216 code, message, err := restjson.GetErrorInfo(decoder) 5217 if err != nil { 5218 var snapshot bytes.Buffer 5219 io.Copy(&snapshot, ringBuffer) 5220 err = &smithy.DeserializationError{ 5221 Err: fmt.Errorf("failed to decode response body, %w", err), 5222 Snapshot: snapshot.Bytes(), 5223 } 5224 return err 5225 } 5226 5227 errorBody.Seek(0, io.SeekStart) 5228 if len(code) != 0 { 5229 errorCode = restjson.SanitizeErrorCode(code) 5230 } 5231 if len(message) != 0 { 5232 errorMessage = message 5233 } 5234 5235 switch { 5236 case strings.EqualFold("InternalServerException", errorCode): 5237 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5238 5239 case strings.EqualFold("InvalidParameterException", errorCode): 5240 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5241 5242 case strings.EqualFold("ResourceNotFoundException", errorCode): 5243 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5244 5245 case strings.EqualFold("ThrottlingException", errorCode): 5246 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5247 5248 default: 5249 genericError := &smithy.GenericAPIError{ 5250 Code: errorCode, 5251 Message: errorMessage, 5252 } 5253 return genericError 5254 5255 } 5256} 5257 5258func awsRestjson1_deserializeOpDocumentDescribeSimulationJobOutput(v **DescribeSimulationJobOutput, value interface{}) error { 5259 if v == nil { 5260 return fmt.Errorf("unexpected nil of type %T", v) 5261 } 5262 if value == nil { 5263 return nil 5264 } 5265 5266 shape, ok := value.(map[string]interface{}) 5267 if !ok { 5268 return fmt.Errorf("unexpected JSON type %v", value) 5269 } 5270 5271 var sv *DescribeSimulationJobOutput 5272 if *v == nil { 5273 sv = &DescribeSimulationJobOutput{} 5274 } else { 5275 sv = *v 5276 } 5277 5278 for key, value := range shape { 5279 switch key { 5280 case "arn": 5281 if value != nil { 5282 jtv, ok := value.(string) 5283 if !ok { 5284 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5285 } 5286 sv.Arn = ptr.String(jtv) 5287 } 5288 5289 case "clientRequestToken": 5290 if value != nil { 5291 jtv, ok := value.(string) 5292 if !ok { 5293 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 5294 } 5295 sv.ClientRequestToken = ptr.String(jtv) 5296 } 5297 5298 case "compute": 5299 if err := awsRestjson1_deserializeDocumentComputeResponse(&sv.Compute, value); err != nil { 5300 return err 5301 } 5302 5303 case "dataSources": 5304 if err := awsRestjson1_deserializeDocumentDataSources(&sv.DataSources, value); err != nil { 5305 return err 5306 } 5307 5308 case "failureBehavior": 5309 if value != nil { 5310 jtv, ok := value.(string) 5311 if !ok { 5312 return fmt.Errorf("expected FailureBehavior to be of type string, got %T instead", value) 5313 } 5314 sv.FailureBehavior = types.FailureBehavior(jtv) 5315 } 5316 5317 case "failureCode": 5318 if value != nil { 5319 jtv, ok := value.(string) 5320 if !ok { 5321 return fmt.Errorf("expected SimulationJobErrorCode to be of type string, got %T instead", value) 5322 } 5323 sv.FailureCode = types.SimulationJobErrorCode(jtv) 5324 } 5325 5326 case "failureReason": 5327 if value != nil { 5328 jtv, ok := value.(string) 5329 if !ok { 5330 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 5331 } 5332 sv.FailureReason = ptr.String(jtv) 5333 } 5334 5335 case "iamRole": 5336 if value != nil { 5337 jtv, ok := value.(string) 5338 if !ok { 5339 return fmt.Errorf("expected IamRole to be of type string, got %T instead", value) 5340 } 5341 sv.IamRole = ptr.String(jtv) 5342 } 5343 5344 case "lastStartedAt": 5345 if value != nil { 5346 switch jtv := value.(type) { 5347 case json.Number: 5348 f64, err := jtv.Float64() 5349 if err != nil { 5350 return err 5351 } 5352 sv.LastStartedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5353 5354 default: 5355 return fmt.Errorf("expected LastStartedAt to be a JSON Number, got %T instead", value) 5356 5357 } 5358 } 5359 5360 case "lastUpdatedAt": 5361 if value != nil { 5362 switch jtv := value.(type) { 5363 case json.Number: 5364 f64, err := jtv.Float64() 5365 if err != nil { 5366 return err 5367 } 5368 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5369 5370 default: 5371 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 5372 5373 } 5374 } 5375 5376 case "loggingConfig": 5377 if err := awsRestjson1_deserializeDocumentLoggingConfig(&sv.LoggingConfig, value); err != nil { 5378 return err 5379 } 5380 5381 case "maxJobDurationInSeconds": 5382 if value != nil { 5383 jtv, ok := value.(json.Number) 5384 if !ok { 5385 return fmt.Errorf("expected JobDuration to be json.Number, got %T instead", value) 5386 } 5387 i64, err := jtv.Int64() 5388 if err != nil { 5389 return err 5390 } 5391 sv.MaxJobDurationInSeconds = i64 5392 } 5393 5394 case "name": 5395 if value != nil { 5396 jtv, ok := value.(string) 5397 if !ok { 5398 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 5399 } 5400 sv.Name = ptr.String(jtv) 5401 } 5402 5403 case "networkInterface": 5404 if err := awsRestjson1_deserializeDocumentNetworkInterface(&sv.NetworkInterface, value); err != nil { 5405 return err 5406 } 5407 5408 case "outputLocation": 5409 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 5410 return err 5411 } 5412 5413 case "robotApplications": 5414 if err := awsRestjson1_deserializeDocumentRobotApplicationConfigs(&sv.RobotApplications, value); err != nil { 5415 return err 5416 } 5417 5418 case "simulationApplications": 5419 if err := awsRestjson1_deserializeDocumentSimulationApplicationConfigs(&sv.SimulationApplications, value); err != nil { 5420 return err 5421 } 5422 5423 case "simulationTimeMillis": 5424 if value != nil { 5425 jtv, ok := value.(json.Number) 5426 if !ok { 5427 return fmt.Errorf("expected SimulationTimeMillis to be json.Number, got %T instead", value) 5428 } 5429 i64, err := jtv.Int64() 5430 if err != nil { 5431 return err 5432 } 5433 sv.SimulationTimeMillis = i64 5434 } 5435 5436 case "status": 5437 if value != nil { 5438 jtv, ok := value.(string) 5439 if !ok { 5440 return fmt.Errorf("expected SimulationJobStatus to be of type string, got %T instead", value) 5441 } 5442 sv.Status = types.SimulationJobStatus(jtv) 5443 } 5444 5445 case "tags": 5446 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 5447 return err 5448 } 5449 5450 case "vpcConfig": 5451 if err := awsRestjson1_deserializeDocumentVPCConfigResponse(&sv.VpcConfig, value); err != nil { 5452 return err 5453 } 5454 5455 default: 5456 _, _ = key, value 5457 5458 } 5459 } 5460 *v = sv 5461 return nil 5462} 5463 5464type awsRestjson1_deserializeOpDescribeSimulationJobBatch struct { 5465} 5466 5467func (*awsRestjson1_deserializeOpDescribeSimulationJobBatch) ID() string { 5468 return "OperationDeserializer" 5469} 5470 5471func (m *awsRestjson1_deserializeOpDescribeSimulationJobBatch) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5472 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5473) { 5474 out, metadata, err = next.HandleDeserialize(ctx, in) 5475 if err != nil { 5476 return out, metadata, err 5477 } 5478 5479 response, ok := out.RawResponse.(*smithyhttp.Response) 5480 if !ok { 5481 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5482 } 5483 5484 if response.StatusCode < 200 || response.StatusCode >= 300 { 5485 return out, metadata, awsRestjson1_deserializeOpErrorDescribeSimulationJobBatch(response, &metadata) 5486 } 5487 output := &DescribeSimulationJobBatchOutput{} 5488 out.Result = output 5489 5490 var buff [1024]byte 5491 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5492 5493 body := io.TeeReader(response.Body, ringBuffer) 5494 5495 decoder := json.NewDecoder(body) 5496 decoder.UseNumber() 5497 var shape interface{} 5498 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5499 var snapshot bytes.Buffer 5500 io.Copy(&snapshot, ringBuffer) 5501 err = &smithy.DeserializationError{ 5502 Err: fmt.Errorf("failed to decode response body, %w", err), 5503 Snapshot: snapshot.Bytes(), 5504 } 5505 return out, metadata, err 5506 } 5507 5508 err = awsRestjson1_deserializeOpDocumentDescribeSimulationJobBatchOutput(&output, shape) 5509 if err != nil { 5510 var snapshot bytes.Buffer 5511 io.Copy(&snapshot, ringBuffer) 5512 return out, metadata, &smithy.DeserializationError{ 5513 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5514 Snapshot: snapshot.Bytes(), 5515 } 5516 } 5517 5518 return out, metadata, err 5519} 5520 5521func awsRestjson1_deserializeOpErrorDescribeSimulationJobBatch(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5522 var errorBuffer bytes.Buffer 5523 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5524 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5525 } 5526 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5527 5528 errorCode := "UnknownError" 5529 errorMessage := errorCode 5530 5531 code := response.Header.Get("X-Amzn-ErrorType") 5532 if len(code) != 0 { 5533 errorCode = restjson.SanitizeErrorCode(code) 5534 } 5535 5536 var buff [1024]byte 5537 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5538 5539 body := io.TeeReader(errorBody, ringBuffer) 5540 decoder := json.NewDecoder(body) 5541 decoder.UseNumber() 5542 code, message, err := restjson.GetErrorInfo(decoder) 5543 if err != nil { 5544 var snapshot bytes.Buffer 5545 io.Copy(&snapshot, ringBuffer) 5546 err = &smithy.DeserializationError{ 5547 Err: fmt.Errorf("failed to decode response body, %w", err), 5548 Snapshot: snapshot.Bytes(), 5549 } 5550 return err 5551 } 5552 5553 errorBody.Seek(0, io.SeekStart) 5554 if len(code) != 0 { 5555 errorCode = restjson.SanitizeErrorCode(code) 5556 } 5557 if len(message) != 0 { 5558 errorMessage = message 5559 } 5560 5561 switch { 5562 case strings.EqualFold("InternalServerException", errorCode): 5563 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5564 5565 case strings.EqualFold("InvalidParameterException", errorCode): 5566 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5567 5568 case strings.EqualFold("ResourceNotFoundException", errorCode): 5569 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5570 5571 default: 5572 genericError := &smithy.GenericAPIError{ 5573 Code: errorCode, 5574 Message: errorMessage, 5575 } 5576 return genericError 5577 5578 } 5579} 5580 5581func awsRestjson1_deserializeOpDocumentDescribeSimulationJobBatchOutput(v **DescribeSimulationJobBatchOutput, value interface{}) error { 5582 if v == nil { 5583 return fmt.Errorf("unexpected nil of type %T", v) 5584 } 5585 if value == nil { 5586 return nil 5587 } 5588 5589 shape, ok := value.(map[string]interface{}) 5590 if !ok { 5591 return fmt.Errorf("unexpected JSON type %v", value) 5592 } 5593 5594 var sv *DescribeSimulationJobBatchOutput 5595 if *v == nil { 5596 sv = &DescribeSimulationJobBatchOutput{} 5597 } else { 5598 sv = *v 5599 } 5600 5601 for key, value := range shape { 5602 switch key { 5603 case "arn": 5604 if value != nil { 5605 jtv, ok := value.(string) 5606 if !ok { 5607 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5608 } 5609 sv.Arn = ptr.String(jtv) 5610 } 5611 5612 case "batchPolicy": 5613 if err := awsRestjson1_deserializeDocumentBatchPolicy(&sv.BatchPolicy, value); err != nil { 5614 return err 5615 } 5616 5617 case "clientRequestToken": 5618 if value != nil { 5619 jtv, ok := value.(string) 5620 if !ok { 5621 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 5622 } 5623 sv.ClientRequestToken = ptr.String(jtv) 5624 } 5625 5626 case "createdAt": 5627 if value != nil { 5628 switch jtv := value.(type) { 5629 case json.Number: 5630 f64, err := jtv.Float64() 5631 if err != nil { 5632 return err 5633 } 5634 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5635 5636 default: 5637 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 5638 5639 } 5640 } 5641 5642 case "createdRequests": 5643 if err := awsRestjson1_deserializeDocumentSimulationJobSummaries(&sv.CreatedRequests, value); err != nil { 5644 return err 5645 } 5646 5647 case "failedRequests": 5648 if err := awsRestjson1_deserializeDocumentFailedCreateSimulationJobRequests(&sv.FailedRequests, value); err != nil { 5649 return err 5650 } 5651 5652 case "failureCode": 5653 if value != nil { 5654 jtv, ok := value.(string) 5655 if !ok { 5656 return fmt.Errorf("expected SimulationJobBatchErrorCode to be of type string, got %T instead", value) 5657 } 5658 sv.FailureCode = types.SimulationJobBatchErrorCode(jtv) 5659 } 5660 5661 case "failureReason": 5662 if value != nil { 5663 jtv, ok := value.(string) 5664 if !ok { 5665 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 5666 } 5667 sv.FailureReason = ptr.String(jtv) 5668 } 5669 5670 case "lastUpdatedAt": 5671 if value != nil { 5672 switch jtv := value.(type) { 5673 case json.Number: 5674 f64, err := jtv.Float64() 5675 if err != nil { 5676 return err 5677 } 5678 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5679 5680 default: 5681 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 5682 5683 } 5684 } 5685 5686 case "pendingRequests": 5687 if err := awsRestjson1_deserializeDocumentCreateSimulationJobRequests(&sv.PendingRequests, value); err != nil { 5688 return err 5689 } 5690 5691 case "status": 5692 if value != nil { 5693 jtv, ok := value.(string) 5694 if !ok { 5695 return fmt.Errorf("expected SimulationJobBatchStatus to be of type string, got %T instead", value) 5696 } 5697 sv.Status = types.SimulationJobBatchStatus(jtv) 5698 } 5699 5700 case "tags": 5701 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 5702 return err 5703 } 5704 5705 default: 5706 _, _ = key, value 5707 5708 } 5709 } 5710 *v = sv 5711 return nil 5712} 5713 5714type awsRestjson1_deserializeOpDescribeWorld struct { 5715} 5716 5717func (*awsRestjson1_deserializeOpDescribeWorld) ID() string { 5718 return "OperationDeserializer" 5719} 5720 5721func (m *awsRestjson1_deserializeOpDescribeWorld) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5722 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5723) { 5724 out, metadata, err = next.HandleDeserialize(ctx, in) 5725 if err != nil { 5726 return out, metadata, err 5727 } 5728 5729 response, ok := out.RawResponse.(*smithyhttp.Response) 5730 if !ok { 5731 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5732 } 5733 5734 if response.StatusCode < 200 || response.StatusCode >= 300 { 5735 return out, metadata, awsRestjson1_deserializeOpErrorDescribeWorld(response, &metadata) 5736 } 5737 output := &DescribeWorldOutput{} 5738 out.Result = output 5739 5740 var buff [1024]byte 5741 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5742 5743 body := io.TeeReader(response.Body, ringBuffer) 5744 5745 decoder := json.NewDecoder(body) 5746 decoder.UseNumber() 5747 var shape interface{} 5748 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5749 var snapshot bytes.Buffer 5750 io.Copy(&snapshot, ringBuffer) 5751 err = &smithy.DeserializationError{ 5752 Err: fmt.Errorf("failed to decode response body, %w", err), 5753 Snapshot: snapshot.Bytes(), 5754 } 5755 return out, metadata, err 5756 } 5757 5758 err = awsRestjson1_deserializeOpDocumentDescribeWorldOutput(&output, shape) 5759 if err != nil { 5760 var snapshot bytes.Buffer 5761 io.Copy(&snapshot, ringBuffer) 5762 return out, metadata, &smithy.DeserializationError{ 5763 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5764 Snapshot: snapshot.Bytes(), 5765 } 5766 } 5767 5768 return out, metadata, err 5769} 5770 5771func awsRestjson1_deserializeOpErrorDescribeWorld(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5772 var errorBuffer bytes.Buffer 5773 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5774 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5775 } 5776 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5777 5778 errorCode := "UnknownError" 5779 errorMessage := errorCode 5780 5781 code := response.Header.Get("X-Amzn-ErrorType") 5782 if len(code) != 0 { 5783 errorCode = restjson.SanitizeErrorCode(code) 5784 } 5785 5786 var buff [1024]byte 5787 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5788 5789 body := io.TeeReader(errorBody, ringBuffer) 5790 decoder := json.NewDecoder(body) 5791 decoder.UseNumber() 5792 code, message, err := restjson.GetErrorInfo(decoder) 5793 if err != nil { 5794 var snapshot bytes.Buffer 5795 io.Copy(&snapshot, ringBuffer) 5796 err = &smithy.DeserializationError{ 5797 Err: fmt.Errorf("failed to decode response body, %w", err), 5798 Snapshot: snapshot.Bytes(), 5799 } 5800 return err 5801 } 5802 5803 errorBody.Seek(0, io.SeekStart) 5804 if len(code) != 0 { 5805 errorCode = restjson.SanitizeErrorCode(code) 5806 } 5807 if len(message) != 0 { 5808 errorMessage = message 5809 } 5810 5811 switch { 5812 case strings.EqualFold("InternalServerException", errorCode): 5813 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5814 5815 case strings.EqualFold("InvalidParameterException", errorCode): 5816 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5817 5818 case strings.EqualFold("ResourceNotFoundException", errorCode): 5819 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5820 5821 case strings.EqualFold("ThrottlingException", errorCode): 5822 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5823 5824 default: 5825 genericError := &smithy.GenericAPIError{ 5826 Code: errorCode, 5827 Message: errorMessage, 5828 } 5829 return genericError 5830 5831 } 5832} 5833 5834func awsRestjson1_deserializeOpDocumentDescribeWorldOutput(v **DescribeWorldOutput, value interface{}) error { 5835 if v == nil { 5836 return fmt.Errorf("unexpected nil of type %T", v) 5837 } 5838 if value == nil { 5839 return nil 5840 } 5841 5842 shape, ok := value.(map[string]interface{}) 5843 if !ok { 5844 return fmt.Errorf("unexpected JSON type %v", value) 5845 } 5846 5847 var sv *DescribeWorldOutput 5848 if *v == nil { 5849 sv = &DescribeWorldOutput{} 5850 } else { 5851 sv = *v 5852 } 5853 5854 for key, value := range shape { 5855 switch key { 5856 case "arn": 5857 if value != nil { 5858 jtv, ok := value.(string) 5859 if !ok { 5860 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5861 } 5862 sv.Arn = ptr.String(jtv) 5863 } 5864 5865 case "createdAt": 5866 if value != nil { 5867 switch jtv := value.(type) { 5868 case json.Number: 5869 f64, err := jtv.Float64() 5870 if err != nil { 5871 return err 5872 } 5873 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5874 5875 default: 5876 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 5877 5878 } 5879 } 5880 5881 case "generationJob": 5882 if value != nil { 5883 jtv, ok := value.(string) 5884 if !ok { 5885 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5886 } 5887 sv.GenerationJob = ptr.String(jtv) 5888 } 5889 5890 case "tags": 5891 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 5892 return err 5893 } 5894 5895 case "template": 5896 if value != nil { 5897 jtv, ok := value.(string) 5898 if !ok { 5899 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5900 } 5901 sv.Template = ptr.String(jtv) 5902 } 5903 5904 case "worldDescriptionBody": 5905 if value != nil { 5906 jtv, ok := value.(string) 5907 if !ok { 5908 return fmt.Errorf("expected Json to be of type string, got %T instead", value) 5909 } 5910 sv.WorldDescriptionBody = ptr.String(jtv) 5911 } 5912 5913 default: 5914 _, _ = key, value 5915 5916 } 5917 } 5918 *v = sv 5919 return nil 5920} 5921 5922type awsRestjson1_deserializeOpDescribeWorldExportJob struct { 5923} 5924 5925func (*awsRestjson1_deserializeOpDescribeWorldExportJob) ID() string { 5926 return "OperationDeserializer" 5927} 5928 5929func (m *awsRestjson1_deserializeOpDescribeWorldExportJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5930 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5931) { 5932 out, metadata, err = next.HandleDeserialize(ctx, in) 5933 if err != nil { 5934 return out, metadata, err 5935 } 5936 5937 response, ok := out.RawResponse.(*smithyhttp.Response) 5938 if !ok { 5939 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5940 } 5941 5942 if response.StatusCode < 200 || response.StatusCode >= 300 { 5943 return out, metadata, awsRestjson1_deserializeOpErrorDescribeWorldExportJob(response, &metadata) 5944 } 5945 output := &DescribeWorldExportJobOutput{} 5946 out.Result = output 5947 5948 var buff [1024]byte 5949 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5950 5951 body := io.TeeReader(response.Body, ringBuffer) 5952 5953 decoder := json.NewDecoder(body) 5954 decoder.UseNumber() 5955 var shape interface{} 5956 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5957 var snapshot bytes.Buffer 5958 io.Copy(&snapshot, ringBuffer) 5959 err = &smithy.DeserializationError{ 5960 Err: fmt.Errorf("failed to decode response body, %w", err), 5961 Snapshot: snapshot.Bytes(), 5962 } 5963 return out, metadata, err 5964 } 5965 5966 err = awsRestjson1_deserializeOpDocumentDescribeWorldExportJobOutput(&output, shape) 5967 if err != nil { 5968 var snapshot bytes.Buffer 5969 io.Copy(&snapshot, ringBuffer) 5970 return out, metadata, &smithy.DeserializationError{ 5971 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5972 Snapshot: snapshot.Bytes(), 5973 } 5974 } 5975 5976 return out, metadata, err 5977} 5978 5979func awsRestjson1_deserializeOpErrorDescribeWorldExportJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5980 var errorBuffer bytes.Buffer 5981 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5982 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5983 } 5984 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5985 5986 errorCode := "UnknownError" 5987 errorMessage := errorCode 5988 5989 code := response.Header.Get("X-Amzn-ErrorType") 5990 if len(code) != 0 { 5991 errorCode = restjson.SanitizeErrorCode(code) 5992 } 5993 5994 var buff [1024]byte 5995 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5996 5997 body := io.TeeReader(errorBody, ringBuffer) 5998 decoder := json.NewDecoder(body) 5999 decoder.UseNumber() 6000 code, message, err := restjson.GetErrorInfo(decoder) 6001 if err != nil { 6002 var snapshot bytes.Buffer 6003 io.Copy(&snapshot, ringBuffer) 6004 err = &smithy.DeserializationError{ 6005 Err: fmt.Errorf("failed to decode response body, %w", err), 6006 Snapshot: snapshot.Bytes(), 6007 } 6008 return err 6009 } 6010 6011 errorBody.Seek(0, io.SeekStart) 6012 if len(code) != 0 { 6013 errorCode = restjson.SanitizeErrorCode(code) 6014 } 6015 if len(message) != 0 { 6016 errorMessage = message 6017 } 6018 6019 switch { 6020 case strings.EqualFold("InternalServerException", errorCode): 6021 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6022 6023 case strings.EqualFold("InvalidParameterException", errorCode): 6024 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6025 6026 case strings.EqualFold("ResourceNotFoundException", errorCode): 6027 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6028 6029 case strings.EqualFold("ThrottlingException", errorCode): 6030 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6031 6032 default: 6033 genericError := &smithy.GenericAPIError{ 6034 Code: errorCode, 6035 Message: errorMessage, 6036 } 6037 return genericError 6038 6039 } 6040} 6041 6042func awsRestjson1_deserializeOpDocumentDescribeWorldExportJobOutput(v **DescribeWorldExportJobOutput, value interface{}) error { 6043 if v == nil { 6044 return fmt.Errorf("unexpected nil of type %T", v) 6045 } 6046 if value == nil { 6047 return nil 6048 } 6049 6050 shape, ok := value.(map[string]interface{}) 6051 if !ok { 6052 return fmt.Errorf("unexpected JSON type %v", value) 6053 } 6054 6055 var sv *DescribeWorldExportJobOutput 6056 if *v == nil { 6057 sv = &DescribeWorldExportJobOutput{} 6058 } else { 6059 sv = *v 6060 } 6061 6062 for key, value := range shape { 6063 switch key { 6064 case "arn": 6065 if value != nil { 6066 jtv, ok := value.(string) 6067 if !ok { 6068 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 6069 } 6070 sv.Arn = ptr.String(jtv) 6071 } 6072 6073 case "clientRequestToken": 6074 if value != nil { 6075 jtv, ok := value.(string) 6076 if !ok { 6077 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 6078 } 6079 sv.ClientRequestToken = ptr.String(jtv) 6080 } 6081 6082 case "createdAt": 6083 if value != nil { 6084 switch jtv := value.(type) { 6085 case json.Number: 6086 f64, err := jtv.Float64() 6087 if err != nil { 6088 return err 6089 } 6090 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6091 6092 default: 6093 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 6094 6095 } 6096 } 6097 6098 case "failureCode": 6099 if value != nil { 6100 jtv, ok := value.(string) 6101 if !ok { 6102 return fmt.Errorf("expected WorldExportJobErrorCode to be of type string, got %T instead", value) 6103 } 6104 sv.FailureCode = types.WorldExportJobErrorCode(jtv) 6105 } 6106 6107 case "failureReason": 6108 if value != nil { 6109 jtv, ok := value.(string) 6110 if !ok { 6111 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 6112 } 6113 sv.FailureReason = ptr.String(jtv) 6114 } 6115 6116 case "iamRole": 6117 if value != nil { 6118 jtv, ok := value.(string) 6119 if !ok { 6120 return fmt.Errorf("expected IamRole to be of type string, got %T instead", value) 6121 } 6122 sv.IamRole = ptr.String(jtv) 6123 } 6124 6125 case "outputLocation": 6126 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 6127 return err 6128 } 6129 6130 case "status": 6131 if value != nil { 6132 jtv, ok := value.(string) 6133 if !ok { 6134 return fmt.Errorf("expected WorldExportJobStatus to be of type string, got %T instead", value) 6135 } 6136 sv.Status = types.WorldExportJobStatus(jtv) 6137 } 6138 6139 case "tags": 6140 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 6141 return err 6142 } 6143 6144 case "worlds": 6145 if err := awsRestjson1_deserializeDocumentArns(&sv.Worlds, value); err != nil { 6146 return err 6147 } 6148 6149 default: 6150 _, _ = key, value 6151 6152 } 6153 } 6154 *v = sv 6155 return nil 6156} 6157 6158type awsRestjson1_deserializeOpDescribeWorldGenerationJob struct { 6159} 6160 6161func (*awsRestjson1_deserializeOpDescribeWorldGenerationJob) ID() string { 6162 return "OperationDeserializer" 6163} 6164 6165func (m *awsRestjson1_deserializeOpDescribeWorldGenerationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6166 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6167) { 6168 out, metadata, err = next.HandleDeserialize(ctx, in) 6169 if err != nil { 6170 return out, metadata, err 6171 } 6172 6173 response, ok := out.RawResponse.(*smithyhttp.Response) 6174 if !ok { 6175 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6176 } 6177 6178 if response.StatusCode < 200 || response.StatusCode >= 300 { 6179 return out, metadata, awsRestjson1_deserializeOpErrorDescribeWorldGenerationJob(response, &metadata) 6180 } 6181 output := &DescribeWorldGenerationJobOutput{} 6182 out.Result = output 6183 6184 var buff [1024]byte 6185 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6186 6187 body := io.TeeReader(response.Body, ringBuffer) 6188 6189 decoder := json.NewDecoder(body) 6190 decoder.UseNumber() 6191 var shape interface{} 6192 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6193 var snapshot bytes.Buffer 6194 io.Copy(&snapshot, ringBuffer) 6195 err = &smithy.DeserializationError{ 6196 Err: fmt.Errorf("failed to decode response body, %w", err), 6197 Snapshot: snapshot.Bytes(), 6198 } 6199 return out, metadata, err 6200 } 6201 6202 err = awsRestjson1_deserializeOpDocumentDescribeWorldGenerationJobOutput(&output, shape) 6203 if err != nil { 6204 var snapshot bytes.Buffer 6205 io.Copy(&snapshot, ringBuffer) 6206 return out, metadata, &smithy.DeserializationError{ 6207 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6208 Snapshot: snapshot.Bytes(), 6209 } 6210 } 6211 6212 return out, metadata, err 6213} 6214 6215func awsRestjson1_deserializeOpErrorDescribeWorldGenerationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6216 var errorBuffer bytes.Buffer 6217 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6218 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6219 } 6220 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6221 6222 errorCode := "UnknownError" 6223 errorMessage := errorCode 6224 6225 code := response.Header.Get("X-Amzn-ErrorType") 6226 if len(code) != 0 { 6227 errorCode = restjson.SanitizeErrorCode(code) 6228 } 6229 6230 var buff [1024]byte 6231 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6232 6233 body := io.TeeReader(errorBody, ringBuffer) 6234 decoder := json.NewDecoder(body) 6235 decoder.UseNumber() 6236 code, message, err := restjson.GetErrorInfo(decoder) 6237 if err != nil { 6238 var snapshot bytes.Buffer 6239 io.Copy(&snapshot, ringBuffer) 6240 err = &smithy.DeserializationError{ 6241 Err: fmt.Errorf("failed to decode response body, %w", err), 6242 Snapshot: snapshot.Bytes(), 6243 } 6244 return err 6245 } 6246 6247 errorBody.Seek(0, io.SeekStart) 6248 if len(code) != 0 { 6249 errorCode = restjson.SanitizeErrorCode(code) 6250 } 6251 if len(message) != 0 { 6252 errorMessage = message 6253 } 6254 6255 switch { 6256 case strings.EqualFold("InternalServerException", errorCode): 6257 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6258 6259 case strings.EqualFold("InvalidParameterException", errorCode): 6260 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6261 6262 case strings.EqualFold("ResourceNotFoundException", errorCode): 6263 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6264 6265 case strings.EqualFold("ThrottlingException", errorCode): 6266 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6267 6268 default: 6269 genericError := &smithy.GenericAPIError{ 6270 Code: errorCode, 6271 Message: errorMessage, 6272 } 6273 return genericError 6274 6275 } 6276} 6277 6278func awsRestjson1_deserializeOpDocumentDescribeWorldGenerationJobOutput(v **DescribeWorldGenerationJobOutput, value interface{}) error { 6279 if v == nil { 6280 return fmt.Errorf("unexpected nil of type %T", v) 6281 } 6282 if value == nil { 6283 return nil 6284 } 6285 6286 shape, ok := value.(map[string]interface{}) 6287 if !ok { 6288 return fmt.Errorf("unexpected JSON type %v", value) 6289 } 6290 6291 var sv *DescribeWorldGenerationJobOutput 6292 if *v == nil { 6293 sv = &DescribeWorldGenerationJobOutput{} 6294 } else { 6295 sv = *v 6296 } 6297 6298 for key, value := range shape { 6299 switch key { 6300 case "arn": 6301 if value != nil { 6302 jtv, ok := value.(string) 6303 if !ok { 6304 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 6305 } 6306 sv.Arn = ptr.String(jtv) 6307 } 6308 6309 case "clientRequestToken": 6310 if value != nil { 6311 jtv, ok := value.(string) 6312 if !ok { 6313 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 6314 } 6315 sv.ClientRequestToken = ptr.String(jtv) 6316 } 6317 6318 case "createdAt": 6319 if value != nil { 6320 switch jtv := value.(type) { 6321 case json.Number: 6322 f64, err := jtv.Float64() 6323 if err != nil { 6324 return err 6325 } 6326 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6327 6328 default: 6329 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 6330 6331 } 6332 } 6333 6334 case "failureCode": 6335 if value != nil { 6336 jtv, ok := value.(string) 6337 if !ok { 6338 return fmt.Errorf("expected WorldGenerationJobErrorCode to be of type string, got %T instead", value) 6339 } 6340 sv.FailureCode = types.WorldGenerationJobErrorCode(jtv) 6341 } 6342 6343 case "failureReason": 6344 if value != nil { 6345 jtv, ok := value.(string) 6346 if !ok { 6347 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 6348 } 6349 sv.FailureReason = ptr.String(jtv) 6350 } 6351 6352 case "finishedWorldsSummary": 6353 if err := awsRestjson1_deserializeDocumentFinishedWorldsSummary(&sv.FinishedWorldsSummary, value); err != nil { 6354 return err 6355 } 6356 6357 case "status": 6358 if value != nil { 6359 jtv, ok := value.(string) 6360 if !ok { 6361 return fmt.Errorf("expected WorldGenerationJobStatus to be of type string, got %T instead", value) 6362 } 6363 sv.Status = types.WorldGenerationJobStatus(jtv) 6364 } 6365 6366 case "tags": 6367 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 6368 return err 6369 } 6370 6371 case "template": 6372 if value != nil { 6373 jtv, ok := value.(string) 6374 if !ok { 6375 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 6376 } 6377 sv.Template = ptr.String(jtv) 6378 } 6379 6380 case "worldCount": 6381 if err := awsRestjson1_deserializeDocumentWorldCount(&sv.WorldCount, value); err != nil { 6382 return err 6383 } 6384 6385 case "worldTags": 6386 if err := awsRestjson1_deserializeDocumentTagMap(&sv.WorldTags, value); err != nil { 6387 return err 6388 } 6389 6390 default: 6391 _, _ = key, value 6392 6393 } 6394 } 6395 *v = sv 6396 return nil 6397} 6398 6399type awsRestjson1_deserializeOpDescribeWorldTemplate struct { 6400} 6401 6402func (*awsRestjson1_deserializeOpDescribeWorldTemplate) ID() string { 6403 return "OperationDeserializer" 6404} 6405 6406func (m *awsRestjson1_deserializeOpDescribeWorldTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6407 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6408) { 6409 out, metadata, err = next.HandleDeserialize(ctx, in) 6410 if err != nil { 6411 return out, metadata, err 6412 } 6413 6414 response, ok := out.RawResponse.(*smithyhttp.Response) 6415 if !ok { 6416 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6417 } 6418 6419 if response.StatusCode < 200 || response.StatusCode >= 300 { 6420 return out, metadata, awsRestjson1_deserializeOpErrorDescribeWorldTemplate(response, &metadata) 6421 } 6422 output := &DescribeWorldTemplateOutput{} 6423 out.Result = output 6424 6425 var buff [1024]byte 6426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6427 6428 body := io.TeeReader(response.Body, ringBuffer) 6429 6430 decoder := json.NewDecoder(body) 6431 decoder.UseNumber() 6432 var shape interface{} 6433 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6434 var snapshot bytes.Buffer 6435 io.Copy(&snapshot, ringBuffer) 6436 err = &smithy.DeserializationError{ 6437 Err: fmt.Errorf("failed to decode response body, %w", err), 6438 Snapshot: snapshot.Bytes(), 6439 } 6440 return out, metadata, err 6441 } 6442 6443 err = awsRestjson1_deserializeOpDocumentDescribeWorldTemplateOutput(&output, shape) 6444 if err != nil { 6445 var snapshot bytes.Buffer 6446 io.Copy(&snapshot, ringBuffer) 6447 return out, metadata, &smithy.DeserializationError{ 6448 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6449 Snapshot: snapshot.Bytes(), 6450 } 6451 } 6452 6453 return out, metadata, err 6454} 6455 6456func awsRestjson1_deserializeOpErrorDescribeWorldTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6457 var errorBuffer bytes.Buffer 6458 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6459 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6460 } 6461 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6462 6463 errorCode := "UnknownError" 6464 errorMessage := errorCode 6465 6466 code := response.Header.Get("X-Amzn-ErrorType") 6467 if len(code) != 0 { 6468 errorCode = restjson.SanitizeErrorCode(code) 6469 } 6470 6471 var buff [1024]byte 6472 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6473 6474 body := io.TeeReader(errorBody, ringBuffer) 6475 decoder := json.NewDecoder(body) 6476 decoder.UseNumber() 6477 code, message, err := restjson.GetErrorInfo(decoder) 6478 if err != nil { 6479 var snapshot bytes.Buffer 6480 io.Copy(&snapshot, ringBuffer) 6481 err = &smithy.DeserializationError{ 6482 Err: fmt.Errorf("failed to decode response body, %w", err), 6483 Snapshot: snapshot.Bytes(), 6484 } 6485 return err 6486 } 6487 6488 errorBody.Seek(0, io.SeekStart) 6489 if len(code) != 0 { 6490 errorCode = restjson.SanitizeErrorCode(code) 6491 } 6492 if len(message) != 0 { 6493 errorMessage = message 6494 } 6495 6496 switch { 6497 case strings.EqualFold("InternalServerException", errorCode): 6498 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6499 6500 case strings.EqualFold("InvalidParameterException", errorCode): 6501 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6502 6503 case strings.EqualFold("ResourceNotFoundException", errorCode): 6504 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6505 6506 case strings.EqualFold("ThrottlingException", errorCode): 6507 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6508 6509 default: 6510 genericError := &smithy.GenericAPIError{ 6511 Code: errorCode, 6512 Message: errorMessage, 6513 } 6514 return genericError 6515 6516 } 6517} 6518 6519func awsRestjson1_deserializeOpDocumentDescribeWorldTemplateOutput(v **DescribeWorldTemplateOutput, value interface{}) error { 6520 if v == nil { 6521 return fmt.Errorf("unexpected nil of type %T", v) 6522 } 6523 if value == nil { 6524 return nil 6525 } 6526 6527 shape, ok := value.(map[string]interface{}) 6528 if !ok { 6529 return fmt.Errorf("unexpected JSON type %v", value) 6530 } 6531 6532 var sv *DescribeWorldTemplateOutput 6533 if *v == nil { 6534 sv = &DescribeWorldTemplateOutput{} 6535 } else { 6536 sv = *v 6537 } 6538 6539 for key, value := range shape { 6540 switch key { 6541 case "arn": 6542 if value != nil { 6543 jtv, ok := value.(string) 6544 if !ok { 6545 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 6546 } 6547 sv.Arn = ptr.String(jtv) 6548 } 6549 6550 case "clientRequestToken": 6551 if value != nil { 6552 jtv, ok := value.(string) 6553 if !ok { 6554 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 6555 } 6556 sv.ClientRequestToken = ptr.String(jtv) 6557 } 6558 6559 case "createdAt": 6560 if value != nil { 6561 switch jtv := value.(type) { 6562 case json.Number: 6563 f64, err := jtv.Float64() 6564 if err != nil { 6565 return err 6566 } 6567 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6568 6569 default: 6570 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 6571 6572 } 6573 } 6574 6575 case "lastUpdatedAt": 6576 if value != nil { 6577 switch jtv := value.(type) { 6578 case json.Number: 6579 f64, err := jtv.Float64() 6580 if err != nil { 6581 return err 6582 } 6583 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6584 6585 default: 6586 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 6587 6588 } 6589 } 6590 6591 case "name": 6592 if value != nil { 6593 jtv, ok := value.(string) 6594 if !ok { 6595 return fmt.Errorf("expected TemplateName to be of type string, got %T instead", value) 6596 } 6597 sv.Name = ptr.String(jtv) 6598 } 6599 6600 case "tags": 6601 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 6602 return err 6603 } 6604 6605 case "version": 6606 if value != nil { 6607 jtv, ok := value.(string) 6608 if !ok { 6609 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 6610 } 6611 sv.Version = ptr.String(jtv) 6612 } 6613 6614 default: 6615 _, _ = key, value 6616 6617 } 6618 } 6619 *v = sv 6620 return nil 6621} 6622 6623type awsRestjson1_deserializeOpGetWorldTemplateBody struct { 6624} 6625 6626func (*awsRestjson1_deserializeOpGetWorldTemplateBody) ID() string { 6627 return "OperationDeserializer" 6628} 6629 6630func (m *awsRestjson1_deserializeOpGetWorldTemplateBody) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6631 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6632) { 6633 out, metadata, err = next.HandleDeserialize(ctx, in) 6634 if err != nil { 6635 return out, metadata, err 6636 } 6637 6638 response, ok := out.RawResponse.(*smithyhttp.Response) 6639 if !ok { 6640 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6641 } 6642 6643 if response.StatusCode < 200 || response.StatusCode >= 300 { 6644 return out, metadata, awsRestjson1_deserializeOpErrorGetWorldTemplateBody(response, &metadata) 6645 } 6646 output := &GetWorldTemplateBodyOutput{} 6647 out.Result = output 6648 6649 var buff [1024]byte 6650 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6651 6652 body := io.TeeReader(response.Body, ringBuffer) 6653 6654 decoder := json.NewDecoder(body) 6655 decoder.UseNumber() 6656 var shape interface{} 6657 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6658 var snapshot bytes.Buffer 6659 io.Copy(&snapshot, ringBuffer) 6660 err = &smithy.DeserializationError{ 6661 Err: fmt.Errorf("failed to decode response body, %w", err), 6662 Snapshot: snapshot.Bytes(), 6663 } 6664 return out, metadata, err 6665 } 6666 6667 err = awsRestjson1_deserializeOpDocumentGetWorldTemplateBodyOutput(&output, shape) 6668 if err != nil { 6669 var snapshot bytes.Buffer 6670 io.Copy(&snapshot, ringBuffer) 6671 return out, metadata, &smithy.DeserializationError{ 6672 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6673 Snapshot: snapshot.Bytes(), 6674 } 6675 } 6676 6677 return out, metadata, err 6678} 6679 6680func awsRestjson1_deserializeOpErrorGetWorldTemplateBody(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6681 var errorBuffer bytes.Buffer 6682 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6683 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6684 } 6685 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6686 6687 errorCode := "UnknownError" 6688 errorMessage := errorCode 6689 6690 code := response.Header.Get("X-Amzn-ErrorType") 6691 if len(code) != 0 { 6692 errorCode = restjson.SanitizeErrorCode(code) 6693 } 6694 6695 var buff [1024]byte 6696 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6697 6698 body := io.TeeReader(errorBody, ringBuffer) 6699 decoder := json.NewDecoder(body) 6700 decoder.UseNumber() 6701 code, message, err := restjson.GetErrorInfo(decoder) 6702 if err != nil { 6703 var snapshot bytes.Buffer 6704 io.Copy(&snapshot, ringBuffer) 6705 err = &smithy.DeserializationError{ 6706 Err: fmt.Errorf("failed to decode response body, %w", err), 6707 Snapshot: snapshot.Bytes(), 6708 } 6709 return err 6710 } 6711 6712 errorBody.Seek(0, io.SeekStart) 6713 if len(code) != 0 { 6714 errorCode = restjson.SanitizeErrorCode(code) 6715 } 6716 if len(message) != 0 { 6717 errorMessage = message 6718 } 6719 6720 switch { 6721 case strings.EqualFold("InternalServerException", errorCode): 6722 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6723 6724 case strings.EqualFold("InvalidParameterException", errorCode): 6725 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6726 6727 case strings.EqualFold("ResourceNotFoundException", errorCode): 6728 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6729 6730 case strings.EqualFold("ThrottlingException", errorCode): 6731 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6732 6733 default: 6734 genericError := &smithy.GenericAPIError{ 6735 Code: errorCode, 6736 Message: errorMessage, 6737 } 6738 return genericError 6739 6740 } 6741} 6742 6743func awsRestjson1_deserializeOpDocumentGetWorldTemplateBodyOutput(v **GetWorldTemplateBodyOutput, value interface{}) error { 6744 if v == nil { 6745 return fmt.Errorf("unexpected nil of type %T", v) 6746 } 6747 if value == nil { 6748 return nil 6749 } 6750 6751 shape, ok := value.(map[string]interface{}) 6752 if !ok { 6753 return fmt.Errorf("unexpected JSON type %v", value) 6754 } 6755 6756 var sv *GetWorldTemplateBodyOutput 6757 if *v == nil { 6758 sv = &GetWorldTemplateBodyOutput{} 6759 } else { 6760 sv = *v 6761 } 6762 6763 for key, value := range shape { 6764 switch key { 6765 case "templateBody": 6766 if value != nil { 6767 jtv, ok := value.(string) 6768 if !ok { 6769 return fmt.Errorf("expected Json to be of type string, got %T instead", value) 6770 } 6771 sv.TemplateBody = ptr.String(jtv) 6772 } 6773 6774 default: 6775 _, _ = key, value 6776 6777 } 6778 } 6779 *v = sv 6780 return nil 6781} 6782 6783type awsRestjson1_deserializeOpListDeploymentJobs struct { 6784} 6785 6786func (*awsRestjson1_deserializeOpListDeploymentJobs) ID() string { 6787 return "OperationDeserializer" 6788} 6789 6790func (m *awsRestjson1_deserializeOpListDeploymentJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6791 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6792) { 6793 out, metadata, err = next.HandleDeserialize(ctx, in) 6794 if err != nil { 6795 return out, metadata, err 6796 } 6797 6798 response, ok := out.RawResponse.(*smithyhttp.Response) 6799 if !ok { 6800 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6801 } 6802 6803 if response.StatusCode < 200 || response.StatusCode >= 300 { 6804 return out, metadata, awsRestjson1_deserializeOpErrorListDeploymentJobs(response, &metadata) 6805 } 6806 output := &ListDeploymentJobsOutput{} 6807 out.Result = output 6808 6809 var buff [1024]byte 6810 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6811 6812 body := io.TeeReader(response.Body, ringBuffer) 6813 6814 decoder := json.NewDecoder(body) 6815 decoder.UseNumber() 6816 var shape interface{} 6817 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6818 var snapshot bytes.Buffer 6819 io.Copy(&snapshot, ringBuffer) 6820 err = &smithy.DeserializationError{ 6821 Err: fmt.Errorf("failed to decode response body, %w", err), 6822 Snapshot: snapshot.Bytes(), 6823 } 6824 return out, metadata, err 6825 } 6826 6827 err = awsRestjson1_deserializeOpDocumentListDeploymentJobsOutput(&output, shape) 6828 if err != nil { 6829 var snapshot bytes.Buffer 6830 io.Copy(&snapshot, ringBuffer) 6831 return out, metadata, &smithy.DeserializationError{ 6832 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6833 Snapshot: snapshot.Bytes(), 6834 } 6835 } 6836 6837 return out, metadata, err 6838} 6839 6840func awsRestjson1_deserializeOpErrorListDeploymentJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6841 var errorBuffer bytes.Buffer 6842 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6843 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6844 } 6845 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6846 6847 errorCode := "UnknownError" 6848 errorMessage := errorCode 6849 6850 code := response.Header.Get("X-Amzn-ErrorType") 6851 if len(code) != 0 { 6852 errorCode = restjson.SanitizeErrorCode(code) 6853 } 6854 6855 var buff [1024]byte 6856 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6857 6858 body := io.TeeReader(errorBody, ringBuffer) 6859 decoder := json.NewDecoder(body) 6860 decoder.UseNumber() 6861 code, message, err := restjson.GetErrorInfo(decoder) 6862 if err != nil { 6863 var snapshot bytes.Buffer 6864 io.Copy(&snapshot, ringBuffer) 6865 err = &smithy.DeserializationError{ 6866 Err: fmt.Errorf("failed to decode response body, %w", err), 6867 Snapshot: snapshot.Bytes(), 6868 } 6869 return err 6870 } 6871 6872 errorBody.Seek(0, io.SeekStart) 6873 if len(code) != 0 { 6874 errorCode = restjson.SanitizeErrorCode(code) 6875 } 6876 if len(message) != 0 { 6877 errorMessage = message 6878 } 6879 6880 switch { 6881 case strings.EqualFold("InternalServerException", errorCode): 6882 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6883 6884 case strings.EqualFold("InvalidParameterException", errorCode): 6885 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6886 6887 case strings.EqualFold("ResourceNotFoundException", errorCode): 6888 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6889 6890 case strings.EqualFold("ThrottlingException", errorCode): 6891 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6892 6893 default: 6894 genericError := &smithy.GenericAPIError{ 6895 Code: errorCode, 6896 Message: errorMessage, 6897 } 6898 return genericError 6899 6900 } 6901} 6902 6903func awsRestjson1_deserializeOpDocumentListDeploymentJobsOutput(v **ListDeploymentJobsOutput, value interface{}) error { 6904 if v == nil { 6905 return fmt.Errorf("unexpected nil of type %T", v) 6906 } 6907 if value == nil { 6908 return nil 6909 } 6910 6911 shape, ok := value.(map[string]interface{}) 6912 if !ok { 6913 return fmt.Errorf("unexpected JSON type %v", value) 6914 } 6915 6916 var sv *ListDeploymentJobsOutput 6917 if *v == nil { 6918 sv = &ListDeploymentJobsOutput{} 6919 } else { 6920 sv = *v 6921 } 6922 6923 for key, value := range shape { 6924 switch key { 6925 case "deploymentJobs": 6926 if err := awsRestjson1_deserializeDocumentDeploymentJobs(&sv.DeploymentJobs, value); err != nil { 6927 return err 6928 } 6929 6930 case "nextToken": 6931 if value != nil { 6932 jtv, ok := value.(string) 6933 if !ok { 6934 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 6935 } 6936 sv.NextToken = ptr.String(jtv) 6937 } 6938 6939 default: 6940 _, _ = key, value 6941 6942 } 6943 } 6944 *v = sv 6945 return nil 6946} 6947 6948type awsRestjson1_deserializeOpListFleets struct { 6949} 6950 6951func (*awsRestjson1_deserializeOpListFleets) ID() string { 6952 return "OperationDeserializer" 6953} 6954 6955func (m *awsRestjson1_deserializeOpListFleets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6956 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6957) { 6958 out, metadata, err = next.HandleDeserialize(ctx, in) 6959 if err != nil { 6960 return out, metadata, err 6961 } 6962 6963 response, ok := out.RawResponse.(*smithyhttp.Response) 6964 if !ok { 6965 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6966 } 6967 6968 if response.StatusCode < 200 || response.StatusCode >= 300 { 6969 return out, metadata, awsRestjson1_deserializeOpErrorListFleets(response, &metadata) 6970 } 6971 output := &ListFleetsOutput{} 6972 out.Result = output 6973 6974 var buff [1024]byte 6975 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6976 6977 body := io.TeeReader(response.Body, ringBuffer) 6978 6979 decoder := json.NewDecoder(body) 6980 decoder.UseNumber() 6981 var shape interface{} 6982 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6983 var snapshot bytes.Buffer 6984 io.Copy(&snapshot, ringBuffer) 6985 err = &smithy.DeserializationError{ 6986 Err: fmt.Errorf("failed to decode response body, %w", err), 6987 Snapshot: snapshot.Bytes(), 6988 } 6989 return out, metadata, err 6990 } 6991 6992 err = awsRestjson1_deserializeOpDocumentListFleetsOutput(&output, shape) 6993 if err != nil { 6994 var snapshot bytes.Buffer 6995 io.Copy(&snapshot, ringBuffer) 6996 return out, metadata, &smithy.DeserializationError{ 6997 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6998 Snapshot: snapshot.Bytes(), 6999 } 7000 } 7001 7002 return out, metadata, err 7003} 7004 7005func awsRestjson1_deserializeOpErrorListFleets(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7006 var errorBuffer bytes.Buffer 7007 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7008 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7009 } 7010 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7011 7012 errorCode := "UnknownError" 7013 errorMessage := errorCode 7014 7015 code := response.Header.Get("X-Amzn-ErrorType") 7016 if len(code) != 0 { 7017 errorCode = restjson.SanitizeErrorCode(code) 7018 } 7019 7020 var buff [1024]byte 7021 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7022 7023 body := io.TeeReader(errorBody, ringBuffer) 7024 decoder := json.NewDecoder(body) 7025 decoder.UseNumber() 7026 code, message, err := restjson.GetErrorInfo(decoder) 7027 if err != nil { 7028 var snapshot bytes.Buffer 7029 io.Copy(&snapshot, ringBuffer) 7030 err = &smithy.DeserializationError{ 7031 Err: fmt.Errorf("failed to decode response body, %w", err), 7032 Snapshot: snapshot.Bytes(), 7033 } 7034 return err 7035 } 7036 7037 errorBody.Seek(0, io.SeekStart) 7038 if len(code) != 0 { 7039 errorCode = restjson.SanitizeErrorCode(code) 7040 } 7041 if len(message) != 0 { 7042 errorMessage = message 7043 } 7044 7045 switch { 7046 case strings.EqualFold("InternalServerException", errorCode): 7047 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7048 7049 case strings.EqualFold("InvalidParameterException", errorCode): 7050 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7051 7052 case strings.EqualFold("ResourceNotFoundException", errorCode): 7053 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7054 7055 case strings.EqualFold("ThrottlingException", errorCode): 7056 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7057 7058 default: 7059 genericError := &smithy.GenericAPIError{ 7060 Code: errorCode, 7061 Message: errorMessage, 7062 } 7063 return genericError 7064 7065 } 7066} 7067 7068func awsRestjson1_deserializeOpDocumentListFleetsOutput(v **ListFleetsOutput, value interface{}) error { 7069 if v == nil { 7070 return fmt.Errorf("unexpected nil of type %T", v) 7071 } 7072 if value == nil { 7073 return nil 7074 } 7075 7076 shape, ok := value.(map[string]interface{}) 7077 if !ok { 7078 return fmt.Errorf("unexpected JSON type %v", value) 7079 } 7080 7081 var sv *ListFleetsOutput 7082 if *v == nil { 7083 sv = &ListFleetsOutput{} 7084 } else { 7085 sv = *v 7086 } 7087 7088 for key, value := range shape { 7089 switch key { 7090 case "fleetDetails": 7091 if err := awsRestjson1_deserializeDocumentFleets(&sv.FleetDetails, value); err != nil { 7092 return err 7093 } 7094 7095 case "nextToken": 7096 if value != nil { 7097 jtv, ok := value.(string) 7098 if !ok { 7099 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 7100 } 7101 sv.NextToken = ptr.String(jtv) 7102 } 7103 7104 default: 7105 _, _ = key, value 7106 7107 } 7108 } 7109 *v = sv 7110 return nil 7111} 7112 7113type awsRestjson1_deserializeOpListRobotApplications struct { 7114} 7115 7116func (*awsRestjson1_deserializeOpListRobotApplications) ID() string { 7117 return "OperationDeserializer" 7118} 7119 7120func (m *awsRestjson1_deserializeOpListRobotApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7121 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7122) { 7123 out, metadata, err = next.HandleDeserialize(ctx, in) 7124 if err != nil { 7125 return out, metadata, err 7126 } 7127 7128 response, ok := out.RawResponse.(*smithyhttp.Response) 7129 if !ok { 7130 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7131 } 7132 7133 if response.StatusCode < 200 || response.StatusCode >= 300 { 7134 return out, metadata, awsRestjson1_deserializeOpErrorListRobotApplications(response, &metadata) 7135 } 7136 output := &ListRobotApplicationsOutput{} 7137 out.Result = output 7138 7139 var buff [1024]byte 7140 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7141 7142 body := io.TeeReader(response.Body, ringBuffer) 7143 7144 decoder := json.NewDecoder(body) 7145 decoder.UseNumber() 7146 var shape interface{} 7147 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7148 var snapshot bytes.Buffer 7149 io.Copy(&snapshot, ringBuffer) 7150 err = &smithy.DeserializationError{ 7151 Err: fmt.Errorf("failed to decode response body, %w", err), 7152 Snapshot: snapshot.Bytes(), 7153 } 7154 return out, metadata, err 7155 } 7156 7157 err = awsRestjson1_deserializeOpDocumentListRobotApplicationsOutput(&output, shape) 7158 if err != nil { 7159 var snapshot bytes.Buffer 7160 io.Copy(&snapshot, ringBuffer) 7161 return out, metadata, &smithy.DeserializationError{ 7162 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7163 Snapshot: snapshot.Bytes(), 7164 } 7165 } 7166 7167 return out, metadata, err 7168} 7169 7170func awsRestjson1_deserializeOpErrorListRobotApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7171 var errorBuffer bytes.Buffer 7172 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7173 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7174 } 7175 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7176 7177 errorCode := "UnknownError" 7178 errorMessage := errorCode 7179 7180 code := response.Header.Get("X-Amzn-ErrorType") 7181 if len(code) != 0 { 7182 errorCode = restjson.SanitizeErrorCode(code) 7183 } 7184 7185 var buff [1024]byte 7186 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7187 7188 body := io.TeeReader(errorBody, ringBuffer) 7189 decoder := json.NewDecoder(body) 7190 decoder.UseNumber() 7191 code, message, err := restjson.GetErrorInfo(decoder) 7192 if err != nil { 7193 var snapshot bytes.Buffer 7194 io.Copy(&snapshot, ringBuffer) 7195 err = &smithy.DeserializationError{ 7196 Err: fmt.Errorf("failed to decode response body, %w", err), 7197 Snapshot: snapshot.Bytes(), 7198 } 7199 return err 7200 } 7201 7202 errorBody.Seek(0, io.SeekStart) 7203 if len(code) != 0 { 7204 errorCode = restjson.SanitizeErrorCode(code) 7205 } 7206 if len(message) != 0 { 7207 errorMessage = message 7208 } 7209 7210 switch { 7211 case strings.EqualFold("InternalServerException", errorCode): 7212 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7213 7214 case strings.EqualFold("InvalidParameterException", errorCode): 7215 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7216 7217 case strings.EqualFold("ThrottlingException", errorCode): 7218 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7219 7220 default: 7221 genericError := &smithy.GenericAPIError{ 7222 Code: errorCode, 7223 Message: errorMessage, 7224 } 7225 return genericError 7226 7227 } 7228} 7229 7230func awsRestjson1_deserializeOpDocumentListRobotApplicationsOutput(v **ListRobotApplicationsOutput, value interface{}) error { 7231 if v == nil { 7232 return fmt.Errorf("unexpected nil of type %T", v) 7233 } 7234 if value == nil { 7235 return nil 7236 } 7237 7238 shape, ok := value.(map[string]interface{}) 7239 if !ok { 7240 return fmt.Errorf("unexpected JSON type %v", value) 7241 } 7242 7243 var sv *ListRobotApplicationsOutput 7244 if *v == nil { 7245 sv = &ListRobotApplicationsOutput{} 7246 } else { 7247 sv = *v 7248 } 7249 7250 for key, value := range shape { 7251 switch key { 7252 case "nextToken": 7253 if value != nil { 7254 jtv, ok := value.(string) 7255 if !ok { 7256 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 7257 } 7258 sv.NextToken = ptr.String(jtv) 7259 } 7260 7261 case "robotApplicationSummaries": 7262 if err := awsRestjson1_deserializeDocumentRobotApplicationSummaries(&sv.RobotApplicationSummaries, value); err != nil { 7263 return err 7264 } 7265 7266 default: 7267 _, _ = key, value 7268 7269 } 7270 } 7271 *v = sv 7272 return nil 7273} 7274 7275type awsRestjson1_deserializeOpListRobots struct { 7276} 7277 7278func (*awsRestjson1_deserializeOpListRobots) ID() string { 7279 return "OperationDeserializer" 7280} 7281 7282func (m *awsRestjson1_deserializeOpListRobots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7283 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7284) { 7285 out, metadata, err = next.HandleDeserialize(ctx, in) 7286 if err != nil { 7287 return out, metadata, err 7288 } 7289 7290 response, ok := out.RawResponse.(*smithyhttp.Response) 7291 if !ok { 7292 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7293 } 7294 7295 if response.StatusCode < 200 || response.StatusCode >= 300 { 7296 return out, metadata, awsRestjson1_deserializeOpErrorListRobots(response, &metadata) 7297 } 7298 output := &ListRobotsOutput{} 7299 out.Result = output 7300 7301 var buff [1024]byte 7302 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7303 7304 body := io.TeeReader(response.Body, ringBuffer) 7305 7306 decoder := json.NewDecoder(body) 7307 decoder.UseNumber() 7308 var shape interface{} 7309 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7310 var snapshot bytes.Buffer 7311 io.Copy(&snapshot, ringBuffer) 7312 err = &smithy.DeserializationError{ 7313 Err: fmt.Errorf("failed to decode response body, %w", err), 7314 Snapshot: snapshot.Bytes(), 7315 } 7316 return out, metadata, err 7317 } 7318 7319 err = awsRestjson1_deserializeOpDocumentListRobotsOutput(&output, shape) 7320 if err != nil { 7321 var snapshot bytes.Buffer 7322 io.Copy(&snapshot, ringBuffer) 7323 return out, metadata, &smithy.DeserializationError{ 7324 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7325 Snapshot: snapshot.Bytes(), 7326 } 7327 } 7328 7329 return out, metadata, err 7330} 7331 7332func awsRestjson1_deserializeOpErrorListRobots(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7333 var errorBuffer bytes.Buffer 7334 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7335 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7336 } 7337 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7338 7339 errorCode := "UnknownError" 7340 errorMessage := errorCode 7341 7342 code := response.Header.Get("X-Amzn-ErrorType") 7343 if len(code) != 0 { 7344 errorCode = restjson.SanitizeErrorCode(code) 7345 } 7346 7347 var buff [1024]byte 7348 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7349 7350 body := io.TeeReader(errorBody, ringBuffer) 7351 decoder := json.NewDecoder(body) 7352 decoder.UseNumber() 7353 code, message, err := restjson.GetErrorInfo(decoder) 7354 if err != nil { 7355 var snapshot bytes.Buffer 7356 io.Copy(&snapshot, ringBuffer) 7357 err = &smithy.DeserializationError{ 7358 Err: fmt.Errorf("failed to decode response body, %w", err), 7359 Snapshot: snapshot.Bytes(), 7360 } 7361 return err 7362 } 7363 7364 errorBody.Seek(0, io.SeekStart) 7365 if len(code) != 0 { 7366 errorCode = restjson.SanitizeErrorCode(code) 7367 } 7368 if len(message) != 0 { 7369 errorMessage = message 7370 } 7371 7372 switch { 7373 case strings.EqualFold("InternalServerException", errorCode): 7374 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7375 7376 case strings.EqualFold("InvalidParameterException", errorCode): 7377 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7378 7379 case strings.EqualFold("ResourceNotFoundException", errorCode): 7380 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7381 7382 case strings.EqualFold("ThrottlingException", errorCode): 7383 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7384 7385 default: 7386 genericError := &smithy.GenericAPIError{ 7387 Code: errorCode, 7388 Message: errorMessage, 7389 } 7390 return genericError 7391 7392 } 7393} 7394 7395func awsRestjson1_deserializeOpDocumentListRobotsOutput(v **ListRobotsOutput, value interface{}) error { 7396 if v == nil { 7397 return fmt.Errorf("unexpected nil of type %T", v) 7398 } 7399 if value == nil { 7400 return nil 7401 } 7402 7403 shape, ok := value.(map[string]interface{}) 7404 if !ok { 7405 return fmt.Errorf("unexpected JSON type %v", value) 7406 } 7407 7408 var sv *ListRobotsOutput 7409 if *v == nil { 7410 sv = &ListRobotsOutput{} 7411 } else { 7412 sv = *v 7413 } 7414 7415 for key, value := range shape { 7416 switch key { 7417 case "nextToken": 7418 if value != nil { 7419 jtv, ok := value.(string) 7420 if !ok { 7421 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 7422 } 7423 sv.NextToken = ptr.String(jtv) 7424 } 7425 7426 case "robots": 7427 if err := awsRestjson1_deserializeDocumentRobots(&sv.Robots, value); err != nil { 7428 return err 7429 } 7430 7431 default: 7432 _, _ = key, value 7433 7434 } 7435 } 7436 *v = sv 7437 return nil 7438} 7439 7440type awsRestjson1_deserializeOpListSimulationApplications struct { 7441} 7442 7443func (*awsRestjson1_deserializeOpListSimulationApplications) ID() string { 7444 return "OperationDeserializer" 7445} 7446 7447func (m *awsRestjson1_deserializeOpListSimulationApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7448 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7449) { 7450 out, metadata, err = next.HandleDeserialize(ctx, in) 7451 if err != nil { 7452 return out, metadata, err 7453 } 7454 7455 response, ok := out.RawResponse.(*smithyhttp.Response) 7456 if !ok { 7457 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7458 } 7459 7460 if response.StatusCode < 200 || response.StatusCode >= 300 { 7461 return out, metadata, awsRestjson1_deserializeOpErrorListSimulationApplications(response, &metadata) 7462 } 7463 output := &ListSimulationApplicationsOutput{} 7464 out.Result = output 7465 7466 var buff [1024]byte 7467 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7468 7469 body := io.TeeReader(response.Body, ringBuffer) 7470 7471 decoder := json.NewDecoder(body) 7472 decoder.UseNumber() 7473 var shape interface{} 7474 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7475 var snapshot bytes.Buffer 7476 io.Copy(&snapshot, ringBuffer) 7477 err = &smithy.DeserializationError{ 7478 Err: fmt.Errorf("failed to decode response body, %w", err), 7479 Snapshot: snapshot.Bytes(), 7480 } 7481 return out, metadata, err 7482 } 7483 7484 err = awsRestjson1_deserializeOpDocumentListSimulationApplicationsOutput(&output, shape) 7485 if err != nil { 7486 var snapshot bytes.Buffer 7487 io.Copy(&snapshot, ringBuffer) 7488 return out, metadata, &smithy.DeserializationError{ 7489 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7490 Snapshot: snapshot.Bytes(), 7491 } 7492 } 7493 7494 return out, metadata, err 7495} 7496 7497func awsRestjson1_deserializeOpErrorListSimulationApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7498 var errorBuffer bytes.Buffer 7499 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7500 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7501 } 7502 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7503 7504 errorCode := "UnknownError" 7505 errorMessage := errorCode 7506 7507 code := response.Header.Get("X-Amzn-ErrorType") 7508 if len(code) != 0 { 7509 errorCode = restjson.SanitizeErrorCode(code) 7510 } 7511 7512 var buff [1024]byte 7513 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7514 7515 body := io.TeeReader(errorBody, ringBuffer) 7516 decoder := json.NewDecoder(body) 7517 decoder.UseNumber() 7518 code, message, err := restjson.GetErrorInfo(decoder) 7519 if err != nil { 7520 var snapshot bytes.Buffer 7521 io.Copy(&snapshot, ringBuffer) 7522 err = &smithy.DeserializationError{ 7523 Err: fmt.Errorf("failed to decode response body, %w", err), 7524 Snapshot: snapshot.Bytes(), 7525 } 7526 return err 7527 } 7528 7529 errorBody.Seek(0, io.SeekStart) 7530 if len(code) != 0 { 7531 errorCode = restjson.SanitizeErrorCode(code) 7532 } 7533 if len(message) != 0 { 7534 errorMessage = message 7535 } 7536 7537 switch { 7538 case strings.EqualFold("InternalServerException", errorCode): 7539 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7540 7541 case strings.EqualFold("InvalidParameterException", errorCode): 7542 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7543 7544 case strings.EqualFold("ThrottlingException", errorCode): 7545 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7546 7547 default: 7548 genericError := &smithy.GenericAPIError{ 7549 Code: errorCode, 7550 Message: errorMessage, 7551 } 7552 return genericError 7553 7554 } 7555} 7556 7557func awsRestjson1_deserializeOpDocumentListSimulationApplicationsOutput(v **ListSimulationApplicationsOutput, value interface{}) error { 7558 if v == nil { 7559 return fmt.Errorf("unexpected nil of type %T", v) 7560 } 7561 if value == nil { 7562 return nil 7563 } 7564 7565 shape, ok := value.(map[string]interface{}) 7566 if !ok { 7567 return fmt.Errorf("unexpected JSON type %v", value) 7568 } 7569 7570 var sv *ListSimulationApplicationsOutput 7571 if *v == nil { 7572 sv = &ListSimulationApplicationsOutput{} 7573 } else { 7574 sv = *v 7575 } 7576 7577 for key, value := range shape { 7578 switch key { 7579 case "nextToken": 7580 if value != nil { 7581 jtv, ok := value.(string) 7582 if !ok { 7583 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 7584 } 7585 sv.NextToken = ptr.String(jtv) 7586 } 7587 7588 case "simulationApplicationSummaries": 7589 if err := awsRestjson1_deserializeDocumentSimulationApplicationSummaries(&sv.SimulationApplicationSummaries, value); err != nil { 7590 return err 7591 } 7592 7593 default: 7594 _, _ = key, value 7595 7596 } 7597 } 7598 *v = sv 7599 return nil 7600} 7601 7602type awsRestjson1_deserializeOpListSimulationJobBatches struct { 7603} 7604 7605func (*awsRestjson1_deserializeOpListSimulationJobBatches) ID() string { 7606 return "OperationDeserializer" 7607} 7608 7609func (m *awsRestjson1_deserializeOpListSimulationJobBatches) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7610 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7611) { 7612 out, metadata, err = next.HandleDeserialize(ctx, in) 7613 if err != nil { 7614 return out, metadata, err 7615 } 7616 7617 response, ok := out.RawResponse.(*smithyhttp.Response) 7618 if !ok { 7619 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7620 } 7621 7622 if response.StatusCode < 200 || response.StatusCode >= 300 { 7623 return out, metadata, awsRestjson1_deserializeOpErrorListSimulationJobBatches(response, &metadata) 7624 } 7625 output := &ListSimulationJobBatchesOutput{} 7626 out.Result = output 7627 7628 var buff [1024]byte 7629 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7630 7631 body := io.TeeReader(response.Body, ringBuffer) 7632 7633 decoder := json.NewDecoder(body) 7634 decoder.UseNumber() 7635 var shape interface{} 7636 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7637 var snapshot bytes.Buffer 7638 io.Copy(&snapshot, ringBuffer) 7639 err = &smithy.DeserializationError{ 7640 Err: fmt.Errorf("failed to decode response body, %w", err), 7641 Snapshot: snapshot.Bytes(), 7642 } 7643 return out, metadata, err 7644 } 7645 7646 err = awsRestjson1_deserializeOpDocumentListSimulationJobBatchesOutput(&output, shape) 7647 if err != nil { 7648 var snapshot bytes.Buffer 7649 io.Copy(&snapshot, ringBuffer) 7650 return out, metadata, &smithy.DeserializationError{ 7651 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7652 Snapshot: snapshot.Bytes(), 7653 } 7654 } 7655 7656 return out, metadata, err 7657} 7658 7659func awsRestjson1_deserializeOpErrorListSimulationJobBatches(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7660 var errorBuffer bytes.Buffer 7661 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7662 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7663 } 7664 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7665 7666 errorCode := "UnknownError" 7667 errorMessage := errorCode 7668 7669 code := response.Header.Get("X-Amzn-ErrorType") 7670 if len(code) != 0 { 7671 errorCode = restjson.SanitizeErrorCode(code) 7672 } 7673 7674 var buff [1024]byte 7675 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7676 7677 body := io.TeeReader(errorBody, ringBuffer) 7678 decoder := json.NewDecoder(body) 7679 decoder.UseNumber() 7680 code, message, err := restjson.GetErrorInfo(decoder) 7681 if err != nil { 7682 var snapshot bytes.Buffer 7683 io.Copy(&snapshot, ringBuffer) 7684 err = &smithy.DeserializationError{ 7685 Err: fmt.Errorf("failed to decode response body, %w", err), 7686 Snapshot: snapshot.Bytes(), 7687 } 7688 return err 7689 } 7690 7691 errorBody.Seek(0, io.SeekStart) 7692 if len(code) != 0 { 7693 errorCode = restjson.SanitizeErrorCode(code) 7694 } 7695 if len(message) != 0 { 7696 errorMessage = message 7697 } 7698 7699 switch { 7700 case strings.EqualFold("InternalServerException", errorCode): 7701 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7702 7703 case strings.EqualFold("InvalidParameterException", errorCode): 7704 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7705 7706 default: 7707 genericError := &smithy.GenericAPIError{ 7708 Code: errorCode, 7709 Message: errorMessage, 7710 } 7711 return genericError 7712 7713 } 7714} 7715 7716func awsRestjson1_deserializeOpDocumentListSimulationJobBatchesOutput(v **ListSimulationJobBatchesOutput, value interface{}) error { 7717 if v == nil { 7718 return fmt.Errorf("unexpected nil of type %T", v) 7719 } 7720 if value == nil { 7721 return nil 7722 } 7723 7724 shape, ok := value.(map[string]interface{}) 7725 if !ok { 7726 return fmt.Errorf("unexpected JSON type %v", value) 7727 } 7728 7729 var sv *ListSimulationJobBatchesOutput 7730 if *v == nil { 7731 sv = &ListSimulationJobBatchesOutput{} 7732 } else { 7733 sv = *v 7734 } 7735 7736 for key, value := range shape { 7737 switch key { 7738 case "nextToken": 7739 if value != nil { 7740 jtv, ok := value.(string) 7741 if !ok { 7742 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 7743 } 7744 sv.NextToken = ptr.String(jtv) 7745 } 7746 7747 case "simulationJobBatchSummaries": 7748 if err := awsRestjson1_deserializeDocumentSimulationJobBatchSummaries(&sv.SimulationJobBatchSummaries, value); err != nil { 7749 return err 7750 } 7751 7752 default: 7753 _, _ = key, value 7754 7755 } 7756 } 7757 *v = sv 7758 return nil 7759} 7760 7761type awsRestjson1_deserializeOpListSimulationJobs struct { 7762} 7763 7764func (*awsRestjson1_deserializeOpListSimulationJobs) ID() string { 7765 return "OperationDeserializer" 7766} 7767 7768func (m *awsRestjson1_deserializeOpListSimulationJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7769 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7770) { 7771 out, metadata, err = next.HandleDeserialize(ctx, in) 7772 if err != nil { 7773 return out, metadata, err 7774 } 7775 7776 response, ok := out.RawResponse.(*smithyhttp.Response) 7777 if !ok { 7778 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7779 } 7780 7781 if response.StatusCode < 200 || response.StatusCode >= 300 { 7782 return out, metadata, awsRestjson1_deserializeOpErrorListSimulationJobs(response, &metadata) 7783 } 7784 output := &ListSimulationJobsOutput{} 7785 out.Result = output 7786 7787 var buff [1024]byte 7788 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7789 7790 body := io.TeeReader(response.Body, ringBuffer) 7791 7792 decoder := json.NewDecoder(body) 7793 decoder.UseNumber() 7794 var shape interface{} 7795 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7796 var snapshot bytes.Buffer 7797 io.Copy(&snapshot, ringBuffer) 7798 err = &smithy.DeserializationError{ 7799 Err: fmt.Errorf("failed to decode response body, %w", err), 7800 Snapshot: snapshot.Bytes(), 7801 } 7802 return out, metadata, err 7803 } 7804 7805 err = awsRestjson1_deserializeOpDocumentListSimulationJobsOutput(&output, shape) 7806 if err != nil { 7807 var snapshot bytes.Buffer 7808 io.Copy(&snapshot, ringBuffer) 7809 return out, metadata, &smithy.DeserializationError{ 7810 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7811 Snapshot: snapshot.Bytes(), 7812 } 7813 } 7814 7815 return out, metadata, err 7816} 7817 7818func awsRestjson1_deserializeOpErrorListSimulationJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7819 var errorBuffer bytes.Buffer 7820 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7821 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7822 } 7823 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7824 7825 errorCode := "UnknownError" 7826 errorMessage := errorCode 7827 7828 code := response.Header.Get("X-Amzn-ErrorType") 7829 if len(code) != 0 { 7830 errorCode = restjson.SanitizeErrorCode(code) 7831 } 7832 7833 var buff [1024]byte 7834 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7835 7836 body := io.TeeReader(errorBody, ringBuffer) 7837 decoder := json.NewDecoder(body) 7838 decoder.UseNumber() 7839 code, message, err := restjson.GetErrorInfo(decoder) 7840 if err != nil { 7841 var snapshot bytes.Buffer 7842 io.Copy(&snapshot, ringBuffer) 7843 err = &smithy.DeserializationError{ 7844 Err: fmt.Errorf("failed to decode response body, %w", err), 7845 Snapshot: snapshot.Bytes(), 7846 } 7847 return err 7848 } 7849 7850 errorBody.Seek(0, io.SeekStart) 7851 if len(code) != 0 { 7852 errorCode = restjson.SanitizeErrorCode(code) 7853 } 7854 if len(message) != 0 { 7855 errorMessage = message 7856 } 7857 7858 switch { 7859 case strings.EqualFold("InternalServerException", errorCode): 7860 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7861 7862 case strings.EqualFold("InvalidParameterException", errorCode): 7863 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7864 7865 case strings.EqualFold("ThrottlingException", errorCode): 7866 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7867 7868 default: 7869 genericError := &smithy.GenericAPIError{ 7870 Code: errorCode, 7871 Message: errorMessage, 7872 } 7873 return genericError 7874 7875 } 7876} 7877 7878func awsRestjson1_deserializeOpDocumentListSimulationJobsOutput(v **ListSimulationJobsOutput, value interface{}) error { 7879 if v == nil { 7880 return fmt.Errorf("unexpected nil of type %T", v) 7881 } 7882 if value == nil { 7883 return nil 7884 } 7885 7886 shape, ok := value.(map[string]interface{}) 7887 if !ok { 7888 return fmt.Errorf("unexpected JSON type %v", value) 7889 } 7890 7891 var sv *ListSimulationJobsOutput 7892 if *v == nil { 7893 sv = &ListSimulationJobsOutput{} 7894 } else { 7895 sv = *v 7896 } 7897 7898 for key, value := range shape { 7899 switch key { 7900 case "nextToken": 7901 if value != nil { 7902 jtv, ok := value.(string) 7903 if !ok { 7904 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 7905 } 7906 sv.NextToken = ptr.String(jtv) 7907 } 7908 7909 case "simulationJobSummaries": 7910 if err := awsRestjson1_deserializeDocumentSimulationJobSummaries(&sv.SimulationJobSummaries, value); err != nil { 7911 return err 7912 } 7913 7914 default: 7915 _, _ = key, value 7916 7917 } 7918 } 7919 *v = sv 7920 return nil 7921} 7922 7923type awsRestjson1_deserializeOpListTagsForResource struct { 7924} 7925 7926func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 7927 return "OperationDeserializer" 7928} 7929 7930func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7931 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7932) { 7933 out, metadata, err = next.HandleDeserialize(ctx, in) 7934 if err != nil { 7935 return out, metadata, err 7936 } 7937 7938 response, ok := out.RawResponse.(*smithyhttp.Response) 7939 if !ok { 7940 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7941 } 7942 7943 if response.StatusCode < 200 || response.StatusCode >= 300 { 7944 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 7945 } 7946 output := &ListTagsForResourceOutput{} 7947 out.Result = output 7948 7949 var buff [1024]byte 7950 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7951 7952 body := io.TeeReader(response.Body, ringBuffer) 7953 7954 decoder := json.NewDecoder(body) 7955 decoder.UseNumber() 7956 var shape interface{} 7957 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7958 var snapshot bytes.Buffer 7959 io.Copy(&snapshot, ringBuffer) 7960 err = &smithy.DeserializationError{ 7961 Err: fmt.Errorf("failed to decode response body, %w", err), 7962 Snapshot: snapshot.Bytes(), 7963 } 7964 return out, metadata, err 7965 } 7966 7967 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 7968 if err != nil { 7969 var snapshot bytes.Buffer 7970 io.Copy(&snapshot, ringBuffer) 7971 return out, metadata, &smithy.DeserializationError{ 7972 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7973 Snapshot: snapshot.Bytes(), 7974 } 7975 } 7976 7977 return out, metadata, err 7978} 7979 7980func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7981 var errorBuffer bytes.Buffer 7982 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7983 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7984 } 7985 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7986 7987 errorCode := "UnknownError" 7988 errorMessage := errorCode 7989 7990 code := response.Header.Get("X-Amzn-ErrorType") 7991 if len(code) != 0 { 7992 errorCode = restjson.SanitizeErrorCode(code) 7993 } 7994 7995 var buff [1024]byte 7996 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7997 7998 body := io.TeeReader(errorBody, ringBuffer) 7999 decoder := json.NewDecoder(body) 8000 decoder.UseNumber() 8001 code, message, err := restjson.GetErrorInfo(decoder) 8002 if err != nil { 8003 var snapshot bytes.Buffer 8004 io.Copy(&snapshot, ringBuffer) 8005 err = &smithy.DeserializationError{ 8006 Err: fmt.Errorf("failed to decode response body, %w", err), 8007 Snapshot: snapshot.Bytes(), 8008 } 8009 return err 8010 } 8011 8012 errorBody.Seek(0, io.SeekStart) 8013 if len(code) != 0 { 8014 errorCode = restjson.SanitizeErrorCode(code) 8015 } 8016 if len(message) != 0 { 8017 errorMessage = message 8018 } 8019 8020 switch { 8021 case strings.EqualFold("InternalServerException", errorCode): 8022 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8023 8024 case strings.EqualFold("InvalidParameterException", errorCode): 8025 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8026 8027 case strings.EqualFold("ResourceNotFoundException", errorCode): 8028 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8029 8030 case strings.EqualFold("ThrottlingException", errorCode): 8031 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8032 8033 default: 8034 genericError := &smithy.GenericAPIError{ 8035 Code: errorCode, 8036 Message: errorMessage, 8037 } 8038 return genericError 8039 8040 } 8041} 8042 8043func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 8044 if v == nil { 8045 return fmt.Errorf("unexpected nil of type %T", v) 8046 } 8047 if value == nil { 8048 return nil 8049 } 8050 8051 shape, ok := value.(map[string]interface{}) 8052 if !ok { 8053 return fmt.Errorf("unexpected JSON type %v", value) 8054 } 8055 8056 var sv *ListTagsForResourceOutput 8057 if *v == nil { 8058 sv = &ListTagsForResourceOutput{} 8059 } else { 8060 sv = *v 8061 } 8062 8063 for key, value := range shape { 8064 switch key { 8065 case "tags": 8066 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 8067 return err 8068 } 8069 8070 default: 8071 _, _ = key, value 8072 8073 } 8074 } 8075 *v = sv 8076 return nil 8077} 8078 8079type awsRestjson1_deserializeOpListWorldExportJobs struct { 8080} 8081 8082func (*awsRestjson1_deserializeOpListWorldExportJobs) ID() string { 8083 return "OperationDeserializer" 8084} 8085 8086func (m *awsRestjson1_deserializeOpListWorldExportJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8087 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8088) { 8089 out, metadata, err = next.HandleDeserialize(ctx, in) 8090 if err != nil { 8091 return out, metadata, err 8092 } 8093 8094 response, ok := out.RawResponse.(*smithyhttp.Response) 8095 if !ok { 8096 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8097 } 8098 8099 if response.StatusCode < 200 || response.StatusCode >= 300 { 8100 return out, metadata, awsRestjson1_deserializeOpErrorListWorldExportJobs(response, &metadata) 8101 } 8102 output := &ListWorldExportJobsOutput{} 8103 out.Result = output 8104 8105 var buff [1024]byte 8106 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8107 8108 body := io.TeeReader(response.Body, ringBuffer) 8109 8110 decoder := json.NewDecoder(body) 8111 decoder.UseNumber() 8112 var shape interface{} 8113 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8114 var snapshot bytes.Buffer 8115 io.Copy(&snapshot, ringBuffer) 8116 err = &smithy.DeserializationError{ 8117 Err: fmt.Errorf("failed to decode response body, %w", err), 8118 Snapshot: snapshot.Bytes(), 8119 } 8120 return out, metadata, err 8121 } 8122 8123 err = awsRestjson1_deserializeOpDocumentListWorldExportJobsOutput(&output, shape) 8124 if err != nil { 8125 var snapshot bytes.Buffer 8126 io.Copy(&snapshot, ringBuffer) 8127 return out, metadata, &smithy.DeserializationError{ 8128 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8129 Snapshot: snapshot.Bytes(), 8130 } 8131 } 8132 8133 return out, metadata, err 8134} 8135 8136func awsRestjson1_deserializeOpErrorListWorldExportJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8137 var errorBuffer bytes.Buffer 8138 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8139 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8140 } 8141 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8142 8143 errorCode := "UnknownError" 8144 errorMessage := errorCode 8145 8146 code := response.Header.Get("X-Amzn-ErrorType") 8147 if len(code) != 0 { 8148 errorCode = restjson.SanitizeErrorCode(code) 8149 } 8150 8151 var buff [1024]byte 8152 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8153 8154 body := io.TeeReader(errorBody, ringBuffer) 8155 decoder := json.NewDecoder(body) 8156 decoder.UseNumber() 8157 code, message, err := restjson.GetErrorInfo(decoder) 8158 if err != nil { 8159 var snapshot bytes.Buffer 8160 io.Copy(&snapshot, ringBuffer) 8161 err = &smithy.DeserializationError{ 8162 Err: fmt.Errorf("failed to decode response body, %w", err), 8163 Snapshot: snapshot.Bytes(), 8164 } 8165 return err 8166 } 8167 8168 errorBody.Seek(0, io.SeekStart) 8169 if len(code) != 0 { 8170 errorCode = restjson.SanitizeErrorCode(code) 8171 } 8172 if len(message) != 0 { 8173 errorMessage = message 8174 } 8175 8176 switch { 8177 case strings.EqualFold("InternalServerException", errorCode): 8178 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8179 8180 case strings.EqualFold("InvalidParameterException", errorCode): 8181 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8182 8183 case strings.EqualFold("ThrottlingException", errorCode): 8184 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8185 8186 default: 8187 genericError := &smithy.GenericAPIError{ 8188 Code: errorCode, 8189 Message: errorMessage, 8190 } 8191 return genericError 8192 8193 } 8194} 8195 8196func awsRestjson1_deserializeOpDocumentListWorldExportJobsOutput(v **ListWorldExportJobsOutput, value interface{}) error { 8197 if v == nil { 8198 return fmt.Errorf("unexpected nil of type %T", v) 8199 } 8200 if value == nil { 8201 return nil 8202 } 8203 8204 shape, ok := value.(map[string]interface{}) 8205 if !ok { 8206 return fmt.Errorf("unexpected JSON type %v", value) 8207 } 8208 8209 var sv *ListWorldExportJobsOutput 8210 if *v == nil { 8211 sv = &ListWorldExportJobsOutput{} 8212 } else { 8213 sv = *v 8214 } 8215 8216 for key, value := range shape { 8217 switch key { 8218 case "nextToken": 8219 if value != nil { 8220 jtv, ok := value.(string) 8221 if !ok { 8222 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 8223 } 8224 sv.NextToken = ptr.String(jtv) 8225 } 8226 8227 case "worldExportJobSummaries": 8228 if err := awsRestjson1_deserializeDocumentWorldExportJobSummaries(&sv.WorldExportJobSummaries, value); err != nil { 8229 return err 8230 } 8231 8232 default: 8233 _, _ = key, value 8234 8235 } 8236 } 8237 *v = sv 8238 return nil 8239} 8240 8241type awsRestjson1_deserializeOpListWorldGenerationJobs struct { 8242} 8243 8244func (*awsRestjson1_deserializeOpListWorldGenerationJobs) ID() string { 8245 return "OperationDeserializer" 8246} 8247 8248func (m *awsRestjson1_deserializeOpListWorldGenerationJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8249 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8250) { 8251 out, metadata, err = next.HandleDeserialize(ctx, in) 8252 if err != nil { 8253 return out, metadata, err 8254 } 8255 8256 response, ok := out.RawResponse.(*smithyhttp.Response) 8257 if !ok { 8258 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8259 } 8260 8261 if response.StatusCode < 200 || response.StatusCode >= 300 { 8262 return out, metadata, awsRestjson1_deserializeOpErrorListWorldGenerationJobs(response, &metadata) 8263 } 8264 output := &ListWorldGenerationJobsOutput{} 8265 out.Result = output 8266 8267 var buff [1024]byte 8268 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8269 8270 body := io.TeeReader(response.Body, ringBuffer) 8271 8272 decoder := json.NewDecoder(body) 8273 decoder.UseNumber() 8274 var shape interface{} 8275 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8276 var snapshot bytes.Buffer 8277 io.Copy(&snapshot, ringBuffer) 8278 err = &smithy.DeserializationError{ 8279 Err: fmt.Errorf("failed to decode response body, %w", err), 8280 Snapshot: snapshot.Bytes(), 8281 } 8282 return out, metadata, err 8283 } 8284 8285 err = awsRestjson1_deserializeOpDocumentListWorldGenerationJobsOutput(&output, shape) 8286 if err != nil { 8287 var snapshot bytes.Buffer 8288 io.Copy(&snapshot, ringBuffer) 8289 return out, metadata, &smithy.DeserializationError{ 8290 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8291 Snapshot: snapshot.Bytes(), 8292 } 8293 } 8294 8295 return out, metadata, err 8296} 8297 8298func awsRestjson1_deserializeOpErrorListWorldGenerationJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8299 var errorBuffer bytes.Buffer 8300 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8301 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8302 } 8303 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8304 8305 errorCode := "UnknownError" 8306 errorMessage := errorCode 8307 8308 code := response.Header.Get("X-Amzn-ErrorType") 8309 if len(code) != 0 { 8310 errorCode = restjson.SanitizeErrorCode(code) 8311 } 8312 8313 var buff [1024]byte 8314 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8315 8316 body := io.TeeReader(errorBody, ringBuffer) 8317 decoder := json.NewDecoder(body) 8318 decoder.UseNumber() 8319 code, message, err := restjson.GetErrorInfo(decoder) 8320 if err != nil { 8321 var snapshot bytes.Buffer 8322 io.Copy(&snapshot, ringBuffer) 8323 err = &smithy.DeserializationError{ 8324 Err: fmt.Errorf("failed to decode response body, %w", err), 8325 Snapshot: snapshot.Bytes(), 8326 } 8327 return err 8328 } 8329 8330 errorBody.Seek(0, io.SeekStart) 8331 if len(code) != 0 { 8332 errorCode = restjson.SanitizeErrorCode(code) 8333 } 8334 if len(message) != 0 { 8335 errorMessage = message 8336 } 8337 8338 switch { 8339 case strings.EqualFold("InternalServerException", errorCode): 8340 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8341 8342 case strings.EqualFold("InvalidParameterException", errorCode): 8343 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8344 8345 case strings.EqualFold("ThrottlingException", errorCode): 8346 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8347 8348 default: 8349 genericError := &smithy.GenericAPIError{ 8350 Code: errorCode, 8351 Message: errorMessage, 8352 } 8353 return genericError 8354 8355 } 8356} 8357 8358func awsRestjson1_deserializeOpDocumentListWorldGenerationJobsOutput(v **ListWorldGenerationJobsOutput, value interface{}) error { 8359 if v == nil { 8360 return fmt.Errorf("unexpected nil of type %T", v) 8361 } 8362 if value == nil { 8363 return nil 8364 } 8365 8366 shape, ok := value.(map[string]interface{}) 8367 if !ok { 8368 return fmt.Errorf("unexpected JSON type %v", value) 8369 } 8370 8371 var sv *ListWorldGenerationJobsOutput 8372 if *v == nil { 8373 sv = &ListWorldGenerationJobsOutput{} 8374 } else { 8375 sv = *v 8376 } 8377 8378 for key, value := range shape { 8379 switch key { 8380 case "nextToken": 8381 if value != nil { 8382 jtv, ok := value.(string) 8383 if !ok { 8384 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 8385 } 8386 sv.NextToken = ptr.String(jtv) 8387 } 8388 8389 case "worldGenerationJobSummaries": 8390 if err := awsRestjson1_deserializeDocumentWorldGenerationJobSummaries(&sv.WorldGenerationJobSummaries, value); err != nil { 8391 return err 8392 } 8393 8394 default: 8395 _, _ = key, value 8396 8397 } 8398 } 8399 *v = sv 8400 return nil 8401} 8402 8403type awsRestjson1_deserializeOpListWorlds struct { 8404} 8405 8406func (*awsRestjson1_deserializeOpListWorlds) ID() string { 8407 return "OperationDeserializer" 8408} 8409 8410func (m *awsRestjson1_deserializeOpListWorlds) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8411 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8412) { 8413 out, metadata, err = next.HandleDeserialize(ctx, in) 8414 if err != nil { 8415 return out, metadata, err 8416 } 8417 8418 response, ok := out.RawResponse.(*smithyhttp.Response) 8419 if !ok { 8420 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8421 } 8422 8423 if response.StatusCode < 200 || response.StatusCode >= 300 { 8424 return out, metadata, awsRestjson1_deserializeOpErrorListWorlds(response, &metadata) 8425 } 8426 output := &ListWorldsOutput{} 8427 out.Result = output 8428 8429 var buff [1024]byte 8430 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8431 8432 body := io.TeeReader(response.Body, ringBuffer) 8433 8434 decoder := json.NewDecoder(body) 8435 decoder.UseNumber() 8436 var shape interface{} 8437 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8438 var snapshot bytes.Buffer 8439 io.Copy(&snapshot, ringBuffer) 8440 err = &smithy.DeserializationError{ 8441 Err: fmt.Errorf("failed to decode response body, %w", err), 8442 Snapshot: snapshot.Bytes(), 8443 } 8444 return out, metadata, err 8445 } 8446 8447 err = awsRestjson1_deserializeOpDocumentListWorldsOutput(&output, shape) 8448 if err != nil { 8449 var snapshot bytes.Buffer 8450 io.Copy(&snapshot, ringBuffer) 8451 return out, metadata, &smithy.DeserializationError{ 8452 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8453 Snapshot: snapshot.Bytes(), 8454 } 8455 } 8456 8457 return out, metadata, err 8458} 8459 8460func awsRestjson1_deserializeOpErrorListWorlds(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8461 var errorBuffer bytes.Buffer 8462 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8463 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8464 } 8465 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8466 8467 errorCode := "UnknownError" 8468 errorMessage := errorCode 8469 8470 code := response.Header.Get("X-Amzn-ErrorType") 8471 if len(code) != 0 { 8472 errorCode = restjson.SanitizeErrorCode(code) 8473 } 8474 8475 var buff [1024]byte 8476 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8477 8478 body := io.TeeReader(errorBody, ringBuffer) 8479 decoder := json.NewDecoder(body) 8480 decoder.UseNumber() 8481 code, message, err := restjson.GetErrorInfo(decoder) 8482 if err != nil { 8483 var snapshot bytes.Buffer 8484 io.Copy(&snapshot, ringBuffer) 8485 err = &smithy.DeserializationError{ 8486 Err: fmt.Errorf("failed to decode response body, %w", err), 8487 Snapshot: snapshot.Bytes(), 8488 } 8489 return err 8490 } 8491 8492 errorBody.Seek(0, io.SeekStart) 8493 if len(code) != 0 { 8494 errorCode = restjson.SanitizeErrorCode(code) 8495 } 8496 if len(message) != 0 { 8497 errorMessage = message 8498 } 8499 8500 switch { 8501 case strings.EqualFold("InternalServerException", errorCode): 8502 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8503 8504 case strings.EqualFold("InvalidParameterException", errorCode): 8505 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8506 8507 case strings.EqualFold("ThrottlingException", errorCode): 8508 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8509 8510 default: 8511 genericError := &smithy.GenericAPIError{ 8512 Code: errorCode, 8513 Message: errorMessage, 8514 } 8515 return genericError 8516 8517 } 8518} 8519 8520func awsRestjson1_deserializeOpDocumentListWorldsOutput(v **ListWorldsOutput, value interface{}) error { 8521 if v == nil { 8522 return fmt.Errorf("unexpected nil of type %T", v) 8523 } 8524 if value == nil { 8525 return nil 8526 } 8527 8528 shape, ok := value.(map[string]interface{}) 8529 if !ok { 8530 return fmt.Errorf("unexpected JSON type %v", value) 8531 } 8532 8533 var sv *ListWorldsOutput 8534 if *v == nil { 8535 sv = &ListWorldsOutput{} 8536 } else { 8537 sv = *v 8538 } 8539 8540 for key, value := range shape { 8541 switch key { 8542 case "nextToken": 8543 if value != nil { 8544 jtv, ok := value.(string) 8545 if !ok { 8546 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 8547 } 8548 sv.NextToken = ptr.String(jtv) 8549 } 8550 8551 case "worldSummaries": 8552 if err := awsRestjson1_deserializeDocumentWorldSummaries(&sv.WorldSummaries, value); err != nil { 8553 return err 8554 } 8555 8556 default: 8557 _, _ = key, value 8558 8559 } 8560 } 8561 *v = sv 8562 return nil 8563} 8564 8565type awsRestjson1_deserializeOpListWorldTemplates struct { 8566} 8567 8568func (*awsRestjson1_deserializeOpListWorldTemplates) ID() string { 8569 return "OperationDeserializer" 8570} 8571 8572func (m *awsRestjson1_deserializeOpListWorldTemplates) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8573 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8574) { 8575 out, metadata, err = next.HandleDeserialize(ctx, in) 8576 if err != nil { 8577 return out, metadata, err 8578 } 8579 8580 response, ok := out.RawResponse.(*smithyhttp.Response) 8581 if !ok { 8582 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8583 } 8584 8585 if response.StatusCode < 200 || response.StatusCode >= 300 { 8586 return out, metadata, awsRestjson1_deserializeOpErrorListWorldTemplates(response, &metadata) 8587 } 8588 output := &ListWorldTemplatesOutput{} 8589 out.Result = output 8590 8591 var buff [1024]byte 8592 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8593 8594 body := io.TeeReader(response.Body, ringBuffer) 8595 8596 decoder := json.NewDecoder(body) 8597 decoder.UseNumber() 8598 var shape interface{} 8599 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8600 var snapshot bytes.Buffer 8601 io.Copy(&snapshot, ringBuffer) 8602 err = &smithy.DeserializationError{ 8603 Err: fmt.Errorf("failed to decode response body, %w", err), 8604 Snapshot: snapshot.Bytes(), 8605 } 8606 return out, metadata, err 8607 } 8608 8609 err = awsRestjson1_deserializeOpDocumentListWorldTemplatesOutput(&output, shape) 8610 if err != nil { 8611 var snapshot bytes.Buffer 8612 io.Copy(&snapshot, ringBuffer) 8613 return out, metadata, &smithy.DeserializationError{ 8614 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8615 Snapshot: snapshot.Bytes(), 8616 } 8617 } 8618 8619 return out, metadata, err 8620} 8621 8622func awsRestjson1_deserializeOpErrorListWorldTemplates(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8623 var errorBuffer bytes.Buffer 8624 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8625 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8626 } 8627 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8628 8629 errorCode := "UnknownError" 8630 errorMessage := errorCode 8631 8632 code := response.Header.Get("X-Amzn-ErrorType") 8633 if len(code) != 0 { 8634 errorCode = restjson.SanitizeErrorCode(code) 8635 } 8636 8637 var buff [1024]byte 8638 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8639 8640 body := io.TeeReader(errorBody, ringBuffer) 8641 decoder := json.NewDecoder(body) 8642 decoder.UseNumber() 8643 code, message, err := restjson.GetErrorInfo(decoder) 8644 if err != nil { 8645 var snapshot bytes.Buffer 8646 io.Copy(&snapshot, ringBuffer) 8647 err = &smithy.DeserializationError{ 8648 Err: fmt.Errorf("failed to decode response body, %w", err), 8649 Snapshot: snapshot.Bytes(), 8650 } 8651 return err 8652 } 8653 8654 errorBody.Seek(0, io.SeekStart) 8655 if len(code) != 0 { 8656 errorCode = restjson.SanitizeErrorCode(code) 8657 } 8658 if len(message) != 0 { 8659 errorMessage = message 8660 } 8661 8662 switch { 8663 case strings.EqualFold("InternalServerException", errorCode): 8664 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8665 8666 case strings.EqualFold("InvalidParameterException", errorCode): 8667 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8668 8669 case strings.EqualFold("ThrottlingException", errorCode): 8670 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8671 8672 default: 8673 genericError := &smithy.GenericAPIError{ 8674 Code: errorCode, 8675 Message: errorMessage, 8676 } 8677 return genericError 8678 8679 } 8680} 8681 8682func awsRestjson1_deserializeOpDocumentListWorldTemplatesOutput(v **ListWorldTemplatesOutput, value interface{}) error { 8683 if v == nil { 8684 return fmt.Errorf("unexpected nil of type %T", v) 8685 } 8686 if value == nil { 8687 return nil 8688 } 8689 8690 shape, ok := value.(map[string]interface{}) 8691 if !ok { 8692 return fmt.Errorf("unexpected JSON type %v", value) 8693 } 8694 8695 var sv *ListWorldTemplatesOutput 8696 if *v == nil { 8697 sv = &ListWorldTemplatesOutput{} 8698 } else { 8699 sv = *v 8700 } 8701 8702 for key, value := range shape { 8703 switch key { 8704 case "nextToken": 8705 if value != nil { 8706 jtv, ok := value.(string) 8707 if !ok { 8708 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 8709 } 8710 sv.NextToken = ptr.String(jtv) 8711 } 8712 8713 case "templateSummaries": 8714 if err := awsRestjson1_deserializeDocumentTemplateSummaries(&sv.TemplateSummaries, value); err != nil { 8715 return err 8716 } 8717 8718 default: 8719 _, _ = key, value 8720 8721 } 8722 } 8723 *v = sv 8724 return nil 8725} 8726 8727type awsRestjson1_deserializeOpRegisterRobot struct { 8728} 8729 8730func (*awsRestjson1_deserializeOpRegisterRobot) ID() string { 8731 return "OperationDeserializer" 8732} 8733 8734func (m *awsRestjson1_deserializeOpRegisterRobot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8735 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8736) { 8737 out, metadata, err = next.HandleDeserialize(ctx, in) 8738 if err != nil { 8739 return out, metadata, err 8740 } 8741 8742 response, ok := out.RawResponse.(*smithyhttp.Response) 8743 if !ok { 8744 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8745 } 8746 8747 if response.StatusCode < 200 || response.StatusCode >= 300 { 8748 return out, metadata, awsRestjson1_deserializeOpErrorRegisterRobot(response, &metadata) 8749 } 8750 output := &RegisterRobotOutput{} 8751 out.Result = output 8752 8753 var buff [1024]byte 8754 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8755 8756 body := io.TeeReader(response.Body, ringBuffer) 8757 8758 decoder := json.NewDecoder(body) 8759 decoder.UseNumber() 8760 var shape interface{} 8761 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8762 var snapshot bytes.Buffer 8763 io.Copy(&snapshot, ringBuffer) 8764 err = &smithy.DeserializationError{ 8765 Err: fmt.Errorf("failed to decode response body, %w", err), 8766 Snapshot: snapshot.Bytes(), 8767 } 8768 return out, metadata, err 8769 } 8770 8771 err = awsRestjson1_deserializeOpDocumentRegisterRobotOutput(&output, shape) 8772 if err != nil { 8773 var snapshot bytes.Buffer 8774 io.Copy(&snapshot, ringBuffer) 8775 return out, metadata, &smithy.DeserializationError{ 8776 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8777 Snapshot: snapshot.Bytes(), 8778 } 8779 } 8780 8781 return out, metadata, err 8782} 8783 8784func awsRestjson1_deserializeOpErrorRegisterRobot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8785 var errorBuffer bytes.Buffer 8786 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8787 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8788 } 8789 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8790 8791 errorCode := "UnknownError" 8792 errorMessage := errorCode 8793 8794 code := response.Header.Get("X-Amzn-ErrorType") 8795 if len(code) != 0 { 8796 errorCode = restjson.SanitizeErrorCode(code) 8797 } 8798 8799 var buff [1024]byte 8800 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8801 8802 body := io.TeeReader(errorBody, ringBuffer) 8803 decoder := json.NewDecoder(body) 8804 decoder.UseNumber() 8805 code, message, err := restjson.GetErrorInfo(decoder) 8806 if err != nil { 8807 var snapshot bytes.Buffer 8808 io.Copy(&snapshot, ringBuffer) 8809 err = &smithy.DeserializationError{ 8810 Err: fmt.Errorf("failed to decode response body, %w", err), 8811 Snapshot: snapshot.Bytes(), 8812 } 8813 return err 8814 } 8815 8816 errorBody.Seek(0, io.SeekStart) 8817 if len(code) != 0 { 8818 errorCode = restjson.SanitizeErrorCode(code) 8819 } 8820 if len(message) != 0 { 8821 errorMessage = message 8822 } 8823 8824 switch { 8825 case strings.EqualFold("InternalServerException", errorCode): 8826 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8827 8828 case strings.EqualFold("InvalidParameterException", errorCode): 8829 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8830 8831 case strings.EqualFold("LimitExceededException", errorCode): 8832 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 8833 8834 case strings.EqualFold("ResourceNotFoundException", errorCode): 8835 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8836 8837 case strings.EqualFold("ThrottlingException", errorCode): 8838 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8839 8840 default: 8841 genericError := &smithy.GenericAPIError{ 8842 Code: errorCode, 8843 Message: errorMessage, 8844 } 8845 return genericError 8846 8847 } 8848} 8849 8850func awsRestjson1_deserializeOpDocumentRegisterRobotOutput(v **RegisterRobotOutput, value interface{}) error { 8851 if v == nil { 8852 return fmt.Errorf("unexpected nil of type %T", v) 8853 } 8854 if value == nil { 8855 return nil 8856 } 8857 8858 shape, ok := value.(map[string]interface{}) 8859 if !ok { 8860 return fmt.Errorf("unexpected JSON type %v", value) 8861 } 8862 8863 var sv *RegisterRobotOutput 8864 if *v == nil { 8865 sv = &RegisterRobotOutput{} 8866 } else { 8867 sv = *v 8868 } 8869 8870 for key, value := range shape { 8871 switch key { 8872 case "fleet": 8873 if value != nil { 8874 jtv, ok := value.(string) 8875 if !ok { 8876 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 8877 } 8878 sv.Fleet = ptr.String(jtv) 8879 } 8880 8881 case "robot": 8882 if value != nil { 8883 jtv, ok := value.(string) 8884 if !ok { 8885 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 8886 } 8887 sv.Robot = ptr.String(jtv) 8888 } 8889 8890 default: 8891 _, _ = key, value 8892 8893 } 8894 } 8895 *v = sv 8896 return nil 8897} 8898 8899type awsRestjson1_deserializeOpRestartSimulationJob struct { 8900} 8901 8902func (*awsRestjson1_deserializeOpRestartSimulationJob) ID() string { 8903 return "OperationDeserializer" 8904} 8905 8906func (m *awsRestjson1_deserializeOpRestartSimulationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8907 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8908) { 8909 out, metadata, err = next.HandleDeserialize(ctx, in) 8910 if err != nil { 8911 return out, metadata, err 8912 } 8913 8914 response, ok := out.RawResponse.(*smithyhttp.Response) 8915 if !ok { 8916 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8917 } 8918 8919 if response.StatusCode < 200 || response.StatusCode >= 300 { 8920 return out, metadata, awsRestjson1_deserializeOpErrorRestartSimulationJob(response, &metadata) 8921 } 8922 output := &RestartSimulationJobOutput{} 8923 out.Result = output 8924 8925 return out, metadata, err 8926} 8927 8928func awsRestjson1_deserializeOpErrorRestartSimulationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8929 var errorBuffer bytes.Buffer 8930 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8931 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8932 } 8933 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8934 8935 errorCode := "UnknownError" 8936 errorMessage := errorCode 8937 8938 code := response.Header.Get("X-Amzn-ErrorType") 8939 if len(code) != 0 { 8940 errorCode = restjson.SanitizeErrorCode(code) 8941 } 8942 8943 var buff [1024]byte 8944 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8945 8946 body := io.TeeReader(errorBody, ringBuffer) 8947 decoder := json.NewDecoder(body) 8948 decoder.UseNumber() 8949 code, message, err := restjson.GetErrorInfo(decoder) 8950 if err != nil { 8951 var snapshot bytes.Buffer 8952 io.Copy(&snapshot, ringBuffer) 8953 err = &smithy.DeserializationError{ 8954 Err: fmt.Errorf("failed to decode response body, %w", err), 8955 Snapshot: snapshot.Bytes(), 8956 } 8957 return err 8958 } 8959 8960 errorBody.Seek(0, io.SeekStart) 8961 if len(code) != 0 { 8962 errorCode = restjson.SanitizeErrorCode(code) 8963 } 8964 if len(message) != 0 { 8965 errorMessage = message 8966 } 8967 8968 switch { 8969 case strings.EqualFold("InternalServerException", errorCode): 8970 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8971 8972 case strings.EqualFold("InvalidParameterException", errorCode): 8973 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8974 8975 case strings.EqualFold("LimitExceededException", errorCode): 8976 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 8977 8978 case strings.EqualFold("ResourceNotFoundException", errorCode): 8979 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8980 8981 case strings.EqualFold("ThrottlingException", errorCode): 8982 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8983 8984 default: 8985 genericError := &smithy.GenericAPIError{ 8986 Code: errorCode, 8987 Message: errorMessage, 8988 } 8989 return genericError 8990 8991 } 8992} 8993 8994type awsRestjson1_deserializeOpStartSimulationJobBatch struct { 8995} 8996 8997func (*awsRestjson1_deserializeOpStartSimulationJobBatch) ID() string { 8998 return "OperationDeserializer" 8999} 9000 9001func (m *awsRestjson1_deserializeOpStartSimulationJobBatch) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9002 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9003) { 9004 out, metadata, err = next.HandleDeserialize(ctx, in) 9005 if err != nil { 9006 return out, metadata, err 9007 } 9008 9009 response, ok := out.RawResponse.(*smithyhttp.Response) 9010 if !ok { 9011 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9012 } 9013 9014 if response.StatusCode < 200 || response.StatusCode >= 300 { 9015 return out, metadata, awsRestjson1_deserializeOpErrorStartSimulationJobBatch(response, &metadata) 9016 } 9017 output := &StartSimulationJobBatchOutput{} 9018 out.Result = output 9019 9020 var buff [1024]byte 9021 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9022 9023 body := io.TeeReader(response.Body, ringBuffer) 9024 9025 decoder := json.NewDecoder(body) 9026 decoder.UseNumber() 9027 var shape interface{} 9028 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9029 var snapshot bytes.Buffer 9030 io.Copy(&snapshot, ringBuffer) 9031 err = &smithy.DeserializationError{ 9032 Err: fmt.Errorf("failed to decode response body, %w", err), 9033 Snapshot: snapshot.Bytes(), 9034 } 9035 return out, metadata, err 9036 } 9037 9038 err = awsRestjson1_deserializeOpDocumentStartSimulationJobBatchOutput(&output, shape) 9039 if err != nil { 9040 var snapshot bytes.Buffer 9041 io.Copy(&snapshot, ringBuffer) 9042 return out, metadata, &smithy.DeserializationError{ 9043 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9044 Snapshot: snapshot.Bytes(), 9045 } 9046 } 9047 9048 return out, metadata, err 9049} 9050 9051func awsRestjson1_deserializeOpErrorStartSimulationJobBatch(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9052 var errorBuffer bytes.Buffer 9053 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9054 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9055 } 9056 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9057 9058 errorCode := "UnknownError" 9059 errorMessage := errorCode 9060 9061 code := response.Header.Get("X-Amzn-ErrorType") 9062 if len(code) != 0 { 9063 errorCode = restjson.SanitizeErrorCode(code) 9064 } 9065 9066 var buff [1024]byte 9067 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9068 9069 body := io.TeeReader(errorBody, ringBuffer) 9070 decoder := json.NewDecoder(body) 9071 decoder.UseNumber() 9072 code, message, err := restjson.GetErrorInfo(decoder) 9073 if err != nil { 9074 var snapshot bytes.Buffer 9075 io.Copy(&snapshot, ringBuffer) 9076 err = &smithy.DeserializationError{ 9077 Err: fmt.Errorf("failed to decode response body, %w", err), 9078 Snapshot: snapshot.Bytes(), 9079 } 9080 return err 9081 } 9082 9083 errorBody.Seek(0, io.SeekStart) 9084 if len(code) != 0 { 9085 errorCode = restjson.SanitizeErrorCode(code) 9086 } 9087 if len(message) != 0 { 9088 errorMessage = message 9089 } 9090 9091 switch { 9092 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 9093 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 9094 9095 case strings.EqualFold("InternalServerException", errorCode): 9096 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9097 9098 case strings.EqualFold("InvalidParameterException", errorCode): 9099 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9100 9101 case strings.EqualFold("LimitExceededException", errorCode): 9102 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 9103 9104 case strings.EqualFold("ThrottlingException", errorCode): 9105 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9106 9107 default: 9108 genericError := &smithy.GenericAPIError{ 9109 Code: errorCode, 9110 Message: errorMessage, 9111 } 9112 return genericError 9113 9114 } 9115} 9116 9117func awsRestjson1_deserializeOpDocumentStartSimulationJobBatchOutput(v **StartSimulationJobBatchOutput, value interface{}) error { 9118 if v == nil { 9119 return fmt.Errorf("unexpected nil of type %T", v) 9120 } 9121 if value == nil { 9122 return nil 9123 } 9124 9125 shape, ok := value.(map[string]interface{}) 9126 if !ok { 9127 return fmt.Errorf("unexpected JSON type %v", value) 9128 } 9129 9130 var sv *StartSimulationJobBatchOutput 9131 if *v == nil { 9132 sv = &StartSimulationJobBatchOutput{} 9133 } else { 9134 sv = *v 9135 } 9136 9137 for key, value := range shape { 9138 switch key { 9139 case "arn": 9140 if value != nil { 9141 jtv, ok := value.(string) 9142 if !ok { 9143 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 9144 } 9145 sv.Arn = ptr.String(jtv) 9146 } 9147 9148 case "batchPolicy": 9149 if err := awsRestjson1_deserializeDocumentBatchPolicy(&sv.BatchPolicy, value); err != nil { 9150 return err 9151 } 9152 9153 case "clientRequestToken": 9154 if value != nil { 9155 jtv, ok := value.(string) 9156 if !ok { 9157 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 9158 } 9159 sv.ClientRequestToken = ptr.String(jtv) 9160 } 9161 9162 case "createdAt": 9163 if value != nil { 9164 switch jtv := value.(type) { 9165 case json.Number: 9166 f64, err := jtv.Float64() 9167 if err != nil { 9168 return err 9169 } 9170 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9171 9172 default: 9173 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 9174 9175 } 9176 } 9177 9178 case "createdRequests": 9179 if err := awsRestjson1_deserializeDocumentSimulationJobSummaries(&sv.CreatedRequests, value); err != nil { 9180 return err 9181 } 9182 9183 case "failedRequests": 9184 if err := awsRestjson1_deserializeDocumentFailedCreateSimulationJobRequests(&sv.FailedRequests, value); err != nil { 9185 return err 9186 } 9187 9188 case "failureCode": 9189 if value != nil { 9190 jtv, ok := value.(string) 9191 if !ok { 9192 return fmt.Errorf("expected SimulationJobBatchErrorCode to be of type string, got %T instead", value) 9193 } 9194 sv.FailureCode = types.SimulationJobBatchErrorCode(jtv) 9195 } 9196 9197 case "failureReason": 9198 if value != nil { 9199 jtv, ok := value.(string) 9200 if !ok { 9201 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 9202 } 9203 sv.FailureReason = ptr.String(jtv) 9204 } 9205 9206 case "pendingRequests": 9207 if err := awsRestjson1_deserializeDocumentCreateSimulationJobRequests(&sv.PendingRequests, value); err != nil { 9208 return err 9209 } 9210 9211 case "status": 9212 if value != nil { 9213 jtv, ok := value.(string) 9214 if !ok { 9215 return fmt.Errorf("expected SimulationJobBatchStatus to be of type string, got %T instead", value) 9216 } 9217 sv.Status = types.SimulationJobBatchStatus(jtv) 9218 } 9219 9220 case "tags": 9221 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 9222 return err 9223 } 9224 9225 default: 9226 _, _ = key, value 9227 9228 } 9229 } 9230 *v = sv 9231 return nil 9232} 9233 9234type awsRestjson1_deserializeOpSyncDeploymentJob struct { 9235} 9236 9237func (*awsRestjson1_deserializeOpSyncDeploymentJob) ID() string { 9238 return "OperationDeserializer" 9239} 9240 9241func (m *awsRestjson1_deserializeOpSyncDeploymentJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9242 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9243) { 9244 out, metadata, err = next.HandleDeserialize(ctx, in) 9245 if err != nil { 9246 return out, metadata, err 9247 } 9248 9249 response, ok := out.RawResponse.(*smithyhttp.Response) 9250 if !ok { 9251 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9252 } 9253 9254 if response.StatusCode < 200 || response.StatusCode >= 300 { 9255 return out, metadata, awsRestjson1_deserializeOpErrorSyncDeploymentJob(response, &metadata) 9256 } 9257 output := &SyncDeploymentJobOutput{} 9258 out.Result = output 9259 9260 var buff [1024]byte 9261 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9262 9263 body := io.TeeReader(response.Body, ringBuffer) 9264 9265 decoder := json.NewDecoder(body) 9266 decoder.UseNumber() 9267 var shape interface{} 9268 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9269 var snapshot bytes.Buffer 9270 io.Copy(&snapshot, ringBuffer) 9271 err = &smithy.DeserializationError{ 9272 Err: fmt.Errorf("failed to decode response body, %w", err), 9273 Snapshot: snapshot.Bytes(), 9274 } 9275 return out, metadata, err 9276 } 9277 9278 err = awsRestjson1_deserializeOpDocumentSyncDeploymentJobOutput(&output, shape) 9279 if err != nil { 9280 var snapshot bytes.Buffer 9281 io.Copy(&snapshot, ringBuffer) 9282 return out, metadata, &smithy.DeserializationError{ 9283 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9284 Snapshot: snapshot.Bytes(), 9285 } 9286 } 9287 9288 return out, metadata, err 9289} 9290 9291func awsRestjson1_deserializeOpErrorSyncDeploymentJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9292 var errorBuffer bytes.Buffer 9293 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9294 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9295 } 9296 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9297 9298 errorCode := "UnknownError" 9299 errorMessage := errorCode 9300 9301 code := response.Header.Get("X-Amzn-ErrorType") 9302 if len(code) != 0 { 9303 errorCode = restjson.SanitizeErrorCode(code) 9304 } 9305 9306 var buff [1024]byte 9307 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9308 9309 body := io.TeeReader(errorBody, ringBuffer) 9310 decoder := json.NewDecoder(body) 9311 decoder.UseNumber() 9312 code, message, err := restjson.GetErrorInfo(decoder) 9313 if err != nil { 9314 var snapshot bytes.Buffer 9315 io.Copy(&snapshot, ringBuffer) 9316 err = &smithy.DeserializationError{ 9317 Err: fmt.Errorf("failed to decode response body, %w", err), 9318 Snapshot: snapshot.Bytes(), 9319 } 9320 return err 9321 } 9322 9323 errorBody.Seek(0, io.SeekStart) 9324 if len(code) != 0 { 9325 errorCode = restjson.SanitizeErrorCode(code) 9326 } 9327 if len(message) != 0 { 9328 errorMessage = message 9329 } 9330 9331 switch { 9332 case strings.EqualFold("ConcurrentDeploymentException", errorCode): 9333 return awsRestjson1_deserializeErrorConcurrentDeploymentException(response, errorBody) 9334 9335 case strings.EqualFold("IdempotentParameterMismatchException", errorCode): 9336 return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody) 9337 9338 case strings.EqualFold("InternalServerException", errorCode): 9339 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9340 9341 case strings.EqualFold("InvalidParameterException", errorCode): 9342 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9343 9344 case strings.EqualFold("LimitExceededException", errorCode): 9345 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 9346 9347 case strings.EqualFold("ResourceNotFoundException", errorCode): 9348 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9349 9350 case strings.EqualFold("ThrottlingException", errorCode): 9351 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9352 9353 default: 9354 genericError := &smithy.GenericAPIError{ 9355 Code: errorCode, 9356 Message: errorMessage, 9357 } 9358 return genericError 9359 9360 } 9361} 9362 9363func awsRestjson1_deserializeOpDocumentSyncDeploymentJobOutput(v **SyncDeploymentJobOutput, value interface{}) error { 9364 if v == nil { 9365 return fmt.Errorf("unexpected nil of type %T", v) 9366 } 9367 if value == nil { 9368 return nil 9369 } 9370 9371 shape, ok := value.(map[string]interface{}) 9372 if !ok { 9373 return fmt.Errorf("unexpected JSON type %v", value) 9374 } 9375 9376 var sv *SyncDeploymentJobOutput 9377 if *v == nil { 9378 sv = &SyncDeploymentJobOutput{} 9379 } else { 9380 sv = *v 9381 } 9382 9383 for key, value := range shape { 9384 switch key { 9385 case "arn": 9386 if value != nil { 9387 jtv, ok := value.(string) 9388 if !ok { 9389 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 9390 } 9391 sv.Arn = ptr.String(jtv) 9392 } 9393 9394 case "createdAt": 9395 if value != nil { 9396 switch jtv := value.(type) { 9397 case json.Number: 9398 f64, err := jtv.Float64() 9399 if err != nil { 9400 return err 9401 } 9402 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9403 9404 default: 9405 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 9406 9407 } 9408 } 9409 9410 case "deploymentApplicationConfigs": 9411 if err := awsRestjson1_deserializeDocumentDeploymentApplicationConfigs(&sv.DeploymentApplicationConfigs, value); err != nil { 9412 return err 9413 } 9414 9415 case "deploymentConfig": 9416 if err := awsRestjson1_deserializeDocumentDeploymentConfig(&sv.DeploymentConfig, value); err != nil { 9417 return err 9418 } 9419 9420 case "failureCode": 9421 if value != nil { 9422 jtv, ok := value.(string) 9423 if !ok { 9424 return fmt.Errorf("expected DeploymentJobErrorCode to be of type string, got %T instead", value) 9425 } 9426 sv.FailureCode = types.DeploymentJobErrorCode(jtv) 9427 } 9428 9429 case "failureReason": 9430 if value != nil { 9431 jtv, ok := value.(string) 9432 if !ok { 9433 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 9434 } 9435 sv.FailureReason = ptr.String(jtv) 9436 } 9437 9438 case "fleet": 9439 if value != nil { 9440 jtv, ok := value.(string) 9441 if !ok { 9442 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 9443 } 9444 sv.Fleet = ptr.String(jtv) 9445 } 9446 9447 case "status": 9448 if value != nil { 9449 jtv, ok := value.(string) 9450 if !ok { 9451 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 9452 } 9453 sv.Status = types.DeploymentStatus(jtv) 9454 } 9455 9456 default: 9457 _, _ = key, value 9458 9459 } 9460 } 9461 *v = sv 9462 return nil 9463} 9464 9465type awsRestjson1_deserializeOpTagResource struct { 9466} 9467 9468func (*awsRestjson1_deserializeOpTagResource) ID() string { 9469 return "OperationDeserializer" 9470} 9471 9472func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9473 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9474) { 9475 out, metadata, err = next.HandleDeserialize(ctx, in) 9476 if err != nil { 9477 return out, metadata, err 9478 } 9479 9480 response, ok := out.RawResponse.(*smithyhttp.Response) 9481 if !ok { 9482 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9483 } 9484 9485 if response.StatusCode < 200 || response.StatusCode >= 300 { 9486 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 9487 } 9488 output := &TagResourceOutput{} 9489 out.Result = output 9490 9491 return out, metadata, err 9492} 9493 9494func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9495 var errorBuffer bytes.Buffer 9496 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9497 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9498 } 9499 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9500 9501 errorCode := "UnknownError" 9502 errorMessage := errorCode 9503 9504 code := response.Header.Get("X-Amzn-ErrorType") 9505 if len(code) != 0 { 9506 errorCode = restjson.SanitizeErrorCode(code) 9507 } 9508 9509 var buff [1024]byte 9510 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9511 9512 body := io.TeeReader(errorBody, ringBuffer) 9513 decoder := json.NewDecoder(body) 9514 decoder.UseNumber() 9515 code, message, err := restjson.GetErrorInfo(decoder) 9516 if err != nil { 9517 var snapshot bytes.Buffer 9518 io.Copy(&snapshot, ringBuffer) 9519 err = &smithy.DeserializationError{ 9520 Err: fmt.Errorf("failed to decode response body, %w", err), 9521 Snapshot: snapshot.Bytes(), 9522 } 9523 return err 9524 } 9525 9526 errorBody.Seek(0, io.SeekStart) 9527 if len(code) != 0 { 9528 errorCode = restjson.SanitizeErrorCode(code) 9529 } 9530 if len(message) != 0 { 9531 errorMessage = message 9532 } 9533 9534 switch { 9535 case strings.EqualFold("InternalServerException", errorCode): 9536 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9537 9538 case strings.EqualFold("InvalidParameterException", errorCode): 9539 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9540 9541 case strings.EqualFold("ResourceNotFoundException", errorCode): 9542 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9543 9544 case strings.EqualFold("ThrottlingException", errorCode): 9545 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9546 9547 default: 9548 genericError := &smithy.GenericAPIError{ 9549 Code: errorCode, 9550 Message: errorMessage, 9551 } 9552 return genericError 9553 9554 } 9555} 9556 9557type awsRestjson1_deserializeOpUntagResource struct { 9558} 9559 9560func (*awsRestjson1_deserializeOpUntagResource) ID() string { 9561 return "OperationDeserializer" 9562} 9563 9564func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9565 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9566) { 9567 out, metadata, err = next.HandleDeserialize(ctx, in) 9568 if err != nil { 9569 return out, metadata, err 9570 } 9571 9572 response, ok := out.RawResponse.(*smithyhttp.Response) 9573 if !ok { 9574 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9575 } 9576 9577 if response.StatusCode < 200 || response.StatusCode >= 300 { 9578 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 9579 } 9580 output := &UntagResourceOutput{} 9581 out.Result = output 9582 9583 return out, metadata, err 9584} 9585 9586func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9587 var errorBuffer bytes.Buffer 9588 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9589 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9590 } 9591 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9592 9593 errorCode := "UnknownError" 9594 errorMessage := errorCode 9595 9596 code := response.Header.Get("X-Amzn-ErrorType") 9597 if len(code) != 0 { 9598 errorCode = restjson.SanitizeErrorCode(code) 9599 } 9600 9601 var buff [1024]byte 9602 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9603 9604 body := io.TeeReader(errorBody, ringBuffer) 9605 decoder := json.NewDecoder(body) 9606 decoder.UseNumber() 9607 code, message, err := restjson.GetErrorInfo(decoder) 9608 if err != nil { 9609 var snapshot bytes.Buffer 9610 io.Copy(&snapshot, ringBuffer) 9611 err = &smithy.DeserializationError{ 9612 Err: fmt.Errorf("failed to decode response body, %w", err), 9613 Snapshot: snapshot.Bytes(), 9614 } 9615 return err 9616 } 9617 9618 errorBody.Seek(0, io.SeekStart) 9619 if len(code) != 0 { 9620 errorCode = restjson.SanitizeErrorCode(code) 9621 } 9622 if len(message) != 0 { 9623 errorMessage = message 9624 } 9625 9626 switch { 9627 case strings.EqualFold("InternalServerException", errorCode): 9628 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9629 9630 case strings.EqualFold("InvalidParameterException", errorCode): 9631 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9632 9633 case strings.EqualFold("ResourceNotFoundException", errorCode): 9634 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9635 9636 case strings.EqualFold("ThrottlingException", errorCode): 9637 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9638 9639 default: 9640 genericError := &smithy.GenericAPIError{ 9641 Code: errorCode, 9642 Message: errorMessage, 9643 } 9644 return genericError 9645 9646 } 9647} 9648 9649type awsRestjson1_deserializeOpUpdateRobotApplication struct { 9650} 9651 9652func (*awsRestjson1_deserializeOpUpdateRobotApplication) ID() string { 9653 return "OperationDeserializer" 9654} 9655 9656func (m *awsRestjson1_deserializeOpUpdateRobotApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9657 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9658) { 9659 out, metadata, err = next.HandleDeserialize(ctx, in) 9660 if err != nil { 9661 return out, metadata, err 9662 } 9663 9664 response, ok := out.RawResponse.(*smithyhttp.Response) 9665 if !ok { 9666 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9667 } 9668 9669 if response.StatusCode < 200 || response.StatusCode >= 300 { 9670 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRobotApplication(response, &metadata) 9671 } 9672 output := &UpdateRobotApplicationOutput{} 9673 out.Result = output 9674 9675 var buff [1024]byte 9676 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9677 9678 body := io.TeeReader(response.Body, ringBuffer) 9679 9680 decoder := json.NewDecoder(body) 9681 decoder.UseNumber() 9682 var shape interface{} 9683 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9684 var snapshot bytes.Buffer 9685 io.Copy(&snapshot, ringBuffer) 9686 err = &smithy.DeserializationError{ 9687 Err: fmt.Errorf("failed to decode response body, %w", err), 9688 Snapshot: snapshot.Bytes(), 9689 } 9690 return out, metadata, err 9691 } 9692 9693 err = awsRestjson1_deserializeOpDocumentUpdateRobotApplicationOutput(&output, shape) 9694 if err != nil { 9695 var snapshot bytes.Buffer 9696 io.Copy(&snapshot, ringBuffer) 9697 return out, metadata, &smithy.DeserializationError{ 9698 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9699 Snapshot: snapshot.Bytes(), 9700 } 9701 } 9702 9703 return out, metadata, err 9704} 9705 9706func awsRestjson1_deserializeOpErrorUpdateRobotApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9707 var errorBuffer bytes.Buffer 9708 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9709 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9710 } 9711 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9712 9713 errorCode := "UnknownError" 9714 errorMessage := errorCode 9715 9716 code := response.Header.Get("X-Amzn-ErrorType") 9717 if len(code) != 0 { 9718 errorCode = restjson.SanitizeErrorCode(code) 9719 } 9720 9721 var buff [1024]byte 9722 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9723 9724 body := io.TeeReader(errorBody, ringBuffer) 9725 decoder := json.NewDecoder(body) 9726 decoder.UseNumber() 9727 code, message, err := restjson.GetErrorInfo(decoder) 9728 if err != nil { 9729 var snapshot bytes.Buffer 9730 io.Copy(&snapshot, ringBuffer) 9731 err = &smithy.DeserializationError{ 9732 Err: fmt.Errorf("failed to decode response body, %w", err), 9733 Snapshot: snapshot.Bytes(), 9734 } 9735 return err 9736 } 9737 9738 errorBody.Seek(0, io.SeekStart) 9739 if len(code) != 0 { 9740 errorCode = restjson.SanitizeErrorCode(code) 9741 } 9742 if len(message) != 0 { 9743 errorMessage = message 9744 } 9745 9746 switch { 9747 case strings.EqualFold("InternalServerException", errorCode): 9748 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9749 9750 case strings.EqualFold("InvalidParameterException", errorCode): 9751 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9752 9753 case strings.EqualFold("LimitExceededException", errorCode): 9754 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 9755 9756 case strings.EqualFold("ResourceNotFoundException", errorCode): 9757 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9758 9759 case strings.EqualFold("ThrottlingException", errorCode): 9760 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9761 9762 default: 9763 genericError := &smithy.GenericAPIError{ 9764 Code: errorCode, 9765 Message: errorMessage, 9766 } 9767 return genericError 9768 9769 } 9770} 9771 9772func awsRestjson1_deserializeOpDocumentUpdateRobotApplicationOutput(v **UpdateRobotApplicationOutput, value interface{}) error { 9773 if v == nil { 9774 return fmt.Errorf("unexpected nil of type %T", v) 9775 } 9776 if value == nil { 9777 return nil 9778 } 9779 9780 shape, ok := value.(map[string]interface{}) 9781 if !ok { 9782 return fmt.Errorf("unexpected JSON type %v", value) 9783 } 9784 9785 var sv *UpdateRobotApplicationOutput 9786 if *v == nil { 9787 sv = &UpdateRobotApplicationOutput{} 9788 } else { 9789 sv = *v 9790 } 9791 9792 for key, value := range shape { 9793 switch key { 9794 case "arn": 9795 if value != nil { 9796 jtv, ok := value.(string) 9797 if !ok { 9798 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 9799 } 9800 sv.Arn = ptr.String(jtv) 9801 } 9802 9803 case "environment": 9804 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 9805 return err 9806 } 9807 9808 case "lastUpdatedAt": 9809 if value != nil { 9810 switch jtv := value.(type) { 9811 case json.Number: 9812 f64, err := jtv.Float64() 9813 if err != nil { 9814 return err 9815 } 9816 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9817 9818 default: 9819 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 9820 9821 } 9822 } 9823 9824 case "name": 9825 if value != nil { 9826 jtv, ok := value.(string) 9827 if !ok { 9828 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 9829 } 9830 sv.Name = ptr.String(jtv) 9831 } 9832 9833 case "revisionId": 9834 if value != nil { 9835 jtv, ok := value.(string) 9836 if !ok { 9837 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 9838 } 9839 sv.RevisionId = ptr.String(jtv) 9840 } 9841 9842 case "robotSoftwareSuite": 9843 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 9844 return err 9845 } 9846 9847 case "sources": 9848 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 9849 return err 9850 } 9851 9852 case "version": 9853 if value != nil { 9854 jtv, ok := value.(string) 9855 if !ok { 9856 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 9857 } 9858 sv.Version = ptr.String(jtv) 9859 } 9860 9861 default: 9862 _, _ = key, value 9863 9864 } 9865 } 9866 *v = sv 9867 return nil 9868} 9869 9870type awsRestjson1_deserializeOpUpdateSimulationApplication struct { 9871} 9872 9873func (*awsRestjson1_deserializeOpUpdateSimulationApplication) ID() string { 9874 return "OperationDeserializer" 9875} 9876 9877func (m *awsRestjson1_deserializeOpUpdateSimulationApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9878 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9879) { 9880 out, metadata, err = next.HandleDeserialize(ctx, in) 9881 if err != nil { 9882 return out, metadata, err 9883 } 9884 9885 response, ok := out.RawResponse.(*smithyhttp.Response) 9886 if !ok { 9887 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9888 } 9889 9890 if response.StatusCode < 200 || response.StatusCode >= 300 { 9891 return out, metadata, awsRestjson1_deserializeOpErrorUpdateSimulationApplication(response, &metadata) 9892 } 9893 output := &UpdateSimulationApplicationOutput{} 9894 out.Result = output 9895 9896 var buff [1024]byte 9897 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9898 9899 body := io.TeeReader(response.Body, ringBuffer) 9900 9901 decoder := json.NewDecoder(body) 9902 decoder.UseNumber() 9903 var shape interface{} 9904 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9905 var snapshot bytes.Buffer 9906 io.Copy(&snapshot, ringBuffer) 9907 err = &smithy.DeserializationError{ 9908 Err: fmt.Errorf("failed to decode response body, %w", err), 9909 Snapshot: snapshot.Bytes(), 9910 } 9911 return out, metadata, err 9912 } 9913 9914 err = awsRestjson1_deserializeOpDocumentUpdateSimulationApplicationOutput(&output, shape) 9915 if err != nil { 9916 var snapshot bytes.Buffer 9917 io.Copy(&snapshot, ringBuffer) 9918 return out, metadata, &smithy.DeserializationError{ 9919 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9920 Snapshot: snapshot.Bytes(), 9921 } 9922 } 9923 9924 return out, metadata, err 9925} 9926 9927func awsRestjson1_deserializeOpErrorUpdateSimulationApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9928 var errorBuffer bytes.Buffer 9929 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9930 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9931 } 9932 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9933 9934 errorCode := "UnknownError" 9935 errorMessage := errorCode 9936 9937 code := response.Header.Get("X-Amzn-ErrorType") 9938 if len(code) != 0 { 9939 errorCode = restjson.SanitizeErrorCode(code) 9940 } 9941 9942 var buff [1024]byte 9943 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9944 9945 body := io.TeeReader(errorBody, ringBuffer) 9946 decoder := json.NewDecoder(body) 9947 decoder.UseNumber() 9948 code, message, err := restjson.GetErrorInfo(decoder) 9949 if err != nil { 9950 var snapshot bytes.Buffer 9951 io.Copy(&snapshot, ringBuffer) 9952 err = &smithy.DeserializationError{ 9953 Err: fmt.Errorf("failed to decode response body, %w", err), 9954 Snapshot: snapshot.Bytes(), 9955 } 9956 return err 9957 } 9958 9959 errorBody.Seek(0, io.SeekStart) 9960 if len(code) != 0 { 9961 errorCode = restjson.SanitizeErrorCode(code) 9962 } 9963 if len(message) != 0 { 9964 errorMessage = message 9965 } 9966 9967 switch { 9968 case strings.EqualFold("InternalServerException", errorCode): 9969 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9970 9971 case strings.EqualFold("InvalidParameterException", errorCode): 9972 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9973 9974 case strings.EqualFold("LimitExceededException", errorCode): 9975 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 9976 9977 case strings.EqualFold("ResourceNotFoundException", errorCode): 9978 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9979 9980 case strings.EqualFold("ThrottlingException", errorCode): 9981 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9982 9983 default: 9984 genericError := &smithy.GenericAPIError{ 9985 Code: errorCode, 9986 Message: errorMessage, 9987 } 9988 return genericError 9989 9990 } 9991} 9992 9993func awsRestjson1_deserializeOpDocumentUpdateSimulationApplicationOutput(v **UpdateSimulationApplicationOutput, value interface{}) error { 9994 if v == nil { 9995 return fmt.Errorf("unexpected nil of type %T", v) 9996 } 9997 if value == nil { 9998 return nil 9999 } 10000 10001 shape, ok := value.(map[string]interface{}) 10002 if !ok { 10003 return fmt.Errorf("unexpected JSON type %v", value) 10004 } 10005 10006 var sv *UpdateSimulationApplicationOutput 10007 if *v == nil { 10008 sv = &UpdateSimulationApplicationOutput{} 10009 } else { 10010 sv = *v 10011 } 10012 10013 for key, value := range shape { 10014 switch key { 10015 case "arn": 10016 if value != nil { 10017 jtv, ok := value.(string) 10018 if !ok { 10019 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 10020 } 10021 sv.Arn = ptr.String(jtv) 10022 } 10023 10024 case "environment": 10025 if err := awsRestjson1_deserializeDocumentEnvironment(&sv.Environment, value); err != nil { 10026 return err 10027 } 10028 10029 case "lastUpdatedAt": 10030 if value != nil { 10031 switch jtv := value.(type) { 10032 case json.Number: 10033 f64, err := jtv.Float64() 10034 if err != nil { 10035 return err 10036 } 10037 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10038 10039 default: 10040 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 10041 10042 } 10043 } 10044 10045 case "name": 10046 if value != nil { 10047 jtv, ok := value.(string) 10048 if !ok { 10049 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 10050 } 10051 sv.Name = ptr.String(jtv) 10052 } 10053 10054 case "renderingEngine": 10055 if err := awsRestjson1_deserializeDocumentRenderingEngine(&sv.RenderingEngine, value); err != nil { 10056 return err 10057 } 10058 10059 case "revisionId": 10060 if value != nil { 10061 jtv, ok := value.(string) 10062 if !ok { 10063 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 10064 } 10065 sv.RevisionId = ptr.String(jtv) 10066 } 10067 10068 case "robotSoftwareSuite": 10069 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 10070 return err 10071 } 10072 10073 case "simulationSoftwareSuite": 10074 if err := awsRestjson1_deserializeDocumentSimulationSoftwareSuite(&sv.SimulationSoftwareSuite, value); err != nil { 10075 return err 10076 } 10077 10078 case "sources": 10079 if err := awsRestjson1_deserializeDocumentSources(&sv.Sources, value); err != nil { 10080 return err 10081 } 10082 10083 case "version": 10084 if value != nil { 10085 jtv, ok := value.(string) 10086 if !ok { 10087 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 10088 } 10089 sv.Version = ptr.String(jtv) 10090 } 10091 10092 default: 10093 _, _ = key, value 10094 10095 } 10096 } 10097 *v = sv 10098 return nil 10099} 10100 10101type awsRestjson1_deserializeOpUpdateWorldTemplate struct { 10102} 10103 10104func (*awsRestjson1_deserializeOpUpdateWorldTemplate) ID() string { 10105 return "OperationDeserializer" 10106} 10107 10108func (m *awsRestjson1_deserializeOpUpdateWorldTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10109 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10110) { 10111 out, metadata, err = next.HandleDeserialize(ctx, in) 10112 if err != nil { 10113 return out, metadata, err 10114 } 10115 10116 response, ok := out.RawResponse.(*smithyhttp.Response) 10117 if !ok { 10118 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10119 } 10120 10121 if response.StatusCode < 200 || response.StatusCode >= 300 { 10122 return out, metadata, awsRestjson1_deserializeOpErrorUpdateWorldTemplate(response, &metadata) 10123 } 10124 output := &UpdateWorldTemplateOutput{} 10125 out.Result = output 10126 10127 var buff [1024]byte 10128 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10129 10130 body := io.TeeReader(response.Body, ringBuffer) 10131 10132 decoder := json.NewDecoder(body) 10133 decoder.UseNumber() 10134 var shape interface{} 10135 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10136 var snapshot bytes.Buffer 10137 io.Copy(&snapshot, ringBuffer) 10138 err = &smithy.DeserializationError{ 10139 Err: fmt.Errorf("failed to decode response body, %w", err), 10140 Snapshot: snapshot.Bytes(), 10141 } 10142 return out, metadata, err 10143 } 10144 10145 err = awsRestjson1_deserializeOpDocumentUpdateWorldTemplateOutput(&output, shape) 10146 if err != nil { 10147 var snapshot bytes.Buffer 10148 io.Copy(&snapshot, ringBuffer) 10149 return out, metadata, &smithy.DeserializationError{ 10150 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10151 Snapshot: snapshot.Bytes(), 10152 } 10153 } 10154 10155 return out, metadata, err 10156} 10157 10158func awsRestjson1_deserializeOpErrorUpdateWorldTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10159 var errorBuffer bytes.Buffer 10160 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10161 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10162 } 10163 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10164 10165 errorCode := "UnknownError" 10166 errorMessage := errorCode 10167 10168 code := response.Header.Get("X-Amzn-ErrorType") 10169 if len(code) != 0 { 10170 errorCode = restjson.SanitizeErrorCode(code) 10171 } 10172 10173 var buff [1024]byte 10174 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10175 10176 body := io.TeeReader(errorBody, ringBuffer) 10177 decoder := json.NewDecoder(body) 10178 decoder.UseNumber() 10179 code, message, err := restjson.GetErrorInfo(decoder) 10180 if err != nil { 10181 var snapshot bytes.Buffer 10182 io.Copy(&snapshot, ringBuffer) 10183 err = &smithy.DeserializationError{ 10184 Err: fmt.Errorf("failed to decode response body, %w", err), 10185 Snapshot: snapshot.Bytes(), 10186 } 10187 return err 10188 } 10189 10190 errorBody.Seek(0, io.SeekStart) 10191 if len(code) != 0 { 10192 errorCode = restjson.SanitizeErrorCode(code) 10193 } 10194 if len(message) != 0 { 10195 errorMessage = message 10196 } 10197 10198 switch { 10199 case strings.EqualFold("InternalServerException", errorCode): 10200 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 10201 10202 case strings.EqualFold("InvalidParameterException", errorCode): 10203 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 10204 10205 case strings.EqualFold("ResourceNotFoundException", errorCode): 10206 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10207 10208 case strings.EqualFold("ThrottlingException", errorCode): 10209 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 10210 10211 default: 10212 genericError := &smithy.GenericAPIError{ 10213 Code: errorCode, 10214 Message: errorMessage, 10215 } 10216 return genericError 10217 10218 } 10219} 10220 10221func awsRestjson1_deserializeOpDocumentUpdateWorldTemplateOutput(v **UpdateWorldTemplateOutput, value interface{}) error { 10222 if v == nil { 10223 return fmt.Errorf("unexpected nil of type %T", v) 10224 } 10225 if value == nil { 10226 return nil 10227 } 10228 10229 shape, ok := value.(map[string]interface{}) 10230 if !ok { 10231 return fmt.Errorf("unexpected JSON type %v", value) 10232 } 10233 10234 var sv *UpdateWorldTemplateOutput 10235 if *v == nil { 10236 sv = &UpdateWorldTemplateOutput{} 10237 } else { 10238 sv = *v 10239 } 10240 10241 for key, value := range shape { 10242 switch key { 10243 case "arn": 10244 if value != nil { 10245 jtv, ok := value.(string) 10246 if !ok { 10247 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 10248 } 10249 sv.Arn = ptr.String(jtv) 10250 } 10251 10252 case "createdAt": 10253 if value != nil { 10254 switch jtv := value.(type) { 10255 case json.Number: 10256 f64, err := jtv.Float64() 10257 if err != nil { 10258 return err 10259 } 10260 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10261 10262 default: 10263 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 10264 10265 } 10266 } 10267 10268 case "lastUpdatedAt": 10269 if value != nil { 10270 switch jtv := value.(type) { 10271 case json.Number: 10272 f64, err := jtv.Float64() 10273 if err != nil { 10274 return err 10275 } 10276 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10277 10278 default: 10279 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 10280 10281 } 10282 } 10283 10284 case "name": 10285 if value != nil { 10286 jtv, ok := value.(string) 10287 if !ok { 10288 return fmt.Errorf("expected TemplateName to be of type string, got %T instead", value) 10289 } 10290 sv.Name = ptr.String(jtv) 10291 } 10292 10293 default: 10294 _, _ = key, value 10295 10296 } 10297 } 10298 *v = sv 10299 return nil 10300} 10301 10302func awsRestjson1_deserializeErrorConcurrentDeploymentException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10303 output := &types.ConcurrentDeploymentException{} 10304 var buff [1024]byte 10305 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10306 10307 body := io.TeeReader(errorBody, ringBuffer) 10308 decoder := json.NewDecoder(body) 10309 decoder.UseNumber() 10310 var shape interface{} 10311 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10312 var snapshot bytes.Buffer 10313 io.Copy(&snapshot, ringBuffer) 10314 err = &smithy.DeserializationError{ 10315 Err: fmt.Errorf("failed to decode response body, %w", err), 10316 Snapshot: snapshot.Bytes(), 10317 } 10318 return err 10319 } 10320 10321 err := awsRestjson1_deserializeDocumentConcurrentDeploymentException(&output, shape) 10322 10323 if err != nil { 10324 var snapshot bytes.Buffer 10325 io.Copy(&snapshot, ringBuffer) 10326 err = &smithy.DeserializationError{ 10327 Err: fmt.Errorf("failed to decode response body, %w", err), 10328 Snapshot: snapshot.Bytes(), 10329 } 10330 return err 10331 } 10332 10333 errorBody.Seek(0, io.SeekStart) 10334 10335 return output 10336} 10337 10338func awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10339 output := &types.IdempotentParameterMismatchException{} 10340 var buff [1024]byte 10341 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10342 10343 body := io.TeeReader(errorBody, ringBuffer) 10344 decoder := json.NewDecoder(body) 10345 decoder.UseNumber() 10346 var shape interface{} 10347 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10348 var snapshot bytes.Buffer 10349 io.Copy(&snapshot, ringBuffer) 10350 err = &smithy.DeserializationError{ 10351 Err: fmt.Errorf("failed to decode response body, %w", err), 10352 Snapshot: snapshot.Bytes(), 10353 } 10354 return err 10355 } 10356 10357 err := awsRestjson1_deserializeDocumentIdempotentParameterMismatchException(&output, shape) 10358 10359 if err != nil { 10360 var snapshot bytes.Buffer 10361 io.Copy(&snapshot, ringBuffer) 10362 err = &smithy.DeserializationError{ 10363 Err: fmt.Errorf("failed to decode response body, %w", err), 10364 Snapshot: snapshot.Bytes(), 10365 } 10366 return err 10367 } 10368 10369 errorBody.Seek(0, io.SeekStart) 10370 10371 return output 10372} 10373 10374func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10375 output := &types.InternalServerException{} 10376 var buff [1024]byte 10377 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10378 10379 body := io.TeeReader(errorBody, ringBuffer) 10380 decoder := json.NewDecoder(body) 10381 decoder.UseNumber() 10382 var shape interface{} 10383 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10384 var snapshot bytes.Buffer 10385 io.Copy(&snapshot, ringBuffer) 10386 err = &smithy.DeserializationError{ 10387 Err: fmt.Errorf("failed to decode response body, %w", err), 10388 Snapshot: snapshot.Bytes(), 10389 } 10390 return err 10391 } 10392 10393 err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) 10394 10395 if err != nil { 10396 var snapshot bytes.Buffer 10397 io.Copy(&snapshot, ringBuffer) 10398 err = &smithy.DeserializationError{ 10399 Err: fmt.Errorf("failed to decode response body, %w", err), 10400 Snapshot: snapshot.Bytes(), 10401 } 10402 return err 10403 } 10404 10405 errorBody.Seek(0, io.SeekStart) 10406 10407 return output 10408} 10409 10410func awsRestjson1_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10411 output := &types.InvalidParameterException{} 10412 var buff [1024]byte 10413 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10414 10415 body := io.TeeReader(errorBody, ringBuffer) 10416 decoder := json.NewDecoder(body) 10417 decoder.UseNumber() 10418 var shape interface{} 10419 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10420 var snapshot bytes.Buffer 10421 io.Copy(&snapshot, ringBuffer) 10422 err = &smithy.DeserializationError{ 10423 Err: fmt.Errorf("failed to decode response body, %w", err), 10424 Snapshot: snapshot.Bytes(), 10425 } 10426 return err 10427 } 10428 10429 err := awsRestjson1_deserializeDocumentInvalidParameterException(&output, shape) 10430 10431 if err != nil { 10432 var snapshot bytes.Buffer 10433 io.Copy(&snapshot, ringBuffer) 10434 err = &smithy.DeserializationError{ 10435 Err: fmt.Errorf("failed to decode response body, %w", err), 10436 Snapshot: snapshot.Bytes(), 10437 } 10438 return err 10439 } 10440 10441 errorBody.Seek(0, io.SeekStart) 10442 10443 return output 10444} 10445 10446func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10447 output := &types.LimitExceededException{} 10448 var buff [1024]byte 10449 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10450 10451 body := io.TeeReader(errorBody, ringBuffer) 10452 decoder := json.NewDecoder(body) 10453 decoder.UseNumber() 10454 var shape interface{} 10455 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10456 var snapshot bytes.Buffer 10457 io.Copy(&snapshot, ringBuffer) 10458 err = &smithy.DeserializationError{ 10459 Err: fmt.Errorf("failed to decode response body, %w", err), 10460 Snapshot: snapshot.Bytes(), 10461 } 10462 return err 10463 } 10464 10465 err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) 10466 10467 if err != nil { 10468 var snapshot bytes.Buffer 10469 io.Copy(&snapshot, ringBuffer) 10470 err = &smithy.DeserializationError{ 10471 Err: fmt.Errorf("failed to decode response body, %w", err), 10472 Snapshot: snapshot.Bytes(), 10473 } 10474 return err 10475 } 10476 10477 errorBody.Seek(0, io.SeekStart) 10478 10479 return output 10480} 10481 10482func awsRestjson1_deserializeErrorResourceAlreadyExistsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10483 output := &types.ResourceAlreadyExistsException{} 10484 var buff [1024]byte 10485 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10486 10487 body := io.TeeReader(errorBody, ringBuffer) 10488 decoder := json.NewDecoder(body) 10489 decoder.UseNumber() 10490 var shape interface{} 10491 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10492 var snapshot bytes.Buffer 10493 io.Copy(&snapshot, ringBuffer) 10494 err = &smithy.DeserializationError{ 10495 Err: fmt.Errorf("failed to decode response body, %w", err), 10496 Snapshot: snapshot.Bytes(), 10497 } 10498 return err 10499 } 10500 10501 err := awsRestjson1_deserializeDocumentResourceAlreadyExistsException(&output, shape) 10502 10503 if err != nil { 10504 var snapshot bytes.Buffer 10505 io.Copy(&snapshot, ringBuffer) 10506 err = &smithy.DeserializationError{ 10507 Err: fmt.Errorf("failed to decode response body, %w", err), 10508 Snapshot: snapshot.Bytes(), 10509 } 10510 return err 10511 } 10512 10513 errorBody.Seek(0, io.SeekStart) 10514 10515 return output 10516} 10517 10518func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10519 output := &types.ResourceNotFoundException{} 10520 var buff [1024]byte 10521 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10522 10523 body := io.TeeReader(errorBody, ringBuffer) 10524 decoder := json.NewDecoder(body) 10525 decoder.UseNumber() 10526 var shape interface{} 10527 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10528 var snapshot bytes.Buffer 10529 io.Copy(&snapshot, ringBuffer) 10530 err = &smithy.DeserializationError{ 10531 Err: fmt.Errorf("failed to decode response body, %w", err), 10532 Snapshot: snapshot.Bytes(), 10533 } 10534 return err 10535 } 10536 10537 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 10538 10539 if err != nil { 10540 var snapshot bytes.Buffer 10541 io.Copy(&snapshot, ringBuffer) 10542 err = &smithy.DeserializationError{ 10543 Err: fmt.Errorf("failed to decode response body, %w", err), 10544 Snapshot: snapshot.Bytes(), 10545 } 10546 return err 10547 } 10548 10549 errorBody.Seek(0, io.SeekStart) 10550 10551 return output 10552} 10553 10554func awsRestjson1_deserializeErrorServiceUnavailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10555 output := &types.ServiceUnavailableException{} 10556 var buff [1024]byte 10557 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10558 10559 body := io.TeeReader(errorBody, ringBuffer) 10560 decoder := json.NewDecoder(body) 10561 decoder.UseNumber() 10562 var shape interface{} 10563 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10564 var snapshot bytes.Buffer 10565 io.Copy(&snapshot, ringBuffer) 10566 err = &smithy.DeserializationError{ 10567 Err: fmt.Errorf("failed to decode response body, %w", err), 10568 Snapshot: snapshot.Bytes(), 10569 } 10570 return err 10571 } 10572 10573 err := awsRestjson1_deserializeDocumentServiceUnavailableException(&output, shape) 10574 10575 if err != nil { 10576 var snapshot bytes.Buffer 10577 io.Copy(&snapshot, ringBuffer) 10578 err = &smithy.DeserializationError{ 10579 Err: fmt.Errorf("failed to decode response body, %w", err), 10580 Snapshot: snapshot.Bytes(), 10581 } 10582 return err 10583 } 10584 10585 errorBody.Seek(0, io.SeekStart) 10586 10587 return output 10588} 10589 10590func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 10591 output := &types.ThrottlingException{} 10592 var buff [1024]byte 10593 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10594 10595 body := io.TeeReader(errorBody, ringBuffer) 10596 decoder := json.NewDecoder(body) 10597 decoder.UseNumber() 10598 var shape interface{} 10599 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10600 var snapshot bytes.Buffer 10601 io.Copy(&snapshot, ringBuffer) 10602 err = &smithy.DeserializationError{ 10603 Err: fmt.Errorf("failed to decode response body, %w", err), 10604 Snapshot: snapshot.Bytes(), 10605 } 10606 return err 10607 } 10608 10609 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 10610 10611 if err != nil { 10612 var snapshot bytes.Buffer 10613 io.Copy(&snapshot, ringBuffer) 10614 err = &smithy.DeserializationError{ 10615 Err: fmt.Errorf("failed to decode response body, %w", err), 10616 Snapshot: snapshot.Bytes(), 10617 } 10618 return err 10619 } 10620 10621 errorBody.Seek(0, io.SeekStart) 10622 10623 return output 10624} 10625 10626func awsRestjson1_deserializeDocumentArns(v *[]string, value interface{}) error { 10627 if v == nil { 10628 return fmt.Errorf("unexpected nil of type %T", v) 10629 } 10630 if value == nil { 10631 return nil 10632 } 10633 10634 shape, ok := value.([]interface{}) 10635 if !ok { 10636 return fmt.Errorf("unexpected JSON type %v", value) 10637 } 10638 10639 var cv []string 10640 if *v == nil { 10641 cv = []string{} 10642 } else { 10643 cv = *v 10644 } 10645 10646 for _, value := range shape { 10647 var col string 10648 if value != nil { 10649 jtv, ok := value.(string) 10650 if !ok { 10651 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 10652 } 10653 col = jtv 10654 } 10655 cv = append(cv, col) 10656 10657 } 10658 *v = cv 10659 return nil 10660} 10661 10662func awsRestjson1_deserializeDocumentBatchPolicy(v **types.BatchPolicy, value interface{}) error { 10663 if v == nil { 10664 return fmt.Errorf("unexpected nil of type %T", v) 10665 } 10666 if value == nil { 10667 return nil 10668 } 10669 10670 shape, ok := value.(map[string]interface{}) 10671 if !ok { 10672 return fmt.Errorf("unexpected JSON type %v", value) 10673 } 10674 10675 var sv *types.BatchPolicy 10676 if *v == nil { 10677 sv = &types.BatchPolicy{} 10678 } else { 10679 sv = *v 10680 } 10681 10682 for key, value := range shape { 10683 switch key { 10684 case "maxConcurrency": 10685 if value != nil { 10686 jtv, ok := value.(json.Number) 10687 if !ok { 10688 return fmt.Errorf("expected MaxConcurrency to be json.Number, got %T instead", value) 10689 } 10690 i64, err := jtv.Int64() 10691 if err != nil { 10692 return err 10693 } 10694 sv.MaxConcurrency = ptr.Int32(int32(i64)) 10695 } 10696 10697 case "timeoutInSeconds": 10698 if value != nil { 10699 jtv, ok := value.(json.Number) 10700 if !ok { 10701 return fmt.Errorf("expected BatchTimeoutInSeconds to be json.Number, got %T instead", value) 10702 } 10703 i64, err := jtv.Int64() 10704 if err != nil { 10705 return err 10706 } 10707 sv.TimeoutInSeconds = ptr.Int64(i64) 10708 } 10709 10710 default: 10711 _, _ = key, value 10712 10713 } 10714 } 10715 *v = sv 10716 return nil 10717} 10718 10719func awsRestjson1_deserializeDocumentCompute(v **types.Compute, value interface{}) error { 10720 if v == nil { 10721 return fmt.Errorf("unexpected nil of type %T", v) 10722 } 10723 if value == nil { 10724 return nil 10725 } 10726 10727 shape, ok := value.(map[string]interface{}) 10728 if !ok { 10729 return fmt.Errorf("unexpected JSON type %v", value) 10730 } 10731 10732 var sv *types.Compute 10733 if *v == nil { 10734 sv = &types.Compute{} 10735 } else { 10736 sv = *v 10737 } 10738 10739 for key, value := range shape { 10740 switch key { 10741 case "simulationUnitLimit": 10742 if value != nil { 10743 jtv, ok := value.(json.Number) 10744 if !ok { 10745 return fmt.Errorf("expected SimulationUnit to be json.Number, got %T instead", value) 10746 } 10747 i64, err := jtv.Int64() 10748 if err != nil { 10749 return err 10750 } 10751 sv.SimulationUnitLimit = ptr.Int32(int32(i64)) 10752 } 10753 10754 default: 10755 _, _ = key, value 10756 10757 } 10758 } 10759 *v = sv 10760 return nil 10761} 10762 10763func awsRestjson1_deserializeDocumentComputeResponse(v **types.ComputeResponse, value interface{}) error { 10764 if v == nil { 10765 return fmt.Errorf("unexpected nil of type %T", v) 10766 } 10767 if value == nil { 10768 return nil 10769 } 10770 10771 shape, ok := value.(map[string]interface{}) 10772 if !ok { 10773 return fmt.Errorf("unexpected JSON type %v", value) 10774 } 10775 10776 var sv *types.ComputeResponse 10777 if *v == nil { 10778 sv = &types.ComputeResponse{} 10779 } else { 10780 sv = *v 10781 } 10782 10783 for key, value := range shape { 10784 switch key { 10785 case "simulationUnitLimit": 10786 if value != nil { 10787 jtv, ok := value.(json.Number) 10788 if !ok { 10789 return fmt.Errorf("expected SimulationUnit to be json.Number, got %T instead", value) 10790 } 10791 i64, err := jtv.Int64() 10792 if err != nil { 10793 return err 10794 } 10795 sv.SimulationUnitLimit = ptr.Int32(int32(i64)) 10796 } 10797 10798 default: 10799 _, _ = key, value 10800 10801 } 10802 } 10803 *v = sv 10804 return nil 10805} 10806 10807func awsRestjson1_deserializeDocumentConcurrentDeploymentException(v **types.ConcurrentDeploymentException, value interface{}) error { 10808 if v == nil { 10809 return fmt.Errorf("unexpected nil of type %T", v) 10810 } 10811 if value == nil { 10812 return nil 10813 } 10814 10815 shape, ok := value.(map[string]interface{}) 10816 if !ok { 10817 return fmt.Errorf("unexpected JSON type %v", value) 10818 } 10819 10820 var sv *types.ConcurrentDeploymentException 10821 if *v == nil { 10822 sv = &types.ConcurrentDeploymentException{} 10823 } else { 10824 sv = *v 10825 } 10826 10827 for key, value := range shape { 10828 switch key { 10829 case "message": 10830 if value != nil { 10831 jtv, ok := value.(string) 10832 if !ok { 10833 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 10834 } 10835 sv.Message = ptr.String(jtv) 10836 } 10837 10838 default: 10839 _, _ = key, value 10840 10841 } 10842 } 10843 *v = sv 10844 return nil 10845} 10846 10847func awsRestjson1_deserializeDocumentCreateSimulationJobRequests(v *[]types.SimulationJobRequest, value interface{}) error { 10848 if v == nil { 10849 return fmt.Errorf("unexpected nil of type %T", v) 10850 } 10851 if value == nil { 10852 return nil 10853 } 10854 10855 shape, ok := value.([]interface{}) 10856 if !ok { 10857 return fmt.Errorf("unexpected JSON type %v", value) 10858 } 10859 10860 var cv []types.SimulationJobRequest 10861 if *v == nil { 10862 cv = []types.SimulationJobRequest{} 10863 } else { 10864 cv = *v 10865 } 10866 10867 for _, value := range shape { 10868 var col types.SimulationJobRequest 10869 destAddr := &col 10870 if err := awsRestjson1_deserializeDocumentSimulationJobRequest(&destAddr, value); err != nil { 10871 return err 10872 } 10873 col = *destAddr 10874 cv = append(cv, col) 10875 10876 } 10877 *v = cv 10878 return nil 10879} 10880 10881func awsRestjson1_deserializeDocumentDataSource(v **types.DataSource, value interface{}) error { 10882 if v == nil { 10883 return fmt.Errorf("unexpected nil of type %T", v) 10884 } 10885 if value == nil { 10886 return nil 10887 } 10888 10889 shape, ok := value.(map[string]interface{}) 10890 if !ok { 10891 return fmt.Errorf("unexpected JSON type %v", value) 10892 } 10893 10894 var sv *types.DataSource 10895 if *v == nil { 10896 sv = &types.DataSource{} 10897 } else { 10898 sv = *v 10899 } 10900 10901 for key, value := range shape { 10902 switch key { 10903 case "name": 10904 if value != nil { 10905 jtv, ok := value.(string) 10906 if !ok { 10907 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 10908 } 10909 sv.Name = ptr.String(jtv) 10910 } 10911 10912 case "s3Bucket": 10913 if value != nil { 10914 jtv, ok := value.(string) 10915 if !ok { 10916 return fmt.Errorf("expected S3Bucket to be of type string, got %T instead", value) 10917 } 10918 sv.S3Bucket = ptr.String(jtv) 10919 } 10920 10921 case "s3Keys": 10922 if err := awsRestjson1_deserializeDocumentS3KeyOutputs(&sv.S3Keys, value); err != nil { 10923 return err 10924 } 10925 10926 default: 10927 _, _ = key, value 10928 10929 } 10930 } 10931 *v = sv 10932 return nil 10933} 10934 10935func awsRestjson1_deserializeDocumentDataSourceConfig(v **types.DataSourceConfig, value interface{}) error { 10936 if v == nil { 10937 return fmt.Errorf("unexpected nil of type %T", v) 10938 } 10939 if value == nil { 10940 return nil 10941 } 10942 10943 shape, ok := value.(map[string]interface{}) 10944 if !ok { 10945 return fmt.Errorf("unexpected JSON type %v", value) 10946 } 10947 10948 var sv *types.DataSourceConfig 10949 if *v == nil { 10950 sv = &types.DataSourceConfig{} 10951 } else { 10952 sv = *v 10953 } 10954 10955 for key, value := range shape { 10956 switch key { 10957 case "name": 10958 if value != nil { 10959 jtv, ok := value.(string) 10960 if !ok { 10961 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 10962 } 10963 sv.Name = ptr.String(jtv) 10964 } 10965 10966 case "s3Bucket": 10967 if value != nil { 10968 jtv, ok := value.(string) 10969 if !ok { 10970 return fmt.Errorf("expected S3Bucket to be of type string, got %T instead", value) 10971 } 10972 sv.S3Bucket = ptr.String(jtv) 10973 } 10974 10975 case "s3Keys": 10976 if err := awsRestjson1_deserializeDocumentS3Keys(&sv.S3Keys, value); err != nil { 10977 return err 10978 } 10979 10980 default: 10981 _, _ = key, value 10982 10983 } 10984 } 10985 *v = sv 10986 return nil 10987} 10988 10989func awsRestjson1_deserializeDocumentDataSourceConfigs(v *[]types.DataSourceConfig, value interface{}) error { 10990 if v == nil { 10991 return fmt.Errorf("unexpected nil of type %T", v) 10992 } 10993 if value == nil { 10994 return nil 10995 } 10996 10997 shape, ok := value.([]interface{}) 10998 if !ok { 10999 return fmt.Errorf("unexpected JSON type %v", value) 11000 } 11001 11002 var cv []types.DataSourceConfig 11003 if *v == nil { 11004 cv = []types.DataSourceConfig{} 11005 } else { 11006 cv = *v 11007 } 11008 11009 for _, value := range shape { 11010 var col types.DataSourceConfig 11011 destAddr := &col 11012 if err := awsRestjson1_deserializeDocumentDataSourceConfig(&destAddr, value); err != nil { 11013 return err 11014 } 11015 col = *destAddr 11016 cv = append(cv, col) 11017 11018 } 11019 *v = cv 11020 return nil 11021} 11022 11023func awsRestjson1_deserializeDocumentDataSourceNames(v *[]string, value interface{}) error { 11024 if v == nil { 11025 return fmt.Errorf("unexpected nil of type %T", v) 11026 } 11027 if value == nil { 11028 return nil 11029 } 11030 11031 shape, ok := value.([]interface{}) 11032 if !ok { 11033 return fmt.Errorf("unexpected JSON type %v", value) 11034 } 11035 11036 var cv []string 11037 if *v == nil { 11038 cv = []string{} 11039 } else { 11040 cv = *v 11041 } 11042 11043 for _, value := range shape { 11044 var col string 11045 if value != nil { 11046 jtv, ok := value.(string) 11047 if !ok { 11048 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 11049 } 11050 col = jtv 11051 } 11052 cv = append(cv, col) 11053 11054 } 11055 *v = cv 11056 return nil 11057} 11058 11059func awsRestjson1_deserializeDocumentDataSources(v *[]types.DataSource, value interface{}) error { 11060 if v == nil { 11061 return fmt.Errorf("unexpected nil of type %T", v) 11062 } 11063 if value == nil { 11064 return nil 11065 } 11066 11067 shape, ok := value.([]interface{}) 11068 if !ok { 11069 return fmt.Errorf("unexpected JSON type %v", value) 11070 } 11071 11072 var cv []types.DataSource 11073 if *v == nil { 11074 cv = []types.DataSource{} 11075 } else { 11076 cv = *v 11077 } 11078 11079 for _, value := range shape { 11080 var col types.DataSource 11081 destAddr := &col 11082 if err := awsRestjson1_deserializeDocumentDataSource(&destAddr, value); err != nil { 11083 return err 11084 } 11085 col = *destAddr 11086 cv = append(cv, col) 11087 11088 } 11089 *v = cv 11090 return nil 11091} 11092 11093func awsRestjson1_deserializeDocumentDeploymentApplicationConfig(v **types.DeploymentApplicationConfig, value interface{}) error { 11094 if v == nil { 11095 return fmt.Errorf("unexpected nil of type %T", v) 11096 } 11097 if value == nil { 11098 return nil 11099 } 11100 11101 shape, ok := value.(map[string]interface{}) 11102 if !ok { 11103 return fmt.Errorf("unexpected JSON type %v", value) 11104 } 11105 11106 var sv *types.DeploymentApplicationConfig 11107 if *v == nil { 11108 sv = &types.DeploymentApplicationConfig{} 11109 } else { 11110 sv = *v 11111 } 11112 11113 for key, value := range shape { 11114 switch key { 11115 case "application": 11116 if value != nil { 11117 jtv, ok := value.(string) 11118 if !ok { 11119 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11120 } 11121 sv.Application = ptr.String(jtv) 11122 } 11123 11124 case "applicationVersion": 11125 if value != nil { 11126 jtv, ok := value.(string) 11127 if !ok { 11128 return fmt.Errorf("expected DeploymentVersion to be of type string, got %T instead", value) 11129 } 11130 sv.ApplicationVersion = ptr.String(jtv) 11131 } 11132 11133 case "launchConfig": 11134 if err := awsRestjson1_deserializeDocumentDeploymentLaunchConfig(&sv.LaunchConfig, value); err != nil { 11135 return err 11136 } 11137 11138 default: 11139 _, _ = key, value 11140 11141 } 11142 } 11143 *v = sv 11144 return nil 11145} 11146 11147func awsRestjson1_deserializeDocumentDeploymentApplicationConfigs(v *[]types.DeploymentApplicationConfig, value interface{}) error { 11148 if v == nil { 11149 return fmt.Errorf("unexpected nil of type %T", v) 11150 } 11151 if value == nil { 11152 return nil 11153 } 11154 11155 shape, ok := value.([]interface{}) 11156 if !ok { 11157 return fmt.Errorf("unexpected JSON type %v", value) 11158 } 11159 11160 var cv []types.DeploymentApplicationConfig 11161 if *v == nil { 11162 cv = []types.DeploymentApplicationConfig{} 11163 } else { 11164 cv = *v 11165 } 11166 11167 for _, value := range shape { 11168 var col types.DeploymentApplicationConfig 11169 destAddr := &col 11170 if err := awsRestjson1_deserializeDocumentDeploymentApplicationConfig(&destAddr, value); err != nil { 11171 return err 11172 } 11173 col = *destAddr 11174 cv = append(cv, col) 11175 11176 } 11177 *v = cv 11178 return nil 11179} 11180 11181func awsRestjson1_deserializeDocumentDeploymentConfig(v **types.DeploymentConfig, value interface{}) error { 11182 if v == nil { 11183 return fmt.Errorf("unexpected nil of type %T", v) 11184 } 11185 if value == nil { 11186 return nil 11187 } 11188 11189 shape, ok := value.(map[string]interface{}) 11190 if !ok { 11191 return fmt.Errorf("unexpected JSON type %v", value) 11192 } 11193 11194 var sv *types.DeploymentConfig 11195 if *v == nil { 11196 sv = &types.DeploymentConfig{} 11197 } else { 11198 sv = *v 11199 } 11200 11201 for key, value := range shape { 11202 switch key { 11203 case "concurrentDeploymentPercentage": 11204 if value != nil { 11205 jtv, ok := value.(json.Number) 11206 if !ok { 11207 return fmt.Errorf("expected Percentage to be json.Number, got %T instead", value) 11208 } 11209 i64, err := jtv.Int64() 11210 if err != nil { 11211 return err 11212 } 11213 sv.ConcurrentDeploymentPercentage = ptr.Int32(int32(i64)) 11214 } 11215 11216 case "downloadConditionFile": 11217 if err := awsRestjson1_deserializeDocumentS3Object(&sv.DownloadConditionFile, value); err != nil { 11218 return err 11219 } 11220 11221 case "failureThresholdPercentage": 11222 if value != nil { 11223 jtv, ok := value.(json.Number) 11224 if !ok { 11225 return fmt.Errorf("expected Percentage to be json.Number, got %T instead", value) 11226 } 11227 i64, err := jtv.Int64() 11228 if err != nil { 11229 return err 11230 } 11231 sv.FailureThresholdPercentage = ptr.Int32(int32(i64)) 11232 } 11233 11234 case "robotDeploymentTimeoutInSeconds": 11235 if value != nil { 11236 jtv, ok := value.(json.Number) 11237 if !ok { 11238 return fmt.Errorf("expected DeploymentTimeout to be json.Number, got %T instead", value) 11239 } 11240 i64, err := jtv.Int64() 11241 if err != nil { 11242 return err 11243 } 11244 sv.RobotDeploymentTimeoutInSeconds = ptr.Int64(i64) 11245 } 11246 11247 default: 11248 _, _ = key, value 11249 11250 } 11251 } 11252 *v = sv 11253 return nil 11254} 11255 11256func awsRestjson1_deserializeDocumentDeploymentJob(v **types.DeploymentJob, value interface{}) error { 11257 if v == nil { 11258 return fmt.Errorf("unexpected nil of type %T", v) 11259 } 11260 if value == nil { 11261 return nil 11262 } 11263 11264 shape, ok := value.(map[string]interface{}) 11265 if !ok { 11266 return fmt.Errorf("unexpected JSON type %v", value) 11267 } 11268 11269 var sv *types.DeploymentJob 11270 if *v == nil { 11271 sv = &types.DeploymentJob{} 11272 } else { 11273 sv = *v 11274 } 11275 11276 for key, value := range shape { 11277 switch key { 11278 case "arn": 11279 if value != nil { 11280 jtv, ok := value.(string) 11281 if !ok { 11282 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11283 } 11284 sv.Arn = ptr.String(jtv) 11285 } 11286 11287 case "createdAt": 11288 if value != nil { 11289 switch jtv := value.(type) { 11290 case json.Number: 11291 f64, err := jtv.Float64() 11292 if err != nil { 11293 return err 11294 } 11295 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11296 11297 default: 11298 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 11299 11300 } 11301 } 11302 11303 case "deploymentApplicationConfigs": 11304 if err := awsRestjson1_deserializeDocumentDeploymentApplicationConfigs(&sv.DeploymentApplicationConfigs, value); err != nil { 11305 return err 11306 } 11307 11308 case "deploymentConfig": 11309 if err := awsRestjson1_deserializeDocumentDeploymentConfig(&sv.DeploymentConfig, value); err != nil { 11310 return err 11311 } 11312 11313 case "failureCode": 11314 if value != nil { 11315 jtv, ok := value.(string) 11316 if !ok { 11317 return fmt.Errorf("expected DeploymentJobErrorCode to be of type string, got %T instead", value) 11318 } 11319 sv.FailureCode = types.DeploymentJobErrorCode(jtv) 11320 } 11321 11322 case "failureReason": 11323 if value != nil { 11324 jtv, ok := value.(string) 11325 if !ok { 11326 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 11327 } 11328 sv.FailureReason = ptr.String(jtv) 11329 } 11330 11331 case "fleet": 11332 if value != nil { 11333 jtv, ok := value.(string) 11334 if !ok { 11335 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11336 } 11337 sv.Fleet = ptr.String(jtv) 11338 } 11339 11340 case "status": 11341 if value != nil { 11342 jtv, ok := value.(string) 11343 if !ok { 11344 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 11345 } 11346 sv.Status = types.DeploymentStatus(jtv) 11347 } 11348 11349 default: 11350 _, _ = key, value 11351 11352 } 11353 } 11354 *v = sv 11355 return nil 11356} 11357 11358func awsRestjson1_deserializeDocumentDeploymentJobs(v *[]types.DeploymentJob, value interface{}) error { 11359 if v == nil { 11360 return fmt.Errorf("unexpected nil of type %T", v) 11361 } 11362 if value == nil { 11363 return nil 11364 } 11365 11366 shape, ok := value.([]interface{}) 11367 if !ok { 11368 return fmt.Errorf("unexpected JSON type %v", value) 11369 } 11370 11371 var cv []types.DeploymentJob 11372 if *v == nil { 11373 cv = []types.DeploymentJob{} 11374 } else { 11375 cv = *v 11376 } 11377 11378 for _, value := range shape { 11379 var col types.DeploymentJob 11380 destAddr := &col 11381 if err := awsRestjson1_deserializeDocumentDeploymentJob(&destAddr, value); err != nil { 11382 return err 11383 } 11384 col = *destAddr 11385 cv = append(cv, col) 11386 11387 } 11388 *v = cv 11389 return nil 11390} 11391 11392func awsRestjson1_deserializeDocumentDeploymentLaunchConfig(v **types.DeploymentLaunchConfig, value interface{}) error { 11393 if v == nil { 11394 return fmt.Errorf("unexpected nil of type %T", v) 11395 } 11396 if value == nil { 11397 return nil 11398 } 11399 11400 shape, ok := value.(map[string]interface{}) 11401 if !ok { 11402 return fmt.Errorf("unexpected JSON type %v", value) 11403 } 11404 11405 var sv *types.DeploymentLaunchConfig 11406 if *v == nil { 11407 sv = &types.DeploymentLaunchConfig{} 11408 } else { 11409 sv = *v 11410 } 11411 11412 for key, value := range shape { 11413 switch key { 11414 case "environmentVariables": 11415 if err := awsRestjson1_deserializeDocumentEnvironmentVariableMap(&sv.EnvironmentVariables, value); err != nil { 11416 return err 11417 } 11418 11419 case "launchFile": 11420 if value != nil { 11421 jtv, ok := value.(string) 11422 if !ok { 11423 return fmt.Errorf("expected Command to be of type string, got %T instead", value) 11424 } 11425 sv.LaunchFile = ptr.String(jtv) 11426 } 11427 11428 case "packageName": 11429 if value != nil { 11430 jtv, ok := value.(string) 11431 if !ok { 11432 return fmt.Errorf("expected Command to be of type string, got %T instead", value) 11433 } 11434 sv.PackageName = ptr.String(jtv) 11435 } 11436 11437 case "postLaunchFile": 11438 if value != nil { 11439 jtv, ok := value.(string) 11440 if !ok { 11441 return fmt.Errorf("expected Path to be of type string, got %T instead", value) 11442 } 11443 sv.PostLaunchFile = ptr.String(jtv) 11444 } 11445 11446 case "preLaunchFile": 11447 if value != nil { 11448 jtv, ok := value.(string) 11449 if !ok { 11450 return fmt.Errorf("expected Path to be of type string, got %T instead", value) 11451 } 11452 sv.PreLaunchFile = ptr.String(jtv) 11453 } 11454 11455 default: 11456 _, _ = key, value 11457 11458 } 11459 } 11460 *v = sv 11461 return nil 11462} 11463 11464func awsRestjson1_deserializeDocumentEnvironment(v **types.Environment, value interface{}) error { 11465 if v == nil { 11466 return fmt.Errorf("unexpected nil of type %T", v) 11467 } 11468 if value == nil { 11469 return nil 11470 } 11471 11472 shape, ok := value.(map[string]interface{}) 11473 if !ok { 11474 return fmt.Errorf("unexpected JSON type %v", value) 11475 } 11476 11477 var sv *types.Environment 11478 if *v == nil { 11479 sv = &types.Environment{} 11480 } else { 11481 sv = *v 11482 } 11483 11484 for key, value := range shape { 11485 switch key { 11486 case "uri": 11487 if value != nil { 11488 jtv, ok := value.(string) 11489 if !ok { 11490 return fmt.Errorf("expected RepositoryUrl to be of type string, got %T instead", value) 11491 } 11492 sv.Uri = ptr.String(jtv) 11493 } 11494 11495 default: 11496 _, _ = key, value 11497 11498 } 11499 } 11500 *v = sv 11501 return nil 11502} 11503 11504func awsRestjson1_deserializeDocumentEnvironmentVariableMap(v *map[string]string, value interface{}) error { 11505 if v == nil { 11506 return fmt.Errorf("unexpected nil of type %T", v) 11507 } 11508 if value == nil { 11509 return nil 11510 } 11511 11512 shape, ok := value.(map[string]interface{}) 11513 if !ok { 11514 return fmt.Errorf("unexpected JSON type %v", value) 11515 } 11516 11517 var mv map[string]string 11518 if *v == nil { 11519 mv = map[string]string{} 11520 } else { 11521 mv = *v 11522 } 11523 11524 for key, value := range shape { 11525 var parsedVal string 11526 if value != nil { 11527 jtv, ok := value.(string) 11528 if !ok { 11529 return fmt.Errorf("expected EnvironmentVariableValue to be of type string, got %T instead", value) 11530 } 11531 parsedVal = jtv 11532 } 11533 mv[key] = parsedVal 11534 11535 } 11536 *v = mv 11537 return nil 11538} 11539 11540func awsRestjson1_deserializeDocumentFailedCreateSimulationJobRequest(v **types.FailedCreateSimulationJobRequest, value interface{}) error { 11541 if v == nil { 11542 return fmt.Errorf("unexpected nil of type %T", v) 11543 } 11544 if value == nil { 11545 return nil 11546 } 11547 11548 shape, ok := value.(map[string]interface{}) 11549 if !ok { 11550 return fmt.Errorf("unexpected JSON type %v", value) 11551 } 11552 11553 var sv *types.FailedCreateSimulationJobRequest 11554 if *v == nil { 11555 sv = &types.FailedCreateSimulationJobRequest{} 11556 } else { 11557 sv = *v 11558 } 11559 11560 for key, value := range shape { 11561 switch key { 11562 case "failedAt": 11563 if value != nil { 11564 switch jtv := value.(type) { 11565 case json.Number: 11566 f64, err := jtv.Float64() 11567 if err != nil { 11568 return err 11569 } 11570 sv.FailedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11571 11572 default: 11573 return fmt.Errorf("expected FailedAt to be a JSON Number, got %T instead", value) 11574 11575 } 11576 } 11577 11578 case "failureCode": 11579 if value != nil { 11580 jtv, ok := value.(string) 11581 if !ok { 11582 return fmt.Errorf("expected SimulationJobErrorCode to be of type string, got %T instead", value) 11583 } 11584 sv.FailureCode = types.SimulationJobErrorCode(jtv) 11585 } 11586 11587 case "failureReason": 11588 if value != nil { 11589 jtv, ok := value.(string) 11590 if !ok { 11591 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 11592 } 11593 sv.FailureReason = ptr.String(jtv) 11594 } 11595 11596 case "request": 11597 if err := awsRestjson1_deserializeDocumentSimulationJobRequest(&sv.Request, value); err != nil { 11598 return err 11599 } 11600 11601 default: 11602 _, _ = key, value 11603 11604 } 11605 } 11606 *v = sv 11607 return nil 11608} 11609 11610func awsRestjson1_deserializeDocumentFailedCreateSimulationJobRequests(v *[]types.FailedCreateSimulationJobRequest, value interface{}) error { 11611 if v == nil { 11612 return fmt.Errorf("unexpected nil of type %T", v) 11613 } 11614 if value == nil { 11615 return nil 11616 } 11617 11618 shape, ok := value.([]interface{}) 11619 if !ok { 11620 return fmt.Errorf("unexpected JSON type %v", value) 11621 } 11622 11623 var cv []types.FailedCreateSimulationJobRequest 11624 if *v == nil { 11625 cv = []types.FailedCreateSimulationJobRequest{} 11626 } else { 11627 cv = *v 11628 } 11629 11630 for _, value := range shape { 11631 var col types.FailedCreateSimulationJobRequest 11632 destAddr := &col 11633 if err := awsRestjson1_deserializeDocumentFailedCreateSimulationJobRequest(&destAddr, value); err != nil { 11634 return err 11635 } 11636 col = *destAddr 11637 cv = append(cv, col) 11638 11639 } 11640 *v = cv 11641 return nil 11642} 11643 11644func awsRestjson1_deserializeDocumentFailureSummary(v **types.FailureSummary, value interface{}) error { 11645 if v == nil { 11646 return fmt.Errorf("unexpected nil of type %T", v) 11647 } 11648 if value == nil { 11649 return nil 11650 } 11651 11652 shape, ok := value.(map[string]interface{}) 11653 if !ok { 11654 return fmt.Errorf("unexpected JSON type %v", value) 11655 } 11656 11657 var sv *types.FailureSummary 11658 if *v == nil { 11659 sv = &types.FailureSummary{} 11660 } else { 11661 sv = *v 11662 } 11663 11664 for key, value := range shape { 11665 switch key { 11666 case "failures": 11667 if err := awsRestjson1_deserializeDocumentWorldFailures(&sv.Failures, value); err != nil { 11668 return err 11669 } 11670 11671 case "totalFailureCount": 11672 if value != nil { 11673 jtv, ok := value.(json.Number) 11674 if !ok { 11675 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 11676 } 11677 i64, err := jtv.Int64() 11678 if err != nil { 11679 return err 11680 } 11681 sv.TotalFailureCount = int32(i64) 11682 } 11683 11684 default: 11685 _, _ = key, value 11686 11687 } 11688 } 11689 *v = sv 11690 return nil 11691} 11692 11693func awsRestjson1_deserializeDocumentFinishedWorldsSummary(v **types.FinishedWorldsSummary, value interface{}) error { 11694 if v == nil { 11695 return fmt.Errorf("unexpected nil of type %T", v) 11696 } 11697 if value == nil { 11698 return nil 11699 } 11700 11701 shape, ok := value.(map[string]interface{}) 11702 if !ok { 11703 return fmt.Errorf("unexpected JSON type %v", value) 11704 } 11705 11706 var sv *types.FinishedWorldsSummary 11707 if *v == nil { 11708 sv = &types.FinishedWorldsSummary{} 11709 } else { 11710 sv = *v 11711 } 11712 11713 for key, value := range shape { 11714 switch key { 11715 case "failureSummary": 11716 if err := awsRestjson1_deserializeDocumentFailureSummary(&sv.FailureSummary, value); err != nil { 11717 return err 11718 } 11719 11720 case "finishedCount": 11721 if value != nil { 11722 jtv, ok := value.(json.Number) 11723 if !ok { 11724 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 11725 } 11726 i64, err := jtv.Int64() 11727 if err != nil { 11728 return err 11729 } 11730 sv.FinishedCount = int32(i64) 11731 } 11732 11733 case "succeededWorlds": 11734 if err := awsRestjson1_deserializeDocumentArns(&sv.SucceededWorlds, value); err != nil { 11735 return err 11736 } 11737 11738 default: 11739 _, _ = key, value 11740 11741 } 11742 } 11743 *v = sv 11744 return nil 11745} 11746 11747func awsRestjson1_deserializeDocumentFleet(v **types.Fleet, value interface{}) error { 11748 if v == nil { 11749 return fmt.Errorf("unexpected nil of type %T", v) 11750 } 11751 if value == nil { 11752 return nil 11753 } 11754 11755 shape, ok := value.(map[string]interface{}) 11756 if !ok { 11757 return fmt.Errorf("unexpected JSON type %v", value) 11758 } 11759 11760 var sv *types.Fleet 11761 if *v == nil { 11762 sv = &types.Fleet{} 11763 } else { 11764 sv = *v 11765 } 11766 11767 for key, value := range shape { 11768 switch key { 11769 case "arn": 11770 if value != nil { 11771 jtv, ok := value.(string) 11772 if !ok { 11773 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11774 } 11775 sv.Arn = ptr.String(jtv) 11776 } 11777 11778 case "createdAt": 11779 if value != nil { 11780 switch jtv := value.(type) { 11781 case json.Number: 11782 f64, err := jtv.Float64() 11783 if err != nil { 11784 return err 11785 } 11786 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11787 11788 default: 11789 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 11790 11791 } 11792 } 11793 11794 case "lastDeploymentJob": 11795 if value != nil { 11796 jtv, ok := value.(string) 11797 if !ok { 11798 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11799 } 11800 sv.LastDeploymentJob = ptr.String(jtv) 11801 } 11802 11803 case "lastDeploymentStatus": 11804 if value != nil { 11805 jtv, ok := value.(string) 11806 if !ok { 11807 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 11808 } 11809 sv.LastDeploymentStatus = types.DeploymentStatus(jtv) 11810 } 11811 11812 case "lastDeploymentTime": 11813 if value != nil { 11814 switch jtv := value.(type) { 11815 case json.Number: 11816 f64, err := jtv.Float64() 11817 if err != nil { 11818 return err 11819 } 11820 sv.LastDeploymentTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11821 11822 default: 11823 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 11824 11825 } 11826 } 11827 11828 case "name": 11829 if value != nil { 11830 jtv, ok := value.(string) 11831 if !ok { 11832 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 11833 } 11834 sv.Name = ptr.String(jtv) 11835 } 11836 11837 default: 11838 _, _ = key, value 11839 11840 } 11841 } 11842 *v = sv 11843 return nil 11844} 11845 11846func awsRestjson1_deserializeDocumentFleets(v *[]types.Fleet, value interface{}) error { 11847 if v == nil { 11848 return fmt.Errorf("unexpected nil of type %T", v) 11849 } 11850 if value == nil { 11851 return nil 11852 } 11853 11854 shape, ok := value.([]interface{}) 11855 if !ok { 11856 return fmt.Errorf("unexpected JSON type %v", value) 11857 } 11858 11859 var cv []types.Fleet 11860 if *v == nil { 11861 cv = []types.Fleet{} 11862 } else { 11863 cv = *v 11864 } 11865 11866 for _, value := range shape { 11867 var col types.Fleet 11868 destAddr := &col 11869 if err := awsRestjson1_deserializeDocumentFleet(&destAddr, value); err != nil { 11870 return err 11871 } 11872 col = *destAddr 11873 cv = append(cv, col) 11874 11875 } 11876 *v = cv 11877 return nil 11878} 11879 11880func awsRestjson1_deserializeDocumentIdempotentParameterMismatchException(v **types.IdempotentParameterMismatchException, value interface{}) error { 11881 if v == nil { 11882 return fmt.Errorf("unexpected nil of type %T", v) 11883 } 11884 if value == nil { 11885 return nil 11886 } 11887 11888 shape, ok := value.(map[string]interface{}) 11889 if !ok { 11890 return fmt.Errorf("unexpected JSON type %v", value) 11891 } 11892 11893 var sv *types.IdempotentParameterMismatchException 11894 if *v == nil { 11895 sv = &types.IdempotentParameterMismatchException{} 11896 } else { 11897 sv = *v 11898 } 11899 11900 for key, value := range shape { 11901 switch key { 11902 case "message": 11903 if value != nil { 11904 jtv, ok := value.(string) 11905 if !ok { 11906 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 11907 } 11908 sv.Message = ptr.String(jtv) 11909 } 11910 11911 default: 11912 _, _ = key, value 11913 11914 } 11915 } 11916 *v = sv 11917 return nil 11918} 11919 11920func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 11921 if v == nil { 11922 return fmt.Errorf("unexpected nil of type %T", v) 11923 } 11924 if value == nil { 11925 return nil 11926 } 11927 11928 shape, ok := value.(map[string]interface{}) 11929 if !ok { 11930 return fmt.Errorf("unexpected JSON type %v", value) 11931 } 11932 11933 var sv *types.InternalServerException 11934 if *v == nil { 11935 sv = &types.InternalServerException{} 11936 } else { 11937 sv = *v 11938 } 11939 11940 for key, value := range shape { 11941 switch key { 11942 case "message": 11943 if value != nil { 11944 jtv, ok := value.(string) 11945 if !ok { 11946 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 11947 } 11948 sv.Message = ptr.String(jtv) 11949 } 11950 11951 default: 11952 _, _ = key, value 11953 11954 } 11955 } 11956 *v = sv 11957 return nil 11958} 11959 11960func awsRestjson1_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error { 11961 if v == nil { 11962 return fmt.Errorf("unexpected nil of type %T", v) 11963 } 11964 if value == nil { 11965 return nil 11966 } 11967 11968 shape, ok := value.(map[string]interface{}) 11969 if !ok { 11970 return fmt.Errorf("unexpected JSON type %v", value) 11971 } 11972 11973 var sv *types.InvalidParameterException 11974 if *v == nil { 11975 sv = &types.InvalidParameterException{} 11976 } else { 11977 sv = *v 11978 } 11979 11980 for key, value := range shape { 11981 switch key { 11982 case "message": 11983 if value != nil { 11984 jtv, ok := value.(string) 11985 if !ok { 11986 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 11987 } 11988 sv.Message = ptr.String(jtv) 11989 } 11990 11991 default: 11992 _, _ = key, value 11993 11994 } 11995 } 11996 *v = sv 11997 return nil 11998} 11999 12000func awsRestjson1_deserializeDocumentLaunchConfig(v **types.LaunchConfig, 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.LaunchConfig 12014 if *v == nil { 12015 sv = &types.LaunchConfig{} 12016 } else { 12017 sv = *v 12018 } 12019 12020 for key, value := range shape { 12021 switch key { 12022 case "environmentVariables": 12023 if err := awsRestjson1_deserializeDocumentEnvironmentVariableMap(&sv.EnvironmentVariables, value); err != nil { 12024 return err 12025 } 12026 12027 case "launchFile": 12028 if value != nil { 12029 jtv, ok := value.(string) 12030 if !ok { 12031 return fmt.Errorf("expected Command to be of type string, got %T instead", value) 12032 } 12033 sv.LaunchFile = ptr.String(jtv) 12034 } 12035 12036 case "packageName": 12037 if value != nil { 12038 jtv, ok := value.(string) 12039 if !ok { 12040 return fmt.Errorf("expected Command to be of type string, got %T instead", value) 12041 } 12042 sv.PackageName = ptr.String(jtv) 12043 } 12044 12045 case "portForwardingConfig": 12046 if err := awsRestjson1_deserializeDocumentPortForwardingConfig(&sv.PortForwardingConfig, value); err != nil { 12047 return err 12048 } 12049 12050 case "streamUI": 12051 if value != nil { 12052 jtv, ok := value.(bool) 12053 if !ok { 12054 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 12055 } 12056 sv.StreamUI = jtv 12057 } 12058 12059 default: 12060 _, _ = key, value 12061 12062 } 12063 } 12064 *v = sv 12065 return nil 12066} 12067 12068func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 12069 if v == nil { 12070 return fmt.Errorf("unexpected nil of type %T", v) 12071 } 12072 if value == nil { 12073 return nil 12074 } 12075 12076 shape, ok := value.(map[string]interface{}) 12077 if !ok { 12078 return fmt.Errorf("unexpected JSON type %v", value) 12079 } 12080 12081 var sv *types.LimitExceededException 12082 if *v == nil { 12083 sv = &types.LimitExceededException{} 12084 } else { 12085 sv = *v 12086 } 12087 12088 for key, value := range shape { 12089 switch key { 12090 case "message": 12091 if value != nil { 12092 jtv, ok := value.(string) 12093 if !ok { 12094 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 12095 } 12096 sv.Message = ptr.String(jtv) 12097 } 12098 12099 default: 12100 _, _ = key, value 12101 12102 } 12103 } 12104 *v = sv 12105 return nil 12106} 12107 12108func awsRestjson1_deserializeDocumentLoggingConfig(v **types.LoggingConfig, value interface{}) error { 12109 if v == nil { 12110 return fmt.Errorf("unexpected nil of type %T", v) 12111 } 12112 if value == nil { 12113 return nil 12114 } 12115 12116 shape, ok := value.(map[string]interface{}) 12117 if !ok { 12118 return fmt.Errorf("unexpected JSON type %v", value) 12119 } 12120 12121 var sv *types.LoggingConfig 12122 if *v == nil { 12123 sv = &types.LoggingConfig{} 12124 } else { 12125 sv = *v 12126 } 12127 12128 for key, value := range shape { 12129 switch key { 12130 case "recordAllRosTopics": 12131 if value != nil { 12132 jtv, ok := value.(bool) 12133 if !ok { 12134 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 12135 } 12136 sv.RecordAllRosTopics = ptr.Bool(jtv) 12137 } 12138 12139 default: 12140 _, _ = key, value 12141 12142 } 12143 } 12144 *v = sv 12145 return nil 12146} 12147 12148func awsRestjson1_deserializeDocumentNetworkInterface(v **types.NetworkInterface, value interface{}) error { 12149 if v == nil { 12150 return fmt.Errorf("unexpected nil of type %T", v) 12151 } 12152 if value == nil { 12153 return nil 12154 } 12155 12156 shape, ok := value.(map[string]interface{}) 12157 if !ok { 12158 return fmt.Errorf("unexpected JSON type %v", value) 12159 } 12160 12161 var sv *types.NetworkInterface 12162 if *v == nil { 12163 sv = &types.NetworkInterface{} 12164 } else { 12165 sv = *v 12166 } 12167 12168 for key, value := range shape { 12169 switch key { 12170 case "networkInterfaceId": 12171 if value != nil { 12172 jtv, ok := value.(string) 12173 if !ok { 12174 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 12175 } 12176 sv.NetworkInterfaceId = ptr.String(jtv) 12177 } 12178 12179 case "privateIpAddress": 12180 if value != nil { 12181 jtv, ok := value.(string) 12182 if !ok { 12183 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 12184 } 12185 sv.PrivateIpAddress = ptr.String(jtv) 12186 } 12187 12188 case "publicIpAddress": 12189 if value != nil { 12190 jtv, ok := value.(string) 12191 if !ok { 12192 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 12193 } 12194 sv.PublicIpAddress = ptr.String(jtv) 12195 } 12196 12197 default: 12198 _, _ = key, value 12199 12200 } 12201 } 12202 *v = sv 12203 return nil 12204} 12205 12206func awsRestjson1_deserializeDocumentOutputLocation(v **types.OutputLocation, value interface{}) error { 12207 if v == nil { 12208 return fmt.Errorf("unexpected nil of type %T", v) 12209 } 12210 if value == nil { 12211 return nil 12212 } 12213 12214 shape, ok := value.(map[string]interface{}) 12215 if !ok { 12216 return fmt.Errorf("unexpected JSON type %v", value) 12217 } 12218 12219 var sv *types.OutputLocation 12220 if *v == nil { 12221 sv = &types.OutputLocation{} 12222 } else { 12223 sv = *v 12224 } 12225 12226 for key, value := range shape { 12227 switch key { 12228 case "s3Bucket": 12229 if value != nil { 12230 jtv, ok := value.(string) 12231 if !ok { 12232 return fmt.Errorf("expected S3Bucket to be of type string, got %T instead", value) 12233 } 12234 sv.S3Bucket = ptr.String(jtv) 12235 } 12236 12237 case "s3Prefix": 12238 if value != nil { 12239 jtv, ok := value.(string) 12240 if !ok { 12241 return fmt.Errorf("expected S3Key to be of type string, got %T instead", value) 12242 } 12243 sv.S3Prefix = ptr.String(jtv) 12244 } 12245 12246 default: 12247 _, _ = key, value 12248 12249 } 12250 } 12251 *v = sv 12252 return nil 12253} 12254 12255func awsRestjson1_deserializeDocumentPortForwardingConfig(v **types.PortForwardingConfig, value interface{}) error { 12256 if v == nil { 12257 return fmt.Errorf("unexpected nil of type %T", v) 12258 } 12259 if value == nil { 12260 return nil 12261 } 12262 12263 shape, ok := value.(map[string]interface{}) 12264 if !ok { 12265 return fmt.Errorf("unexpected JSON type %v", value) 12266 } 12267 12268 var sv *types.PortForwardingConfig 12269 if *v == nil { 12270 sv = &types.PortForwardingConfig{} 12271 } else { 12272 sv = *v 12273 } 12274 12275 for key, value := range shape { 12276 switch key { 12277 case "portMappings": 12278 if err := awsRestjson1_deserializeDocumentPortMappingList(&sv.PortMappings, value); err != nil { 12279 return err 12280 } 12281 12282 default: 12283 _, _ = key, value 12284 12285 } 12286 } 12287 *v = sv 12288 return nil 12289} 12290 12291func awsRestjson1_deserializeDocumentPortMapping(v **types.PortMapping, value interface{}) error { 12292 if v == nil { 12293 return fmt.Errorf("unexpected nil of type %T", v) 12294 } 12295 if value == nil { 12296 return nil 12297 } 12298 12299 shape, ok := value.(map[string]interface{}) 12300 if !ok { 12301 return fmt.Errorf("unexpected JSON type %v", value) 12302 } 12303 12304 var sv *types.PortMapping 12305 if *v == nil { 12306 sv = &types.PortMapping{} 12307 } else { 12308 sv = *v 12309 } 12310 12311 for key, value := range shape { 12312 switch key { 12313 case "applicationPort": 12314 if value != nil { 12315 jtv, ok := value.(json.Number) 12316 if !ok { 12317 return fmt.Errorf("expected NonSystemPort to be json.Number, got %T instead", value) 12318 } 12319 i64, err := jtv.Int64() 12320 if err != nil { 12321 return err 12322 } 12323 sv.ApplicationPort = int32(i64) 12324 } 12325 12326 case "enableOnPublicIp": 12327 if value != nil { 12328 jtv, ok := value.(bool) 12329 if !ok { 12330 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 12331 } 12332 sv.EnableOnPublicIp = jtv 12333 } 12334 12335 case "jobPort": 12336 if value != nil { 12337 jtv, ok := value.(json.Number) 12338 if !ok { 12339 return fmt.Errorf("expected Port to be json.Number, got %T instead", value) 12340 } 12341 i64, err := jtv.Int64() 12342 if err != nil { 12343 return err 12344 } 12345 sv.JobPort = int32(i64) 12346 } 12347 12348 default: 12349 _, _ = key, value 12350 12351 } 12352 } 12353 *v = sv 12354 return nil 12355} 12356 12357func awsRestjson1_deserializeDocumentPortMappingList(v *[]types.PortMapping, value interface{}) error { 12358 if v == nil { 12359 return fmt.Errorf("unexpected nil of type %T", v) 12360 } 12361 if value == nil { 12362 return nil 12363 } 12364 12365 shape, ok := value.([]interface{}) 12366 if !ok { 12367 return fmt.Errorf("unexpected JSON type %v", value) 12368 } 12369 12370 var cv []types.PortMapping 12371 if *v == nil { 12372 cv = []types.PortMapping{} 12373 } else { 12374 cv = *v 12375 } 12376 12377 for _, value := range shape { 12378 var col types.PortMapping 12379 destAddr := &col 12380 if err := awsRestjson1_deserializeDocumentPortMapping(&destAddr, value); err != nil { 12381 return err 12382 } 12383 col = *destAddr 12384 cv = append(cv, col) 12385 12386 } 12387 *v = cv 12388 return nil 12389} 12390 12391func awsRestjson1_deserializeDocumentProgressDetail(v **types.ProgressDetail, value interface{}) error { 12392 if v == nil { 12393 return fmt.Errorf("unexpected nil of type %T", v) 12394 } 12395 if value == nil { 12396 return nil 12397 } 12398 12399 shape, ok := value.(map[string]interface{}) 12400 if !ok { 12401 return fmt.Errorf("unexpected JSON type %v", value) 12402 } 12403 12404 var sv *types.ProgressDetail 12405 if *v == nil { 12406 sv = &types.ProgressDetail{} 12407 } else { 12408 sv = *v 12409 } 12410 12411 for key, value := range shape { 12412 switch key { 12413 case "currentProgress": 12414 if value != nil { 12415 jtv, ok := value.(string) 12416 if !ok { 12417 return fmt.Errorf("expected RobotDeploymentStep to be of type string, got %T instead", value) 12418 } 12419 sv.CurrentProgress = types.RobotDeploymentStep(jtv) 12420 } 12421 12422 case "estimatedTimeRemainingSeconds": 12423 if value != nil { 12424 jtv, ok := value.(json.Number) 12425 if !ok { 12426 return fmt.Errorf("expected GenericInteger to be json.Number, got %T instead", value) 12427 } 12428 i64, err := jtv.Int64() 12429 if err != nil { 12430 return err 12431 } 12432 sv.EstimatedTimeRemainingSeconds = ptr.Int32(int32(i64)) 12433 } 12434 12435 case "percentDone": 12436 if value != nil { 12437 switch jtv := value.(type) { 12438 case json.Number: 12439 f64, err := jtv.Float64() 12440 if err != nil { 12441 return err 12442 } 12443 sv.PercentDone = ptr.Float32(float32(f64)) 12444 12445 case string: 12446 var f64 float64 12447 switch { 12448 case strings.EqualFold(jtv, "NaN"): 12449 f64 = math.NaN() 12450 12451 case strings.EqualFold(jtv, "Infinity"): 12452 f64 = math.Inf(1) 12453 12454 case strings.EqualFold(jtv, "-Infinity"): 12455 f64 = math.Inf(-1) 12456 12457 default: 12458 return fmt.Errorf("unknown JSON number value: %s", jtv) 12459 12460 } 12461 sv.PercentDone = ptr.Float32(float32(f64)) 12462 12463 default: 12464 return fmt.Errorf("expected PercentDone to be a JSON Number, got %T instead", value) 12465 12466 } 12467 } 12468 12469 case "targetResource": 12470 if value != nil { 12471 jtv, ok := value.(string) 12472 if !ok { 12473 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 12474 } 12475 sv.TargetResource = ptr.String(jtv) 12476 } 12477 12478 default: 12479 _, _ = key, value 12480 12481 } 12482 } 12483 *v = sv 12484 return nil 12485} 12486 12487func awsRestjson1_deserializeDocumentRenderingEngine(v **types.RenderingEngine, value interface{}) error { 12488 if v == nil { 12489 return fmt.Errorf("unexpected nil of type %T", v) 12490 } 12491 if value == nil { 12492 return nil 12493 } 12494 12495 shape, ok := value.(map[string]interface{}) 12496 if !ok { 12497 return fmt.Errorf("unexpected JSON type %v", value) 12498 } 12499 12500 var sv *types.RenderingEngine 12501 if *v == nil { 12502 sv = &types.RenderingEngine{} 12503 } else { 12504 sv = *v 12505 } 12506 12507 for key, value := range shape { 12508 switch key { 12509 case "name": 12510 if value != nil { 12511 jtv, ok := value.(string) 12512 if !ok { 12513 return fmt.Errorf("expected RenderingEngineType to be of type string, got %T instead", value) 12514 } 12515 sv.Name = types.RenderingEngineType(jtv) 12516 } 12517 12518 case "version": 12519 if value != nil { 12520 jtv, ok := value.(string) 12521 if !ok { 12522 return fmt.Errorf("expected RenderingEngineVersionType to be of type string, got %T instead", value) 12523 } 12524 sv.Version = ptr.String(jtv) 12525 } 12526 12527 default: 12528 _, _ = key, value 12529 12530 } 12531 } 12532 *v = sv 12533 return nil 12534} 12535 12536func awsRestjson1_deserializeDocumentResourceAlreadyExistsException(v **types.ResourceAlreadyExistsException, 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.ResourceAlreadyExistsException 12550 if *v == nil { 12551 sv = &types.ResourceAlreadyExistsException{} 12552 } else { 12553 sv = *v 12554 } 12555 12556 for key, value := range shape { 12557 switch key { 12558 case "message": 12559 if value != nil { 12560 jtv, ok := value.(string) 12561 if !ok { 12562 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 12563 } 12564 sv.Message = ptr.String(jtv) 12565 } 12566 12567 default: 12568 _, _ = key, value 12569 12570 } 12571 } 12572 *v = sv 12573 return nil 12574} 12575 12576func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 12577 if v == nil { 12578 return fmt.Errorf("unexpected nil of type %T", v) 12579 } 12580 if value == nil { 12581 return nil 12582 } 12583 12584 shape, ok := value.(map[string]interface{}) 12585 if !ok { 12586 return fmt.Errorf("unexpected JSON type %v", value) 12587 } 12588 12589 var sv *types.ResourceNotFoundException 12590 if *v == nil { 12591 sv = &types.ResourceNotFoundException{} 12592 } else { 12593 sv = *v 12594 } 12595 12596 for key, value := range shape { 12597 switch key { 12598 case "message": 12599 if value != nil { 12600 jtv, ok := value.(string) 12601 if !ok { 12602 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 12603 } 12604 sv.Message = ptr.String(jtv) 12605 } 12606 12607 default: 12608 _, _ = key, value 12609 12610 } 12611 } 12612 *v = sv 12613 return nil 12614} 12615 12616func awsRestjson1_deserializeDocumentRobot(v **types.Robot, value interface{}) error { 12617 if v == nil { 12618 return fmt.Errorf("unexpected nil of type %T", v) 12619 } 12620 if value == nil { 12621 return nil 12622 } 12623 12624 shape, ok := value.(map[string]interface{}) 12625 if !ok { 12626 return fmt.Errorf("unexpected JSON type %v", value) 12627 } 12628 12629 var sv *types.Robot 12630 if *v == nil { 12631 sv = &types.Robot{} 12632 } else { 12633 sv = *v 12634 } 12635 12636 for key, value := range shape { 12637 switch key { 12638 case "architecture": 12639 if value != nil { 12640 jtv, ok := value.(string) 12641 if !ok { 12642 return fmt.Errorf("expected Architecture to be of type string, got %T instead", value) 12643 } 12644 sv.Architecture = types.Architecture(jtv) 12645 } 12646 12647 case "arn": 12648 if value != nil { 12649 jtv, ok := value.(string) 12650 if !ok { 12651 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 12652 } 12653 sv.Arn = ptr.String(jtv) 12654 } 12655 12656 case "createdAt": 12657 if value != nil { 12658 switch jtv := value.(type) { 12659 case json.Number: 12660 f64, err := jtv.Float64() 12661 if err != nil { 12662 return err 12663 } 12664 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12665 12666 default: 12667 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 12668 12669 } 12670 } 12671 12672 case "fleetArn": 12673 if value != nil { 12674 jtv, ok := value.(string) 12675 if !ok { 12676 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 12677 } 12678 sv.FleetArn = ptr.String(jtv) 12679 } 12680 12681 case "greenGrassGroupId": 12682 if value != nil { 12683 jtv, ok := value.(string) 12684 if !ok { 12685 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12686 } 12687 sv.GreenGrassGroupId = ptr.String(jtv) 12688 } 12689 12690 case "lastDeploymentJob": 12691 if value != nil { 12692 jtv, ok := value.(string) 12693 if !ok { 12694 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 12695 } 12696 sv.LastDeploymentJob = ptr.String(jtv) 12697 } 12698 12699 case "lastDeploymentTime": 12700 if value != nil { 12701 switch jtv := value.(type) { 12702 case json.Number: 12703 f64, err := jtv.Float64() 12704 if err != nil { 12705 return err 12706 } 12707 sv.LastDeploymentTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12708 12709 default: 12710 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 12711 12712 } 12713 } 12714 12715 case "name": 12716 if value != nil { 12717 jtv, ok := value.(string) 12718 if !ok { 12719 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 12720 } 12721 sv.Name = ptr.String(jtv) 12722 } 12723 12724 case "status": 12725 if value != nil { 12726 jtv, ok := value.(string) 12727 if !ok { 12728 return fmt.Errorf("expected RobotStatus to be of type string, got %T instead", value) 12729 } 12730 sv.Status = types.RobotStatus(jtv) 12731 } 12732 12733 default: 12734 _, _ = key, value 12735 12736 } 12737 } 12738 *v = sv 12739 return nil 12740} 12741 12742func awsRestjson1_deserializeDocumentRobotApplicationConfig(v **types.RobotApplicationConfig, value interface{}) error { 12743 if v == nil { 12744 return fmt.Errorf("unexpected nil of type %T", v) 12745 } 12746 if value == nil { 12747 return nil 12748 } 12749 12750 shape, ok := value.(map[string]interface{}) 12751 if !ok { 12752 return fmt.Errorf("unexpected JSON type %v", value) 12753 } 12754 12755 var sv *types.RobotApplicationConfig 12756 if *v == nil { 12757 sv = &types.RobotApplicationConfig{} 12758 } else { 12759 sv = *v 12760 } 12761 12762 for key, value := range shape { 12763 switch key { 12764 case "application": 12765 if value != nil { 12766 jtv, ok := value.(string) 12767 if !ok { 12768 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 12769 } 12770 sv.Application = ptr.String(jtv) 12771 } 12772 12773 case "applicationVersion": 12774 if value != nil { 12775 jtv, ok := value.(string) 12776 if !ok { 12777 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 12778 } 12779 sv.ApplicationVersion = ptr.String(jtv) 12780 } 12781 12782 case "launchConfig": 12783 if err := awsRestjson1_deserializeDocumentLaunchConfig(&sv.LaunchConfig, value); err != nil { 12784 return err 12785 } 12786 12787 case "tools": 12788 if err := awsRestjson1_deserializeDocumentTools(&sv.Tools, value); err != nil { 12789 return err 12790 } 12791 12792 case "uploadConfigurations": 12793 if err := awsRestjson1_deserializeDocumentUploadConfigurations(&sv.UploadConfigurations, value); err != nil { 12794 return err 12795 } 12796 12797 case "useDefaultTools": 12798 if value != nil { 12799 jtv, ok := value.(bool) 12800 if !ok { 12801 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 12802 } 12803 sv.UseDefaultTools = ptr.Bool(jtv) 12804 } 12805 12806 case "useDefaultUploadConfigurations": 12807 if value != nil { 12808 jtv, ok := value.(bool) 12809 if !ok { 12810 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 12811 } 12812 sv.UseDefaultUploadConfigurations = ptr.Bool(jtv) 12813 } 12814 12815 default: 12816 _, _ = key, value 12817 12818 } 12819 } 12820 *v = sv 12821 return nil 12822} 12823 12824func awsRestjson1_deserializeDocumentRobotApplicationConfigs(v *[]types.RobotApplicationConfig, value interface{}) error { 12825 if v == nil { 12826 return fmt.Errorf("unexpected nil of type %T", v) 12827 } 12828 if value == nil { 12829 return nil 12830 } 12831 12832 shape, ok := value.([]interface{}) 12833 if !ok { 12834 return fmt.Errorf("unexpected JSON type %v", value) 12835 } 12836 12837 var cv []types.RobotApplicationConfig 12838 if *v == nil { 12839 cv = []types.RobotApplicationConfig{} 12840 } else { 12841 cv = *v 12842 } 12843 12844 for _, value := range shape { 12845 var col types.RobotApplicationConfig 12846 destAddr := &col 12847 if err := awsRestjson1_deserializeDocumentRobotApplicationConfig(&destAddr, value); err != nil { 12848 return err 12849 } 12850 col = *destAddr 12851 cv = append(cv, col) 12852 12853 } 12854 *v = cv 12855 return nil 12856} 12857 12858func awsRestjson1_deserializeDocumentRobotApplicationNames(v *[]string, value interface{}) error { 12859 if v == nil { 12860 return fmt.Errorf("unexpected nil of type %T", v) 12861 } 12862 if value == nil { 12863 return nil 12864 } 12865 12866 shape, ok := value.([]interface{}) 12867 if !ok { 12868 return fmt.Errorf("unexpected JSON type %v", value) 12869 } 12870 12871 var cv []string 12872 if *v == nil { 12873 cv = []string{} 12874 } else { 12875 cv = *v 12876 } 12877 12878 for _, value := range shape { 12879 var col string 12880 if value != nil { 12881 jtv, ok := value.(string) 12882 if !ok { 12883 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 12884 } 12885 col = jtv 12886 } 12887 cv = append(cv, col) 12888 12889 } 12890 *v = cv 12891 return nil 12892} 12893 12894func awsRestjson1_deserializeDocumentRobotApplicationSummaries(v *[]types.RobotApplicationSummary, value interface{}) error { 12895 if v == nil { 12896 return fmt.Errorf("unexpected nil of type %T", v) 12897 } 12898 if value == nil { 12899 return nil 12900 } 12901 12902 shape, ok := value.([]interface{}) 12903 if !ok { 12904 return fmt.Errorf("unexpected JSON type %v", value) 12905 } 12906 12907 var cv []types.RobotApplicationSummary 12908 if *v == nil { 12909 cv = []types.RobotApplicationSummary{} 12910 } else { 12911 cv = *v 12912 } 12913 12914 for _, value := range shape { 12915 var col types.RobotApplicationSummary 12916 destAddr := &col 12917 if err := awsRestjson1_deserializeDocumentRobotApplicationSummary(&destAddr, value); err != nil { 12918 return err 12919 } 12920 col = *destAddr 12921 cv = append(cv, col) 12922 12923 } 12924 *v = cv 12925 return nil 12926} 12927 12928func awsRestjson1_deserializeDocumentRobotApplicationSummary(v **types.RobotApplicationSummary, value interface{}) error { 12929 if v == nil { 12930 return fmt.Errorf("unexpected nil of type %T", v) 12931 } 12932 if value == nil { 12933 return nil 12934 } 12935 12936 shape, ok := value.(map[string]interface{}) 12937 if !ok { 12938 return fmt.Errorf("unexpected JSON type %v", value) 12939 } 12940 12941 var sv *types.RobotApplicationSummary 12942 if *v == nil { 12943 sv = &types.RobotApplicationSummary{} 12944 } else { 12945 sv = *v 12946 } 12947 12948 for key, value := range shape { 12949 switch key { 12950 case "arn": 12951 if value != nil { 12952 jtv, ok := value.(string) 12953 if !ok { 12954 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 12955 } 12956 sv.Arn = ptr.String(jtv) 12957 } 12958 12959 case "lastUpdatedAt": 12960 if value != nil { 12961 switch jtv := value.(type) { 12962 case json.Number: 12963 f64, err := jtv.Float64() 12964 if err != nil { 12965 return err 12966 } 12967 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12968 12969 default: 12970 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 12971 12972 } 12973 } 12974 12975 case "name": 12976 if value != nil { 12977 jtv, ok := value.(string) 12978 if !ok { 12979 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 12980 } 12981 sv.Name = ptr.String(jtv) 12982 } 12983 12984 case "robotSoftwareSuite": 12985 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 12986 return err 12987 } 12988 12989 case "version": 12990 if value != nil { 12991 jtv, ok := value.(string) 12992 if !ok { 12993 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 12994 } 12995 sv.Version = ptr.String(jtv) 12996 } 12997 12998 default: 12999 _, _ = key, value 13000 13001 } 13002 } 13003 *v = sv 13004 return nil 13005} 13006 13007func awsRestjson1_deserializeDocumentRobotDeployment(v **types.RobotDeployment, value interface{}) error { 13008 if v == nil { 13009 return fmt.Errorf("unexpected nil of type %T", v) 13010 } 13011 if value == nil { 13012 return nil 13013 } 13014 13015 shape, ok := value.(map[string]interface{}) 13016 if !ok { 13017 return fmt.Errorf("unexpected JSON type %v", value) 13018 } 13019 13020 var sv *types.RobotDeployment 13021 if *v == nil { 13022 sv = &types.RobotDeployment{} 13023 } else { 13024 sv = *v 13025 } 13026 13027 for key, value := range shape { 13028 switch key { 13029 case "arn": 13030 if value != nil { 13031 jtv, ok := value.(string) 13032 if !ok { 13033 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13034 } 13035 sv.Arn = ptr.String(jtv) 13036 } 13037 13038 case "deploymentFinishTime": 13039 if value != nil { 13040 switch jtv := value.(type) { 13041 case json.Number: 13042 f64, err := jtv.Float64() 13043 if err != nil { 13044 return err 13045 } 13046 sv.DeploymentFinishTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13047 13048 default: 13049 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 13050 13051 } 13052 } 13053 13054 case "deploymentStartTime": 13055 if value != nil { 13056 switch jtv := value.(type) { 13057 case json.Number: 13058 f64, err := jtv.Float64() 13059 if err != nil { 13060 return err 13061 } 13062 sv.DeploymentStartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13063 13064 default: 13065 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 13066 13067 } 13068 } 13069 13070 case "failureCode": 13071 if value != nil { 13072 jtv, ok := value.(string) 13073 if !ok { 13074 return fmt.Errorf("expected DeploymentJobErrorCode to be of type string, got %T instead", value) 13075 } 13076 sv.FailureCode = types.DeploymentJobErrorCode(jtv) 13077 } 13078 13079 case "failureReason": 13080 if value != nil { 13081 jtv, ok := value.(string) 13082 if !ok { 13083 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 13084 } 13085 sv.FailureReason = ptr.String(jtv) 13086 } 13087 13088 case "progressDetail": 13089 if err := awsRestjson1_deserializeDocumentProgressDetail(&sv.ProgressDetail, value); err != nil { 13090 return err 13091 } 13092 13093 case "status": 13094 if value != nil { 13095 jtv, ok := value.(string) 13096 if !ok { 13097 return fmt.Errorf("expected RobotStatus to be of type string, got %T instead", value) 13098 } 13099 sv.Status = types.RobotStatus(jtv) 13100 } 13101 13102 default: 13103 _, _ = key, value 13104 13105 } 13106 } 13107 *v = sv 13108 return nil 13109} 13110 13111func awsRestjson1_deserializeDocumentRobotDeploymentSummary(v *[]types.RobotDeployment, value interface{}) error { 13112 if v == nil { 13113 return fmt.Errorf("unexpected nil of type %T", v) 13114 } 13115 if value == nil { 13116 return nil 13117 } 13118 13119 shape, ok := value.([]interface{}) 13120 if !ok { 13121 return fmt.Errorf("unexpected JSON type %v", value) 13122 } 13123 13124 var cv []types.RobotDeployment 13125 if *v == nil { 13126 cv = []types.RobotDeployment{} 13127 } else { 13128 cv = *v 13129 } 13130 13131 for _, value := range shape { 13132 var col types.RobotDeployment 13133 destAddr := &col 13134 if err := awsRestjson1_deserializeDocumentRobotDeployment(&destAddr, value); err != nil { 13135 return err 13136 } 13137 col = *destAddr 13138 cv = append(cv, col) 13139 13140 } 13141 *v = cv 13142 return nil 13143} 13144 13145func awsRestjson1_deserializeDocumentRobots(v *[]types.Robot, value interface{}) error { 13146 if v == nil { 13147 return fmt.Errorf("unexpected nil of type %T", v) 13148 } 13149 if value == nil { 13150 return nil 13151 } 13152 13153 shape, ok := value.([]interface{}) 13154 if !ok { 13155 return fmt.Errorf("unexpected JSON type %v", value) 13156 } 13157 13158 var cv []types.Robot 13159 if *v == nil { 13160 cv = []types.Robot{} 13161 } else { 13162 cv = *v 13163 } 13164 13165 for _, value := range shape { 13166 var col types.Robot 13167 destAddr := &col 13168 if err := awsRestjson1_deserializeDocumentRobot(&destAddr, value); err != nil { 13169 return err 13170 } 13171 col = *destAddr 13172 cv = append(cv, col) 13173 13174 } 13175 *v = cv 13176 return nil 13177} 13178 13179func awsRestjson1_deserializeDocumentRobotSoftwareSuite(v **types.RobotSoftwareSuite, value interface{}) error { 13180 if v == nil { 13181 return fmt.Errorf("unexpected nil of type %T", v) 13182 } 13183 if value == nil { 13184 return nil 13185 } 13186 13187 shape, ok := value.(map[string]interface{}) 13188 if !ok { 13189 return fmt.Errorf("unexpected JSON type %v", value) 13190 } 13191 13192 var sv *types.RobotSoftwareSuite 13193 if *v == nil { 13194 sv = &types.RobotSoftwareSuite{} 13195 } else { 13196 sv = *v 13197 } 13198 13199 for key, value := range shape { 13200 switch key { 13201 case "name": 13202 if value != nil { 13203 jtv, ok := value.(string) 13204 if !ok { 13205 return fmt.Errorf("expected RobotSoftwareSuiteType to be of type string, got %T instead", value) 13206 } 13207 sv.Name = types.RobotSoftwareSuiteType(jtv) 13208 } 13209 13210 case "version": 13211 if value != nil { 13212 jtv, ok := value.(string) 13213 if !ok { 13214 return fmt.Errorf("expected RobotSoftwareSuiteVersionType to be of type string, got %T instead", value) 13215 } 13216 sv.Version = types.RobotSoftwareSuiteVersionType(jtv) 13217 } 13218 13219 default: 13220 _, _ = key, value 13221 13222 } 13223 } 13224 *v = sv 13225 return nil 13226} 13227 13228func awsRestjson1_deserializeDocumentS3KeyOutput(v **types.S3KeyOutput, value interface{}) error { 13229 if v == nil { 13230 return fmt.Errorf("unexpected nil of type %T", v) 13231 } 13232 if value == nil { 13233 return nil 13234 } 13235 13236 shape, ok := value.(map[string]interface{}) 13237 if !ok { 13238 return fmt.Errorf("unexpected JSON type %v", value) 13239 } 13240 13241 var sv *types.S3KeyOutput 13242 if *v == nil { 13243 sv = &types.S3KeyOutput{} 13244 } else { 13245 sv = *v 13246 } 13247 13248 for key, value := range shape { 13249 switch key { 13250 case "etag": 13251 if value != nil { 13252 jtv, ok := value.(string) 13253 if !ok { 13254 return fmt.Errorf("expected S3Etag to be of type string, got %T instead", value) 13255 } 13256 sv.Etag = ptr.String(jtv) 13257 } 13258 13259 case "s3Key": 13260 if value != nil { 13261 jtv, ok := value.(string) 13262 if !ok { 13263 return fmt.Errorf("expected S3Key to be of type string, got %T instead", value) 13264 } 13265 sv.S3Key = ptr.String(jtv) 13266 } 13267 13268 default: 13269 _, _ = key, value 13270 13271 } 13272 } 13273 *v = sv 13274 return nil 13275} 13276 13277func awsRestjson1_deserializeDocumentS3KeyOutputs(v *[]types.S3KeyOutput, value interface{}) error { 13278 if v == nil { 13279 return fmt.Errorf("unexpected nil of type %T", v) 13280 } 13281 if value == nil { 13282 return nil 13283 } 13284 13285 shape, ok := value.([]interface{}) 13286 if !ok { 13287 return fmt.Errorf("unexpected JSON type %v", value) 13288 } 13289 13290 var cv []types.S3KeyOutput 13291 if *v == nil { 13292 cv = []types.S3KeyOutput{} 13293 } else { 13294 cv = *v 13295 } 13296 13297 for _, value := range shape { 13298 var col types.S3KeyOutput 13299 destAddr := &col 13300 if err := awsRestjson1_deserializeDocumentS3KeyOutput(&destAddr, value); err != nil { 13301 return err 13302 } 13303 col = *destAddr 13304 cv = append(cv, col) 13305 13306 } 13307 *v = cv 13308 return nil 13309} 13310 13311func awsRestjson1_deserializeDocumentS3Keys(v *[]string, value interface{}) error { 13312 if v == nil { 13313 return fmt.Errorf("unexpected nil of type %T", v) 13314 } 13315 if value == nil { 13316 return nil 13317 } 13318 13319 shape, ok := value.([]interface{}) 13320 if !ok { 13321 return fmt.Errorf("unexpected JSON type %v", value) 13322 } 13323 13324 var cv []string 13325 if *v == nil { 13326 cv = []string{} 13327 } else { 13328 cv = *v 13329 } 13330 13331 for _, value := range shape { 13332 var col string 13333 if value != nil { 13334 jtv, ok := value.(string) 13335 if !ok { 13336 return fmt.Errorf("expected S3Key to be of type string, got %T instead", value) 13337 } 13338 col = jtv 13339 } 13340 cv = append(cv, col) 13341 13342 } 13343 *v = cv 13344 return nil 13345} 13346 13347func awsRestjson1_deserializeDocumentS3Object(v **types.S3Object, value interface{}) error { 13348 if v == nil { 13349 return fmt.Errorf("unexpected nil of type %T", v) 13350 } 13351 if value == nil { 13352 return nil 13353 } 13354 13355 shape, ok := value.(map[string]interface{}) 13356 if !ok { 13357 return fmt.Errorf("unexpected JSON type %v", value) 13358 } 13359 13360 var sv *types.S3Object 13361 if *v == nil { 13362 sv = &types.S3Object{} 13363 } else { 13364 sv = *v 13365 } 13366 13367 for key, value := range shape { 13368 switch key { 13369 case "bucket": 13370 if value != nil { 13371 jtv, ok := value.(string) 13372 if !ok { 13373 return fmt.Errorf("expected S3Bucket to be of type string, got %T instead", value) 13374 } 13375 sv.Bucket = ptr.String(jtv) 13376 } 13377 13378 case "etag": 13379 if value != nil { 13380 jtv, ok := value.(string) 13381 if !ok { 13382 return fmt.Errorf("expected S3Etag to be of type string, got %T instead", value) 13383 } 13384 sv.Etag = ptr.String(jtv) 13385 } 13386 13387 case "key": 13388 if value != nil { 13389 jtv, ok := value.(string) 13390 if !ok { 13391 return fmt.Errorf("expected S3Key to be of type string, got %T instead", value) 13392 } 13393 sv.Key = ptr.String(jtv) 13394 } 13395 13396 default: 13397 _, _ = key, value 13398 13399 } 13400 } 13401 *v = sv 13402 return nil 13403} 13404 13405func awsRestjson1_deserializeDocumentSecurityGroups(v *[]string, value interface{}) error { 13406 if v == nil { 13407 return fmt.Errorf("unexpected nil of type %T", v) 13408 } 13409 if value == nil { 13410 return nil 13411 } 13412 13413 shape, ok := value.([]interface{}) 13414 if !ok { 13415 return fmt.Errorf("unexpected JSON type %v", value) 13416 } 13417 13418 var cv []string 13419 if *v == nil { 13420 cv = []string{} 13421 } else { 13422 cv = *v 13423 } 13424 13425 for _, value := range shape { 13426 var col string 13427 if value != nil { 13428 jtv, ok := value.(string) 13429 if !ok { 13430 return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) 13431 } 13432 col = jtv 13433 } 13434 cv = append(cv, col) 13435 13436 } 13437 *v = cv 13438 return nil 13439} 13440 13441func awsRestjson1_deserializeDocumentServiceUnavailableException(v **types.ServiceUnavailableException, value interface{}) error { 13442 if v == nil { 13443 return fmt.Errorf("unexpected nil of type %T", v) 13444 } 13445 if value == nil { 13446 return nil 13447 } 13448 13449 shape, ok := value.(map[string]interface{}) 13450 if !ok { 13451 return fmt.Errorf("unexpected JSON type %v", value) 13452 } 13453 13454 var sv *types.ServiceUnavailableException 13455 if *v == nil { 13456 sv = &types.ServiceUnavailableException{} 13457 } else { 13458 sv = *v 13459 } 13460 13461 for key, value := range shape { 13462 switch key { 13463 case "message": 13464 if value != nil { 13465 jtv, ok := value.(string) 13466 if !ok { 13467 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 13468 } 13469 sv.Message = ptr.String(jtv) 13470 } 13471 13472 default: 13473 _, _ = key, value 13474 13475 } 13476 } 13477 *v = sv 13478 return nil 13479} 13480 13481func awsRestjson1_deserializeDocumentSimulationApplicationConfig(v **types.SimulationApplicationConfig, value interface{}) error { 13482 if v == nil { 13483 return fmt.Errorf("unexpected nil of type %T", v) 13484 } 13485 if value == nil { 13486 return nil 13487 } 13488 13489 shape, ok := value.(map[string]interface{}) 13490 if !ok { 13491 return fmt.Errorf("unexpected JSON type %v", value) 13492 } 13493 13494 var sv *types.SimulationApplicationConfig 13495 if *v == nil { 13496 sv = &types.SimulationApplicationConfig{} 13497 } else { 13498 sv = *v 13499 } 13500 13501 for key, value := range shape { 13502 switch key { 13503 case "application": 13504 if value != nil { 13505 jtv, ok := value.(string) 13506 if !ok { 13507 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13508 } 13509 sv.Application = ptr.String(jtv) 13510 } 13511 13512 case "applicationVersion": 13513 if value != nil { 13514 jtv, ok := value.(string) 13515 if !ok { 13516 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 13517 } 13518 sv.ApplicationVersion = ptr.String(jtv) 13519 } 13520 13521 case "launchConfig": 13522 if err := awsRestjson1_deserializeDocumentLaunchConfig(&sv.LaunchConfig, value); err != nil { 13523 return err 13524 } 13525 13526 case "tools": 13527 if err := awsRestjson1_deserializeDocumentTools(&sv.Tools, value); err != nil { 13528 return err 13529 } 13530 13531 case "uploadConfigurations": 13532 if err := awsRestjson1_deserializeDocumentUploadConfigurations(&sv.UploadConfigurations, value); err != nil { 13533 return err 13534 } 13535 13536 case "useDefaultTools": 13537 if value != nil { 13538 jtv, ok := value.(bool) 13539 if !ok { 13540 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 13541 } 13542 sv.UseDefaultTools = ptr.Bool(jtv) 13543 } 13544 13545 case "useDefaultUploadConfigurations": 13546 if value != nil { 13547 jtv, ok := value.(bool) 13548 if !ok { 13549 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 13550 } 13551 sv.UseDefaultUploadConfigurations = ptr.Bool(jtv) 13552 } 13553 13554 case "worldConfigs": 13555 if err := awsRestjson1_deserializeDocumentWorldConfigs(&sv.WorldConfigs, value); err != nil { 13556 return err 13557 } 13558 13559 default: 13560 _, _ = key, value 13561 13562 } 13563 } 13564 *v = sv 13565 return nil 13566} 13567 13568func awsRestjson1_deserializeDocumentSimulationApplicationConfigs(v *[]types.SimulationApplicationConfig, value interface{}) error { 13569 if v == nil { 13570 return fmt.Errorf("unexpected nil of type %T", v) 13571 } 13572 if value == nil { 13573 return nil 13574 } 13575 13576 shape, ok := value.([]interface{}) 13577 if !ok { 13578 return fmt.Errorf("unexpected JSON type %v", value) 13579 } 13580 13581 var cv []types.SimulationApplicationConfig 13582 if *v == nil { 13583 cv = []types.SimulationApplicationConfig{} 13584 } else { 13585 cv = *v 13586 } 13587 13588 for _, value := range shape { 13589 var col types.SimulationApplicationConfig 13590 destAddr := &col 13591 if err := awsRestjson1_deserializeDocumentSimulationApplicationConfig(&destAddr, value); err != nil { 13592 return err 13593 } 13594 col = *destAddr 13595 cv = append(cv, col) 13596 13597 } 13598 *v = cv 13599 return nil 13600} 13601 13602func awsRestjson1_deserializeDocumentSimulationApplicationNames(v *[]string, value interface{}) error { 13603 if v == nil { 13604 return fmt.Errorf("unexpected nil of type %T", v) 13605 } 13606 if value == nil { 13607 return nil 13608 } 13609 13610 shape, ok := value.([]interface{}) 13611 if !ok { 13612 return fmt.Errorf("unexpected JSON type %v", value) 13613 } 13614 13615 var cv []string 13616 if *v == nil { 13617 cv = []string{} 13618 } else { 13619 cv = *v 13620 } 13621 13622 for _, value := range shape { 13623 var col string 13624 if value != nil { 13625 jtv, ok := value.(string) 13626 if !ok { 13627 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 13628 } 13629 col = jtv 13630 } 13631 cv = append(cv, col) 13632 13633 } 13634 *v = cv 13635 return nil 13636} 13637 13638func awsRestjson1_deserializeDocumentSimulationApplicationSummaries(v *[]types.SimulationApplicationSummary, value interface{}) error { 13639 if v == nil { 13640 return fmt.Errorf("unexpected nil of type %T", v) 13641 } 13642 if value == nil { 13643 return nil 13644 } 13645 13646 shape, ok := value.([]interface{}) 13647 if !ok { 13648 return fmt.Errorf("unexpected JSON type %v", value) 13649 } 13650 13651 var cv []types.SimulationApplicationSummary 13652 if *v == nil { 13653 cv = []types.SimulationApplicationSummary{} 13654 } else { 13655 cv = *v 13656 } 13657 13658 for _, value := range shape { 13659 var col types.SimulationApplicationSummary 13660 destAddr := &col 13661 if err := awsRestjson1_deserializeDocumentSimulationApplicationSummary(&destAddr, value); err != nil { 13662 return err 13663 } 13664 col = *destAddr 13665 cv = append(cv, col) 13666 13667 } 13668 *v = cv 13669 return nil 13670} 13671 13672func awsRestjson1_deserializeDocumentSimulationApplicationSummary(v **types.SimulationApplicationSummary, value interface{}) error { 13673 if v == nil { 13674 return fmt.Errorf("unexpected nil of type %T", v) 13675 } 13676 if value == nil { 13677 return nil 13678 } 13679 13680 shape, ok := value.(map[string]interface{}) 13681 if !ok { 13682 return fmt.Errorf("unexpected JSON type %v", value) 13683 } 13684 13685 var sv *types.SimulationApplicationSummary 13686 if *v == nil { 13687 sv = &types.SimulationApplicationSummary{} 13688 } else { 13689 sv = *v 13690 } 13691 13692 for key, value := range shape { 13693 switch key { 13694 case "arn": 13695 if value != nil { 13696 jtv, ok := value.(string) 13697 if !ok { 13698 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13699 } 13700 sv.Arn = ptr.String(jtv) 13701 } 13702 13703 case "lastUpdatedAt": 13704 if value != nil { 13705 switch jtv := value.(type) { 13706 case json.Number: 13707 f64, err := jtv.Float64() 13708 if err != nil { 13709 return err 13710 } 13711 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13712 13713 default: 13714 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 13715 13716 } 13717 } 13718 13719 case "name": 13720 if value != nil { 13721 jtv, ok := value.(string) 13722 if !ok { 13723 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 13724 } 13725 sv.Name = ptr.String(jtv) 13726 } 13727 13728 case "robotSoftwareSuite": 13729 if err := awsRestjson1_deserializeDocumentRobotSoftwareSuite(&sv.RobotSoftwareSuite, value); err != nil { 13730 return err 13731 } 13732 13733 case "simulationSoftwareSuite": 13734 if err := awsRestjson1_deserializeDocumentSimulationSoftwareSuite(&sv.SimulationSoftwareSuite, value); err != nil { 13735 return err 13736 } 13737 13738 case "version": 13739 if value != nil { 13740 jtv, ok := value.(string) 13741 if !ok { 13742 return fmt.Errorf("expected Version to be of type string, got %T instead", value) 13743 } 13744 sv.Version = ptr.String(jtv) 13745 } 13746 13747 default: 13748 _, _ = key, value 13749 13750 } 13751 } 13752 *v = sv 13753 return nil 13754} 13755 13756func awsRestjson1_deserializeDocumentSimulationJob(v **types.SimulationJob, value interface{}) error { 13757 if v == nil { 13758 return fmt.Errorf("unexpected nil of type %T", v) 13759 } 13760 if value == nil { 13761 return nil 13762 } 13763 13764 shape, ok := value.(map[string]interface{}) 13765 if !ok { 13766 return fmt.Errorf("unexpected JSON type %v", value) 13767 } 13768 13769 var sv *types.SimulationJob 13770 if *v == nil { 13771 sv = &types.SimulationJob{} 13772 } else { 13773 sv = *v 13774 } 13775 13776 for key, value := range shape { 13777 switch key { 13778 case "arn": 13779 if value != nil { 13780 jtv, ok := value.(string) 13781 if !ok { 13782 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13783 } 13784 sv.Arn = ptr.String(jtv) 13785 } 13786 13787 case "clientRequestToken": 13788 if value != nil { 13789 jtv, ok := value.(string) 13790 if !ok { 13791 return fmt.Errorf("expected ClientRequestToken to be of type string, got %T instead", value) 13792 } 13793 sv.ClientRequestToken = ptr.String(jtv) 13794 } 13795 13796 case "compute": 13797 if err := awsRestjson1_deserializeDocumentComputeResponse(&sv.Compute, value); err != nil { 13798 return err 13799 } 13800 13801 case "dataSources": 13802 if err := awsRestjson1_deserializeDocumentDataSources(&sv.DataSources, value); err != nil { 13803 return err 13804 } 13805 13806 case "failureBehavior": 13807 if value != nil { 13808 jtv, ok := value.(string) 13809 if !ok { 13810 return fmt.Errorf("expected FailureBehavior to be of type string, got %T instead", value) 13811 } 13812 sv.FailureBehavior = types.FailureBehavior(jtv) 13813 } 13814 13815 case "failureCode": 13816 if value != nil { 13817 jtv, ok := value.(string) 13818 if !ok { 13819 return fmt.Errorf("expected SimulationJobErrorCode to be of type string, got %T instead", value) 13820 } 13821 sv.FailureCode = types.SimulationJobErrorCode(jtv) 13822 } 13823 13824 case "failureReason": 13825 if value != nil { 13826 jtv, ok := value.(string) 13827 if !ok { 13828 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 13829 } 13830 sv.FailureReason = ptr.String(jtv) 13831 } 13832 13833 case "iamRole": 13834 if value != nil { 13835 jtv, ok := value.(string) 13836 if !ok { 13837 return fmt.Errorf("expected IamRole to be of type string, got %T instead", value) 13838 } 13839 sv.IamRole = ptr.String(jtv) 13840 } 13841 13842 case "lastStartedAt": 13843 if value != nil { 13844 switch jtv := value.(type) { 13845 case json.Number: 13846 f64, err := jtv.Float64() 13847 if err != nil { 13848 return err 13849 } 13850 sv.LastStartedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13851 13852 default: 13853 return fmt.Errorf("expected LastStartedAt to be a JSON Number, got %T instead", value) 13854 13855 } 13856 } 13857 13858 case "lastUpdatedAt": 13859 if value != nil { 13860 switch jtv := value.(type) { 13861 case json.Number: 13862 f64, err := jtv.Float64() 13863 if err != nil { 13864 return err 13865 } 13866 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13867 13868 default: 13869 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 13870 13871 } 13872 } 13873 13874 case "loggingConfig": 13875 if err := awsRestjson1_deserializeDocumentLoggingConfig(&sv.LoggingConfig, value); err != nil { 13876 return err 13877 } 13878 13879 case "maxJobDurationInSeconds": 13880 if value != nil { 13881 jtv, ok := value.(json.Number) 13882 if !ok { 13883 return fmt.Errorf("expected JobDuration to be json.Number, got %T instead", value) 13884 } 13885 i64, err := jtv.Int64() 13886 if err != nil { 13887 return err 13888 } 13889 sv.MaxJobDurationInSeconds = i64 13890 } 13891 13892 case "name": 13893 if value != nil { 13894 jtv, ok := value.(string) 13895 if !ok { 13896 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 13897 } 13898 sv.Name = ptr.String(jtv) 13899 } 13900 13901 case "networkInterface": 13902 if err := awsRestjson1_deserializeDocumentNetworkInterface(&sv.NetworkInterface, value); err != nil { 13903 return err 13904 } 13905 13906 case "outputLocation": 13907 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 13908 return err 13909 } 13910 13911 case "robotApplications": 13912 if err := awsRestjson1_deserializeDocumentRobotApplicationConfigs(&sv.RobotApplications, value); err != nil { 13913 return err 13914 } 13915 13916 case "simulationApplications": 13917 if err := awsRestjson1_deserializeDocumentSimulationApplicationConfigs(&sv.SimulationApplications, value); err != nil { 13918 return err 13919 } 13920 13921 case "simulationTimeMillis": 13922 if value != nil { 13923 jtv, ok := value.(json.Number) 13924 if !ok { 13925 return fmt.Errorf("expected SimulationTimeMillis to be json.Number, got %T instead", value) 13926 } 13927 i64, err := jtv.Int64() 13928 if err != nil { 13929 return err 13930 } 13931 sv.SimulationTimeMillis = i64 13932 } 13933 13934 case "status": 13935 if value != nil { 13936 jtv, ok := value.(string) 13937 if !ok { 13938 return fmt.Errorf("expected SimulationJobStatus to be of type string, got %T instead", value) 13939 } 13940 sv.Status = types.SimulationJobStatus(jtv) 13941 } 13942 13943 case "tags": 13944 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 13945 return err 13946 } 13947 13948 case "vpcConfig": 13949 if err := awsRestjson1_deserializeDocumentVPCConfigResponse(&sv.VpcConfig, value); err != nil { 13950 return err 13951 } 13952 13953 default: 13954 _, _ = key, value 13955 13956 } 13957 } 13958 *v = sv 13959 return nil 13960} 13961 13962func awsRestjson1_deserializeDocumentSimulationJobBatchSummaries(v *[]types.SimulationJobBatchSummary, value interface{}) error { 13963 if v == nil { 13964 return fmt.Errorf("unexpected nil of type %T", v) 13965 } 13966 if value == nil { 13967 return nil 13968 } 13969 13970 shape, ok := value.([]interface{}) 13971 if !ok { 13972 return fmt.Errorf("unexpected JSON type %v", value) 13973 } 13974 13975 var cv []types.SimulationJobBatchSummary 13976 if *v == nil { 13977 cv = []types.SimulationJobBatchSummary{} 13978 } else { 13979 cv = *v 13980 } 13981 13982 for _, value := range shape { 13983 var col types.SimulationJobBatchSummary 13984 destAddr := &col 13985 if err := awsRestjson1_deserializeDocumentSimulationJobBatchSummary(&destAddr, value); err != nil { 13986 return err 13987 } 13988 col = *destAddr 13989 cv = append(cv, col) 13990 13991 } 13992 *v = cv 13993 return nil 13994} 13995 13996func awsRestjson1_deserializeDocumentSimulationJobBatchSummary(v **types.SimulationJobBatchSummary, value interface{}) error { 13997 if v == nil { 13998 return fmt.Errorf("unexpected nil of type %T", v) 13999 } 14000 if value == nil { 14001 return nil 14002 } 14003 14004 shape, ok := value.(map[string]interface{}) 14005 if !ok { 14006 return fmt.Errorf("unexpected JSON type %v", value) 14007 } 14008 14009 var sv *types.SimulationJobBatchSummary 14010 if *v == nil { 14011 sv = &types.SimulationJobBatchSummary{} 14012 } else { 14013 sv = *v 14014 } 14015 14016 for key, value := range shape { 14017 switch key { 14018 case "arn": 14019 if value != nil { 14020 jtv, ok := value.(string) 14021 if !ok { 14022 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 14023 } 14024 sv.Arn = ptr.String(jtv) 14025 } 14026 14027 case "createdAt": 14028 if value != nil { 14029 switch jtv := value.(type) { 14030 case json.Number: 14031 f64, err := jtv.Float64() 14032 if err != nil { 14033 return err 14034 } 14035 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14036 14037 default: 14038 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 14039 14040 } 14041 } 14042 14043 case "createdRequestCount": 14044 if value != nil { 14045 jtv, ok := value.(json.Number) 14046 if !ok { 14047 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 14048 } 14049 i64, err := jtv.Int64() 14050 if err != nil { 14051 return err 14052 } 14053 sv.CreatedRequestCount = int32(i64) 14054 } 14055 14056 case "failedRequestCount": 14057 if value != nil { 14058 jtv, ok := value.(json.Number) 14059 if !ok { 14060 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 14061 } 14062 i64, err := jtv.Int64() 14063 if err != nil { 14064 return err 14065 } 14066 sv.FailedRequestCount = int32(i64) 14067 } 14068 14069 case "lastUpdatedAt": 14070 if value != nil { 14071 switch jtv := value.(type) { 14072 case json.Number: 14073 f64, err := jtv.Float64() 14074 if err != nil { 14075 return err 14076 } 14077 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14078 14079 default: 14080 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 14081 14082 } 14083 } 14084 14085 case "pendingRequestCount": 14086 if value != nil { 14087 jtv, ok := value.(json.Number) 14088 if !ok { 14089 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 14090 } 14091 i64, err := jtv.Int64() 14092 if err != nil { 14093 return err 14094 } 14095 sv.PendingRequestCount = int32(i64) 14096 } 14097 14098 case "status": 14099 if value != nil { 14100 jtv, ok := value.(string) 14101 if !ok { 14102 return fmt.Errorf("expected SimulationJobBatchStatus to be of type string, got %T instead", value) 14103 } 14104 sv.Status = types.SimulationJobBatchStatus(jtv) 14105 } 14106 14107 default: 14108 _, _ = key, value 14109 14110 } 14111 } 14112 *v = sv 14113 return nil 14114} 14115 14116func awsRestjson1_deserializeDocumentSimulationJobRequest(v **types.SimulationJobRequest, value interface{}) error { 14117 if v == nil { 14118 return fmt.Errorf("unexpected nil of type %T", v) 14119 } 14120 if value == nil { 14121 return nil 14122 } 14123 14124 shape, ok := value.(map[string]interface{}) 14125 if !ok { 14126 return fmt.Errorf("unexpected JSON type %v", value) 14127 } 14128 14129 var sv *types.SimulationJobRequest 14130 if *v == nil { 14131 sv = &types.SimulationJobRequest{} 14132 } else { 14133 sv = *v 14134 } 14135 14136 for key, value := range shape { 14137 switch key { 14138 case "compute": 14139 if err := awsRestjson1_deserializeDocumentCompute(&sv.Compute, value); err != nil { 14140 return err 14141 } 14142 14143 case "dataSources": 14144 if err := awsRestjson1_deserializeDocumentDataSourceConfigs(&sv.DataSources, value); err != nil { 14145 return err 14146 } 14147 14148 case "failureBehavior": 14149 if value != nil { 14150 jtv, ok := value.(string) 14151 if !ok { 14152 return fmt.Errorf("expected FailureBehavior to be of type string, got %T instead", value) 14153 } 14154 sv.FailureBehavior = types.FailureBehavior(jtv) 14155 } 14156 14157 case "iamRole": 14158 if value != nil { 14159 jtv, ok := value.(string) 14160 if !ok { 14161 return fmt.Errorf("expected IamRole to be of type string, got %T instead", value) 14162 } 14163 sv.IamRole = ptr.String(jtv) 14164 } 14165 14166 case "loggingConfig": 14167 if err := awsRestjson1_deserializeDocumentLoggingConfig(&sv.LoggingConfig, value); err != nil { 14168 return err 14169 } 14170 14171 case "maxJobDurationInSeconds": 14172 if value != nil { 14173 jtv, ok := value.(json.Number) 14174 if !ok { 14175 return fmt.Errorf("expected JobDuration to be json.Number, got %T instead", value) 14176 } 14177 i64, err := jtv.Int64() 14178 if err != nil { 14179 return err 14180 } 14181 sv.MaxJobDurationInSeconds = i64 14182 } 14183 14184 case "outputLocation": 14185 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 14186 return err 14187 } 14188 14189 case "robotApplications": 14190 if err := awsRestjson1_deserializeDocumentRobotApplicationConfigs(&sv.RobotApplications, value); err != nil { 14191 return err 14192 } 14193 14194 case "simulationApplications": 14195 if err := awsRestjson1_deserializeDocumentSimulationApplicationConfigs(&sv.SimulationApplications, value); err != nil { 14196 return err 14197 } 14198 14199 case "tags": 14200 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 14201 return err 14202 } 14203 14204 case "useDefaultApplications": 14205 if value != nil { 14206 jtv, ok := value.(bool) 14207 if !ok { 14208 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 14209 } 14210 sv.UseDefaultApplications = ptr.Bool(jtv) 14211 } 14212 14213 case "vpcConfig": 14214 if err := awsRestjson1_deserializeDocumentVPCConfig(&sv.VpcConfig, value); err != nil { 14215 return err 14216 } 14217 14218 default: 14219 _, _ = key, value 14220 14221 } 14222 } 14223 *v = sv 14224 return nil 14225} 14226 14227func awsRestjson1_deserializeDocumentSimulationJobs(v *[]types.SimulationJob, value interface{}) error { 14228 if v == nil { 14229 return fmt.Errorf("unexpected nil of type %T", v) 14230 } 14231 if value == nil { 14232 return nil 14233 } 14234 14235 shape, ok := value.([]interface{}) 14236 if !ok { 14237 return fmt.Errorf("unexpected JSON type %v", value) 14238 } 14239 14240 var cv []types.SimulationJob 14241 if *v == nil { 14242 cv = []types.SimulationJob{} 14243 } else { 14244 cv = *v 14245 } 14246 14247 for _, value := range shape { 14248 var col types.SimulationJob 14249 destAddr := &col 14250 if err := awsRestjson1_deserializeDocumentSimulationJob(&destAddr, value); err != nil { 14251 return err 14252 } 14253 col = *destAddr 14254 cv = append(cv, col) 14255 14256 } 14257 *v = cv 14258 return nil 14259} 14260 14261func awsRestjson1_deserializeDocumentSimulationJobSummaries(v *[]types.SimulationJobSummary, value interface{}) error { 14262 if v == nil { 14263 return fmt.Errorf("unexpected nil of type %T", v) 14264 } 14265 if value == nil { 14266 return nil 14267 } 14268 14269 shape, ok := value.([]interface{}) 14270 if !ok { 14271 return fmt.Errorf("unexpected JSON type %v", value) 14272 } 14273 14274 var cv []types.SimulationJobSummary 14275 if *v == nil { 14276 cv = []types.SimulationJobSummary{} 14277 } else { 14278 cv = *v 14279 } 14280 14281 for _, value := range shape { 14282 var col types.SimulationJobSummary 14283 destAddr := &col 14284 if err := awsRestjson1_deserializeDocumentSimulationJobSummary(&destAddr, value); err != nil { 14285 return err 14286 } 14287 col = *destAddr 14288 cv = append(cv, col) 14289 14290 } 14291 *v = cv 14292 return nil 14293} 14294 14295func awsRestjson1_deserializeDocumentSimulationJobSummary(v **types.SimulationJobSummary, value interface{}) error { 14296 if v == nil { 14297 return fmt.Errorf("unexpected nil of type %T", v) 14298 } 14299 if value == nil { 14300 return nil 14301 } 14302 14303 shape, ok := value.(map[string]interface{}) 14304 if !ok { 14305 return fmt.Errorf("unexpected JSON type %v", value) 14306 } 14307 14308 var sv *types.SimulationJobSummary 14309 if *v == nil { 14310 sv = &types.SimulationJobSummary{} 14311 } else { 14312 sv = *v 14313 } 14314 14315 for key, value := range shape { 14316 switch key { 14317 case "arn": 14318 if value != nil { 14319 jtv, ok := value.(string) 14320 if !ok { 14321 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 14322 } 14323 sv.Arn = ptr.String(jtv) 14324 } 14325 14326 case "dataSourceNames": 14327 if err := awsRestjson1_deserializeDocumentDataSourceNames(&sv.DataSourceNames, value); err != nil { 14328 return err 14329 } 14330 14331 case "lastUpdatedAt": 14332 if value != nil { 14333 switch jtv := value.(type) { 14334 case json.Number: 14335 f64, err := jtv.Float64() 14336 if err != nil { 14337 return err 14338 } 14339 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14340 14341 default: 14342 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 14343 14344 } 14345 } 14346 14347 case "name": 14348 if value != nil { 14349 jtv, ok := value.(string) 14350 if !ok { 14351 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 14352 } 14353 sv.Name = ptr.String(jtv) 14354 } 14355 14356 case "robotApplicationNames": 14357 if err := awsRestjson1_deserializeDocumentRobotApplicationNames(&sv.RobotApplicationNames, value); err != nil { 14358 return err 14359 } 14360 14361 case "simulationApplicationNames": 14362 if err := awsRestjson1_deserializeDocumentSimulationApplicationNames(&sv.SimulationApplicationNames, value); err != nil { 14363 return err 14364 } 14365 14366 case "status": 14367 if value != nil { 14368 jtv, ok := value.(string) 14369 if !ok { 14370 return fmt.Errorf("expected SimulationJobStatus to be of type string, got %T instead", value) 14371 } 14372 sv.Status = types.SimulationJobStatus(jtv) 14373 } 14374 14375 default: 14376 _, _ = key, value 14377 14378 } 14379 } 14380 *v = sv 14381 return nil 14382} 14383 14384func awsRestjson1_deserializeDocumentSimulationSoftwareSuite(v **types.SimulationSoftwareSuite, value interface{}) error { 14385 if v == nil { 14386 return fmt.Errorf("unexpected nil of type %T", v) 14387 } 14388 if value == nil { 14389 return nil 14390 } 14391 14392 shape, ok := value.(map[string]interface{}) 14393 if !ok { 14394 return fmt.Errorf("unexpected JSON type %v", value) 14395 } 14396 14397 var sv *types.SimulationSoftwareSuite 14398 if *v == nil { 14399 sv = &types.SimulationSoftwareSuite{} 14400 } else { 14401 sv = *v 14402 } 14403 14404 for key, value := range shape { 14405 switch key { 14406 case "name": 14407 if value != nil { 14408 jtv, ok := value.(string) 14409 if !ok { 14410 return fmt.Errorf("expected SimulationSoftwareSuiteType to be of type string, got %T instead", value) 14411 } 14412 sv.Name = types.SimulationSoftwareSuiteType(jtv) 14413 } 14414 14415 case "version": 14416 if value != nil { 14417 jtv, ok := value.(string) 14418 if !ok { 14419 return fmt.Errorf("expected SimulationSoftwareSuiteVersionType to be of type string, got %T instead", value) 14420 } 14421 sv.Version = ptr.String(jtv) 14422 } 14423 14424 default: 14425 _, _ = key, value 14426 14427 } 14428 } 14429 *v = sv 14430 return nil 14431} 14432 14433func awsRestjson1_deserializeDocumentSource(v **types.Source, value interface{}) error { 14434 if v == nil { 14435 return fmt.Errorf("unexpected nil of type %T", v) 14436 } 14437 if value == nil { 14438 return nil 14439 } 14440 14441 shape, ok := value.(map[string]interface{}) 14442 if !ok { 14443 return fmt.Errorf("unexpected JSON type %v", value) 14444 } 14445 14446 var sv *types.Source 14447 if *v == nil { 14448 sv = &types.Source{} 14449 } else { 14450 sv = *v 14451 } 14452 14453 for key, value := range shape { 14454 switch key { 14455 case "architecture": 14456 if value != nil { 14457 jtv, ok := value.(string) 14458 if !ok { 14459 return fmt.Errorf("expected Architecture to be of type string, got %T instead", value) 14460 } 14461 sv.Architecture = types.Architecture(jtv) 14462 } 14463 14464 case "etag": 14465 if value != nil { 14466 jtv, ok := value.(string) 14467 if !ok { 14468 return fmt.Errorf("expected S3Etag to be of type string, got %T instead", value) 14469 } 14470 sv.Etag = ptr.String(jtv) 14471 } 14472 14473 case "s3Bucket": 14474 if value != nil { 14475 jtv, ok := value.(string) 14476 if !ok { 14477 return fmt.Errorf("expected S3Bucket to be of type string, got %T instead", value) 14478 } 14479 sv.S3Bucket = ptr.String(jtv) 14480 } 14481 14482 case "s3Key": 14483 if value != nil { 14484 jtv, ok := value.(string) 14485 if !ok { 14486 return fmt.Errorf("expected S3Key to be of type string, got %T instead", value) 14487 } 14488 sv.S3Key = ptr.String(jtv) 14489 } 14490 14491 default: 14492 _, _ = key, value 14493 14494 } 14495 } 14496 *v = sv 14497 return nil 14498} 14499 14500func awsRestjson1_deserializeDocumentSources(v *[]types.Source, value interface{}) error { 14501 if v == nil { 14502 return fmt.Errorf("unexpected nil of type %T", v) 14503 } 14504 if value == nil { 14505 return nil 14506 } 14507 14508 shape, ok := value.([]interface{}) 14509 if !ok { 14510 return fmt.Errorf("unexpected JSON type %v", value) 14511 } 14512 14513 var cv []types.Source 14514 if *v == nil { 14515 cv = []types.Source{} 14516 } else { 14517 cv = *v 14518 } 14519 14520 for _, value := range shape { 14521 var col types.Source 14522 destAddr := &col 14523 if err := awsRestjson1_deserializeDocumentSource(&destAddr, value); err != nil { 14524 return err 14525 } 14526 col = *destAddr 14527 cv = append(cv, col) 14528 14529 } 14530 *v = cv 14531 return nil 14532} 14533 14534func awsRestjson1_deserializeDocumentSubnets(v *[]string, value interface{}) error { 14535 if v == nil { 14536 return fmt.Errorf("unexpected nil of type %T", v) 14537 } 14538 if value == nil { 14539 return nil 14540 } 14541 14542 shape, ok := value.([]interface{}) 14543 if !ok { 14544 return fmt.Errorf("unexpected JSON type %v", value) 14545 } 14546 14547 var cv []string 14548 if *v == nil { 14549 cv = []string{} 14550 } else { 14551 cv = *v 14552 } 14553 14554 for _, value := range shape { 14555 var col string 14556 if value != nil { 14557 jtv, ok := value.(string) 14558 if !ok { 14559 return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) 14560 } 14561 col = jtv 14562 } 14563 cv = append(cv, col) 14564 14565 } 14566 *v = cv 14567 return nil 14568} 14569 14570func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 14571 if v == nil { 14572 return fmt.Errorf("unexpected nil of type %T", v) 14573 } 14574 if value == nil { 14575 return nil 14576 } 14577 14578 shape, ok := value.(map[string]interface{}) 14579 if !ok { 14580 return fmt.Errorf("unexpected JSON type %v", value) 14581 } 14582 14583 var mv map[string]string 14584 if *v == nil { 14585 mv = map[string]string{} 14586 } else { 14587 mv = *v 14588 } 14589 14590 for key, value := range shape { 14591 var parsedVal string 14592 if value != nil { 14593 jtv, ok := value.(string) 14594 if !ok { 14595 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 14596 } 14597 parsedVal = jtv 14598 } 14599 mv[key] = parsedVal 14600 14601 } 14602 *v = mv 14603 return nil 14604} 14605 14606func awsRestjson1_deserializeDocumentTemplateSummaries(v *[]types.TemplateSummary, value interface{}) error { 14607 if v == nil { 14608 return fmt.Errorf("unexpected nil of type %T", v) 14609 } 14610 if value == nil { 14611 return nil 14612 } 14613 14614 shape, ok := value.([]interface{}) 14615 if !ok { 14616 return fmt.Errorf("unexpected JSON type %v", value) 14617 } 14618 14619 var cv []types.TemplateSummary 14620 if *v == nil { 14621 cv = []types.TemplateSummary{} 14622 } else { 14623 cv = *v 14624 } 14625 14626 for _, value := range shape { 14627 var col types.TemplateSummary 14628 destAddr := &col 14629 if err := awsRestjson1_deserializeDocumentTemplateSummary(&destAddr, value); err != nil { 14630 return err 14631 } 14632 col = *destAddr 14633 cv = append(cv, col) 14634 14635 } 14636 *v = cv 14637 return nil 14638} 14639 14640func awsRestjson1_deserializeDocumentTemplateSummary(v **types.TemplateSummary, value interface{}) error { 14641 if v == nil { 14642 return fmt.Errorf("unexpected nil of type %T", v) 14643 } 14644 if value == nil { 14645 return nil 14646 } 14647 14648 shape, ok := value.(map[string]interface{}) 14649 if !ok { 14650 return fmt.Errorf("unexpected JSON type %v", value) 14651 } 14652 14653 var sv *types.TemplateSummary 14654 if *v == nil { 14655 sv = &types.TemplateSummary{} 14656 } else { 14657 sv = *v 14658 } 14659 14660 for key, value := range shape { 14661 switch key { 14662 case "arn": 14663 if value != nil { 14664 jtv, ok := value.(string) 14665 if !ok { 14666 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 14667 } 14668 sv.Arn = ptr.String(jtv) 14669 } 14670 14671 case "createdAt": 14672 if value != nil { 14673 switch jtv := value.(type) { 14674 case json.Number: 14675 f64, err := jtv.Float64() 14676 if err != nil { 14677 return err 14678 } 14679 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14680 14681 default: 14682 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 14683 14684 } 14685 } 14686 14687 case "lastUpdatedAt": 14688 if value != nil { 14689 switch jtv := value.(type) { 14690 case json.Number: 14691 f64, err := jtv.Float64() 14692 if err != nil { 14693 return err 14694 } 14695 sv.LastUpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14696 14697 default: 14698 return fmt.Errorf("expected LastUpdatedAt to be a JSON Number, got %T instead", value) 14699 14700 } 14701 } 14702 14703 case "name": 14704 if value != nil { 14705 jtv, ok := value.(string) 14706 if !ok { 14707 return fmt.Errorf("expected TemplateName to be of type string, got %T instead", value) 14708 } 14709 sv.Name = ptr.String(jtv) 14710 } 14711 14712 case "version": 14713 if value != nil { 14714 jtv, ok := value.(string) 14715 if !ok { 14716 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 14717 } 14718 sv.Version = ptr.String(jtv) 14719 } 14720 14721 default: 14722 _, _ = key, value 14723 14724 } 14725 } 14726 *v = sv 14727 return nil 14728} 14729 14730func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 14731 if v == nil { 14732 return fmt.Errorf("unexpected nil of type %T", v) 14733 } 14734 if value == nil { 14735 return nil 14736 } 14737 14738 shape, ok := value.(map[string]interface{}) 14739 if !ok { 14740 return fmt.Errorf("unexpected JSON type %v", value) 14741 } 14742 14743 var sv *types.ThrottlingException 14744 if *v == nil { 14745 sv = &types.ThrottlingException{} 14746 } else { 14747 sv = *v 14748 } 14749 14750 for key, value := range shape { 14751 switch key { 14752 case "message": 14753 if value != nil { 14754 jtv, ok := value.(string) 14755 if !ok { 14756 return fmt.Errorf("expected errorMessage to be of type string, got %T instead", value) 14757 } 14758 sv.Message = ptr.String(jtv) 14759 } 14760 14761 default: 14762 _, _ = key, value 14763 14764 } 14765 } 14766 *v = sv 14767 return nil 14768} 14769 14770func awsRestjson1_deserializeDocumentTool(v **types.Tool, value interface{}) error { 14771 if v == nil { 14772 return fmt.Errorf("unexpected nil of type %T", v) 14773 } 14774 if value == nil { 14775 return nil 14776 } 14777 14778 shape, ok := value.(map[string]interface{}) 14779 if !ok { 14780 return fmt.Errorf("unexpected JSON type %v", value) 14781 } 14782 14783 var sv *types.Tool 14784 if *v == nil { 14785 sv = &types.Tool{} 14786 } else { 14787 sv = *v 14788 } 14789 14790 for key, value := range shape { 14791 switch key { 14792 case "command": 14793 if value != nil { 14794 jtv, ok := value.(string) 14795 if !ok { 14796 return fmt.Errorf("expected UnrestrictedCommand to be of type string, got %T instead", value) 14797 } 14798 sv.Command = ptr.String(jtv) 14799 } 14800 14801 case "exitBehavior": 14802 if value != nil { 14803 jtv, ok := value.(string) 14804 if !ok { 14805 return fmt.Errorf("expected ExitBehavior to be of type string, got %T instead", value) 14806 } 14807 sv.ExitBehavior = types.ExitBehavior(jtv) 14808 } 14809 14810 case "name": 14811 if value != nil { 14812 jtv, ok := value.(string) 14813 if !ok { 14814 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 14815 } 14816 sv.Name = ptr.String(jtv) 14817 } 14818 14819 case "streamOutputToCloudWatch": 14820 if value != nil { 14821 jtv, ok := value.(bool) 14822 if !ok { 14823 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 14824 } 14825 sv.StreamOutputToCloudWatch = ptr.Bool(jtv) 14826 } 14827 14828 case "streamUI": 14829 if value != nil { 14830 jtv, ok := value.(bool) 14831 if !ok { 14832 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 14833 } 14834 sv.StreamUI = ptr.Bool(jtv) 14835 } 14836 14837 default: 14838 _, _ = key, value 14839 14840 } 14841 } 14842 *v = sv 14843 return nil 14844} 14845 14846func awsRestjson1_deserializeDocumentTools(v *[]types.Tool, value interface{}) error { 14847 if v == nil { 14848 return fmt.Errorf("unexpected nil of type %T", v) 14849 } 14850 if value == nil { 14851 return nil 14852 } 14853 14854 shape, ok := value.([]interface{}) 14855 if !ok { 14856 return fmt.Errorf("unexpected JSON type %v", value) 14857 } 14858 14859 var cv []types.Tool 14860 if *v == nil { 14861 cv = []types.Tool{} 14862 } else { 14863 cv = *v 14864 } 14865 14866 for _, value := range shape { 14867 var col types.Tool 14868 destAddr := &col 14869 if err := awsRestjson1_deserializeDocumentTool(&destAddr, value); err != nil { 14870 return err 14871 } 14872 col = *destAddr 14873 cv = append(cv, col) 14874 14875 } 14876 *v = cv 14877 return nil 14878} 14879 14880func awsRestjson1_deserializeDocumentUploadConfiguration(v **types.UploadConfiguration, value interface{}) error { 14881 if v == nil { 14882 return fmt.Errorf("unexpected nil of type %T", v) 14883 } 14884 if value == nil { 14885 return nil 14886 } 14887 14888 shape, ok := value.(map[string]interface{}) 14889 if !ok { 14890 return fmt.Errorf("unexpected JSON type %v", value) 14891 } 14892 14893 var sv *types.UploadConfiguration 14894 if *v == nil { 14895 sv = &types.UploadConfiguration{} 14896 } else { 14897 sv = *v 14898 } 14899 14900 for key, value := range shape { 14901 switch key { 14902 case "name": 14903 if value != nil { 14904 jtv, ok := value.(string) 14905 if !ok { 14906 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 14907 } 14908 sv.Name = ptr.String(jtv) 14909 } 14910 14911 case "path": 14912 if value != nil { 14913 jtv, ok := value.(string) 14914 if !ok { 14915 return fmt.Errorf("expected Path to be of type string, got %T instead", value) 14916 } 14917 sv.Path = ptr.String(jtv) 14918 } 14919 14920 case "uploadBehavior": 14921 if value != nil { 14922 jtv, ok := value.(string) 14923 if !ok { 14924 return fmt.Errorf("expected UploadBehavior to be of type string, got %T instead", value) 14925 } 14926 sv.UploadBehavior = types.UploadBehavior(jtv) 14927 } 14928 14929 default: 14930 _, _ = key, value 14931 14932 } 14933 } 14934 *v = sv 14935 return nil 14936} 14937 14938func awsRestjson1_deserializeDocumentUploadConfigurations(v *[]types.UploadConfiguration, value interface{}) error { 14939 if v == nil { 14940 return fmt.Errorf("unexpected nil of type %T", v) 14941 } 14942 if value == nil { 14943 return nil 14944 } 14945 14946 shape, ok := value.([]interface{}) 14947 if !ok { 14948 return fmt.Errorf("unexpected JSON type %v", value) 14949 } 14950 14951 var cv []types.UploadConfiguration 14952 if *v == nil { 14953 cv = []types.UploadConfiguration{} 14954 } else { 14955 cv = *v 14956 } 14957 14958 for _, value := range shape { 14959 var col types.UploadConfiguration 14960 destAddr := &col 14961 if err := awsRestjson1_deserializeDocumentUploadConfiguration(&destAddr, value); err != nil { 14962 return err 14963 } 14964 col = *destAddr 14965 cv = append(cv, col) 14966 14967 } 14968 *v = cv 14969 return nil 14970} 14971 14972func awsRestjson1_deserializeDocumentVPCConfig(v **types.VPCConfig, value interface{}) error { 14973 if v == nil { 14974 return fmt.Errorf("unexpected nil of type %T", v) 14975 } 14976 if value == nil { 14977 return nil 14978 } 14979 14980 shape, ok := value.(map[string]interface{}) 14981 if !ok { 14982 return fmt.Errorf("unexpected JSON type %v", value) 14983 } 14984 14985 var sv *types.VPCConfig 14986 if *v == nil { 14987 sv = &types.VPCConfig{} 14988 } else { 14989 sv = *v 14990 } 14991 14992 for key, value := range shape { 14993 switch key { 14994 case "assignPublicIp": 14995 if value != nil { 14996 jtv, ok := value.(bool) 14997 if !ok { 14998 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 14999 } 15000 sv.AssignPublicIp = jtv 15001 } 15002 15003 case "securityGroups": 15004 if err := awsRestjson1_deserializeDocumentSecurityGroups(&sv.SecurityGroups, value); err != nil { 15005 return err 15006 } 15007 15008 case "subnets": 15009 if err := awsRestjson1_deserializeDocumentSubnets(&sv.Subnets, value); err != nil { 15010 return err 15011 } 15012 15013 default: 15014 _, _ = key, value 15015 15016 } 15017 } 15018 *v = sv 15019 return nil 15020} 15021 15022func awsRestjson1_deserializeDocumentVPCConfigResponse(v **types.VPCConfigResponse, value interface{}) error { 15023 if v == nil { 15024 return fmt.Errorf("unexpected nil of type %T", v) 15025 } 15026 if value == nil { 15027 return nil 15028 } 15029 15030 shape, ok := value.(map[string]interface{}) 15031 if !ok { 15032 return fmt.Errorf("unexpected JSON type %v", value) 15033 } 15034 15035 var sv *types.VPCConfigResponse 15036 if *v == nil { 15037 sv = &types.VPCConfigResponse{} 15038 } else { 15039 sv = *v 15040 } 15041 15042 for key, value := range shape { 15043 switch key { 15044 case "assignPublicIp": 15045 if value != nil { 15046 jtv, ok := value.(bool) 15047 if !ok { 15048 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 15049 } 15050 sv.AssignPublicIp = jtv 15051 } 15052 15053 case "securityGroups": 15054 if err := awsRestjson1_deserializeDocumentSecurityGroups(&sv.SecurityGroups, value); err != nil { 15055 return err 15056 } 15057 15058 case "subnets": 15059 if err := awsRestjson1_deserializeDocumentSubnets(&sv.Subnets, value); err != nil { 15060 return err 15061 } 15062 15063 case "vpcId": 15064 if value != nil { 15065 jtv, ok := value.(string) 15066 if !ok { 15067 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 15068 } 15069 sv.VpcId = ptr.String(jtv) 15070 } 15071 15072 default: 15073 _, _ = key, value 15074 15075 } 15076 } 15077 *v = sv 15078 return nil 15079} 15080 15081func awsRestjson1_deserializeDocumentWorldConfig(v **types.WorldConfig, value interface{}) error { 15082 if v == nil { 15083 return fmt.Errorf("unexpected nil of type %T", v) 15084 } 15085 if value == nil { 15086 return nil 15087 } 15088 15089 shape, ok := value.(map[string]interface{}) 15090 if !ok { 15091 return fmt.Errorf("unexpected JSON type %v", value) 15092 } 15093 15094 var sv *types.WorldConfig 15095 if *v == nil { 15096 sv = &types.WorldConfig{} 15097 } else { 15098 sv = *v 15099 } 15100 15101 for key, value := range shape { 15102 switch key { 15103 case "world": 15104 if value != nil { 15105 jtv, ok := value.(string) 15106 if !ok { 15107 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 15108 } 15109 sv.World = ptr.String(jtv) 15110 } 15111 15112 default: 15113 _, _ = key, value 15114 15115 } 15116 } 15117 *v = sv 15118 return nil 15119} 15120 15121func awsRestjson1_deserializeDocumentWorldConfigs(v *[]types.WorldConfig, value interface{}) error { 15122 if v == nil { 15123 return fmt.Errorf("unexpected nil of type %T", v) 15124 } 15125 if value == nil { 15126 return nil 15127 } 15128 15129 shape, ok := value.([]interface{}) 15130 if !ok { 15131 return fmt.Errorf("unexpected JSON type %v", value) 15132 } 15133 15134 var cv []types.WorldConfig 15135 if *v == nil { 15136 cv = []types.WorldConfig{} 15137 } else { 15138 cv = *v 15139 } 15140 15141 for _, value := range shape { 15142 var col types.WorldConfig 15143 destAddr := &col 15144 if err := awsRestjson1_deserializeDocumentWorldConfig(&destAddr, value); err != nil { 15145 return err 15146 } 15147 col = *destAddr 15148 cv = append(cv, col) 15149 15150 } 15151 *v = cv 15152 return nil 15153} 15154 15155func awsRestjson1_deserializeDocumentWorldCount(v **types.WorldCount, value interface{}) error { 15156 if v == nil { 15157 return fmt.Errorf("unexpected nil of type %T", v) 15158 } 15159 if value == nil { 15160 return nil 15161 } 15162 15163 shape, ok := value.(map[string]interface{}) 15164 if !ok { 15165 return fmt.Errorf("unexpected JSON type %v", value) 15166 } 15167 15168 var sv *types.WorldCount 15169 if *v == nil { 15170 sv = &types.WorldCount{} 15171 } else { 15172 sv = *v 15173 } 15174 15175 for key, value := range shape { 15176 switch key { 15177 case "floorplanCount": 15178 if value != nil { 15179 jtv, ok := value.(json.Number) 15180 if !ok { 15181 return fmt.Errorf("expected FloorplanCount to be json.Number, got %T instead", value) 15182 } 15183 i64, err := jtv.Int64() 15184 if err != nil { 15185 return err 15186 } 15187 sv.FloorplanCount = ptr.Int32(int32(i64)) 15188 } 15189 15190 case "interiorCountPerFloorplan": 15191 if value != nil { 15192 jtv, ok := value.(json.Number) 15193 if !ok { 15194 return fmt.Errorf("expected InteriorCountPerFloorplan to be json.Number, got %T instead", value) 15195 } 15196 i64, err := jtv.Int64() 15197 if err != nil { 15198 return err 15199 } 15200 sv.InteriorCountPerFloorplan = ptr.Int32(int32(i64)) 15201 } 15202 15203 default: 15204 _, _ = key, value 15205 15206 } 15207 } 15208 *v = sv 15209 return nil 15210} 15211 15212func awsRestjson1_deserializeDocumentWorldExportJobSummaries(v *[]types.WorldExportJobSummary, value interface{}) error { 15213 if v == nil { 15214 return fmt.Errorf("unexpected nil of type %T", v) 15215 } 15216 if value == nil { 15217 return nil 15218 } 15219 15220 shape, ok := value.([]interface{}) 15221 if !ok { 15222 return fmt.Errorf("unexpected JSON type %v", value) 15223 } 15224 15225 var cv []types.WorldExportJobSummary 15226 if *v == nil { 15227 cv = []types.WorldExportJobSummary{} 15228 } else { 15229 cv = *v 15230 } 15231 15232 for _, value := range shape { 15233 var col types.WorldExportJobSummary 15234 destAddr := &col 15235 if err := awsRestjson1_deserializeDocumentWorldExportJobSummary(&destAddr, value); err != nil { 15236 return err 15237 } 15238 col = *destAddr 15239 cv = append(cv, col) 15240 15241 } 15242 *v = cv 15243 return nil 15244} 15245 15246func awsRestjson1_deserializeDocumentWorldExportJobSummary(v **types.WorldExportJobSummary, value interface{}) error { 15247 if v == nil { 15248 return fmt.Errorf("unexpected nil of type %T", v) 15249 } 15250 if value == nil { 15251 return nil 15252 } 15253 15254 shape, ok := value.(map[string]interface{}) 15255 if !ok { 15256 return fmt.Errorf("unexpected JSON type %v", value) 15257 } 15258 15259 var sv *types.WorldExportJobSummary 15260 if *v == nil { 15261 sv = &types.WorldExportJobSummary{} 15262 } else { 15263 sv = *v 15264 } 15265 15266 for key, value := range shape { 15267 switch key { 15268 case "arn": 15269 if value != nil { 15270 jtv, ok := value.(string) 15271 if !ok { 15272 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 15273 } 15274 sv.Arn = ptr.String(jtv) 15275 } 15276 15277 case "createdAt": 15278 if value != nil { 15279 switch jtv := value.(type) { 15280 case json.Number: 15281 f64, err := jtv.Float64() 15282 if err != nil { 15283 return err 15284 } 15285 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 15286 15287 default: 15288 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 15289 15290 } 15291 } 15292 15293 case "status": 15294 if value != nil { 15295 jtv, ok := value.(string) 15296 if !ok { 15297 return fmt.Errorf("expected WorldExportJobStatus to be of type string, got %T instead", value) 15298 } 15299 sv.Status = types.WorldExportJobStatus(jtv) 15300 } 15301 15302 case "worlds": 15303 if err := awsRestjson1_deserializeDocumentArns(&sv.Worlds, value); err != nil { 15304 return err 15305 } 15306 15307 default: 15308 _, _ = key, value 15309 15310 } 15311 } 15312 *v = sv 15313 return nil 15314} 15315 15316func awsRestjson1_deserializeDocumentWorldFailure(v **types.WorldFailure, value interface{}) error { 15317 if v == nil { 15318 return fmt.Errorf("unexpected nil of type %T", v) 15319 } 15320 if value == nil { 15321 return nil 15322 } 15323 15324 shape, ok := value.(map[string]interface{}) 15325 if !ok { 15326 return fmt.Errorf("unexpected JSON type %v", value) 15327 } 15328 15329 var sv *types.WorldFailure 15330 if *v == nil { 15331 sv = &types.WorldFailure{} 15332 } else { 15333 sv = *v 15334 } 15335 15336 for key, value := range shape { 15337 switch key { 15338 case "failureCode": 15339 if value != nil { 15340 jtv, ok := value.(string) 15341 if !ok { 15342 return fmt.Errorf("expected WorldGenerationJobErrorCode to be of type string, got %T instead", value) 15343 } 15344 sv.FailureCode = types.WorldGenerationJobErrorCode(jtv) 15345 } 15346 15347 case "failureCount": 15348 if value != nil { 15349 jtv, ok := value.(json.Number) 15350 if !ok { 15351 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 15352 } 15353 i64, err := jtv.Int64() 15354 if err != nil { 15355 return err 15356 } 15357 sv.FailureCount = int32(i64) 15358 } 15359 15360 case "sampleFailureReason": 15361 if value != nil { 15362 jtv, ok := value.(string) 15363 if !ok { 15364 return fmt.Errorf("expected GenericString to be of type string, got %T instead", value) 15365 } 15366 sv.SampleFailureReason = ptr.String(jtv) 15367 } 15368 15369 default: 15370 _, _ = key, value 15371 15372 } 15373 } 15374 *v = sv 15375 return nil 15376} 15377 15378func awsRestjson1_deserializeDocumentWorldFailures(v *[]types.WorldFailure, value interface{}) error { 15379 if v == nil { 15380 return fmt.Errorf("unexpected nil of type %T", v) 15381 } 15382 if value == nil { 15383 return nil 15384 } 15385 15386 shape, ok := value.([]interface{}) 15387 if !ok { 15388 return fmt.Errorf("unexpected JSON type %v", value) 15389 } 15390 15391 var cv []types.WorldFailure 15392 if *v == nil { 15393 cv = []types.WorldFailure{} 15394 } else { 15395 cv = *v 15396 } 15397 15398 for _, value := range shape { 15399 var col types.WorldFailure 15400 destAddr := &col 15401 if err := awsRestjson1_deserializeDocumentWorldFailure(&destAddr, value); err != nil { 15402 return err 15403 } 15404 col = *destAddr 15405 cv = append(cv, col) 15406 15407 } 15408 *v = cv 15409 return nil 15410} 15411 15412func awsRestjson1_deserializeDocumentWorldGenerationJobSummaries(v *[]types.WorldGenerationJobSummary, value interface{}) error { 15413 if v == nil { 15414 return fmt.Errorf("unexpected nil of type %T", v) 15415 } 15416 if value == nil { 15417 return nil 15418 } 15419 15420 shape, ok := value.([]interface{}) 15421 if !ok { 15422 return fmt.Errorf("unexpected JSON type %v", value) 15423 } 15424 15425 var cv []types.WorldGenerationJobSummary 15426 if *v == nil { 15427 cv = []types.WorldGenerationJobSummary{} 15428 } else { 15429 cv = *v 15430 } 15431 15432 for _, value := range shape { 15433 var col types.WorldGenerationJobSummary 15434 destAddr := &col 15435 if err := awsRestjson1_deserializeDocumentWorldGenerationJobSummary(&destAddr, value); err != nil { 15436 return err 15437 } 15438 col = *destAddr 15439 cv = append(cv, col) 15440 15441 } 15442 *v = cv 15443 return nil 15444} 15445 15446func awsRestjson1_deserializeDocumentWorldGenerationJobSummary(v **types.WorldGenerationJobSummary, value interface{}) error { 15447 if v == nil { 15448 return fmt.Errorf("unexpected nil of type %T", v) 15449 } 15450 if value == nil { 15451 return nil 15452 } 15453 15454 shape, ok := value.(map[string]interface{}) 15455 if !ok { 15456 return fmt.Errorf("unexpected JSON type %v", value) 15457 } 15458 15459 var sv *types.WorldGenerationJobSummary 15460 if *v == nil { 15461 sv = &types.WorldGenerationJobSummary{} 15462 } else { 15463 sv = *v 15464 } 15465 15466 for key, value := range shape { 15467 switch key { 15468 case "arn": 15469 if value != nil { 15470 jtv, ok := value.(string) 15471 if !ok { 15472 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 15473 } 15474 sv.Arn = ptr.String(jtv) 15475 } 15476 15477 case "createdAt": 15478 if value != nil { 15479 switch jtv := value.(type) { 15480 case json.Number: 15481 f64, err := jtv.Float64() 15482 if err != nil { 15483 return err 15484 } 15485 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 15486 15487 default: 15488 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 15489 15490 } 15491 } 15492 15493 case "failedWorldCount": 15494 if value != nil { 15495 jtv, ok := value.(json.Number) 15496 if !ok { 15497 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 15498 } 15499 i64, err := jtv.Int64() 15500 if err != nil { 15501 return err 15502 } 15503 sv.FailedWorldCount = int32(i64) 15504 } 15505 15506 case "status": 15507 if value != nil { 15508 jtv, ok := value.(string) 15509 if !ok { 15510 return fmt.Errorf("expected WorldGenerationJobStatus to be of type string, got %T instead", value) 15511 } 15512 sv.Status = types.WorldGenerationJobStatus(jtv) 15513 } 15514 15515 case "succeededWorldCount": 15516 if value != nil { 15517 jtv, ok := value.(json.Number) 15518 if !ok { 15519 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 15520 } 15521 i64, err := jtv.Int64() 15522 if err != nil { 15523 return err 15524 } 15525 sv.SucceededWorldCount = int32(i64) 15526 } 15527 15528 case "template": 15529 if value != nil { 15530 jtv, ok := value.(string) 15531 if !ok { 15532 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 15533 } 15534 sv.Template = ptr.String(jtv) 15535 } 15536 15537 case "worldCount": 15538 if err := awsRestjson1_deserializeDocumentWorldCount(&sv.WorldCount, value); err != nil { 15539 return err 15540 } 15541 15542 default: 15543 _, _ = key, value 15544 15545 } 15546 } 15547 *v = sv 15548 return nil 15549} 15550 15551func awsRestjson1_deserializeDocumentWorldSummaries(v *[]types.WorldSummary, value interface{}) error { 15552 if v == nil { 15553 return fmt.Errorf("unexpected nil of type %T", v) 15554 } 15555 if value == nil { 15556 return nil 15557 } 15558 15559 shape, ok := value.([]interface{}) 15560 if !ok { 15561 return fmt.Errorf("unexpected JSON type %v", value) 15562 } 15563 15564 var cv []types.WorldSummary 15565 if *v == nil { 15566 cv = []types.WorldSummary{} 15567 } else { 15568 cv = *v 15569 } 15570 15571 for _, value := range shape { 15572 var col types.WorldSummary 15573 destAddr := &col 15574 if err := awsRestjson1_deserializeDocumentWorldSummary(&destAddr, value); err != nil { 15575 return err 15576 } 15577 col = *destAddr 15578 cv = append(cv, col) 15579 15580 } 15581 *v = cv 15582 return nil 15583} 15584 15585func awsRestjson1_deserializeDocumentWorldSummary(v **types.WorldSummary, value interface{}) error { 15586 if v == nil { 15587 return fmt.Errorf("unexpected nil of type %T", v) 15588 } 15589 if value == nil { 15590 return nil 15591 } 15592 15593 shape, ok := value.(map[string]interface{}) 15594 if !ok { 15595 return fmt.Errorf("unexpected JSON type %v", value) 15596 } 15597 15598 var sv *types.WorldSummary 15599 if *v == nil { 15600 sv = &types.WorldSummary{} 15601 } else { 15602 sv = *v 15603 } 15604 15605 for key, value := range shape { 15606 switch key { 15607 case "arn": 15608 if value != nil { 15609 jtv, ok := value.(string) 15610 if !ok { 15611 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 15612 } 15613 sv.Arn = ptr.String(jtv) 15614 } 15615 15616 case "createdAt": 15617 if value != nil { 15618 switch jtv := value.(type) { 15619 case json.Number: 15620 f64, err := jtv.Float64() 15621 if err != nil { 15622 return err 15623 } 15624 sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) 15625 15626 default: 15627 return fmt.Errorf("expected CreatedAt to be a JSON Number, got %T instead", value) 15628 15629 } 15630 } 15631 15632 case "generationJob": 15633 if value != nil { 15634 jtv, ok := value.(string) 15635 if !ok { 15636 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 15637 } 15638 sv.GenerationJob = ptr.String(jtv) 15639 } 15640 15641 case "template": 15642 if value != nil { 15643 jtv, ok := value.(string) 15644 if !ok { 15645 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 15646 } 15647 sv.Template = ptr.String(jtv) 15648 } 15649 15650 default: 15651 _, _ = key, value 15652 15653 } 15654 } 15655 *v = sv 15656 return nil 15657} 15658