1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package connect 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/connect/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithytime "github.com/aws/smithy-go/time" 17 smithyhttp "github.com/aws/smithy-go/transport/http" 18 "io" 19 "io/ioutil" 20 "strings" 21) 22 23type awsRestjson1_deserializeOpAssociateApprovedOrigin struct { 24} 25 26func (*awsRestjson1_deserializeOpAssociateApprovedOrigin) ID() string { 27 return "OperationDeserializer" 28} 29 30func (m *awsRestjson1_deserializeOpAssociateApprovedOrigin) 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_deserializeOpErrorAssociateApprovedOrigin(response, &metadata) 45 } 46 output := &AssociateApprovedOriginOutput{} 47 out.Result = output 48 49 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 50 return out, metadata, &smithy.DeserializationError{ 51 Err: fmt.Errorf("failed to discard response body, %w", err), 52 } 53 } 54 55 return out, metadata, err 56} 57 58func awsRestjson1_deserializeOpErrorAssociateApprovedOrigin(response *smithyhttp.Response, metadata *middleware.Metadata) error { 59 var errorBuffer bytes.Buffer 60 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 61 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 62 } 63 errorBody := bytes.NewReader(errorBuffer.Bytes()) 64 65 errorCode := "UnknownError" 66 errorMessage := errorCode 67 68 code := response.Header.Get("X-Amzn-ErrorType") 69 if len(code) != 0 { 70 errorCode = restjson.SanitizeErrorCode(code) 71 } 72 73 var buff [1024]byte 74 ringBuffer := smithyio.NewRingBuffer(buff[:]) 75 76 body := io.TeeReader(errorBody, ringBuffer) 77 decoder := json.NewDecoder(body) 78 decoder.UseNumber() 79 code, message, err := restjson.GetErrorInfo(decoder) 80 if err != nil { 81 var snapshot bytes.Buffer 82 io.Copy(&snapshot, ringBuffer) 83 err = &smithy.DeserializationError{ 84 Err: fmt.Errorf("failed to decode response body, %w", err), 85 Snapshot: snapshot.Bytes(), 86 } 87 return err 88 } 89 90 errorBody.Seek(0, io.SeekStart) 91 if len(code) != 0 { 92 errorCode = restjson.SanitizeErrorCode(code) 93 } 94 if len(message) != 0 { 95 errorMessage = message 96 } 97 98 switch { 99 case strings.EqualFold("InternalServiceException", errorCode): 100 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 101 102 case strings.EqualFold("InvalidParameterException", errorCode): 103 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 104 105 case strings.EqualFold("InvalidRequestException", errorCode): 106 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 107 108 case strings.EqualFold("ResourceConflictException", errorCode): 109 return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) 110 111 case strings.EqualFold("ResourceNotFoundException", errorCode): 112 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 113 114 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 115 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 116 117 case strings.EqualFold("ThrottlingException", errorCode): 118 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 119 120 default: 121 genericError := &smithy.GenericAPIError{ 122 Code: errorCode, 123 Message: errorMessage, 124 } 125 return genericError 126 127 } 128} 129 130type awsRestjson1_deserializeOpAssociateInstanceStorageConfig struct { 131} 132 133func (*awsRestjson1_deserializeOpAssociateInstanceStorageConfig) ID() string { 134 return "OperationDeserializer" 135} 136 137func (m *awsRestjson1_deserializeOpAssociateInstanceStorageConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 138 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 139) { 140 out, metadata, err = next.HandleDeserialize(ctx, in) 141 if err != nil { 142 return out, metadata, err 143 } 144 145 response, ok := out.RawResponse.(*smithyhttp.Response) 146 if !ok { 147 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 148 } 149 150 if response.StatusCode < 200 || response.StatusCode >= 300 { 151 return out, metadata, awsRestjson1_deserializeOpErrorAssociateInstanceStorageConfig(response, &metadata) 152 } 153 output := &AssociateInstanceStorageConfigOutput{} 154 out.Result = output 155 156 var buff [1024]byte 157 ringBuffer := smithyio.NewRingBuffer(buff[:]) 158 159 body := io.TeeReader(response.Body, ringBuffer) 160 161 decoder := json.NewDecoder(body) 162 decoder.UseNumber() 163 var shape interface{} 164 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 165 var snapshot bytes.Buffer 166 io.Copy(&snapshot, ringBuffer) 167 err = &smithy.DeserializationError{ 168 Err: fmt.Errorf("failed to decode response body, %w", err), 169 Snapshot: snapshot.Bytes(), 170 } 171 return out, metadata, err 172 } 173 174 err = awsRestjson1_deserializeOpDocumentAssociateInstanceStorageConfigOutput(&output, shape) 175 if err != nil { 176 var snapshot bytes.Buffer 177 io.Copy(&snapshot, ringBuffer) 178 return out, metadata, &smithy.DeserializationError{ 179 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 180 Snapshot: snapshot.Bytes(), 181 } 182 } 183 184 return out, metadata, err 185} 186 187func awsRestjson1_deserializeOpErrorAssociateInstanceStorageConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 188 var errorBuffer bytes.Buffer 189 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 190 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 191 } 192 errorBody := bytes.NewReader(errorBuffer.Bytes()) 193 194 errorCode := "UnknownError" 195 errorMessage := errorCode 196 197 code := response.Header.Get("X-Amzn-ErrorType") 198 if len(code) != 0 { 199 errorCode = restjson.SanitizeErrorCode(code) 200 } 201 202 var buff [1024]byte 203 ringBuffer := smithyio.NewRingBuffer(buff[:]) 204 205 body := io.TeeReader(errorBody, ringBuffer) 206 decoder := json.NewDecoder(body) 207 decoder.UseNumber() 208 code, message, err := restjson.GetErrorInfo(decoder) 209 if err != nil { 210 var snapshot bytes.Buffer 211 io.Copy(&snapshot, ringBuffer) 212 err = &smithy.DeserializationError{ 213 Err: fmt.Errorf("failed to decode response body, %w", err), 214 Snapshot: snapshot.Bytes(), 215 } 216 return err 217 } 218 219 errorBody.Seek(0, io.SeekStart) 220 if len(code) != 0 { 221 errorCode = restjson.SanitizeErrorCode(code) 222 } 223 if len(message) != 0 { 224 errorMessage = message 225 } 226 227 switch { 228 case strings.EqualFold("InternalServiceException", errorCode): 229 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 230 231 case strings.EqualFold("InvalidParameterException", errorCode): 232 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 233 234 case strings.EqualFold("InvalidRequestException", errorCode): 235 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 236 237 case strings.EqualFold("ResourceConflictException", errorCode): 238 return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) 239 240 case strings.EqualFold("ResourceNotFoundException", errorCode): 241 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 242 243 case strings.EqualFold("ThrottlingException", errorCode): 244 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 245 246 default: 247 genericError := &smithy.GenericAPIError{ 248 Code: errorCode, 249 Message: errorMessage, 250 } 251 return genericError 252 253 } 254} 255 256func awsRestjson1_deserializeOpDocumentAssociateInstanceStorageConfigOutput(v **AssociateInstanceStorageConfigOutput, value interface{}) error { 257 if v == nil { 258 return fmt.Errorf("unexpected nil of type %T", v) 259 } 260 if value == nil { 261 return nil 262 } 263 264 shape, ok := value.(map[string]interface{}) 265 if !ok { 266 return fmt.Errorf("unexpected JSON type %v", value) 267 } 268 269 var sv *AssociateInstanceStorageConfigOutput 270 if *v == nil { 271 sv = &AssociateInstanceStorageConfigOutput{} 272 } else { 273 sv = *v 274 } 275 276 for key, value := range shape { 277 switch key { 278 case "AssociationId": 279 if value != nil { 280 jtv, ok := value.(string) 281 if !ok { 282 return fmt.Errorf("expected AssociationId to be of type string, got %T instead", value) 283 } 284 sv.AssociationId = ptr.String(jtv) 285 } 286 287 default: 288 _, _ = key, value 289 290 } 291 } 292 *v = sv 293 return nil 294} 295 296type awsRestjson1_deserializeOpAssociateLambdaFunction struct { 297} 298 299func (*awsRestjson1_deserializeOpAssociateLambdaFunction) ID() string { 300 return "OperationDeserializer" 301} 302 303func (m *awsRestjson1_deserializeOpAssociateLambdaFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 304 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 305) { 306 out, metadata, err = next.HandleDeserialize(ctx, in) 307 if err != nil { 308 return out, metadata, err 309 } 310 311 response, ok := out.RawResponse.(*smithyhttp.Response) 312 if !ok { 313 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 314 } 315 316 if response.StatusCode < 200 || response.StatusCode >= 300 { 317 return out, metadata, awsRestjson1_deserializeOpErrorAssociateLambdaFunction(response, &metadata) 318 } 319 output := &AssociateLambdaFunctionOutput{} 320 out.Result = output 321 322 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 323 return out, metadata, &smithy.DeserializationError{ 324 Err: fmt.Errorf("failed to discard response body, %w", err), 325 } 326 } 327 328 return out, metadata, err 329} 330 331func awsRestjson1_deserializeOpErrorAssociateLambdaFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { 332 var errorBuffer bytes.Buffer 333 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 334 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 335 } 336 errorBody := bytes.NewReader(errorBuffer.Bytes()) 337 338 errorCode := "UnknownError" 339 errorMessage := errorCode 340 341 code := response.Header.Get("X-Amzn-ErrorType") 342 if len(code) != 0 { 343 errorCode = restjson.SanitizeErrorCode(code) 344 } 345 346 var buff [1024]byte 347 ringBuffer := smithyio.NewRingBuffer(buff[:]) 348 349 body := io.TeeReader(errorBody, ringBuffer) 350 decoder := json.NewDecoder(body) 351 decoder.UseNumber() 352 code, message, err := restjson.GetErrorInfo(decoder) 353 if err != nil { 354 var snapshot bytes.Buffer 355 io.Copy(&snapshot, ringBuffer) 356 err = &smithy.DeserializationError{ 357 Err: fmt.Errorf("failed to decode response body, %w", err), 358 Snapshot: snapshot.Bytes(), 359 } 360 return err 361 } 362 363 errorBody.Seek(0, io.SeekStart) 364 if len(code) != 0 { 365 errorCode = restjson.SanitizeErrorCode(code) 366 } 367 if len(message) != 0 { 368 errorMessage = message 369 } 370 371 switch { 372 case strings.EqualFold("InternalServiceException", errorCode): 373 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 374 375 case strings.EqualFold("InvalidParameterException", errorCode): 376 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 377 378 case strings.EqualFold("InvalidRequestException", errorCode): 379 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 380 381 case strings.EqualFold("ResourceConflictException", errorCode): 382 return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) 383 384 case strings.EqualFold("ResourceNotFoundException", errorCode): 385 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 386 387 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 388 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 389 390 case strings.EqualFold("ThrottlingException", errorCode): 391 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 392 393 default: 394 genericError := &smithy.GenericAPIError{ 395 Code: errorCode, 396 Message: errorMessage, 397 } 398 return genericError 399 400 } 401} 402 403type awsRestjson1_deserializeOpAssociateLexBot struct { 404} 405 406func (*awsRestjson1_deserializeOpAssociateLexBot) ID() string { 407 return "OperationDeserializer" 408} 409 410func (m *awsRestjson1_deserializeOpAssociateLexBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 411 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 412) { 413 out, metadata, err = next.HandleDeserialize(ctx, in) 414 if err != nil { 415 return out, metadata, err 416 } 417 418 response, ok := out.RawResponse.(*smithyhttp.Response) 419 if !ok { 420 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 421 } 422 423 if response.StatusCode < 200 || response.StatusCode >= 300 { 424 return out, metadata, awsRestjson1_deserializeOpErrorAssociateLexBot(response, &metadata) 425 } 426 output := &AssociateLexBotOutput{} 427 out.Result = output 428 429 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 430 return out, metadata, &smithy.DeserializationError{ 431 Err: fmt.Errorf("failed to discard response body, %w", err), 432 } 433 } 434 435 return out, metadata, err 436} 437 438func awsRestjson1_deserializeOpErrorAssociateLexBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 439 var errorBuffer bytes.Buffer 440 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 441 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 442 } 443 errorBody := bytes.NewReader(errorBuffer.Bytes()) 444 445 errorCode := "UnknownError" 446 errorMessage := errorCode 447 448 code := response.Header.Get("X-Amzn-ErrorType") 449 if len(code) != 0 { 450 errorCode = restjson.SanitizeErrorCode(code) 451 } 452 453 var buff [1024]byte 454 ringBuffer := smithyio.NewRingBuffer(buff[:]) 455 456 body := io.TeeReader(errorBody, ringBuffer) 457 decoder := json.NewDecoder(body) 458 decoder.UseNumber() 459 code, message, err := restjson.GetErrorInfo(decoder) 460 if err != nil { 461 var snapshot bytes.Buffer 462 io.Copy(&snapshot, ringBuffer) 463 err = &smithy.DeserializationError{ 464 Err: fmt.Errorf("failed to decode response body, %w", err), 465 Snapshot: snapshot.Bytes(), 466 } 467 return err 468 } 469 470 errorBody.Seek(0, io.SeekStart) 471 if len(code) != 0 { 472 errorCode = restjson.SanitizeErrorCode(code) 473 } 474 if len(message) != 0 { 475 errorMessage = message 476 } 477 478 switch { 479 case strings.EqualFold("InternalServiceException", errorCode): 480 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 481 482 case strings.EqualFold("InvalidParameterException", errorCode): 483 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 484 485 case strings.EqualFold("InvalidRequestException", errorCode): 486 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 487 488 case strings.EqualFold("ResourceConflictException", errorCode): 489 return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) 490 491 case strings.EqualFold("ResourceNotFoundException", errorCode): 492 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 493 494 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 495 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 496 497 case strings.EqualFold("ThrottlingException", errorCode): 498 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 499 500 default: 501 genericError := &smithy.GenericAPIError{ 502 Code: errorCode, 503 Message: errorMessage, 504 } 505 return genericError 506 507 } 508} 509 510type awsRestjson1_deserializeOpAssociateQueueQuickConnects struct { 511} 512 513func (*awsRestjson1_deserializeOpAssociateQueueQuickConnects) ID() string { 514 return "OperationDeserializer" 515} 516 517func (m *awsRestjson1_deserializeOpAssociateQueueQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 518 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 519) { 520 out, metadata, err = next.HandleDeserialize(ctx, in) 521 if err != nil { 522 return out, metadata, err 523 } 524 525 response, ok := out.RawResponse.(*smithyhttp.Response) 526 if !ok { 527 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 528 } 529 530 if response.StatusCode < 200 || response.StatusCode >= 300 { 531 return out, metadata, awsRestjson1_deserializeOpErrorAssociateQueueQuickConnects(response, &metadata) 532 } 533 output := &AssociateQueueQuickConnectsOutput{} 534 out.Result = output 535 536 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 537 return out, metadata, &smithy.DeserializationError{ 538 Err: fmt.Errorf("failed to discard response body, %w", err), 539 } 540 } 541 542 return out, metadata, err 543} 544 545func awsRestjson1_deserializeOpErrorAssociateQueueQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { 546 var errorBuffer bytes.Buffer 547 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 548 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 549 } 550 errorBody := bytes.NewReader(errorBuffer.Bytes()) 551 552 errorCode := "UnknownError" 553 errorMessage := errorCode 554 555 code := response.Header.Get("X-Amzn-ErrorType") 556 if len(code) != 0 { 557 errorCode = restjson.SanitizeErrorCode(code) 558 } 559 560 var buff [1024]byte 561 ringBuffer := smithyio.NewRingBuffer(buff[:]) 562 563 body := io.TeeReader(errorBody, ringBuffer) 564 decoder := json.NewDecoder(body) 565 decoder.UseNumber() 566 code, message, err := restjson.GetErrorInfo(decoder) 567 if err != nil { 568 var snapshot bytes.Buffer 569 io.Copy(&snapshot, ringBuffer) 570 err = &smithy.DeserializationError{ 571 Err: fmt.Errorf("failed to decode response body, %w", err), 572 Snapshot: snapshot.Bytes(), 573 } 574 return err 575 } 576 577 errorBody.Seek(0, io.SeekStart) 578 if len(code) != 0 { 579 errorCode = restjson.SanitizeErrorCode(code) 580 } 581 if len(message) != 0 { 582 errorMessage = message 583 } 584 585 switch { 586 case strings.EqualFold("InternalServiceException", errorCode): 587 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 588 589 case strings.EqualFold("InvalidParameterException", errorCode): 590 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 591 592 case strings.EqualFold("InvalidRequestException", errorCode): 593 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 594 595 case strings.EqualFold("LimitExceededException", errorCode): 596 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 597 598 case strings.EqualFold("ResourceNotFoundException", errorCode): 599 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 600 601 case strings.EqualFold("ThrottlingException", errorCode): 602 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 603 604 default: 605 genericError := &smithy.GenericAPIError{ 606 Code: errorCode, 607 Message: errorMessage, 608 } 609 return genericError 610 611 } 612} 613 614type awsRestjson1_deserializeOpAssociateRoutingProfileQueues struct { 615} 616 617func (*awsRestjson1_deserializeOpAssociateRoutingProfileQueues) ID() string { 618 return "OperationDeserializer" 619} 620 621func (m *awsRestjson1_deserializeOpAssociateRoutingProfileQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 622 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 623) { 624 out, metadata, err = next.HandleDeserialize(ctx, in) 625 if err != nil { 626 return out, metadata, err 627 } 628 629 response, ok := out.RawResponse.(*smithyhttp.Response) 630 if !ok { 631 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 632 } 633 634 if response.StatusCode < 200 || response.StatusCode >= 300 { 635 return out, metadata, awsRestjson1_deserializeOpErrorAssociateRoutingProfileQueues(response, &metadata) 636 } 637 output := &AssociateRoutingProfileQueuesOutput{} 638 out.Result = output 639 640 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 641 return out, metadata, &smithy.DeserializationError{ 642 Err: fmt.Errorf("failed to discard response body, %w", err), 643 } 644 } 645 646 return out, metadata, err 647} 648 649func awsRestjson1_deserializeOpErrorAssociateRoutingProfileQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { 650 var errorBuffer bytes.Buffer 651 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 652 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 653 } 654 errorBody := bytes.NewReader(errorBuffer.Bytes()) 655 656 errorCode := "UnknownError" 657 errorMessage := errorCode 658 659 code := response.Header.Get("X-Amzn-ErrorType") 660 if len(code) != 0 { 661 errorCode = restjson.SanitizeErrorCode(code) 662 } 663 664 var buff [1024]byte 665 ringBuffer := smithyio.NewRingBuffer(buff[:]) 666 667 body := io.TeeReader(errorBody, ringBuffer) 668 decoder := json.NewDecoder(body) 669 decoder.UseNumber() 670 code, message, err := restjson.GetErrorInfo(decoder) 671 if err != nil { 672 var snapshot bytes.Buffer 673 io.Copy(&snapshot, ringBuffer) 674 err = &smithy.DeserializationError{ 675 Err: fmt.Errorf("failed to decode response body, %w", err), 676 Snapshot: snapshot.Bytes(), 677 } 678 return err 679 } 680 681 errorBody.Seek(0, io.SeekStart) 682 if len(code) != 0 { 683 errorCode = restjson.SanitizeErrorCode(code) 684 } 685 if len(message) != 0 { 686 errorMessage = message 687 } 688 689 switch { 690 case strings.EqualFold("InternalServiceException", errorCode): 691 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 692 693 case strings.EqualFold("InvalidParameterException", errorCode): 694 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 695 696 case strings.EqualFold("InvalidRequestException", errorCode): 697 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 698 699 case strings.EqualFold("ResourceNotFoundException", errorCode): 700 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 701 702 case strings.EqualFold("ThrottlingException", errorCode): 703 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 704 705 default: 706 genericError := &smithy.GenericAPIError{ 707 Code: errorCode, 708 Message: errorMessage, 709 } 710 return genericError 711 712 } 713} 714 715type awsRestjson1_deserializeOpAssociateSecurityKey struct { 716} 717 718func (*awsRestjson1_deserializeOpAssociateSecurityKey) ID() string { 719 return "OperationDeserializer" 720} 721 722func (m *awsRestjson1_deserializeOpAssociateSecurityKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 723 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 724) { 725 out, metadata, err = next.HandleDeserialize(ctx, in) 726 if err != nil { 727 return out, metadata, err 728 } 729 730 response, ok := out.RawResponse.(*smithyhttp.Response) 731 if !ok { 732 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 733 } 734 735 if response.StatusCode < 200 || response.StatusCode >= 300 { 736 return out, metadata, awsRestjson1_deserializeOpErrorAssociateSecurityKey(response, &metadata) 737 } 738 output := &AssociateSecurityKeyOutput{} 739 out.Result = output 740 741 var buff [1024]byte 742 ringBuffer := smithyio.NewRingBuffer(buff[:]) 743 744 body := io.TeeReader(response.Body, ringBuffer) 745 746 decoder := json.NewDecoder(body) 747 decoder.UseNumber() 748 var shape interface{} 749 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 750 var snapshot bytes.Buffer 751 io.Copy(&snapshot, ringBuffer) 752 err = &smithy.DeserializationError{ 753 Err: fmt.Errorf("failed to decode response body, %w", err), 754 Snapshot: snapshot.Bytes(), 755 } 756 return out, metadata, err 757 } 758 759 err = awsRestjson1_deserializeOpDocumentAssociateSecurityKeyOutput(&output, shape) 760 if err != nil { 761 var snapshot bytes.Buffer 762 io.Copy(&snapshot, ringBuffer) 763 return out, metadata, &smithy.DeserializationError{ 764 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 765 Snapshot: snapshot.Bytes(), 766 } 767 } 768 769 return out, metadata, err 770} 771 772func awsRestjson1_deserializeOpErrorAssociateSecurityKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 773 var errorBuffer bytes.Buffer 774 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 775 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 776 } 777 errorBody := bytes.NewReader(errorBuffer.Bytes()) 778 779 errorCode := "UnknownError" 780 errorMessage := errorCode 781 782 code := response.Header.Get("X-Amzn-ErrorType") 783 if len(code) != 0 { 784 errorCode = restjson.SanitizeErrorCode(code) 785 } 786 787 var buff [1024]byte 788 ringBuffer := smithyio.NewRingBuffer(buff[:]) 789 790 body := io.TeeReader(errorBody, ringBuffer) 791 decoder := json.NewDecoder(body) 792 decoder.UseNumber() 793 code, message, err := restjson.GetErrorInfo(decoder) 794 if err != nil { 795 var snapshot bytes.Buffer 796 io.Copy(&snapshot, ringBuffer) 797 err = &smithy.DeserializationError{ 798 Err: fmt.Errorf("failed to decode response body, %w", err), 799 Snapshot: snapshot.Bytes(), 800 } 801 return err 802 } 803 804 errorBody.Seek(0, io.SeekStart) 805 if len(code) != 0 { 806 errorCode = restjson.SanitizeErrorCode(code) 807 } 808 if len(message) != 0 { 809 errorMessage = message 810 } 811 812 switch { 813 case strings.EqualFold("InternalServiceException", errorCode): 814 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 815 816 case strings.EqualFold("InvalidParameterException", errorCode): 817 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 818 819 case strings.EqualFold("InvalidRequestException", errorCode): 820 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 821 822 case strings.EqualFold("ResourceConflictException", errorCode): 823 return awsRestjson1_deserializeErrorResourceConflictException(response, errorBody) 824 825 case strings.EqualFold("ResourceNotFoundException", errorCode): 826 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 827 828 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 829 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 830 831 case strings.EqualFold("ThrottlingException", errorCode): 832 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 833 834 default: 835 genericError := &smithy.GenericAPIError{ 836 Code: errorCode, 837 Message: errorMessage, 838 } 839 return genericError 840 841 } 842} 843 844func awsRestjson1_deserializeOpDocumentAssociateSecurityKeyOutput(v **AssociateSecurityKeyOutput, value interface{}) error { 845 if v == nil { 846 return fmt.Errorf("unexpected nil of type %T", v) 847 } 848 if value == nil { 849 return nil 850 } 851 852 shape, ok := value.(map[string]interface{}) 853 if !ok { 854 return fmt.Errorf("unexpected JSON type %v", value) 855 } 856 857 var sv *AssociateSecurityKeyOutput 858 if *v == nil { 859 sv = &AssociateSecurityKeyOutput{} 860 } else { 861 sv = *v 862 } 863 864 for key, value := range shape { 865 switch key { 866 case "AssociationId": 867 if value != nil { 868 jtv, ok := value.(string) 869 if !ok { 870 return fmt.Errorf("expected AssociationId to be of type string, got %T instead", value) 871 } 872 sv.AssociationId = ptr.String(jtv) 873 } 874 875 default: 876 _, _ = key, value 877 878 } 879 } 880 *v = sv 881 return nil 882} 883 884type awsRestjson1_deserializeOpCreateContactFlow struct { 885} 886 887func (*awsRestjson1_deserializeOpCreateContactFlow) ID() string { 888 return "OperationDeserializer" 889} 890 891func (m *awsRestjson1_deserializeOpCreateContactFlow) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 892 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 893) { 894 out, metadata, err = next.HandleDeserialize(ctx, in) 895 if err != nil { 896 return out, metadata, err 897 } 898 899 response, ok := out.RawResponse.(*smithyhttp.Response) 900 if !ok { 901 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 902 } 903 904 if response.StatusCode < 200 || response.StatusCode >= 300 { 905 return out, metadata, awsRestjson1_deserializeOpErrorCreateContactFlow(response, &metadata) 906 } 907 output := &CreateContactFlowOutput{} 908 out.Result = output 909 910 var buff [1024]byte 911 ringBuffer := smithyio.NewRingBuffer(buff[:]) 912 913 body := io.TeeReader(response.Body, ringBuffer) 914 915 decoder := json.NewDecoder(body) 916 decoder.UseNumber() 917 var shape interface{} 918 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 919 var snapshot bytes.Buffer 920 io.Copy(&snapshot, ringBuffer) 921 err = &smithy.DeserializationError{ 922 Err: fmt.Errorf("failed to decode response body, %w", err), 923 Snapshot: snapshot.Bytes(), 924 } 925 return out, metadata, err 926 } 927 928 err = awsRestjson1_deserializeOpDocumentCreateContactFlowOutput(&output, shape) 929 if err != nil { 930 var snapshot bytes.Buffer 931 io.Copy(&snapshot, ringBuffer) 932 return out, metadata, &smithy.DeserializationError{ 933 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 934 Snapshot: snapshot.Bytes(), 935 } 936 } 937 938 return out, metadata, err 939} 940 941func awsRestjson1_deserializeOpErrorCreateContactFlow(response *smithyhttp.Response, metadata *middleware.Metadata) error { 942 var errorBuffer bytes.Buffer 943 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 944 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 945 } 946 errorBody := bytes.NewReader(errorBuffer.Bytes()) 947 948 errorCode := "UnknownError" 949 errorMessage := errorCode 950 951 code := response.Header.Get("X-Amzn-ErrorType") 952 if len(code) != 0 { 953 errorCode = restjson.SanitizeErrorCode(code) 954 } 955 956 var buff [1024]byte 957 ringBuffer := smithyio.NewRingBuffer(buff[:]) 958 959 body := io.TeeReader(errorBody, ringBuffer) 960 decoder := json.NewDecoder(body) 961 decoder.UseNumber() 962 code, message, err := restjson.GetErrorInfo(decoder) 963 if err != nil { 964 var snapshot bytes.Buffer 965 io.Copy(&snapshot, ringBuffer) 966 err = &smithy.DeserializationError{ 967 Err: fmt.Errorf("failed to decode response body, %w", err), 968 Snapshot: snapshot.Bytes(), 969 } 970 return err 971 } 972 973 errorBody.Seek(0, io.SeekStart) 974 if len(code) != 0 { 975 errorCode = restjson.SanitizeErrorCode(code) 976 } 977 if len(message) != 0 { 978 errorMessage = message 979 } 980 981 switch { 982 case strings.EqualFold("DuplicateResourceException", errorCode): 983 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 984 985 case strings.EqualFold("InternalServiceException", errorCode): 986 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 987 988 case strings.EqualFold("InvalidContactFlowException", errorCode): 989 return awsRestjson1_deserializeErrorInvalidContactFlowException(response, errorBody) 990 991 case strings.EqualFold("InvalidParameterException", errorCode): 992 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 993 994 case strings.EqualFold("InvalidRequestException", errorCode): 995 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 996 997 case strings.EqualFold("LimitExceededException", errorCode): 998 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 999 1000 case strings.EqualFold("ResourceNotFoundException", errorCode): 1001 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1002 1003 case strings.EqualFold("ThrottlingException", errorCode): 1004 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1005 1006 default: 1007 genericError := &smithy.GenericAPIError{ 1008 Code: errorCode, 1009 Message: errorMessage, 1010 } 1011 return genericError 1012 1013 } 1014} 1015 1016func awsRestjson1_deserializeOpDocumentCreateContactFlowOutput(v **CreateContactFlowOutput, value interface{}) error { 1017 if v == nil { 1018 return fmt.Errorf("unexpected nil of type %T", v) 1019 } 1020 if value == nil { 1021 return nil 1022 } 1023 1024 shape, ok := value.(map[string]interface{}) 1025 if !ok { 1026 return fmt.Errorf("unexpected JSON type %v", value) 1027 } 1028 1029 var sv *CreateContactFlowOutput 1030 if *v == nil { 1031 sv = &CreateContactFlowOutput{} 1032 } else { 1033 sv = *v 1034 } 1035 1036 for key, value := range shape { 1037 switch key { 1038 case "ContactFlowArn": 1039 if value != nil { 1040 jtv, ok := value.(string) 1041 if !ok { 1042 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 1043 } 1044 sv.ContactFlowArn = ptr.String(jtv) 1045 } 1046 1047 case "ContactFlowId": 1048 if value != nil { 1049 jtv, ok := value.(string) 1050 if !ok { 1051 return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) 1052 } 1053 sv.ContactFlowId = ptr.String(jtv) 1054 } 1055 1056 default: 1057 _, _ = key, value 1058 1059 } 1060 } 1061 *v = sv 1062 return nil 1063} 1064 1065type awsRestjson1_deserializeOpCreateInstance struct { 1066} 1067 1068func (*awsRestjson1_deserializeOpCreateInstance) ID() string { 1069 return "OperationDeserializer" 1070} 1071 1072func (m *awsRestjson1_deserializeOpCreateInstance) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1073 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1074) { 1075 out, metadata, err = next.HandleDeserialize(ctx, in) 1076 if err != nil { 1077 return out, metadata, err 1078 } 1079 1080 response, ok := out.RawResponse.(*smithyhttp.Response) 1081 if !ok { 1082 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1083 } 1084 1085 if response.StatusCode < 200 || response.StatusCode >= 300 { 1086 return out, metadata, awsRestjson1_deserializeOpErrorCreateInstance(response, &metadata) 1087 } 1088 output := &CreateInstanceOutput{} 1089 out.Result = output 1090 1091 var buff [1024]byte 1092 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1093 1094 body := io.TeeReader(response.Body, ringBuffer) 1095 1096 decoder := json.NewDecoder(body) 1097 decoder.UseNumber() 1098 var shape interface{} 1099 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1100 var snapshot bytes.Buffer 1101 io.Copy(&snapshot, ringBuffer) 1102 err = &smithy.DeserializationError{ 1103 Err: fmt.Errorf("failed to decode response body, %w", err), 1104 Snapshot: snapshot.Bytes(), 1105 } 1106 return out, metadata, err 1107 } 1108 1109 err = awsRestjson1_deserializeOpDocumentCreateInstanceOutput(&output, shape) 1110 if err != nil { 1111 var snapshot bytes.Buffer 1112 io.Copy(&snapshot, ringBuffer) 1113 return out, metadata, &smithy.DeserializationError{ 1114 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1115 Snapshot: snapshot.Bytes(), 1116 } 1117 } 1118 1119 return out, metadata, err 1120} 1121 1122func awsRestjson1_deserializeOpErrorCreateInstance(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1123 var errorBuffer bytes.Buffer 1124 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1125 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1126 } 1127 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1128 1129 errorCode := "UnknownError" 1130 errorMessage := errorCode 1131 1132 code := response.Header.Get("X-Amzn-ErrorType") 1133 if len(code) != 0 { 1134 errorCode = restjson.SanitizeErrorCode(code) 1135 } 1136 1137 var buff [1024]byte 1138 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1139 1140 body := io.TeeReader(errorBody, ringBuffer) 1141 decoder := json.NewDecoder(body) 1142 decoder.UseNumber() 1143 code, message, err := restjson.GetErrorInfo(decoder) 1144 if err != nil { 1145 var snapshot bytes.Buffer 1146 io.Copy(&snapshot, ringBuffer) 1147 err = &smithy.DeserializationError{ 1148 Err: fmt.Errorf("failed to decode response body, %w", err), 1149 Snapshot: snapshot.Bytes(), 1150 } 1151 return err 1152 } 1153 1154 errorBody.Seek(0, io.SeekStart) 1155 if len(code) != 0 { 1156 errorCode = restjson.SanitizeErrorCode(code) 1157 } 1158 if len(message) != 0 { 1159 errorMessage = message 1160 } 1161 1162 switch { 1163 case strings.EqualFold("InternalServiceException", errorCode): 1164 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 1165 1166 case strings.EqualFold("InvalidRequestException", errorCode): 1167 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 1168 1169 case strings.EqualFold("ResourceNotFoundException", errorCode): 1170 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1171 1172 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1173 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1174 1175 case strings.EqualFold("ThrottlingException", errorCode): 1176 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1177 1178 default: 1179 genericError := &smithy.GenericAPIError{ 1180 Code: errorCode, 1181 Message: errorMessage, 1182 } 1183 return genericError 1184 1185 } 1186} 1187 1188func awsRestjson1_deserializeOpDocumentCreateInstanceOutput(v **CreateInstanceOutput, value interface{}) error { 1189 if v == nil { 1190 return fmt.Errorf("unexpected nil of type %T", v) 1191 } 1192 if value == nil { 1193 return nil 1194 } 1195 1196 shape, ok := value.(map[string]interface{}) 1197 if !ok { 1198 return fmt.Errorf("unexpected JSON type %v", value) 1199 } 1200 1201 var sv *CreateInstanceOutput 1202 if *v == nil { 1203 sv = &CreateInstanceOutput{} 1204 } else { 1205 sv = *v 1206 } 1207 1208 for key, value := range shape { 1209 switch key { 1210 case "Arn": 1211 if value != nil { 1212 jtv, ok := value.(string) 1213 if !ok { 1214 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 1215 } 1216 sv.Arn = ptr.String(jtv) 1217 } 1218 1219 case "Id": 1220 if value != nil { 1221 jtv, ok := value.(string) 1222 if !ok { 1223 return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) 1224 } 1225 sv.Id = ptr.String(jtv) 1226 } 1227 1228 default: 1229 _, _ = key, value 1230 1231 } 1232 } 1233 *v = sv 1234 return nil 1235} 1236 1237type awsRestjson1_deserializeOpCreateIntegrationAssociation struct { 1238} 1239 1240func (*awsRestjson1_deserializeOpCreateIntegrationAssociation) ID() string { 1241 return "OperationDeserializer" 1242} 1243 1244func (m *awsRestjson1_deserializeOpCreateIntegrationAssociation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1245 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1246) { 1247 out, metadata, err = next.HandleDeserialize(ctx, in) 1248 if err != nil { 1249 return out, metadata, err 1250 } 1251 1252 response, ok := out.RawResponse.(*smithyhttp.Response) 1253 if !ok { 1254 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1255 } 1256 1257 if response.StatusCode < 200 || response.StatusCode >= 300 { 1258 return out, metadata, awsRestjson1_deserializeOpErrorCreateIntegrationAssociation(response, &metadata) 1259 } 1260 output := &CreateIntegrationAssociationOutput{} 1261 out.Result = output 1262 1263 var buff [1024]byte 1264 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1265 1266 body := io.TeeReader(response.Body, ringBuffer) 1267 1268 decoder := json.NewDecoder(body) 1269 decoder.UseNumber() 1270 var shape interface{} 1271 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1272 var snapshot bytes.Buffer 1273 io.Copy(&snapshot, ringBuffer) 1274 err = &smithy.DeserializationError{ 1275 Err: fmt.Errorf("failed to decode response body, %w", err), 1276 Snapshot: snapshot.Bytes(), 1277 } 1278 return out, metadata, err 1279 } 1280 1281 err = awsRestjson1_deserializeOpDocumentCreateIntegrationAssociationOutput(&output, shape) 1282 if err != nil { 1283 var snapshot bytes.Buffer 1284 io.Copy(&snapshot, ringBuffer) 1285 return out, metadata, &smithy.DeserializationError{ 1286 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1287 Snapshot: snapshot.Bytes(), 1288 } 1289 } 1290 1291 return out, metadata, err 1292} 1293 1294func awsRestjson1_deserializeOpErrorCreateIntegrationAssociation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1295 var errorBuffer bytes.Buffer 1296 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1297 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1298 } 1299 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1300 1301 errorCode := "UnknownError" 1302 errorMessage := errorCode 1303 1304 code := response.Header.Get("X-Amzn-ErrorType") 1305 if len(code) != 0 { 1306 errorCode = restjson.SanitizeErrorCode(code) 1307 } 1308 1309 var buff [1024]byte 1310 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1311 1312 body := io.TeeReader(errorBody, ringBuffer) 1313 decoder := json.NewDecoder(body) 1314 decoder.UseNumber() 1315 code, message, err := restjson.GetErrorInfo(decoder) 1316 if err != nil { 1317 var snapshot bytes.Buffer 1318 io.Copy(&snapshot, ringBuffer) 1319 err = &smithy.DeserializationError{ 1320 Err: fmt.Errorf("failed to decode response body, %w", err), 1321 Snapshot: snapshot.Bytes(), 1322 } 1323 return err 1324 } 1325 1326 errorBody.Seek(0, io.SeekStart) 1327 if len(code) != 0 { 1328 errorCode = restjson.SanitizeErrorCode(code) 1329 } 1330 if len(message) != 0 { 1331 errorMessage = message 1332 } 1333 1334 switch { 1335 case strings.EqualFold("DuplicateResourceException", errorCode): 1336 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 1337 1338 case strings.EqualFold("InternalServiceException", errorCode): 1339 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 1340 1341 case strings.EqualFold("InvalidRequestException", errorCode): 1342 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 1343 1344 case strings.EqualFold("ResourceNotFoundException", errorCode): 1345 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1346 1347 case strings.EqualFold("ThrottlingException", errorCode): 1348 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1349 1350 default: 1351 genericError := &smithy.GenericAPIError{ 1352 Code: errorCode, 1353 Message: errorMessage, 1354 } 1355 return genericError 1356 1357 } 1358} 1359 1360func awsRestjson1_deserializeOpDocumentCreateIntegrationAssociationOutput(v **CreateIntegrationAssociationOutput, value interface{}) error { 1361 if v == nil { 1362 return fmt.Errorf("unexpected nil of type %T", v) 1363 } 1364 if value == nil { 1365 return nil 1366 } 1367 1368 shape, ok := value.(map[string]interface{}) 1369 if !ok { 1370 return fmt.Errorf("unexpected JSON type %v", value) 1371 } 1372 1373 var sv *CreateIntegrationAssociationOutput 1374 if *v == nil { 1375 sv = &CreateIntegrationAssociationOutput{} 1376 } else { 1377 sv = *v 1378 } 1379 1380 for key, value := range shape { 1381 switch key { 1382 case "IntegrationAssociationArn": 1383 if value != nil { 1384 jtv, ok := value.(string) 1385 if !ok { 1386 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 1387 } 1388 sv.IntegrationAssociationArn = ptr.String(jtv) 1389 } 1390 1391 case "IntegrationAssociationId": 1392 if value != nil { 1393 jtv, ok := value.(string) 1394 if !ok { 1395 return fmt.Errorf("expected IntegrationAssociationId to be of type string, got %T instead", value) 1396 } 1397 sv.IntegrationAssociationId = ptr.String(jtv) 1398 } 1399 1400 default: 1401 _, _ = key, value 1402 1403 } 1404 } 1405 *v = sv 1406 return nil 1407} 1408 1409type awsRestjson1_deserializeOpCreateQueue struct { 1410} 1411 1412func (*awsRestjson1_deserializeOpCreateQueue) ID() string { 1413 return "OperationDeserializer" 1414} 1415 1416func (m *awsRestjson1_deserializeOpCreateQueue) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1417 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1418) { 1419 out, metadata, err = next.HandleDeserialize(ctx, in) 1420 if err != nil { 1421 return out, metadata, err 1422 } 1423 1424 response, ok := out.RawResponse.(*smithyhttp.Response) 1425 if !ok { 1426 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1427 } 1428 1429 if response.StatusCode < 200 || response.StatusCode >= 300 { 1430 return out, metadata, awsRestjson1_deserializeOpErrorCreateQueue(response, &metadata) 1431 } 1432 output := &CreateQueueOutput{} 1433 out.Result = output 1434 1435 var buff [1024]byte 1436 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1437 1438 body := io.TeeReader(response.Body, ringBuffer) 1439 1440 decoder := json.NewDecoder(body) 1441 decoder.UseNumber() 1442 var shape interface{} 1443 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1444 var snapshot bytes.Buffer 1445 io.Copy(&snapshot, ringBuffer) 1446 err = &smithy.DeserializationError{ 1447 Err: fmt.Errorf("failed to decode response body, %w", err), 1448 Snapshot: snapshot.Bytes(), 1449 } 1450 return out, metadata, err 1451 } 1452 1453 err = awsRestjson1_deserializeOpDocumentCreateQueueOutput(&output, shape) 1454 if err != nil { 1455 var snapshot bytes.Buffer 1456 io.Copy(&snapshot, ringBuffer) 1457 return out, metadata, &smithy.DeserializationError{ 1458 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1459 Snapshot: snapshot.Bytes(), 1460 } 1461 } 1462 1463 return out, metadata, err 1464} 1465 1466func awsRestjson1_deserializeOpErrorCreateQueue(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1467 var errorBuffer bytes.Buffer 1468 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1469 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1470 } 1471 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1472 1473 errorCode := "UnknownError" 1474 errorMessage := errorCode 1475 1476 code := response.Header.Get("X-Amzn-ErrorType") 1477 if len(code) != 0 { 1478 errorCode = restjson.SanitizeErrorCode(code) 1479 } 1480 1481 var buff [1024]byte 1482 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1483 1484 body := io.TeeReader(errorBody, ringBuffer) 1485 decoder := json.NewDecoder(body) 1486 decoder.UseNumber() 1487 code, message, err := restjson.GetErrorInfo(decoder) 1488 if err != nil { 1489 var snapshot bytes.Buffer 1490 io.Copy(&snapshot, ringBuffer) 1491 err = &smithy.DeserializationError{ 1492 Err: fmt.Errorf("failed to decode response body, %w", err), 1493 Snapshot: snapshot.Bytes(), 1494 } 1495 return err 1496 } 1497 1498 errorBody.Seek(0, io.SeekStart) 1499 if len(code) != 0 { 1500 errorCode = restjson.SanitizeErrorCode(code) 1501 } 1502 if len(message) != 0 { 1503 errorMessage = message 1504 } 1505 1506 switch { 1507 case strings.EqualFold("DuplicateResourceException", errorCode): 1508 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 1509 1510 case strings.EqualFold("InternalServiceException", errorCode): 1511 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 1512 1513 case strings.EqualFold("InvalidParameterException", errorCode): 1514 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1515 1516 case strings.EqualFold("InvalidRequestException", errorCode): 1517 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 1518 1519 case strings.EqualFold("LimitExceededException", errorCode): 1520 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1521 1522 case strings.EqualFold("ResourceNotFoundException", errorCode): 1523 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1524 1525 case strings.EqualFold("ThrottlingException", errorCode): 1526 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1527 1528 default: 1529 genericError := &smithy.GenericAPIError{ 1530 Code: errorCode, 1531 Message: errorMessage, 1532 } 1533 return genericError 1534 1535 } 1536} 1537 1538func awsRestjson1_deserializeOpDocumentCreateQueueOutput(v **CreateQueueOutput, value interface{}) error { 1539 if v == nil { 1540 return fmt.Errorf("unexpected nil of type %T", v) 1541 } 1542 if value == nil { 1543 return nil 1544 } 1545 1546 shape, ok := value.(map[string]interface{}) 1547 if !ok { 1548 return fmt.Errorf("unexpected JSON type %v", value) 1549 } 1550 1551 var sv *CreateQueueOutput 1552 if *v == nil { 1553 sv = &CreateQueueOutput{} 1554 } else { 1555 sv = *v 1556 } 1557 1558 for key, value := range shape { 1559 switch key { 1560 case "QueueArn": 1561 if value != nil { 1562 jtv, ok := value.(string) 1563 if !ok { 1564 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 1565 } 1566 sv.QueueArn = ptr.String(jtv) 1567 } 1568 1569 case "QueueId": 1570 if value != nil { 1571 jtv, ok := value.(string) 1572 if !ok { 1573 return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) 1574 } 1575 sv.QueueId = ptr.String(jtv) 1576 } 1577 1578 default: 1579 _, _ = key, value 1580 1581 } 1582 } 1583 *v = sv 1584 return nil 1585} 1586 1587type awsRestjson1_deserializeOpCreateQuickConnect struct { 1588} 1589 1590func (*awsRestjson1_deserializeOpCreateQuickConnect) ID() string { 1591 return "OperationDeserializer" 1592} 1593 1594func (m *awsRestjson1_deserializeOpCreateQuickConnect) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1595 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1596) { 1597 out, metadata, err = next.HandleDeserialize(ctx, in) 1598 if err != nil { 1599 return out, metadata, err 1600 } 1601 1602 response, ok := out.RawResponse.(*smithyhttp.Response) 1603 if !ok { 1604 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1605 } 1606 1607 if response.StatusCode < 200 || response.StatusCode >= 300 { 1608 return out, metadata, awsRestjson1_deserializeOpErrorCreateQuickConnect(response, &metadata) 1609 } 1610 output := &CreateQuickConnectOutput{} 1611 out.Result = output 1612 1613 var buff [1024]byte 1614 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1615 1616 body := io.TeeReader(response.Body, ringBuffer) 1617 1618 decoder := json.NewDecoder(body) 1619 decoder.UseNumber() 1620 var shape interface{} 1621 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1622 var snapshot bytes.Buffer 1623 io.Copy(&snapshot, ringBuffer) 1624 err = &smithy.DeserializationError{ 1625 Err: fmt.Errorf("failed to decode response body, %w", err), 1626 Snapshot: snapshot.Bytes(), 1627 } 1628 return out, metadata, err 1629 } 1630 1631 err = awsRestjson1_deserializeOpDocumentCreateQuickConnectOutput(&output, shape) 1632 if err != nil { 1633 var snapshot bytes.Buffer 1634 io.Copy(&snapshot, ringBuffer) 1635 return out, metadata, &smithy.DeserializationError{ 1636 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1637 Snapshot: snapshot.Bytes(), 1638 } 1639 } 1640 1641 return out, metadata, err 1642} 1643 1644func awsRestjson1_deserializeOpErrorCreateQuickConnect(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1645 var errorBuffer bytes.Buffer 1646 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1647 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1648 } 1649 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1650 1651 errorCode := "UnknownError" 1652 errorMessage := errorCode 1653 1654 code := response.Header.Get("X-Amzn-ErrorType") 1655 if len(code) != 0 { 1656 errorCode = restjson.SanitizeErrorCode(code) 1657 } 1658 1659 var buff [1024]byte 1660 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1661 1662 body := io.TeeReader(errorBody, ringBuffer) 1663 decoder := json.NewDecoder(body) 1664 decoder.UseNumber() 1665 code, message, err := restjson.GetErrorInfo(decoder) 1666 if err != nil { 1667 var snapshot bytes.Buffer 1668 io.Copy(&snapshot, ringBuffer) 1669 err = &smithy.DeserializationError{ 1670 Err: fmt.Errorf("failed to decode response body, %w", err), 1671 Snapshot: snapshot.Bytes(), 1672 } 1673 return err 1674 } 1675 1676 errorBody.Seek(0, io.SeekStart) 1677 if len(code) != 0 { 1678 errorCode = restjson.SanitizeErrorCode(code) 1679 } 1680 if len(message) != 0 { 1681 errorMessage = message 1682 } 1683 1684 switch { 1685 case strings.EqualFold("DuplicateResourceException", errorCode): 1686 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 1687 1688 case strings.EqualFold("InternalServiceException", errorCode): 1689 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 1690 1691 case strings.EqualFold("InvalidParameterException", errorCode): 1692 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1693 1694 case strings.EqualFold("InvalidRequestException", errorCode): 1695 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 1696 1697 case strings.EqualFold("LimitExceededException", errorCode): 1698 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1699 1700 case strings.EqualFold("ResourceNotFoundException", errorCode): 1701 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1702 1703 case strings.EqualFold("ThrottlingException", errorCode): 1704 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1705 1706 default: 1707 genericError := &smithy.GenericAPIError{ 1708 Code: errorCode, 1709 Message: errorMessage, 1710 } 1711 return genericError 1712 1713 } 1714} 1715 1716func awsRestjson1_deserializeOpDocumentCreateQuickConnectOutput(v **CreateQuickConnectOutput, value interface{}) error { 1717 if v == nil { 1718 return fmt.Errorf("unexpected nil of type %T", v) 1719 } 1720 if value == nil { 1721 return nil 1722 } 1723 1724 shape, ok := value.(map[string]interface{}) 1725 if !ok { 1726 return fmt.Errorf("unexpected JSON type %v", value) 1727 } 1728 1729 var sv *CreateQuickConnectOutput 1730 if *v == nil { 1731 sv = &CreateQuickConnectOutput{} 1732 } else { 1733 sv = *v 1734 } 1735 1736 for key, value := range shape { 1737 switch key { 1738 case "QuickConnectARN": 1739 if value != nil { 1740 jtv, ok := value.(string) 1741 if !ok { 1742 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 1743 } 1744 sv.QuickConnectARN = ptr.String(jtv) 1745 } 1746 1747 case "QuickConnectId": 1748 if value != nil { 1749 jtv, ok := value.(string) 1750 if !ok { 1751 return fmt.Errorf("expected QuickConnectId to be of type string, got %T instead", value) 1752 } 1753 sv.QuickConnectId = ptr.String(jtv) 1754 } 1755 1756 default: 1757 _, _ = key, value 1758 1759 } 1760 } 1761 *v = sv 1762 return nil 1763} 1764 1765type awsRestjson1_deserializeOpCreateRoutingProfile struct { 1766} 1767 1768func (*awsRestjson1_deserializeOpCreateRoutingProfile) ID() string { 1769 return "OperationDeserializer" 1770} 1771 1772func (m *awsRestjson1_deserializeOpCreateRoutingProfile) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1773 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1774) { 1775 out, metadata, err = next.HandleDeserialize(ctx, in) 1776 if err != nil { 1777 return out, metadata, err 1778 } 1779 1780 response, ok := out.RawResponse.(*smithyhttp.Response) 1781 if !ok { 1782 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1783 } 1784 1785 if response.StatusCode < 200 || response.StatusCode >= 300 { 1786 return out, metadata, awsRestjson1_deserializeOpErrorCreateRoutingProfile(response, &metadata) 1787 } 1788 output := &CreateRoutingProfileOutput{} 1789 out.Result = output 1790 1791 var buff [1024]byte 1792 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1793 1794 body := io.TeeReader(response.Body, ringBuffer) 1795 1796 decoder := json.NewDecoder(body) 1797 decoder.UseNumber() 1798 var shape interface{} 1799 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1800 var snapshot bytes.Buffer 1801 io.Copy(&snapshot, ringBuffer) 1802 err = &smithy.DeserializationError{ 1803 Err: fmt.Errorf("failed to decode response body, %w", err), 1804 Snapshot: snapshot.Bytes(), 1805 } 1806 return out, metadata, err 1807 } 1808 1809 err = awsRestjson1_deserializeOpDocumentCreateRoutingProfileOutput(&output, shape) 1810 if err != nil { 1811 var snapshot bytes.Buffer 1812 io.Copy(&snapshot, ringBuffer) 1813 return out, metadata, &smithy.DeserializationError{ 1814 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1815 Snapshot: snapshot.Bytes(), 1816 } 1817 } 1818 1819 return out, metadata, err 1820} 1821 1822func awsRestjson1_deserializeOpErrorCreateRoutingProfile(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1823 var errorBuffer bytes.Buffer 1824 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1825 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1826 } 1827 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1828 1829 errorCode := "UnknownError" 1830 errorMessage := errorCode 1831 1832 code := response.Header.Get("X-Amzn-ErrorType") 1833 if len(code) != 0 { 1834 errorCode = restjson.SanitizeErrorCode(code) 1835 } 1836 1837 var buff [1024]byte 1838 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1839 1840 body := io.TeeReader(errorBody, ringBuffer) 1841 decoder := json.NewDecoder(body) 1842 decoder.UseNumber() 1843 code, message, err := restjson.GetErrorInfo(decoder) 1844 if err != nil { 1845 var snapshot bytes.Buffer 1846 io.Copy(&snapshot, ringBuffer) 1847 err = &smithy.DeserializationError{ 1848 Err: fmt.Errorf("failed to decode response body, %w", err), 1849 Snapshot: snapshot.Bytes(), 1850 } 1851 return err 1852 } 1853 1854 errorBody.Seek(0, io.SeekStart) 1855 if len(code) != 0 { 1856 errorCode = restjson.SanitizeErrorCode(code) 1857 } 1858 if len(message) != 0 { 1859 errorMessage = message 1860 } 1861 1862 switch { 1863 case strings.EqualFold("DuplicateResourceException", errorCode): 1864 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 1865 1866 case strings.EqualFold("InternalServiceException", errorCode): 1867 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 1868 1869 case strings.EqualFold("InvalidParameterException", errorCode): 1870 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 1871 1872 case strings.EqualFold("InvalidRequestException", errorCode): 1873 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 1874 1875 case strings.EqualFold("LimitExceededException", errorCode): 1876 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 1877 1878 case strings.EqualFold("ResourceNotFoundException", errorCode): 1879 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1880 1881 case strings.EqualFold("ThrottlingException", errorCode): 1882 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1883 1884 default: 1885 genericError := &smithy.GenericAPIError{ 1886 Code: errorCode, 1887 Message: errorMessage, 1888 } 1889 return genericError 1890 1891 } 1892} 1893 1894func awsRestjson1_deserializeOpDocumentCreateRoutingProfileOutput(v **CreateRoutingProfileOutput, value interface{}) error { 1895 if v == nil { 1896 return fmt.Errorf("unexpected nil of type %T", v) 1897 } 1898 if value == nil { 1899 return nil 1900 } 1901 1902 shape, ok := value.(map[string]interface{}) 1903 if !ok { 1904 return fmt.Errorf("unexpected JSON type %v", value) 1905 } 1906 1907 var sv *CreateRoutingProfileOutput 1908 if *v == nil { 1909 sv = &CreateRoutingProfileOutput{} 1910 } else { 1911 sv = *v 1912 } 1913 1914 for key, value := range shape { 1915 switch key { 1916 case "RoutingProfileArn": 1917 if value != nil { 1918 jtv, ok := value.(string) 1919 if !ok { 1920 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 1921 } 1922 sv.RoutingProfileArn = ptr.String(jtv) 1923 } 1924 1925 case "RoutingProfileId": 1926 if value != nil { 1927 jtv, ok := value.(string) 1928 if !ok { 1929 return fmt.Errorf("expected RoutingProfileId to be of type string, got %T instead", value) 1930 } 1931 sv.RoutingProfileId = ptr.String(jtv) 1932 } 1933 1934 default: 1935 _, _ = key, value 1936 1937 } 1938 } 1939 *v = sv 1940 return nil 1941} 1942 1943type awsRestjson1_deserializeOpCreateUseCase struct { 1944} 1945 1946func (*awsRestjson1_deserializeOpCreateUseCase) ID() string { 1947 return "OperationDeserializer" 1948} 1949 1950func (m *awsRestjson1_deserializeOpCreateUseCase) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1951 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1952) { 1953 out, metadata, err = next.HandleDeserialize(ctx, in) 1954 if err != nil { 1955 return out, metadata, err 1956 } 1957 1958 response, ok := out.RawResponse.(*smithyhttp.Response) 1959 if !ok { 1960 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1961 } 1962 1963 if response.StatusCode < 200 || response.StatusCode >= 300 { 1964 return out, metadata, awsRestjson1_deserializeOpErrorCreateUseCase(response, &metadata) 1965 } 1966 output := &CreateUseCaseOutput{} 1967 out.Result = output 1968 1969 var buff [1024]byte 1970 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1971 1972 body := io.TeeReader(response.Body, ringBuffer) 1973 1974 decoder := json.NewDecoder(body) 1975 decoder.UseNumber() 1976 var shape interface{} 1977 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1978 var snapshot bytes.Buffer 1979 io.Copy(&snapshot, ringBuffer) 1980 err = &smithy.DeserializationError{ 1981 Err: fmt.Errorf("failed to decode response body, %w", err), 1982 Snapshot: snapshot.Bytes(), 1983 } 1984 return out, metadata, err 1985 } 1986 1987 err = awsRestjson1_deserializeOpDocumentCreateUseCaseOutput(&output, shape) 1988 if err != nil { 1989 var snapshot bytes.Buffer 1990 io.Copy(&snapshot, ringBuffer) 1991 return out, metadata, &smithy.DeserializationError{ 1992 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1993 Snapshot: snapshot.Bytes(), 1994 } 1995 } 1996 1997 return out, metadata, err 1998} 1999 2000func awsRestjson1_deserializeOpErrorCreateUseCase(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2001 var errorBuffer bytes.Buffer 2002 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2003 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2004 } 2005 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2006 2007 errorCode := "UnknownError" 2008 errorMessage := errorCode 2009 2010 code := response.Header.Get("X-Amzn-ErrorType") 2011 if len(code) != 0 { 2012 errorCode = restjson.SanitizeErrorCode(code) 2013 } 2014 2015 var buff [1024]byte 2016 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2017 2018 body := io.TeeReader(errorBody, ringBuffer) 2019 decoder := json.NewDecoder(body) 2020 decoder.UseNumber() 2021 code, message, err := restjson.GetErrorInfo(decoder) 2022 if err != nil { 2023 var snapshot bytes.Buffer 2024 io.Copy(&snapshot, ringBuffer) 2025 err = &smithy.DeserializationError{ 2026 Err: fmt.Errorf("failed to decode response body, %w", err), 2027 Snapshot: snapshot.Bytes(), 2028 } 2029 return err 2030 } 2031 2032 errorBody.Seek(0, io.SeekStart) 2033 if len(code) != 0 { 2034 errorCode = restjson.SanitizeErrorCode(code) 2035 } 2036 if len(message) != 0 { 2037 errorMessage = message 2038 } 2039 2040 switch { 2041 case strings.EqualFold("DuplicateResourceException", errorCode): 2042 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 2043 2044 case strings.EqualFold("InternalServiceException", errorCode): 2045 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2046 2047 case strings.EqualFold("InvalidRequestException", errorCode): 2048 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2049 2050 case strings.EqualFold("ResourceNotFoundException", errorCode): 2051 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2052 2053 case strings.EqualFold("ThrottlingException", errorCode): 2054 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2055 2056 default: 2057 genericError := &smithy.GenericAPIError{ 2058 Code: errorCode, 2059 Message: errorMessage, 2060 } 2061 return genericError 2062 2063 } 2064} 2065 2066func awsRestjson1_deserializeOpDocumentCreateUseCaseOutput(v **CreateUseCaseOutput, value interface{}) error { 2067 if v == nil { 2068 return fmt.Errorf("unexpected nil of type %T", v) 2069 } 2070 if value == nil { 2071 return nil 2072 } 2073 2074 shape, ok := value.(map[string]interface{}) 2075 if !ok { 2076 return fmt.Errorf("unexpected JSON type %v", value) 2077 } 2078 2079 var sv *CreateUseCaseOutput 2080 if *v == nil { 2081 sv = &CreateUseCaseOutput{} 2082 } else { 2083 sv = *v 2084 } 2085 2086 for key, value := range shape { 2087 switch key { 2088 case "UseCaseArn": 2089 if value != nil { 2090 jtv, ok := value.(string) 2091 if !ok { 2092 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 2093 } 2094 sv.UseCaseArn = ptr.String(jtv) 2095 } 2096 2097 case "UseCaseId": 2098 if value != nil { 2099 jtv, ok := value.(string) 2100 if !ok { 2101 return fmt.Errorf("expected UseCaseId to be of type string, got %T instead", value) 2102 } 2103 sv.UseCaseId = ptr.String(jtv) 2104 } 2105 2106 default: 2107 _, _ = key, value 2108 2109 } 2110 } 2111 *v = sv 2112 return nil 2113} 2114 2115type awsRestjson1_deserializeOpCreateUser struct { 2116} 2117 2118func (*awsRestjson1_deserializeOpCreateUser) ID() string { 2119 return "OperationDeserializer" 2120} 2121 2122func (m *awsRestjson1_deserializeOpCreateUser) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2123 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2124) { 2125 out, metadata, err = next.HandleDeserialize(ctx, in) 2126 if err != nil { 2127 return out, metadata, err 2128 } 2129 2130 response, ok := out.RawResponse.(*smithyhttp.Response) 2131 if !ok { 2132 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2133 } 2134 2135 if response.StatusCode < 200 || response.StatusCode >= 300 { 2136 return out, metadata, awsRestjson1_deserializeOpErrorCreateUser(response, &metadata) 2137 } 2138 output := &CreateUserOutput{} 2139 out.Result = output 2140 2141 var buff [1024]byte 2142 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2143 2144 body := io.TeeReader(response.Body, ringBuffer) 2145 2146 decoder := json.NewDecoder(body) 2147 decoder.UseNumber() 2148 var shape interface{} 2149 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2150 var snapshot bytes.Buffer 2151 io.Copy(&snapshot, ringBuffer) 2152 err = &smithy.DeserializationError{ 2153 Err: fmt.Errorf("failed to decode response body, %w", err), 2154 Snapshot: snapshot.Bytes(), 2155 } 2156 return out, metadata, err 2157 } 2158 2159 err = awsRestjson1_deserializeOpDocumentCreateUserOutput(&output, shape) 2160 if err != nil { 2161 var snapshot bytes.Buffer 2162 io.Copy(&snapshot, ringBuffer) 2163 return out, metadata, &smithy.DeserializationError{ 2164 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2165 Snapshot: snapshot.Bytes(), 2166 } 2167 } 2168 2169 return out, metadata, err 2170} 2171 2172func awsRestjson1_deserializeOpErrorCreateUser(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2173 var errorBuffer bytes.Buffer 2174 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2175 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2176 } 2177 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2178 2179 errorCode := "UnknownError" 2180 errorMessage := errorCode 2181 2182 code := response.Header.Get("X-Amzn-ErrorType") 2183 if len(code) != 0 { 2184 errorCode = restjson.SanitizeErrorCode(code) 2185 } 2186 2187 var buff [1024]byte 2188 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2189 2190 body := io.TeeReader(errorBody, ringBuffer) 2191 decoder := json.NewDecoder(body) 2192 decoder.UseNumber() 2193 code, message, err := restjson.GetErrorInfo(decoder) 2194 if err != nil { 2195 var snapshot bytes.Buffer 2196 io.Copy(&snapshot, ringBuffer) 2197 err = &smithy.DeserializationError{ 2198 Err: fmt.Errorf("failed to decode response body, %w", err), 2199 Snapshot: snapshot.Bytes(), 2200 } 2201 return err 2202 } 2203 2204 errorBody.Seek(0, io.SeekStart) 2205 if len(code) != 0 { 2206 errorCode = restjson.SanitizeErrorCode(code) 2207 } 2208 if len(message) != 0 { 2209 errorMessage = message 2210 } 2211 2212 switch { 2213 case strings.EqualFold("DuplicateResourceException", errorCode): 2214 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 2215 2216 case strings.EqualFold("InternalServiceException", errorCode): 2217 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2218 2219 case strings.EqualFold("InvalidParameterException", errorCode): 2220 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 2221 2222 case strings.EqualFold("InvalidRequestException", errorCode): 2223 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2224 2225 case strings.EqualFold("LimitExceededException", errorCode): 2226 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 2227 2228 case strings.EqualFold("ResourceNotFoundException", errorCode): 2229 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2230 2231 case strings.EqualFold("ThrottlingException", errorCode): 2232 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2233 2234 default: 2235 genericError := &smithy.GenericAPIError{ 2236 Code: errorCode, 2237 Message: errorMessage, 2238 } 2239 return genericError 2240 2241 } 2242} 2243 2244func awsRestjson1_deserializeOpDocumentCreateUserOutput(v **CreateUserOutput, value interface{}) error { 2245 if v == nil { 2246 return fmt.Errorf("unexpected nil of type %T", v) 2247 } 2248 if value == nil { 2249 return nil 2250 } 2251 2252 shape, ok := value.(map[string]interface{}) 2253 if !ok { 2254 return fmt.Errorf("unexpected JSON type %v", value) 2255 } 2256 2257 var sv *CreateUserOutput 2258 if *v == nil { 2259 sv = &CreateUserOutput{} 2260 } else { 2261 sv = *v 2262 } 2263 2264 for key, value := range shape { 2265 switch key { 2266 case "UserArn": 2267 if value != nil { 2268 jtv, ok := value.(string) 2269 if !ok { 2270 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 2271 } 2272 sv.UserArn = ptr.String(jtv) 2273 } 2274 2275 case "UserId": 2276 if value != nil { 2277 jtv, ok := value.(string) 2278 if !ok { 2279 return fmt.Errorf("expected UserId to be of type string, got %T instead", value) 2280 } 2281 sv.UserId = ptr.String(jtv) 2282 } 2283 2284 default: 2285 _, _ = key, value 2286 2287 } 2288 } 2289 *v = sv 2290 return nil 2291} 2292 2293type awsRestjson1_deserializeOpCreateUserHierarchyGroup struct { 2294} 2295 2296func (*awsRestjson1_deserializeOpCreateUserHierarchyGroup) ID() string { 2297 return "OperationDeserializer" 2298} 2299 2300func (m *awsRestjson1_deserializeOpCreateUserHierarchyGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2301 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2302) { 2303 out, metadata, err = next.HandleDeserialize(ctx, in) 2304 if err != nil { 2305 return out, metadata, err 2306 } 2307 2308 response, ok := out.RawResponse.(*smithyhttp.Response) 2309 if !ok { 2310 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2311 } 2312 2313 if response.StatusCode < 200 || response.StatusCode >= 300 { 2314 return out, metadata, awsRestjson1_deserializeOpErrorCreateUserHierarchyGroup(response, &metadata) 2315 } 2316 output := &CreateUserHierarchyGroupOutput{} 2317 out.Result = output 2318 2319 var buff [1024]byte 2320 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2321 2322 body := io.TeeReader(response.Body, ringBuffer) 2323 2324 decoder := json.NewDecoder(body) 2325 decoder.UseNumber() 2326 var shape interface{} 2327 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2328 var snapshot bytes.Buffer 2329 io.Copy(&snapshot, ringBuffer) 2330 err = &smithy.DeserializationError{ 2331 Err: fmt.Errorf("failed to decode response body, %w", err), 2332 Snapshot: snapshot.Bytes(), 2333 } 2334 return out, metadata, err 2335 } 2336 2337 err = awsRestjson1_deserializeOpDocumentCreateUserHierarchyGroupOutput(&output, shape) 2338 if err != nil { 2339 var snapshot bytes.Buffer 2340 io.Copy(&snapshot, ringBuffer) 2341 return out, metadata, &smithy.DeserializationError{ 2342 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2343 Snapshot: snapshot.Bytes(), 2344 } 2345 } 2346 2347 return out, metadata, err 2348} 2349 2350func awsRestjson1_deserializeOpErrorCreateUserHierarchyGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2351 var errorBuffer bytes.Buffer 2352 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2353 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2354 } 2355 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2356 2357 errorCode := "UnknownError" 2358 errorMessage := errorCode 2359 2360 code := response.Header.Get("X-Amzn-ErrorType") 2361 if len(code) != 0 { 2362 errorCode = restjson.SanitizeErrorCode(code) 2363 } 2364 2365 var buff [1024]byte 2366 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2367 2368 body := io.TeeReader(errorBody, ringBuffer) 2369 decoder := json.NewDecoder(body) 2370 decoder.UseNumber() 2371 code, message, err := restjson.GetErrorInfo(decoder) 2372 if err != nil { 2373 var snapshot bytes.Buffer 2374 io.Copy(&snapshot, ringBuffer) 2375 err = &smithy.DeserializationError{ 2376 Err: fmt.Errorf("failed to decode response body, %w", err), 2377 Snapshot: snapshot.Bytes(), 2378 } 2379 return err 2380 } 2381 2382 errorBody.Seek(0, io.SeekStart) 2383 if len(code) != 0 { 2384 errorCode = restjson.SanitizeErrorCode(code) 2385 } 2386 if len(message) != 0 { 2387 errorMessage = message 2388 } 2389 2390 switch { 2391 case strings.EqualFold("DuplicateResourceException", errorCode): 2392 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 2393 2394 case strings.EqualFold("InternalServiceException", errorCode): 2395 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2396 2397 case strings.EqualFold("InvalidParameterException", errorCode): 2398 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 2399 2400 case strings.EqualFold("InvalidRequestException", errorCode): 2401 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2402 2403 case strings.EqualFold("LimitExceededException", errorCode): 2404 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 2405 2406 case strings.EqualFold("ResourceNotFoundException", errorCode): 2407 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2408 2409 case strings.EqualFold("ThrottlingException", errorCode): 2410 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2411 2412 default: 2413 genericError := &smithy.GenericAPIError{ 2414 Code: errorCode, 2415 Message: errorMessage, 2416 } 2417 return genericError 2418 2419 } 2420} 2421 2422func awsRestjson1_deserializeOpDocumentCreateUserHierarchyGroupOutput(v **CreateUserHierarchyGroupOutput, value interface{}) error { 2423 if v == nil { 2424 return fmt.Errorf("unexpected nil of type %T", v) 2425 } 2426 if value == nil { 2427 return nil 2428 } 2429 2430 shape, ok := value.(map[string]interface{}) 2431 if !ok { 2432 return fmt.Errorf("unexpected JSON type %v", value) 2433 } 2434 2435 var sv *CreateUserHierarchyGroupOutput 2436 if *v == nil { 2437 sv = &CreateUserHierarchyGroupOutput{} 2438 } else { 2439 sv = *v 2440 } 2441 2442 for key, value := range shape { 2443 switch key { 2444 case "HierarchyGroupArn": 2445 if value != nil { 2446 jtv, ok := value.(string) 2447 if !ok { 2448 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 2449 } 2450 sv.HierarchyGroupArn = ptr.String(jtv) 2451 } 2452 2453 case "HierarchyGroupId": 2454 if value != nil { 2455 jtv, ok := value.(string) 2456 if !ok { 2457 return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) 2458 } 2459 sv.HierarchyGroupId = ptr.String(jtv) 2460 } 2461 2462 default: 2463 _, _ = key, value 2464 2465 } 2466 } 2467 *v = sv 2468 return nil 2469} 2470 2471type awsRestjson1_deserializeOpDeleteInstance struct { 2472} 2473 2474func (*awsRestjson1_deserializeOpDeleteInstance) ID() string { 2475 return "OperationDeserializer" 2476} 2477 2478func (m *awsRestjson1_deserializeOpDeleteInstance) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2479 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2480) { 2481 out, metadata, err = next.HandleDeserialize(ctx, in) 2482 if err != nil { 2483 return out, metadata, err 2484 } 2485 2486 response, ok := out.RawResponse.(*smithyhttp.Response) 2487 if !ok { 2488 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2489 } 2490 2491 if response.StatusCode < 200 || response.StatusCode >= 300 { 2492 return out, metadata, awsRestjson1_deserializeOpErrorDeleteInstance(response, &metadata) 2493 } 2494 output := &DeleteInstanceOutput{} 2495 out.Result = output 2496 2497 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2498 return out, metadata, &smithy.DeserializationError{ 2499 Err: fmt.Errorf("failed to discard response body, %w", err), 2500 } 2501 } 2502 2503 return out, metadata, err 2504} 2505 2506func awsRestjson1_deserializeOpErrorDeleteInstance(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2507 var errorBuffer bytes.Buffer 2508 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2509 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2510 } 2511 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2512 2513 errorCode := "UnknownError" 2514 errorMessage := errorCode 2515 2516 code := response.Header.Get("X-Amzn-ErrorType") 2517 if len(code) != 0 { 2518 errorCode = restjson.SanitizeErrorCode(code) 2519 } 2520 2521 var buff [1024]byte 2522 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2523 2524 body := io.TeeReader(errorBody, ringBuffer) 2525 decoder := json.NewDecoder(body) 2526 decoder.UseNumber() 2527 code, message, err := restjson.GetErrorInfo(decoder) 2528 if err != nil { 2529 var snapshot bytes.Buffer 2530 io.Copy(&snapshot, ringBuffer) 2531 err = &smithy.DeserializationError{ 2532 Err: fmt.Errorf("failed to decode response body, %w", err), 2533 Snapshot: snapshot.Bytes(), 2534 } 2535 return err 2536 } 2537 2538 errorBody.Seek(0, io.SeekStart) 2539 if len(code) != 0 { 2540 errorCode = restjson.SanitizeErrorCode(code) 2541 } 2542 if len(message) != 0 { 2543 errorMessage = message 2544 } 2545 2546 switch { 2547 case strings.EqualFold("InternalServiceException", errorCode): 2548 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2549 2550 case strings.EqualFold("InvalidRequestException", errorCode): 2551 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2552 2553 case strings.EqualFold("ResourceNotFoundException", errorCode): 2554 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2555 2556 default: 2557 genericError := &smithy.GenericAPIError{ 2558 Code: errorCode, 2559 Message: errorMessage, 2560 } 2561 return genericError 2562 2563 } 2564} 2565 2566type awsRestjson1_deserializeOpDeleteIntegrationAssociation struct { 2567} 2568 2569func (*awsRestjson1_deserializeOpDeleteIntegrationAssociation) ID() string { 2570 return "OperationDeserializer" 2571} 2572 2573func (m *awsRestjson1_deserializeOpDeleteIntegrationAssociation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2574 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2575) { 2576 out, metadata, err = next.HandleDeserialize(ctx, in) 2577 if err != nil { 2578 return out, metadata, err 2579 } 2580 2581 response, ok := out.RawResponse.(*smithyhttp.Response) 2582 if !ok { 2583 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2584 } 2585 2586 if response.StatusCode < 200 || response.StatusCode >= 300 { 2587 return out, metadata, awsRestjson1_deserializeOpErrorDeleteIntegrationAssociation(response, &metadata) 2588 } 2589 output := &DeleteIntegrationAssociationOutput{} 2590 out.Result = output 2591 2592 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2593 return out, metadata, &smithy.DeserializationError{ 2594 Err: fmt.Errorf("failed to discard response body, %w", err), 2595 } 2596 } 2597 2598 return out, metadata, err 2599} 2600 2601func awsRestjson1_deserializeOpErrorDeleteIntegrationAssociation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2602 var errorBuffer bytes.Buffer 2603 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2604 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2605 } 2606 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2607 2608 errorCode := "UnknownError" 2609 errorMessage := errorCode 2610 2611 code := response.Header.Get("X-Amzn-ErrorType") 2612 if len(code) != 0 { 2613 errorCode = restjson.SanitizeErrorCode(code) 2614 } 2615 2616 var buff [1024]byte 2617 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2618 2619 body := io.TeeReader(errorBody, ringBuffer) 2620 decoder := json.NewDecoder(body) 2621 decoder.UseNumber() 2622 code, message, err := restjson.GetErrorInfo(decoder) 2623 if err != nil { 2624 var snapshot bytes.Buffer 2625 io.Copy(&snapshot, ringBuffer) 2626 err = &smithy.DeserializationError{ 2627 Err: fmt.Errorf("failed to decode response body, %w", err), 2628 Snapshot: snapshot.Bytes(), 2629 } 2630 return err 2631 } 2632 2633 errorBody.Seek(0, io.SeekStart) 2634 if len(code) != 0 { 2635 errorCode = restjson.SanitizeErrorCode(code) 2636 } 2637 if len(message) != 0 { 2638 errorMessage = message 2639 } 2640 2641 switch { 2642 case strings.EqualFold("InternalServiceException", errorCode): 2643 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2644 2645 case strings.EqualFold("InvalidRequestException", errorCode): 2646 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2647 2648 case strings.EqualFold("ResourceNotFoundException", errorCode): 2649 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2650 2651 case strings.EqualFold("ThrottlingException", errorCode): 2652 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2653 2654 default: 2655 genericError := &smithy.GenericAPIError{ 2656 Code: errorCode, 2657 Message: errorMessage, 2658 } 2659 return genericError 2660 2661 } 2662} 2663 2664type awsRestjson1_deserializeOpDeleteQuickConnect struct { 2665} 2666 2667func (*awsRestjson1_deserializeOpDeleteQuickConnect) ID() string { 2668 return "OperationDeserializer" 2669} 2670 2671func (m *awsRestjson1_deserializeOpDeleteQuickConnect) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2672 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2673) { 2674 out, metadata, err = next.HandleDeserialize(ctx, in) 2675 if err != nil { 2676 return out, metadata, err 2677 } 2678 2679 response, ok := out.RawResponse.(*smithyhttp.Response) 2680 if !ok { 2681 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2682 } 2683 2684 if response.StatusCode < 200 || response.StatusCode >= 300 { 2685 return out, metadata, awsRestjson1_deserializeOpErrorDeleteQuickConnect(response, &metadata) 2686 } 2687 output := &DeleteQuickConnectOutput{} 2688 out.Result = output 2689 2690 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2691 return out, metadata, &smithy.DeserializationError{ 2692 Err: fmt.Errorf("failed to discard response body, %w", err), 2693 } 2694 } 2695 2696 return out, metadata, err 2697} 2698 2699func awsRestjson1_deserializeOpErrorDeleteQuickConnect(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2700 var errorBuffer bytes.Buffer 2701 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2702 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2703 } 2704 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2705 2706 errorCode := "UnknownError" 2707 errorMessage := errorCode 2708 2709 code := response.Header.Get("X-Amzn-ErrorType") 2710 if len(code) != 0 { 2711 errorCode = restjson.SanitizeErrorCode(code) 2712 } 2713 2714 var buff [1024]byte 2715 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2716 2717 body := io.TeeReader(errorBody, ringBuffer) 2718 decoder := json.NewDecoder(body) 2719 decoder.UseNumber() 2720 code, message, err := restjson.GetErrorInfo(decoder) 2721 if err != nil { 2722 var snapshot bytes.Buffer 2723 io.Copy(&snapshot, ringBuffer) 2724 err = &smithy.DeserializationError{ 2725 Err: fmt.Errorf("failed to decode response body, %w", err), 2726 Snapshot: snapshot.Bytes(), 2727 } 2728 return err 2729 } 2730 2731 errorBody.Seek(0, io.SeekStart) 2732 if len(code) != 0 { 2733 errorCode = restjson.SanitizeErrorCode(code) 2734 } 2735 if len(message) != 0 { 2736 errorMessage = message 2737 } 2738 2739 switch { 2740 case strings.EqualFold("InternalServiceException", errorCode): 2741 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2742 2743 case strings.EqualFold("InvalidParameterException", errorCode): 2744 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 2745 2746 case strings.EqualFold("InvalidRequestException", errorCode): 2747 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2748 2749 case strings.EqualFold("ResourceNotFoundException", errorCode): 2750 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2751 2752 case strings.EqualFold("ThrottlingException", errorCode): 2753 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2754 2755 default: 2756 genericError := &smithy.GenericAPIError{ 2757 Code: errorCode, 2758 Message: errorMessage, 2759 } 2760 return genericError 2761 2762 } 2763} 2764 2765type awsRestjson1_deserializeOpDeleteUseCase struct { 2766} 2767 2768func (*awsRestjson1_deserializeOpDeleteUseCase) ID() string { 2769 return "OperationDeserializer" 2770} 2771 2772func (m *awsRestjson1_deserializeOpDeleteUseCase) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2773 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2774) { 2775 out, metadata, err = next.HandleDeserialize(ctx, in) 2776 if err != nil { 2777 return out, metadata, err 2778 } 2779 2780 response, ok := out.RawResponse.(*smithyhttp.Response) 2781 if !ok { 2782 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2783 } 2784 2785 if response.StatusCode < 200 || response.StatusCode >= 300 { 2786 return out, metadata, awsRestjson1_deserializeOpErrorDeleteUseCase(response, &metadata) 2787 } 2788 output := &DeleteUseCaseOutput{} 2789 out.Result = output 2790 2791 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2792 return out, metadata, &smithy.DeserializationError{ 2793 Err: fmt.Errorf("failed to discard response body, %w", err), 2794 } 2795 } 2796 2797 return out, metadata, err 2798} 2799 2800func awsRestjson1_deserializeOpErrorDeleteUseCase(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2801 var errorBuffer bytes.Buffer 2802 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2803 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2804 } 2805 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2806 2807 errorCode := "UnknownError" 2808 errorMessage := errorCode 2809 2810 code := response.Header.Get("X-Amzn-ErrorType") 2811 if len(code) != 0 { 2812 errorCode = restjson.SanitizeErrorCode(code) 2813 } 2814 2815 var buff [1024]byte 2816 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2817 2818 body := io.TeeReader(errorBody, ringBuffer) 2819 decoder := json.NewDecoder(body) 2820 decoder.UseNumber() 2821 code, message, err := restjson.GetErrorInfo(decoder) 2822 if err != nil { 2823 var snapshot bytes.Buffer 2824 io.Copy(&snapshot, ringBuffer) 2825 err = &smithy.DeserializationError{ 2826 Err: fmt.Errorf("failed to decode response body, %w", err), 2827 Snapshot: snapshot.Bytes(), 2828 } 2829 return err 2830 } 2831 2832 errorBody.Seek(0, io.SeekStart) 2833 if len(code) != 0 { 2834 errorCode = restjson.SanitizeErrorCode(code) 2835 } 2836 if len(message) != 0 { 2837 errorMessage = message 2838 } 2839 2840 switch { 2841 case strings.EqualFold("InternalServiceException", errorCode): 2842 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2843 2844 case strings.EqualFold("InvalidRequestException", errorCode): 2845 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2846 2847 case strings.EqualFold("ResourceNotFoundException", errorCode): 2848 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2849 2850 case strings.EqualFold("ThrottlingException", errorCode): 2851 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2852 2853 default: 2854 genericError := &smithy.GenericAPIError{ 2855 Code: errorCode, 2856 Message: errorMessage, 2857 } 2858 return genericError 2859 2860 } 2861} 2862 2863type awsRestjson1_deserializeOpDeleteUser struct { 2864} 2865 2866func (*awsRestjson1_deserializeOpDeleteUser) ID() string { 2867 return "OperationDeserializer" 2868} 2869 2870func (m *awsRestjson1_deserializeOpDeleteUser) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2871 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2872) { 2873 out, metadata, err = next.HandleDeserialize(ctx, in) 2874 if err != nil { 2875 return out, metadata, err 2876 } 2877 2878 response, ok := out.RawResponse.(*smithyhttp.Response) 2879 if !ok { 2880 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2881 } 2882 2883 if response.StatusCode < 200 || response.StatusCode >= 300 { 2884 return out, metadata, awsRestjson1_deserializeOpErrorDeleteUser(response, &metadata) 2885 } 2886 output := &DeleteUserOutput{} 2887 out.Result = output 2888 2889 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2890 return out, metadata, &smithy.DeserializationError{ 2891 Err: fmt.Errorf("failed to discard response body, %w", err), 2892 } 2893 } 2894 2895 return out, metadata, err 2896} 2897 2898func awsRestjson1_deserializeOpErrorDeleteUser(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2899 var errorBuffer bytes.Buffer 2900 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2901 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2902 } 2903 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2904 2905 errorCode := "UnknownError" 2906 errorMessage := errorCode 2907 2908 code := response.Header.Get("X-Amzn-ErrorType") 2909 if len(code) != 0 { 2910 errorCode = restjson.SanitizeErrorCode(code) 2911 } 2912 2913 var buff [1024]byte 2914 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2915 2916 body := io.TeeReader(errorBody, ringBuffer) 2917 decoder := json.NewDecoder(body) 2918 decoder.UseNumber() 2919 code, message, err := restjson.GetErrorInfo(decoder) 2920 if err != nil { 2921 var snapshot bytes.Buffer 2922 io.Copy(&snapshot, ringBuffer) 2923 err = &smithy.DeserializationError{ 2924 Err: fmt.Errorf("failed to decode response body, %w", err), 2925 Snapshot: snapshot.Bytes(), 2926 } 2927 return err 2928 } 2929 2930 errorBody.Seek(0, io.SeekStart) 2931 if len(code) != 0 { 2932 errorCode = restjson.SanitizeErrorCode(code) 2933 } 2934 if len(message) != 0 { 2935 errorMessage = message 2936 } 2937 2938 switch { 2939 case strings.EqualFold("InternalServiceException", errorCode): 2940 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 2941 2942 case strings.EqualFold("InvalidParameterException", errorCode): 2943 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 2944 2945 case strings.EqualFold("InvalidRequestException", errorCode): 2946 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 2947 2948 case strings.EqualFold("ResourceNotFoundException", errorCode): 2949 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2950 2951 case strings.EqualFold("ThrottlingException", errorCode): 2952 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2953 2954 default: 2955 genericError := &smithy.GenericAPIError{ 2956 Code: errorCode, 2957 Message: errorMessage, 2958 } 2959 return genericError 2960 2961 } 2962} 2963 2964type awsRestjson1_deserializeOpDeleteUserHierarchyGroup struct { 2965} 2966 2967func (*awsRestjson1_deserializeOpDeleteUserHierarchyGroup) ID() string { 2968 return "OperationDeserializer" 2969} 2970 2971func (m *awsRestjson1_deserializeOpDeleteUserHierarchyGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2972 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2973) { 2974 out, metadata, err = next.HandleDeserialize(ctx, in) 2975 if err != nil { 2976 return out, metadata, err 2977 } 2978 2979 response, ok := out.RawResponse.(*smithyhttp.Response) 2980 if !ok { 2981 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2982 } 2983 2984 if response.StatusCode < 200 || response.StatusCode >= 300 { 2985 return out, metadata, awsRestjson1_deserializeOpErrorDeleteUserHierarchyGroup(response, &metadata) 2986 } 2987 output := &DeleteUserHierarchyGroupOutput{} 2988 out.Result = output 2989 2990 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2991 return out, metadata, &smithy.DeserializationError{ 2992 Err: fmt.Errorf("failed to discard response body, %w", err), 2993 } 2994 } 2995 2996 return out, metadata, err 2997} 2998 2999func awsRestjson1_deserializeOpErrorDeleteUserHierarchyGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3000 var errorBuffer bytes.Buffer 3001 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3002 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3003 } 3004 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3005 3006 errorCode := "UnknownError" 3007 errorMessage := errorCode 3008 3009 code := response.Header.Get("X-Amzn-ErrorType") 3010 if len(code) != 0 { 3011 errorCode = restjson.SanitizeErrorCode(code) 3012 } 3013 3014 var buff [1024]byte 3015 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3016 3017 body := io.TeeReader(errorBody, ringBuffer) 3018 decoder := json.NewDecoder(body) 3019 decoder.UseNumber() 3020 code, message, err := restjson.GetErrorInfo(decoder) 3021 if err != nil { 3022 var snapshot bytes.Buffer 3023 io.Copy(&snapshot, ringBuffer) 3024 err = &smithy.DeserializationError{ 3025 Err: fmt.Errorf("failed to decode response body, %w", err), 3026 Snapshot: snapshot.Bytes(), 3027 } 3028 return err 3029 } 3030 3031 errorBody.Seek(0, io.SeekStart) 3032 if len(code) != 0 { 3033 errorCode = restjson.SanitizeErrorCode(code) 3034 } 3035 if len(message) != 0 { 3036 errorMessage = message 3037 } 3038 3039 switch { 3040 case strings.EqualFold("InternalServiceException", errorCode): 3041 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 3042 3043 case strings.EqualFold("InvalidParameterException", errorCode): 3044 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3045 3046 case strings.EqualFold("InvalidRequestException", errorCode): 3047 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 3048 3049 case strings.EqualFold("ResourceInUseException", errorCode): 3050 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 3051 3052 case strings.EqualFold("ResourceNotFoundException", errorCode): 3053 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3054 3055 case strings.EqualFold("ThrottlingException", errorCode): 3056 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3057 3058 default: 3059 genericError := &smithy.GenericAPIError{ 3060 Code: errorCode, 3061 Message: errorMessage, 3062 } 3063 return genericError 3064 3065 } 3066} 3067 3068type awsRestjson1_deserializeOpDescribeContactFlow struct { 3069} 3070 3071func (*awsRestjson1_deserializeOpDescribeContactFlow) ID() string { 3072 return "OperationDeserializer" 3073} 3074 3075func (m *awsRestjson1_deserializeOpDescribeContactFlow) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3076 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3077) { 3078 out, metadata, err = next.HandleDeserialize(ctx, in) 3079 if err != nil { 3080 return out, metadata, err 3081 } 3082 3083 response, ok := out.RawResponse.(*smithyhttp.Response) 3084 if !ok { 3085 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3086 } 3087 3088 if response.StatusCode < 200 || response.StatusCode >= 300 { 3089 return out, metadata, awsRestjson1_deserializeOpErrorDescribeContactFlow(response, &metadata) 3090 } 3091 output := &DescribeContactFlowOutput{} 3092 out.Result = output 3093 3094 var buff [1024]byte 3095 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3096 3097 body := io.TeeReader(response.Body, ringBuffer) 3098 3099 decoder := json.NewDecoder(body) 3100 decoder.UseNumber() 3101 var shape interface{} 3102 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3103 var snapshot bytes.Buffer 3104 io.Copy(&snapshot, ringBuffer) 3105 err = &smithy.DeserializationError{ 3106 Err: fmt.Errorf("failed to decode response body, %w", err), 3107 Snapshot: snapshot.Bytes(), 3108 } 3109 return out, metadata, err 3110 } 3111 3112 err = awsRestjson1_deserializeOpDocumentDescribeContactFlowOutput(&output, shape) 3113 if err != nil { 3114 var snapshot bytes.Buffer 3115 io.Copy(&snapshot, ringBuffer) 3116 return out, metadata, &smithy.DeserializationError{ 3117 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3118 Snapshot: snapshot.Bytes(), 3119 } 3120 } 3121 3122 return out, metadata, err 3123} 3124 3125func awsRestjson1_deserializeOpErrorDescribeContactFlow(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3126 var errorBuffer bytes.Buffer 3127 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3128 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3129 } 3130 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3131 3132 errorCode := "UnknownError" 3133 errorMessage := errorCode 3134 3135 code := response.Header.Get("X-Amzn-ErrorType") 3136 if len(code) != 0 { 3137 errorCode = restjson.SanitizeErrorCode(code) 3138 } 3139 3140 var buff [1024]byte 3141 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3142 3143 body := io.TeeReader(errorBody, ringBuffer) 3144 decoder := json.NewDecoder(body) 3145 decoder.UseNumber() 3146 code, message, err := restjson.GetErrorInfo(decoder) 3147 if err != nil { 3148 var snapshot bytes.Buffer 3149 io.Copy(&snapshot, ringBuffer) 3150 err = &smithy.DeserializationError{ 3151 Err: fmt.Errorf("failed to decode response body, %w", err), 3152 Snapshot: snapshot.Bytes(), 3153 } 3154 return err 3155 } 3156 3157 errorBody.Seek(0, io.SeekStart) 3158 if len(code) != 0 { 3159 errorCode = restjson.SanitizeErrorCode(code) 3160 } 3161 if len(message) != 0 { 3162 errorMessage = message 3163 } 3164 3165 switch { 3166 case strings.EqualFold("ContactFlowNotPublishedException", errorCode): 3167 return awsRestjson1_deserializeErrorContactFlowNotPublishedException(response, errorBody) 3168 3169 case strings.EqualFold("InternalServiceException", errorCode): 3170 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 3171 3172 case strings.EqualFold("InvalidParameterException", errorCode): 3173 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3174 3175 case strings.EqualFold("InvalidRequestException", errorCode): 3176 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 3177 3178 case strings.EqualFold("ResourceNotFoundException", errorCode): 3179 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3180 3181 case strings.EqualFold("ThrottlingException", errorCode): 3182 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3183 3184 default: 3185 genericError := &smithy.GenericAPIError{ 3186 Code: errorCode, 3187 Message: errorMessage, 3188 } 3189 return genericError 3190 3191 } 3192} 3193 3194func awsRestjson1_deserializeOpDocumentDescribeContactFlowOutput(v **DescribeContactFlowOutput, value interface{}) error { 3195 if v == nil { 3196 return fmt.Errorf("unexpected nil of type %T", v) 3197 } 3198 if value == nil { 3199 return nil 3200 } 3201 3202 shape, ok := value.(map[string]interface{}) 3203 if !ok { 3204 return fmt.Errorf("unexpected JSON type %v", value) 3205 } 3206 3207 var sv *DescribeContactFlowOutput 3208 if *v == nil { 3209 sv = &DescribeContactFlowOutput{} 3210 } else { 3211 sv = *v 3212 } 3213 3214 for key, value := range shape { 3215 switch key { 3216 case "ContactFlow": 3217 if err := awsRestjson1_deserializeDocumentContactFlow(&sv.ContactFlow, value); err != nil { 3218 return err 3219 } 3220 3221 default: 3222 _, _ = key, value 3223 3224 } 3225 } 3226 *v = sv 3227 return nil 3228} 3229 3230type awsRestjson1_deserializeOpDescribeHoursOfOperation struct { 3231} 3232 3233func (*awsRestjson1_deserializeOpDescribeHoursOfOperation) ID() string { 3234 return "OperationDeserializer" 3235} 3236 3237func (m *awsRestjson1_deserializeOpDescribeHoursOfOperation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3238 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3239) { 3240 out, metadata, err = next.HandleDeserialize(ctx, in) 3241 if err != nil { 3242 return out, metadata, err 3243 } 3244 3245 response, ok := out.RawResponse.(*smithyhttp.Response) 3246 if !ok { 3247 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3248 } 3249 3250 if response.StatusCode < 200 || response.StatusCode >= 300 { 3251 return out, metadata, awsRestjson1_deserializeOpErrorDescribeHoursOfOperation(response, &metadata) 3252 } 3253 output := &DescribeHoursOfOperationOutput{} 3254 out.Result = output 3255 3256 var buff [1024]byte 3257 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3258 3259 body := io.TeeReader(response.Body, ringBuffer) 3260 3261 decoder := json.NewDecoder(body) 3262 decoder.UseNumber() 3263 var shape interface{} 3264 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3265 var snapshot bytes.Buffer 3266 io.Copy(&snapshot, ringBuffer) 3267 err = &smithy.DeserializationError{ 3268 Err: fmt.Errorf("failed to decode response body, %w", err), 3269 Snapshot: snapshot.Bytes(), 3270 } 3271 return out, metadata, err 3272 } 3273 3274 err = awsRestjson1_deserializeOpDocumentDescribeHoursOfOperationOutput(&output, shape) 3275 if err != nil { 3276 var snapshot bytes.Buffer 3277 io.Copy(&snapshot, ringBuffer) 3278 return out, metadata, &smithy.DeserializationError{ 3279 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3280 Snapshot: snapshot.Bytes(), 3281 } 3282 } 3283 3284 return out, metadata, err 3285} 3286 3287func awsRestjson1_deserializeOpErrorDescribeHoursOfOperation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3288 var errorBuffer bytes.Buffer 3289 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3290 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3291 } 3292 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3293 3294 errorCode := "UnknownError" 3295 errorMessage := errorCode 3296 3297 code := response.Header.Get("X-Amzn-ErrorType") 3298 if len(code) != 0 { 3299 errorCode = restjson.SanitizeErrorCode(code) 3300 } 3301 3302 var buff [1024]byte 3303 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3304 3305 body := io.TeeReader(errorBody, ringBuffer) 3306 decoder := json.NewDecoder(body) 3307 decoder.UseNumber() 3308 code, message, err := restjson.GetErrorInfo(decoder) 3309 if err != nil { 3310 var snapshot bytes.Buffer 3311 io.Copy(&snapshot, ringBuffer) 3312 err = &smithy.DeserializationError{ 3313 Err: fmt.Errorf("failed to decode response body, %w", err), 3314 Snapshot: snapshot.Bytes(), 3315 } 3316 return err 3317 } 3318 3319 errorBody.Seek(0, io.SeekStart) 3320 if len(code) != 0 { 3321 errorCode = restjson.SanitizeErrorCode(code) 3322 } 3323 if len(message) != 0 { 3324 errorMessage = message 3325 } 3326 3327 switch { 3328 case strings.EqualFold("InternalServiceException", errorCode): 3329 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 3330 3331 case strings.EqualFold("InvalidParameterException", errorCode): 3332 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3333 3334 case strings.EqualFold("InvalidRequestException", errorCode): 3335 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 3336 3337 case strings.EqualFold("ResourceNotFoundException", errorCode): 3338 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3339 3340 case strings.EqualFold("ThrottlingException", errorCode): 3341 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3342 3343 default: 3344 genericError := &smithy.GenericAPIError{ 3345 Code: errorCode, 3346 Message: errorMessage, 3347 } 3348 return genericError 3349 3350 } 3351} 3352 3353func awsRestjson1_deserializeOpDocumentDescribeHoursOfOperationOutput(v **DescribeHoursOfOperationOutput, value interface{}) error { 3354 if v == nil { 3355 return fmt.Errorf("unexpected nil of type %T", v) 3356 } 3357 if value == nil { 3358 return nil 3359 } 3360 3361 shape, ok := value.(map[string]interface{}) 3362 if !ok { 3363 return fmt.Errorf("unexpected JSON type %v", value) 3364 } 3365 3366 var sv *DescribeHoursOfOperationOutput 3367 if *v == nil { 3368 sv = &DescribeHoursOfOperationOutput{} 3369 } else { 3370 sv = *v 3371 } 3372 3373 for key, value := range shape { 3374 switch key { 3375 case "HoursOfOperation": 3376 if err := awsRestjson1_deserializeDocumentHoursOfOperation(&sv.HoursOfOperation, value); err != nil { 3377 return err 3378 } 3379 3380 default: 3381 _, _ = key, value 3382 3383 } 3384 } 3385 *v = sv 3386 return nil 3387} 3388 3389type awsRestjson1_deserializeOpDescribeInstance struct { 3390} 3391 3392func (*awsRestjson1_deserializeOpDescribeInstance) ID() string { 3393 return "OperationDeserializer" 3394} 3395 3396func (m *awsRestjson1_deserializeOpDescribeInstance) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3397 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3398) { 3399 out, metadata, err = next.HandleDeserialize(ctx, in) 3400 if err != nil { 3401 return out, metadata, err 3402 } 3403 3404 response, ok := out.RawResponse.(*smithyhttp.Response) 3405 if !ok { 3406 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3407 } 3408 3409 if response.StatusCode < 200 || response.StatusCode >= 300 { 3410 return out, metadata, awsRestjson1_deserializeOpErrorDescribeInstance(response, &metadata) 3411 } 3412 output := &DescribeInstanceOutput{} 3413 out.Result = output 3414 3415 var buff [1024]byte 3416 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3417 3418 body := io.TeeReader(response.Body, ringBuffer) 3419 3420 decoder := json.NewDecoder(body) 3421 decoder.UseNumber() 3422 var shape interface{} 3423 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3424 var snapshot bytes.Buffer 3425 io.Copy(&snapshot, ringBuffer) 3426 err = &smithy.DeserializationError{ 3427 Err: fmt.Errorf("failed to decode response body, %w", err), 3428 Snapshot: snapshot.Bytes(), 3429 } 3430 return out, metadata, err 3431 } 3432 3433 err = awsRestjson1_deserializeOpDocumentDescribeInstanceOutput(&output, shape) 3434 if err != nil { 3435 var snapshot bytes.Buffer 3436 io.Copy(&snapshot, ringBuffer) 3437 return out, metadata, &smithy.DeserializationError{ 3438 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3439 Snapshot: snapshot.Bytes(), 3440 } 3441 } 3442 3443 return out, metadata, err 3444} 3445 3446func awsRestjson1_deserializeOpErrorDescribeInstance(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3447 var errorBuffer bytes.Buffer 3448 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3449 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3450 } 3451 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3452 3453 errorCode := "UnknownError" 3454 errorMessage := errorCode 3455 3456 code := response.Header.Get("X-Amzn-ErrorType") 3457 if len(code) != 0 { 3458 errorCode = restjson.SanitizeErrorCode(code) 3459 } 3460 3461 var buff [1024]byte 3462 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3463 3464 body := io.TeeReader(errorBody, ringBuffer) 3465 decoder := json.NewDecoder(body) 3466 decoder.UseNumber() 3467 code, message, err := restjson.GetErrorInfo(decoder) 3468 if err != nil { 3469 var snapshot bytes.Buffer 3470 io.Copy(&snapshot, ringBuffer) 3471 err = &smithy.DeserializationError{ 3472 Err: fmt.Errorf("failed to decode response body, %w", err), 3473 Snapshot: snapshot.Bytes(), 3474 } 3475 return err 3476 } 3477 3478 errorBody.Seek(0, io.SeekStart) 3479 if len(code) != 0 { 3480 errorCode = restjson.SanitizeErrorCode(code) 3481 } 3482 if len(message) != 0 { 3483 errorMessage = message 3484 } 3485 3486 switch { 3487 case strings.EqualFold("InternalServiceException", errorCode): 3488 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 3489 3490 case strings.EqualFold("InvalidRequestException", errorCode): 3491 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 3492 3493 case strings.EqualFold("ResourceNotFoundException", errorCode): 3494 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3495 3496 default: 3497 genericError := &smithy.GenericAPIError{ 3498 Code: errorCode, 3499 Message: errorMessage, 3500 } 3501 return genericError 3502 3503 } 3504} 3505 3506func awsRestjson1_deserializeOpDocumentDescribeInstanceOutput(v **DescribeInstanceOutput, value interface{}) error { 3507 if v == nil { 3508 return fmt.Errorf("unexpected nil of type %T", v) 3509 } 3510 if value == nil { 3511 return nil 3512 } 3513 3514 shape, ok := value.(map[string]interface{}) 3515 if !ok { 3516 return fmt.Errorf("unexpected JSON type %v", value) 3517 } 3518 3519 var sv *DescribeInstanceOutput 3520 if *v == nil { 3521 sv = &DescribeInstanceOutput{} 3522 } else { 3523 sv = *v 3524 } 3525 3526 for key, value := range shape { 3527 switch key { 3528 case "Instance": 3529 if err := awsRestjson1_deserializeDocumentInstance(&sv.Instance, value); err != nil { 3530 return err 3531 } 3532 3533 default: 3534 _, _ = key, value 3535 3536 } 3537 } 3538 *v = sv 3539 return nil 3540} 3541 3542type awsRestjson1_deserializeOpDescribeInstanceAttribute struct { 3543} 3544 3545func (*awsRestjson1_deserializeOpDescribeInstanceAttribute) ID() string { 3546 return "OperationDeserializer" 3547} 3548 3549func (m *awsRestjson1_deserializeOpDescribeInstanceAttribute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3550 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3551) { 3552 out, metadata, err = next.HandleDeserialize(ctx, in) 3553 if err != nil { 3554 return out, metadata, err 3555 } 3556 3557 response, ok := out.RawResponse.(*smithyhttp.Response) 3558 if !ok { 3559 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3560 } 3561 3562 if response.StatusCode < 200 || response.StatusCode >= 300 { 3563 return out, metadata, awsRestjson1_deserializeOpErrorDescribeInstanceAttribute(response, &metadata) 3564 } 3565 output := &DescribeInstanceAttributeOutput{} 3566 out.Result = output 3567 3568 var buff [1024]byte 3569 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3570 3571 body := io.TeeReader(response.Body, ringBuffer) 3572 3573 decoder := json.NewDecoder(body) 3574 decoder.UseNumber() 3575 var shape interface{} 3576 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3577 var snapshot bytes.Buffer 3578 io.Copy(&snapshot, ringBuffer) 3579 err = &smithy.DeserializationError{ 3580 Err: fmt.Errorf("failed to decode response body, %w", err), 3581 Snapshot: snapshot.Bytes(), 3582 } 3583 return out, metadata, err 3584 } 3585 3586 err = awsRestjson1_deserializeOpDocumentDescribeInstanceAttributeOutput(&output, shape) 3587 if err != nil { 3588 var snapshot bytes.Buffer 3589 io.Copy(&snapshot, ringBuffer) 3590 return out, metadata, &smithy.DeserializationError{ 3591 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3592 Snapshot: snapshot.Bytes(), 3593 } 3594 } 3595 3596 return out, metadata, err 3597} 3598 3599func awsRestjson1_deserializeOpErrorDescribeInstanceAttribute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3600 var errorBuffer bytes.Buffer 3601 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3602 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3603 } 3604 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3605 3606 errorCode := "UnknownError" 3607 errorMessage := errorCode 3608 3609 code := response.Header.Get("X-Amzn-ErrorType") 3610 if len(code) != 0 { 3611 errorCode = restjson.SanitizeErrorCode(code) 3612 } 3613 3614 var buff [1024]byte 3615 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3616 3617 body := io.TeeReader(errorBody, ringBuffer) 3618 decoder := json.NewDecoder(body) 3619 decoder.UseNumber() 3620 code, message, err := restjson.GetErrorInfo(decoder) 3621 if err != nil { 3622 var snapshot bytes.Buffer 3623 io.Copy(&snapshot, ringBuffer) 3624 err = &smithy.DeserializationError{ 3625 Err: fmt.Errorf("failed to decode response body, %w", err), 3626 Snapshot: snapshot.Bytes(), 3627 } 3628 return err 3629 } 3630 3631 errorBody.Seek(0, io.SeekStart) 3632 if len(code) != 0 { 3633 errorCode = restjson.SanitizeErrorCode(code) 3634 } 3635 if len(message) != 0 { 3636 errorMessage = message 3637 } 3638 3639 switch { 3640 case strings.EqualFold("InternalServiceException", errorCode): 3641 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 3642 3643 case strings.EqualFold("InvalidParameterException", errorCode): 3644 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3645 3646 case strings.EqualFold("InvalidRequestException", errorCode): 3647 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 3648 3649 case strings.EqualFold("ResourceNotFoundException", errorCode): 3650 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3651 3652 case strings.EqualFold("ThrottlingException", errorCode): 3653 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3654 3655 default: 3656 genericError := &smithy.GenericAPIError{ 3657 Code: errorCode, 3658 Message: errorMessage, 3659 } 3660 return genericError 3661 3662 } 3663} 3664 3665func awsRestjson1_deserializeOpDocumentDescribeInstanceAttributeOutput(v **DescribeInstanceAttributeOutput, value interface{}) error { 3666 if v == nil { 3667 return fmt.Errorf("unexpected nil of type %T", v) 3668 } 3669 if value == nil { 3670 return nil 3671 } 3672 3673 shape, ok := value.(map[string]interface{}) 3674 if !ok { 3675 return fmt.Errorf("unexpected JSON type %v", value) 3676 } 3677 3678 var sv *DescribeInstanceAttributeOutput 3679 if *v == nil { 3680 sv = &DescribeInstanceAttributeOutput{} 3681 } else { 3682 sv = *v 3683 } 3684 3685 for key, value := range shape { 3686 switch key { 3687 case "Attribute": 3688 if err := awsRestjson1_deserializeDocumentAttribute(&sv.Attribute, value); err != nil { 3689 return err 3690 } 3691 3692 default: 3693 _, _ = key, value 3694 3695 } 3696 } 3697 *v = sv 3698 return nil 3699} 3700 3701type awsRestjson1_deserializeOpDescribeInstanceStorageConfig struct { 3702} 3703 3704func (*awsRestjson1_deserializeOpDescribeInstanceStorageConfig) ID() string { 3705 return "OperationDeserializer" 3706} 3707 3708func (m *awsRestjson1_deserializeOpDescribeInstanceStorageConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3709 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3710) { 3711 out, metadata, err = next.HandleDeserialize(ctx, in) 3712 if err != nil { 3713 return out, metadata, err 3714 } 3715 3716 response, ok := out.RawResponse.(*smithyhttp.Response) 3717 if !ok { 3718 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3719 } 3720 3721 if response.StatusCode < 200 || response.StatusCode >= 300 { 3722 return out, metadata, awsRestjson1_deserializeOpErrorDescribeInstanceStorageConfig(response, &metadata) 3723 } 3724 output := &DescribeInstanceStorageConfigOutput{} 3725 out.Result = output 3726 3727 var buff [1024]byte 3728 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3729 3730 body := io.TeeReader(response.Body, ringBuffer) 3731 3732 decoder := json.NewDecoder(body) 3733 decoder.UseNumber() 3734 var shape interface{} 3735 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3736 var snapshot bytes.Buffer 3737 io.Copy(&snapshot, ringBuffer) 3738 err = &smithy.DeserializationError{ 3739 Err: fmt.Errorf("failed to decode response body, %w", err), 3740 Snapshot: snapshot.Bytes(), 3741 } 3742 return out, metadata, err 3743 } 3744 3745 err = awsRestjson1_deserializeOpDocumentDescribeInstanceStorageConfigOutput(&output, shape) 3746 if err != nil { 3747 var snapshot bytes.Buffer 3748 io.Copy(&snapshot, ringBuffer) 3749 return out, metadata, &smithy.DeserializationError{ 3750 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3751 Snapshot: snapshot.Bytes(), 3752 } 3753 } 3754 3755 return out, metadata, err 3756} 3757 3758func awsRestjson1_deserializeOpErrorDescribeInstanceStorageConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3759 var errorBuffer bytes.Buffer 3760 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3761 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3762 } 3763 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3764 3765 errorCode := "UnknownError" 3766 errorMessage := errorCode 3767 3768 code := response.Header.Get("X-Amzn-ErrorType") 3769 if len(code) != 0 { 3770 errorCode = restjson.SanitizeErrorCode(code) 3771 } 3772 3773 var buff [1024]byte 3774 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3775 3776 body := io.TeeReader(errorBody, ringBuffer) 3777 decoder := json.NewDecoder(body) 3778 decoder.UseNumber() 3779 code, message, err := restjson.GetErrorInfo(decoder) 3780 if err != nil { 3781 var snapshot bytes.Buffer 3782 io.Copy(&snapshot, ringBuffer) 3783 err = &smithy.DeserializationError{ 3784 Err: fmt.Errorf("failed to decode response body, %w", err), 3785 Snapshot: snapshot.Bytes(), 3786 } 3787 return err 3788 } 3789 3790 errorBody.Seek(0, io.SeekStart) 3791 if len(code) != 0 { 3792 errorCode = restjson.SanitizeErrorCode(code) 3793 } 3794 if len(message) != 0 { 3795 errorMessage = message 3796 } 3797 3798 switch { 3799 case strings.EqualFold("InternalServiceException", errorCode): 3800 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 3801 3802 case strings.EqualFold("InvalidParameterException", errorCode): 3803 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3804 3805 case strings.EqualFold("InvalidRequestException", errorCode): 3806 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 3807 3808 case strings.EqualFold("ResourceNotFoundException", errorCode): 3809 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3810 3811 case strings.EqualFold("ThrottlingException", errorCode): 3812 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3813 3814 default: 3815 genericError := &smithy.GenericAPIError{ 3816 Code: errorCode, 3817 Message: errorMessage, 3818 } 3819 return genericError 3820 3821 } 3822} 3823 3824func awsRestjson1_deserializeOpDocumentDescribeInstanceStorageConfigOutput(v **DescribeInstanceStorageConfigOutput, value interface{}) error { 3825 if v == nil { 3826 return fmt.Errorf("unexpected nil of type %T", v) 3827 } 3828 if value == nil { 3829 return nil 3830 } 3831 3832 shape, ok := value.(map[string]interface{}) 3833 if !ok { 3834 return fmt.Errorf("unexpected JSON type %v", value) 3835 } 3836 3837 var sv *DescribeInstanceStorageConfigOutput 3838 if *v == nil { 3839 sv = &DescribeInstanceStorageConfigOutput{} 3840 } else { 3841 sv = *v 3842 } 3843 3844 for key, value := range shape { 3845 switch key { 3846 case "StorageConfig": 3847 if err := awsRestjson1_deserializeDocumentInstanceStorageConfig(&sv.StorageConfig, value); err != nil { 3848 return err 3849 } 3850 3851 default: 3852 _, _ = key, value 3853 3854 } 3855 } 3856 *v = sv 3857 return nil 3858} 3859 3860type awsRestjson1_deserializeOpDescribeQueue struct { 3861} 3862 3863func (*awsRestjson1_deserializeOpDescribeQueue) ID() string { 3864 return "OperationDeserializer" 3865} 3866 3867func (m *awsRestjson1_deserializeOpDescribeQueue) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3868 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3869) { 3870 out, metadata, err = next.HandleDeserialize(ctx, in) 3871 if err != nil { 3872 return out, metadata, err 3873 } 3874 3875 response, ok := out.RawResponse.(*smithyhttp.Response) 3876 if !ok { 3877 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3878 } 3879 3880 if response.StatusCode < 200 || response.StatusCode >= 300 { 3881 return out, metadata, awsRestjson1_deserializeOpErrorDescribeQueue(response, &metadata) 3882 } 3883 output := &DescribeQueueOutput{} 3884 out.Result = output 3885 3886 var buff [1024]byte 3887 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3888 3889 body := io.TeeReader(response.Body, ringBuffer) 3890 3891 decoder := json.NewDecoder(body) 3892 decoder.UseNumber() 3893 var shape interface{} 3894 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3895 var snapshot bytes.Buffer 3896 io.Copy(&snapshot, ringBuffer) 3897 err = &smithy.DeserializationError{ 3898 Err: fmt.Errorf("failed to decode response body, %w", err), 3899 Snapshot: snapshot.Bytes(), 3900 } 3901 return out, metadata, err 3902 } 3903 3904 err = awsRestjson1_deserializeOpDocumentDescribeQueueOutput(&output, shape) 3905 if err != nil { 3906 var snapshot bytes.Buffer 3907 io.Copy(&snapshot, ringBuffer) 3908 return out, metadata, &smithy.DeserializationError{ 3909 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3910 Snapshot: snapshot.Bytes(), 3911 } 3912 } 3913 3914 return out, metadata, err 3915} 3916 3917func awsRestjson1_deserializeOpErrorDescribeQueue(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3918 var errorBuffer bytes.Buffer 3919 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3920 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3921 } 3922 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3923 3924 errorCode := "UnknownError" 3925 errorMessage := errorCode 3926 3927 code := response.Header.Get("X-Amzn-ErrorType") 3928 if len(code) != 0 { 3929 errorCode = restjson.SanitizeErrorCode(code) 3930 } 3931 3932 var buff [1024]byte 3933 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3934 3935 body := io.TeeReader(errorBody, ringBuffer) 3936 decoder := json.NewDecoder(body) 3937 decoder.UseNumber() 3938 code, message, err := restjson.GetErrorInfo(decoder) 3939 if err != nil { 3940 var snapshot bytes.Buffer 3941 io.Copy(&snapshot, ringBuffer) 3942 err = &smithy.DeserializationError{ 3943 Err: fmt.Errorf("failed to decode response body, %w", err), 3944 Snapshot: snapshot.Bytes(), 3945 } 3946 return err 3947 } 3948 3949 errorBody.Seek(0, io.SeekStart) 3950 if len(code) != 0 { 3951 errorCode = restjson.SanitizeErrorCode(code) 3952 } 3953 if len(message) != 0 { 3954 errorMessage = message 3955 } 3956 3957 switch { 3958 case strings.EqualFold("InternalServiceException", errorCode): 3959 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 3960 3961 case strings.EqualFold("InvalidParameterException", errorCode): 3962 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 3963 3964 case strings.EqualFold("InvalidRequestException", errorCode): 3965 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 3966 3967 case strings.EqualFold("ResourceNotFoundException", errorCode): 3968 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3969 3970 case strings.EqualFold("ThrottlingException", errorCode): 3971 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3972 3973 default: 3974 genericError := &smithy.GenericAPIError{ 3975 Code: errorCode, 3976 Message: errorMessage, 3977 } 3978 return genericError 3979 3980 } 3981} 3982 3983func awsRestjson1_deserializeOpDocumentDescribeQueueOutput(v **DescribeQueueOutput, value interface{}) error { 3984 if v == nil { 3985 return fmt.Errorf("unexpected nil of type %T", v) 3986 } 3987 if value == nil { 3988 return nil 3989 } 3990 3991 shape, ok := value.(map[string]interface{}) 3992 if !ok { 3993 return fmt.Errorf("unexpected JSON type %v", value) 3994 } 3995 3996 var sv *DescribeQueueOutput 3997 if *v == nil { 3998 sv = &DescribeQueueOutput{} 3999 } else { 4000 sv = *v 4001 } 4002 4003 for key, value := range shape { 4004 switch key { 4005 case "Queue": 4006 if err := awsRestjson1_deserializeDocumentQueue(&sv.Queue, value); err != nil { 4007 return err 4008 } 4009 4010 default: 4011 _, _ = key, value 4012 4013 } 4014 } 4015 *v = sv 4016 return nil 4017} 4018 4019type awsRestjson1_deserializeOpDescribeQuickConnect struct { 4020} 4021 4022func (*awsRestjson1_deserializeOpDescribeQuickConnect) ID() string { 4023 return "OperationDeserializer" 4024} 4025 4026func (m *awsRestjson1_deserializeOpDescribeQuickConnect) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4027 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4028) { 4029 out, metadata, err = next.HandleDeserialize(ctx, in) 4030 if err != nil { 4031 return out, metadata, err 4032 } 4033 4034 response, ok := out.RawResponse.(*smithyhttp.Response) 4035 if !ok { 4036 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4037 } 4038 4039 if response.StatusCode < 200 || response.StatusCode >= 300 { 4040 return out, metadata, awsRestjson1_deserializeOpErrorDescribeQuickConnect(response, &metadata) 4041 } 4042 output := &DescribeQuickConnectOutput{} 4043 out.Result = output 4044 4045 var buff [1024]byte 4046 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4047 4048 body := io.TeeReader(response.Body, ringBuffer) 4049 4050 decoder := json.NewDecoder(body) 4051 decoder.UseNumber() 4052 var shape interface{} 4053 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4054 var snapshot bytes.Buffer 4055 io.Copy(&snapshot, ringBuffer) 4056 err = &smithy.DeserializationError{ 4057 Err: fmt.Errorf("failed to decode response body, %w", err), 4058 Snapshot: snapshot.Bytes(), 4059 } 4060 return out, metadata, err 4061 } 4062 4063 err = awsRestjson1_deserializeOpDocumentDescribeQuickConnectOutput(&output, shape) 4064 if err != nil { 4065 var snapshot bytes.Buffer 4066 io.Copy(&snapshot, ringBuffer) 4067 return out, metadata, &smithy.DeserializationError{ 4068 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4069 Snapshot: snapshot.Bytes(), 4070 } 4071 } 4072 4073 return out, metadata, err 4074} 4075 4076func awsRestjson1_deserializeOpErrorDescribeQuickConnect(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4077 var errorBuffer bytes.Buffer 4078 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4079 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4080 } 4081 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4082 4083 errorCode := "UnknownError" 4084 errorMessage := errorCode 4085 4086 code := response.Header.Get("X-Amzn-ErrorType") 4087 if len(code) != 0 { 4088 errorCode = restjson.SanitizeErrorCode(code) 4089 } 4090 4091 var buff [1024]byte 4092 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4093 4094 body := io.TeeReader(errorBody, ringBuffer) 4095 decoder := json.NewDecoder(body) 4096 decoder.UseNumber() 4097 code, message, err := restjson.GetErrorInfo(decoder) 4098 if err != nil { 4099 var snapshot bytes.Buffer 4100 io.Copy(&snapshot, ringBuffer) 4101 err = &smithy.DeserializationError{ 4102 Err: fmt.Errorf("failed to decode response body, %w", err), 4103 Snapshot: snapshot.Bytes(), 4104 } 4105 return err 4106 } 4107 4108 errorBody.Seek(0, io.SeekStart) 4109 if len(code) != 0 { 4110 errorCode = restjson.SanitizeErrorCode(code) 4111 } 4112 if len(message) != 0 { 4113 errorMessage = message 4114 } 4115 4116 switch { 4117 case strings.EqualFold("InternalServiceException", errorCode): 4118 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 4119 4120 case strings.EqualFold("InvalidParameterException", errorCode): 4121 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4122 4123 case strings.EqualFold("InvalidRequestException", errorCode): 4124 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 4125 4126 case strings.EqualFold("ResourceNotFoundException", errorCode): 4127 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4128 4129 case strings.EqualFold("ThrottlingException", errorCode): 4130 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4131 4132 default: 4133 genericError := &smithy.GenericAPIError{ 4134 Code: errorCode, 4135 Message: errorMessage, 4136 } 4137 return genericError 4138 4139 } 4140} 4141 4142func awsRestjson1_deserializeOpDocumentDescribeQuickConnectOutput(v **DescribeQuickConnectOutput, value interface{}) error { 4143 if v == nil { 4144 return fmt.Errorf("unexpected nil of type %T", v) 4145 } 4146 if value == nil { 4147 return nil 4148 } 4149 4150 shape, ok := value.(map[string]interface{}) 4151 if !ok { 4152 return fmt.Errorf("unexpected JSON type %v", value) 4153 } 4154 4155 var sv *DescribeQuickConnectOutput 4156 if *v == nil { 4157 sv = &DescribeQuickConnectOutput{} 4158 } else { 4159 sv = *v 4160 } 4161 4162 for key, value := range shape { 4163 switch key { 4164 case "QuickConnect": 4165 if err := awsRestjson1_deserializeDocumentQuickConnect(&sv.QuickConnect, value); err != nil { 4166 return err 4167 } 4168 4169 default: 4170 _, _ = key, value 4171 4172 } 4173 } 4174 *v = sv 4175 return nil 4176} 4177 4178type awsRestjson1_deserializeOpDescribeRoutingProfile struct { 4179} 4180 4181func (*awsRestjson1_deserializeOpDescribeRoutingProfile) ID() string { 4182 return "OperationDeserializer" 4183} 4184 4185func (m *awsRestjson1_deserializeOpDescribeRoutingProfile) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4186 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4187) { 4188 out, metadata, err = next.HandleDeserialize(ctx, in) 4189 if err != nil { 4190 return out, metadata, err 4191 } 4192 4193 response, ok := out.RawResponse.(*smithyhttp.Response) 4194 if !ok { 4195 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4196 } 4197 4198 if response.StatusCode < 200 || response.StatusCode >= 300 { 4199 return out, metadata, awsRestjson1_deserializeOpErrorDescribeRoutingProfile(response, &metadata) 4200 } 4201 output := &DescribeRoutingProfileOutput{} 4202 out.Result = output 4203 4204 var buff [1024]byte 4205 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4206 4207 body := io.TeeReader(response.Body, ringBuffer) 4208 4209 decoder := json.NewDecoder(body) 4210 decoder.UseNumber() 4211 var shape interface{} 4212 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4213 var snapshot bytes.Buffer 4214 io.Copy(&snapshot, ringBuffer) 4215 err = &smithy.DeserializationError{ 4216 Err: fmt.Errorf("failed to decode response body, %w", err), 4217 Snapshot: snapshot.Bytes(), 4218 } 4219 return out, metadata, err 4220 } 4221 4222 err = awsRestjson1_deserializeOpDocumentDescribeRoutingProfileOutput(&output, shape) 4223 if err != nil { 4224 var snapshot bytes.Buffer 4225 io.Copy(&snapshot, ringBuffer) 4226 return out, metadata, &smithy.DeserializationError{ 4227 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4228 Snapshot: snapshot.Bytes(), 4229 } 4230 } 4231 4232 return out, metadata, err 4233} 4234 4235func awsRestjson1_deserializeOpErrorDescribeRoutingProfile(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4236 var errorBuffer bytes.Buffer 4237 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4238 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4239 } 4240 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4241 4242 errorCode := "UnknownError" 4243 errorMessage := errorCode 4244 4245 code := response.Header.Get("X-Amzn-ErrorType") 4246 if len(code) != 0 { 4247 errorCode = restjson.SanitizeErrorCode(code) 4248 } 4249 4250 var buff [1024]byte 4251 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4252 4253 body := io.TeeReader(errorBody, ringBuffer) 4254 decoder := json.NewDecoder(body) 4255 decoder.UseNumber() 4256 code, message, err := restjson.GetErrorInfo(decoder) 4257 if err != nil { 4258 var snapshot bytes.Buffer 4259 io.Copy(&snapshot, ringBuffer) 4260 err = &smithy.DeserializationError{ 4261 Err: fmt.Errorf("failed to decode response body, %w", err), 4262 Snapshot: snapshot.Bytes(), 4263 } 4264 return err 4265 } 4266 4267 errorBody.Seek(0, io.SeekStart) 4268 if len(code) != 0 { 4269 errorCode = restjson.SanitizeErrorCode(code) 4270 } 4271 if len(message) != 0 { 4272 errorMessage = message 4273 } 4274 4275 switch { 4276 case strings.EqualFold("InternalServiceException", errorCode): 4277 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 4278 4279 case strings.EqualFold("InvalidParameterException", errorCode): 4280 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4281 4282 case strings.EqualFold("InvalidRequestException", errorCode): 4283 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 4284 4285 case strings.EqualFold("ResourceNotFoundException", errorCode): 4286 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4287 4288 case strings.EqualFold("ThrottlingException", errorCode): 4289 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4290 4291 default: 4292 genericError := &smithy.GenericAPIError{ 4293 Code: errorCode, 4294 Message: errorMessage, 4295 } 4296 return genericError 4297 4298 } 4299} 4300 4301func awsRestjson1_deserializeOpDocumentDescribeRoutingProfileOutput(v **DescribeRoutingProfileOutput, value interface{}) error { 4302 if v == nil { 4303 return fmt.Errorf("unexpected nil of type %T", v) 4304 } 4305 if value == nil { 4306 return nil 4307 } 4308 4309 shape, ok := value.(map[string]interface{}) 4310 if !ok { 4311 return fmt.Errorf("unexpected JSON type %v", value) 4312 } 4313 4314 var sv *DescribeRoutingProfileOutput 4315 if *v == nil { 4316 sv = &DescribeRoutingProfileOutput{} 4317 } else { 4318 sv = *v 4319 } 4320 4321 for key, value := range shape { 4322 switch key { 4323 case "RoutingProfile": 4324 if err := awsRestjson1_deserializeDocumentRoutingProfile(&sv.RoutingProfile, value); err != nil { 4325 return err 4326 } 4327 4328 default: 4329 _, _ = key, value 4330 4331 } 4332 } 4333 *v = sv 4334 return nil 4335} 4336 4337type awsRestjson1_deserializeOpDescribeUser struct { 4338} 4339 4340func (*awsRestjson1_deserializeOpDescribeUser) ID() string { 4341 return "OperationDeserializer" 4342} 4343 4344func (m *awsRestjson1_deserializeOpDescribeUser) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4345 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4346) { 4347 out, metadata, err = next.HandleDeserialize(ctx, in) 4348 if err != nil { 4349 return out, metadata, err 4350 } 4351 4352 response, ok := out.RawResponse.(*smithyhttp.Response) 4353 if !ok { 4354 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4355 } 4356 4357 if response.StatusCode < 200 || response.StatusCode >= 300 { 4358 return out, metadata, awsRestjson1_deserializeOpErrorDescribeUser(response, &metadata) 4359 } 4360 output := &DescribeUserOutput{} 4361 out.Result = output 4362 4363 var buff [1024]byte 4364 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4365 4366 body := io.TeeReader(response.Body, ringBuffer) 4367 4368 decoder := json.NewDecoder(body) 4369 decoder.UseNumber() 4370 var shape interface{} 4371 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4372 var snapshot bytes.Buffer 4373 io.Copy(&snapshot, ringBuffer) 4374 err = &smithy.DeserializationError{ 4375 Err: fmt.Errorf("failed to decode response body, %w", err), 4376 Snapshot: snapshot.Bytes(), 4377 } 4378 return out, metadata, err 4379 } 4380 4381 err = awsRestjson1_deserializeOpDocumentDescribeUserOutput(&output, shape) 4382 if err != nil { 4383 var snapshot bytes.Buffer 4384 io.Copy(&snapshot, ringBuffer) 4385 return out, metadata, &smithy.DeserializationError{ 4386 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4387 Snapshot: snapshot.Bytes(), 4388 } 4389 } 4390 4391 return out, metadata, err 4392} 4393 4394func awsRestjson1_deserializeOpErrorDescribeUser(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4395 var errorBuffer bytes.Buffer 4396 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4397 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4398 } 4399 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4400 4401 errorCode := "UnknownError" 4402 errorMessage := errorCode 4403 4404 code := response.Header.Get("X-Amzn-ErrorType") 4405 if len(code) != 0 { 4406 errorCode = restjson.SanitizeErrorCode(code) 4407 } 4408 4409 var buff [1024]byte 4410 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4411 4412 body := io.TeeReader(errorBody, ringBuffer) 4413 decoder := json.NewDecoder(body) 4414 decoder.UseNumber() 4415 code, message, err := restjson.GetErrorInfo(decoder) 4416 if err != nil { 4417 var snapshot bytes.Buffer 4418 io.Copy(&snapshot, ringBuffer) 4419 err = &smithy.DeserializationError{ 4420 Err: fmt.Errorf("failed to decode response body, %w", err), 4421 Snapshot: snapshot.Bytes(), 4422 } 4423 return err 4424 } 4425 4426 errorBody.Seek(0, io.SeekStart) 4427 if len(code) != 0 { 4428 errorCode = restjson.SanitizeErrorCode(code) 4429 } 4430 if len(message) != 0 { 4431 errorMessage = message 4432 } 4433 4434 switch { 4435 case strings.EqualFold("InternalServiceException", errorCode): 4436 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 4437 4438 case strings.EqualFold("InvalidParameterException", errorCode): 4439 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4440 4441 case strings.EqualFold("InvalidRequestException", errorCode): 4442 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 4443 4444 case strings.EqualFold("ResourceNotFoundException", errorCode): 4445 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4446 4447 case strings.EqualFold("ThrottlingException", errorCode): 4448 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4449 4450 default: 4451 genericError := &smithy.GenericAPIError{ 4452 Code: errorCode, 4453 Message: errorMessage, 4454 } 4455 return genericError 4456 4457 } 4458} 4459 4460func awsRestjson1_deserializeOpDocumentDescribeUserOutput(v **DescribeUserOutput, value interface{}) error { 4461 if v == nil { 4462 return fmt.Errorf("unexpected nil of type %T", v) 4463 } 4464 if value == nil { 4465 return nil 4466 } 4467 4468 shape, ok := value.(map[string]interface{}) 4469 if !ok { 4470 return fmt.Errorf("unexpected JSON type %v", value) 4471 } 4472 4473 var sv *DescribeUserOutput 4474 if *v == nil { 4475 sv = &DescribeUserOutput{} 4476 } else { 4477 sv = *v 4478 } 4479 4480 for key, value := range shape { 4481 switch key { 4482 case "User": 4483 if err := awsRestjson1_deserializeDocumentUser(&sv.User, value); err != nil { 4484 return err 4485 } 4486 4487 default: 4488 _, _ = key, value 4489 4490 } 4491 } 4492 *v = sv 4493 return nil 4494} 4495 4496type awsRestjson1_deserializeOpDescribeUserHierarchyGroup struct { 4497} 4498 4499func (*awsRestjson1_deserializeOpDescribeUserHierarchyGroup) ID() string { 4500 return "OperationDeserializer" 4501} 4502 4503func (m *awsRestjson1_deserializeOpDescribeUserHierarchyGroup) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4504 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4505) { 4506 out, metadata, err = next.HandleDeserialize(ctx, in) 4507 if err != nil { 4508 return out, metadata, err 4509 } 4510 4511 response, ok := out.RawResponse.(*smithyhttp.Response) 4512 if !ok { 4513 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4514 } 4515 4516 if response.StatusCode < 200 || response.StatusCode >= 300 { 4517 return out, metadata, awsRestjson1_deserializeOpErrorDescribeUserHierarchyGroup(response, &metadata) 4518 } 4519 output := &DescribeUserHierarchyGroupOutput{} 4520 out.Result = output 4521 4522 var buff [1024]byte 4523 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4524 4525 body := io.TeeReader(response.Body, ringBuffer) 4526 4527 decoder := json.NewDecoder(body) 4528 decoder.UseNumber() 4529 var shape interface{} 4530 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4531 var snapshot bytes.Buffer 4532 io.Copy(&snapshot, ringBuffer) 4533 err = &smithy.DeserializationError{ 4534 Err: fmt.Errorf("failed to decode response body, %w", err), 4535 Snapshot: snapshot.Bytes(), 4536 } 4537 return out, metadata, err 4538 } 4539 4540 err = awsRestjson1_deserializeOpDocumentDescribeUserHierarchyGroupOutput(&output, shape) 4541 if err != nil { 4542 var snapshot bytes.Buffer 4543 io.Copy(&snapshot, ringBuffer) 4544 return out, metadata, &smithy.DeserializationError{ 4545 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4546 Snapshot: snapshot.Bytes(), 4547 } 4548 } 4549 4550 return out, metadata, err 4551} 4552 4553func awsRestjson1_deserializeOpErrorDescribeUserHierarchyGroup(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4554 var errorBuffer bytes.Buffer 4555 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4556 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4557 } 4558 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4559 4560 errorCode := "UnknownError" 4561 errorMessage := errorCode 4562 4563 code := response.Header.Get("X-Amzn-ErrorType") 4564 if len(code) != 0 { 4565 errorCode = restjson.SanitizeErrorCode(code) 4566 } 4567 4568 var buff [1024]byte 4569 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4570 4571 body := io.TeeReader(errorBody, ringBuffer) 4572 decoder := json.NewDecoder(body) 4573 decoder.UseNumber() 4574 code, message, err := restjson.GetErrorInfo(decoder) 4575 if err != nil { 4576 var snapshot bytes.Buffer 4577 io.Copy(&snapshot, ringBuffer) 4578 err = &smithy.DeserializationError{ 4579 Err: fmt.Errorf("failed to decode response body, %w", err), 4580 Snapshot: snapshot.Bytes(), 4581 } 4582 return err 4583 } 4584 4585 errorBody.Seek(0, io.SeekStart) 4586 if len(code) != 0 { 4587 errorCode = restjson.SanitizeErrorCode(code) 4588 } 4589 if len(message) != 0 { 4590 errorMessage = message 4591 } 4592 4593 switch { 4594 case strings.EqualFold("InternalServiceException", errorCode): 4595 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 4596 4597 case strings.EqualFold("InvalidParameterException", errorCode): 4598 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4599 4600 case strings.EqualFold("InvalidRequestException", errorCode): 4601 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 4602 4603 case strings.EqualFold("ResourceNotFoundException", errorCode): 4604 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4605 4606 case strings.EqualFold("ThrottlingException", errorCode): 4607 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4608 4609 default: 4610 genericError := &smithy.GenericAPIError{ 4611 Code: errorCode, 4612 Message: errorMessage, 4613 } 4614 return genericError 4615 4616 } 4617} 4618 4619func awsRestjson1_deserializeOpDocumentDescribeUserHierarchyGroupOutput(v **DescribeUserHierarchyGroupOutput, value interface{}) error { 4620 if v == nil { 4621 return fmt.Errorf("unexpected nil of type %T", v) 4622 } 4623 if value == nil { 4624 return nil 4625 } 4626 4627 shape, ok := value.(map[string]interface{}) 4628 if !ok { 4629 return fmt.Errorf("unexpected JSON type %v", value) 4630 } 4631 4632 var sv *DescribeUserHierarchyGroupOutput 4633 if *v == nil { 4634 sv = &DescribeUserHierarchyGroupOutput{} 4635 } else { 4636 sv = *v 4637 } 4638 4639 for key, value := range shape { 4640 switch key { 4641 case "HierarchyGroup": 4642 if err := awsRestjson1_deserializeDocumentHierarchyGroup(&sv.HierarchyGroup, value); err != nil { 4643 return err 4644 } 4645 4646 default: 4647 _, _ = key, value 4648 4649 } 4650 } 4651 *v = sv 4652 return nil 4653} 4654 4655type awsRestjson1_deserializeOpDescribeUserHierarchyStructure struct { 4656} 4657 4658func (*awsRestjson1_deserializeOpDescribeUserHierarchyStructure) ID() string { 4659 return "OperationDeserializer" 4660} 4661 4662func (m *awsRestjson1_deserializeOpDescribeUserHierarchyStructure) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4663 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4664) { 4665 out, metadata, err = next.HandleDeserialize(ctx, in) 4666 if err != nil { 4667 return out, metadata, err 4668 } 4669 4670 response, ok := out.RawResponse.(*smithyhttp.Response) 4671 if !ok { 4672 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4673 } 4674 4675 if response.StatusCode < 200 || response.StatusCode >= 300 { 4676 return out, metadata, awsRestjson1_deserializeOpErrorDescribeUserHierarchyStructure(response, &metadata) 4677 } 4678 output := &DescribeUserHierarchyStructureOutput{} 4679 out.Result = output 4680 4681 var buff [1024]byte 4682 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4683 4684 body := io.TeeReader(response.Body, ringBuffer) 4685 4686 decoder := json.NewDecoder(body) 4687 decoder.UseNumber() 4688 var shape interface{} 4689 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4690 var snapshot bytes.Buffer 4691 io.Copy(&snapshot, ringBuffer) 4692 err = &smithy.DeserializationError{ 4693 Err: fmt.Errorf("failed to decode response body, %w", err), 4694 Snapshot: snapshot.Bytes(), 4695 } 4696 return out, metadata, err 4697 } 4698 4699 err = awsRestjson1_deserializeOpDocumentDescribeUserHierarchyStructureOutput(&output, shape) 4700 if err != nil { 4701 var snapshot bytes.Buffer 4702 io.Copy(&snapshot, ringBuffer) 4703 return out, metadata, &smithy.DeserializationError{ 4704 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4705 Snapshot: snapshot.Bytes(), 4706 } 4707 } 4708 4709 return out, metadata, err 4710} 4711 4712func awsRestjson1_deserializeOpErrorDescribeUserHierarchyStructure(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4713 var errorBuffer bytes.Buffer 4714 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4715 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4716 } 4717 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4718 4719 errorCode := "UnknownError" 4720 errorMessage := errorCode 4721 4722 code := response.Header.Get("X-Amzn-ErrorType") 4723 if len(code) != 0 { 4724 errorCode = restjson.SanitizeErrorCode(code) 4725 } 4726 4727 var buff [1024]byte 4728 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4729 4730 body := io.TeeReader(errorBody, ringBuffer) 4731 decoder := json.NewDecoder(body) 4732 decoder.UseNumber() 4733 code, message, err := restjson.GetErrorInfo(decoder) 4734 if err != nil { 4735 var snapshot bytes.Buffer 4736 io.Copy(&snapshot, ringBuffer) 4737 err = &smithy.DeserializationError{ 4738 Err: fmt.Errorf("failed to decode response body, %w", err), 4739 Snapshot: snapshot.Bytes(), 4740 } 4741 return err 4742 } 4743 4744 errorBody.Seek(0, io.SeekStart) 4745 if len(code) != 0 { 4746 errorCode = restjson.SanitizeErrorCode(code) 4747 } 4748 if len(message) != 0 { 4749 errorMessage = message 4750 } 4751 4752 switch { 4753 case strings.EqualFold("InternalServiceException", errorCode): 4754 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 4755 4756 case strings.EqualFold("InvalidParameterException", errorCode): 4757 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4758 4759 case strings.EqualFold("InvalidRequestException", errorCode): 4760 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 4761 4762 case strings.EqualFold("ResourceNotFoundException", errorCode): 4763 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4764 4765 case strings.EqualFold("ThrottlingException", errorCode): 4766 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4767 4768 default: 4769 genericError := &smithy.GenericAPIError{ 4770 Code: errorCode, 4771 Message: errorMessage, 4772 } 4773 return genericError 4774 4775 } 4776} 4777 4778func awsRestjson1_deserializeOpDocumentDescribeUserHierarchyStructureOutput(v **DescribeUserHierarchyStructureOutput, value interface{}) error { 4779 if v == nil { 4780 return fmt.Errorf("unexpected nil of type %T", v) 4781 } 4782 if value == nil { 4783 return nil 4784 } 4785 4786 shape, ok := value.(map[string]interface{}) 4787 if !ok { 4788 return fmt.Errorf("unexpected JSON type %v", value) 4789 } 4790 4791 var sv *DescribeUserHierarchyStructureOutput 4792 if *v == nil { 4793 sv = &DescribeUserHierarchyStructureOutput{} 4794 } else { 4795 sv = *v 4796 } 4797 4798 for key, value := range shape { 4799 switch key { 4800 case "HierarchyStructure": 4801 if err := awsRestjson1_deserializeDocumentHierarchyStructure(&sv.HierarchyStructure, value); err != nil { 4802 return err 4803 } 4804 4805 default: 4806 _, _ = key, value 4807 4808 } 4809 } 4810 *v = sv 4811 return nil 4812} 4813 4814type awsRestjson1_deserializeOpDisassociateApprovedOrigin struct { 4815} 4816 4817func (*awsRestjson1_deserializeOpDisassociateApprovedOrigin) ID() string { 4818 return "OperationDeserializer" 4819} 4820 4821func (m *awsRestjson1_deserializeOpDisassociateApprovedOrigin) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4822 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4823) { 4824 out, metadata, err = next.HandleDeserialize(ctx, in) 4825 if err != nil { 4826 return out, metadata, err 4827 } 4828 4829 response, ok := out.RawResponse.(*smithyhttp.Response) 4830 if !ok { 4831 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4832 } 4833 4834 if response.StatusCode < 200 || response.StatusCode >= 300 { 4835 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateApprovedOrigin(response, &metadata) 4836 } 4837 output := &DisassociateApprovedOriginOutput{} 4838 out.Result = output 4839 4840 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4841 return out, metadata, &smithy.DeserializationError{ 4842 Err: fmt.Errorf("failed to discard response body, %w", err), 4843 } 4844 } 4845 4846 return out, metadata, err 4847} 4848 4849func awsRestjson1_deserializeOpErrorDisassociateApprovedOrigin(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4850 var errorBuffer bytes.Buffer 4851 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4852 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4853 } 4854 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4855 4856 errorCode := "UnknownError" 4857 errorMessage := errorCode 4858 4859 code := response.Header.Get("X-Amzn-ErrorType") 4860 if len(code) != 0 { 4861 errorCode = restjson.SanitizeErrorCode(code) 4862 } 4863 4864 var buff [1024]byte 4865 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4866 4867 body := io.TeeReader(errorBody, ringBuffer) 4868 decoder := json.NewDecoder(body) 4869 decoder.UseNumber() 4870 code, message, err := restjson.GetErrorInfo(decoder) 4871 if err != nil { 4872 var snapshot bytes.Buffer 4873 io.Copy(&snapshot, ringBuffer) 4874 err = &smithy.DeserializationError{ 4875 Err: fmt.Errorf("failed to decode response body, %w", err), 4876 Snapshot: snapshot.Bytes(), 4877 } 4878 return err 4879 } 4880 4881 errorBody.Seek(0, io.SeekStart) 4882 if len(code) != 0 { 4883 errorCode = restjson.SanitizeErrorCode(code) 4884 } 4885 if len(message) != 0 { 4886 errorMessage = message 4887 } 4888 4889 switch { 4890 case strings.EqualFold("InternalServiceException", errorCode): 4891 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 4892 4893 case strings.EqualFold("InvalidParameterException", errorCode): 4894 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4895 4896 case strings.EqualFold("InvalidRequestException", errorCode): 4897 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 4898 4899 case strings.EqualFold("ResourceNotFoundException", errorCode): 4900 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4901 4902 case strings.EqualFold("ThrottlingException", errorCode): 4903 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4904 4905 default: 4906 genericError := &smithy.GenericAPIError{ 4907 Code: errorCode, 4908 Message: errorMessage, 4909 } 4910 return genericError 4911 4912 } 4913} 4914 4915type awsRestjson1_deserializeOpDisassociateInstanceStorageConfig struct { 4916} 4917 4918func (*awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) ID() string { 4919 return "OperationDeserializer" 4920} 4921 4922func (m *awsRestjson1_deserializeOpDisassociateInstanceStorageConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4923 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4924) { 4925 out, metadata, err = next.HandleDeserialize(ctx, in) 4926 if err != nil { 4927 return out, metadata, err 4928 } 4929 4930 response, ok := out.RawResponse.(*smithyhttp.Response) 4931 if !ok { 4932 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4933 } 4934 4935 if response.StatusCode < 200 || response.StatusCode >= 300 { 4936 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(response, &metadata) 4937 } 4938 output := &DisassociateInstanceStorageConfigOutput{} 4939 out.Result = output 4940 4941 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4942 return out, metadata, &smithy.DeserializationError{ 4943 Err: fmt.Errorf("failed to discard response body, %w", err), 4944 } 4945 } 4946 4947 return out, metadata, err 4948} 4949 4950func awsRestjson1_deserializeOpErrorDisassociateInstanceStorageConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4951 var errorBuffer bytes.Buffer 4952 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4953 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4954 } 4955 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4956 4957 errorCode := "UnknownError" 4958 errorMessage := errorCode 4959 4960 code := response.Header.Get("X-Amzn-ErrorType") 4961 if len(code) != 0 { 4962 errorCode = restjson.SanitizeErrorCode(code) 4963 } 4964 4965 var buff [1024]byte 4966 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4967 4968 body := io.TeeReader(errorBody, ringBuffer) 4969 decoder := json.NewDecoder(body) 4970 decoder.UseNumber() 4971 code, message, err := restjson.GetErrorInfo(decoder) 4972 if err != nil { 4973 var snapshot bytes.Buffer 4974 io.Copy(&snapshot, ringBuffer) 4975 err = &smithy.DeserializationError{ 4976 Err: fmt.Errorf("failed to decode response body, %w", err), 4977 Snapshot: snapshot.Bytes(), 4978 } 4979 return err 4980 } 4981 4982 errorBody.Seek(0, io.SeekStart) 4983 if len(code) != 0 { 4984 errorCode = restjson.SanitizeErrorCode(code) 4985 } 4986 if len(message) != 0 { 4987 errorMessage = message 4988 } 4989 4990 switch { 4991 case strings.EqualFold("InternalServiceException", errorCode): 4992 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 4993 4994 case strings.EqualFold("InvalidParameterException", errorCode): 4995 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 4996 4997 case strings.EqualFold("InvalidRequestException", errorCode): 4998 return awsRestjson1_deserializeErrorInvalidRequestException(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 5016type awsRestjson1_deserializeOpDisassociateLambdaFunction struct { 5017} 5018 5019func (*awsRestjson1_deserializeOpDisassociateLambdaFunction) ID() string { 5020 return "OperationDeserializer" 5021} 5022 5023func (m *awsRestjson1_deserializeOpDisassociateLambdaFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5024 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5025) { 5026 out, metadata, err = next.HandleDeserialize(ctx, in) 5027 if err != nil { 5028 return out, metadata, err 5029 } 5030 5031 response, ok := out.RawResponse.(*smithyhttp.Response) 5032 if !ok { 5033 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5034 } 5035 5036 if response.StatusCode < 200 || response.StatusCode >= 300 { 5037 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateLambdaFunction(response, &metadata) 5038 } 5039 output := &DisassociateLambdaFunctionOutput{} 5040 out.Result = output 5041 5042 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5043 return out, metadata, &smithy.DeserializationError{ 5044 Err: fmt.Errorf("failed to discard response body, %w", err), 5045 } 5046 } 5047 5048 return out, metadata, err 5049} 5050 5051func awsRestjson1_deserializeOpErrorDisassociateLambdaFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5052 var errorBuffer bytes.Buffer 5053 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5054 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5055 } 5056 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5057 5058 errorCode := "UnknownError" 5059 errorMessage := errorCode 5060 5061 code := response.Header.Get("X-Amzn-ErrorType") 5062 if len(code) != 0 { 5063 errorCode = restjson.SanitizeErrorCode(code) 5064 } 5065 5066 var buff [1024]byte 5067 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5068 5069 body := io.TeeReader(errorBody, ringBuffer) 5070 decoder := json.NewDecoder(body) 5071 decoder.UseNumber() 5072 code, message, err := restjson.GetErrorInfo(decoder) 5073 if err != nil { 5074 var snapshot bytes.Buffer 5075 io.Copy(&snapshot, ringBuffer) 5076 err = &smithy.DeserializationError{ 5077 Err: fmt.Errorf("failed to decode response body, %w", err), 5078 Snapshot: snapshot.Bytes(), 5079 } 5080 return err 5081 } 5082 5083 errorBody.Seek(0, io.SeekStart) 5084 if len(code) != 0 { 5085 errorCode = restjson.SanitizeErrorCode(code) 5086 } 5087 if len(message) != 0 { 5088 errorMessage = message 5089 } 5090 5091 switch { 5092 case strings.EqualFold("InternalServiceException", errorCode): 5093 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5094 5095 case strings.EqualFold("InvalidParameterException", errorCode): 5096 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5097 5098 case strings.EqualFold("InvalidRequestException", errorCode): 5099 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5100 5101 case strings.EqualFold("ResourceNotFoundException", errorCode): 5102 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5103 5104 case strings.EqualFold("ThrottlingException", errorCode): 5105 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5106 5107 default: 5108 genericError := &smithy.GenericAPIError{ 5109 Code: errorCode, 5110 Message: errorMessage, 5111 } 5112 return genericError 5113 5114 } 5115} 5116 5117type awsRestjson1_deserializeOpDisassociateLexBot struct { 5118} 5119 5120func (*awsRestjson1_deserializeOpDisassociateLexBot) ID() string { 5121 return "OperationDeserializer" 5122} 5123 5124func (m *awsRestjson1_deserializeOpDisassociateLexBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5125 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5126) { 5127 out, metadata, err = next.HandleDeserialize(ctx, in) 5128 if err != nil { 5129 return out, metadata, err 5130 } 5131 5132 response, ok := out.RawResponse.(*smithyhttp.Response) 5133 if !ok { 5134 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5135 } 5136 5137 if response.StatusCode < 200 || response.StatusCode >= 300 { 5138 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateLexBot(response, &metadata) 5139 } 5140 output := &DisassociateLexBotOutput{} 5141 out.Result = output 5142 5143 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5144 return out, metadata, &smithy.DeserializationError{ 5145 Err: fmt.Errorf("failed to discard response body, %w", err), 5146 } 5147 } 5148 5149 return out, metadata, err 5150} 5151 5152func awsRestjson1_deserializeOpErrorDisassociateLexBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5153 var errorBuffer bytes.Buffer 5154 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5155 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5156 } 5157 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5158 5159 errorCode := "UnknownError" 5160 errorMessage := errorCode 5161 5162 code := response.Header.Get("X-Amzn-ErrorType") 5163 if len(code) != 0 { 5164 errorCode = restjson.SanitizeErrorCode(code) 5165 } 5166 5167 var buff [1024]byte 5168 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5169 5170 body := io.TeeReader(errorBody, ringBuffer) 5171 decoder := json.NewDecoder(body) 5172 decoder.UseNumber() 5173 code, message, err := restjson.GetErrorInfo(decoder) 5174 if err != nil { 5175 var snapshot bytes.Buffer 5176 io.Copy(&snapshot, ringBuffer) 5177 err = &smithy.DeserializationError{ 5178 Err: fmt.Errorf("failed to decode response body, %w", err), 5179 Snapshot: snapshot.Bytes(), 5180 } 5181 return err 5182 } 5183 5184 errorBody.Seek(0, io.SeekStart) 5185 if len(code) != 0 { 5186 errorCode = restjson.SanitizeErrorCode(code) 5187 } 5188 if len(message) != 0 { 5189 errorMessage = message 5190 } 5191 5192 switch { 5193 case strings.EqualFold("InternalServiceException", errorCode): 5194 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5195 5196 case strings.EqualFold("InvalidParameterException", errorCode): 5197 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5198 5199 case strings.EqualFold("InvalidRequestException", errorCode): 5200 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5201 5202 case strings.EqualFold("ResourceNotFoundException", errorCode): 5203 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5204 5205 case strings.EqualFold("ThrottlingException", errorCode): 5206 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5207 5208 default: 5209 genericError := &smithy.GenericAPIError{ 5210 Code: errorCode, 5211 Message: errorMessage, 5212 } 5213 return genericError 5214 5215 } 5216} 5217 5218type awsRestjson1_deserializeOpDisassociateQueueQuickConnects struct { 5219} 5220 5221func (*awsRestjson1_deserializeOpDisassociateQueueQuickConnects) ID() string { 5222 return "OperationDeserializer" 5223} 5224 5225func (m *awsRestjson1_deserializeOpDisassociateQueueQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5226 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5227) { 5228 out, metadata, err = next.HandleDeserialize(ctx, in) 5229 if err != nil { 5230 return out, metadata, err 5231 } 5232 5233 response, ok := out.RawResponse.(*smithyhttp.Response) 5234 if !ok { 5235 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5236 } 5237 5238 if response.StatusCode < 200 || response.StatusCode >= 300 { 5239 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateQueueQuickConnects(response, &metadata) 5240 } 5241 output := &DisassociateQueueQuickConnectsOutput{} 5242 out.Result = output 5243 5244 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5245 return out, metadata, &smithy.DeserializationError{ 5246 Err: fmt.Errorf("failed to discard response body, %w", err), 5247 } 5248 } 5249 5250 return out, metadata, err 5251} 5252 5253func awsRestjson1_deserializeOpErrorDisassociateQueueQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5254 var errorBuffer bytes.Buffer 5255 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5256 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5257 } 5258 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5259 5260 errorCode := "UnknownError" 5261 errorMessage := errorCode 5262 5263 code := response.Header.Get("X-Amzn-ErrorType") 5264 if len(code) != 0 { 5265 errorCode = restjson.SanitizeErrorCode(code) 5266 } 5267 5268 var buff [1024]byte 5269 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5270 5271 body := io.TeeReader(errorBody, ringBuffer) 5272 decoder := json.NewDecoder(body) 5273 decoder.UseNumber() 5274 code, message, err := restjson.GetErrorInfo(decoder) 5275 if err != nil { 5276 var snapshot bytes.Buffer 5277 io.Copy(&snapshot, ringBuffer) 5278 err = &smithy.DeserializationError{ 5279 Err: fmt.Errorf("failed to decode response body, %w", err), 5280 Snapshot: snapshot.Bytes(), 5281 } 5282 return err 5283 } 5284 5285 errorBody.Seek(0, io.SeekStart) 5286 if len(code) != 0 { 5287 errorCode = restjson.SanitizeErrorCode(code) 5288 } 5289 if len(message) != 0 { 5290 errorMessage = message 5291 } 5292 5293 switch { 5294 case strings.EqualFold("InternalServiceException", errorCode): 5295 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5296 5297 case strings.EqualFold("InvalidParameterException", errorCode): 5298 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5299 5300 case strings.EqualFold("InvalidRequestException", errorCode): 5301 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5302 5303 case strings.EqualFold("ResourceNotFoundException", errorCode): 5304 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5305 5306 case strings.EqualFold("ThrottlingException", errorCode): 5307 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5308 5309 default: 5310 genericError := &smithy.GenericAPIError{ 5311 Code: errorCode, 5312 Message: errorMessage, 5313 } 5314 return genericError 5315 5316 } 5317} 5318 5319type awsRestjson1_deserializeOpDisassociateRoutingProfileQueues struct { 5320} 5321 5322func (*awsRestjson1_deserializeOpDisassociateRoutingProfileQueues) ID() string { 5323 return "OperationDeserializer" 5324} 5325 5326func (m *awsRestjson1_deserializeOpDisassociateRoutingProfileQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5327 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5328) { 5329 out, metadata, err = next.HandleDeserialize(ctx, in) 5330 if err != nil { 5331 return out, metadata, err 5332 } 5333 5334 response, ok := out.RawResponse.(*smithyhttp.Response) 5335 if !ok { 5336 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5337 } 5338 5339 if response.StatusCode < 200 || response.StatusCode >= 300 { 5340 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateRoutingProfileQueues(response, &metadata) 5341 } 5342 output := &DisassociateRoutingProfileQueuesOutput{} 5343 out.Result = output 5344 5345 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5346 return out, metadata, &smithy.DeserializationError{ 5347 Err: fmt.Errorf("failed to discard response body, %w", err), 5348 } 5349 } 5350 5351 return out, metadata, err 5352} 5353 5354func awsRestjson1_deserializeOpErrorDisassociateRoutingProfileQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5355 var errorBuffer bytes.Buffer 5356 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5357 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5358 } 5359 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5360 5361 errorCode := "UnknownError" 5362 errorMessage := errorCode 5363 5364 code := response.Header.Get("X-Amzn-ErrorType") 5365 if len(code) != 0 { 5366 errorCode = restjson.SanitizeErrorCode(code) 5367 } 5368 5369 var buff [1024]byte 5370 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5371 5372 body := io.TeeReader(errorBody, ringBuffer) 5373 decoder := json.NewDecoder(body) 5374 decoder.UseNumber() 5375 code, message, err := restjson.GetErrorInfo(decoder) 5376 if err != nil { 5377 var snapshot bytes.Buffer 5378 io.Copy(&snapshot, ringBuffer) 5379 err = &smithy.DeserializationError{ 5380 Err: fmt.Errorf("failed to decode response body, %w", err), 5381 Snapshot: snapshot.Bytes(), 5382 } 5383 return err 5384 } 5385 5386 errorBody.Seek(0, io.SeekStart) 5387 if len(code) != 0 { 5388 errorCode = restjson.SanitizeErrorCode(code) 5389 } 5390 if len(message) != 0 { 5391 errorMessage = message 5392 } 5393 5394 switch { 5395 case strings.EqualFold("InternalServiceException", errorCode): 5396 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5397 5398 case strings.EqualFold("InvalidParameterException", errorCode): 5399 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5400 5401 case strings.EqualFold("InvalidRequestException", errorCode): 5402 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5403 5404 case strings.EqualFold("ResourceNotFoundException", errorCode): 5405 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5406 5407 case strings.EqualFold("ThrottlingException", errorCode): 5408 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5409 5410 default: 5411 genericError := &smithy.GenericAPIError{ 5412 Code: errorCode, 5413 Message: errorMessage, 5414 } 5415 return genericError 5416 5417 } 5418} 5419 5420type awsRestjson1_deserializeOpDisassociateSecurityKey struct { 5421} 5422 5423func (*awsRestjson1_deserializeOpDisassociateSecurityKey) ID() string { 5424 return "OperationDeserializer" 5425} 5426 5427func (m *awsRestjson1_deserializeOpDisassociateSecurityKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5428 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5429) { 5430 out, metadata, err = next.HandleDeserialize(ctx, in) 5431 if err != nil { 5432 return out, metadata, err 5433 } 5434 5435 response, ok := out.RawResponse.(*smithyhttp.Response) 5436 if !ok { 5437 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5438 } 5439 5440 if response.StatusCode < 200 || response.StatusCode >= 300 { 5441 return out, metadata, awsRestjson1_deserializeOpErrorDisassociateSecurityKey(response, &metadata) 5442 } 5443 output := &DisassociateSecurityKeyOutput{} 5444 out.Result = output 5445 5446 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5447 return out, metadata, &smithy.DeserializationError{ 5448 Err: fmt.Errorf("failed to discard response body, %w", err), 5449 } 5450 } 5451 5452 return out, metadata, err 5453} 5454 5455func awsRestjson1_deserializeOpErrorDisassociateSecurityKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5456 var errorBuffer bytes.Buffer 5457 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5458 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5459 } 5460 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5461 5462 errorCode := "UnknownError" 5463 errorMessage := errorCode 5464 5465 code := response.Header.Get("X-Amzn-ErrorType") 5466 if len(code) != 0 { 5467 errorCode = restjson.SanitizeErrorCode(code) 5468 } 5469 5470 var buff [1024]byte 5471 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5472 5473 body := io.TeeReader(errorBody, ringBuffer) 5474 decoder := json.NewDecoder(body) 5475 decoder.UseNumber() 5476 code, message, err := restjson.GetErrorInfo(decoder) 5477 if err != nil { 5478 var snapshot bytes.Buffer 5479 io.Copy(&snapshot, ringBuffer) 5480 err = &smithy.DeserializationError{ 5481 Err: fmt.Errorf("failed to decode response body, %w", err), 5482 Snapshot: snapshot.Bytes(), 5483 } 5484 return err 5485 } 5486 5487 errorBody.Seek(0, io.SeekStart) 5488 if len(code) != 0 { 5489 errorCode = restjson.SanitizeErrorCode(code) 5490 } 5491 if len(message) != 0 { 5492 errorMessage = message 5493 } 5494 5495 switch { 5496 case strings.EqualFold("InternalServiceException", errorCode): 5497 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5498 5499 case strings.EqualFold("InvalidParameterException", errorCode): 5500 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5501 5502 case strings.EqualFold("InvalidRequestException", errorCode): 5503 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5504 5505 case strings.EqualFold("ResourceNotFoundException", errorCode): 5506 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5507 5508 case strings.EqualFold("ThrottlingException", errorCode): 5509 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5510 5511 default: 5512 genericError := &smithy.GenericAPIError{ 5513 Code: errorCode, 5514 Message: errorMessage, 5515 } 5516 return genericError 5517 5518 } 5519} 5520 5521type awsRestjson1_deserializeOpGetContactAttributes struct { 5522} 5523 5524func (*awsRestjson1_deserializeOpGetContactAttributes) ID() string { 5525 return "OperationDeserializer" 5526} 5527 5528func (m *awsRestjson1_deserializeOpGetContactAttributes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5529 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5530) { 5531 out, metadata, err = next.HandleDeserialize(ctx, in) 5532 if err != nil { 5533 return out, metadata, err 5534 } 5535 5536 response, ok := out.RawResponse.(*smithyhttp.Response) 5537 if !ok { 5538 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5539 } 5540 5541 if response.StatusCode < 200 || response.StatusCode >= 300 { 5542 return out, metadata, awsRestjson1_deserializeOpErrorGetContactAttributes(response, &metadata) 5543 } 5544 output := &GetContactAttributesOutput{} 5545 out.Result = output 5546 5547 var buff [1024]byte 5548 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5549 5550 body := io.TeeReader(response.Body, ringBuffer) 5551 5552 decoder := json.NewDecoder(body) 5553 decoder.UseNumber() 5554 var shape interface{} 5555 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5556 var snapshot bytes.Buffer 5557 io.Copy(&snapshot, ringBuffer) 5558 err = &smithy.DeserializationError{ 5559 Err: fmt.Errorf("failed to decode response body, %w", err), 5560 Snapshot: snapshot.Bytes(), 5561 } 5562 return out, metadata, err 5563 } 5564 5565 err = awsRestjson1_deserializeOpDocumentGetContactAttributesOutput(&output, shape) 5566 if err != nil { 5567 var snapshot bytes.Buffer 5568 io.Copy(&snapshot, ringBuffer) 5569 return out, metadata, &smithy.DeserializationError{ 5570 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5571 Snapshot: snapshot.Bytes(), 5572 } 5573 } 5574 5575 return out, metadata, err 5576} 5577 5578func awsRestjson1_deserializeOpErrorGetContactAttributes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5579 var errorBuffer bytes.Buffer 5580 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5581 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5582 } 5583 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5584 5585 errorCode := "UnknownError" 5586 errorMessage := errorCode 5587 5588 code := response.Header.Get("X-Amzn-ErrorType") 5589 if len(code) != 0 { 5590 errorCode = restjson.SanitizeErrorCode(code) 5591 } 5592 5593 var buff [1024]byte 5594 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5595 5596 body := io.TeeReader(errorBody, ringBuffer) 5597 decoder := json.NewDecoder(body) 5598 decoder.UseNumber() 5599 code, message, err := restjson.GetErrorInfo(decoder) 5600 if err != nil { 5601 var snapshot bytes.Buffer 5602 io.Copy(&snapshot, ringBuffer) 5603 err = &smithy.DeserializationError{ 5604 Err: fmt.Errorf("failed to decode response body, %w", err), 5605 Snapshot: snapshot.Bytes(), 5606 } 5607 return err 5608 } 5609 5610 errorBody.Seek(0, io.SeekStart) 5611 if len(code) != 0 { 5612 errorCode = restjson.SanitizeErrorCode(code) 5613 } 5614 if len(message) != 0 { 5615 errorMessage = message 5616 } 5617 5618 switch { 5619 case strings.EqualFold("InternalServiceException", errorCode): 5620 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5621 5622 case strings.EqualFold("InvalidRequestException", errorCode): 5623 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5624 5625 case strings.EqualFold("ResourceNotFoundException", errorCode): 5626 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5627 5628 default: 5629 genericError := &smithy.GenericAPIError{ 5630 Code: errorCode, 5631 Message: errorMessage, 5632 } 5633 return genericError 5634 5635 } 5636} 5637 5638func awsRestjson1_deserializeOpDocumentGetContactAttributesOutput(v **GetContactAttributesOutput, value interface{}) error { 5639 if v == nil { 5640 return fmt.Errorf("unexpected nil of type %T", v) 5641 } 5642 if value == nil { 5643 return nil 5644 } 5645 5646 shape, ok := value.(map[string]interface{}) 5647 if !ok { 5648 return fmt.Errorf("unexpected JSON type %v", value) 5649 } 5650 5651 var sv *GetContactAttributesOutput 5652 if *v == nil { 5653 sv = &GetContactAttributesOutput{} 5654 } else { 5655 sv = *v 5656 } 5657 5658 for key, value := range shape { 5659 switch key { 5660 case "Attributes": 5661 if err := awsRestjson1_deserializeDocumentAttributes(&sv.Attributes, value); err != nil { 5662 return err 5663 } 5664 5665 default: 5666 _, _ = key, value 5667 5668 } 5669 } 5670 *v = sv 5671 return nil 5672} 5673 5674type awsRestjson1_deserializeOpGetCurrentMetricData struct { 5675} 5676 5677func (*awsRestjson1_deserializeOpGetCurrentMetricData) ID() string { 5678 return "OperationDeserializer" 5679} 5680 5681func (m *awsRestjson1_deserializeOpGetCurrentMetricData) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5682 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5683) { 5684 out, metadata, err = next.HandleDeserialize(ctx, in) 5685 if err != nil { 5686 return out, metadata, err 5687 } 5688 5689 response, ok := out.RawResponse.(*smithyhttp.Response) 5690 if !ok { 5691 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5692 } 5693 5694 if response.StatusCode < 200 || response.StatusCode >= 300 { 5695 return out, metadata, awsRestjson1_deserializeOpErrorGetCurrentMetricData(response, &metadata) 5696 } 5697 output := &GetCurrentMetricDataOutput{} 5698 out.Result = output 5699 5700 var buff [1024]byte 5701 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5702 5703 body := io.TeeReader(response.Body, ringBuffer) 5704 5705 decoder := json.NewDecoder(body) 5706 decoder.UseNumber() 5707 var shape interface{} 5708 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5709 var snapshot bytes.Buffer 5710 io.Copy(&snapshot, ringBuffer) 5711 err = &smithy.DeserializationError{ 5712 Err: fmt.Errorf("failed to decode response body, %w", err), 5713 Snapshot: snapshot.Bytes(), 5714 } 5715 return out, metadata, err 5716 } 5717 5718 err = awsRestjson1_deserializeOpDocumentGetCurrentMetricDataOutput(&output, shape) 5719 if err != nil { 5720 var snapshot bytes.Buffer 5721 io.Copy(&snapshot, ringBuffer) 5722 return out, metadata, &smithy.DeserializationError{ 5723 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5724 Snapshot: snapshot.Bytes(), 5725 } 5726 } 5727 5728 return out, metadata, err 5729} 5730 5731func awsRestjson1_deserializeOpErrorGetCurrentMetricData(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5732 var errorBuffer bytes.Buffer 5733 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5734 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5735 } 5736 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5737 5738 errorCode := "UnknownError" 5739 errorMessage := errorCode 5740 5741 code := response.Header.Get("X-Amzn-ErrorType") 5742 if len(code) != 0 { 5743 errorCode = restjson.SanitizeErrorCode(code) 5744 } 5745 5746 var buff [1024]byte 5747 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5748 5749 body := io.TeeReader(errorBody, ringBuffer) 5750 decoder := json.NewDecoder(body) 5751 decoder.UseNumber() 5752 code, message, err := restjson.GetErrorInfo(decoder) 5753 if err != nil { 5754 var snapshot bytes.Buffer 5755 io.Copy(&snapshot, ringBuffer) 5756 err = &smithy.DeserializationError{ 5757 Err: fmt.Errorf("failed to decode response body, %w", err), 5758 Snapshot: snapshot.Bytes(), 5759 } 5760 return err 5761 } 5762 5763 errorBody.Seek(0, io.SeekStart) 5764 if len(code) != 0 { 5765 errorCode = restjson.SanitizeErrorCode(code) 5766 } 5767 if len(message) != 0 { 5768 errorMessage = message 5769 } 5770 5771 switch { 5772 case strings.EqualFold("InternalServiceException", errorCode): 5773 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5774 5775 case strings.EqualFold("InvalidParameterException", errorCode): 5776 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5777 5778 case strings.EqualFold("InvalidRequestException", errorCode): 5779 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5780 5781 case strings.EqualFold("ResourceNotFoundException", errorCode): 5782 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5783 5784 case strings.EqualFold("ThrottlingException", errorCode): 5785 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5786 5787 default: 5788 genericError := &smithy.GenericAPIError{ 5789 Code: errorCode, 5790 Message: errorMessage, 5791 } 5792 return genericError 5793 5794 } 5795} 5796 5797func awsRestjson1_deserializeOpDocumentGetCurrentMetricDataOutput(v **GetCurrentMetricDataOutput, value interface{}) error { 5798 if v == nil { 5799 return fmt.Errorf("unexpected nil of type %T", v) 5800 } 5801 if value == nil { 5802 return nil 5803 } 5804 5805 shape, ok := value.(map[string]interface{}) 5806 if !ok { 5807 return fmt.Errorf("unexpected JSON type %v", value) 5808 } 5809 5810 var sv *GetCurrentMetricDataOutput 5811 if *v == nil { 5812 sv = &GetCurrentMetricDataOutput{} 5813 } else { 5814 sv = *v 5815 } 5816 5817 for key, value := range shape { 5818 switch key { 5819 case "DataSnapshotTime": 5820 if value != nil { 5821 jtv, ok := value.(json.Number) 5822 if !ok { 5823 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 5824 } 5825 f64, err := jtv.Float64() 5826 if err != nil { 5827 return err 5828 } 5829 sv.DataSnapshotTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5830 } 5831 5832 case "MetricResults": 5833 if err := awsRestjson1_deserializeDocumentCurrentMetricResults(&sv.MetricResults, value); err != nil { 5834 return err 5835 } 5836 5837 case "NextToken": 5838 if value != nil { 5839 jtv, ok := value.(string) 5840 if !ok { 5841 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5842 } 5843 sv.NextToken = ptr.String(jtv) 5844 } 5845 5846 default: 5847 _, _ = key, value 5848 5849 } 5850 } 5851 *v = sv 5852 return nil 5853} 5854 5855type awsRestjson1_deserializeOpGetFederationToken struct { 5856} 5857 5858func (*awsRestjson1_deserializeOpGetFederationToken) ID() string { 5859 return "OperationDeserializer" 5860} 5861 5862func (m *awsRestjson1_deserializeOpGetFederationToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5863 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5864) { 5865 out, metadata, err = next.HandleDeserialize(ctx, in) 5866 if err != nil { 5867 return out, metadata, err 5868 } 5869 5870 response, ok := out.RawResponse.(*smithyhttp.Response) 5871 if !ok { 5872 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5873 } 5874 5875 if response.StatusCode < 200 || response.StatusCode >= 300 { 5876 return out, metadata, awsRestjson1_deserializeOpErrorGetFederationToken(response, &metadata) 5877 } 5878 output := &GetFederationTokenOutput{} 5879 out.Result = output 5880 5881 var buff [1024]byte 5882 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5883 5884 body := io.TeeReader(response.Body, ringBuffer) 5885 5886 decoder := json.NewDecoder(body) 5887 decoder.UseNumber() 5888 var shape interface{} 5889 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5890 var snapshot bytes.Buffer 5891 io.Copy(&snapshot, ringBuffer) 5892 err = &smithy.DeserializationError{ 5893 Err: fmt.Errorf("failed to decode response body, %w", err), 5894 Snapshot: snapshot.Bytes(), 5895 } 5896 return out, metadata, err 5897 } 5898 5899 err = awsRestjson1_deserializeOpDocumentGetFederationTokenOutput(&output, shape) 5900 if err != nil { 5901 var snapshot bytes.Buffer 5902 io.Copy(&snapshot, ringBuffer) 5903 return out, metadata, &smithy.DeserializationError{ 5904 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5905 Snapshot: snapshot.Bytes(), 5906 } 5907 } 5908 5909 return out, metadata, err 5910} 5911 5912func awsRestjson1_deserializeOpErrorGetFederationToken(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5913 var errorBuffer bytes.Buffer 5914 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5915 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5916 } 5917 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5918 5919 errorCode := "UnknownError" 5920 errorMessage := errorCode 5921 5922 code := response.Header.Get("X-Amzn-ErrorType") 5923 if len(code) != 0 { 5924 errorCode = restjson.SanitizeErrorCode(code) 5925 } 5926 5927 var buff [1024]byte 5928 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5929 5930 body := io.TeeReader(errorBody, ringBuffer) 5931 decoder := json.NewDecoder(body) 5932 decoder.UseNumber() 5933 code, message, err := restjson.GetErrorInfo(decoder) 5934 if err != nil { 5935 var snapshot bytes.Buffer 5936 io.Copy(&snapshot, ringBuffer) 5937 err = &smithy.DeserializationError{ 5938 Err: fmt.Errorf("failed to decode response body, %w", err), 5939 Snapshot: snapshot.Bytes(), 5940 } 5941 return err 5942 } 5943 5944 errorBody.Seek(0, io.SeekStart) 5945 if len(code) != 0 { 5946 errorCode = restjson.SanitizeErrorCode(code) 5947 } 5948 if len(message) != 0 { 5949 errorMessage = message 5950 } 5951 5952 switch { 5953 case strings.EqualFold("DuplicateResourceException", errorCode): 5954 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 5955 5956 case strings.EqualFold("InternalServiceException", errorCode): 5957 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 5958 5959 case strings.EqualFold("InvalidParameterException", errorCode): 5960 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 5961 5962 case strings.EqualFold("InvalidRequestException", errorCode): 5963 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 5964 5965 case strings.EqualFold("ResourceNotFoundException", errorCode): 5966 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5967 5968 case strings.EqualFold("UserNotFoundException", errorCode): 5969 return awsRestjson1_deserializeErrorUserNotFoundException(response, errorBody) 5970 5971 default: 5972 genericError := &smithy.GenericAPIError{ 5973 Code: errorCode, 5974 Message: errorMessage, 5975 } 5976 return genericError 5977 5978 } 5979} 5980 5981func awsRestjson1_deserializeOpDocumentGetFederationTokenOutput(v **GetFederationTokenOutput, value interface{}) error { 5982 if v == nil { 5983 return fmt.Errorf("unexpected nil of type %T", v) 5984 } 5985 if value == nil { 5986 return nil 5987 } 5988 5989 shape, ok := value.(map[string]interface{}) 5990 if !ok { 5991 return fmt.Errorf("unexpected JSON type %v", value) 5992 } 5993 5994 var sv *GetFederationTokenOutput 5995 if *v == nil { 5996 sv = &GetFederationTokenOutput{} 5997 } else { 5998 sv = *v 5999 } 6000 6001 for key, value := range shape { 6002 switch key { 6003 case "Credentials": 6004 if err := awsRestjson1_deserializeDocumentCredentials(&sv.Credentials, value); err != nil { 6005 return err 6006 } 6007 6008 default: 6009 _, _ = key, value 6010 6011 } 6012 } 6013 *v = sv 6014 return nil 6015} 6016 6017type awsRestjson1_deserializeOpGetMetricData struct { 6018} 6019 6020func (*awsRestjson1_deserializeOpGetMetricData) ID() string { 6021 return "OperationDeserializer" 6022} 6023 6024func (m *awsRestjson1_deserializeOpGetMetricData) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6025 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6026) { 6027 out, metadata, err = next.HandleDeserialize(ctx, in) 6028 if err != nil { 6029 return out, metadata, err 6030 } 6031 6032 response, ok := out.RawResponse.(*smithyhttp.Response) 6033 if !ok { 6034 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6035 } 6036 6037 if response.StatusCode < 200 || response.StatusCode >= 300 { 6038 return out, metadata, awsRestjson1_deserializeOpErrorGetMetricData(response, &metadata) 6039 } 6040 output := &GetMetricDataOutput{} 6041 out.Result = output 6042 6043 var buff [1024]byte 6044 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6045 6046 body := io.TeeReader(response.Body, ringBuffer) 6047 6048 decoder := json.NewDecoder(body) 6049 decoder.UseNumber() 6050 var shape interface{} 6051 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6052 var snapshot bytes.Buffer 6053 io.Copy(&snapshot, ringBuffer) 6054 err = &smithy.DeserializationError{ 6055 Err: fmt.Errorf("failed to decode response body, %w", err), 6056 Snapshot: snapshot.Bytes(), 6057 } 6058 return out, metadata, err 6059 } 6060 6061 err = awsRestjson1_deserializeOpDocumentGetMetricDataOutput(&output, shape) 6062 if err != nil { 6063 var snapshot bytes.Buffer 6064 io.Copy(&snapshot, ringBuffer) 6065 return out, metadata, &smithy.DeserializationError{ 6066 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6067 Snapshot: snapshot.Bytes(), 6068 } 6069 } 6070 6071 return out, metadata, err 6072} 6073 6074func awsRestjson1_deserializeOpErrorGetMetricData(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6075 var errorBuffer bytes.Buffer 6076 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6077 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6078 } 6079 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6080 6081 errorCode := "UnknownError" 6082 errorMessage := errorCode 6083 6084 code := response.Header.Get("X-Amzn-ErrorType") 6085 if len(code) != 0 { 6086 errorCode = restjson.SanitizeErrorCode(code) 6087 } 6088 6089 var buff [1024]byte 6090 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6091 6092 body := io.TeeReader(errorBody, ringBuffer) 6093 decoder := json.NewDecoder(body) 6094 decoder.UseNumber() 6095 code, message, err := restjson.GetErrorInfo(decoder) 6096 if err != nil { 6097 var snapshot bytes.Buffer 6098 io.Copy(&snapshot, ringBuffer) 6099 err = &smithy.DeserializationError{ 6100 Err: fmt.Errorf("failed to decode response body, %w", err), 6101 Snapshot: snapshot.Bytes(), 6102 } 6103 return err 6104 } 6105 6106 errorBody.Seek(0, io.SeekStart) 6107 if len(code) != 0 { 6108 errorCode = restjson.SanitizeErrorCode(code) 6109 } 6110 if len(message) != 0 { 6111 errorMessage = message 6112 } 6113 6114 switch { 6115 case strings.EqualFold("InternalServiceException", errorCode): 6116 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 6117 6118 case strings.EqualFold("InvalidParameterException", errorCode): 6119 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6120 6121 case strings.EqualFold("InvalidRequestException", errorCode): 6122 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 6123 6124 case strings.EqualFold("ResourceNotFoundException", errorCode): 6125 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6126 6127 case strings.EqualFold("ThrottlingException", errorCode): 6128 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6129 6130 default: 6131 genericError := &smithy.GenericAPIError{ 6132 Code: errorCode, 6133 Message: errorMessage, 6134 } 6135 return genericError 6136 6137 } 6138} 6139 6140func awsRestjson1_deserializeOpDocumentGetMetricDataOutput(v **GetMetricDataOutput, value interface{}) error { 6141 if v == nil { 6142 return fmt.Errorf("unexpected nil of type %T", v) 6143 } 6144 if value == nil { 6145 return nil 6146 } 6147 6148 shape, ok := value.(map[string]interface{}) 6149 if !ok { 6150 return fmt.Errorf("unexpected JSON type %v", value) 6151 } 6152 6153 var sv *GetMetricDataOutput 6154 if *v == nil { 6155 sv = &GetMetricDataOutput{} 6156 } else { 6157 sv = *v 6158 } 6159 6160 for key, value := range shape { 6161 switch key { 6162 case "MetricResults": 6163 if err := awsRestjson1_deserializeDocumentHistoricalMetricResults(&sv.MetricResults, value); err != nil { 6164 return err 6165 } 6166 6167 case "NextToken": 6168 if value != nil { 6169 jtv, ok := value.(string) 6170 if !ok { 6171 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6172 } 6173 sv.NextToken = ptr.String(jtv) 6174 } 6175 6176 default: 6177 _, _ = key, value 6178 6179 } 6180 } 6181 *v = sv 6182 return nil 6183} 6184 6185type awsRestjson1_deserializeOpListApprovedOrigins struct { 6186} 6187 6188func (*awsRestjson1_deserializeOpListApprovedOrigins) ID() string { 6189 return "OperationDeserializer" 6190} 6191 6192func (m *awsRestjson1_deserializeOpListApprovedOrigins) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6193 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6194) { 6195 out, metadata, err = next.HandleDeserialize(ctx, in) 6196 if err != nil { 6197 return out, metadata, err 6198 } 6199 6200 response, ok := out.RawResponse.(*smithyhttp.Response) 6201 if !ok { 6202 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6203 } 6204 6205 if response.StatusCode < 200 || response.StatusCode >= 300 { 6206 return out, metadata, awsRestjson1_deserializeOpErrorListApprovedOrigins(response, &metadata) 6207 } 6208 output := &ListApprovedOriginsOutput{} 6209 out.Result = output 6210 6211 var buff [1024]byte 6212 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6213 6214 body := io.TeeReader(response.Body, ringBuffer) 6215 6216 decoder := json.NewDecoder(body) 6217 decoder.UseNumber() 6218 var shape interface{} 6219 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6220 var snapshot bytes.Buffer 6221 io.Copy(&snapshot, ringBuffer) 6222 err = &smithy.DeserializationError{ 6223 Err: fmt.Errorf("failed to decode response body, %w", err), 6224 Snapshot: snapshot.Bytes(), 6225 } 6226 return out, metadata, err 6227 } 6228 6229 err = awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(&output, shape) 6230 if err != nil { 6231 var snapshot bytes.Buffer 6232 io.Copy(&snapshot, ringBuffer) 6233 return out, metadata, &smithy.DeserializationError{ 6234 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6235 Snapshot: snapshot.Bytes(), 6236 } 6237 } 6238 6239 return out, metadata, err 6240} 6241 6242func awsRestjson1_deserializeOpErrorListApprovedOrigins(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6243 var errorBuffer bytes.Buffer 6244 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6245 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6246 } 6247 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6248 6249 errorCode := "UnknownError" 6250 errorMessage := errorCode 6251 6252 code := response.Header.Get("X-Amzn-ErrorType") 6253 if len(code) != 0 { 6254 errorCode = restjson.SanitizeErrorCode(code) 6255 } 6256 6257 var buff [1024]byte 6258 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6259 6260 body := io.TeeReader(errorBody, ringBuffer) 6261 decoder := json.NewDecoder(body) 6262 decoder.UseNumber() 6263 code, message, err := restjson.GetErrorInfo(decoder) 6264 if err != nil { 6265 var snapshot bytes.Buffer 6266 io.Copy(&snapshot, ringBuffer) 6267 err = &smithy.DeserializationError{ 6268 Err: fmt.Errorf("failed to decode response body, %w", err), 6269 Snapshot: snapshot.Bytes(), 6270 } 6271 return err 6272 } 6273 6274 errorBody.Seek(0, io.SeekStart) 6275 if len(code) != 0 { 6276 errorCode = restjson.SanitizeErrorCode(code) 6277 } 6278 if len(message) != 0 { 6279 errorMessage = message 6280 } 6281 6282 switch { 6283 case strings.EqualFold("InternalServiceException", errorCode): 6284 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 6285 6286 case strings.EqualFold("InvalidParameterException", errorCode): 6287 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6288 6289 case strings.EqualFold("InvalidRequestException", errorCode): 6290 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 6291 6292 case strings.EqualFold("ResourceNotFoundException", errorCode): 6293 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6294 6295 case strings.EqualFold("ThrottlingException", errorCode): 6296 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6297 6298 default: 6299 genericError := &smithy.GenericAPIError{ 6300 Code: errorCode, 6301 Message: errorMessage, 6302 } 6303 return genericError 6304 6305 } 6306} 6307 6308func awsRestjson1_deserializeOpDocumentListApprovedOriginsOutput(v **ListApprovedOriginsOutput, value interface{}) error { 6309 if v == nil { 6310 return fmt.Errorf("unexpected nil of type %T", v) 6311 } 6312 if value == nil { 6313 return nil 6314 } 6315 6316 shape, ok := value.(map[string]interface{}) 6317 if !ok { 6318 return fmt.Errorf("unexpected JSON type %v", value) 6319 } 6320 6321 var sv *ListApprovedOriginsOutput 6322 if *v == nil { 6323 sv = &ListApprovedOriginsOutput{} 6324 } else { 6325 sv = *v 6326 } 6327 6328 for key, value := range shape { 6329 switch key { 6330 case "NextToken": 6331 if value != nil { 6332 jtv, ok := value.(string) 6333 if !ok { 6334 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6335 } 6336 sv.NextToken = ptr.String(jtv) 6337 } 6338 6339 case "Origins": 6340 if err := awsRestjson1_deserializeDocumentOriginsList(&sv.Origins, value); err != nil { 6341 return err 6342 } 6343 6344 default: 6345 _, _ = key, value 6346 6347 } 6348 } 6349 *v = sv 6350 return nil 6351} 6352 6353type awsRestjson1_deserializeOpListContactFlows struct { 6354} 6355 6356func (*awsRestjson1_deserializeOpListContactFlows) ID() string { 6357 return "OperationDeserializer" 6358} 6359 6360func (m *awsRestjson1_deserializeOpListContactFlows) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6361 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6362) { 6363 out, metadata, err = next.HandleDeserialize(ctx, in) 6364 if err != nil { 6365 return out, metadata, err 6366 } 6367 6368 response, ok := out.RawResponse.(*smithyhttp.Response) 6369 if !ok { 6370 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6371 } 6372 6373 if response.StatusCode < 200 || response.StatusCode >= 300 { 6374 return out, metadata, awsRestjson1_deserializeOpErrorListContactFlows(response, &metadata) 6375 } 6376 output := &ListContactFlowsOutput{} 6377 out.Result = output 6378 6379 var buff [1024]byte 6380 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6381 6382 body := io.TeeReader(response.Body, ringBuffer) 6383 6384 decoder := json.NewDecoder(body) 6385 decoder.UseNumber() 6386 var shape interface{} 6387 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6388 var snapshot bytes.Buffer 6389 io.Copy(&snapshot, ringBuffer) 6390 err = &smithy.DeserializationError{ 6391 Err: fmt.Errorf("failed to decode response body, %w", err), 6392 Snapshot: snapshot.Bytes(), 6393 } 6394 return out, metadata, err 6395 } 6396 6397 err = awsRestjson1_deserializeOpDocumentListContactFlowsOutput(&output, shape) 6398 if err != nil { 6399 var snapshot bytes.Buffer 6400 io.Copy(&snapshot, ringBuffer) 6401 return out, metadata, &smithy.DeserializationError{ 6402 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6403 Snapshot: snapshot.Bytes(), 6404 } 6405 } 6406 6407 return out, metadata, err 6408} 6409 6410func awsRestjson1_deserializeOpErrorListContactFlows(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6411 var errorBuffer bytes.Buffer 6412 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6413 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6414 } 6415 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6416 6417 errorCode := "UnknownError" 6418 errorMessage := errorCode 6419 6420 code := response.Header.Get("X-Amzn-ErrorType") 6421 if len(code) != 0 { 6422 errorCode = restjson.SanitizeErrorCode(code) 6423 } 6424 6425 var buff [1024]byte 6426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6427 6428 body := io.TeeReader(errorBody, ringBuffer) 6429 decoder := json.NewDecoder(body) 6430 decoder.UseNumber() 6431 code, message, err := restjson.GetErrorInfo(decoder) 6432 if err != nil { 6433 var snapshot bytes.Buffer 6434 io.Copy(&snapshot, ringBuffer) 6435 err = &smithy.DeserializationError{ 6436 Err: fmt.Errorf("failed to decode response body, %w", err), 6437 Snapshot: snapshot.Bytes(), 6438 } 6439 return err 6440 } 6441 6442 errorBody.Seek(0, io.SeekStart) 6443 if len(code) != 0 { 6444 errorCode = restjson.SanitizeErrorCode(code) 6445 } 6446 if len(message) != 0 { 6447 errorMessage = message 6448 } 6449 6450 switch { 6451 case strings.EqualFold("InternalServiceException", errorCode): 6452 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 6453 6454 case strings.EqualFold("InvalidParameterException", errorCode): 6455 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6456 6457 case strings.EqualFold("InvalidRequestException", errorCode): 6458 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 6459 6460 case strings.EqualFold("ResourceNotFoundException", errorCode): 6461 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6462 6463 case strings.EqualFold("ThrottlingException", errorCode): 6464 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6465 6466 default: 6467 genericError := &smithy.GenericAPIError{ 6468 Code: errorCode, 6469 Message: errorMessage, 6470 } 6471 return genericError 6472 6473 } 6474} 6475 6476func awsRestjson1_deserializeOpDocumentListContactFlowsOutput(v **ListContactFlowsOutput, value interface{}) error { 6477 if v == nil { 6478 return fmt.Errorf("unexpected nil of type %T", v) 6479 } 6480 if value == nil { 6481 return nil 6482 } 6483 6484 shape, ok := value.(map[string]interface{}) 6485 if !ok { 6486 return fmt.Errorf("unexpected JSON type %v", value) 6487 } 6488 6489 var sv *ListContactFlowsOutput 6490 if *v == nil { 6491 sv = &ListContactFlowsOutput{} 6492 } else { 6493 sv = *v 6494 } 6495 6496 for key, value := range shape { 6497 switch key { 6498 case "ContactFlowSummaryList": 6499 if err := awsRestjson1_deserializeDocumentContactFlowSummaryList(&sv.ContactFlowSummaryList, value); err != nil { 6500 return err 6501 } 6502 6503 case "NextToken": 6504 if value != nil { 6505 jtv, ok := value.(string) 6506 if !ok { 6507 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6508 } 6509 sv.NextToken = ptr.String(jtv) 6510 } 6511 6512 default: 6513 _, _ = key, value 6514 6515 } 6516 } 6517 *v = sv 6518 return nil 6519} 6520 6521type awsRestjson1_deserializeOpListHoursOfOperations struct { 6522} 6523 6524func (*awsRestjson1_deserializeOpListHoursOfOperations) ID() string { 6525 return "OperationDeserializer" 6526} 6527 6528func (m *awsRestjson1_deserializeOpListHoursOfOperations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6529 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6530) { 6531 out, metadata, err = next.HandleDeserialize(ctx, in) 6532 if err != nil { 6533 return out, metadata, err 6534 } 6535 6536 response, ok := out.RawResponse.(*smithyhttp.Response) 6537 if !ok { 6538 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6539 } 6540 6541 if response.StatusCode < 200 || response.StatusCode >= 300 { 6542 return out, metadata, awsRestjson1_deserializeOpErrorListHoursOfOperations(response, &metadata) 6543 } 6544 output := &ListHoursOfOperationsOutput{} 6545 out.Result = output 6546 6547 var buff [1024]byte 6548 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6549 6550 body := io.TeeReader(response.Body, ringBuffer) 6551 6552 decoder := json.NewDecoder(body) 6553 decoder.UseNumber() 6554 var shape interface{} 6555 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6556 var snapshot bytes.Buffer 6557 io.Copy(&snapshot, ringBuffer) 6558 err = &smithy.DeserializationError{ 6559 Err: fmt.Errorf("failed to decode response body, %w", err), 6560 Snapshot: snapshot.Bytes(), 6561 } 6562 return out, metadata, err 6563 } 6564 6565 err = awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(&output, shape) 6566 if err != nil { 6567 var snapshot bytes.Buffer 6568 io.Copy(&snapshot, ringBuffer) 6569 return out, metadata, &smithy.DeserializationError{ 6570 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6571 Snapshot: snapshot.Bytes(), 6572 } 6573 } 6574 6575 return out, metadata, err 6576} 6577 6578func awsRestjson1_deserializeOpErrorListHoursOfOperations(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6579 var errorBuffer bytes.Buffer 6580 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6581 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6582 } 6583 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6584 6585 errorCode := "UnknownError" 6586 errorMessage := errorCode 6587 6588 code := response.Header.Get("X-Amzn-ErrorType") 6589 if len(code) != 0 { 6590 errorCode = restjson.SanitizeErrorCode(code) 6591 } 6592 6593 var buff [1024]byte 6594 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6595 6596 body := io.TeeReader(errorBody, ringBuffer) 6597 decoder := json.NewDecoder(body) 6598 decoder.UseNumber() 6599 code, message, err := restjson.GetErrorInfo(decoder) 6600 if err != nil { 6601 var snapshot bytes.Buffer 6602 io.Copy(&snapshot, ringBuffer) 6603 err = &smithy.DeserializationError{ 6604 Err: fmt.Errorf("failed to decode response body, %w", err), 6605 Snapshot: snapshot.Bytes(), 6606 } 6607 return err 6608 } 6609 6610 errorBody.Seek(0, io.SeekStart) 6611 if len(code) != 0 { 6612 errorCode = restjson.SanitizeErrorCode(code) 6613 } 6614 if len(message) != 0 { 6615 errorMessage = message 6616 } 6617 6618 switch { 6619 case strings.EqualFold("InternalServiceException", errorCode): 6620 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 6621 6622 case strings.EqualFold("InvalidParameterException", errorCode): 6623 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6624 6625 case strings.EqualFold("InvalidRequestException", errorCode): 6626 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 6627 6628 case strings.EqualFold("ResourceNotFoundException", errorCode): 6629 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6630 6631 case strings.EqualFold("ThrottlingException", errorCode): 6632 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6633 6634 default: 6635 genericError := &smithy.GenericAPIError{ 6636 Code: errorCode, 6637 Message: errorMessage, 6638 } 6639 return genericError 6640 6641 } 6642} 6643 6644func awsRestjson1_deserializeOpDocumentListHoursOfOperationsOutput(v **ListHoursOfOperationsOutput, value interface{}) error { 6645 if v == nil { 6646 return fmt.Errorf("unexpected nil of type %T", v) 6647 } 6648 if value == nil { 6649 return nil 6650 } 6651 6652 shape, ok := value.(map[string]interface{}) 6653 if !ok { 6654 return fmt.Errorf("unexpected JSON type %v", value) 6655 } 6656 6657 var sv *ListHoursOfOperationsOutput 6658 if *v == nil { 6659 sv = &ListHoursOfOperationsOutput{} 6660 } else { 6661 sv = *v 6662 } 6663 6664 for key, value := range shape { 6665 switch key { 6666 case "HoursOfOperationSummaryList": 6667 if err := awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(&sv.HoursOfOperationSummaryList, value); err != nil { 6668 return err 6669 } 6670 6671 case "NextToken": 6672 if value != nil { 6673 jtv, ok := value.(string) 6674 if !ok { 6675 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6676 } 6677 sv.NextToken = ptr.String(jtv) 6678 } 6679 6680 default: 6681 _, _ = key, value 6682 6683 } 6684 } 6685 *v = sv 6686 return nil 6687} 6688 6689type awsRestjson1_deserializeOpListInstanceAttributes struct { 6690} 6691 6692func (*awsRestjson1_deserializeOpListInstanceAttributes) ID() string { 6693 return "OperationDeserializer" 6694} 6695 6696func (m *awsRestjson1_deserializeOpListInstanceAttributes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6697 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6698) { 6699 out, metadata, err = next.HandleDeserialize(ctx, in) 6700 if err != nil { 6701 return out, metadata, err 6702 } 6703 6704 response, ok := out.RawResponse.(*smithyhttp.Response) 6705 if !ok { 6706 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6707 } 6708 6709 if response.StatusCode < 200 || response.StatusCode >= 300 { 6710 return out, metadata, awsRestjson1_deserializeOpErrorListInstanceAttributes(response, &metadata) 6711 } 6712 output := &ListInstanceAttributesOutput{} 6713 out.Result = output 6714 6715 var buff [1024]byte 6716 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6717 6718 body := io.TeeReader(response.Body, ringBuffer) 6719 6720 decoder := json.NewDecoder(body) 6721 decoder.UseNumber() 6722 var shape interface{} 6723 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6724 var snapshot bytes.Buffer 6725 io.Copy(&snapshot, ringBuffer) 6726 err = &smithy.DeserializationError{ 6727 Err: fmt.Errorf("failed to decode response body, %w", err), 6728 Snapshot: snapshot.Bytes(), 6729 } 6730 return out, metadata, err 6731 } 6732 6733 err = awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(&output, shape) 6734 if err != nil { 6735 var snapshot bytes.Buffer 6736 io.Copy(&snapshot, ringBuffer) 6737 return out, metadata, &smithy.DeserializationError{ 6738 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6739 Snapshot: snapshot.Bytes(), 6740 } 6741 } 6742 6743 return out, metadata, err 6744} 6745 6746func awsRestjson1_deserializeOpErrorListInstanceAttributes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6747 var errorBuffer bytes.Buffer 6748 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6749 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6750 } 6751 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6752 6753 errorCode := "UnknownError" 6754 errorMessage := errorCode 6755 6756 code := response.Header.Get("X-Amzn-ErrorType") 6757 if len(code) != 0 { 6758 errorCode = restjson.SanitizeErrorCode(code) 6759 } 6760 6761 var buff [1024]byte 6762 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6763 6764 body := io.TeeReader(errorBody, ringBuffer) 6765 decoder := json.NewDecoder(body) 6766 decoder.UseNumber() 6767 code, message, err := restjson.GetErrorInfo(decoder) 6768 if err != nil { 6769 var snapshot bytes.Buffer 6770 io.Copy(&snapshot, ringBuffer) 6771 err = &smithy.DeserializationError{ 6772 Err: fmt.Errorf("failed to decode response body, %w", err), 6773 Snapshot: snapshot.Bytes(), 6774 } 6775 return err 6776 } 6777 6778 errorBody.Seek(0, io.SeekStart) 6779 if len(code) != 0 { 6780 errorCode = restjson.SanitizeErrorCode(code) 6781 } 6782 if len(message) != 0 { 6783 errorMessage = message 6784 } 6785 6786 switch { 6787 case strings.EqualFold("InternalServiceException", errorCode): 6788 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 6789 6790 case strings.EqualFold("InvalidParameterException", errorCode): 6791 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 6792 6793 case strings.EqualFold("InvalidRequestException", errorCode): 6794 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 6795 6796 case strings.EqualFold("ResourceNotFoundException", errorCode): 6797 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6798 6799 case strings.EqualFold("ThrottlingException", errorCode): 6800 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6801 6802 default: 6803 genericError := &smithy.GenericAPIError{ 6804 Code: errorCode, 6805 Message: errorMessage, 6806 } 6807 return genericError 6808 6809 } 6810} 6811 6812func awsRestjson1_deserializeOpDocumentListInstanceAttributesOutput(v **ListInstanceAttributesOutput, value interface{}) error { 6813 if v == nil { 6814 return fmt.Errorf("unexpected nil of type %T", v) 6815 } 6816 if value == nil { 6817 return nil 6818 } 6819 6820 shape, ok := value.(map[string]interface{}) 6821 if !ok { 6822 return fmt.Errorf("unexpected JSON type %v", value) 6823 } 6824 6825 var sv *ListInstanceAttributesOutput 6826 if *v == nil { 6827 sv = &ListInstanceAttributesOutput{} 6828 } else { 6829 sv = *v 6830 } 6831 6832 for key, value := range shape { 6833 switch key { 6834 case "Attributes": 6835 if err := awsRestjson1_deserializeDocumentAttributesList(&sv.Attributes, value); err != nil { 6836 return err 6837 } 6838 6839 case "NextToken": 6840 if value != nil { 6841 jtv, ok := value.(string) 6842 if !ok { 6843 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6844 } 6845 sv.NextToken = ptr.String(jtv) 6846 } 6847 6848 default: 6849 _, _ = key, value 6850 6851 } 6852 } 6853 *v = sv 6854 return nil 6855} 6856 6857type awsRestjson1_deserializeOpListInstances struct { 6858} 6859 6860func (*awsRestjson1_deserializeOpListInstances) ID() string { 6861 return "OperationDeserializer" 6862} 6863 6864func (m *awsRestjson1_deserializeOpListInstances) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6865 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6866) { 6867 out, metadata, err = next.HandleDeserialize(ctx, in) 6868 if err != nil { 6869 return out, metadata, err 6870 } 6871 6872 response, ok := out.RawResponse.(*smithyhttp.Response) 6873 if !ok { 6874 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6875 } 6876 6877 if response.StatusCode < 200 || response.StatusCode >= 300 { 6878 return out, metadata, awsRestjson1_deserializeOpErrorListInstances(response, &metadata) 6879 } 6880 output := &ListInstancesOutput{} 6881 out.Result = output 6882 6883 var buff [1024]byte 6884 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6885 6886 body := io.TeeReader(response.Body, ringBuffer) 6887 6888 decoder := json.NewDecoder(body) 6889 decoder.UseNumber() 6890 var shape interface{} 6891 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6892 var snapshot bytes.Buffer 6893 io.Copy(&snapshot, ringBuffer) 6894 err = &smithy.DeserializationError{ 6895 Err: fmt.Errorf("failed to decode response body, %w", err), 6896 Snapshot: snapshot.Bytes(), 6897 } 6898 return out, metadata, err 6899 } 6900 6901 err = awsRestjson1_deserializeOpDocumentListInstancesOutput(&output, shape) 6902 if err != nil { 6903 var snapshot bytes.Buffer 6904 io.Copy(&snapshot, ringBuffer) 6905 return out, metadata, &smithy.DeserializationError{ 6906 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6907 Snapshot: snapshot.Bytes(), 6908 } 6909 } 6910 6911 return out, metadata, err 6912} 6913 6914func awsRestjson1_deserializeOpErrorListInstances(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6915 var errorBuffer bytes.Buffer 6916 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6917 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6918 } 6919 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6920 6921 errorCode := "UnknownError" 6922 errorMessage := errorCode 6923 6924 code := response.Header.Get("X-Amzn-ErrorType") 6925 if len(code) != 0 { 6926 errorCode = restjson.SanitizeErrorCode(code) 6927 } 6928 6929 var buff [1024]byte 6930 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6931 6932 body := io.TeeReader(errorBody, ringBuffer) 6933 decoder := json.NewDecoder(body) 6934 decoder.UseNumber() 6935 code, message, err := restjson.GetErrorInfo(decoder) 6936 if err != nil { 6937 var snapshot bytes.Buffer 6938 io.Copy(&snapshot, ringBuffer) 6939 err = &smithy.DeserializationError{ 6940 Err: fmt.Errorf("failed to decode response body, %w", err), 6941 Snapshot: snapshot.Bytes(), 6942 } 6943 return err 6944 } 6945 6946 errorBody.Seek(0, io.SeekStart) 6947 if len(code) != 0 { 6948 errorCode = restjson.SanitizeErrorCode(code) 6949 } 6950 if len(message) != 0 { 6951 errorMessage = message 6952 } 6953 6954 switch { 6955 case strings.EqualFold("InternalServiceException", errorCode): 6956 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 6957 6958 case strings.EqualFold("InvalidRequestException", errorCode): 6959 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 6960 6961 default: 6962 genericError := &smithy.GenericAPIError{ 6963 Code: errorCode, 6964 Message: errorMessage, 6965 } 6966 return genericError 6967 6968 } 6969} 6970 6971func awsRestjson1_deserializeOpDocumentListInstancesOutput(v **ListInstancesOutput, value interface{}) error { 6972 if v == nil { 6973 return fmt.Errorf("unexpected nil of type %T", v) 6974 } 6975 if value == nil { 6976 return nil 6977 } 6978 6979 shape, ok := value.(map[string]interface{}) 6980 if !ok { 6981 return fmt.Errorf("unexpected JSON type %v", value) 6982 } 6983 6984 var sv *ListInstancesOutput 6985 if *v == nil { 6986 sv = &ListInstancesOutput{} 6987 } else { 6988 sv = *v 6989 } 6990 6991 for key, value := range shape { 6992 switch key { 6993 case "InstanceSummaryList": 6994 if err := awsRestjson1_deserializeDocumentInstanceSummaryList(&sv.InstanceSummaryList, value); err != nil { 6995 return err 6996 } 6997 6998 case "NextToken": 6999 if value != nil { 7000 jtv, ok := value.(string) 7001 if !ok { 7002 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7003 } 7004 sv.NextToken = ptr.String(jtv) 7005 } 7006 7007 default: 7008 _, _ = key, value 7009 7010 } 7011 } 7012 *v = sv 7013 return nil 7014} 7015 7016type awsRestjson1_deserializeOpListInstanceStorageConfigs struct { 7017} 7018 7019func (*awsRestjson1_deserializeOpListInstanceStorageConfigs) ID() string { 7020 return "OperationDeserializer" 7021} 7022 7023func (m *awsRestjson1_deserializeOpListInstanceStorageConfigs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7024 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7025) { 7026 out, metadata, err = next.HandleDeserialize(ctx, in) 7027 if err != nil { 7028 return out, metadata, err 7029 } 7030 7031 response, ok := out.RawResponse.(*smithyhttp.Response) 7032 if !ok { 7033 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7034 } 7035 7036 if response.StatusCode < 200 || response.StatusCode >= 300 { 7037 return out, metadata, awsRestjson1_deserializeOpErrorListInstanceStorageConfigs(response, &metadata) 7038 } 7039 output := &ListInstanceStorageConfigsOutput{} 7040 out.Result = output 7041 7042 var buff [1024]byte 7043 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7044 7045 body := io.TeeReader(response.Body, ringBuffer) 7046 7047 decoder := json.NewDecoder(body) 7048 decoder.UseNumber() 7049 var shape interface{} 7050 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7051 var snapshot bytes.Buffer 7052 io.Copy(&snapshot, ringBuffer) 7053 err = &smithy.DeserializationError{ 7054 Err: fmt.Errorf("failed to decode response body, %w", err), 7055 Snapshot: snapshot.Bytes(), 7056 } 7057 return out, metadata, err 7058 } 7059 7060 err = awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(&output, shape) 7061 if err != nil { 7062 var snapshot bytes.Buffer 7063 io.Copy(&snapshot, ringBuffer) 7064 return out, metadata, &smithy.DeserializationError{ 7065 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7066 Snapshot: snapshot.Bytes(), 7067 } 7068 } 7069 7070 return out, metadata, err 7071} 7072 7073func awsRestjson1_deserializeOpErrorListInstanceStorageConfigs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7074 var errorBuffer bytes.Buffer 7075 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7076 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7077 } 7078 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7079 7080 errorCode := "UnknownError" 7081 errorMessage := errorCode 7082 7083 code := response.Header.Get("X-Amzn-ErrorType") 7084 if len(code) != 0 { 7085 errorCode = restjson.SanitizeErrorCode(code) 7086 } 7087 7088 var buff [1024]byte 7089 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7090 7091 body := io.TeeReader(errorBody, ringBuffer) 7092 decoder := json.NewDecoder(body) 7093 decoder.UseNumber() 7094 code, message, err := restjson.GetErrorInfo(decoder) 7095 if err != nil { 7096 var snapshot bytes.Buffer 7097 io.Copy(&snapshot, ringBuffer) 7098 err = &smithy.DeserializationError{ 7099 Err: fmt.Errorf("failed to decode response body, %w", err), 7100 Snapshot: snapshot.Bytes(), 7101 } 7102 return err 7103 } 7104 7105 errorBody.Seek(0, io.SeekStart) 7106 if len(code) != 0 { 7107 errorCode = restjson.SanitizeErrorCode(code) 7108 } 7109 if len(message) != 0 { 7110 errorMessage = message 7111 } 7112 7113 switch { 7114 case strings.EqualFold("InternalServiceException", errorCode): 7115 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 7116 7117 case strings.EqualFold("InvalidParameterException", errorCode): 7118 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7119 7120 case strings.EqualFold("InvalidRequestException", errorCode): 7121 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 7122 7123 case strings.EqualFold("ResourceNotFoundException", errorCode): 7124 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7125 7126 case strings.EqualFold("ThrottlingException", errorCode): 7127 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7128 7129 default: 7130 genericError := &smithy.GenericAPIError{ 7131 Code: errorCode, 7132 Message: errorMessage, 7133 } 7134 return genericError 7135 7136 } 7137} 7138 7139func awsRestjson1_deserializeOpDocumentListInstanceStorageConfigsOutput(v **ListInstanceStorageConfigsOutput, value interface{}) error { 7140 if v == nil { 7141 return fmt.Errorf("unexpected nil of type %T", v) 7142 } 7143 if value == nil { 7144 return nil 7145 } 7146 7147 shape, ok := value.(map[string]interface{}) 7148 if !ok { 7149 return fmt.Errorf("unexpected JSON type %v", value) 7150 } 7151 7152 var sv *ListInstanceStorageConfigsOutput 7153 if *v == nil { 7154 sv = &ListInstanceStorageConfigsOutput{} 7155 } else { 7156 sv = *v 7157 } 7158 7159 for key, value := range shape { 7160 switch key { 7161 case "NextToken": 7162 if value != nil { 7163 jtv, ok := value.(string) 7164 if !ok { 7165 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7166 } 7167 sv.NextToken = ptr.String(jtv) 7168 } 7169 7170 case "StorageConfigs": 7171 if err := awsRestjson1_deserializeDocumentInstanceStorageConfigs(&sv.StorageConfigs, value); err != nil { 7172 return err 7173 } 7174 7175 default: 7176 _, _ = key, value 7177 7178 } 7179 } 7180 *v = sv 7181 return nil 7182} 7183 7184type awsRestjson1_deserializeOpListIntegrationAssociations struct { 7185} 7186 7187func (*awsRestjson1_deserializeOpListIntegrationAssociations) ID() string { 7188 return "OperationDeserializer" 7189} 7190 7191func (m *awsRestjson1_deserializeOpListIntegrationAssociations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7192 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7193) { 7194 out, metadata, err = next.HandleDeserialize(ctx, in) 7195 if err != nil { 7196 return out, metadata, err 7197 } 7198 7199 response, ok := out.RawResponse.(*smithyhttp.Response) 7200 if !ok { 7201 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7202 } 7203 7204 if response.StatusCode < 200 || response.StatusCode >= 300 { 7205 return out, metadata, awsRestjson1_deserializeOpErrorListIntegrationAssociations(response, &metadata) 7206 } 7207 output := &ListIntegrationAssociationsOutput{} 7208 out.Result = output 7209 7210 var buff [1024]byte 7211 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7212 7213 body := io.TeeReader(response.Body, ringBuffer) 7214 7215 decoder := json.NewDecoder(body) 7216 decoder.UseNumber() 7217 var shape interface{} 7218 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7219 var snapshot bytes.Buffer 7220 io.Copy(&snapshot, ringBuffer) 7221 err = &smithy.DeserializationError{ 7222 Err: fmt.Errorf("failed to decode response body, %w", err), 7223 Snapshot: snapshot.Bytes(), 7224 } 7225 return out, metadata, err 7226 } 7227 7228 err = awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(&output, shape) 7229 if err != nil { 7230 var snapshot bytes.Buffer 7231 io.Copy(&snapshot, ringBuffer) 7232 return out, metadata, &smithy.DeserializationError{ 7233 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7234 Snapshot: snapshot.Bytes(), 7235 } 7236 } 7237 7238 return out, metadata, err 7239} 7240 7241func awsRestjson1_deserializeOpErrorListIntegrationAssociations(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7242 var errorBuffer bytes.Buffer 7243 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7244 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7245 } 7246 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7247 7248 errorCode := "UnknownError" 7249 errorMessage := errorCode 7250 7251 code := response.Header.Get("X-Amzn-ErrorType") 7252 if len(code) != 0 { 7253 errorCode = restjson.SanitizeErrorCode(code) 7254 } 7255 7256 var buff [1024]byte 7257 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7258 7259 body := io.TeeReader(errorBody, ringBuffer) 7260 decoder := json.NewDecoder(body) 7261 decoder.UseNumber() 7262 code, message, err := restjson.GetErrorInfo(decoder) 7263 if err != nil { 7264 var snapshot bytes.Buffer 7265 io.Copy(&snapshot, ringBuffer) 7266 err = &smithy.DeserializationError{ 7267 Err: fmt.Errorf("failed to decode response body, %w", err), 7268 Snapshot: snapshot.Bytes(), 7269 } 7270 return err 7271 } 7272 7273 errorBody.Seek(0, io.SeekStart) 7274 if len(code) != 0 { 7275 errorCode = restjson.SanitizeErrorCode(code) 7276 } 7277 if len(message) != 0 { 7278 errorMessage = message 7279 } 7280 7281 switch { 7282 case strings.EqualFold("InternalServiceException", errorCode): 7283 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 7284 7285 case strings.EqualFold("InvalidRequestException", errorCode): 7286 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 7287 7288 case strings.EqualFold("ResourceNotFoundException", errorCode): 7289 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7290 7291 case strings.EqualFold("ThrottlingException", errorCode): 7292 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7293 7294 default: 7295 genericError := &smithy.GenericAPIError{ 7296 Code: errorCode, 7297 Message: errorMessage, 7298 } 7299 return genericError 7300 7301 } 7302} 7303 7304func awsRestjson1_deserializeOpDocumentListIntegrationAssociationsOutput(v **ListIntegrationAssociationsOutput, value interface{}) error { 7305 if v == nil { 7306 return fmt.Errorf("unexpected nil of type %T", v) 7307 } 7308 if value == nil { 7309 return nil 7310 } 7311 7312 shape, ok := value.(map[string]interface{}) 7313 if !ok { 7314 return fmt.Errorf("unexpected JSON type %v", value) 7315 } 7316 7317 var sv *ListIntegrationAssociationsOutput 7318 if *v == nil { 7319 sv = &ListIntegrationAssociationsOutput{} 7320 } else { 7321 sv = *v 7322 } 7323 7324 for key, value := range shape { 7325 switch key { 7326 case "IntegrationAssociationSummaryList": 7327 if err := awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(&sv.IntegrationAssociationSummaryList, value); err != nil { 7328 return err 7329 } 7330 7331 case "NextToken": 7332 if value != nil { 7333 jtv, ok := value.(string) 7334 if !ok { 7335 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7336 } 7337 sv.NextToken = ptr.String(jtv) 7338 } 7339 7340 default: 7341 _, _ = key, value 7342 7343 } 7344 } 7345 *v = sv 7346 return nil 7347} 7348 7349type awsRestjson1_deserializeOpListLambdaFunctions struct { 7350} 7351 7352func (*awsRestjson1_deserializeOpListLambdaFunctions) ID() string { 7353 return "OperationDeserializer" 7354} 7355 7356func (m *awsRestjson1_deserializeOpListLambdaFunctions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7357 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7358) { 7359 out, metadata, err = next.HandleDeserialize(ctx, in) 7360 if err != nil { 7361 return out, metadata, err 7362 } 7363 7364 response, ok := out.RawResponse.(*smithyhttp.Response) 7365 if !ok { 7366 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7367 } 7368 7369 if response.StatusCode < 200 || response.StatusCode >= 300 { 7370 return out, metadata, awsRestjson1_deserializeOpErrorListLambdaFunctions(response, &metadata) 7371 } 7372 output := &ListLambdaFunctionsOutput{} 7373 out.Result = output 7374 7375 var buff [1024]byte 7376 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7377 7378 body := io.TeeReader(response.Body, ringBuffer) 7379 7380 decoder := json.NewDecoder(body) 7381 decoder.UseNumber() 7382 var shape interface{} 7383 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7384 var snapshot bytes.Buffer 7385 io.Copy(&snapshot, ringBuffer) 7386 err = &smithy.DeserializationError{ 7387 Err: fmt.Errorf("failed to decode response body, %w", err), 7388 Snapshot: snapshot.Bytes(), 7389 } 7390 return out, metadata, err 7391 } 7392 7393 err = awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(&output, shape) 7394 if err != nil { 7395 var snapshot bytes.Buffer 7396 io.Copy(&snapshot, ringBuffer) 7397 return out, metadata, &smithy.DeserializationError{ 7398 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7399 Snapshot: snapshot.Bytes(), 7400 } 7401 } 7402 7403 return out, metadata, err 7404} 7405 7406func awsRestjson1_deserializeOpErrorListLambdaFunctions(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7407 var errorBuffer bytes.Buffer 7408 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7409 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7410 } 7411 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7412 7413 errorCode := "UnknownError" 7414 errorMessage := errorCode 7415 7416 code := response.Header.Get("X-Amzn-ErrorType") 7417 if len(code) != 0 { 7418 errorCode = restjson.SanitizeErrorCode(code) 7419 } 7420 7421 var buff [1024]byte 7422 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7423 7424 body := io.TeeReader(errorBody, ringBuffer) 7425 decoder := json.NewDecoder(body) 7426 decoder.UseNumber() 7427 code, message, err := restjson.GetErrorInfo(decoder) 7428 if err != nil { 7429 var snapshot bytes.Buffer 7430 io.Copy(&snapshot, ringBuffer) 7431 err = &smithy.DeserializationError{ 7432 Err: fmt.Errorf("failed to decode response body, %w", err), 7433 Snapshot: snapshot.Bytes(), 7434 } 7435 return err 7436 } 7437 7438 errorBody.Seek(0, io.SeekStart) 7439 if len(code) != 0 { 7440 errorCode = restjson.SanitizeErrorCode(code) 7441 } 7442 if len(message) != 0 { 7443 errorMessage = message 7444 } 7445 7446 switch { 7447 case strings.EqualFold("InternalServiceException", errorCode): 7448 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 7449 7450 case strings.EqualFold("InvalidParameterException", errorCode): 7451 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7452 7453 case strings.EqualFold("InvalidRequestException", errorCode): 7454 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 7455 7456 case strings.EqualFold("ResourceNotFoundException", errorCode): 7457 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7458 7459 case strings.EqualFold("ThrottlingException", errorCode): 7460 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7461 7462 default: 7463 genericError := &smithy.GenericAPIError{ 7464 Code: errorCode, 7465 Message: errorMessage, 7466 } 7467 return genericError 7468 7469 } 7470} 7471 7472func awsRestjson1_deserializeOpDocumentListLambdaFunctionsOutput(v **ListLambdaFunctionsOutput, value interface{}) error { 7473 if v == nil { 7474 return fmt.Errorf("unexpected nil of type %T", v) 7475 } 7476 if value == nil { 7477 return nil 7478 } 7479 7480 shape, ok := value.(map[string]interface{}) 7481 if !ok { 7482 return fmt.Errorf("unexpected JSON type %v", value) 7483 } 7484 7485 var sv *ListLambdaFunctionsOutput 7486 if *v == nil { 7487 sv = &ListLambdaFunctionsOutput{} 7488 } else { 7489 sv = *v 7490 } 7491 7492 for key, value := range shape { 7493 switch key { 7494 case "LambdaFunctions": 7495 if err := awsRestjson1_deserializeDocumentFunctionArnsList(&sv.LambdaFunctions, value); err != nil { 7496 return err 7497 } 7498 7499 case "NextToken": 7500 if value != nil { 7501 jtv, ok := value.(string) 7502 if !ok { 7503 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7504 } 7505 sv.NextToken = ptr.String(jtv) 7506 } 7507 7508 default: 7509 _, _ = key, value 7510 7511 } 7512 } 7513 *v = sv 7514 return nil 7515} 7516 7517type awsRestjson1_deserializeOpListLexBots struct { 7518} 7519 7520func (*awsRestjson1_deserializeOpListLexBots) ID() string { 7521 return "OperationDeserializer" 7522} 7523 7524func (m *awsRestjson1_deserializeOpListLexBots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7525 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7526) { 7527 out, metadata, err = next.HandleDeserialize(ctx, in) 7528 if err != nil { 7529 return out, metadata, err 7530 } 7531 7532 response, ok := out.RawResponse.(*smithyhttp.Response) 7533 if !ok { 7534 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7535 } 7536 7537 if response.StatusCode < 200 || response.StatusCode >= 300 { 7538 return out, metadata, awsRestjson1_deserializeOpErrorListLexBots(response, &metadata) 7539 } 7540 output := &ListLexBotsOutput{} 7541 out.Result = output 7542 7543 var buff [1024]byte 7544 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7545 7546 body := io.TeeReader(response.Body, ringBuffer) 7547 7548 decoder := json.NewDecoder(body) 7549 decoder.UseNumber() 7550 var shape interface{} 7551 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7552 var snapshot bytes.Buffer 7553 io.Copy(&snapshot, ringBuffer) 7554 err = &smithy.DeserializationError{ 7555 Err: fmt.Errorf("failed to decode response body, %w", err), 7556 Snapshot: snapshot.Bytes(), 7557 } 7558 return out, metadata, err 7559 } 7560 7561 err = awsRestjson1_deserializeOpDocumentListLexBotsOutput(&output, shape) 7562 if err != nil { 7563 var snapshot bytes.Buffer 7564 io.Copy(&snapshot, ringBuffer) 7565 return out, metadata, &smithy.DeserializationError{ 7566 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7567 Snapshot: snapshot.Bytes(), 7568 } 7569 } 7570 7571 return out, metadata, err 7572} 7573 7574func awsRestjson1_deserializeOpErrorListLexBots(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7575 var errorBuffer bytes.Buffer 7576 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7577 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7578 } 7579 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7580 7581 errorCode := "UnknownError" 7582 errorMessage := errorCode 7583 7584 code := response.Header.Get("X-Amzn-ErrorType") 7585 if len(code) != 0 { 7586 errorCode = restjson.SanitizeErrorCode(code) 7587 } 7588 7589 var buff [1024]byte 7590 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7591 7592 body := io.TeeReader(errorBody, ringBuffer) 7593 decoder := json.NewDecoder(body) 7594 decoder.UseNumber() 7595 code, message, err := restjson.GetErrorInfo(decoder) 7596 if err != nil { 7597 var snapshot bytes.Buffer 7598 io.Copy(&snapshot, ringBuffer) 7599 err = &smithy.DeserializationError{ 7600 Err: fmt.Errorf("failed to decode response body, %w", err), 7601 Snapshot: snapshot.Bytes(), 7602 } 7603 return err 7604 } 7605 7606 errorBody.Seek(0, io.SeekStart) 7607 if len(code) != 0 { 7608 errorCode = restjson.SanitizeErrorCode(code) 7609 } 7610 if len(message) != 0 { 7611 errorMessage = message 7612 } 7613 7614 switch { 7615 case strings.EqualFold("InternalServiceException", errorCode): 7616 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 7617 7618 case strings.EqualFold("InvalidParameterException", errorCode): 7619 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7620 7621 case strings.EqualFold("InvalidRequestException", errorCode): 7622 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 7623 7624 case strings.EqualFold("ResourceNotFoundException", errorCode): 7625 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7626 7627 case strings.EqualFold("ThrottlingException", errorCode): 7628 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7629 7630 default: 7631 genericError := &smithy.GenericAPIError{ 7632 Code: errorCode, 7633 Message: errorMessage, 7634 } 7635 return genericError 7636 7637 } 7638} 7639 7640func awsRestjson1_deserializeOpDocumentListLexBotsOutput(v **ListLexBotsOutput, value interface{}) error { 7641 if v == nil { 7642 return fmt.Errorf("unexpected nil of type %T", v) 7643 } 7644 if value == nil { 7645 return nil 7646 } 7647 7648 shape, ok := value.(map[string]interface{}) 7649 if !ok { 7650 return fmt.Errorf("unexpected JSON type %v", value) 7651 } 7652 7653 var sv *ListLexBotsOutput 7654 if *v == nil { 7655 sv = &ListLexBotsOutput{} 7656 } else { 7657 sv = *v 7658 } 7659 7660 for key, value := range shape { 7661 switch key { 7662 case "LexBots": 7663 if err := awsRestjson1_deserializeDocumentLexBotsList(&sv.LexBots, value); err != nil { 7664 return err 7665 } 7666 7667 case "NextToken": 7668 if value != nil { 7669 jtv, ok := value.(string) 7670 if !ok { 7671 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7672 } 7673 sv.NextToken = ptr.String(jtv) 7674 } 7675 7676 default: 7677 _, _ = key, value 7678 7679 } 7680 } 7681 *v = sv 7682 return nil 7683} 7684 7685type awsRestjson1_deserializeOpListPhoneNumbers struct { 7686} 7687 7688func (*awsRestjson1_deserializeOpListPhoneNumbers) ID() string { 7689 return "OperationDeserializer" 7690} 7691 7692func (m *awsRestjson1_deserializeOpListPhoneNumbers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7693 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7694) { 7695 out, metadata, err = next.HandleDeserialize(ctx, in) 7696 if err != nil { 7697 return out, metadata, err 7698 } 7699 7700 response, ok := out.RawResponse.(*smithyhttp.Response) 7701 if !ok { 7702 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7703 } 7704 7705 if response.StatusCode < 200 || response.StatusCode >= 300 { 7706 return out, metadata, awsRestjson1_deserializeOpErrorListPhoneNumbers(response, &metadata) 7707 } 7708 output := &ListPhoneNumbersOutput{} 7709 out.Result = output 7710 7711 var buff [1024]byte 7712 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7713 7714 body := io.TeeReader(response.Body, ringBuffer) 7715 7716 decoder := json.NewDecoder(body) 7717 decoder.UseNumber() 7718 var shape interface{} 7719 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7720 var snapshot bytes.Buffer 7721 io.Copy(&snapshot, ringBuffer) 7722 err = &smithy.DeserializationError{ 7723 Err: fmt.Errorf("failed to decode response body, %w", err), 7724 Snapshot: snapshot.Bytes(), 7725 } 7726 return out, metadata, err 7727 } 7728 7729 err = awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(&output, shape) 7730 if err != nil { 7731 var snapshot bytes.Buffer 7732 io.Copy(&snapshot, ringBuffer) 7733 return out, metadata, &smithy.DeserializationError{ 7734 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7735 Snapshot: snapshot.Bytes(), 7736 } 7737 } 7738 7739 return out, metadata, err 7740} 7741 7742func awsRestjson1_deserializeOpErrorListPhoneNumbers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7743 var errorBuffer bytes.Buffer 7744 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7745 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7746 } 7747 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7748 7749 errorCode := "UnknownError" 7750 errorMessage := errorCode 7751 7752 code := response.Header.Get("X-Amzn-ErrorType") 7753 if len(code) != 0 { 7754 errorCode = restjson.SanitizeErrorCode(code) 7755 } 7756 7757 var buff [1024]byte 7758 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7759 7760 body := io.TeeReader(errorBody, ringBuffer) 7761 decoder := json.NewDecoder(body) 7762 decoder.UseNumber() 7763 code, message, err := restjson.GetErrorInfo(decoder) 7764 if err != nil { 7765 var snapshot bytes.Buffer 7766 io.Copy(&snapshot, ringBuffer) 7767 err = &smithy.DeserializationError{ 7768 Err: fmt.Errorf("failed to decode response body, %w", err), 7769 Snapshot: snapshot.Bytes(), 7770 } 7771 return err 7772 } 7773 7774 errorBody.Seek(0, io.SeekStart) 7775 if len(code) != 0 { 7776 errorCode = restjson.SanitizeErrorCode(code) 7777 } 7778 if len(message) != 0 { 7779 errorMessage = message 7780 } 7781 7782 switch { 7783 case strings.EqualFold("InternalServiceException", errorCode): 7784 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 7785 7786 case strings.EqualFold("InvalidParameterException", errorCode): 7787 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7788 7789 case strings.EqualFold("InvalidRequestException", errorCode): 7790 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 7791 7792 case strings.EqualFold("ResourceNotFoundException", errorCode): 7793 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7794 7795 case strings.EqualFold("ThrottlingException", errorCode): 7796 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7797 7798 default: 7799 genericError := &smithy.GenericAPIError{ 7800 Code: errorCode, 7801 Message: errorMessage, 7802 } 7803 return genericError 7804 7805 } 7806} 7807 7808func awsRestjson1_deserializeOpDocumentListPhoneNumbersOutput(v **ListPhoneNumbersOutput, value interface{}) error { 7809 if v == nil { 7810 return fmt.Errorf("unexpected nil of type %T", v) 7811 } 7812 if value == nil { 7813 return nil 7814 } 7815 7816 shape, ok := value.(map[string]interface{}) 7817 if !ok { 7818 return fmt.Errorf("unexpected JSON type %v", value) 7819 } 7820 7821 var sv *ListPhoneNumbersOutput 7822 if *v == nil { 7823 sv = &ListPhoneNumbersOutput{} 7824 } else { 7825 sv = *v 7826 } 7827 7828 for key, value := range shape { 7829 switch key { 7830 case "NextToken": 7831 if value != nil { 7832 jtv, ok := value.(string) 7833 if !ok { 7834 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7835 } 7836 sv.NextToken = ptr.String(jtv) 7837 } 7838 7839 case "PhoneNumberSummaryList": 7840 if err := awsRestjson1_deserializeDocumentPhoneNumberSummaryList(&sv.PhoneNumberSummaryList, value); err != nil { 7841 return err 7842 } 7843 7844 default: 7845 _, _ = key, value 7846 7847 } 7848 } 7849 *v = sv 7850 return nil 7851} 7852 7853type awsRestjson1_deserializeOpListPrompts struct { 7854} 7855 7856func (*awsRestjson1_deserializeOpListPrompts) ID() string { 7857 return "OperationDeserializer" 7858} 7859 7860func (m *awsRestjson1_deserializeOpListPrompts) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7861 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7862) { 7863 out, metadata, err = next.HandleDeserialize(ctx, in) 7864 if err != nil { 7865 return out, metadata, err 7866 } 7867 7868 response, ok := out.RawResponse.(*smithyhttp.Response) 7869 if !ok { 7870 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7871 } 7872 7873 if response.StatusCode < 200 || response.StatusCode >= 300 { 7874 return out, metadata, awsRestjson1_deserializeOpErrorListPrompts(response, &metadata) 7875 } 7876 output := &ListPromptsOutput{} 7877 out.Result = output 7878 7879 var buff [1024]byte 7880 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7881 7882 body := io.TeeReader(response.Body, ringBuffer) 7883 7884 decoder := json.NewDecoder(body) 7885 decoder.UseNumber() 7886 var shape interface{} 7887 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7888 var snapshot bytes.Buffer 7889 io.Copy(&snapshot, ringBuffer) 7890 err = &smithy.DeserializationError{ 7891 Err: fmt.Errorf("failed to decode response body, %w", err), 7892 Snapshot: snapshot.Bytes(), 7893 } 7894 return out, metadata, err 7895 } 7896 7897 err = awsRestjson1_deserializeOpDocumentListPromptsOutput(&output, shape) 7898 if err != nil { 7899 var snapshot bytes.Buffer 7900 io.Copy(&snapshot, ringBuffer) 7901 return out, metadata, &smithy.DeserializationError{ 7902 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7903 Snapshot: snapshot.Bytes(), 7904 } 7905 } 7906 7907 return out, metadata, err 7908} 7909 7910func awsRestjson1_deserializeOpErrorListPrompts(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7911 var errorBuffer bytes.Buffer 7912 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7913 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7914 } 7915 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7916 7917 errorCode := "UnknownError" 7918 errorMessage := errorCode 7919 7920 code := response.Header.Get("X-Amzn-ErrorType") 7921 if len(code) != 0 { 7922 errorCode = restjson.SanitizeErrorCode(code) 7923 } 7924 7925 var buff [1024]byte 7926 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7927 7928 body := io.TeeReader(errorBody, ringBuffer) 7929 decoder := json.NewDecoder(body) 7930 decoder.UseNumber() 7931 code, message, err := restjson.GetErrorInfo(decoder) 7932 if err != nil { 7933 var snapshot bytes.Buffer 7934 io.Copy(&snapshot, ringBuffer) 7935 err = &smithy.DeserializationError{ 7936 Err: fmt.Errorf("failed to decode response body, %w", err), 7937 Snapshot: snapshot.Bytes(), 7938 } 7939 return err 7940 } 7941 7942 errorBody.Seek(0, io.SeekStart) 7943 if len(code) != 0 { 7944 errorCode = restjson.SanitizeErrorCode(code) 7945 } 7946 if len(message) != 0 { 7947 errorMessage = message 7948 } 7949 7950 switch { 7951 case strings.EqualFold("InternalServiceException", errorCode): 7952 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 7953 7954 case strings.EqualFold("InvalidParameterException", errorCode): 7955 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 7956 7957 case strings.EqualFold("InvalidRequestException", errorCode): 7958 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 7959 7960 case strings.EqualFold("ResourceNotFoundException", errorCode): 7961 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 7962 7963 case strings.EqualFold("ThrottlingException", errorCode): 7964 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7965 7966 default: 7967 genericError := &smithy.GenericAPIError{ 7968 Code: errorCode, 7969 Message: errorMessage, 7970 } 7971 return genericError 7972 7973 } 7974} 7975 7976func awsRestjson1_deserializeOpDocumentListPromptsOutput(v **ListPromptsOutput, value interface{}) error { 7977 if v == nil { 7978 return fmt.Errorf("unexpected nil of type %T", v) 7979 } 7980 if value == nil { 7981 return nil 7982 } 7983 7984 shape, ok := value.(map[string]interface{}) 7985 if !ok { 7986 return fmt.Errorf("unexpected JSON type %v", value) 7987 } 7988 7989 var sv *ListPromptsOutput 7990 if *v == nil { 7991 sv = &ListPromptsOutput{} 7992 } else { 7993 sv = *v 7994 } 7995 7996 for key, value := range shape { 7997 switch key { 7998 case "NextToken": 7999 if value != nil { 8000 jtv, ok := value.(string) 8001 if !ok { 8002 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8003 } 8004 sv.NextToken = ptr.String(jtv) 8005 } 8006 8007 case "PromptSummaryList": 8008 if err := awsRestjson1_deserializeDocumentPromptSummaryList(&sv.PromptSummaryList, value); err != nil { 8009 return err 8010 } 8011 8012 default: 8013 _, _ = key, value 8014 8015 } 8016 } 8017 *v = sv 8018 return nil 8019} 8020 8021type awsRestjson1_deserializeOpListQueueQuickConnects struct { 8022} 8023 8024func (*awsRestjson1_deserializeOpListQueueQuickConnects) ID() string { 8025 return "OperationDeserializer" 8026} 8027 8028func (m *awsRestjson1_deserializeOpListQueueQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8029 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8030) { 8031 out, metadata, err = next.HandleDeserialize(ctx, in) 8032 if err != nil { 8033 return out, metadata, err 8034 } 8035 8036 response, ok := out.RawResponse.(*smithyhttp.Response) 8037 if !ok { 8038 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8039 } 8040 8041 if response.StatusCode < 200 || response.StatusCode >= 300 { 8042 return out, metadata, awsRestjson1_deserializeOpErrorListQueueQuickConnects(response, &metadata) 8043 } 8044 output := &ListQueueQuickConnectsOutput{} 8045 out.Result = output 8046 8047 var buff [1024]byte 8048 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8049 8050 body := io.TeeReader(response.Body, ringBuffer) 8051 8052 decoder := json.NewDecoder(body) 8053 decoder.UseNumber() 8054 var shape interface{} 8055 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8056 var snapshot bytes.Buffer 8057 io.Copy(&snapshot, ringBuffer) 8058 err = &smithy.DeserializationError{ 8059 Err: fmt.Errorf("failed to decode response body, %w", err), 8060 Snapshot: snapshot.Bytes(), 8061 } 8062 return out, metadata, err 8063 } 8064 8065 err = awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(&output, shape) 8066 if err != nil { 8067 var snapshot bytes.Buffer 8068 io.Copy(&snapshot, ringBuffer) 8069 return out, metadata, &smithy.DeserializationError{ 8070 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8071 Snapshot: snapshot.Bytes(), 8072 } 8073 } 8074 8075 return out, metadata, err 8076} 8077 8078func awsRestjson1_deserializeOpErrorListQueueQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8079 var errorBuffer bytes.Buffer 8080 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8081 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8082 } 8083 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8084 8085 errorCode := "UnknownError" 8086 errorMessage := errorCode 8087 8088 code := response.Header.Get("X-Amzn-ErrorType") 8089 if len(code) != 0 { 8090 errorCode = restjson.SanitizeErrorCode(code) 8091 } 8092 8093 var buff [1024]byte 8094 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8095 8096 body := io.TeeReader(errorBody, ringBuffer) 8097 decoder := json.NewDecoder(body) 8098 decoder.UseNumber() 8099 code, message, err := restjson.GetErrorInfo(decoder) 8100 if err != nil { 8101 var snapshot bytes.Buffer 8102 io.Copy(&snapshot, ringBuffer) 8103 err = &smithy.DeserializationError{ 8104 Err: fmt.Errorf("failed to decode response body, %w", err), 8105 Snapshot: snapshot.Bytes(), 8106 } 8107 return err 8108 } 8109 8110 errorBody.Seek(0, io.SeekStart) 8111 if len(code) != 0 { 8112 errorCode = restjson.SanitizeErrorCode(code) 8113 } 8114 if len(message) != 0 { 8115 errorMessage = message 8116 } 8117 8118 switch { 8119 case strings.EqualFold("InternalServiceException", errorCode): 8120 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 8121 8122 case strings.EqualFold("InvalidParameterException", errorCode): 8123 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8124 8125 case strings.EqualFold("InvalidRequestException", errorCode): 8126 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 8127 8128 case strings.EqualFold("ResourceNotFoundException", errorCode): 8129 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8130 8131 case strings.EqualFold("ThrottlingException", errorCode): 8132 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8133 8134 default: 8135 genericError := &smithy.GenericAPIError{ 8136 Code: errorCode, 8137 Message: errorMessage, 8138 } 8139 return genericError 8140 8141 } 8142} 8143 8144func awsRestjson1_deserializeOpDocumentListQueueQuickConnectsOutput(v **ListQueueQuickConnectsOutput, value interface{}) error { 8145 if v == nil { 8146 return fmt.Errorf("unexpected nil of type %T", v) 8147 } 8148 if value == nil { 8149 return nil 8150 } 8151 8152 shape, ok := value.(map[string]interface{}) 8153 if !ok { 8154 return fmt.Errorf("unexpected JSON type %v", value) 8155 } 8156 8157 var sv *ListQueueQuickConnectsOutput 8158 if *v == nil { 8159 sv = &ListQueueQuickConnectsOutput{} 8160 } else { 8161 sv = *v 8162 } 8163 8164 for key, value := range shape { 8165 switch key { 8166 case "NextToken": 8167 if value != nil { 8168 jtv, ok := value.(string) 8169 if !ok { 8170 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8171 } 8172 sv.NextToken = ptr.String(jtv) 8173 } 8174 8175 case "QuickConnectSummaryList": 8176 if err := awsRestjson1_deserializeDocumentQuickConnectSummaryList(&sv.QuickConnectSummaryList, value); err != nil { 8177 return err 8178 } 8179 8180 default: 8181 _, _ = key, value 8182 8183 } 8184 } 8185 *v = sv 8186 return nil 8187} 8188 8189type awsRestjson1_deserializeOpListQueues struct { 8190} 8191 8192func (*awsRestjson1_deserializeOpListQueues) ID() string { 8193 return "OperationDeserializer" 8194} 8195 8196func (m *awsRestjson1_deserializeOpListQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8197 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8198) { 8199 out, metadata, err = next.HandleDeserialize(ctx, in) 8200 if err != nil { 8201 return out, metadata, err 8202 } 8203 8204 response, ok := out.RawResponse.(*smithyhttp.Response) 8205 if !ok { 8206 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8207 } 8208 8209 if response.StatusCode < 200 || response.StatusCode >= 300 { 8210 return out, metadata, awsRestjson1_deserializeOpErrorListQueues(response, &metadata) 8211 } 8212 output := &ListQueuesOutput{} 8213 out.Result = output 8214 8215 var buff [1024]byte 8216 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8217 8218 body := io.TeeReader(response.Body, ringBuffer) 8219 8220 decoder := json.NewDecoder(body) 8221 decoder.UseNumber() 8222 var shape interface{} 8223 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8224 var snapshot bytes.Buffer 8225 io.Copy(&snapshot, ringBuffer) 8226 err = &smithy.DeserializationError{ 8227 Err: fmt.Errorf("failed to decode response body, %w", err), 8228 Snapshot: snapshot.Bytes(), 8229 } 8230 return out, metadata, err 8231 } 8232 8233 err = awsRestjson1_deserializeOpDocumentListQueuesOutput(&output, shape) 8234 if err != nil { 8235 var snapshot bytes.Buffer 8236 io.Copy(&snapshot, ringBuffer) 8237 return out, metadata, &smithy.DeserializationError{ 8238 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8239 Snapshot: snapshot.Bytes(), 8240 } 8241 } 8242 8243 return out, metadata, err 8244} 8245 8246func awsRestjson1_deserializeOpErrorListQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8247 var errorBuffer bytes.Buffer 8248 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8249 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8250 } 8251 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8252 8253 errorCode := "UnknownError" 8254 errorMessage := errorCode 8255 8256 code := response.Header.Get("X-Amzn-ErrorType") 8257 if len(code) != 0 { 8258 errorCode = restjson.SanitizeErrorCode(code) 8259 } 8260 8261 var buff [1024]byte 8262 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8263 8264 body := io.TeeReader(errorBody, ringBuffer) 8265 decoder := json.NewDecoder(body) 8266 decoder.UseNumber() 8267 code, message, err := restjson.GetErrorInfo(decoder) 8268 if err != nil { 8269 var snapshot bytes.Buffer 8270 io.Copy(&snapshot, ringBuffer) 8271 err = &smithy.DeserializationError{ 8272 Err: fmt.Errorf("failed to decode response body, %w", err), 8273 Snapshot: snapshot.Bytes(), 8274 } 8275 return err 8276 } 8277 8278 errorBody.Seek(0, io.SeekStart) 8279 if len(code) != 0 { 8280 errorCode = restjson.SanitizeErrorCode(code) 8281 } 8282 if len(message) != 0 { 8283 errorMessage = message 8284 } 8285 8286 switch { 8287 case strings.EqualFold("InternalServiceException", errorCode): 8288 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 8289 8290 case strings.EqualFold("InvalidParameterException", errorCode): 8291 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8292 8293 case strings.EqualFold("InvalidRequestException", errorCode): 8294 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 8295 8296 case strings.EqualFold("ResourceNotFoundException", errorCode): 8297 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8298 8299 case strings.EqualFold("ThrottlingException", errorCode): 8300 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8301 8302 default: 8303 genericError := &smithy.GenericAPIError{ 8304 Code: errorCode, 8305 Message: errorMessage, 8306 } 8307 return genericError 8308 8309 } 8310} 8311 8312func awsRestjson1_deserializeOpDocumentListQueuesOutput(v **ListQueuesOutput, value interface{}) error { 8313 if v == nil { 8314 return fmt.Errorf("unexpected nil of type %T", v) 8315 } 8316 if value == nil { 8317 return nil 8318 } 8319 8320 shape, ok := value.(map[string]interface{}) 8321 if !ok { 8322 return fmt.Errorf("unexpected JSON type %v", value) 8323 } 8324 8325 var sv *ListQueuesOutput 8326 if *v == nil { 8327 sv = &ListQueuesOutput{} 8328 } else { 8329 sv = *v 8330 } 8331 8332 for key, value := range shape { 8333 switch key { 8334 case "NextToken": 8335 if value != nil { 8336 jtv, ok := value.(string) 8337 if !ok { 8338 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8339 } 8340 sv.NextToken = ptr.String(jtv) 8341 } 8342 8343 case "QueueSummaryList": 8344 if err := awsRestjson1_deserializeDocumentQueueSummaryList(&sv.QueueSummaryList, value); err != nil { 8345 return err 8346 } 8347 8348 default: 8349 _, _ = key, value 8350 8351 } 8352 } 8353 *v = sv 8354 return nil 8355} 8356 8357type awsRestjson1_deserializeOpListQuickConnects struct { 8358} 8359 8360func (*awsRestjson1_deserializeOpListQuickConnects) ID() string { 8361 return "OperationDeserializer" 8362} 8363 8364func (m *awsRestjson1_deserializeOpListQuickConnects) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8365 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8366) { 8367 out, metadata, err = next.HandleDeserialize(ctx, in) 8368 if err != nil { 8369 return out, metadata, err 8370 } 8371 8372 response, ok := out.RawResponse.(*smithyhttp.Response) 8373 if !ok { 8374 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8375 } 8376 8377 if response.StatusCode < 200 || response.StatusCode >= 300 { 8378 return out, metadata, awsRestjson1_deserializeOpErrorListQuickConnects(response, &metadata) 8379 } 8380 output := &ListQuickConnectsOutput{} 8381 out.Result = output 8382 8383 var buff [1024]byte 8384 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8385 8386 body := io.TeeReader(response.Body, ringBuffer) 8387 8388 decoder := json.NewDecoder(body) 8389 decoder.UseNumber() 8390 var shape interface{} 8391 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8392 var snapshot bytes.Buffer 8393 io.Copy(&snapshot, ringBuffer) 8394 err = &smithy.DeserializationError{ 8395 Err: fmt.Errorf("failed to decode response body, %w", err), 8396 Snapshot: snapshot.Bytes(), 8397 } 8398 return out, metadata, err 8399 } 8400 8401 err = awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(&output, shape) 8402 if err != nil { 8403 var snapshot bytes.Buffer 8404 io.Copy(&snapshot, ringBuffer) 8405 return out, metadata, &smithy.DeserializationError{ 8406 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8407 Snapshot: snapshot.Bytes(), 8408 } 8409 } 8410 8411 return out, metadata, err 8412} 8413 8414func awsRestjson1_deserializeOpErrorListQuickConnects(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8415 var errorBuffer bytes.Buffer 8416 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8417 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8418 } 8419 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8420 8421 errorCode := "UnknownError" 8422 errorMessage := errorCode 8423 8424 code := response.Header.Get("X-Amzn-ErrorType") 8425 if len(code) != 0 { 8426 errorCode = restjson.SanitizeErrorCode(code) 8427 } 8428 8429 var buff [1024]byte 8430 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8431 8432 body := io.TeeReader(errorBody, ringBuffer) 8433 decoder := json.NewDecoder(body) 8434 decoder.UseNumber() 8435 code, message, err := restjson.GetErrorInfo(decoder) 8436 if err != nil { 8437 var snapshot bytes.Buffer 8438 io.Copy(&snapshot, ringBuffer) 8439 err = &smithy.DeserializationError{ 8440 Err: fmt.Errorf("failed to decode response body, %w", err), 8441 Snapshot: snapshot.Bytes(), 8442 } 8443 return err 8444 } 8445 8446 errorBody.Seek(0, io.SeekStart) 8447 if len(code) != 0 { 8448 errorCode = restjson.SanitizeErrorCode(code) 8449 } 8450 if len(message) != 0 { 8451 errorMessage = message 8452 } 8453 8454 switch { 8455 case strings.EqualFold("InternalServiceException", errorCode): 8456 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 8457 8458 case strings.EqualFold("InvalidParameterException", errorCode): 8459 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8460 8461 case strings.EqualFold("InvalidRequestException", errorCode): 8462 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 8463 8464 case strings.EqualFold("ResourceNotFoundException", errorCode): 8465 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8466 8467 case strings.EqualFold("ThrottlingException", errorCode): 8468 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8469 8470 default: 8471 genericError := &smithy.GenericAPIError{ 8472 Code: errorCode, 8473 Message: errorMessage, 8474 } 8475 return genericError 8476 8477 } 8478} 8479 8480func awsRestjson1_deserializeOpDocumentListQuickConnectsOutput(v **ListQuickConnectsOutput, value interface{}) error { 8481 if v == nil { 8482 return fmt.Errorf("unexpected nil of type %T", v) 8483 } 8484 if value == nil { 8485 return nil 8486 } 8487 8488 shape, ok := value.(map[string]interface{}) 8489 if !ok { 8490 return fmt.Errorf("unexpected JSON type %v", value) 8491 } 8492 8493 var sv *ListQuickConnectsOutput 8494 if *v == nil { 8495 sv = &ListQuickConnectsOutput{} 8496 } else { 8497 sv = *v 8498 } 8499 8500 for key, value := range shape { 8501 switch key { 8502 case "NextToken": 8503 if value != nil { 8504 jtv, ok := value.(string) 8505 if !ok { 8506 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8507 } 8508 sv.NextToken = ptr.String(jtv) 8509 } 8510 8511 case "QuickConnectSummaryList": 8512 if err := awsRestjson1_deserializeDocumentQuickConnectSummaryList(&sv.QuickConnectSummaryList, value); err != nil { 8513 return err 8514 } 8515 8516 default: 8517 _, _ = key, value 8518 8519 } 8520 } 8521 *v = sv 8522 return nil 8523} 8524 8525type awsRestjson1_deserializeOpListRoutingProfileQueues struct { 8526} 8527 8528func (*awsRestjson1_deserializeOpListRoutingProfileQueues) ID() string { 8529 return "OperationDeserializer" 8530} 8531 8532func (m *awsRestjson1_deserializeOpListRoutingProfileQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8533 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8534) { 8535 out, metadata, err = next.HandleDeserialize(ctx, in) 8536 if err != nil { 8537 return out, metadata, err 8538 } 8539 8540 response, ok := out.RawResponse.(*smithyhttp.Response) 8541 if !ok { 8542 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8543 } 8544 8545 if response.StatusCode < 200 || response.StatusCode >= 300 { 8546 return out, metadata, awsRestjson1_deserializeOpErrorListRoutingProfileQueues(response, &metadata) 8547 } 8548 output := &ListRoutingProfileQueuesOutput{} 8549 out.Result = output 8550 8551 var buff [1024]byte 8552 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8553 8554 body := io.TeeReader(response.Body, ringBuffer) 8555 8556 decoder := json.NewDecoder(body) 8557 decoder.UseNumber() 8558 var shape interface{} 8559 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8560 var snapshot bytes.Buffer 8561 io.Copy(&snapshot, ringBuffer) 8562 err = &smithy.DeserializationError{ 8563 Err: fmt.Errorf("failed to decode response body, %w", err), 8564 Snapshot: snapshot.Bytes(), 8565 } 8566 return out, metadata, err 8567 } 8568 8569 err = awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(&output, shape) 8570 if err != nil { 8571 var snapshot bytes.Buffer 8572 io.Copy(&snapshot, ringBuffer) 8573 return out, metadata, &smithy.DeserializationError{ 8574 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8575 Snapshot: snapshot.Bytes(), 8576 } 8577 } 8578 8579 return out, metadata, err 8580} 8581 8582func awsRestjson1_deserializeOpErrorListRoutingProfileQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8583 var errorBuffer bytes.Buffer 8584 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8585 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8586 } 8587 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8588 8589 errorCode := "UnknownError" 8590 errorMessage := errorCode 8591 8592 code := response.Header.Get("X-Amzn-ErrorType") 8593 if len(code) != 0 { 8594 errorCode = restjson.SanitizeErrorCode(code) 8595 } 8596 8597 var buff [1024]byte 8598 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8599 8600 body := io.TeeReader(errorBody, ringBuffer) 8601 decoder := json.NewDecoder(body) 8602 decoder.UseNumber() 8603 code, message, err := restjson.GetErrorInfo(decoder) 8604 if err != nil { 8605 var snapshot bytes.Buffer 8606 io.Copy(&snapshot, ringBuffer) 8607 err = &smithy.DeserializationError{ 8608 Err: fmt.Errorf("failed to decode response body, %w", err), 8609 Snapshot: snapshot.Bytes(), 8610 } 8611 return err 8612 } 8613 8614 errorBody.Seek(0, io.SeekStart) 8615 if len(code) != 0 { 8616 errorCode = restjson.SanitizeErrorCode(code) 8617 } 8618 if len(message) != 0 { 8619 errorMessage = message 8620 } 8621 8622 switch { 8623 case strings.EqualFold("InternalServiceException", errorCode): 8624 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 8625 8626 case strings.EqualFold("InvalidParameterException", errorCode): 8627 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8628 8629 case strings.EqualFold("InvalidRequestException", errorCode): 8630 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 8631 8632 case strings.EqualFold("ResourceNotFoundException", errorCode): 8633 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8634 8635 case strings.EqualFold("ThrottlingException", errorCode): 8636 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8637 8638 default: 8639 genericError := &smithy.GenericAPIError{ 8640 Code: errorCode, 8641 Message: errorMessage, 8642 } 8643 return genericError 8644 8645 } 8646} 8647 8648func awsRestjson1_deserializeOpDocumentListRoutingProfileQueuesOutput(v **ListRoutingProfileQueuesOutput, value interface{}) error { 8649 if v == nil { 8650 return fmt.Errorf("unexpected nil of type %T", v) 8651 } 8652 if value == nil { 8653 return nil 8654 } 8655 8656 shape, ok := value.(map[string]interface{}) 8657 if !ok { 8658 return fmt.Errorf("unexpected JSON type %v", value) 8659 } 8660 8661 var sv *ListRoutingProfileQueuesOutput 8662 if *v == nil { 8663 sv = &ListRoutingProfileQueuesOutput{} 8664 } else { 8665 sv = *v 8666 } 8667 8668 for key, value := range shape { 8669 switch key { 8670 case "NextToken": 8671 if value != nil { 8672 jtv, ok := value.(string) 8673 if !ok { 8674 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8675 } 8676 sv.NextToken = ptr.String(jtv) 8677 } 8678 8679 case "RoutingProfileQueueConfigSummaryList": 8680 if err := awsRestjson1_deserializeDocumentRoutingProfileQueueConfigSummaryList(&sv.RoutingProfileQueueConfigSummaryList, value); err != nil { 8681 return err 8682 } 8683 8684 default: 8685 _, _ = key, value 8686 8687 } 8688 } 8689 *v = sv 8690 return nil 8691} 8692 8693type awsRestjson1_deserializeOpListRoutingProfiles struct { 8694} 8695 8696func (*awsRestjson1_deserializeOpListRoutingProfiles) ID() string { 8697 return "OperationDeserializer" 8698} 8699 8700func (m *awsRestjson1_deserializeOpListRoutingProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8701 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8702) { 8703 out, metadata, err = next.HandleDeserialize(ctx, in) 8704 if err != nil { 8705 return out, metadata, err 8706 } 8707 8708 response, ok := out.RawResponse.(*smithyhttp.Response) 8709 if !ok { 8710 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8711 } 8712 8713 if response.StatusCode < 200 || response.StatusCode >= 300 { 8714 return out, metadata, awsRestjson1_deserializeOpErrorListRoutingProfiles(response, &metadata) 8715 } 8716 output := &ListRoutingProfilesOutput{} 8717 out.Result = output 8718 8719 var buff [1024]byte 8720 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8721 8722 body := io.TeeReader(response.Body, ringBuffer) 8723 8724 decoder := json.NewDecoder(body) 8725 decoder.UseNumber() 8726 var shape interface{} 8727 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8728 var snapshot bytes.Buffer 8729 io.Copy(&snapshot, ringBuffer) 8730 err = &smithy.DeserializationError{ 8731 Err: fmt.Errorf("failed to decode response body, %w", err), 8732 Snapshot: snapshot.Bytes(), 8733 } 8734 return out, metadata, err 8735 } 8736 8737 err = awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(&output, shape) 8738 if err != nil { 8739 var snapshot bytes.Buffer 8740 io.Copy(&snapshot, ringBuffer) 8741 return out, metadata, &smithy.DeserializationError{ 8742 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8743 Snapshot: snapshot.Bytes(), 8744 } 8745 } 8746 8747 return out, metadata, err 8748} 8749 8750func awsRestjson1_deserializeOpErrorListRoutingProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8751 var errorBuffer bytes.Buffer 8752 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8753 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8754 } 8755 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8756 8757 errorCode := "UnknownError" 8758 errorMessage := errorCode 8759 8760 code := response.Header.Get("X-Amzn-ErrorType") 8761 if len(code) != 0 { 8762 errorCode = restjson.SanitizeErrorCode(code) 8763 } 8764 8765 var buff [1024]byte 8766 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8767 8768 body := io.TeeReader(errorBody, ringBuffer) 8769 decoder := json.NewDecoder(body) 8770 decoder.UseNumber() 8771 code, message, err := restjson.GetErrorInfo(decoder) 8772 if err != nil { 8773 var snapshot bytes.Buffer 8774 io.Copy(&snapshot, ringBuffer) 8775 err = &smithy.DeserializationError{ 8776 Err: fmt.Errorf("failed to decode response body, %w", err), 8777 Snapshot: snapshot.Bytes(), 8778 } 8779 return err 8780 } 8781 8782 errorBody.Seek(0, io.SeekStart) 8783 if len(code) != 0 { 8784 errorCode = restjson.SanitizeErrorCode(code) 8785 } 8786 if len(message) != 0 { 8787 errorMessage = message 8788 } 8789 8790 switch { 8791 case strings.EqualFold("InternalServiceException", errorCode): 8792 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 8793 8794 case strings.EqualFold("InvalidParameterException", errorCode): 8795 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8796 8797 case strings.EqualFold("InvalidRequestException", errorCode): 8798 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 8799 8800 case strings.EqualFold("ResourceNotFoundException", errorCode): 8801 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8802 8803 case strings.EqualFold("ThrottlingException", errorCode): 8804 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8805 8806 default: 8807 genericError := &smithy.GenericAPIError{ 8808 Code: errorCode, 8809 Message: errorMessage, 8810 } 8811 return genericError 8812 8813 } 8814} 8815 8816func awsRestjson1_deserializeOpDocumentListRoutingProfilesOutput(v **ListRoutingProfilesOutput, value interface{}) error { 8817 if v == nil { 8818 return fmt.Errorf("unexpected nil of type %T", v) 8819 } 8820 if value == nil { 8821 return nil 8822 } 8823 8824 shape, ok := value.(map[string]interface{}) 8825 if !ok { 8826 return fmt.Errorf("unexpected JSON type %v", value) 8827 } 8828 8829 var sv *ListRoutingProfilesOutput 8830 if *v == nil { 8831 sv = &ListRoutingProfilesOutput{} 8832 } else { 8833 sv = *v 8834 } 8835 8836 for key, value := range shape { 8837 switch key { 8838 case "NextToken": 8839 if value != nil { 8840 jtv, ok := value.(string) 8841 if !ok { 8842 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8843 } 8844 sv.NextToken = ptr.String(jtv) 8845 } 8846 8847 case "RoutingProfileSummaryList": 8848 if err := awsRestjson1_deserializeDocumentRoutingProfileSummaryList(&sv.RoutingProfileSummaryList, value); err != nil { 8849 return err 8850 } 8851 8852 default: 8853 _, _ = key, value 8854 8855 } 8856 } 8857 *v = sv 8858 return nil 8859} 8860 8861type awsRestjson1_deserializeOpListSecurityKeys struct { 8862} 8863 8864func (*awsRestjson1_deserializeOpListSecurityKeys) ID() string { 8865 return "OperationDeserializer" 8866} 8867 8868func (m *awsRestjson1_deserializeOpListSecurityKeys) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8869 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8870) { 8871 out, metadata, err = next.HandleDeserialize(ctx, in) 8872 if err != nil { 8873 return out, metadata, err 8874 } 8875 8876 response, ok := out.RawResponse.(*smithyhttp.Response) 8877 if !ok { 8878 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8879 } 8880 8881 if response.StatusCode < 200 || response.StatusCode >= 300 { 8882 return out, metadata, awsRestjson1_deserializeOpErrorListSecurityKeys(response, &metadata) 8883 } 8884 output := &ListSecurityKeysOutput{} 8885 out.Result = output 8886 8887 var buff [1024]byte 8888 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8889 8890 body := io.TeeReader(response.Body, ringBuffer) 8891 8892 decoder := json.NewDecoder(body) 8893 decoder.UseNumber() 8894 var shape interface{} 8895 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8896 var snapshot bytes.Buffer 8897 io.Copy(&snapshot, ringBuffer) 8898 err = &smithy.DeserializationError{ 8899 Err: fmt.Errorf("failed to decode response body, %w", err), 8900 Snapshot: snapshot.Bytes(), 8901 } 8902 return out, metadata, err 8903 } 8904 8905 err = awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(&output, shape) 8906 if err != nil { 8907 var snapshot bytes.Buffer 8908 io.Copy(&snapshot, ringBuffer) 8909 return out, metadata, &smithy.DeserializationError{ 8910 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8911 Snapshot: snapshot.Bytes(), 8912 } 8913 } 8914 8915 return out, metadata, err 8916} 8917 8918func awsRestjson1_deserializeOpErrorListSecurityKeys(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8919 var errorBuffer bytes.Buffer 8920 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8921 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8922 } 8923 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8924 8925 errorCode := "UnknownError" 8926 errorMessage := errorCode 8927 8928 code := response.Header.Get("X-Amzn-ErrorType") 8929 if len(code) != 0 { 8930 errorCode = restjson.SanitizeErrorCode(code) 8931 } 8932 8933 var buff [1024]byte 8934 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8935 8936 body := io.TeeReader(errorBody, ringBuffer) 8937 decoder := json.NewDecoder(body) 8938 decoder.UseNumber() 8939 code, message, err := restjson.GetErrorInfo(decoder) 8940 if err != nil { 8941 var snapshot bytes.Buffer 8942 io.Copy(&snapshot, ringBuffer) 8943 err = &smithy.DeserializationError{ 8944 Err: fmt.Errorf("failed to decode response body, %w", err), 8945 Snapshot: snapshot.Bytes(), 8946 } 8947 return err 8948 } 8949 8950 errorBody.Seek(0, io.SeekStart) 8951 if len(code) != 0 { 8952 errorCode = restjson.SanitizeErrorCode(code) 8953 } 8954 if len(message) != 0 { 8955 errorMessage = message 8956 } 8957 8958 switch { 8959 case strings.EqualFold("InternalServiceException", errorCode): 8960 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 8961 8962 case strings.EqualFold("InvalidParameterException", errorCode): 8963 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 8964 8965 case strings.EqualFold("InvalidRequestException", errorCode): 8966 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 8967 8968 case strings.EqualFold("ResourceNotFoundException", errorCode): 8969 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 8970 8971 case strings.EqualFold("ThrottlingException", errorCode): 8972 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8973 8974 default: 8975 genericError := &smithy.GenericAPIError{ 8976 Code: errorCode, 8977 Message: errorMessage, 8978 } 8979 return genericError 8980 8981 } 8982} 8983 8984func awsRestjson1_deserializeOpDocumentListSecurityKeysOutput(v **ListSecurityKeysOutput, value interface{}) error { 8985 if v == nil { 8986 return fmt.Errorf("unexpected nil of type %T", v) 8987 } 8988 if value == nil { 8989 return nil 8990 } 8991 8992 shape, ok := value.(map[string]interface{}) 8993 if !ok { 8994 return fmt.Errorf("unexpected JSON type %v", value) 8995 } 8996 8997 var sv *ListSecurityKeysOutput 8998 if *v == nil { 8999 sv = &ListSecurityKeysOutput{} 9000 } else { 9001 sv = *v 9002 } 9003 9004 for key, value := range shape { 9005 switch key { 9006 case "NextToken": 9007 if value != nil { 9008 jtv, ok := value.(string) 9009 if !ok { 9010 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 9011 } 9012 sv.NextToken = ptr.String(jtv) 9013 } 9014 9015 case "SecurityKeys": 9016 if err := awsRestjson1_deserializeDocumentSecurityKeysList(&sv.SecurityKeys, value); err != nil { 9017 return err 9018 } 9019 9020 default: 9021 _, _ = key, value 9022 9023 } 9024 } 9025 *v = sv 9026 return nil 9027} 9028 9029type awsRestjson1_deserializeOpListSecurityProfiles struct { 9030} 9031 9032func (*awsRestjson1_deserializeOpListSecurityProfiles) ID() string { 9033 return "OperationDeserializer" 9034} 9035 9036func (m *awsRestjson1_deserializeOpListSecurityProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9037 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9038) { 9039 out, metadata, err = next.HandleDeserialize(ctx, in) 9040 if err != nil { 9041 return out, metadata, err 9042 } 9043 9044 response, ok := out.RawResponse.(*smithyhttp.Response) 9045 if !ok { 9046 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9047 } 9048 9049 if response.StatusCode < 200 || response.StatusCode >= 300 { 9050 return out, metadata, awsRestjson1_deserializeOpErrorListSecurityProfiles(response, &metadata) 9051 } 9052 output := &ListSecurityProfilesOutput{} 9053 out.Result = output 9054 9055 var buff [1024]byte 9056 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9057 9058 body := io.TeeReader(response.Body, ringBuffer) 9059 9060 decoder := json.NewDecoder(body) 9061 decoder.UseNumber() 9062 var shape interface{} 9063 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9064 var snapshot bytes.Buffer 9065 io.Copy(&snapshot, ringBuffer) 9066 err = &smithy.DeserializationError{ 9067 Err: fmt.Errorf("failed to decode response body, %w", err), 9068 Snapshot: snapshot.Bytes(), 9069 } 9070 return out, metadata, err 9071 } 9072 9073 err = awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(&output, shape) 9074 if err != nil { 9075 var snapshot bytes.Buffer 9076 io.Copy(&snapshot, ringBuffer) 9077 return out, metadata, &smithy.DeserializationError{ 9078 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9079 Snapshot: snapshot.Bytes(), 9080 } 9081 } 9082 9083 return out, metadata, err 9084} 9085 9086func awsRestjson1_deserializeOpErrorListSecurityProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9087 var errorBuffer bytes.Buffer 9088 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9089 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9090 } 9091 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9092 9093 errorCode := "UnknownError" 9094 errorMessage := errorCode 9095 9096 code := response.Header.Get("X-Amzn-ErrorType") 9097 if len(code) != 0 { 9098 errorCode = restjson.SanitizeErrorCode(code) 9099 } 9100 9101 var buff [1024]byte 9102 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9103 9104 body := io.TeeReader(errorBody, ringBuffer) 9105 decoder := json.NewDecoder(body) 9106 decoder.UseNumber() 9107 code, message, err := restjson.GetErrorInfo(decoder) 9108 if err != nil { 9109 var snapshot bytes.Buffer 9110 io.Copy(&snapshot, ringBuffer) 9111 err = &smithy.DeserializationError{ 9112 Err: fmt.Errorf("failed to decode response body, %w", err), 9113 Snapshot: snapshot.Bytes(), 9114 } 9115 return err 9116 } 9117 9118 errorBody.Seek(0, io.SeekStart) 9119 if len(code) != 0 { 9120 errorCode = restjson.SanitizeErrorCode(code) 9121 } 9122 if len(message) != 0 { 9123 errorMessage = message 9124 } 9125 9126 switch { 9127 case strings.EqualFold("InternalServiceException", errorCode): 9128 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 9129 9130 case strings.EqualFold("InvalidParameterException", errorCode): 9131 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9132 9133 case strings.EqualFold("InvalidRequestException", errorCode): 9134 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 9135 9136 case strings.EqualFold("ResourceNotFoundException", errorCode): 9137 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9138 9139 case strings.EqualFold("ThrottlingException", errorCode): 9140 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9141 9142 default: 9143 genericError := &smithy.GenericAPIError{ 9144 Code: errorCode, 9145 Message: errorMessage, 9146 } 9147 return genericError 9148 9149 } 9150} 9151 9152func awsRestjson1_deserializeOpDocumentListSecurityProfilesOutput(v **ListSecurityProfilesOutput, value interface{}) error { 9153 if v == nil { 9154 return fmt.Errorf("unexpected nil of type %T", v) 9155 } 9156 if value == nil { 9157 return nil 9158 } 9159 9160 shape, ok := value.(map[string]interface{}) 9161 if !ok { 9162 return fmt.Errorf("unexpected JSON type %v", value) 9163 } 9164 9165 var sv *ListSecurityProfilesOutput 9166 if *v == nil { 9167 sv = &ListSecurityProfilesOutput{} 9168 } else { 9169 sv = *v 9170 } 9171 9172 for key, value := range shape { 9173 switch key { 9174 case "NextToken": 9175 if value != nil { 9176 jtv, ok := value.(string) 9177 if !ok { 9178 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 9179 } 9180 sv.NextToken = ptr.String(jtv) 9181 } 9182 9183 case "SecurityProfileSummaryList": 9184 if err := awsRestjson1_deserializeDocumentSecurityProfileSummaryList(&sv.SecurityProfileSummaryList, value); err != nil { 9185 return err 9186 } 9187 9188 default: 9189 _, _ = key, value 9190 9191 } 9192 } 9193 *v = sv 9194 return nil 9195} 9196 9197type awsRestjson1_deserializeOpListTagsForResource struct { 9198} 9199 9200func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 9201 return "OperationDeserializer" 9202} 9203 9204func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9205 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9206) { 9207 out, metadata, err = next.HandleDeserialize(ctx, in) 9208 if err != nil { 9209 return out, metadata, err 9210 } 9211 9212 response, ok := out.RawResponse.(*smithyhttp.Response) 9213 if !ok { 9214 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9215 } 9216 9217 if response.StatusCode < 200 || response.StatusCode >= 300 { 9218 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 9219 } 9220 output := &ListTagsForResourceOutput{} 9221 out.Result = output 9222 9223 var buff [1024]byte 9224 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9225 9226 body := io.TeeReader(response.Body, ringBuffer) 9227 9228 decoder := json.NewDecoder(body) 9229 decoder.UseNumber() 9230 var shape interface{} 9231 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9232 var snapshot bytes.Buffer 9233 io.Copy(&snapshot, ringBuffer) 9234 err = &smithy.DeserializationError{ 9235 Err: fmt.Errorf("failed to decode response body, %w", err), 9236 Snapshot: snapshot.Bytes(), 9237 } 9238 return out, metadata, err 9239 } 9240 9241 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 9242 if err != nil { 9243 var snapshot bytes.Buffer 9244 io.Copy(&snapshot, ringBuffer) 9245 return out, metadata, &smithy.DeserializationError{ 9246 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9247 Snapshot: snapshot.Bytes(), 9248 } 9249 } 9250 9251 return out, metadata, err 9252} 9253 9254func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9255 var errorBuffer bytes.Buffer 9256 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9257 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9258 } 9259 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9260 9261 errorCode := "UnknownError" 9262 errorMessage := errorCode 9263 9264 code := response.Header.Get("X-Amzn-ErrorType") 9265 if len(code) != 0 { 9266 errorCode = restjson.SanitizeErrorCode(code) 9267 } 9268 9269 var buff [1024]byte 9270 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9271 9272 body := io.TeeReader(errorBody, ringBuffer) 9273 decoder := json.NewDecoder(body) 9274 decoder.UseNumber() 9275 code, message, err := restjson.GetErrorInfo(decoder) 9276 if err != nil { 9277 var snapshot bytes.Buffer 9278 io.Copy(&snapshot, ringBuffer) 9279 err = &smithy.DeserializationError{ 9280 Err: fmt.Errorf("failed to decode response body, %w", err), 9281 Snapshot: snapshot.Bytes(), 9282 } 9283 return err 9284 } 9285 9286 errorBody.Seek(0, io.SeekStart) 9287 if len(code) != 0 { 9288 errorCode = restjson.SanitizeErrorCode(code) 9289 } 9290 if len(message) != 0 { 9291 errorMessage = message 9292 } 9293 9294 switch { 9295 case strings.EqualFold("InternalServiceException", errorCode): 9296 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 9297 9298 case strings.EqualFold("InvalidParameterException", errorCode): 9299 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9300 9301 case strings.EqualFold("InvalidRequestException", errorCode): 9302 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 9303 9304 case strings.EqualFold("ResourceNotFoundException", errorCode): 9305 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9306 9307 case strings.EqualFold("ThrottlingException", errorCode): 9308 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9309 9310 default: 9311 genericError := &smithy.GenericAPIError{ 9312 Code: errorCode, 9313 Message: errorMessage, 9314 } 9315 return genericError 9316 9317 } 9318} 9319 9320func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 9321 if v == nil { 9322 return fmt.Errorf("unexpected nil of type %T", v) 9323 } 9324 if value == nil { 9325 return nil 9326 } 9327 9328 shape, ok := value.(map[string]interface{}) 9329 if !ok { 9330 return fmt.Errorf("unexpected JSON type %v", value) 9331 } 9332 9333 var sv *ListTagsForResourceOutput 9334 if *v == nil { 9335 sv = &ListTagsForResourceOutput{} 9336 } else { 9337 sv = *v 9338 } 9339 9340 for key, value := range shape { 9341 switch key { 9342 case "tags": 9343 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 9344 return err 9345 } 9346 9347 default: 9348 _, _ = key, value 9349 9350 } 9351 } 9352 *v = sv 9353 return nil 9354} 9355 9356type awsRestjson1_deserializeOpListUseCases struct { 9357} 9358 9359func (*awsRestjson1_deserializeOpListUseCases) ID() string { 9360 return "OperationDeserializer" 9361} 9362 9363func (m *awsRestjson1_deserializeOpListUseCases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9364 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9365) { 9366 out, metadata, err = next.HandleDeserialize(ctx, in) 9367 if err != nil { 9368 return out, metadata, err 9369 } 9370 9371 response, ok := out.RawResponse.(*smithyhttp.Response) 9372 if !ok { 9373 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9374 } 9375 9376 if response.StatusCode < 200 || response.StatusCode >= 300 { 9377 return out, metadata, awsRestjson1_deserializeOpErrorListUseCases(response, &metadata) 9378 } 9379 output := &ListUseCasesOutput{} 9380 out.Result = output 9381 9382 var buff [1024]byte 9383 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9384 9385 body := io.TeeReader(response.Body, ringBuffer) 9386 9387 decoder := json.NewDecoder(body) 9388 decoder.UseNumber() 9389 var shape interface{} 9390 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9391 var snapshot bytes.Buffer 9392 io.Copy(&snapshot, ringBuffer) 9393 err = &smithy.DeserializationError{ 9394 Err: fmt.Errorf("failed to decode response body, %w", err), 9395 Snapshot: snapshot.Bytes(), 9396 } 9397 return out, metadata, err 9398 } 9399 9400 err = awsRestjson1_deserializeOpDocumentListUseCasesOutput(&output, shape) 9401 if err != nil { 9402 var snapshot bytes.Buffer 9403 io.Copy(&snapshot, ringBuffer) 9404 return out, metadata, &smithy.DeserializationError{ 9405 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9406 Snapshot: snapshot.Bytes(), 9407 } 9408 } 9409 9410 return out, metadata, err 9411} 9412 9413func awsRestjson1_deserializeOpErrorListUseCases(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9414 var errorBuffer bytes.Buffer 9415 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9416 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9417 } 9418 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9419 9420 errorCode := "UnknownError" 9421 errorMessage := errorCode 9422 9423 code := response.Header.Get("X-Amzn-ErrorType") 9424 if len(code) != 0 { 9425 errorCode = restjson.SanitizeErrorCode(code) 9426 } 9427 9428 var buff [1024]byte 9429 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9430 9431 body := io.TeeReader(errorBody, ringBuffer) 9432 decoder := json.NewDecoder(body) 9433 decoder.UseNumber() 9434 code, message, err := restjson.GetErrorInfo(decoder) 9435 if err != nil { 9436 var snapshot bytes.Buffer 9437 io.Copy(&snapshot, ringBuffer) 9438 err = &smithy.DeserializationError{ 9439 Err: fmt.Errorf("failed to decode response body, %w", err), 9440 Snapshot: snapshot.Bytes(), 9441 } 9442 return err 9443 } 9444 9445 errorBody.Seek(0, io.SeekStart) 9446 if len(code) != 0 { 9447 errorCode = restjson.SanitizeErrorCode(code) 9448 } 9449 if len(message) != 0 { 9450 errorMessage = message 9451 } 9452 9453 switch { 9454 case strings.EqualFold("InternalServiceException", errorCode): 9455 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 9456 9457 case strings.EqualFold("InvalidRequestException", errorCode): 9458 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 9459 9460 case strings.EqualFold("ResourceNotFoundException", errorCode): 9461 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9462 9463 case strings.EqualFold("ThrottlingException", errorCode): 9464 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9465 9466 default: 9467 genericError := &smithy.GenericAPIError{ 9468 Code: errorCode, 9469 Message: errorMessage, 9470 } 9471 return genericError 9472 9473 } 9474} 9475 9476func awsRestjson1_deserializeOpDocumentListUseCasesOutput(v **ListUseCasesOutput, value interface{}) error { 9477 if v == nil { 9478 return fmt.Errorf("unexpected nil of type %T", v) 9479 } 9480 if value == nil { 9481 return nil 9482 } 9483 9484 shape, ok := value.(map[string]interface{}) 9485 if !ok { 9486 return fmt.Errorf("unexpected JSON type %v", value) 9487 } 9488 9489 var sv *ListUseCasesOutput 9490 if *v == nil { 9491 sv = &ListUseCasesOutput{} 9492 } else { 9493 sv = *v 9494 } 9495 9496 for key, value := range shape { 9497 switch key { 9498 case "NextToken": 9499 if value != nil { 9500 jtv, ok := value.(string) 9501 if !ok { 9502 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 9503 } 9504 sv.NextToken = ptr.String(jtv) 9505 } 9506 9507 case "UseCaseSummaryList": 9508 if err := awsRestjson1_deserializeDocumentUseCaseSummaryList(&sv.UseCaseSummaryList, value); err != nil { 9509 return err 9510 } 9511 9512 default: 9513 _, _ = key, value 9514 9515 } 9516 } 9517 *v = sv 9518 return nil 9519} 9520 9521type awsRestjson1_deserializeOpListUserHierarchyGroups struct { 9522} 9523 9524func (*awsRestjson1_deserializeOpListUserHierarchyGroups) ID() string { 9525 return "OperationDeserializer" 9526} 9527 9528func (m *awsRestjson1_deserializeOpListUserHierarchyGroups) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9529 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9530) { 9531 out, metadata, err = next.HandleDeserialize(ctx, in) 9532 if err != nil { 9533 return out, metadata, err 9534 } 9535 9536 response, ok := out.RawResponse.(*smithyhttp.Response) 9537 if !ok { 9538 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9539 } 9540 9541 if response.StatusCode < 200 || response.StatusCode >= 300 { 9542 return out, metadata, awsRestjson1_deserializeOpErrorListUserHierarchyGroups(response, &metadata) 9543 } 9544 output := &ListUserHierarchyGroupsOutput{} 9545 out.Result = output 9546 9547 var buff [1024]byte 9548 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9549 9550 body := io.TeeReader(response.Body, ringBuffer) 9551 9552 decoder := json.NewDecoder(body) 9553 decoder.UseNumber() 9554 var shape interface{} 9555 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9556 var snapshot bytes.Buffer 9557 io.Copy(&snapshot, ringBuffer) 9558 err = &smithy.DeserializationError{ 9559 Err: fmt.Errorf("failed to decode response body, %w", err), 9560 Snapshot: snapshot.Bytes(), 9561 } 9562 return out, metadata, err 9563 } 9564 9565 err = awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(&output, shape) 9566 if err != nil { 9567 var snapshot bytes.Buffer 9568 io.Copy(&snapshot, ringBuffer) 9569 return out, metadata, &smithy.DeserializationError{ 9570 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9571 Snapshot: snapshot.Bytes(), 9572 } 9573 } 9574 9575 return out, metadata, err 9576} 9577 9578func awsRestjson1_deserializeOpErrorListUserHierarchyGroups(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9579 var errorBuffer bytes.Buffer 9580 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9581 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9582 } 9583 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9584 9585 errorCode := "UnknownError" 9586 errorMessage := errorCode 9587 9588 code := response.Header.Get("X-Amzn-ErrorType") 9589 if len(code) != 0 { 9590 errorCode = restjson.SanitizeErrorCode(code) 9591 } 9592 9593 var buff [1024]byte 9594 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9595 9596 body := io.TeeReader(errorBody, ringBuffer) 9597 decoder := json.NewDecoder(body) 9598 decoder.UseNumber() 9599 code, message, err := restjson.GetErrorInfo(decoder) 9600 if err != nil { 9601 var snapshot bytes.Buffer 9602 io.Copy(&snapshot, ringBuffer) 9603 err = &smithy.DeserializationError{ 9604 Err: fmt.Errorf("failed to decode response body, %w", err), 9605 Snapshot: snapshot.Bytes(), 9606 } 9607 return err 9608 } 9609 9610 errorBody.Seek(0, io.SeekStart) 9611 if len(code) != 0 { 9612 errorCode = restjson.SanitizeErrorCode(code) 9613 } 9614 if len(message) != 0 { 9615 errorMessage = message 9616 } 9617 9618 switch { 9619 case strings.EqualFold("InternalServiceException", errorCode): 9620 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 9621 9622 case strings.EqualFold("InvalidParameterException", errorCode): 9623 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9624 9625 case strings.EqualFold("InvalidRequestException", errorCode): 9626 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 9627 9628 case strings.EqualFold("ResourceNotFoundException", errorCode): 9629 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9630 9631 case strings.EqualFold("ThrottlingException", errorCode): 9632 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9633 9634 default: 9635 genericError := &smithy.GenericAPIError{ 9636 Code: errorCode, 9637 Message: errorMessage, 9638 } 9639 return genericError 9640 9641 } 9642} 9643 9644func awsRestjson1_deserializeOpDocumentListUserHierarchyGroupsOutput(v **ListUserHierarchyGroupsOutput, value interface{}) error { 9645 if v == nil { 9646 return fmt.Errorf("unexpected nil of type %T", v) 9647 } 9648 if value == nil { 9649 return nil 9650 } 9651 9652 shape, ok := value.(map[string]interface{}) 9653 if !ok { 9654 return fmt.Errorf("unexpected JSON type %v", value) 9655 } 9656 9657 var sv *ListUserHierarchyGroupsOutput 9658 if *v == nil { 9659 sv = &ListUserHierarchyGroupsOutput{} 9660 } else { 9661 sv = *v 9662 } 9663 9664 for key, value := range shape { 9665 switch key { 9666 case "NextToken": 9667 if value != nil { 9668 jtv, ok := value.(string) 9669 if !ok { 9670 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 9671 } 9672 sv.NextToken = ptr.String(jtv) 9673 } 9674 9675 case "UserHierarchyGroupSummaryList": 9676 if err := awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(&sv.UserHierarchyGroupSummaryList, value); err != nil { 9677 return err 9678 } 9679 9680 default: 9681 _, _ = key, value 9682 9683 } 9684 } 9685 *v = sv 9686 return nil 9687} 9688 9689type awsRestjson1_deserializeOpListUsers struct { 9690} 9691 9692func (*awsRestjson1_deserializeOpListUsers) ID() string { 9693 return "OperationDeserializer" 9694} 9695 9696func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9697 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9698) { 9699 out, metadata, err = next.HandleDeserialize(ctx, in) 9700 if err != nil { 9701 return out, metadata, err 9702 } 9703 9704 response, ok := out.RawResponse.(*smithyhttp.Response) 9705 if !ok { 9706 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9707 } 9708 9709 if response.StatusCode < 200 || response.StatusCode >= 300 { 9710 return out, metadata, awsRestjson1_deserializeOpErrorListUsers(response, &metadata) 9711 } 9712 output := &ListUsersOutput{} 9713 out.Result = output 9714 9715 var buff [1024]byte 9716 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9717 9718 body := io.TeeReader(response.Body, ringBuffer) 9719 9720 decoder := json.NewDecoder(body) 9721 decoder.UseNumber() 9722 var shape interface{} 9723 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9724 var snapshot bytes.Buffer 9725 io.Copy(&snapshot, ringBuffer) 9726 err = &smithy.DeserializationError{ 9727 Err: fmt.Errorf("failed to decode response body, %w", err), 9728 Snapshot: snapshot.Bytes(), 9729 } 9730 return out, metadata, err 9731 } 9732 9733 err = awsRestjson1_deserializeOpDocumentListUsersOutput(&output, shape) 9734 if err != nil { 9735 var snapshot bytes.Buffer 9736 io.Copy(&snapshot, ringBuffer) 9737 return out, metadata, &smithy.DeserializationError{ 9738 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9739 Snapshot: snapshot.Bytes(), 9740 } 9741 } 9742 9743 return out, metadata, err 9744} 9745 9746func awsRestjson1_deserializeOpErrorListUsers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9747 var errorBuffer bytes.Buffer 9748 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9749 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9750 } 9751 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9752 9753 errorCode := "UnknownError" 9754 errorMessage := errorCode 9755 9756 code := response.Header.Get("X-Amzn-ErrorType") 9757 if len(code) != 0 { 9758 errorCode = restjson.SanitizeErrorCode(code) 9759 } 9760 9761 var buff [1024]byte 9762 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9763 9764 body := io.TeeReader(errorBody, ringBuffer) 9765 decoder := json.NewDecoder(body) 9766 decoder.UseNumber() 9767 code, message, err := restjson.GetErrorInfo(decoder) 9768 if err != nil { 9769 var snapshot bytes.Buffer 9770 io.Copy(&snapshot, ringBuffer) 9771 err = &smithy.DeserializationError{ 9772 Err: fmt.Errorf("failed to decode response body, %w", err), 9773 Snapshot: snapshot.Bytes(), 9774 } 9775 return err 9776 } 9777 9778 errorBody.Seek(0, io.SeekStart) 9779 if len(code) != 0 { 9780 errorCode = restjson.SanitizeErrorCode(code) 9781 } 9782 if len(message) != 0 { 9783 errorMessage = message 9784 } 9785 9786 switch { 9787 case strings.EqualFold("InternalServiceException", errorCode): 9788 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 9789 9790 case strings.EqualFold("InvalidParameterException", errorCode): 9791 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 9792 9793 case strings.EqualFold("InvalidRequestException", errorCode): 9794 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 9795 9796 case strings.EqualFold("ResourceNotFoundException", errorCode): 9797 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9798 9799 case strings.EqualFold("ThrottlingException", errorCode): 9800 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9801 9802 default: 9803 genericError := &smithy.GenericAPIError{ 9804 Code: errorCode, 9805 Message: errorMessage, 9806 } 9807 return genericError 9808 9809 } 9810} 9811 9812func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, value interface{}) error { 9813 if v == nil { 9814 return fmt.Errorf("unexpected nil of type %T", v) 9815 } 9816 if value == nil { 9817 return nil 9818 } 9819 9820 shape, ok := value.(map[string]interface{}) 9821 if !ok { 9822 return fmt.Errorf("unexpected JSON type %v", value) 9823 } 9824 9825 var sv *ListUsersOutput 9826 if *v == nil { 9827 sv = &ListUsersOutput{} 9828 } else { 9829 sv = *v 9830 } 9831 9832 for key, value := range shape { 9833 switch key { 9834 case "NextToken": 9835 if value != nil { 9836 jtv, ok := value.(string) 9837 if !ok { 9838 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 9839 } 9840 sv.NextToken = ptr.String(jtv) 9841 } 9842 9843 case "UserSummaryList": 9844 if err := awsRestjson1_deserializeDocumentUserSummaryList(&sv.UserSummaryList, value); err != nil { 9845 return err 9846 } 9847 9848 default: 9849 _, _ = key, value 9850 9851 } 9852 } 9853 *v = sv 9854 return nil 9855} 9856 9857type awsRestjson1_deserializeOpResumeContactRecording struct { 9858} 9859 9860func (*awsRestjson1_deserializeOpResumeContactRecording) ID() string { 9861 return "OperationDeserializer" 9862} 9863 9864func (m *awsRestjson1_deserializeOpResumeContactRecording) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9865 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9866) { 9867 out, metadata, err = next.HandleDeserialize(ctx, in) 9868 if err != nil { 9869 return out, metadata, err 9870 } 9871 9872 response, ok := out.RawResponse.(*smithyhttp.Response) 9873 if !ok { 9874 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9875 } 9876 9877 if response.StatusCode < 200 || response.StatusCode >= 300 { 9878 return out, metadata, awsRestjson1_deserializeOpErrorResumeContactRecording(response, &metadata) 9879 } 9880 output := &ResumeContactRecordingOutput{} 9881 out.Result = output 9882 9883 return out, metadata, err 9884} 9885 9886func awsRestjson1_deserializeOpErrorResumeContactRecording(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9887 var errorBuffer bytes.Buffer 9888 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9889 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9890 } 9891 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9892 9893 errorCode := "UnknownError" 9894 errorMessage := errorCode 9895 9896 code := response.Header.Get("X-Amzn-ErrorType") 9897 if len(code) != 0 { 9898 errorCode = restjson.SanitizeErrorCode(code) 9899 } 9900 9901 var buff [1024]byte 9902 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9903 9904 body := io.TeeReader(errorBody, ringBuffer) 9905 decoder := json.NewDecoder(body) 9906 decoder.UseNumber() 9907 code, message, err := restjson.GetErrorInfo(decoder) 9908 if err != nil { 9909 var snapshot bytes.Buffer 9910 io.Copy(&snapshot, ringBuffer) 9911 err = &smithy.DeserializationError{ 9912 Err: fmt.Errorf("failed to decode response body, %w", err), 9913 Snapshot: snapshot.Bytes(), 9914 } 9915 return err 9916 } 9917 9918 errorBody.Seek(0, io.SeekStart) 9919 if len(code) != 0 { 9920 errorCode = restjson.SanitizeErrorCode(code) 9921 } 9922 if len(message) != 0 { 9923 errorMessage = message 9924 } 9925 9926 switch { 9927 case strings.EqualFold("InternalServiceException", errorCode): 9928 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 9929 9930 case strings.EqualFold("InvalidRequestException", errorCode): 9931 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 9932 9933 case strings.EqualFold("ResourceNotFoundException", errorCode): 9934 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9935 9936 default: 9937 genericError := &smithy.GenericAPIError{ 9938 Code: errorCode, 9939 Message: errorMessage, 9940 } 9941 return genericError 9942 9943 } 9944} 9945 9946type awsRestjson1_deserializeOpStartChatContact struct { 9947} 9948 9949func (*awsRestjson1_deserializeOpStartChatContact) ID() string { 9950 return "OperationDeserializer" 9951} 9952 9953func (m *awsRestjson1_deserializeOpStartChatContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9954 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9955) { 9956 out, metadata, err = next.HandleDeserialize(ctx, in) 9957 if err != nil { 9958 return out, metadata, err 9959 } 9960 9961 response, ok := out.RawResponse.(*smithyhttp.Response) 9962 if !ok { 9963 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9964 } 9965 9966 if response.StatusCode < 200 || response.StatusCode >= 300 { 9967 return out, metadata, awsRestjson1_deserializeOpErrorStartChatContact(response, &metadata) 9968 } 9969 output := &StartChatContactOutput{} 9970 out.Result = output 9971 9972 var buff [1024]byte 9973 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9974 9975 body := io.TeeReader(response.Body, ringBuffer) 9976 9977 decoder := json.NewDecoder(body) 9978 decoder.UseNumber() 9979 var shape interface{} 9980 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9981 var snapshot bytes.Buffer 9982 io.Copy(&snapshot, ringBuffer) 9983 err = &smithy.DeserializationError{ 9984 Err: fmt.Errorf("failed to decode response body, %w", err), 9985 Snapshot: snapshot.Bytes(), 9986 } 9987 return out, metadata, err 9988 } 9989 9990 err = awsRestjson1_deserializeOpDocumentStartChatContactOutput(&output, shape) 9991 if err != nil { 9992 var snapshot bytes.Buffer 9993 io.Copy(&snapshot, ringBuffer) 9994 return out, metadata, &smithy.DeserializationError{ 9995 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9996 Snapshot: snapshot.Bytes(), 9997 } 9998 } 9999 10000 return out, metadata, err 10001} 10002 10003func awsRestjson1_deserializeOpErrorStartChatContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10004 var errorBuffer bytes.Buffer 10005 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10006 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10007 } 10008 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10009 10010 errorCode := "UnknownError" 10011 errorMessage := errorCode 10012 10013 code := response.Header.Get("X-Amzn-ErrorType") 10014 if len(code) != 0 { 10015 errorCode = restjson.SanitizeErrorCode(code) 10016 } 10017 10018 var buff [1024]byte 10019 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10020 10021 body := io.TeeReader(errorBody, ringBuffer) 10022 decoder := json.NewDecoder(body) 10023 decoder.UseNumber() 10024 code, message, err := restjson.GetErrorInfo(decoder) 10025 if err != nil { 10026 var snapshot bytes.Buffer 10027 io.Copy(&snapshot, ringBuffer) 10028 err = &smithy.DeserializationError{ 10029 Err: fmt.Errorf("failed to decode response body, %w", err), 10030 Snapshot: snapshot.Bytes(), 10031 } 10032 return err 10033 } 10034 10035 errorBody.Seek(0, io.SeekStart) 10036 if len(code) != 0 { 10037 errorCode = restjson.SanitizeErrorCode(code) 10038 } 10039 if len(message) != 0 { 10040 errorMessage = message 10041 } 10042 10043 switch { 10044 case strings.EqualFold("InternalServiceException", errorCode): 10045 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10046 10047 case strings.EqualFold("InvalidParameterException", errorCode): 10048 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 10049 10050 case strings.EqualFold("InvalidRequestException", errorCode): 10051 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10052 10053 case strings.EqualFold("LimitExceededException", errorCode): 10054 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 10055 10056 case strings.EqualFold("ResourceNotFoundException", errorCode): 10057 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10058 10059 default: 10060 genericError := &smithy.GenericAPIError{ 10061 Code: errorCode, 10062 Message: errorMessage, 10063 } 10064 return genericError 10065 10066 } 10067} 10068 10069func awsRestjson1_deserializeOpDocumentStartChatContactOutput(v **StartChatContactOutput, value interface{}) error { 10070 if v == nil { 10071 return fmt.Errorf("unexpected nil of type %T", v) 10072 } 10073 if value == nil { 10074 return nil 10075 } 10076 10077 shape, ok := value.(map[string]interface{}) 10078 if !ok { 10079 return fmt.Errorf("unexpected JSON type %v", value) 10080 } 10081 10082 var sv *StartChatContactOutput 10083 if *v == nil { 10084 sv = &StartChatContactOutput{} 10085 } else { 10086 sv = *v 10087 } 10088 10089 for key, value := range shape { 10090 switch key { 10091 case "ContactId": 10092 if value != nil { 10093 jtv, ok := value.(string) 10094 if !ok { 10095 return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) 10096 } 10097 sv.ContactId = ptr.String(jtv) 10098 } 10099 10100 case "ParticipantId": 10101 if value != nil { 10102 jtv, ok := value.(string) 10103 if !ok { 10104 return fmt.Errorf("expected ParticipantId to be of type string, got %T instead", value) 10105 } 10106 sv.ParticipantId = ptr.String(jtv) 10107 } 10108 10109 case "ParticipantToken": 10110 if value != nil { 10111 jtv, ok := value.(string) 10112 if !ok { 10113 return fmt.Errorf("expected ParticipantToken to be of type string, got %T instead", value) 10114 } 10115 sv.ParticipantToken = ptr.String(jtv) 10116 } 10117 10118 default: 10119 _, _ = key, value 10120 10121 } 10122 } 10123 *v = sv 10124 return nil 10125} 10126 10127type awsRestjson1_deserializeOpStartContactRecording struct { 10128} 10129 10130func (*awsRestjson1_deserializeOpStartContactRecording) ID() string { 10131 return "OperationDeserializer" 10132} 10133 10134func (m *awsRestjson1_deserializeOpStartContactRecording) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10135 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10136) { 10137 out, metadata, err = next.HandleDeserialize(ctx, in) 10138 if err != nil { 10139 return out, metadata, err 10140 } 10141 10142 response, ok := out.RawResponse.(*smithyhttp.Response) 10143 if !ok { 10144 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10145 } 10146 10147 if response.StatusCode < 200 || response.StatusCode >= 300 { 10148 return out, metadata, awsRestjson1_deserializeOpErrorStartContactRecording(response, &metadata) 10149 } 10150 output := &StartContactRecordingOutput{} 10151 out.Result = output 10152 10153 return out, metadata, err 10154} 10155 10156func awsRestjson1_deserializeOpErrorStartContactRecording(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10157 var errorBuffer bytes.Buffer 10158 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10159 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10160 } 10161 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10162 10163 errorCode := "UnknownError" 10164 errorMessage := errorCode 10165 10166 code := response.Header.Get("X-Amzn-ErrorType") 10167 if len(code) != 0 { 10168 errorCode = restjson.SanitizeErrorCode(code) 10169 } 10170 10171 var buff [1024]byte 10172 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10173 10174 body := io.TeeReader(errorBody, ringBuffer) 10175 decoder := json.NewDecoder(body) 10176 decoder.UseNumber() 10177 code, message, err := restjson.GetErrorInfo(decoder) 10178 if err != nil { 10179 var snapshot bytes.Buffer 10180 io.Copy(&snapshot, ringBuffer) 10181 err = &smithy.DeserializationError{ 10182 Err: fmt.Errorf("failed to decode response body, %w", err), 10183 Snapshot: snapshot.Bytes(), 10184 } 10185 return err 10186 } 10187 10188 errorBody.Seek(0, io.SeekStart) 10189 if len(code) != 0 { 10190 errorCode = restjson.SanitizeErrorCode(code) 10191 } 10192 if len(message) != 0 { 10193 errorMessage = message 10194 } 10195 10196 switch { 10197 case strings.EqualFold("InternalServiceException", errorCode): 10198 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10199 10200 case strings.EqualFold("InvalidParameterException", errorCode): 10201 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 10202 10203 case strings.EqualFold("InvalidRequestException", errorCode): 10204 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10205 10206 case strings.EqualFold("ResourceNotFoundException", errorCode): 10207 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10208 10209 default: 10210 genericError := &smithy.GenericAPIError{ 10211 Code: errorCode, 10212 Message: errorMessage, 10213 } 10214 return genericError 10215 10216 } 10217} 10218 10219type awsRestjson1_deserializeOpStartOutboundVoiceContact struct { 10220} 10221 10222func (*awsRestjson1_deserializeOpStartOutboundVoiceContact) ID() string { 10223 return "OperationDeserializer" 10224} 10225 10226func (m *awsRestjson1_deserializeOpStartOutboundVoiceContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10227 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10228) { 10229 out, metadata, err = next.HandleDeserialize(ctx, in) 10230 if err != nil { 10231 return out, metadata, err 10232 } 10233 10234 response, ok := out.RawResponse.(*smithyhttp.Response) 10235 if !ok { 10236 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10237 } 10238 10239 if response.StatusCode < 200 || response.StatusCode >= 300 { 10240 return out, metadata, awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response, &metadata) 10241 } 10242 output := &StartOutboundVoiceContactOutput{} 10243 out.Result = output 10244 10245 var buff [1024]byte 10246 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10247 10248 body := io.TeeReader(response.Body, ringBuffer) 10249 10250 decoder := json.NewDecoder(body) 10251 decoder.UseNumber() 10252 var shape interface{} 10253 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10254 var snapshot bytes.Buffer 10255 io.Copy(&snapshot, ringBuffer) 10256 err = &smithy.DeserializationError{ 10257 Err: fmt.Errorf("failed to decode response body, %w", err), 10258 Snapshot: snapshot.Bytes(), 10259 } 10260 return out, metadata, err 10261 } 10262 10263 err = awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(&output, shape) 10264 if err != nil { 10265 var snapshot bytes.Buffer 10266 io.Copy(&snapshot, ringBuffer) 10267 return out, metadata, &smithy.DeserializationError{ 10268 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10269 Snapshot: snapshot.Bytes(), 10270 } 10271 } 10272 10273 return out, metadata, err 10274} 10275 10276func awsRestjson1_deserializeOpErrorStartOutboundVoiceContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10277 var errorBuffer bytes.Buffer 10278 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10279 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10280 } 10281 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10282 10283 errorCode := "UnknownError" 10284 errorMessage := errorCode 10285 10286 code := response.Header.Get("X-Amzn-ErrorType") 10287 if len(code) != 0 { 10288 errorCode = restjson.SanitizeErrorCode(code) 10289 } 10290 10291 var buff [1024]byte 10292 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10293 10294 body := io.TeeReader(errorBody, ringBuffer) 10295 decoder := json.NewDecoder(body) 10296 decoder.UseNumber() 10297 code, message, err := restjson.GetErrorInfo(decoder) 10298 if err != nil { 10299 var snapshot bytes.Buffer 10300 io.Copy(&snapshot, ringBuffer) 10301 err = &smithy.DeserializationError{ 10302 Err: fmt.Errorf("failed to decode response body, %w", err), 10303 Snapshot: snapshot.Bytes(), 10304 } 10305 return err 10306 } 10307 10308 errorBody.Seek(0, io.SeekStart) 10309 if len(code) != 0 { 10310 errorCode = restjson.SanitizeErrorCode(code) 10311 } 10312 if len(message) != 0 { 10313 errorMessage = message 10314 } 10315 10316 switch { 10317 case strings.EqualFold("DestinationNotAllowedException", errorCode): 10318 return awsRestjson1_deserializeErrorDestinationNotAllowedException(response, errorBody) 10319 10320 case strings.EqualFold("InternalServiceException", errorCode): 10321 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10322 10323 case strings.EqualFold("InvalidParameterException", errorCode): 10324 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 10325 10326 case strings.EqualFold("InvalidRequestException", errorCode): 10327 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10328 10329 case strings.EqualFold("LimitExceededException", errorCode): 10330 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 10331 10332 case strings.EqualFold("OutboundContactNotPermittedException", errorCode): 10333 return awsRestjson1_deserializeErrorOutboundContactNotPermittedException(response, errorBody) 10334 10335 case strings.EqualFold("ResourceNotFoundException", errorCode): 10336 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10337 10338 default: 10339 genericError := &smithy.GenericAPIError{ 10340 Code: errorCode, 10341 Message: errorMessage, 10342 } 10343 return genericError 10344 10345 } 10346} 10347 10348func awsRestjson1_deserializeOpDocumentStartOutboundVoiceContactOutput(v **StartOutboundVoiceContactOutput, value interface{}) error { 10349 if v == nil { 10350 return fmt.Errorf("unexpected nil of type %T", v) 10351 } 10352 if value == nil { 10353 return nil 10354 } 10355 10356 shape, ok := value.(map[string]interface{}) 10357 if !ok { 10358 return fmt.Errorf("unexpected JSON type %v", value) 10359 } 10360 10361 var sv *StartOutboundVoiceContactOutput 10362 if *v == nil { 10363 sv = &StartOutboundVoiceContactOutput{} 10364 } else { 10365 sv = *v 10366 } 10367 10368 for key, value := range shape { 10369 switch key { 10370 case "ContactId": 10371 if value != nil { 10372 jtv, ok := value.(string) 10373 if !ok { 10374 return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) 10375 } 10376 sv.ContactId = ptr.String(jtv) 10377 } 10378 10379 default: 10380 _, _ = key, value 10381 10382 } 10383 } 10384 *v = sv 10385 return nil 10386} 10387 10388type awsRestjson1_deserializeOpStartTaskContact struct { 10389} 10390 10391func (*awsRestjson1_deserializeOpStartTaskContact) ID() string { 10392 return "OperationDeserializer" 10393} 10394 10395func (m *awsRestjson1_deserializeOpStartTaskContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10396 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10397) { 10398 out, metadata, err = next.HandleDeserialize(ctx, in) 10399 if err != nil { 10400 return out, metadata, err 10401 } 10402 10403 response, ok := out.RawResponse.(*smithyhttp.Response) 10404 if !ok { 10405 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10406 } 10407 10408 if response.StatusCode < 200 || response.StatusCode >= 300 { 10409 return out, metadata, awsRestjson1_deserializeOpErrorStartTaskContact(response, &metadata) 10410 } 10411 output := &StartTaskContactOutput{} 10412 out.Result = output 10413 10414 var buff [1024]byte 10415 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10416 10417 body := io.TeeReader(response.Body, ringBuffer) 10418 10419 decoder := json.NewDecoder(body) 10420 decoder.UseNumber() 10421 var shape interface{} 10422 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10423 var snapshot bytes.Buffer 10424 io.Copy(&snapshot, ringBuffer) 10425 err = &smithy.DeserializationError{ 10426 Err: fmt.Errorf("failed to decode response body, %w", err), 10427 Snapshot: snapshot.Bytes(), 10428 } 10429 return out, metadata, err 10430 } 10431 10432 err = awsRestjson1_deserializeOpDocumentStartTaskContactOutput(&output, shape) 10433 if err != nil { 10434 var snapshot bytes.Buffer 10435 io.Copy(&snapshot, ringBuffer) 10436 return out, metadata, &smithy.DeserializationError{ 10437 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10438 Snapshot: snapshot.Bytes(), 10439 } 10440 } 10441 10442 return out, metadata, err 10443} 10444 10445func awsRestjson1_deserializeOpErrorStartTaskContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10446 var errorBuffer bytes.Buffer 10447 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10448 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10449 } 10450 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10451 10452 errorCode := "UnknownError" 10453 errorMessage := errorCode 10454 10455 code := response.Header.Get("X-Amzn-ErrorType") 10456 if len(code) != 0 { 10457 errorCode = restjson.SanitizeErrorCode(code) 10458 } 10459 10460 var buff [1024]byte 10461 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10462 10463 body := io.TeeReader(errorBody, ringBuffer) 10464 decoder := json.NewDecoder(body) 10465 decoder.UseNumber() 10466 code, message, err := restjson.GetErrorInfo(decoder) 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 if len(code) != 0 { 10479 errorCode = restjson.SanitizeErrorCode(code) 10480 } 10481 if len(message) != 0 { 10482 errorMessage = message 10483 } 10484 10485 switch { 10486 case strings.EqualFold("InternalServiceException", errorCode): 10487 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10488 10489 case strings.EqualFold("InvalidParameterException", errorCode): 10490 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 10491 10492 case strings.EqualFold("InvalidRequestException", errorCode): 10493 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10494 10495 case strings.EqualFold("ResourceNotFoundException", errorCode): 10496 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10497 10498 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 10499 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 10500 10501 case strings.EqualFold("ThrottlingException", errorCode): 10502 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 10503 10504 default: 10505 genericError := &smithy.GenericAPIError{ 10506 Code: errorCode, 10507 Message: errorMessage, 10508 } 10509 return genericError 10510 10511 } 10512} 10513 10514func awsRestjson1_deserializeOpDocumentStartTaskContactOutput(v **StartTaskContactOutput, value interface{}) error { 10515 if v == nil { 10516 return fmt.Errorf("unexpected nil of type %T", v) 10517 } 10518 if value == nil { 10519 return nil 10520 } 10521 10522 shape, ok := value.(map[string]interface{}) 10523 if !ok { 10524 return fmt.Errorf("unexpected JSON type %v", value) 10525 } 10526 10527 var sv *StartTaskContactOutput 10528 if *v == nil { 10529 sv = &StartTaskContactOutput{} 10530 } else { 10531 sv = *v 10532 } 10533 10534 for key, value := range shape { 10535 switch key { 10536 case "ContactId": 10537 if value != nil { 10538 jtv, ok := value.(string) 10539 if !ok { 10540 return fmt.Errorf("expected ContactId to be of type string, got %T instead", value) 10541 } 10542 sv.ContactId = ptr.String(jtv) 10543 } 10544 10545 default: 10546 _, _ = key, value 10547 10548 } 10549 } 10550 *v = sv 10551 return nil 10552} 10553 10554type awsRestjson1_deserializeOpStopContact struct { 10555} 10556 10557func (*awsRestjson1_deserializeOpStopContact) ID() string { 10558 return "OperationDeserializer" 10559} 10560 10561func (m *awsRestjson1_deserializeOpStopContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10562 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10563) { 10564 out, metadata, err = next.HandleDeserialize(ctx, in) 10565 if err != nil { 10566 return out, metadata, err 10567 } 10568 10569 response, ok := out.RawResponse.(*smithyhttp.Response) 10570 if !ok { 10571 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10572 } 10573 10574 if response.StatusCode < 200 || response.StatusCode >= 300 { 10575 return out, metadata, awsRestjson1_deserializeOpErrorStopContact(response, &metadata) 10576 } 10577 output := &StopContactOutput{} 10578 out.Result = output 10579 10580 return out, metadata, err 10581} 10582 10583func awsRestjson1_deserializeOpErrorStopContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10584 var errorBuffer bytes.Buffer 10585 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10586 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10587 } 10588 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10589 10590 errorCode := "UnknownError" 10591 errorMessage := errorCode 10592 10593 code := response.Header.Get("X-Amzn-ErrorType") 10594 if len(code) != 0 { 10595 errorCode = restjson.SanitizeErrorCode(code) 10596 } 10597 10598 var buff [1024]byte 10599 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10600 10601 body := io.TeeReader(errorBody, ringBuffer) 10602 decoder := json.NewDecoder(body) 10603 decoder.UseNumber() 10604 code, message, err := restjson.GetErrorInfo(decoder) 10605 if err != nil { 10606 var snapshot bytes.Buffer 10607 io.Copy(&snapshot, ringBuffer) 10608 err = &smithy.DeserializationError{ 10609 Err: fmt.Errorf("failed to decode response body, %w", err), 10610 Snapshot: snapshot.Bytes(), 10611 } 10612 return err 10613 } 10614 10615 errorBody.Seek(0, io.SeekStart) 10616 if len(code) != 0 { 10617 errorCode = restjson.SanitizeErrorCode(code) 10618 } 10619 if len(message) != 0 { 10620 errorMessage = message 10621 } 10622 10623 switch { 10624 case strings.EqualFold("ContactNotFoundException", errorCode): 10625 return awsRestjson1_deserializeErrorContactNotFoundException(response, errorBody) 10626 10627 case strings.EqualFold("InternalServiceException", errorCode): 10628 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10629 10630 case strings.EqualFold("InvalidParameterException", errorCode): 10631 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 10632 10633 case strings.EqualFold("InvalidRequestException", errorCode): 10634 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10635 10636 case strings.EqualFold("ResourceNotFoundException", errorCode): 10637 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10638 10639 default: 10640 genericError := &smithy.GenericAPIError{ 10641 Code: errorCode, 10642 Message: errorMessage, 10643 } 10644 return genericError 10645 10646 } 10647} 10648 10649type awsRestjson1_deserializeOpStopContactRecording struct { 10650} 10651 10652func (*awsRestjson1_deserializeOpStopContactRecording) ID() string { 10653 return "OperationDeserializer" 10654} 10655 10656func (m *awsRestjson1_deserializeOpStopContactRecording) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10657 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10658) { 10659 out, metadata, err = next.HandleDeserialize(ctx, in) 10660 if err != nil { 10661 return out, metadata, err 10662 } 10663 10664 response, ok := out.RawResponse.(*smithyhttp.Response) 10665 if !ok { 10666 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10667 } 10668 10669 if response.StatusCode < 200 || response.StatusCode >= 300 { 10670 return out, metadata, awsRestjson1_deserializeOpErrorStopContactRecording(response, &metadata) 10671 } 10672 output := &StopContactRecordingOutput{} 10673 out.Result = output 10674 10675 return out, metadata, err 10676} 10677 10678func awsRestjson1_deserializeOpErrorStopContactRecording(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10679 var errorBuffer bytes.Buffer 10680 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10681 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10682 } 10683 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10684 10685 errorCode := "UnknownError" 10686 errorMessage := errorCode 10687 10688 code := response.Header.Get("X-Amzn-ErrorType") 10689 if len(code) != 0 { 10690 errorCode = restjson.SanitizeErrorCode(code) 10691 } 10692 10693 var buff [1024]byte 10694 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10695 10696 body := io.TeeReader(errorBody, ringBuffer) 10697 decoder := json.NewDecoder(body) 10698 decoder.UseNumber() 10699 code, message, err := restjson.GetErrorInfo(decoder) 10700 if err != nil { 10701 var snapshot bytes.Buffer 10702 io.Copy(&snapshot, ringBuffer) 10703 err = &smithy.DeserializationError{ 10704 Err: fmt.Errorf("failed to decode response body, %w", err), 10705 Snapshot: snapshot.Bytes(), 10706 } 10707 return err 10708 } 10709 10710 errorBody.Seek(0, io.SeekStart) 10711 if len(code) != 0 { 10712 errorCode = restjson.SanitizeErrorCode(code) 10713 } 10714 if len(message) != 0 { 10715 errorMessage = message 10716 } 10717 10718 switch { 10719 case strings.EqualFold("InternalServiceException", errorCode): 10720 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10721 10722 case strings.EqualFold("InvalidRequestException", errorCode): 10723 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10724 10725 case strings.EqualFold("ResourceNotFoundException", errorCode): 10726 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10727 10728 default: 10729 genericError := &smithy.GenericAPIError{ 10730 Code: errorCode, 10731 Message: errorMessage, 10732 } 10733 return genericError 10734 10735 } 10736} 10737 10738type awsRestjson1_deserializeOpSuspendContactRecording struct { 10739} 10740 10741func (*awsRestjson1_deserializeOpSuspendContactRecording) ID() string { 10742 return "OperationDeserializer" 10743} 10744 10745func (m *awsRestjson1_deserializeOpSuspendContactRecording) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10746 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10747) { 10748 out, metadata, err = next.HandleDeserialize(ctx, in) 10749 if err != nil { 10750 return out, metadata, err 10751 } 10752 10753 response, ok := out.RawResponse.(*smithyhttp.Response) 10754 if !ok { 10755 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10756 } 10757 10758 if response.StatusCode < 200 || response.StatusCode >= 300 { 10759 return out, metadata, awsRestjson1_deserializeOpErrorSuspendContactRecording(response, &metadata) 10760 } 10761 output := &SuspendContactRecordingOutput{} 10762 out.Result = output 10763 10764 return out, metadata, err 10765} 10766 10767func awsRestjson1_deserializeOpErrorSuspendContactRecording(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10768 var errorBuffer bytes.Buffer 10769 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10770 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10771 } 10772 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10773 10774 errorCode := "UnknownError" 10775 errorMessage := errorCode 10776 10777 code := response.Header.Get("X-Amzn-ErrorType") 10778 if len(code) != 0 { 10779 errorCode = restjson.SanitizeErrorCode(code) 10780 } 10781 10782 var buff [1024]byte 10783 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10784 10785 body := io.TeeReader(errorBody, ringBuffer) 10786 decoder := json.NewDecoder(body) 10787 decoder.UseNumber() 10788 code, message, err := restjson.GetErrorInfo(decoder) 10789 if err != nil { 10790 var snapshot bytes.Buffer 10791 io.Copy(&snapshot, ringBuffer) 10792 err = &smithy.DeserializationError{ 10793 Err: fmt.Errorf("failed to decode response body, %w", err), 10794 Snapshot: snapshot.Bytes(), 10795 } 10796 return err 10797 } 10798 10799 errorBody.Seek(0, io.SeekStart) 10800 if len(code) != 0 { 10801 errorCode = restjson.SanitizeErrorCode(code) 10802 } 10803 if len(message) != 0 { 10804 errorMessage = message 10805 } 10806 10807 switch { 10808 case strings.EqualFold("InternalServiceException", errorCode): 10809 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10810 10811 case strings.EqualFold("InvalidRequestException", errorCode): 10812 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10813 10814 case strings.EqualFold("ResourceNotFoundException", errorCode): 10815 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10816 10817 default: 10818 genericError := &smithy.GenericAPIError{ 10819 Code: errorCode, 10820 Message: errorMessage, 10821 } 10822 return genericError 10823 10824 } 10825} 10826 10827type awsRestjson1_deserializeOpTagResource struct { 10828} 10829 10830func (*awsRestjson1_deserializeOpTagResource) ID() string { 10831 return "OperationDeserializer" 10832} 10833 10834func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10835 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10836) { 10837 out, metadata, err = next.HandleDeserialize(ctx, in) 10838 if err != nil { 10839 return out, metadata, err 10840 } 10841 10842 response, ok := out.RawResponse.(*smithyhttp.Response) 10843 if !ok { 10844 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10845 } 10846 10847 if response.StatusCode < 200 || response.StatusCode >= 300 { 10848 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 10849 } 10850 output := &TagResourceOutput{} 10851 out.Result = output 10852 10853 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 10854 return out, metadata, &smithy.DeserializationError{ 10855 Err: fmt.Errorf("failed to discard response body, %w", err), 10856 } 10857 } 10858 10859 return out, metadata, err 10860} 10861 10862func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10863 var errorBuffer bytes.Buffer 10864 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10865 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10866 } 10867 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10868 10869 errorCode := "UnknownError" 10870 errorMessage := errorCode 10871 10872 code := response.Header.Get("X-Amzn-ErrorType") 10873 if len(code) != 0 { 10874 errorCode = restjson.SanitizeErrorCode(code) 10875 } 10876 10877 var buff [1024]byte 10878 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10879 10880 body := io.TeeReader(errorBody, ringBuffer) 10881 decoder := json.NewDecoder(body) 10882 decoder.UseNumber() 10883 code, message, err := restjson.GetErrorInfo(decoder) 10884 if err != nil { 10885 var snapshot bytes.Buffer 10886 io.Copy(&snapshot, ringBuffer) 10887 err = &smithy.DeserializationError{ 10888 Err: fmt.Errorf("failed to decode response body, %w", err), 10889 Snapshot: snapshot.Bytes(), 10890 } 10891 return err 10892 } 10893 10894 errorBody.Seek(0, io.SeekStart) 10895 if len(code) != 0 { 10896 errorCode = restjson.SanitizeErrorCode(code) 10897 } 10898 if len(message) != 0 { 10899 errorMessage = message 10900 } 10901 10902 switch { 10903 case strings.EqualFold("InternalServiceException", errorCode): 10904 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 10905 10906 case strings.EqualFold("InvalidParameterException", errorCode): 10907 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 10908 10909 case strings.EqualFold("InvalidRequestException", errorCode): 10910 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 10911 10912 case strings.EqualFold("ResourceNotFoundException", errorCode): 10913 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10914 10915 case strings.EqualFold("ThrottlingException", errorCode): 10916 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 10917 10918 default: 10919 genericError := &smithy.GenericAPIError{ 10920 Code: errorCode, 10921 Message: errorMessage, 10922 } 10923 return genericError 10924 10925 } 10926} 10927 10928type awsRestjson1_deserializeOpUntagResource struct { 10929} 10930 10931func (*awsRestjson1_deserializeOpUntagResource) ID() string { 10932 return "OperationDeserializer" 10933} 10934 10935func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10936 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10937) { 10938 out, metadata, err = next.HandleDeserialize(ctx, in) 10939 if err != nil { 10940 return out, metadata, err 10941 } 10942 10943 response, ok := out.RawResponse.(*smithyhttp.Response) 10944 if !ok { 10945 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10946 } 10947 10948 if response.StatusCode < 200 || response.StatusCode >= 300 { 10949 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 10950 } 10951 output := &UntagResourceOutput{} 10952 out.Result = output 10953 10954 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 10955 return out, metadata, &smithy.DeserializationError{ 10956 Err: fmt.Errorf("failed to discard response body, %w", err), 10957 } 10958 } 10959 10960 return out, metadata, err 10961} 10962 10963func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10964 var errorBuffer bytes.Buffer 10965 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10966 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10967 } 10968 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10969 10970 errorCode := "UnknownError" 10971 errorMessage := errorCode 10972 10973 code := response.Header.Get("X-Amzn-ErrorType") 10974 if len(code) != 0 { 10975 errorCode = restjson.SanitizeErrorCode(code) 10976 } 10977 10978 var buff [1024]byte 10979 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10980 10981 body := io.TeeReader(errorBody, ringBuffer) 10982 decoder := json.NewDecoder(body) 10983 decoder.UseNumber() 10984 code, message, err := restjson.GetErrorInfo(decoder) 10985 if err != nil { 10986 var snapshot bytes.Buffer 10987 io.Copy(&snapshot, ringBuffer) 10988 err = &smithy.DeserializationError{ 10989 Err: fmt.Errorf("failed to decode response body, %w", err), 10990 Snapshot: snapshot.Bytes(), 10991 } 10992 return err 10993 } 10994 10995 errorBody.Seek(0, io.SeekStart) 10996 if len(code) != 0 { 10997 errorCode = restjson.SanitizeErrorCode(code) 10998 } 10999 if len(message) != 0 { 11000 errorMessage = message 11001 } 11002 11003 switch { 11004 case strings.EqualFold("InternalServiceException", errorCode): 11005 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11006 11007 case strings.EqualFold("InvalidParameterException", errorCode): 11008 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11009 11010 case strings.EqualFold("InvalidRequestException", errorCode): 11011 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11012 11013 case strings.EqualFold("ResourceNotFoundException", errorCode): 11014 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11015 11016 case strings.EqualFold("ThrottlingException", errorCode): 11017 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11018 11019 default: 11020 genericError := &smithy.GenericAPIError{ 11021 Code: errorCode, 11022 Message: errorMessage, 11023 } 11024 return genericError 11025 11026 } 11027} 11028 11029type awsRestjson1_deserializeOpUpdateContactAttributes struct { 11030} 11031 11032func (*awsRestjson1_deserializeOpUpdateContactAttributes) ID() string { 11033 return "OperationDeserializer" 11034} 11035 11036func (m *awsRestjson1_deserializeOpUpdateContactAttributes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11037 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11038) { 11039 out, metadata, err = next.HandleDeserialize(ctx, in) 11040 if err != nil { 11041 return out, metadata, err 11042 } 11043 11044 response, ok := out.RawResponse.(*smithyhttp.Response) 11045 if !ok { 11046 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11047 } 11048 11049 if response.StatusCode < 200 || response.StatusCode >= 300 { 11050 return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactAttributes(response, &metadata) 11051 } 11052 output := &UpdateContactAttributesOutput{} 11053 out.Result = output 11054 11055 return out, metadata, err 11056} 11057 11058func awsRestjson1_deserializeOpErrorUpdateContactAttributes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11059 var errorBuffer bytes.Buffer 11060 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11061 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11062 } 11063 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11064 11065 errorCode := "UnknownError" 11066 errorMessage := errorCode 11067 11068 code := response.Header.Get("X-Amzn-ErrorType") 11069 if len(code) != 0 { 11070 errorCode = restjson.SanitizeErrorCode(code) 11071 } 11072 11073 var buff [1024]byte 11074 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11075 11076 body := io.TeeReader(errorBody, ringBuffer) 11077 decoder := json.NewDecoder(body) 11078 decoder.UseNumber() 11079 code, message, err := restjson.GetErrorInfo(decoder) 11080 if err != nil { 11081 var snapshot bytes.Buffer 11082 io.Copy(&snapshot, ringBuffer) 11083 err = &smithy.DeserializationError{ 11084 Err: fmt.Errorf("failed to decode response body, %w", err), 11085 Snapshot: snapshot.Bytes(), 11086 } 11087 return err 11088 } 11089 11090 errorBody.Seek(0, io.SeekStart) 11091 if len(code) != 0 { 11092 errorCode = restjson.SanitizeErrorCode(code) 11093 } 11094 if len(message) != 0 { 11095 errorMessage = message 11096 } 11097 11098 switch { 11099 case strings.EqualFold("InternalServiceException", errorCode): 11100 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11101 11102 case strings.EqualFold("InvalidParameterException", errorCode): 11103 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11104 11105 case strings.EqualFold("InvalidRequestException", errorCode): 11106 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11107 11108 case strings.EqualFold("ResourceNotFoundException", errorCode): 11109 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11110 11111 default: 11112 genericError := &smithy.GenericAPIError{ 11113 Code: errorCode, 11114 Message: errorMessage, 11115 } 11116 return genericError 11117 11118 } 11119} 11120 11121type awsRestjson1_deserializeOpUpdateContactFlowContent struct { 11122} 11123 11124func (*awsRestjson1_deserializeOpUpdateContactFlowContent) ID() string { 11125 return "OperationDeserializer" 11126} 11127 11128func (m *awsRestjson1_deserializeOpUpdateContactFlowContent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11129 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11130) { 11131 out, metadata, err = next.HandleDeserialize(ctx, in) 11132 if err != nil { 11133 return out, metadata, err 11134 } 11135 11136 response, ok := out.RawResponse.(*smithyhttp.Response) 11137 if !ok { 11138 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11139 } 11140 11141 if response.StatusCode < 200 || response.StatusCode >= 300 { 11142 return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowContent(response, &metadata) 11143 } 11144 output := &UpdateContactFlowContentOutput{} 11145 out.Result = output 11146 11147 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11148 return out, metadata, &smithy.DeserializationError{ 11149 Err: fmt.Errorf("failed to discard response body, %w", err), 11150 } 11151 } 11152 11153 return out, metadata, err 11154} 11155 11156func awsRestjson1_deserializeOpErrorUpdateContactFlowContent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11157 var errorBuffer bytes.Buffer 11158 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11159 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11160 } 11161 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11162 11163 errorCode := "UnknownError" 11164 errorMessage := errorCode 11165 11166 code := response.Header.Get("X-Amzn-ErrorType") 11167 if len(code) != 0 { 11168 errorCode = restjson.SanitizeErrorCode(code) 11169 } 11170 11171 var buff [1024]byte 11172 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11173 11174 body := io.TeeReader(errorBody, ringBuffer) 11175 decoder := json.NewDecoder(body) 11176 decoder.UseNumber() 11177 code, message, err := restjson.GetErrorInfo(decoder) 11178 if err != nil { 11179 var snapshot bytes.Buffer 11180 io.Copy(&snapshot, ringBuffer) 11181 err = &smithy.DeserializationError{ 11182 Err: fmt.Errorf("failed to decode response body, %w", err), 11183 Snapshot: snapshot.Bytes(), 11184 } 11185 return err 11186 } 11187 11188 errorBody.Seek(0, io.SeekStart) 11189 if len(code) != 0 { 11190 errorCode = restjson.SanitizeErrorCode(code) 11191 } 11192 if len(message) != 0 { 11193 errorMessage = message 11194 } 11195 11196 switch { 11197 case strings.EqualFold("InternalServiceException", errorCode): 11198 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11199 11200 case strings.EqualFold("InvalidContactFlowException", errorCode): 11201 return awsRestjson1_deserializeErrorInvalidContactFlowException(response, errorBody) 11202 11203 case strings.EqualFold("InvalidParameterException", errorCode): 11204 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11205 11206 case strings.EqualFold("InvalidRequestException", errorCode): 11207 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11208 11209 case strings.EqualFold("ResourceNotFoundException", errorCode): 11210 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11211 11212 case strings.EqualFold("ThrottlingException", errorCode): 11213 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11214 11215 default: 11216 genericError := &smithy.GenericAPIError{ 11217 Code: errorCode, 11218 Message: errorMessage, 11219 } 11220 return genericError 11221 11222 } 11223} 11224 11225type awsRestjson1_deserializeOpUpdateContactFlowName struct { 11226} 11227 11228func (*awsRestjson1_deserializeOpUpdateContactFlowName) ID() string { 11229 return "OperationDeserializer" 11230} 11231 11232func (m *awsRestjson1_deserializeOpUpdateContactFlowName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11233 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11234) { 11235 out, metadata, err = next.HandleDeserialize(ctx, in) 11236 if err != nil { 11237 return out, metadata, err 11238 } 11239 11240 response, ok := out.RawResponse.(*smithyhttp.Response) 11241 if !ok { 11242 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11243 } 11244 11245 if response.StatusCode < 200 || response.StatusCode >= 300 { 11246 return out, metadata, awsRestjson1_deserializeOpErrorUpdateContactFlowName(response, &metadata) 11247 } 11248 output := &UpdateContactFlowNameOutput{} 11249 out.Result = output 11250 11251 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11252 return out, metadata, &smithy.DeserializationError{ 11253 Err: fmt.Errorf("failed to discard response body, %w", err), 11254 } 11255 } 11256 11257 return out, metadata, err 11258} 11259 11260func awsRestjson1_deserializeOpErrorUpdateContactFlowName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11261 var errorBuffer bytes.Buffer 11262 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11263 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11264 } 11265 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11266 11267 errorCode := "UnknownError" 11268 errorMessage := errorCode 11269 11270 code := response.Header.Get("X-Amzn-ErrorType") 11271 if len(code) != 0 { 11272 errorCode = restjson.SanitizeErrorCode(code) 11273 } 11274 11275 var buff [1024]byte 11276 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11277 11278 body := io.TeeReader(errorBody, ringBuffer) 11279 decoder := json.NewDecoder(body) 11280 decoder.UseNumber() 11281 code, message, err := restjson.GetErrorInfo(decoder) 11282 if err != nil { 11283 var snapshot bytes.Buffer 11284 io.Copy(&snapshot, ringBuffer) 11285 err = &smithy.DeserializationError{ 11286 Err: fmt.Errorf("failed to decode response body, %w", err), 11287 Snapshot: snapshot.Bytes(), 11288 } 11289 return err 11290 } 11291 11292 errorBody.Seek(0, io.SeekStart) 11293 if len(code) != 0 { 11294 errorCode = restjson.SanitizeErrorCode(code) 11295 } 11296 if len(message) != 0 { 11297 errorMessage = message 11298 } 11299 11300 switch { 11301 case strings.EqualFold("DuplicateResourceException", errorCode): 11302 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 11303 11304 case strings.EqualFold("InternalServiceException", errorCode): 11305 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11306 11307 case strings.EqualFold("InvalidParameterException", errorCode): 11308 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11309 11310 case strings.EqualFold("InvalidRequestException", errorCode): 11311 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11312 11313 case strings.EqualFold("ResourceNotFoundException", errorCode): 11314 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11315 11316 case strings.EqualFold("ThrottlingException", errorCode): 11317 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11318 11319 default: 11320 genericError := &smithy.GenericAPIError{ 11321 Code: errorCode, 11322 Message: errorMessage, 11323 } 11324 return genericError 11325 11326 } 11327} 11328 11329type awsRestjson1_deserializeOpUpdateInstanceAttribute struct { 11330} 11331 11332func (*awsRestjson1_deserializeOpUpdateInstanceAttribute) ID() string { 11333 return "OperationDeserializer" 11334} 11335 11336func (m *awsRestjson1_deserializeOpUpdateInstanceAttribute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11337 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11338) { 11339 out, metadata, err = next.HandleDeserialize(ctx, in) 11340 if err != nil { 11341 return out, metadata, err 11342 } 11343 11344 response, ok := out.RawResponse.(*smithyhttp.Response) 11345 if !ok { 11346 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11347 } 11348 11349 if response.StatusCode < 200 || response.StatusCode >= 300 { 11350 return out, metadata, awsRestjson1_deserializeOpErrorUpdateInstanceAttribute(response, &metadata) 11351 } 11352 output := &UpdateInstanceAttributeOutput{} 11353 out.Result = output 11354 11355 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11356 return out, metadata, &smithy.DeserializationError{ 11357 Err: fmt.Errorf("failed to discard response body, %w", err), 11358 } 11359 } 11360 11361 return out, metadata, err 11362} 11363 11364func awsRestjson1_deserializeOpErrorUpdateInstanceAttribute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11365 var errorBuffer bytes.Buffer 11366 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11367 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11368 } 11369 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11370 11371 errorCode := "UnknownError" 11372 errorMessage := errorCode 11373 11374 code := response.Header.Get("X-Amzn-ErrorType") 11375 if len(code) != 0 { 11376 errorCode = restjson.SanitizeErrorCode(code) 11377 } 11378 11379 var buff [1024]byte 11380 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11381 11382 body := io.TeeReader(errorBody, ringBuffer) 11383 decoder := json.NewDecoder(body) 11384 decoder.UseNumber() 11385 code, message, err := restjson.GetErrorInfo(decoder) 11386 if err != nil { 11387 var snapshot bytes.Buffer 11388 io.Copy(&snapshot, ringBuffer) 11389 err = &smithy.DeserializationError{ 11390 Err: fmt.Errorf("failed to decode response body, %w", err), 11391 Snapshot: snapshot.Bytes(), 11392 } 11393 return err 11394 } 11395 11396 errorBody.Seek(0, io.SeekStart) 11397 if len(code) != 0 { 11398 errorCode = restjson.SanitizeErrorCode(code) 11399 } 11400 if len(message) != 0 { 11401 errorMessage = message 11402 } 11403 11404 switch { 11405 case strings.EqualFold("InternalServiceException", errorCode): 11406 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11407 11408 case strings.EqualFold("InvalidParameterException", errorCode): 11409 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11410 11411 case strings.EqualFold("InvalidRequestException", errorCode): 11412 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11413 11414 case strings.EqualFold("ResourceNotFoundException", errorCode): 11415 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11416 11417 case strings.EqualFold("ThrottlingException", errorCode): 11418 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11419 11420 default: 11421 genericError := &smithy.GenericAPIError{ 11422 Code: errorCode, 11423 Message: errorMessage, 11424 } 11425 return genericError 11426 11427 } 11428} 11429 11430type awsRestjson1_deserializeOpUpdateInstanceStorageConfig struct { 11431} 11432 11433func (*awsRestjson1_deserializeOpUpdateInstanceStorageConfig) ID() string { 11434 return "OperationDeserializer" 11435} 11436 11437func (m *awsRestjson1_deserializeOpUpdateInstanceStorageConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11438 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11439) { 11440 out, metadata, err = next.HandleDeserialize(ctx, in) 11441 if err != nil { 11442 return out, metadata, err 11443 } 11444 11445 response, ok := out.RawResponse.(*smithyhttp.Response) 11446 if !ok { 11447 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11448 } 11449 11450 if response.StatusCode < 200 || response.StatusCode >= 300 { 11451 return out, metadata, awsRestjson1_deserializeOpErrorUpdateInstanceStorageConfig(response, &metadata) 11452 } 11453 output := &UpdateInstanceStorageConfigOutput{} 11454 out.Result = output 11455 11456 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11457 return out, metadata, &smithy.DeserializationError{ 11458 Err: fmt.Errorf("failed to discard response body, %w", err), 11459 } 11460 } 11461 11462 return out, metadata, err 11463} 11464 11465func awsRestjson1_deserializeOpErrorUpdateInstanceStorageConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11466 var errorBuffer bytes.Buffer 11467 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11468 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11469 } 11470 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11471 11472 errorCode := "UnknownError" 11473 errorMessage := errorCode 11474 11475 code := response.Header.Get("X-Amzn-ErrorType") 11476 if len(code) != 0 { 11477 errorCode = restjson.SanitizeErrorCode(code) 11478 } 11479 11480 var buff [1024]byte 11481 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11482 11483 body := io.TeeReader(errorBody, ringBuffer) 11484 decoder := json.NewDecoder(body) 11485 decoder.UseNumber() 11486 code, message, err := restjson.GetErrorInfo(decoder) 11487 if err != nil { 11488 var snapshot bytes.Buffer 11489 io.Copy(&snapshot, ringBuffer) 11490 err = &smithy.DeserializationError{ 11491 Err: fmt.Errorf("failed to decode response body, %w", err), 11492 Snapshot: snapshot.Bytes(), 11493 } 11494 return err 11495 } 11496 11497 errorBody.Seek(0, io.SeekStart) 11498 if len(code) != 0 { 11499 errorCode = restjson.SanitizeErrorCode(code) 11500 } 11501 if len(message) != 0 { 11502 errorMessage = message 11503 } 11504 11505 switch { 11506 case strings.EqualFold("InternalServiceException", errorCode): 11507 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11508 11509 case strings.EqualFold("InvalidParameterException", errorCode): 11510 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11511 11512 case strings.EqualFold("InvalidRequestException", errorCode): 11513 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11514 11515 case strings.EqualFold("ResourceNotFoundException", errorCode): 11516 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11517 11518 case strings.EqualFold("ThrottlingException", errorCode): 11519 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11520 11521 default: 11522 genericError := &smithy.GenericAPIError{ 11523 Code: errorCode, 11524 Message: errorMessage, 11525 } 11526 return genericError 11527 11528 } 11529} 11530 11531type awsRestjson1_deserializeOpUpdateQueueHoursOfOperation struct { 11532} 11533 11534func (*awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) ID() string { 11535 return "OperationDeserializer" 11536} 11537 11538func (m *awsRestjson1_deserializeOpUpdateQueueHoursOfOperation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11539 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11540) { 11541 out, metadata, err = next.HandleDeserialize(ctx, in) 11542 if err != nil { 11543 return out, metadata, err 11544 } 11545 11546 response, ok := out.RawResponse.(*smithyhttp.Response) 11547 if !ok { 11548 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11549 } 11550 11551 if response.StatusCode < 200 || response.StatusCode >= 300 { 11552 return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(response, &metadata) 11553 } 11554 output := &UpdateQueueHoursOfOperationOutput{} 11555 out.Result = output 11556 11557 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11558 return out, metadata, &smithy.DeserializationError{ 11559 Err: fmt.Errorf("failed to discard response body, %w", err), 11560 } 11561 } 11562 11563 return out, metadata, err 11564} 11565 11566func awsRestjson1_deserializeOpErrorUpdateQueueHoursOfOperation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11567 var errorBuffer bytes.Buffer 11568 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11569 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11570 } 11571 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11572 11573 errorCode := "UnknownError" 11574 errorMessage := errorCode 11575 11576 code := response.Header.Get("X-Amzn-ErrorType") 11577 if len(code) != 0 { 11578 errorCode = restjson.SanitizeErrorCode(code) 11579 } 11580 11581 var buff [1024]byte 11582 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11583 11584 body := io.TeeReader(errorBody, ringBuffer) 11585 decoder := json.NewDecoder(body) 11586 decoder.UseNumber() 11587 code, message, err := restjson.GetErrorInfo(decoder) 11588 if err != nil { 11589 var snapshot bytes.Buffer 11590 io.Copy(&snapshot, ringBuffer) 11591 err = &smithy.DeserializationError{ 11592 Err: fmt.Errorf("failed to decode response body, %w", err), 11593 Snapshot: snapshot.Bytes(), 11594 } 11595 return err 11596 } 11597 11598 errorBody.Seek(0, io.SeekStart) 11599 if len(code) != 0 { 11600 errorCode = restjson.SanitizeErrorCode(code) 11601 } 11602 if len(message) != 0 { 11603 errorMessage = message 11604 } 11605 11606 switch { 11607 case strings.EqualFold("InternalServiceException", errorCode): 11608 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11609 11610 case strings.EqualFold("InvalidParameterException", errorCode): 11611 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11612 11613 case strings.EqualFold("InvalidRequestException", errorCode): 11614 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11615 11616 case strings.EqualFold("ResourceNotFoundException", errorCode): 11617 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11618 11619 case strings.EqualFold("ThrottlingException", errorCode): 11620 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11621 11622 default: 11623 genericError := &smithy.GenericAPIError{ 11624 Code: errorCode, 11625 Message: errorMessage, 11626 } 11627 return genericError 11628 11629 } 11630} 11631 11632type awsRestjson1_deserializeOpUpdateQueueMaxContacts struct { 11633} 11634 11635func (*awsRestjson1_deserializeOpUpdateQueueMaxContacts) ID() string { 11636 return "OperationDeserializer" 11637} 11638 11639func (m *awsRestjson1_deserializeOpUpdateQueueMaxContacts) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11640 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11641) { 11642 out, metadata, err = next.HandleDeserialize(ctx, in) 11643 if err != nil { 11644 return out, metadata, err 11645 } 11646 11647 response, ok := out.RawResponse.(*smithyhttp.Response) 11648 if !ok { 11649 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11650 } 11651 11652 if response.StatusCode < 200 || response.StatusCode >= 300 { 11653 return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueMaxContacts(response, &metadata) 11654 } 11655 output := &UpdateQueueMaxContactsOutput{} 11656 out.Result = output 11657 11658 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11659 return out, metadata, &smithy.DeserializationError{ 11660 Err: fmt.Errorf("failed to discard response body, %w", err), 11661 } 11662 } 11663 11664 return out, metadata, err 11665} 11666 11667func awsRestjson1_deserializeOpErrorUpdateQueueMaxContacts(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11668 var errorBuffer bytes.Buffer 11669 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11670 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11671 } 11672 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11673 11674 errorCode := "UnknownError" 11675 errorMessage := errorCode 11676 11677 code := response.Header.Get("X-Amzn-ErrorType") 11678 if len(code) != 0 { 11679 errorCode = restjson.SanitizeErrorCode(code) 11680 } 11681 11682 var buff [1024]byte 11683 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11684 11685 body := io.TeeReader(errorBody, ringBuffer) 11686 decoder := json.NewDecoder(body) 11687 decoder.UseNumber() 11688 code, message, err := restjson.GetErrorInfo(decoder) 11689 if err != nil { 11690 var snapshot bytes.Buffer 11691 io.Copy(&snapshot, ringBuffer) 11692 err = &smithy.DeserializationError{ 11693 Err: fmt.Errorf("failed to decode response body, %w", err), 11694 Snapshot: snapshot.Bytes(), 11695 } 11696 return err 11697 } 11698 11699 errorBody.Seek(0, io.SeekStart) 11700 if len(code) != 0 { 11701 errorCode = restjson.SanitizeErrorCode(code) 11702 } 11703 if len(message) != 0 { 11704 errorMessage = message 11705 } 11706 11707 switch { 11708 case strings.EqualFold("InternalServiceException", errorCode): 11709 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11710 11711 case strings.EqualFold("InvalidParameterException", errorCode): 11712 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11713 11714 case strings.EqualFold("InvalidRequestException", errorCode): 11715 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11716 11717 case strings.EqualFold("ResourceNotFoundException", errorCode): 11718 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11719 11720 case strings.EqualFold("ThrottlingException", errorCode): 11721 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11722 11723 default: 11724 genericError := &smithy.GenericAPIError{ 11725 Code: errorCode, 11726 Message: errorMessage, 11727 } 11728 return genericError 11729 11730 } 11731} 11732 11733type awsRestjson1_deserializeOpUpdateQueueName struct { 11734} 11735 11736func (*awsRestjson1_deserializeOpUpdateQueueName) ID() string { 11737 return "OperationDeserializer" 11738} 11739 11740func (m *awsRestjson1_deserializeOpUpdateQueueName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11741 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11742) { 11743 out, metadata, err = next.HandleDeserialize(ctx, in) 11744 if err != nil { 11745 return out, metadata, err 11746 } 11747 11748 response, ok := out.RawResponse.(*smithyhttp.Response) 11749 if !ok { 11750 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11751 } 11752 11753 if response.StatusCode < 200 || response.StatusCode >= 300 { 11754 return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueName(response, &metadata) 11755 } 11756 output := &UpdateQueueNameOutput{} 11757 out.Result = output 11758 11759 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11760 return out, metadata, &smithy.DeserializationError{ 11761 Err: fmt.Errorf("failed to discard response body, %w", err), 11762 } 11763 } 11764 11765 return out, metadata, err 11766} 11767 11768func awsRestjson1_deserializeOpErrorUpdateQueueName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11769 var errorBuffer bytes.Buffer 11770 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11771 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11772 } 11773 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11774 11775 errorCode := "UnknownError" 11776 errorMessage := errorCode 11777 11778 code := response.Header.Get("X-Amzn-ErrorType") 11779 if len(code) != 0 { 11780 errorCode = restjson.SanitizeErrorCode(code) 11781 } 11782 11783 var buff [1024]byte 11784 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11785 11786 body := io.TeeReader(errorBody, ringBuffer) 11787 decoder := json.NewDecoder(body) 11788 decoder.UseNumber() 11789 code, message, err := restjson.GetErrorInfo(decoder) 11790 if err != nil { 11791 var snapshot bytes.Buffer 11792 io.Copy(&snapshot, ringBuffer) 11793 err = &smithy.DeserializationError{ 11794 Err: fmt.Errorf("failed to decode response body, %w", err), 11795 Snapshot: snapshot.Bytes(), 11796 } 11797 return err 11798 } 11799 11800 errorBody.Seek(0, io.SeekStart) 11801 if len(code) != 0 { 11802 errorCode = restjson.SanitizeErrorCode(code) 11803 } 11804 if len(message) != 0 { 11805 errorMessage = message 11806 } 11807 11808 switch { 11809 case strings.EqualFold("DuplicateResourceException", errorCode): 11810 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 11811 11812 case strings.EqualFold("InternalServiceException", errorCode): 11813 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11814 11815 case strings.EqualFold("InvalidParameterException", errorCode): 11816 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11817 11818 case strings.EqualFold("InvalidRequestException", errorCode): 11819 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11820 11821 case strings.EqualFold("ResourceNotFoundException", errorCode): 11822 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11823 11824 case strings.EqualFold("ThrottlingException", errorCode): 11825 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11826 11827 default: 11828 genericError := &smithy.GenericAPIError{ 11829 Code: errorCode, 11830 Message: errorMessage, 11831 } 11832 return genericError 11833 11834 } 11835} 11836 11837type awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig struct { 11838} 11839 11840func (*awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig) ID() string { 11841 return "OperationDeserializer" 11842} 11843 11844func (m *awsRestjson1_deserializeOpUpdateQueueOutboundCallerConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11845 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11846) { 11847 out, metadata, err = next.HandleDeserialize(ctx, in) 11848 if err != nil { 11849 return out, metadata, err 11850 } 11851 11852 response, ok := out.RawResponse.(*smithyhttp.Response) 11853 if !ok { 11854 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11855 } 11856 11857 if response.StatusCode < 200 || response.StatusCode >= 300 { 11858 return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueOutboundCallerConfig(response, &metadata) 11859 } 11860 output := &UpdateQueueOutboundCallerConfigOutput{} 11861 out.Result = output 11862 11863 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11864 return out, metadata, &smithy.DeserializationError{ 11865 Err: fmt.Errorf("failed to discard response body, %w", err), 11866 } 11867 } 11868 11869 return out, metadata, err 11870} 11871 11872func awsRestjson1_deserializeOpErrorUpdateQueueOutboundCallerConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11873 var errorBuffer bytes.Buffer 11874 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11875 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11876 } 11877 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11878 11879 errorCode := "UnknownError" 11880 errorMessage := errorCode 11881 11882 code := response.Header.Get("X-Amzn-ErrorType") 11883 if len(code) != 0 { 11884 errorCode = restjson.SanitizeErrorCode(code) 11885 } 11886 11887 var buff [1024]byte 11888 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11889 11890 body := io.TeeReader(errorBody, ringBuffer) 11891 decoder := json.NewDecoder(body) 11892 decoder.UseNumber() 11893 code, message, err := restjson.GetErrorInfo(decoder) 11894 if err != nil { 11895 var snapshot bytes.Buffer 11896 io.Copy(&snapshot, ringBuffer) 11897 err = &smithy.DeserializationError{ 11898 Err: fmt.Errorf("failed to decode response body, %w", err), 11899 Snapshot: snapshot.Bytes(), 11900 } 11901 return err 11902 } 11903 11904 errorBody.Seek(0, io.SeekStart) 11905 if len(code) != 0 { 11906 errorCode = restjson.SanitizeErrorCode(code) 11907 } 11908 if len(message) != 0 { 11909 errorMessage = message 11910 } 11911 11912 switch { 11913 case strings.EqualFold("InternalServiceException", errorCode): 11914 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 11915 11916 case strings.EqualFold("InvalidParameterException", errorCode): 11917 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 11918 11919 case strings.EqualFold("InvalidRequestException", errorCode): 11920 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 11921 11922 case strings.EqualFold("ResourceNotFoundException", errorCode): 11923 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 11924 11925 case strings.EqualFold("ThrottlingException", errorCode): 11926 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11927 11928 default: 11929 genericError := &smithy.GenericAPIError{ 11930 Code: errorCode, 11931 Message: errorMessage, 11932 } 11933 return genericError 11934 11935 } 11936} 11937 11938type awsRestjson1_deserializeOpUpdateQueueStatus struct { 11939} 11940 11941func (*awsRestjson1_deserializeOpUpdateQueueStatus) ID() string { 11942 return "OperationDeserializer" 11943} 11944 11945func (m *awsRestjson1_deserializeOpUpdateQueueStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11946 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11947) { 11948 out, metadata, err = next.HandleDeserialize(ctx, in) 11949 if err != nil { 11950 return out, metadata, err 11951 } 11952 11953 response, ok := out.RawResponse.(*smithyhttp.Response) 11954 if !ok { 11955 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11956 } 11957 11958 if response.StatusCode < 200 || response.StatusCode >= 300 { 11959 return out, metadata, awsRestjson1_deserializeOpErrorUpdateQueueStatus(response, &metadata) 11960 } 11961 output := &UpdateQueueStatusOutput{} 11962 out.Result = output 11963 11964 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 11965 return out, metadata, &smithy.DeserializationError{ 11966 Err: fmt.Errorf("failed to discard response body, %w", err), 11967 } 11968 } 11969 11970 return out, metadata, err 11971} 11972 11973func awsRestjson1_deserializeOpErrorUpdateQueueStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11974 var errorBuffer bytes.Buffer 11975 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11976 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11977 } 11978 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11979 11980 errorCode := "UnknownError" 11981 errorMessage := errorCode 11982 11983 code := response.Header.Get("X-Amzn-ErrorType") 11984 if len(code) != 0 { 11985 errorCode = restjson.SanitizeErrorCode(code) 11986 } 11987 11988 var buff [1024]byte 11989 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11990 11991 body := io.TeeReader(errorBody, ringBuffer) 11992 decoder := json.NewDecoder(body) 11993 decoder.UseNumber() 11994 code, message, err := restjson.GetErrorInfo(decoder) 11995 if err != nil { 11996 var snapshot bytes.Buffer 11997 io.Copy(&snapshot, ringBuffer) 11998 err = &smithy.DeserializationError{ 11999 Err: fmt.Errorf("failed to decode response body, %w", err), 12000 Snapshot: snapshot.Bytes(), 12001 } 12002 return err 12003 } 12004 12005 errorBody.Seek(0, io.SeekStart) 12006 if len(code) != 0 { 12007 errorCode = restjson.SanitizeErrorCode(code) 12008 } 12009 if len(message) != 0 { 12010 errorMessage = message 12011 } 12012 12013 switch { 12014 case strings.EqualFold("InternalServiceException", errorCode): 12015 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12016 12017 case strings.EqualFold("InvalidParameterException", errorCode): 12018 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12019 12020 case strings.EqualFold("InvalidRequestException", errorCode): 12021 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12022 12023 case strings.EqualFold("ResourceNotFoundException", errorCode): 12024 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12025 12026 case strings.EqualFold("ThrottlingException", errorCode): 12027 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12028 12029 default: 12030 genericError := &smithy.GenericAPIError{ 12031 Code: errorCode, 12032 Message: errorMessage, 12033 } 12034 return genericError 12035 12036 } 12037} 12038 12039type awsRestjson1_deserializeOpUpdateQuickConnectConfig struct { 12040} 12041 12042func (*awsRestjson1_deserializeOpUpdateQuickConnectConfig) ID() string { 12043 return "OperationDeserializer" 12044} 12045 12046func (m *awsRestjson1_deserializeOpUpdateQuickConnectConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12047 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12048) { 12049 out, metadata, err = next.HandleDeserialize(ctx, in) 12050 if err != nil { 12051 return out, metadata, err 12052 } 12053 12054 response, ok := out.RawResponse.(*smithyhttp.Response) 12055 if !ok { 12056 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12057 } 12058 12059 if response.StatusCode < 200 || response.StatusCode >= 300 { 12060 return out, metadata, awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response, &metadata) 12061 } 12062 output := &UpdateQuickConnectConfigOutput{} 12063 out.Result = output 12064 12065 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12066 return out, metadata, &smithy.DeserializationError{ 12067 Err: fmt.Errorf("failed to discard response body, %w", err), 12068 } 12069 } 12070 12071 return out, metadata, err 12072} 12073 12074func awsRestjson1_deserializeOpErrorUpdateQuickConnectConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12075 var errorBuffer bytes.Buffer 12076 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12077 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12078 } 12079 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12080 12081 errorCode := "UnknownError" 12082 errorMessage := errorCode 12083 12084 code := response.Header.Get("X-Amzn-ErrorType") 12085 if len(code) != 0 { 12086 errorCode = restjson.SanitizeErrorCode(code) 12087 } 12088 12089 var buff [1024]byte 12090 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12091 12092 body := io.TeeReader(errorBody, ringBuffer) 12093 decoder := json.NewDecoder(body) 12094 decoder.UseNumber() 12095 code, message, err := restjson.GetErrorInfo(decoder) 12096 if err != nil { 12097 var snapshot bytes.Buffer 12098 io.Copy(&snapshot, ringBuffer) 12099 err = &smithy.DeserializationError{ 12100 Err: fmt.Errorf("failed to decode response body, %w", err), 12101 Snapshot: snapshot.Bytes(), 12102 } 12103 return err 12104 } 12105 12106 errorBody.Seek(0, io.SeekStart) 12107 if len(code) != 0 { 12108 errorCode = restjson.SanitizeErrorCode(code) 12109 } 12110 if len(message) != 0 { 12111 errorMessage = message 12112 } 12113 12114 switch { 12115 case strings.EqualFold("InternalServiceException", errorCode): 12116 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12117 12118 case strings.EqualFold("InvalidParameterException", errorCode): 12119 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12120 12121 case strings.EqualFold("InvalidRequestException", errorCode): 12122 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12123 12124 case strings.EqualFold("ResourceNotFoundException", errorCode): 12125 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12126 12127 case strings.EqualFold("ThrottlingException", errorCode): 12128 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12129 12130 default: 12131 genericError := &smithy.GenericAPIError{ 12132 Code: errorCode, 12133 Message: errorMessage, 12134 } 12135 return genericError 12136 12137 } 12138} 12139 12140type awsRestjson1_deserializeOpUpdateQuickConnectName struct { 12141} 12142 12143func (*awsRestjson1_deserializeOpUpdateQuickConnectName) ID() string { 12144 return "OperationDeserializer" 12145} 12146 12147func (m *awsRestjson1_deserializeOpUpdateQuickConnectName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12148 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12149) { 12150 out, metadata, err = next.HandleDeserialize(ctx, in) 12151 if err != nil { 12152 return out, metadata, err 12153 } 12154 12155 response, ok := out.RawResponse.(*smithyhttp.Response) 12156 if !ok { 12157 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12158 } 12159 12160 if response.StatusCode < 200 || response.StatusCode >= 300 { 12161 return out, metadata, awsRestjson1_deserializeOpErrorUpdateQuickConnectName(response, &metadata) 12162 } 12163 output := &UpdateQuickConnectNameOutput{} 12164 out.Result = output 12165 12166 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12167 return out, metadata, &smithy.DeserializationError{ 12168 Err: fmt.Errorf("failed to discard response body, %w", err), 12169 } 12170 } 12171 12172 return out, metadata, err 12173} 12174 12175func awsRestjson1_deserializeOpErrorUpdateQuickConnectName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12176 var errorBuffer bytes.Buffer 12177 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12178 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12179 } 12180 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12181 12182 errorCode := "UnknownError" 12183 errorMessage := errorCode 12184 12185 code := response.Header.Get("X-Amzn-ErrorType") 12186 if len(code) != 0 { 12187 errorCode = restjson.SanitizeErrorCode(code) 12188 } 12189 12190 var buff [1024]byte 12191 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12192 12193 body := io.TeeReader(errorBody, ringBuffer) 12194 decoder := json.NewDecoder(body) 12195 decoder.UseNumber() 12196 code, message, err := restjson.GetErrorInfo(decoder) 12197 if err != nil { 12198 var snapshot bytes.Buffer 12199 io.Copy(&snapshot, ringBuffer) 12200 err = &smithy.DeserializationError{ 12201 Err: fmt.Errorf("failed to decode response body, %w", err), 12202 Snapshot: snapshot.Bytes(), 12203 } 12204 return err 12205 } 12206 12207 errorBody.Seek(0, io.SeekStart) 12208 if len(code) != 0 { 12209 errorCode = restjson.SanitizeErrorCode(code) 12210 } 12211 if len(message) != 0 { 12212 errorMessage = message 12213 } 12214 12215 switch { 12216 case strings.EqualFold("InternalServiceException", errorCode): 12217 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12218 12219 case strings.EqualFold("InvalidParameterException", errorCode): 12220 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12221 12222 case strings.EqualFold("InvalidRequestException", errorCode): 12223 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12224 12225 case strings.EqualFold("ResourceNotFoundException", errorCode): 12226 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12227 12228 case strings.EqualFold("ThrottlingException", errorCode): 12229 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12230 12231 default: 12232 genericError := &smithy.GenericAPIError{ 12233 Code: errorCode, 12234 Message: errorMessage, 12235 } 12236 return genericError 12237 12238 } 12239} 12240 12241type awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency struct { 12242} 12243 12244func (*awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) ID() string { 12245 return "OperationDeserializer" 12246} 12247 12248func (m *awsRestjson1_deserializeOpUpdateRoutingProfileConcurrency) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12249 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12250) { 12251 out, metadata, err = next.HandleDeserialize(ctx, in) 12252 if err != nil { 12253 return out, metadata, err 12254 } 12255 12256 response, ok := out.RawResponse.(*smithyhttp.Response) 12257 if !ok { 12258 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12259 } 12260 12261 if response.StatusCode < 200 || response.StatusCode >= 300 { 12262 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileConcurrency(response, &metadata) 12263 } 12264 output := &UpdateRoutingProfileConcurrencyOutput{} 12265 out.Result = output 12266 12267 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12268 return out, metadata, &smithy.DeserializationError{ 12269 Err: fmt.Errorf("failed to discard response body, %w", err), 12270 } 12271 } 12272 12273 return out, metadata, err 12274} 12275 12276func awsRestjson1_deserializeOpErrorUpdateRoutingProfileConcurrency(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12277 var errorBuffer bytes.Buffer 12278 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12279 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12280 } 12281 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12282 12283 errorCode := "UnknownError" 12284 errorMessage := errorCode 12285 12286 code := response.Header.Get("X-Amzn-ErrorType") 12287 if len(code) != 0 { 12288 errorCode = restjson.SanitizeErrorCode(code) 12289 } 12290 12291 var buff [1024]byte 12292 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12293 12294 body := io.TeeReader(errorBody, ringBuffer) 12295 decoder := json.NewDecoder(body) 12296 decoder.UseNumber() 12297 code, message, err := restjson.GetErrorInfo(decoder) 12298 if err != nil { 12299 var snapshot bytes.Buffer 12300 io.Copy(&snapshot, ringBuffer) 12301 err = &smithy.DeserializationError{ 12302 Err: fmt.Errorf("failed to decode response body, %w", err), 12303 Snapshot: snapshot.Bytes(), 12304 } 12305 return err 12306 } 12307 12308 errorBody.Seek(0, io.SeekStart) 12309 if len(code) != 0 { 12310 errorCode = restjson.SanitizeErrorCode(code) 12311 } 12312 if len(message) != 0 { 12313 errorMessage = message 12314 } 12315 12316 switch { 12317 case strings.EqualFold("InternalServiceException", errorCode): 12318 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12319 12320 case strings.EqualFold("InvalidParameterException", errorCode): 12321 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12322 12323 case strings.EqualFold("InvalidRequestException", errorCode): 12324 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12325 12326 case strings.EqualFold("ResourceNotFoundException", errorCode): 12327 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12328 12329 case strings.EqualFold("ThrottlingException", errorCode): 12330 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12331 12332 default: 12333 genericError := &smithy.GenericAPIError{ 12334 Code: errorCode, 12335 Message: errorMessage, 12336 } 12337 return genericError 12338 12339 } 12340} 12341 12342type awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue struct { 12343} 12344 12345func (*awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) ID() string { 12346 return "OperationDeserializer" 12347} 12348 12349func (m *awsRestjson1_deserializeOpUpdateRoutingProfileDefaultOutboundQueue) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12350 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12351) { 12352 out, metadata, err = next.HandleDeserialize(ctx, in) 12353 if err != nil { 12354 return out, metadata, err 12355 } 12356 12357 response, ok := out.RawResponse.(*smithyhttp.Response) 12358 if !ok { 12359 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12360 } 12361 12362 if response.StatusCode < 200 || response.StatusCode >= 300 { 12363 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(response, &metadata) 12364 } 12365 output := &UpdateRoutingProfileDefaultOutboundQueueOutput{} 12366 out.Result = output 12367 12368 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12369 return out, metadata, &smithy.DeserializationError{ 12370 Err: fmt.Errorf("failed to discard response body, %w", err), 12371 } 12372 } 12373 12374 return out, metadata, err 12375} 12376 12377func awsRestjson1_deserializeOpErrorUpdateRoutingProfileDefaultOutboundQueue(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12378 var errorBuffer bytes.Buffer 12379 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12380 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12381 } 12382 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12383 12384 errorCode := "UnknownError" 12385 errorMessage := errorCode 12386 12387 code := response.Header.Get("X-Amzn-ErrorType") 12388 if len(code) != 0 { 12389 errorCode = restjson.SanitizeErrorCode(code) 12390 } 12391 12392 var buff [1024]byte 12393 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12394 12395 body := io.TeeReader(errorBody, ringBuffer) 12396 decoder := json.NewDecoder(body) 12397 decoder.UseNumber() 12398 code, message, err := restjson.GetErrorInfo(decoder) 12399 if err != nil { 12400 var snapshot bytes.Buffer 12401 io.Copy(&snapshot, ringBuffer) 12402 err = &smithy.DeserializationError{ 12403 Err: fmt.Errorf("failed to decode response body, %w", err), 12404 Snapshot: snapshot.Bytes(), 12405 } 12406 return err 12407 } 12408 12409 errorBody.Seek(0, io.SeekStart) 12410 if len(code) != 0 { 12411 errorCode = restjson.SanitizeErrorCode(code) 12412 } 12413 if len(message) != 0 { 12414 errorMessage = message 12415 } 12416 12417 switch { 12418 case strings.EqualFold("InternalServiceException", errorCode): 12419 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12420 12421 case strings.EqualFold("InvalidParameterException", errorCode): 12422 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12423 12424 case strings.EqualFold("InvalidRequestException", errorCode): 12425 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12426 12427 case strings.EqualFold("ResourceNotFoundException", errorCode): 12428 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12429 12430 case strings.EqualFold("ThrottlingException", errorCode): 12431 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12432 12433 default: 12434 genericError := &smithy.GenericAPIError{ 12435 Code: errorCode, 12436 Message: errorMessage, 12437 } 12438 return genericError 12439 12440 } 12441} 12442 12443type awsRestjson1_deserializeOpUpdateRoutingProfileName struct { 12444} 12445 12446func (*awsRestjson1_deserializeOpUpdateRoutingProfileName) ID() string { 12447 return "OperationDeserializer" 12448} 12449 12450func (m *awsRestjson1_deserializeOpUpdateRoutingProfileName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12451 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12452) { 12453 out, metadata, err = next.HandleDeserialize(ctx, in) 12454 if err != nil { 12455 return out, metadata, err 12456 } 12457 12458 response, ok := out.RawResponse.(*smithyhttp.Response) 12459 if !ok { 12460 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12461 } 12462 12463 if response.StatusCode < 200 || response.StatusCode >= 300 { 12464 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(response, &metadata) 12465 } 12466 output := &UpdateRoutingProfileNameOutput{} 12467 out.Result = output 12468 12469 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12470 return out, metadata, &smithy.DeserializationError{ 12471 Err: fmt.Errorf("failed to discard response body, %w", err), 12472 } 12473 } 12474 12475 return out, metadata, err 12476} 12477 12478func awsRestjson1_deserializeOpErrorUpdateRoutingProfileName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12479 var errorBuffer bytes.Buffer 12480 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12481 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12482 } 12483 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12484 12485 errorCode := "UnknownError" 12486 errorMessage := errorCode 12487 12488 code := response.Header.Get("X-Amzn-ErrorType") 12489 if len(code) != 0 { 12490 errorCode = restjson.SanitizeErrorCode(code) 12491 } 12492 12493 var buff [1024]byte 12494 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12495 12496 body := io.TeeReader(errorBody, ringBuffer) 12497 decoder := json.NewDecoder(body) 12498 decoder.UseNumber() 12499 code, message, err := restjson.GetErrorInfo(decoder) 12500 if err != nil { 12501 var snapshot bytes.Buffer 12502 io.Copy(&snapshot, ringBuffer) 12503 err = &smithy.DeserializationError{ 12504 Err: fmt.Errorf("failed to decode response body, %w", err), 12505 Snapshot: snapshot.Bytes(), 12506 } 12507 return err 12508 } 12509 12510 errorBody.Seek(0, io.SeekStart) 12511 if len(code) != 0 { 12512 errorCode = restjson.SanitizeErrorCode(code) 12513 } 12514 if len(message) != 0 { 12515 errorMessage = message 12516 } 12517 12518 switch { 12519 case strings.EqualFold("DuplicateResourceException", errorCode): 12520 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 12521 12522 case strings.EqualFold("InternalServiceException", errorCode): 12523 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12524 12525 case strings.EqualFold("InvalidParameterException", errorCode): 12526 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12527 12528 case strings.EqualFold("InvalidRequestException", errorCode): 12529 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12530 12531 case strings.EqualFold("ResourceNotFoundException", errorCode): 12532 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12533 12534 case strings.EqualFold("ThrottlingException", errorCode): 12535 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12536 12537 default: 12538 genericError := &smithy.GenericAPIError{ 12539 Code: errorCode, 12540 Message: errorMessage, 12541 } 12542 return genericError 12543 12544 } 12545} 12546 12547type awsRestjson1_deserializeOpUpdateRoutingProfileQueues struct { 12548} 12549 12550func (*awsRestjson1_deserializeOpUpdateRoutingProfileQueues) ID() string { 12551 return "OperationDeserializer" 12552} 12553 12554func (m *awsRestjson1_deserializeOpUpdateRoutingProfileQueues) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12555 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12556) { 12557 out, metadata, err = next.HandleDeserialize(ctx, in) 12558 if err != nil { 12559 return out, metadata, err 12560 } 12561 12562 response, ok := out.RawResponse.(*smithyhttp.Response) 12563 if !ok { 12564 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12565 } 12566 12567 if response.StatusCode < 200 || response.StatusCode >= 300 { 12568 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoutingProfileQueues(response, &metadata) 12569 } 12570 output := &UpdateRoutingProfileQueuesOutput{} 12571 out.Result = output 12572 12573 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12574 return out, metadata, &smithy.DeserializationError{ 12575 Err: fmt.Errorf("failed to discard response body, %w", err), 12576 } 12577 } 12578 12579 return out, metadata, err 12580} 12581 12582func awsRestjson1_deserializeOpErrorUpdateRoutingProfileQueues(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12583 var errorBuffer bytes.Buffer 12584 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12585 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12586 } 12587 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12588 12589 errorCode := "UnknownError" 12590 errorMessage := errorCode 12591 12592 code := response.Header.Get("X-Amzn-ErrorType") 12593 if len(code) != 0 { 12594 errorCode = restjson.SanitizeErrorCode(code) 12595 } 12596 12597 var buff [1024]byte 12598 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12599 12600 body := io.TeeReader(errorBody, ringBuffer) 12601 decoder := json.NewDecoder(body) 12602 decoder.UseNumber() 12603 code, message, err := restjson.GetErrorInfo(decoder) 12604 if err != nil { 12605 var snapshot bytes.Buffer 12606 io.Copy(&snapshot, ringBuffer) 12607 err = &smithy.DeserializationError{ 12608 Err: fmt.Errorf("failed to decode response body, %w", err), 12609 Snapshot: snapshot.Bytes(), 12610 } 12611 return err 12612 } 12613 12614 errorBody.Seek(0, io.SeekStart) 12615 if len(code) != 0 { 12616 errorCode = restjson.SanitizeErrorCode(code) 12617 } 12618 if len(message) != 0 { 12619 errorMessage = message 12620 } 12621 12622 switch { 12623 case strings.EqualFold("InternalServiceException", errorCode): 12624 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12625 12626 case strings.EqualFold("InvalidParameterException", errorCode): 12627 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12628 12629 case strings.EqualFold("InvalidRequestException", errorCode): 12630 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12631 12632 case strings.EqualFold("ResourceNotFoundException", errorCode): 12633 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12634 12635 case strings.EqualFold("ThrottlingException", errorCode): 12636 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12637 12638 default: 12639 genericError := &smithy.GenericAPIError{ 12640 Code: errorCode, 12641 Message: errorMessage, 12642 } 12643 return genericError 12644 12645 } 12646} 12647 12648type awsRestjson1_deserializeOpUpdateUserHierarchy struct { 12649} 12650 12651func (*awsRestjson1_deserializeOpUpdateUserHierarchy) ID() string { 12652 return "OperationDeserializer" 12653} 12654 12655func (m *awsRestjson1_deserializeOpUpdateUserHierarchy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12656 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12657) { 12658 out, metadata, err = next.HandleDeserialize(ctx, in) 12659 if err != nil { 12660 return out, metadata, err 12661 } 12662 12663 response, ok := out.RawResponse.(*smithyhttp.Response) 12664 if !ok { 12665 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12666 } 12667 12668 if response.StatusCode < 200 || response.StatusCode >= 300 { 12669 return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchy(response, &metadata) 12670 } 12671 output := &UpdateUserHierarchyOutput{} 12672 out.Result = output 12673 12674 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12675 return out, metadata, &smithy.DeserializationError{ 12676 Err: fmt.Errorf("failed to discard response body, %w", err), 12677 } 12678 } 12679 12680 return out, metadata, err 12681} 12682 12683func awsRestjson1_deserializeOpErrorUpdateUserHierarchy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12684 var errorBuffer bytes.Buffer 12685 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12686 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12687 } 12688 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12689 12690 errorCode := "UnknownError" 12691 errorMessage := errorCode 12692 12693 code := response.Header.Get("X-Amzn-ErrorType") 12694 if len(code) != 0 { 12695 errorCode = restjson.SanitizeErrorCode(code) 12696 } 12697 12698 var buff [1024]byte 12699 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12700 12701 body := io.TeeReader(errorBody, ringBuffer) 12702 decoder := json.NewDecoder(body) 12703 decoder.UseNumber() 12704 code, message, err := restjson.GetErrorInfo(decoder) 12705 if err != nil { 12706 var snapshot bytes.Buffer 12707 io.Copy(&snapshot, ringBuffer) 12708 err = &smithy.DeserializationError{ 12709 Err: fmt.Errorf("failed to decode response body, %w", err), 12710 Snapshot: snapshot.Bytes(), 12711 } 12712 return err 12713 } 12714 12715 errorBody.Seek(0, io.SeekStart) 12716 if len(code) != 0 { 12717 errorCode = restjson.SanitizeErrorCode(code) 12718 } 12719 if len(message) != 0 { 12720 errorMessage = message 12721 } 12722 12723 switch { 12724 case strings.EqualFold("InternalServiceException", errorCode): 12725 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12726 12727 case strings.EqualFold("InvalidParameterException", errorCode): 12728 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12729 12730 case strings.EqualFold("InvalidRequestException", errorCode): 12731 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12732 12733 case strings.EqualFold("ResourceNotFoundException", errorCode): 12734 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12735 12736 case strings.EqualFold("ThrottlingException", errorCode): 12737 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12738 12739 default: 12740 genericError := &smithy.GenericAPIError{ 12741 Code: errorCode, 12742 Message: errorMessage, 12743 } 12744 return genericError 12745 12746 } 12747} 12748 12749type awsRestjson1_deserializeOpUpdateUserHierarchyGroupName struct { 12750} 12751 12752func (*awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) ID() string { 12753 return "OperationDeserializer" 12754} 12755 12756func (m *awsRestjson1_deserializeOpUpdateUserHierarchyGroupName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12757 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12758) { 12759 out, metadata, err = next.HandleDeserialize(ctx, in) 12760 if err != nil { 12761 return out, metadata, err 12762 } 12763 12764 response, ok := out.RawResponse.(*smithyhttp.Response) 12765 if !ok { 12766 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12767 } 12768 12769 if response.StatusCode < 200 || response.StatusCode >= 300 { 12770 return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchyGroupName(response, &metadata) 12771 } 12772 output := &UpdateUserHierarchyGroupNameOutput{} 12773 out.Result = output 12774 12775 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12776 return out, metadata, &smithy.DeserializationError{ 12777 Err: fmt.Errorf("failed to discard response body, %w", err), 12778 } 12779 } 12780 12781 return out, metadata, err 12782} 12783 12784func awsRestjson1_deserializeOpErrorUpdateUserHierarchyGroupName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12785 var errorBuffer bytes.Buffer 12786 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12787 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12788 } 12789 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12790 12791 errorCode := "UnknownError" 12792 errorMessage := errorCode 12793 12794 code := response.Header.Get("X-Amzn-ErrorType") 12795 if len(code) != 0 { 12796 errorCode = restjson.SanitizeErrorCode(code) 12797 } 12798 12799 var buff [1024]byte 12800 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12801 12802 body := io.TeeReader(errorBody, ringBuffer) 12803 decoder := json.NewDecoder(body) 12804 decoder.UseNumber() 12805 code, message, err := restjson.GetErrorInfo(decoder) 12806 if err != nil { 12807 var snapshot bytes.Buffer 12808 io.Copy(&snapshot, ringBuffer) 12809 err = &smithy.DeserializationError{ 12810 Err: fmt.Errorf("failed to decode response body, %w", err), 12811 Snapshot: snapshot.Bytes(), 12812 } 12813 return err 12814 } 12815 12816 errorBody.Seek(0, io.SeekStart) 12817 if len(code) != 0 { 12818 errorCode = restjson.SanitizeErrorCode(code) 12819 } 12820 if len(message) != 0 { 12821 errorMessage = message 12822 } 12823 12824 switch { 12825 case strings.EqualFold("DuplicateResourceException", errorCode): 12826 return awsRestjson1_deserializeErrorDuplicateResourceException(response, errorBody) 12827 12828 case strings.EqualFold("InternalServiceException", errorCode): 12829 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12830 12831 case strings.EqualFold("InvalidParameterException", errorCode): 12832 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12833 12834 case strings.EqualFold("InvalidRequestException", errorCode): 12835 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12836 12837 case strings.EqualFold("ResourceNotFoundException", errorCode): 12838 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12839 12840 case strings.EqualFold("ThrottlingException", errorCode): 12841 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12842 12843 default: 12844 genericError := &smithy.GenericAPIError{ 12845 Code: errorCode, 12846 Message: errorMessage, 12847 } 12848 return genericError 12849 12850 } 12851} 12852 12853type awsRestjson1_deserializeOpUpdateUserHierarchyStructure struct { 12854} 12855 12856func (*awsRestjson1_deserializeOpUpdateUserHierarchyStructure) ID() string { 12857 return "OperationDeserializer" 12858} 12859 12860func (m *awsRestjson1_deserializeOpUpdateUserHierarchyStructure) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12861 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12862) { 12863 out, metadata, err = next.HandleDeserialize(ctx, in) 12864 if err != nil { 12865 return out, metadata, err 12866 } 12867 12868 response, ok := out.RawResponse.(*smithyhttp.Response) 12869 if !ok { 12870 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12871 } 12872 12873 if response.StatusCode < 200 || response.StatusCode >= 300 { 12874 return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(response, &metadata) 12875 } 12876 output := &UpdateUserHierarchyStructureOutput{} 12877 out.Result = output 12878 12879 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12880 return out, metadata, &smithy.DeserializationError{ 12881 Err: fmt.Errorf("failed to discard response body, %w", err), 12882 } 12883 } 12884 12885 return out, metadata, err 12886} 12887 12888func awsRestjson1_deserializeOpErrorUpdateUserHierarchyStructure(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12889 var errorBuffer bytes.Buffer 12890 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12891 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12892 } 12893 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12894 12895 errorCode := "UnknownError" 12896 errorMessage := errorCode 12897 12898 code := response.Header.Get("X-Amzn-ErrorType") 12899 if len(code) != 0 { 12900 errorCode = restjson.SanitizeErrorCode(code) 12901 } 12902 12903 var buff [1024]byte 12904 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12905 12906 body := io.TeeReader(errorBody, ringBuffer) 12907 decoder := json.NewDecoder(body) 12908 decoder.UseNumber() 12909 code, message, err := restjson.GetErrorInfo(decoder) 12910 if err != nil { 12911 var snapshot bytes.Buffer 12912 io.Copy(&snapshot, ringBuffer) 12913 err = &smithy.DeserializationError{ 12914 Err: fmt.Errorf("failed to decode response body, %w", err), 12915 Snapshot: snapshot.Bytes(), 12916 } 12917 return err 12918 } 12919 12920 errorBody.Seek(0, io.SeekStart) 12921 if len(code) != 0 { 12922 errorCode = restjson.SanitizeErrorCode(code) 12923 } 12924 if len(message) != 0 { 12925 errorMessage = message 12926 } 12927 12928 switch { 12929 case strings.EqualFold("InternalServiceException", errorCode): 12930 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 12931 12932 case strings.EqualFold("InvalidParameterException", errorCode): 12933 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 12934 12935 case strings.EqualFold("InvalidRequestException", errorCode): 12936 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 12937 12938 case strings.EqualFold("ResourceInUseException", errorCode): 12939 return awsRestjson1_deserializeErrorResourceInUseException(response, errorBody) 12940 12941 case strings.EqualFold("ResourceNotFoundException", errorCode): 12942 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 12943 12944 case strings.EqualFold("ThrottlingException", errorCode): 12945 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 12946 12947 default: 12948 genericError := &smithy.GenericAPIError{ 12949 Code: errorCode, 12950 Message: errorMessage, 12951 } 12952 return genericError 12953 12954 } 12955} 12956 12957type awsRestjson1_deserializeOpUpdateUserIdentityInfo struct { 12958} 12959 12960func (*awsRestjson1_deserializeOpUpdateUserIdentityInfo) ID() string { 12961 return "OperationDeserializer" 12962} 12963 12964func (m *awsRestjson1_deserializeOpUpdateUserIdentityInfo) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12965 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12966) { 12967 out, metadata, err = next.HandleDeserialize(ctx, in) 12968 if err != nil { 12969 return out, metadata, err 12970 } 12971 12972 response, ok := out.RawResponse.(*smithyhttp.Response) 12973 if !ok { 12974 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12975 } 12976 12977 if response.StatusCode < 200 || response.StatusCode >= 300 { 12978 return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(response, &metadata) 12979 } 12980 output := &UpdateUserIdentityInfoOutput{} 12981 out.Result = output 12982 12983 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 12984 return out, metadata, &smithy.DeserializationError{ 12985 Err: fmt.Errorf("failed to discard response body, %w", err), 12986 } 12987 } 12988 12989 return out, metadata, err 12990} 12991 12992func awsRestjson1_deserializeOpErrorUpdateUserIdentityInfo(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12993 var errorBuffer bytes.Buffer 12994 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12995 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12996 } 12997 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12998 12999 errorCode := "UnknownError" 13000 errorMessage := errorCode 13001 13002 code := response.Header.Get("X-Amzn-ErrorType") 13003 if len(code) != 0 { 13004 errorCode = restjson.SanitizeErrorCode(code) 13005 } 13006 13007 var buff [1024]byte 13008 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13009 13010 body := io.TeeReader(errorBody, ringBuffer) 13011 decoder := json.NewDecoder(body) 13012 decoder.UseNumber() 13013 code, message, err := restjson.GetErrorInfo(decoder) 13014 if err != nil { 13015 var snapshot bytes.Buffer 13016 io.Copy(&snapshot, ringBuffer) 13017 err = &smithy.DeserializationError{ 13018 Err: fmt.Errorf("failed to decode response body, %w", err), 13019 Snapshot: snapshot.Bytes(), 13020 } 13021 return err 13022 } 13023 13024 errorBody.Seek(0, io.SeekStart) 13025 if len(code) != 0 { 13026 errorCode = restjson.SanitizeErrorCode(code) 13027 } 13028 if len(message) != 0 { 13029 errorMessage = message 13030 } 13031 13032 switch { 13033 case strings.EqualFold("InternalServiceException", errorCode): 13034 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 13035 13036 case strings.EqualFold("InvalidParameterException", errorCode): 13037 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 13038 13039 case strings.EqualFold("InvalidRequestException", errorCode): 13040 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 13041 13042 case strings.EqualFold("ResourceNotFoundException", errorCode): 13043 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 13044 13045 case strings.EqualFold("ThrottlingException", errorCode): 13046 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 13047 13048 default: 13049 genericError := &smithy.GenericAPIError{ 13050 Code: errorCode, 13051 Message: errorMessage, 13052 } 13053 return genericError 13054 13055 } 13056} 13057 13058type awsRestjson1_deserializeOpUpdateUserPhoneConfig struct { 13059} 13060 13061func (*awsRestjson1_deserializeOpUpdateUserPhoneConfig) ID() string { 13062 return "OperationDeserializer" 13063} 13064 13065func (m *awsRestjson1_deserializeOpUpdateUserPhoneConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 13066 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 13067) { 13068 out, metadata, err = next.HandleDeserialize(ctx, in) 13069 if err != nil { 13070 return out, metadata, err 13071 } 13072 13073 response, ok := out.RawResponse.(*smithyhttp.Response) 13074 if !ok { 13075 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 13076 } 13077 13078 if response.StatusCode < 200 || response.StatusCode >= 300 { 13079 return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserPhoneConfig(response, &metadata) 13080 } 13081 output := &UpdateUserPhoneConfigOutput{} 13082 out.Result = output 13083 13084 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 13085 return out, metadata, &smithy.DeserializationError{ 13086 Err: fmt.Errorf("failed to discard response body, %w", err), 13087 } 13088 } 13089 13090 return out, metadata, err 13091} 13092 13093func awsRestjson1_deserializeOpErrorUpdateUserPhoneConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 13094 var errorBuffer bytes.Buffer 13095 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 13096 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 13097 } 13098 errorBody := bytes.NewReader(errorBuffer.Bytes()) 13099 13100 errorCode := "UnknownError" 13101 errorMessage := errorCode 13102 13103 code := response.Header.Get("X-Amzn-ErrorType") 13104 if len(code) != 0 { 13105 errorCode = restjson.SanitizeErrorCode(code) 13106 } 13107 13108 var buff [1024]byte 13109 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13110 13111 body := io.TeeReader(errorBody, ringBuffer) 13112 decoder := json.NewDecoder(body) 13113 decoder.UseNumber() 13114 code, message, err := restjson.GetErrorInfo(decoder) 13115 if err != nil { 13116 var snapshot bytes.Buffer 13117 io.Copy(&snapshot, ringBuffer) 13118 err = &smithy.DeserializationError{ 13119 Err: fmt.Errorf("failed to decode response body, %w", err), 13120 Snapshot: snapshot.Bytes(), 13121 } 13122 return err 13123 } 13124 13125 errorBody.Seek(0, io.SeekStart) 13126 if len(code) != 0 { 13127 errorCode = restjson.SanitizeErrorCode(code) 13128 } 13129 if len(message) != 0 { 13130 errorMessage = message 13131 } 13132 13133 switch { 13134 case strings.EqualFold("InternalServiceException", errorCode): 13135 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 13136 13137 case strings.EqualFold("InvalidParameterException", errorCode): 13138 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 13139 13140 case strings.EqualFold("InvalidRequestException", errorCode): 13141 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 13142 13143 case strings.EqualFold("ResourceNotFoundException", errorCode): 13144 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 13145 13146 case strings.EqualFold("ThrottlingException", errorCode): 13147 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 13148 13149 default: 13150 genericError := &smithy.GenericAPIError{ 13151 Code: errorCode, 13152 Message: errorMessage, 13153 } 13154 return genericError 13155 13156 } 13157} 13158 13159type awsRestjson1_deserializeOpUpdateUserRoutingProfile struct { 13160} 13161 13162func (*awsRestjson1_deserializeOpUpdateUserRoutingProfile) ID() string { 13163 return "OperationDeserializer" 13164} 13165 13166func (m *awsRestjson1_deserializeOpUpdateUserRoutingProfile) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 13167 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 13168) { 13169 out, metadata, err = next.HandleDeserialize(ctx, in) 13170 if err != nil { 13171 return out, metadata, err 13172 } 13173 13174 response, ok := out.RawResponse.(*smithyhttp.Response) 13175 if !ok { 13176 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 13177 } 13178 13179 if response.StatusCode < 200 || response.StatusCode >= 300 { 13180 return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserRoutingProfile(response, &metadata) 13181 } 13182 output := &UpdateUserRoutingProfileOutput{} 13183 out.Result = output 13184 13185 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 13186 return out, metadata, &smithy.DeserializationError{ 13187 Err: fmt.Errorf("failed to discard response body, %w", err), 13188 } 13189 } 13190 13191 return out, metadata, err 13192} 13193 13194func awsRestjson1_deserializeOpErrorUpdateUserRoutingProfile(response *smithyhttp.Response, metadata *middleware.Metadata) error { 13195 var errorBuffer bytes.Buffer 13196 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 13197 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 13198 } 13199 errorBody := bytes.NewReader(errorBuffer.Bytes()) 13200 13201 errorCode := "UnknownError" 13202 errorMessage := errorCode 13203 13204 code := response.Header.Get("X-Amzn-ErrorType") 13205 if len(code) != 0 { 13206 errorCode = restjson.SanitizeErrorCode(code) 13207 } 13208 13209 var buff [1024]byte 13210 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13211 13212 body := io.TeeReader(errorBody, ringBuffer) 13213 decoder := json.NewDecoder(body) 13214 decoder.UseNumber() 13215 code, message, err := restjson.GetErrorInfo(decoder) 13216 if err != nil { 13217 var snapshot bytes.Buffer 13218 io.Copy(&snapshot, ringBuffer) 13219 err = &smithy.DeserializationError{ 13220 Err: fmt.Errorf("failed to decode response body, %w", err), 13221 Snapshot: snapshot.Bytes(), 13222 } 13223 return err 13224 } 13225 13226 errorBody.Seek(0, io.SeekStart) 13227 if len(code) != 0 { 13228 errorCode = restjson.SanitizeErrorCode(code) 13229 } 13230 if len(message) != 0 { 13231 errorMessage = message 13232 } 13233 13234 switch { 13235 case strings.EqualFold("InternalServiceException", errorCode): 13236 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 13237 13238 case strings.EqualFold("InvalidParameterException", errorCode): 13239 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 13240 13241 case strings.EqualFold("InvalidRequestException", errorCode): 13242 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 13243 13244 case strings.EqualFold("ResourceNotFoundException", errorCode): 13245 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 13246 13247 case strings.EqualFold("ThrottlingException", errorCode): 13248 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 13249 13250 default: 13251 genericError := &smithy.GenericAPIError{ 13252 Code: errorCode, 13253 Message: errorMessage, 13254 } 13255 return genericError 13256 13257 } 13258} 13259 13260type awsRestjson1_deserializeOpUpdateUserSecurityProfiles struct { 13261} 13262 13263func (*awsRestjson1_deserializeOpUpdateUserSecurityProfiles) ID() string { 13264 return "OperationDeserializer" 13265} 13266 13267func (m *awsRestjson1_deserializeOpUpdateUserSecurityProfiles) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 13268 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 13269) { 13270 out, metadata, err = next.HandleDeserialize(ctx, in) 13271 if err != nil { 13272 return out, metadata, err 13273 } 13274 13275 response, ok := out.RawResponse.(*smithyhttp.Response) 13276 if !ok { 13277 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 13278 } 13279 13280 if response.StatusCode < 200 || response.StatusCode >= 300 { 13281 return out, metadata, awsRestjson1_deserializeOpErrorUpdateUserSecurityProfiles(response, &metadata) 13282 } 13283 output := &UpdateUserSecurityProfilesOutput{} 13284 out.Result = output 13285 13286 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 13287 return out, metadata, &smithy.DeserializationError{ 13288 Err: fmt.Errorf("failed to discard response body, %w", err), 13289 } 13290 } 13291 13292 return out, metadata, err 13293} 13294 13295func awsRestjson1_deserializeOpErrorUpdateUserSecurityProfiles(response *smithyhttp.Response, metadata *middleware.Metadata) error { 13296 var errorBuffer bytes.Buffer 13297 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 13298 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 13299 } 13300 errorBody := bytes.NewReader(errorBuffer.Bytes()) 13301 13302 errorCode := "UnknownError" 13303 errorMessage := errorCode 13304 13305 code := response.Header.Get("X-Amzn-ErrorType") 13306 if len(code) != 0 { 13307 errorCode = restjson.SanitizeErrorCode(code) 13308 } 13309 13310 var buff [1024]byte 13311 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13312 13313 body := io.TeeReader(errorBody, ringBuffer) 13314 decoder := json.NewDecoder(body) 13315 decoder.UseNumber() 13316 code, message, err := restjson.GetErrorInfo(decoder) 13317 if err != nil { 13318 var snapshot bytes.Buffer 13319 io.Copy(&snapshot, ringBuffer) 13320 err = &smithy.DeserializationError{ 13321 Err: fmt.Errorf("failed to decode response body, %w", err), 13322 Snapshot: snapshot.Bytes(), 13323 } 13324 return err 13325 } 13326 13327 errorBody.Seek(0, io.SeekStart) 13328 if len(code) != 0 { 13329 errorCode = restjson.SanitizeErrorCode(code) 13330 } 13331 if len(message) != 0 { 13332 errorMessage = message 13333 } 13334 13335 switch { 13336 case strings.EqualFold("InternalServiceException", errorCode): 13337 return awsRestjson1_deserializeErrorInternalServiceException(response, errorBody) 13338 13339 case strings.EqualFold("InvalidParameterException", errorCode): 13340 return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) 13341 13342 case strings.EqualFold("InvalidRequestException", errorCode): 13343 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 13344 13345 case strings.EqualFold("ResourceNotFoundException", errorCode): 13346 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 13347 13348 case strings.EqualFold("ThrottlingException", errorCode): 13349 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 13350 13351 default: 13352 genericError := &smithy.GenericAPIError{ 13353 Code: errorCode, 13354 Message: errorMessage, 13355 } 13356 return genericError 13357 13358 } 13359} 13360 13361func awsRestjson1_deserializeErrorContactFlowNotPublishedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13362 output := &types.ContactFlowNotPublishedException{} 13363 var buff [1024]byte 13364 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13365 13366 body := io.TeeReader(errorBody, ringBuffer) 13367 decoder := json.NewDecoder(body) 13368 decoder.UseNumber() 13369 var shape interface{} 13370 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13371 var snapshot bytes.Buffer 13372 io.Copy(&snapshot, ringBuffer) 13373 err = &smithy.DeserializationError{ 13374 Err: fmt.Errorf("failed to decode response body, %w", err), 13375 Snapshot: snapshot.Bytes(), 13376 } 13377 return err 13378 } 13379 13380 err := awsRestjson1_deserializeDocumentContactFlowNotPublishedException(&output, shape) 13381 13382 if err != nil { 13383 var snapshot bytes.Buffer 13384 io.Copy(&snapshot, ringBuffer) 13385 err = &smithy.DeserializationError{ 13386 Err: fmt.Errorf("failed to decode response body, %w", err), 13387 Snapshot: snapshot.Bytes(), 13388 } 13389 return err 13390 } 13391 13392 errorBody.Seek(0, io.SeekStart) 13393 13394 return output 13395} 13396 13397func awsRestjson1_deserializeErrorContactNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13398 output := &types.ContactNotFoundException{} 13399 var buff [1024]byte 13400 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13401 13402 body := io.TeeReader(errorBody, ringBuffer) 13403 decoder := json.NewDecoder(body) 13404 decoder.UseNumber() 13405 var shape interface{} 13406 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13407 var snapshot bytes.Buffer 13408 io.Copy(&snapshot, ringBuffer) 13409 err = &smithy.DeserializationError{ 13410 Err: fmt.Errorf("failed to decode response body, %w", err), 13411 Snapshot: snapshot.Bytes(), 13412 } 13413 return err 13414 } 13415 13416 err := awsRestjson1_deserializeDocumentContactNotFoundException(&output, shape) 13417 13418 if err != nil { 13419 var snapshot bytes.Buffer 13420 io.Copy(&snapshot, ringBuffer) 13421 err = &smithy.DeserializationError{ 13422 Err: fmt.Errorf("failed to decode response body, %w", err), 13423 Snapshot: snapshot.Bytes(), 13424 } 13425 return err 13426 } 13427 13428 errorBody.Seek(0, io.SeekStart) 13429 13430 return output 13431} 13432 13433func awsRestjson1_deserializeErrorDestinationNotAllowedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13434 output := &types.DestinationNotAllowedException{} 13435 var buff [1024]byte 13436 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13437 13438 body := io.TeeReader(errorBody, ringBuffer) 13439 decoder := json.NewDecoder(body) 13440 decoder.UseNumber() 13441 var shape interface{} 13442 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13443 var snapshot bytes.Buffer 13444 io.Copy(&snapshot, ringBuffer) 13445 err = &smithy.DeserializationError{ 13446 Err: fmt.Errorf("failed to decode response body, %w", err), 13447 Snapshot: snapshot.Bytes(), 13448 } 13449 return err 13450 } 13451 13452 err := awsRestjson1_deserializeDocumentDestinationNotAllowedException(&output, shape) 13453 13454 if err != nil { 13455 var snapshot bytes.Buffer 13456 io.Copy(&snapshot, ringBuffer) 13457 err = &smithy.DeserializationError{ 13458 Err: fmt.Errorf("failed to decode response body, %w", err), 13459 Snapshot: snapshot.Bytes(), 13460 } 13461 return err 13462 } 13463 13464 errorBody.Seek(0, io.SeekStart) 13465 13466 return output 13467} 13468 13469func awsRestjson1_deserializeErrorDuplicateResourceException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13470 output := &types.DuplicateResourceException{} 13471 var buff [1024]byte 13472 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13473 13474 body := io.TeeReader(errorBody, ringBuffer) 13475 decoder := json.NewDecoder(body) 13476 decoder.UseNumber() 13477 var shape interface{} 13478 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13479 var snapshot bytes.Buffer 13480 io.Copy(&snapshot, ringBuffer) 13481 err = &smithy.DeserializationError{ 13482 Err: fmt.Errorf("failed to decode response body, %w", err), 13483 Snapshot: snapshot.Bytes(), 13484 } 13485 return err 13486 } 13487 13488 err := awsRestjson1_deserializeDocumentDuplicateResourceException(&output, shape) 13489 13490 if err != nil { 13491 var snapshot bytes.Buffer 13492 io.Copy(&snapshot, ringBuffer) 13493 err = &smithy.DeserializationError{ 13494 Err: fmt.Errorf("failed to decode response body, %w", err), 13495 Snapshot: snapshot.Bytes(), 13496 } 13497 return err 13498 } 13499 13500 errorBody.Seek(0, io.SeekStart) 13501 13502 return output 13503} 13504 13505func awsRestjson1_deserializeErrorInternalServiceException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13506 output := &types.InternalServiceException{} 13507 var buff [1024]byte 13508 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13509 13510 body := io.TeeReader(errorBody, ringBuffer) 13511 decoder := json.NewDecoder(body) 13512 decoder.UseNumber() 13513 var shape interface{} 13514 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13515 var snapshot bytes.Buffer 13516 io.Copy(&snapshot, ringBuffer) 13517 err = &smithy.DeserializationError{ 13518 Err: fmt.Errorf("failed to decode response body, %w", err), 13519 Snapshot: snapshot.Bytes(), 13520 } 13521 return err 13522 } 13523 13524 err := awsRestjson1_deserializeDocumentInternalServiceException(&output, shape) 13525 13526 if err != nil { 13527 var snapshot bytes.Buffer 13528 io.Copy(&snapshot, ringBuffer) 13529 err = &smithy.DeserializationError{ 13530 Err: fmt.Errorf("failed to decode response body, %w", err), 13531 Snapshot: snapshot.Bytes(), 13532 } 13533 return err 13534 } 13535 13536 errorBody.Seek(0, io.SeekStart) 13537 13538 return output 13539} 13540 13541func awsRestjson1_deserializeErrorInvalidContactFlowException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13542 output := &types.InvalidContactFlowException{} 13543 var buff [1024]byte 13544 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13545 13546 body := io.TeeReader(errorBody, ringBuffer) 13547 decoder := json.NewDecoder(body) 13548 decoder.UseNumber() 13549 var shape interface{} 13550 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13551 var snapshot bytes.Buffer 13552 io.Copy(&snapshot, ringBuffer) 13553 err = &smithy.DeserializationError{ 13554 Err: fmt.Errorf("failed to decode response body, %w", err), 13555 Snapshot: snapshot.Bytes(), 13556 } 13557 return err 13558 } 13559 13560 err := awsRestjson1_deserializeDocumentInvalidContactFlowException(&output, shape) 13561 13562 if err != nil { 13563 var snapshot bytes.Buffer 13564 io.Copy(&snapshot, ringBuffer) 13565 err = &smithy.DeserializationError{ 13566 Err: fmt.Errorf("failed to decode response body, %w", err), 13567 Snapshot: snapshot.Bytes(), 13568 } 13569 return err 13570 } 13571 13572 errorBody.Seek(0, io.SeekStart) 13573 13574 return output 13575} 13576 13577func awsRestjson1_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13578 output := &types.InvalidParameterException{} 13579 var buff [1024]byte 13580 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13581 13582 body := io.TeeReader(errorBody, ringBuffer) 13583 decoder := json.NewDecoder(body) 13584 decoder.UseNumber() 13585 var shape interface{} 13586 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13587 var snapshot bytes.Buffer 13588 io.Copy(&snapshot, ringBuffer) 13589 err = &smithy.DeserializationError{ 13590 Err: fmt.Errorf("failed to decode response body, %w", err), 13591 Snapshot: snapshot.Bytes(), 13592 } 13593 return err 13594 } 13595 13596 err := awsRestjson1_deserializeDocumentInvalidParameterException(&output, shape) 13597 13598 if err != nil { 13599 var snapshot bytes.Buffer 13600 io.Copy(&snapshot, ringBuffer) 13601 err = &smithy.DeserializationError{ 13602 Err: fmt.Errorf("failed to decode response body, %w", err), 13603 Snapshot: snapshot.Bytes(), 13604 } 13605 return err 13606 } 13607 13608 errorBody.Seek(0, io.SeekStart) 13609 13610 return output 13611} 13612 13613func awsRestjson1_deserializeErrorInvalidRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13614 output := &types.InvalidRequestException{} 13615 var buff [1024]byte 13616 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13617 13618 body := io.TeeReader(errorBody, ringBuffer) 13619 decoder := json.NewDecoder(body) 13620 decoder.UseNumber() 13621 var shape interface{} 13622 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13623 var snapshot bytes.Buffer 13624 io.Copy(&snapshot, ringBuffer) 13625 err = &smithy.DeserializationError{ 13626 Err: fmt.Errorf("failed to decode response body, %w", err), 13627 Snapshot: snapshot.Bytes(), 13628 } 13629 return err 13630 } 13631 13632 err := awsRestjson1_deserializeDocumentInvalidRequestException(&output, shape) 13633 13634 if err != nil { 13635 var snapshot bytes.Buffer 13636 io.Copy(&snapshot, ringBuffer) 13637 err = &smithy.DeserializationError{ 13638 Err: fmt.Errorf("failed to decode response body, %w", err), 13639 Snapshot: snapshot.Bytes(), 13640 } 13641 return err 13642 } 13643 13644 errorBody.Seek(0, io.SeekStart) 13645 13646 return output 13647} 13648 13649func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13650 output := &types.LimitExceededException{} 13651 var buff [1024]byte 13652 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13653 13654 body := io.TeeReader(errorBody, ringBuffer) 13655 decoder := json.NewDecoder(body) 13656 decoder.UseNumber() 13657 var shape interface{} 13658 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13659 var snapshot bytes.Buffer 13660 io.Copy(&snapshot, ringBuffer) 13661 err = &smithy.DeserializationError{ 13662 Err: fmt.Errorf("failed to decode response body, %w", err), 13663 Snapshot: snapshot.Bytes(), 13664 } 13665 return err 13666 } 13667 13668 err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) 13669 13670 if err != nil { 13671 var snapshot bytes.Buffer 13672 io.Copy(&snapshot, ringBuffer) 13673 err = &smithy.DeserializationError{ 13674 Err: fmt.Errorf("failed to decode response body, %w", err), 13675 Snapshot: snapshot.Bytes(), 13676 } 13677 return err 13678 } 13679 13680 errorBody.Seek(0, io.SeekStart) 13681 13682 return output 13683} 13684 13685func awsRestjson1_deserializeErrorOutboundContactNotPermittedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13686 output := &types.OutboundContactNotPermittedException{} 13687 var buff [1024]byte 13688 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13689 13690 body := io.TeeReader(errorBody, ringBuffer) 13691 decoder := json.NewDecoder(body) 13692 decoder.UseNumber() 13693 var shape interface{} 13694 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13695 var snapshot bytes.Buffer 13696 io.Copy(&snapshot, ringBuffer) 13697 err = &smithy.DeserializationError{ 13698 Err: fmt.Errorf("failed to decode response body, %w", err), 13699 Snapshot: snapshot.Bytes(), 13700 } 13701 return err 13702 } 13703 13704 err := awsRestjson1_deserializeDocumentOutboundContactNotPermittedException(&output, shape) 13705 13706 if err != nil { 13707 var snapshot bytes.Buffer 13708 io.Copy(&snapshot, ringBuffer) 13709 err = &smithy.DeserializationError{ 13710 Err: fmt.Errorf("failed to decode response body, %w", err), 13711 Snapshot: snapshot.Bytes(), 13712 } 13713 return err 13714 } 13715 13716 errorBody.Seek(0, io.SeekStart) 13717 13718 return output 13719} 13720 13721func awsRestjson1_deserializeErrorResourceConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13722 output := &types.ResourceConflictException{} 13723 var buff [1024]byte 13724 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13725 13726 body := io.TeeReader(errorBody, ringBuffer) 13727 decoder := json.NewDecoder(body) 13728 decoder.UseNumber() 13729 var shape interface{} 13730 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13731 var snapshot bytes.Buffer 13732 io.Copy(&snapshot, ringBuffer) 13733 err = &smithy.DeserializationError{ 13734 Err: fmt.Errorf("failed to decode response body, %w", err), 13735 Snapshot: snapshot.Bytes(), 13736 } 13737 return err 13738 } 13739 13740 err := awsRestjson1_deserializeDocumentResourceConflictException(&output, shape) 13741 13742 if err != nil { 13743 var snapshot bytes.Buffer 13744 io.Copy(&snapshot, ringBuffer) 13745 err = &smithy.DeserializationError{ 13746 Err: fmt.Errorf("failed to decode response body, %w", err), 13747 Snapshot: snapshot.Bytes(), 13748 } 13749 return err 13750 } 13751 13752 errorBody.Seek(0, io.SeekStart) 13753 13754 return output 13755} 13756 13757func awsRestjson1_deserializeErrorResourceInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13758 output := &types.ResourceInUseException{} 13759 var buff [1024]byte 13760 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13761 13762 body := io.TeeReader(errorBody, ringBuffer) 13763 decoder := json.NewDecoder(body) 13764 decoder.UseNumber() 13765 var shape interface{} 13766 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13767 var snapshot bytes.Buffer 13768 io.Copy(&snapshot, ringBuffer) 13769 err = &smithy.DeserializationError{ 13770 Err: fmt.Errorf("failed to decode response body, %w", err), 13771 Snapshot: snapshot.Bytes(), 13772 } 13773 return err 13774 } 13775 13776 err := awsRestjson1_deserializeDocumentResourceInUseException(&output, shape) 13777 13778 if err != nil { 13779 var snapshot bytes.Buffer 13780 io.Copy(&snapshot, ringBuffer) 13781 err = &smithy.DeserializationError{ 13782 Err: fmt.Errorf("failed to decode response body, %w", err), 13783 Snapshot: snapshot.Bytes(), 13784 } 13785 return err 13786 } 13787 13788 errorBody.Seek(0, io.SeekStart) 13789 13790 return output 13791} 13792 13793func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13794 output := &types.ResourceNotFoundException{} 13795 var buff [1024]byte 13796 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13797 13798 body := io.TeeReader(errorBody, ringBuffer) 13799 decoder := json.NewDecoder(body) 13800 decoder.UseNumber() 13801 var shape interface{} 13802 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13803 var snapshot bytes.Buffer 13804 io.Copy(&snapshot, ringBuffer) 13805 err = &smithy.DeserializationError{ 13806 Err: fmt.Errorf("failed to decode response body, %w", err), 13807 Snapshot: snapshot.Bytes(), 13808 } 13809 return err 13810 } 13811 13812 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 13813 13814 if err != nil { 13815 var snapshot bytes.Buffer 13816 io.Copy(&snapshot, ringBuffer) 13817 err = &smithy.DeserializationError{ 13818 Err: fmt.Errorf("failed to decode response body, %w", err), 13819 Snapshot: snapshot.Bytes(), 13820 } 13821 return err 13822 } 13823 13824 errorBody.Seek(0, io.SeekStart) 13825 13826 return output 13827} 13828 13829func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13830 output := &types.ServiceQuotaExceededException{} 13831 var buff [1024]byte 13832 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13833 13834 body := io.TeeReader(errorBody, ringBuffer) 13835 decoder := json.NewDecoder(body) 13836 decoder.UseNumber() 13837 var shape interface{} 13838 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13839 var snapshot bytes.Buffer 13840 io.Copy(&snapshot, ringBuffer) 13841 err = &smithy.DeserializationError{ 13842 Err: fmt.Errorf("failed to decode response body, %w", err), 13843 Snapshot: snapshot.Bytes(), 13844 } 13845 return err 13846 } 13847 13848 err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) 13849 13850 if err != nil { 13851 var snapshot bytes.Buffer 13852 io.Copy(&snapshot, ringBuffer) 13853 err = &smithy.DeserializationError{ 13854 Err: fmt.Errorf("failed to decode response body, %w", err), 13855 Snapshot: snapshot.Bytes(), 13856 } 13857 return err 13858 } 13859 13860 errorBody.Seek(0, io.SeekStart) 13861 13862 return output 13863} 13864 13865func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13866 output := &types.ThrottlingException{} 13867 var buff [1024]byte 13868 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13869 13870 body := io.TeeReader(errorBody, ringBuffer) 13871 decoder := json.NewDecoder(body) 13872 decoder.UseNumber() 13873 var shape interface{} 13874 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13875 var snapshot bytes.Buffer 13876 io.Copy(&snapshot, ringBuffer) 13877 err = &smithy.DeserializationError{ 13878 Err: fmt.Errorf("failed to decode response body, %w", err), 13879 Snapshot: snapshot.Bytes(), 13880 } 13881 return err 13882 } 13883 13884 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 13885 13886 if err != nil { 13887 var snapshot bytes.Buffer 13888 io.Copy(&snapshot, ringBuffer) 13889 err = &smithy.DeserializationError{ 13890 Err: fmt.Errorf("failed to decode response body, %w", err), 13891 Snapshot: snapshot.Bytes(), 13892 } 13893 return err 13894 } 13895 13896 errorBody.Seek(0, io.SeekStart) 13897 13898 return output 13899} 13900 13901func awsRestjson1_deserializeErrorUserNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13902 output := &types.UserNotFoundException{} 13903 var buff [1024]byte 13904 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13905 13906 body := io.TeeReader(errorBody, ringBuffer) 13907 decoder := json.NewDecoder(body) 13908 decoder.UseNumber() 13909 var shape interface{} 13910 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13911 var snapshot bytes.Buffer 13912 io.Copy(&snapshot, ringBuffer) 13913 err = &smithy.DeserializationError{ 13914 Err: fmt.Errorf("failed to decode response body, %w", err), 13915 Snapshot: snapshot.Bytes(), 13916 } 13917 return err 13918 } 13919 13920 err := awsRestjson1_deserializeDocumentUserNotFoundException(&output, shape) 13921 13922 if err != nil { 13923 var snapshot bytes.Buffer 13924 io.Copy(&snapshot, ringBuffer) 13925 err = &smithy.DeserializationError{ 13926 Err: fmt.Errorf("failed to decode response body, %w", err), 13927 Snapshot: snapshot.Bytes(), 13928 } 13929 return err 13930 } 13931 13932 errorBody.Seek(0, io.SeekStart) 13933 13934 return output 13935} 13936 13937func awsRestjson1_deserializeDocumentAttribute(v **types.Attribute, value interface{}) error { 13938 if v == nil { 13939 return fmt.Errorf("unexpected nil of type %T", v) 13940 } 13941 if value == nil { 13942 return nil 13943 } 13944 13945 shape, ok := value.(map[string]interface{}) 13946 if !ok { 13947 return fmt.Errorf("unexpected JSON type %v", value) 13948 } 13949 13950 var sv *types.Attribute 13951 if *v == nil { 13952 sv = &types.Attribute{} 13953 } else { 13954 sv = *v 13955 } 13956 13957 for key, value := range shape { 13958 switch key { 13959 case "AttributeType": 13960 if value != nil { 13961 jtv, ok := value.(string) 13962 if !ok { 13963 return fmt.Errorf("expected InstanceAttributeType to be of type string, got %T instead", value) 13964 } 13965 sv.AttributeType = types.InstanceAttributeType(jtv) 13966 } 13967 13968 case "Value": 13969 if value != nil { 13970 jtv, ok := value.(string) 13971 if !ok { 13972 return fmt.Errorf("expected InstanceAttributeValue to be of type string, got %T instead", value) 13973 } 13974 sv.Value = ptr.String(jtv) 13975 } 13976 13977 default: 13978 _, _ = key, value 13979 13980 } 13981 } 13982 *v = sv 13983 return nil 13984} 13985 13986func awsRestjson1_deserializeDocumentAttributes(v *map[string]string, value interface{}) error { 13987 if v == nil { 13988 return fmt.Errorf("unexpected nil of type %T", v) 13989 } 13990 if value == nil { 13991 return nil 13992 } 13993 13994 shape, ok := value.(map[string]interface{}) 13995 if !ok { 13996 return fmt.Errorf("unexpected JSON type %v", value) 13997 } 13998 13999 var mv map[string]string 14000 if *v == nil { 14001 mv = map[string]string{} 14002 } else { 14003 mv = *v 14004 } 14005 14006 for key, value := range shape { 14007 var parsedVal string 14008 if value != nil { 14009 jtv, ok := value.(string) 14010 if !ok { 14011 return fmt.Errorf("expected AttributeValue to be of type string, got %T instead", value) 14012 } 14013 parsedVal = jtv 14014 } 14015 mv[key] = parsedVal 14016 14017 } 14018 *v = mv 14019 return nil 14020} 14021 14022func awsRestjson1_deserializeDocumentAttributesList(v *[]types.Attribute, value interface{}) error { 14023 if v == nil { 14024 return fmt.Errorf("unexpected nil of type %T", v) 14025 } 14026 if value == nil { 14027 return nil 14028 } 14029 14030 shape, ok := value.([]interface{}) 14031 if !ok { 14032 return fmt.Errorf("unexpected JSON type %v", value) 14033 } 14034 14035 var cv []types.Attribute 14036 if *v == nil { 14037 cv = []types.Attribute{} 14038 } else { 14039 cv = *v 14040 } 14041 14042 for _, value := range shape { 14043 var col types.Attribute 14044 destAddr := &col 14045 if err := awsRestjson1_deserializeDocumentAttribute(&destAddr, value); err != nil { 14046 return err 14047 } 14048 col = *destAddr 14049 cv = append(cv, col) 14050 14051 } 14052 *v = cv 14053 return nil 14054} 14055 14056func awsRestjson1_deserializeDocumentContactFlow(v **types.ContactFlow, value interface{}) error { 14057 if v == nil { 14058 return fmt.Errorf("unexpected nil of type %T", v) 14059 } 14060 if value == nil { 14061 return nil 14062 } 14063 14064 shape, ok := value.(map[string]interface{}) 14065 if !ok { 14066 return fmt.Errorf("unexpected JSON type %v", value) 14067 } 14068 14069 var sv *types.ContactFlow 14070 if *v == nil { 14071 sv = &types.ContactFlow{} 14072 } else { 14073 sv = *v 14074 } 14075 14076 for key, value := range shape { 14077 switch key { 14078 case "Arn": 14079 if value != nil { 14080 jtv, ok := value.(string) 14081 if !ok { 14082 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 14083 } 14084 sv.Arn = ptr.String(jtv) 14085 } 14086 14087 case "Content": 14088 if value != nil { 14089 jtv, ok := value.(string) 14090 if !ok { 14091 return fmt.Errorf("expected ContactFlowContent to be of type string, got %T instead", value) 14092 } 14093 sv.Content = ptr.String(jtv) 14094 } 14095 14096 case "Description": 14097 if value != nil { 14098 jtv, ok := value.(string) 14099 if !ok { 14100 return fmt.Errorf("expected ContactFlowDescription to be of type string, got %T instead", value) 14101 } 14102 sv.Description = ptr.String(jtv) 14103 } 14104 14105 case "Id": 14106 if value != nil { 14107 jtv, ok := value.(string) 14108 if !ok { 14109 return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) 14110 } 14111 sv.Id = ptr.String(jtv) 14112 } 14113 14114 case "Name": 14115 if value != nil { 14116 jtv, ok := value.(string) 14117 if !ok { 14118 return fmt.Errorf("expected ContactFlowName to be of type string, got %T instead", value) 14119 } 14120 sv.Name = ptr.String(jtv) 14121 } 14122 14123 case "Tags": 14124 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 14125 return err 14126 } 14127 14128 case "Type": 14129 if value != nil { 14130 jtv, ok := value.(string) 14131 if !ok { 14132 return fmt.Errorf("expected ContactFlowType to be of type string, got %T instead", value) 14133 } 14134 sv.Type = types.ContactFlowType(jtv) 14135 } 14136 14137 default: 14138 _, _ = key, value 14139 14140 } 14141 } 14142 *v = sv 14143 return nil 14144} 14145 14146func awsRestjson1_deserializeDocumentContactFlowNotPublishedException(v **types.ContactFlowNotPublishedException, value interface{}) error { 14147 if v == nil { 14148 return fmt.Errorf("unexpected nil of type %T", v) 14149 } 14150 if value == nil { 14151 return nil 14152 } 14153 14154 shape, ok := value.(map[string]interface{}) 14155 if !ok { 14156 return fmt.Errorf("unexpected JSON type %v", value) 14157 } 14158 14159 var sv *types.ContactFlowNotPublishedException 14160 if *v == nil { 14161 sv = &types.ContactFlowNotPublishedException{} 14162 } else { 14163 sv = *v 14164 } 14165 14166 for key, value := range shape { 14167 switch key { 14168 case "Message": 14169 if value != nil { 14170 jtv, ok := value.(string) 14171 if !ok { 14172 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 14173 } 14174 sv.Message = ptr.String(jtv) 14175 } 14176 14177 default: 14178 _, _ = key, value 14179 14180 } 14181 } 14182 *v = sv 14183 return nil 14184} 14185 14186func awsRestjson1_deserializeDocumentContactFlowSummary(v **types.ContactFlowSummary, value interface{}) error { 14187 if v == nil { 14188 return fmt.Errorf("unexpected nil of type %T", v) 14189 } 14190 if value == nil { 14191 return nil 14192 } 14193 14194 shape, ok := value.(map[string]interface{}) 14195 if !ok { 14196 return fmt.Errorf("unexpected JSON type %v", value) 14197 } 14198 14199 var sv *types.ContactFlowSummary 14200 if *v == nil { 14201 sv = &types.ContactFlowSummary{} 14202 } else { 14203 sv = *v 14204 } 14205 14206 for key, value := range shape { 14207 switch key { 14208 case "Arn": 14209 if value != nil { 14210 jtv, ok := value.(string) 14211 if !ok { 14212 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 14213 } 14214 sv.Arn = ptr.String(jtv) 14215 } 14216 14217 case "ContactFlowType": 14218 if value != nil { 14219 jtv, ok := value.(string) 14220 if !ok { 14221 return fmt.Errorf("expected ContactFlowType to be of type string, got %T instead", value) 14222 } 14223 sv.ContactFlowType = types.ContactFlowType(jtv) 14224 } 14225 14226 case "Id": 14227 if value != nil { 14228 jtv, ok := value.(string) 14229 if !ok { 14230 return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) 14231 } 14232 sv.Id = ptr.String(jtv) 14233 } 14234 14235 case "Name": 14236 if value != nil { 14237 jtv, ok := value.(string) 14238 if !ok { 14239 return fmt.Errorf("expected ContactFlowName to be of type string, got %T instead", value) 14240 } 14241 sv.Name = ptr.String(jtv) 14242 } 14243 14244 default: 14245 _, _ = key, value 14246 14247 } 14248 } 14249 *v = sv 14250 return nil 14251} 14252 14253func awsRestjson1_deserializeDocumentContactFlowSummaryList(v *[]types.ContactFlowSummary, value interface{}) error { 14254 if v == nil { 14255 return fmt.Errorf("unexpected nil of type %T", v) 14256 } 14257 if value == nil { 14258 return nil 14259 } 14260 14261 shape, ok := value.([]interface{}) 14262 if !ok { 14263 return fmt.Errorf("unexpected JSON type %v", value) 14264 } 14265 14266 var cv []types.ContactFlowSummary 14267 if *v == nil { 14268 cv = []types.ContactFlowSummary{} 14269 } else { 14270 cv = *v 14271 } 14272 14273 for _, value := range shape { 14274 var col types.ContactFlowSummary 14275 destAddr := &col 14276 if err := awsRestjson1_deserializeDocumentContactFlowSummary(&destAddr, value); err != nil { 14277 return err 14278 } 14279 col = *destAddr 14280 cv = append(cv, col) 14281 14282 } 14283 *v = cv 14284 return nil 14285} 14286 14287func awsRestjson1_deserializeDocumentContactNotFoundException(v **types.ContactNotFoundException, value interface{}) error { 14288 if v == nil { 14289 return fmt.Errorf("unexpected nil of type %T", v) 14290 } 14291 if value == nil { 14292 return nil 14293 } 14294 14295 shape, ok := value.(map[string]interface{}) 14296 if !ok { 14297 return fmt.Errorf("unexpected JSON type %v", value) 14298 } 14299 14300 var sv *types.ContactNotFoundException 14301 if *v == nil { 14302 sv = &types.ContactNotFoundException{} 14303 } else { 14304 sv = *v 14305 } 14306 14307 for key, value := range shape { 14308 switch key { 14309 case "Message": 14310 if value != nil { 14311 jtv, ok := value.(string) 14312 if !ok { 14313 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 14314 } 14315 sv.Message = ptr.String(jtv) 14316 } 14317 14318 default: 14319 _, _ = key, value 14320 14321 } 14322 } 14323 *v = sv 14324 return nil 14325} 14326 14327func awsRestjson1_deserializeDocumentCredentials(v **types.Credentials, value interface{}) error { 14328 if v == nil { 14329 return fmt.Errorf("unexpected nil of type %T", v) 14330 } 14331 if value == nil { 14332 return nil 14333 } 14334 14335 shape, ok := value.(map[string]interface{}) 14336 if !ok { 14337 return fmt.Errorf("unexpected JSON type %v", value) 14338 } 14339 14340 var sv *types.Credentials 14341 if *v == nil { 14342 sv = &types.Credentials{} 14343 } else { 14344 sv = *v 14345 } 14346 14347 for key, value := range shape { 14348 switch key { 14349 case "AccessToken": 14350 if value != nil { 14351 jtv, ok := value.(string) 14352 if !ok { 14353 return fmt.Errorf("expected SecurityToken to be of type string, got %T instead", value) 14354 } 14355 sv.AccessToken = ptr.String(jtv) 14356 } 14357 14358 case "AccessTokenExpiration": 14359 if value != nil { 14360 jtv, ok := value.(json.Number) 14361 if !ok { 14362 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 14363 } 14364 f64, err := jtv.Float64() 14365 if err != nil { 14366 return err 14367 } 14368 sv.AccessTokenExpiration = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14369 } 14370 14371 case "RefreshToken": 14372 if value != nil { 14373 jtv, ok := value.(string) 14374 if !ok { 14375 return fmt.Errorf("expected SecurityToken to be of type string, got %T instead", value) 14376 } 14377 sv.RefreshToken = ptr.String(jtv) 14378 } 14379 14380 case "RefreshTokenExpiration": 14381 if value != nil { 14382 jtv, ok := value.(json.Number) 14383 if !ok { 14384 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 14385 } 14386 f64, err := jtv.Float64() 14387 if err != nil { 14388 return err 14389 } 14390 sv.RefreshTokenExpiration = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14391 } 14392 14393 default: 14394 _, _ = key, value 14395 14396 } 14397 } 14398 *v = sv 14399 return nil 14400} 14401 14402func awsRestjson1_deserializeDocumentCurrentMetric(v **types.CurrentMetric, value interface{}) error { 14403 if v == nil { 14404 return fmt.Errorf("unexpected nil of type %T", v) 14405 } 14406 if value == nil { 14407 return nil 14408 } 14409 14410 shape, ok := value.(map[string]interface{}) 14411 if !ok { 14412 return fmt.Errorf("unexpected JSON type %v", value) 14413 } 14414 14415 var sv *types.CurrentMetric 14416 if *v == nil { 14417 sv = &types.CurrentMetric{} 14418 } else { 14419 sv = *v 14420 } 14421 14422 for key, value := range shape { 14423 switch key { 14424 case "Name": 14425 if value != nil { 14426 jtv, ok := value.(string) 14427 if !ok { 14428 return fmt.Errorf("expected CurrentMetricName to be of type string, got %T instead", value) 14429 } 14430 sv.Name = types.CurrentMetricName(jtv) 14431 } 14432 14433 case "Unit": 14434 if value != nil { 14435 jtv, ok := value.(string) 14436 if !ok { 14437 return fmt.Errorf("expected Unit to be of type string, got %T instead", value) 14438 } 14439 sv.Unit = types.Unit(jtv) 14440 } 14441 14442 default: 14443 _, _ = key, value 14444 14445 } 14446 } 14447 *v = sv 14448 return nil 14449} 14450 14451func awsRestjson1_deserializeDocumentCurrentMetricData(v **types.CurrentMetricData, value interface{}) error { 14452 if v == nil { 14453 return fmt.Errorf("unexpected nil of type %T", v) 14454 } 14455 if value == nil { 14456 return nil 14457 } 14458 14459 shape, ok := value.(map[string]interface{}) 14460 if !ok { 14461 return fmt.Errorf("unexpected JSON type %v", value) 14462 } 14463 14464 var sv *types.CurrentMetricData 14465 if *v == nil { 14466 sv = &types.CurrentMetricData{} 14467 } else { 14468 sv = *v 14469 } 14470 14471 for key, value := range shape { 14472 switch key { 14473 case "Metric": 14474 if err := awsRestjson1_deserializeDocumentCurrentMetric(&sv.Metric, value); err != nil { 14475 return err 14476 } 14477 14478 case "Value": 14479 if value != nil { 14480 jtv, ok := value.(json.Number) 14481 if !ok { 14482 return fmt.Errorf("expected Value to be json.Number, got %T instead", value) 14483 } 14484 f64, err := jtv.Float64() 14485 if err != nil { 14486 return err 14487 } 14488 sv.Value = ptr.Float64(f64) 14489 } 14490 14491 default: 14492 _, _ = key, value 14493 14494 } 14495 } 14496 *v = sv 14497 return nil 14498} 14499 14500func awsRestjson1_deserializeDocumentCurrentMetricDataCollections(v *[]types.CurrentMetricData, 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.CurrentMetricData 14514 if *v == nil { 14515 cv = []types.CurrentMetricData{} 14516 } else { 14517 cv = *v 14518 } 14519 14520 for _, value := range shape { 14521 var col types.CurrentMetricData 14522 destAddr := &col 14523 if err := awsRestjson1_deserializeDocumentCurrentMetricData(&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_deserializeDocumentCurrentMetricResult(v **types.CurrentMetricResult, 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.(map[string]interface{}) 14543 if !ok { 14544 return fmt.Errorf("unexpected JSON type %v", value) 14545 } 14546 14547 var sv *types.CurrentMetricResult 14548 if *v == nil { 14549 sv = &types.CurrentMetricResult{} 14550 } else { 14551 sv = *v 14552 } 14553 14554 for key, value := range shape { 14555 switch key { 14556 case "Collections": 14557 if err := awsRestjson1_deserializeDocumentCurrentMetricDataCollections(&sv.Collections, value); err != nil { 14558 return err 14559 } 14560 14561 case "Dimensions": 14562 if err := awsRestjson1_deserializeDocumentDimensions(&sv.Dimensions, value); err != nil { 14563 return err 14564 } 14565 14566 default: 14567 _, _ = key, value 14568 14569 } 14570 } 14571 *v = sv 14572 return nil 14573} 14574 14575func awsRestjson1_deserializeDocumentCurrentMetricResults(v *[]types.CurrentMetricResult, value interface{}) error { 14576 if v == nil { 14577 return fmt.Errorf("unexpected nil of type %T", v) 14578 } 14579 if value == nil { 14580 return nil 14581 } 14582 14583 shape, ok := value.([]interface{}) 14584 if !ok { 14585 return fmt.Errorf("unexpected JSON type %v", value) 14586 } 14587 14588 var cv []types.CurrentMetricResult 14589 if *v == nil { 14590 cv = []types.CurrentMetricResult{} 14591 } else { 14592 cv = *v 14593 } 14594 14595 for _, value := range shape { 14596 var col types.CurrentMetricResult 14597 destAddr := &col 14598 if err := awsRestjson1_deserializeDocumentCurrentMetricResult(&destAddr, value); err != nil { 14599 return err 14600 } 14601 col = *destAddr 14602 cv = append(cv, col) 14603 14604 } 14605 *v = cv 14606 return nil 14607} 14608 14609func awsRestjson1_deserializeDocumentDestinationNotAllowedException(v **types.DestinationNotAllowedException, value interface{}) error { 14610 if v == nil { 14611 return fmt.Errorf("unexpected nil of type %T", v) 14612 } 14613 if value == nil { 14614 return nil 14615 } 14616 14617 shape, ok := value.(map[string]interface{}) 14618 if !ok { 14619 return fmt.Errorf("unexpected JSON type %v", value) 14620 } 14621 14622 var sv *types.DestinationNotAllowedException 14623 if *v == nil { 14624 sv = &types.DestinationNotAllowedException{} 14625 } else { 14626 sv = *v 14627 } 14628 14629 for key, value := range shape { 14630 switch key { 14631 case "Message": 14632 if value != nil { 14633 jtv, ok := value.(string) 14634 if !ok { 14635 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 14636 } 14637 sv.Message = ptr.String(jtv) 14638 } 14639 14640 default: 14641 _, _ = key, value 14642 14643 } 14644 } 14645 *v = sv 14646 return nil 14647} 14648 14649func awsRestjson1_deserializeDocumentDimensions(v **types.Dimensions, value interface{}) error { 14650 if v == nil { 14651 return fmt.Errorf("unexpected nil of type %T", v) 14652 } 14653 if value == nil { 14654 return nil 14655 } 14656 14657 shape, ok := value.(map[string]interface{}) 14658 if !ok { 14659 return fmt.Errorf("unexpected JSON type %v", value) 14660 } 14661 14662 var sv *types.Dimensions 14663 if *v == nil { 14664 sv = &types.Dimensions{} 14665 } else { 14666 sv = *v 14667 } 14668 14669 for key, value := range shape { 14670 switch key { 14671 case "Channel": 14672 if value != nil { 14673 jtv, ok := value.(string) 14674 if !ok { 14675 return fmt.Errorf("expected Channel to be of type string, got %T instead", value) 14676 } 14677 sv.Channel = types.Channel(jtv) 14678 } 14679 14680 case "Queue": 14681 if err := awsRestjson1_deserializeDocumentQueueReference(&sv.Queue, value); err != nil { 14682 return err 14683 } 14684 14685 default: 14686 _, _ = key, value 14687 14688 } 14689 } 14690 *v = sv 14691 return nil 14692} 14693 14694func awsRestjson1_deserializeDocumentDuplicateResourceException(v **types.DuplicateResourceException, value interface{}) error { 14695 if v == nil { 14696 return fmt.Errorf("unexpected nil of type %T", v) 14697 } 14698 if value == nil { 14699 return nil 14700 } 14701 14702 shape, ok := value.(map[string]interface{}) 14703 if !ok { 14704 return fmt.Errorf("unexpected JSON type %v", value) 14705 } 14706 14707 var sv *types.DuplicateResourceException 14708 if *v == nil { 14709 sv = &types.DuplicateResourceException{} 14710 } else { 14711 sv = *v 14712 } 14713 14714 for key, value := range shape { 14715 switch key { 14716 case "Message": 14717 if value != nil { 14718 jtv, ok := value.(string) 14719 if !ok { 14720 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 14721 } 14722 sv.Message = ptr.String(jtv) 14723 } 14724 14725 default: 14726 _, _ = key, value 14727 14728 } 14729 } 14730 *v = sv 14731 return nil 14732} 14733 14734func awsRestjson1_deserializeDocumentEncryptionConfig(v **types.EncryptionConfig, value interface{}) error { 14735 if v == nil { 14736 return fmt.Errorf("unexpected nil of type %T", v) 14737 } 14738 if value == nil { 14739 return nil 14740 } 14741 14742 shape, ok := value.(map[string]interface{}) 14743 if !ok { 14744 return fmt.Errorf("unexpected JSON type %v", value) 14745 } 14746 14747 var sv *types.EncryptionConfig 14748 if *v == nil { 14749 sv = &types.EncryptionConfig{} 14750 } else { 14751 sv = *v 14752 } 14753 14754 for key, value := range shape { 14755 switch key { 14756 case "EncryptionType": 14757 if value != nil { 14758 jtv, ok := value.(string) 14759 if !ok { 14760 return fmt.Errorf("expected EncryptionType to be of type string, got %T instead", value) 14761 } 14762 sv.EncryptionType = types.EncryptionType(jtv) 14763 } 14764 14765 case "KeyId": 14766 if value != nil { 14767 jtv, ok := value.(string) 14768 if !ok { 14769 return fmt.Errorf("expected KeyId to be of type string, got %T instead", value) 14770 } 14771 sv.KeyId = ptr.String(jtv) 14772 } 14773 14774 default: 14775 _, _ = key, value 14776 14777 } 14778 } 14779 *v = sv 14780 return nil 14781} 14782 14783func awsRestjson1_deserializeDocumentFunctionArnsList(v *[]string, value interface{}) error { 14784 if v == nil { 14785 return fmt.Errorf("unexpected nil of type %T", v) 14786 } 14787 if value == nil { 14788 return nil 14789 } 14790 14791 shape, ok := value.([]interface{}) 14792 if !ok { 14793 return fmt.Errorf("unexpected JSON type %v", value) 14794 } 14795 14796 var cv []string 14797 if *v == nil { 14798 cv = []string{} 14799 } else { 14800 cv = *v 14801 } 14802 14803 for _, value := range shape { 14804 var col string 14805 if value != nil { 14806 jtv, ok := value.(string) 14807 if !ok { 14808 return fmt.Errorf("expected FunctionArn to be of type string, got %T instead", value) 14809 } 14810 col = jtv 14811 } 14812 cv = append(cv, col) 14813 14814 } 14815 *v = cv 14816 return nil 14817} 14818 14819func awsRestjson1_deserializeDocumentHierarchyGroup(v **types.HierarchyGroup, value interface{}) error { 14820 if v == nil { 14821 return fmt.Errorf("unexpected nil of type %T", v) 14822 } 14823 if value == nil { 14824 return nil 14825 } 14826 14827 shape, ok := value.(map[string]interface{}) 14828 if !ok { 14829 return fmt.Errorf("unexpected JSON type %v", value) 14830 } 14831 14832 var sv *types.HierarchyGroup 14833 if *v == nil { 14834 sv = &types.HierarchyGroup{} 14835 } else { 14836 sv = *v 14837 } 14838 14839 for key, value := range shape { 14840 switch key { 14841 case "Arn": 14842 if value != nil { 14843 jtv, ok := value.(string) 14844 if !ok { 14845 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 14846 } 14847 sv.Arn = ptr.String(jtv) 14848 } 14849 14850 case "HierarchyPath": 14851 if err := awsRestjson1_deserializeDocumentHierarchyPath(&sv.HierarchyPath, value); err != nil { 14852 return err 14853 } 14854 14855 case "Id": 14856 if value != nil { 14857 jtv, ok := value.(string) 14858 if !ok { 14859 return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) 14860 } 14861 sv.Id = ptr.String(jtv) 14862 } 14863 14864 case "LevelId": 14865 if value != nil { 14866 jtv, ok := value.(string) 14867 if !ok { 14868 return fmt.Errorf("expected HierarchyLevelId to be of type string, got %T instead", value) 14869 } 14870 sv.LevelId = ptr.String(jtv) 14871 } 14872 14873 case "Name": 14874 if value != nil { 14875 jtv, ok := value.(string) 14876 if !ok { 14877 return fmt.Errorf("expected HierarchyGroupName to be of type string, got %T instead", value) 14878 } 14879 sv.Name = ptr.String(jtv) 14880 } 14881 14882 default: 14883 _, _ = key, value 14884 14885 } 14886 } 14887 *v = sv 14888 return nil 14889} 14890 14891func awsRestjson1_deserializeDocumentHierarchyGroupSummary(v **types.HierarchyGroupSummary, value interface{}) error { 14892 if v == nil { 14893 return fmt.Errorf("unexpected nil of type %T", v) 14894 } 14895 if value == nil { 14896 return nil 14897 } 14898 14899 shape, ok := value.(map[string]interface{}) 14900 if !ok { 14901 return fmt.Errorf("unexpected JSON type %v", value) 14902 } 14903 14904 var sv *types.HierarchyGroupSummary 14905 if *v == nil { 14906 sv = &types.HierarchyGroupSummary{} 14907 } else { 14908 sv = *v 14909 } 14910 14911 for key, value := range shape { 14912 switch key { 14913 case "Arn": 14914 if value != nil { 14915 jtv, ok := value.(string) 14916 if !ok { 14917 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 14918 } 14919 sv.Arn = ptr.String(jtv) 14920 } 14921 14922 case "Id": 14923 if value != nil { 14924 jtv, ok := value.(string) 14925 if !ok { 14926 return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) 14927 } 14928 sv.Id = ptr.String(jtv) 14929 } 14930 14931 case "Name": 14932 if value != nil { 14933 jtv, ok := value.(string) 14934 if !ok { 14935 return fmt.Errorf("expected HierarchyGroupName to be of type string, got %T instead", value) 14936 } 14937 sv.Name = ptr.String(jtv) 14938 } 14939 14940 default: 14941 _, _ = key, value 14942 14943 } 14944 } 14945 *v = sv 14946 return nil 14947} 14948 14949func awsRestjson1_deserializeDocumentHierarchyGroupSummaryList(v *[]types.HierarchyGroupSummary, value interface{}) error { 14950 if v == nil { 14951 return fmt.Errorf("unexpected nil of type %T", v) 14952 } 14953 if value == nil { 14954 return nil 14955 } 14956 14957 shape, ok := value.([]interface{}) 14958 if !ok { 14959 return fmt.Errorf("unexpected JSON type %v", value) 14960 } 14961 14962 var cv []types.HierarchyGroupSummary 14963 if *v == nil { 14964 cv = []types.HierarchyGroupSummary{} 14965 } else { 14966 cv = *v 14967 } 14968 14969 for _, value := range shape { 14970 var col types.HierarchyGroupSummary 14971 destAddr := &col 14972 if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&destAddr, value); err != nil { 14973 return err 14974 } 14975 col = *destAddr 14976 cv = append(cv, col) 14977 14978 } 14979 *v = cv 14980 return nil 14981} 14982 14983func awsRestjson1_deserializeDocumentHierarchyLevel(v **types.HierarchyLevel, value interface{}) error { 14984 if v == nil { 14985 return fmt.Errorf("unexpected nil of type %T", v) 14986 } 14987 if value == nil { 14988 return nil 14989 } 14990 14991 shape, ok := value.(map[string]interface{}) 14992 if !ok { 14993 return fmt.Errorf("unexpected JSON type %v", value) 14994 } 14995 14996 var sv *types.HierarchyLevel 14997 if *v == nil { 14998 sv = &types.HierarchyLevel{} 14999 } else { 15000 sv = *v 15001 } 15002 15003 for key, value := range shape { 15004 switch key { 15005 case "Arn": 15006 if value != nil { 15007 jtv, ok := value.(string) 15008 if !ok { 15009 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 15010 } 15011 sv.Arn = ptr.String(jtv) 15012 } 15013 15014 case "Id": 15015 if value != nil { 15016 jtv, ok := value.(string) 15017 if !ok { 15018 return fmt.Errorf("expected HierarchyLevelId to be of type string, got %T instead", value) 15019 } 15020 sv.Id = ptr.String(jtv) 15021 } 15022 15023 case "Name": 15024 if value != nil { 15025 jtv, ok := value.(string) 15026 if !ok { 15027 return fmt.Errorf("expected HierarchyLevelName to be of type string, got %T instead", value) 15028 } 15029 sv.Name = ptr.String(jtv) 15030 } 15031 15032 default: 15033 _, _ = key, value 15034 15035 } 15036 } 15037 *v = sv 15038 return nil 15039} 15040 15041func awsRestjson1_deserializeDocumentHierarchyPath(v **types.HierarchyPath, value interface{}) error { 15042 if v == nil { 15043 return fmt.Errorf("unexpected nil of type %T", v) 15044 } 15045 if value == nil { 15046 return nil 15047 } 15048 15049 shape, ok := value.(map[string]interface{}) 15050 if !ok { 15051 return fmt.Errorf("unexpected JSON type %v", value) 15052 } 15053 15054 var sv *types.HierarchyPath 15055 if *v == nil { 15056 sv = &types.HierarchyPath{} 15057 } else { 15058 sv = *v 15059 } 15060 15061 for key, value := range shape { 15062 switch key { 15063 case "LevelFive": 15064 if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelFive, value); err != nil { 15065 return err 15066 } 15067 15068 case "LevelFour": 15069 if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelFour, value); err != nil { 15070 return err 15071 } 15072 15073 case "LevelOne": 15074 if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelOne, value); err != nil { 15075 return err 15076 } 15077 15078 case "LevelThree": 15079 if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelThree, value); err != nil { 15080 return err 15081 } 15082 15083 case "LevelTwo": 15084 if err := awsRestjson1_deserializeDocumentHierarchyGroupSummary(&sv.LevelTwo, value); err != nil { 15085 return err 15086 } 15087 15088 default: 15089 _, _ = key, value 15090 15091 } 15092 } 15093 *v = sv 15094 return nil 15095} 15096 15097func awsRestjson1_deserializeDocumentHierarchyStructure(v **types.HierarchyStructure, value interface{}) error { 15098 if v == nil { 15099 return fmt.Errorf("unexpected nil of type %T", v) 15100 } 15101 if value == nil { 15102 return nil 15103 } 15104 15105 shape, ok := value.(map[string]interface{}) 15106 if !ok { 15107 return fmt.Errorf("unexpected JSON type %v", value) 15108 } 15109 15110 var sv *types.HierarchyStructure 15111 if *v == nil { 15112 sv = &types.HierarchyStructure{} 15113 } else { 15114 sv = *v 15115 } 15116 15117 for key, value := range shape { 15118 switch key { 15119 case "LevelFive": 15120 if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelFive, value); err != nil { 15121 return err 15122 } 15123 15124 case "LevelFour": 15125 if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelFour, value); err != nil { 15126 return err 15127 } 15128 15129 case "LevelOne": 15130 if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelOne, value); err != nil { 15131 return err 15132 } 15133 15134 case "LevelThree": 15135 if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelThree, value); err != nil { 15136 return err 15137 } 15138 15139 case "LevelTwo": 15140 if err := awsRestjson1_deserializeDocumentHierarchyLevel(&sv.LevelTwo, value); err != nil { 15141 return err 15142 } 15143 15144 default: 15145 _, _ = key, value 15146 15147 } 15148 } 15149 *v = sv 15150 return nil 15151} 15152 15153func awsRestjson1_deserializeDocumentHistoricalMetric(v **types.HistoricalMetric, value interface{}) error { 15154 if v == nil { 15155 return fmt.Errorf("unexpected nil of type %T", v) 15156 } 15157 if value == nil { 15158 return nil 15159 } 15160 15161 shape, ok := value.(map[string]interface{}) 15162 if !ok { 15163 return fmt.Errorf("unexpected JSON type %v", value) 15164 } 15165 15166 var sv *types.HistoricalMetric 15167 if *v == nil { 15168 sv = &types.HistoricalMetric{} 15169 } else { 15170 sv = *v 15171 } 15172 15173 for key, value := range shape { 15174 switch key { 15175 case "Name": 15176 if value != nil { 15177 jtv, ok := value.(string) 15178 if !ok { 15179 return fmt.Errorf("expected HistoricalMetricName to be of type string, got %T instead", value) 15180 } 15181 sv.Name = types.HistoricalMetricName(jtv) 15182 } 15183 15184 case "Statistic": 15185 if value != nil { 15186 jtv, ok := value.(string) 15187 if !ok { 15188 return fmt.Errorf("expected Statistic to be of type string, got %T instead", value) 15189 } 15190 sv.Statistic = types.Statistic(jtv) 15191 } 15192 15193 case "Threshold": 15194 if err := awsRestjson1_deserializeDocumentThreshold(&sv.Threshold, value); err != nil { 15195 return err 15196 } 15197 15198 case "Unit": 15199 if value != nil { 15200 jtv, ok := value.(string) 15201 if !ok { 15202 return fmt.Errorf("expected Unit to be of type string, got %T instead", value) 15203 } 15204 sv.Unit = types.Unit(jtv) 15205 } 15206 15207 default: 15208 _, _ = key, value 15209 15210 } 15211 } 15212 *v = sv 15213 return nil 15214} 15215 15216func awsRestjson1_deserializeDocumentHistoricalMetricData(v **types.HistoricalMetricData, value interface{}) error { 15217 if v == nil { 15218 return fmt.Errorf("unexpected nil of type %T", v) 15219 } 15220 if value == nil { 15221 return nil 15222 } 15223 15224 shape, ok := value.(map[string]interface{}) 15225 if !ok { 15226 return fmt.Errorf("unexpected JSON type %v", value) 15227 } 15228 15229 var sv *types.HistoricalMetricData 15230 if *v == nil { 15231 sv = &types.HistoricalMetricData{} 15232 } else { 15233 sv = *v 15234 } 15235 15236 for key, value := range shape { 15237 switch key { 15238 case "Metric": 15239 if err := awsRestjson1_deserializeDocumentHistoricalMetric(&sv.Metric, value); err != nil { 15240 return err 15241 } 15242 15243 case "Value": 15244 if value != nil { 15245 jtv, ok := value.(json.Number) 15246 if !ok { 15247 return fmt.Errorf("expected Value to be json.Number, got %T instead", value) 15248 } 15249 f64, err := jtv.Float64() 15250 if err != nil { 15251 return err 15252 } 15253 sv.Value = ptr.Float64(f64) 15254 } 15255 15256 default: 15257 _, _ = key, value 15258 15259 } 15260 } 15261 *v = sv 15262 return nil 15263} 15264 15265func awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(v *[]types.HistoricalMetricData, value interface{}) error { 15266 if v == nil { 15267 return fmt.Errorf("unexpected nil of type %T", v) 15268 } 15269 if value == nil { 15270 return nil 15271 } 15272 15273 shape, ok := value.([]interface{}) 15274 if !ok { 15275 return fmt.Errorf("unexpected JSON type %v", value) 15276 } 15277 15278 var cv []types.HistoricalMetricData 15279 if *v == nil { 15280 cv = []types.HistoricalMetricData{} 15281 } else { 15282 cv = *v 15283 } 15284 15285 for _, value := range shape { 15286 var col types.HistoricalMetricData 15287 destAddr := &col 15288 if err := awsRestjson1_deserializeDocumentHistoricalMetricData(&destAddr, value); err != nil { 15289 return err 15290 } 15291 col = *destAddr 15292 cv = append(cv, col) 15293 15294 } 15295 *v = cv 15296 return nil 15297} 15298 15299func awsRestjson1_deserializeDocumentHistoricalMetricResult(v **types.HistoricalMetricResult, value interface{}) error { 15300 if v == nil { 15301 return fmt.Errorf("unexpected nil of type %T", v) 15302 } 15303 if value == nil { 15304 return nil 15305 } 15306 15307 shape, ok := value.(map[string]interface{}) 15308 if !ok { 15309 return fmt.Errorf("unexpected JSON type %v", value) 15310 } 15311 15312 var sv *types.HistoricalMetricResult 15313 if *v == nil { 15314 sv = &types.HistoricalMetricResult{} 15315 } else { 15316 sv = *v 15317 } 15318 15319 for key, value := range shape { 15320 switch key { 15321 case "Collections": 15322 if err := awsRestjson1_deserializeDocumentHistoricalMetricDataCollections(&sv.Collections, value); err != nil { 15323 return err 15324 } 15325 15326 case "Dimensions": 15327 if err := awsRestjson1_deserializeDocumentDimensions(&sv.Dimensions, value); err != nil { 15328 return err 15329 } 15330 15331 default: 15332 _, _ = key, value 15333 15334 } 15335 } 15336 *v = sv 15337 return nil 15338} 15339 15340func awsRestjson1_deserializeDocumentHistoricalMetricResults(v *[]types.HistoricalMetricResult, value interface{}) error { 15341 if v == nil { 15342 return fmt.Errorf("unexpected nil of type %T", v) 15343 } 15344 if value == nil { 15345 return nil 15346 } 15347 15348 shape, ok := value.([]interface{}) 15349 if !ok { 15350 return fmt.Errorf("unexpected JSON type %v", value) 15351 } 15352 15353 var cv []types.HistoricalMetricResult 15354 if *v == nil { 15355 cv = []types.HistoricalMetricResult{} 15356 } else { 15357 cv = *v 15358 } 15359 15360 for _, value := range shape { 15361 var col types.HistoricalMetricResult 15362 destAddr := &col 15363 if err := awsRestjson1_deserializeDocumentHistoricalMetricResult(&destAddr, value); err != nil { 15364 return err 15365 } 15366 col = *destAddr 15367 cv = append(cv, col) 15368 15369 } 15370 *v = cv 15371 return nil 15372} 15373 15374func awsRestjson1_deserializeDocumentHoursOfOperation(v **types.HoursOfOperation, value interface{}) error { 15375 if v == nil { 15376 return fmt.Errorf("unexpected nil of type %T", v) 15377 } 15378 if value == nil { 15379 return nil 15380 } 15381 15382 shape, ok := value.(map[string]interface{}) 15383 if !ok { 15384 return fmt.Errorf("unexpected JSON type %v", value) 15385 } 15386 15387 var sv *types.HoursOfOperation 15388 if *v == nil { 15389 sv = &types.HoursOfOperation{} 15390 } else { 15391 sv = *v 15392 } 15393 15394 for key, value := range shape { 15395 switch key { 15396 case "Config": 15397 if err := awsRestjson1_deserializeDocumentHoursOfOperationConfigList(&sv.Config, value); err != nil { 15398 return err 15399 } 15400 15401 case "Description": 15402 if value != nil { 15403 jtv, ok := value.(string) 15404 if !ok { 15405 return fmt.Errorf("expected CommonDescriptionLength250 to be of type string, got %T instead", value) 15406 } 15407 sv.Description = ptr.String(jtv) 15408 } 15409 15410 case "HoursOfOperationArn": 15411 if value != nil { 15412 jtv, ok := value.(string) 15413 if !ok { 15414 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 15415 } 15416 sv.HoursOfOperationArn = ptr.String(jtv) 15417 } 15418 15419 case "HoursOfOperationId": 15420 if value != nil { 15421 jtv, ok := value.(string) 15422 if !ok { 15423 return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) 15424 } 15425 sv.HoursOfOperationId = ptr.String(jtv) 15426 } 15427 15428 case "Name": 15429 if value != nil { 15430 jtv, ok := value.(string) 15431 if !ok { 15432 return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) 15433 } 15434 sv.Name = ptr.String(jtv) 15435 } 15436 15437 case "Tags": 15438 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 15439 return err 15440 } 15441 15442 case "TimeZone": 15443 if value != nil { 15444 jtv, ok := value.(string) 15445 if !ok { 15446 return fmt.Errorf("expected TimeZone to be of type string, got %T instead", value) 15447 } 15448 sv.TimeZone = ptr.String(jtv) 15449 } 15450 15451 default: 15452 _, _ = key, value 15453 15454 } 15455 } 15456 *v = sv 15457 return nil 15458} 15459 15460func awsRestjson1_deserializeDocumentHoursOfOperationConfig(v **types.HoursOfOperationConfig, value interface{}) error { 15461 if v == nil { 15462 return fmt.Errorf("unexpected nil of type %T", v) 15463 } 15464 if value == nil { 15465 return nil 15466 } 15467 15468 shape, ok := value.(map[string]interface{}) 15469 if !ok { 15470 return fmt.Errorf("unexpected JSON type %v", value) 15471 } 15472 15473 var sv *types.HoursOfOperationConfig 15474 if *v == nil { 15475 sv = &types.HoursOfOperationConfig{} 15476 } else { 15477 sv = *v 15478 } 15479 15480 for key, value := range shape { 15481 switch key { 15482 case "Day": 15483 if value != nil { 15484 jtv, ok := value.(string) 15485 if !ok { 15486 return fmt.Errorf("expected HoursOfOperationDays to be of type string, got %T instead", value) 15487 } 15488 sv.Day = types.HoursOfOperationDays(jtv) 15489 } 15490 15491 case "EndTime": 15492 if err := awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(&sv.EndTime, value); err != nil { 15493 return err 15494 } 15495 15496 case "StartTime": 15497 if err := awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(&sv.StartTime, value); err != nil { 15498 return err 15499 } 15500 15501 default: 15502 _, _ = key, value 15503 15504 } 15505 } 15506 *v = sv 15507 return nil 15508} 15509 15510func awsRestjson1_deserializeDocumentHoursOfOperationConfigList(v *[]types.HoursOfOperationConfig, value interface{}) error { 15511 if v == nil { 15512 return fmt.Errorf("unexpected nil of type %T", v) 15513 } 15514 if value == nil { 15515 return nil 15516 } 15517 15518 shape, ok := value.([]interface{}) 15519 if !ok { 15520 return fmt.Errorf("unexpected JSON type %v", value) 15521 } 15522 15523 var cv []types.HoursOfOperationConfig 15524 if *v == nil { 15525 cv = []types.HoursOfOperationConfig{} 15526 } else { 15527 cv = *v 15528 } 15529 15530 for _, value := range shape { 15531 var col types.HoursOfOperationConfig 15532 destAddr := &col 15533 if err := awsRestjson1_deserializeDocumentHoursOfOperationConfig(&destAddr, value); err != nil { 15534 return err 15535 } 15536 col = *destAddr 15537 cv = append(cv, col) 15538 15539 } 15540 *v = cv 15541 return nil 15542} 15543 15544func awsRestjson1_deserializeDocumentHoursOfOperationSummary(v **types.HoursOfOperationSummary, value interface{}) error { 15545 if v == nil { 15546 return fmt.Errorf("unexpected nil of type %T", v) 15547 } 15548 if value == nil { 15549 return nil 15550 } 15551 15552 shape, ok := value.(map[string]interface{}) 15553 if !ok { 15554 return fmt.Errorf("unexpected JSON type %v", value) 15555 } 15556 15557 var sv *types.HoursOfOperationSummary 15558 if *v == nil { 15559 sv = &types.HoursOfOperationSummary{} 15560 } else { 15561 sv = *v 15562 } 15563 15564 for key, value := range shape { 15565 switch key { 15566 case "Arn": 15567 if value != nil { 15568 jtv, ok := value.(string) 15569 if !ok { 15570 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 15571 } 15572 sv.Arn = ptr.String(jtv) 15573 } 15574 15575 case "Id": 15576 if value != nil { 15577 jtv, ok := value.(string) 15578 if !ok { 15579 return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) 15580 } 15581 sv.Id = ptr.String(jtv) 15582 } 15583 15584 case "Name": 15585 if value != nil { 15586 jtv, ok := value.(string) 15587 if !ok { 15588 return fmt.Errorf("expected HoursOfOperationName to be of type string, got %T instead", value) 15589 } 15590 sv.Name = ptr.String(jtv) 15591 } 15592 15593 default: 15594 _, _ = key, value 15595 15596 } 15597 } 15598 *v = sv 15599 return nil 15600} 15601 15602func awsRestjson1_deserializeDocumentHoursOfOperationSummaryList(v *[]types.HoursOfOperationSummary, value interface{}) error { 15603 if v == nil { 15604 return fmt.Errorf("unexpected nil of type %T", v) 15605 } 15606 if value == nil { 15607 return nil 15608 } 15609 15610 shape, ok := value.([]interface{}) 15611 if !ok { 15612 return fmt.Errorf("unexpected JSON type %v", value) 15613 } 15614 15615 var cv []types.HoursOfOperationSummary 15616 if *v == nil { 15617 cv = []types.HoursOfOperationSummary{} 15618 } else { 15619 cv = *v 15620 } 15621 15622 for _, value := range shape { 15623 var col types.HoursOfOperationSummary 15624 destAddr := &col 15625 if err := awsRestjson1_deserializeDocumentHoursOfOperationSummary(&destAddr, value); err != nil { 15626 return err 15627 } 15628 col = *destAddr 15629 cv = append(cv, col) 15630 15631 } 15632 *v = cv 15633 return nil 15634} 15635 15636func awsRestjson1_deserializeDocumentHoursOfOperationTimeSlice(v **types.HoursOfOperationTimeSlice, value interface{}) error { 15637 if v == nil { 15638 return fmt.Errorf("unexpected nil of type %T", v) 15639 } 15640 if value == nil { 15641 return nil 15642 } 15643 15644 shape, ok := value.(map[string]interface{}) 15645 if !ok { 15646 return fmt.Errorf("unexpected JSON type %v", value) 15647 } 15648 15649 var sv *types.HoursOfOperationTimeSlice 15650 if *v == nil { 15651 sv = &types.HoursOfOperationTimeSlice{} 15652 } else { 15653 sv = *v 15654 } 15655 15656 for key, value := range shape { 15657 switch key { 15658 case "Hours": 15659 if value != nil { 15660 jtv, ok := value.(json.Number) 15661 if !ok { 15662 return fmt.Errorf("expected Hours24Format to be json.Number, got %T instead", value) 15663 } 15664 i64, err := jtv.Int64() 15665 if err != nil { 15666 return err 15667 } 15668 sv.Hours = int32(i64) 15669 } 15670 15671 case "Minutes": 15672 if value != nil { 15673 jtv, ok := value.(json.Number) 15674 if !ok { 15675 return fmt.Errorf("expected MinutesLimit60 to be json.Number, got %T instead", value) 15676 } 15677 i64, err := jtv.Int64() 15678 if err != nil { 15679 return err 15680 } 15681 sv.Minutes = int32(i64) 15682 } 15683 15684 default: 15685 _, _ = key, value 15686 15687 } 15688 } 15689 *v = sv 15690 return nil 15691} 15692 15693func awsRestjson1_deserializeDocumentInstance(v **types.Instance, value interface{}) error { 15694 if v == nil { 15695 return fmt.Errorf("unexpected nil of type %T", v) 15696 } 15697 if value == nil { 15698 return nil 15699 } 15700 15701 shape, ok := value.(map[string]interface{}) 15702 if !ok { 15703 return fmt.Errorf("unexpected JSON type %v", value) 15704 } 15705 15706 var sv *types.Instance 15707 if *v == nil { 15708 sv = &types.Instance{} 15709 } else { 15710 sv = *v 15711 } 15712 15713 for key, value := range shape { 15714 switch key { 15715 case "Arn": 15716 if value != nil { 15717 jtv, ok := value.(string) 15718 if !ok { 15719 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 15720 } 15721 sv.Arn = ptr.String(jtv) 15722 } 15723 15724 case "CreatedTime": 15725 if value != nil { 15726 jtv, ok := value.(json.Number) 15727 if !ok { 15728 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 15729 } 15730 f64, err := jtv.Float64() 15731 if err != nil { 15732 return err 15733 } 15734 sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 15735 } 15736 15737 case "Id": 15738 if value != nil { 15739 jtv, ok := value.(string) 15740 if !ok { 15741 return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) 15742 } 15743 sv.Id = ptr.String(jtv) 15744 } 15745 15746 case "IdentityManagementType": 15747 if value != nil { 15748 jtv, ok := value.(string) 15749 if !ok { 15750 return fmt.Errorf("expected DirectoryType to be of type string, got %T instead", value) 15751 } 15752 sv.IdentityManagementType = types.DirectoryType(jtv) 15753 } 15754 15755 case "InboundCallsEnabled": 15756 if value != nil { 15757 jtv, ok := value.(bool) 15758 if !ok { 15759 return fmt.Errorf("expected InboundCallsEnabled to be of type *bool, got %T instead", value) 15760 } 15761 sv.InboundCallsEnabled = ptr.Bool(jtv) 15762 } 15763 15764 case "InstanceAlias": 15765 if value != nil { 15766 jtv, ok := value.(string) 15767 if !ok { 15768 return fmt.Errorf("expected DirectoryAlias to be of type string, got %T instead", value) 15769 } 15770 sv.InstanceAlias = ptr.String(jtv) 15771 } 15772 15773 case "InstanceStatus": 15774 if value != nil { 15775 jtv, ok := value.(string) 15776 if !ok { 15777 return fmt.Errorf("expected InstanceStatus to be of type string, got %T instead", value) 15778 } 15779 sv.InstanceStatus = types.InstanceStatus(jtv) 15780 } 15781 15782 case "OutboundCallsEnabled": 15783 if value != nil { 15784 jtv, ok := value.(bool) 15785 if !ok { 15786 return fmt.Errorf("expected OutboundCallsEnabled to be of type *bool, got %T instead", value) 15787 } 15788 sv.OutboundCallsEnabled = ptr.Bool(jtv) 15789 } 15790 15791 case "ServiceRole": 15792 if value != nil { 15793 jtv, ok := value.(string) 15794 if !ok { 15795 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 15796 } 15797 sv.ServiceRole = ptr.String(jtv) 15798 } 15799 15800 case "StatusReason": 15801 if err := awsRestjson1_deserializeDocumentInstanceStatusReason(&sv.StatusReason, value); err != nil { 15802 return err 15803 } 15804 15805 default: 15806 _, _ = key, value 15807 15808 } 15809 } 15810 *v = sv 15811 return nil 15812} 15813 15814func awsRestjson1_deserializeDocumentInstanceStatusReason(v **types.InstanceStatusReason, value interface{}) error { 15815 if v == nil { 15816 return fmt.Errorf("unexpected nil of type %T", v) 15817 } 15818 if value == nil { 15819 return nil 15820 } 15821 15822 shape, ok := value.(map[string]interface{}) 15823 if !ok { 15824 return fmt.Errorf("unexpected JSON type %v", value) 15825 } 15826 15827 var sv *types.InstanceStatusReason 15828 if *v == nil { 15829 sv = &types.InstanceStatusReason{} 15830 } else { 15831 sv = *v 15832 } 15833 15834 for key, value := range shape { 15835 switch key { 15836 case "Message": 15837 if value != nil { 15838 jtv, ok := value.(string) 15839 if !ok { 15840 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15841 } 15842 sv.Message = ptr.String(jtv) 15843 } 15844 15845 default: 15846 _, _ = key, value 15847 15848 } 15849 } 15850 *v = sv 15851 return nil 15852} 15853 15854func awsRestjson1_deserializeDocumentInstanceStorageConfig(v **types.InstanceStorageConfig, value interface{}) error { 15855 if v == nil { 15856 return fmt.Errorf("unexpected nil of type %T", v) 15857 } 15858 if value == nil { 15859 return nil 15860 } 15861 15862 shape, ok := value.(map[string]interface{}) 15863 if !ok { 15864 return fmt.Errorf("unexpected JSON type %v", value) 15865 } 15866 15867 var sv *types.InstanceStorageConfig 15868 if *v == nil { 15869 sv = &types.InstanceStorageConfig{} 15870 } else { 15871 sv = *v 15872 } 15873 15874 for key, value := range shape { 15875 switch key { 15876 case "AssociationId": 15877 if value != nil { 15878 jtv, ok := value.(string) 15879 if !ok { 15880 return fmt.Errorf("expected AssociationId to be of type string, got %T instead", value) 15881 } 15882 sv.AssociationId = ptr.String(jtv) 15883 } 15884 15885 case "KinesisFirehoseConfig": 15886 if err := awsRestjson1_deserializeDocumentKinesisFirehoseConfig(&sv.KinesisFirehoseConfig, value); err != nil { 15887 return err 15888 } 15889 15890 case "KinesisStreamConfig": 15891 if err := awsRestjson1_deserializeDocumentKinesisStreamConfig(&sv.KinesisStreamConfig, value); err != nil { 15892 return err 15893 } 15894 15895 case "KinesisVideoStreamConfig": 15896 if err := awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(&sv.KinesisVideoStreamConfig, value); err != nil { 15897 return err 15898 } 15899 15900 case "S3Config": 15901 if err := awsRestjson1_deserializeDocumentS3Config(&sv.S3Config, value); err != nil { 15902 return err 15903 } 15904 15905 case "StorageType": 15906 if value != nil { 15907 jtv, ok := value.(string) 15908 if !ok { 15909 return fmt.Errorf("expected StorageType to be of type string, got %T instead", value) 15910 } 15911 sv.StorageType = types.StorageType(jtv) 15912 } 15913 15914 default: 15915 _, _ = key, value 15916 15917 } 15918 } 15919 *v = sv 15920 return nil 15921} 15922 15923func awsRestjson1_deserializeDocumentInstanceStorageConfigs(v *[]types.InstanceStorageConfig, value interface{}) error { 15924 if v == nil { 15925 return fmt.Errorf("unexpected nil of type %T", v) 15926 } 15927 if value == nil { 15928 return nil 15929 } 15930 15931 shape, ok := value.([]interface{}) 15932 if !ok { 15933 return fmt.Errorf("unexpected JSON type %v", value) 15934 } 15935 15936 var cv []types.InstanceStorageConfig 15937 if *v == nil { 15938 cv = []types.InstanceStorageConfig{} 15939 } else { 15940 cv = *v 15941 } 15942 15943 for _, value := range shape { 15944 var col types.InstanceStorageConfig 15945 destAddr := &col 15946 if err := awsRestjson1_deserializeDocumentInstanceStorageConfig(&destAddr, value); err != nil { 15947 return err 15948 } 15949 col = *destAddr 15950 cv = append(cv, col) 15951 15952 } 15953 *v = cv 15954 return nil 15955} 15956 15957func awsRestjson1_deserializeDocumentInstanceSummary(v **types.InstanceSummary, value interface{}) error { 15958 if v == nil { 15959 return fmt.Errorf("unexpected nil of type %T", v) 15960 } 15961 if value == nil { 15962 return nil 15963 } 15964 15965 shape, ok := value.(map[string]interface{}) 15966 if !ok { 15967 return fmt.Errorf("unexpected JSON type %v", value) 15968 } 15969 15970 var sv *types.InstanceSummary 15971 if *v == nil { 15972 sv = &types.InstanceSummary{} 15973 } else { 15974 sv = *v 15975 } 15976 15977 for key, value := range shape { 15978 switch key { 15979 case "Arn": 15980 if value != nil { 15981 jtv, ok := value.(string) 15982 if !ok { 15983 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 15984 } 15985 sv.Arn = ptr.String(jtv) 15986 } 15987 15988 case "CreatedTime": 15989 if value != nil { 15990 jtv, ok := value.(json.Number) 15991 if !ok { 15992 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 15993 } 15994 f64, err := jtv.Float64() 15995 if err != nil { 15996 return err 15997 } 15998 sv.CreatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 15999 } 16000 16001 case "Id": 16002 if value != nil { 16003 jtv, ok := value.(string) 16004 if !ok { 16005 return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) 16006 } 16007 sv.Id = ptr.String(jtv) 16008 } 16009 16010 case "IdentityManagementType": 16011 if value != nil { 16012 jtv, ok := value.(string) 16013 if !ok { 16014 return fmt.Errorf("expected DirectoryType to be of type string, got %T instead", value) 16015 } 16016 sv.IdentityManagementType = types.DirectoryType(jtv) 16017 } 16018 16019 case "InboundCallsEnabled": 16020 if value != nil { 16021 jtv, ok := value.(bool) 16022 if !ok { 16023 return fmt.Errorf("expected InboundCallsEnabled to be of type *bool, got %T instead", value) 16024 } 16025 sv.InboundCallsEnabled = ptr.Bool(jtv) 16026 } 16027 16028 case "InstanceAlias": 16029 if value != nil { 16030 jtv, ok := value.(string) 16031 if !ok { 16032 return fmt.Errorf("expected DirectoryAlias to be of type string, got %T instead", value) 16033 } 16034 sv.InstanceAlias = ptr.String(jtv) 16035 } 16036 16037 case "InstanceStatus": 16038 if value != nil { 16039 jtv, ok := value.(string) 16040 if !ok { 16041 return fmt.Errorf("expected InstanceStatus to be of type string, got %T instead", value) 16042 } 16043 sv.InstanceStatus = types.InstanceStatus(jtv) 16044 } 16045 16046 case "OutboundCallsEnabled": 16047 if value != nil { 16048 jtv, ok := value.(bool) 16049 if !ok { 16050 return fmt.Errorf("expected OutboundCallsEnabled to be of type *bool, got %T instead", value) 16051 } 16052 sv.OutboundCallsEnabled = ptr.Bool(jtv) 16053 } 16054 16055 case "ServiceRole": 16056 if value != nil { 16057 jtv, ok := value.(string) 16058 if !ok { 16059 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 16060 } 16061 sv.ServiceRole = ptr.String(jtv) 16062 } 16063 16064 default: 16065 _, _ = key, value 16066 16067 } 16068 } 16069 *v = sv 16070 return nil 16071} 16072 16073func awsRestjson1_deserializeDocumentInstanceSummaryList(v *[]types.InstanceSummary, value interface{}) error { 16074 if v == nil { 16075 return fmt.Errorf("unexpected nil of type %T", v) 16076 } 16077 if value == nil { 16078 return nil 16079 } 16080 16081 shape, ok := value.([]interface{}) 16082 if !ok { 16083 return fmt.Errorf("unexpected JSON type %v", value) 16084 } 16085 16086 var cv []types.InstanceSummary 16087 if *v == nil { 16088 cv = []types.InstanceSummary{} 16089 } else { 16090 cv = *v 16091 } 16092 16093 for _, value := range shape { 16094 var col types.InstanceSummary 16095 destAddr := &col 16096 if err := awsRestjson1_deserializeDocumentInstanceSummary(&destAddr, value); err != nil { 16097 return err 16098 } 16099 col = *destAddr 16100 cv = append(cv, col) 16101 16102 } 16103 *v = cv 16104 return nil 16105} 16106 16107func awsRestjson1_deserializeDocumentIntegrationAssociationSummary(v **types.IntegrationAssociationSummary, value interface{}) error { 16108 if v == nil { 16109 return fmt.Errorf("unexpected nil of type %T", v) 16110 } 16111 if value == nil { 16112 return nil 16113 } 16114 16115 shape, ok := value.(map[string]interface{}) 16116 if !ok { 16117 return fmt.Errorf("unexpected JSON type %v", value) 16118 } 16119 16120 var sv *types.IntegrationAssociationSummary 16121 if *v == nil { 16122 sv = &types.IntegrationAssociationSummary{} 16123 } else { 16124 sv = *v 16125 } 16126 16127 for key, value := range shape { 16128 switch key { 16129 case "InstanceId": 16130 if value != nil { 16131 jtv, ok := value.(string) 16132 if !ok { 16133 return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) 16134 } 16135 sv.InstanceId = ptr.String(jtv) 16136 } 16137 16138 case "IntegrationArn": 16139 if value != nil { 16140 jtv, ok := value.(string) 16141 if !ok { 16142 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 16143 } 16144 sv.IntegrationArn = ptr.String(jtv) 16145 } 16146 16147 case "IntegrationAssociationArn": 16148 if value != nil { 16149 jtv, ok := value.(string) 16150 if !ok { 16151 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 16152 } 16153 sv.IntegrationAssociationArn = ptr.String(jtv) 16154 } 16155 16156 case "IntegrationAssociationId": 16157 if value != nil { 16158 jtv, ok := value.(string) 16159 if !ok { 16160 return fmt.Errorf("expected IntegrationAssociationId to be of type string, got %T instead", value) 16161 } 16162 sv.IntegrationAssociationId = ptr.String(jtv) 16163 } 16164 16165 case "IntegrationType": 16166 if value != nil { 16167 jtv, ok := value.(string) 16168 if !ok { 16169 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 16170 } 16171 sv.IntegrationType = types.IntegrationType(jtv) 16172 } 16173 16174 case "SourceApplicationName": 16175 if value != nil { 16176 jtv, ok := value.(string) 16177 if !ok { 16178 return fmt.Errorf("expected SourceApplicationName to be of type string, got %T instead", value) 16179 } 16180 sv.SourceApplicationName = ptr.String(jtv) 16181 } 16182 16183 case "SourceApplicationUrl": 16184 if value != nil { 16185 jtv, ok := value.(string) 16186 if !ok { 16187 return fmt.Errorf("expected URI to be of type string, got %T instead", value) 16188 } 16189 sv.SourceApplicationUrl = ptr.String(jtv) 16190 } 16191 16192 case "SourceType": 16193 if value != nil { 16194 jtv, ok := value.(string) 16195 if !ok { 16196 return fmt.Errorf("expected SourceType to be of type string, got %T instead", value) 16197 } 16198 sv.SourceType = types.SourceType(jtv) 16199 } 16200 16201 default: 16202 _, _ = key, value 16203 16204 } 16205 } 16206 *v = sv 16207 return nil 16208} 16209 16210func awsRestjson1_deserializeDocumentIntegrationAssociationSummaryList(v *[]types.IntegrationAssociationSummary, value interface{}) error { 16211 if v == nil { 16212 return fmt.Errorf("unexpected nil of type %T", v) 16213 } 16214 if value == nil { 16215 return nil 16216 } 16217 16218 shape, ok := value.([]interface{}) 16219 if !ok { 16220 return fmt.Errorf("unexpected JSON type %v", value) 16221 } 16222 16223 var cv []types.IntegrationAssociationSummary 16224 if *v == nil { 16225 cv = []types.IntegrationAssociationSummary{} 16226 } else { 16227 cv = *v 16228 } 16229 16230 for _, value := range shape { 16231 var col types.IntegrationAssociationSummary 16232 destAddr := &col 16233 if err := awsRestjson1_deserializeDocumentIntegrationAssociationSummary(&destAddr, value); err != nil { 16234 return err 16235 } 16236 col = *destAddr 16237 cv = append(cv, col) 16238 16239 } 16240 *v = cv 16241 return nil 16242} 16243 16244func awsRestjson1_deserializeDocumentInternalServiceException(v **types.InternalServiceException, value interface{}) error { 16245 if v == nil { 16246 return fmt.Errorf("unexpected nil of type %T", v) 16247 } 16248 if value == nil { 16249 return nil 16250 } 16251 16252 shape, ok := value.(map[string]interface{}) 16253 if !ok { 16254 return fmt.Errorf("unexpected JSON type %v", value) 16255 } 16256 16257 var sv *types.InternalServiceException 16258 if *v == nil { 16259 sv = &types.InternalServiceException{} 16260 } else { 16261 sv = *v 16262 } 16263 16264 for key, value := range shape { 16265 switch key { 16266 case "Message": 16267 if value != nil { 16268 jtv, ok := value.(string) 16269 if !ok { 16270 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 16271 } 16272 sv.Message = ptr.String(jtv) 16273 } 16274 16275 default: 16276 _, _ = key, value 16277 16278 } 16279 } 16280 *v = sv 16281 return nil 16282} 16283 16284func awsRestjson1_deserializeDocumentInvalidContactFlowException(v **types.InvalidContactFlowException, value interface{}) error { 16285 if v == nil { 16286 return fmt.Errorf("unexpected nil of type %T", v) 16287 } 16288 if value == nil { 16289 return nil 16290 } 16291 16292 shape, ok := value.(map[string]interface{}) 16293 if !ok { 16294 return fmt.Errorf("unexpected JSON type %v", value) 16295 } 16296 16297 var sv *types.InvalidContactFlowException 16298 if *v == nil { 16299 sv = &types.InvalidContactFlowException{} 16300 } else { 16301 sv = *v 16302 } 16303 16304 for key, value := range shape { 16305 switch key { 16306 case "problems": 16307 if err := awsRestjson1_deserializeDocumentProblems(&sv.Problems, value); err != nil { 16308 return err 16309 } 16310 16311 default: 16312 _, _ = key, value 16313 16314 } 16315 } 16316 *v = sv 16317 return nil 16318} 16319 16320func awsRestjson1_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error { 16321 if v == nil { 16322 return fmt.Errorf("unexpected nil of type %T", v) 16323 } 16324 if value == nil { 16325 return nil 16326 } 16327 16328 shape, ok := value.(map[string]interface{}) 16329 if !ok { 16330 return fmt.Errorf("unexpected JSON type %v", value) 16331 } 16332 16333 var sv *types.InvalidParameterException 16334 if *v == nil { 16335 sv = &types.InvalidParameterException{} 16336 } else { 16337 sv = *v 16338 } 16339 16340 for key, value := range shape { 16341 switch key { 16342 case "Message": 16343 if value != nil { 16344 jtv, ok := value.(string) 16345 if !ok { 16346 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 16347 } 16348 sv.Message = ptr.String(jtv) 16349 } 16350 16351 default: 16352 _, _ = key, value 16353 16354 } 16355 } 16356 *v = sv 16357 return nil 16358} 16359 16360func awsRestjson1_deserializeDocumentInvalidRequestException(v **types.InvalidRequestException, value interface{}) error { 16361 if v == nil { 16362 return fmt.Errorf("unexpected nil of type %T", v) 16363 } 16364 if value == nil { 16365 return nil 16366 } 16367 16368 shape, ok := value.(map[string]interface{}) 16369 if !ok { 16370 return fmt.Errorf("unexpected JSON type %v", value) 16371 } 16372 16373 var sv *types.InvalidRequestException 16374 if *v == nil { 16375 sv = &types.InvalidRequestException{} 16376 } else { 16377 sv = *v 16378 } 16379 16380 for key, value := range shape { 16381 switch key { 16382 case "Message": 16383 if value != nil { 16384 jtv, ok := value.(string) 16385 if !ok { 16386 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 16387 } 16388 sv.Message = ptr.String(jtv) 16389 } 16390 16391 default: 16392 _, _ = key, value 16393 16394 } 16395 } 16396 *v = sv 16397 return nil 16398} 16399 16400func awsRestjson1_deserializeDocumentKinesisFirehoseConfig(v **types.KinesisFirehoseConfig, value interface{}) error { 16401 if v == nil { 16402 return fmt.Errorf("unexpected nil of type %T", v) 16403 } 16404 if value == nil { 16405 return nil 16406 } 16407 16408 shape, ok := value.(map[string]interface{}) 16409 if !ok { 16410 return fmt.Errorf("unexpected JSON type %v", value) 16411 } 16412 16413 var sv *types.KinesisFirehoseConfig 16414 if *v == nil { 16415 sv = &types.KinesisFirehoseConfig{} 16416 } else { 16417 sv = *v 16418 } 16419 16420 for key, value := range shape { 16421 switch key { 16422 case "FirehoseArn": 16423 if value != nil { 16424 jtv, ok := value.(string) 16425 if !ok { 16426 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 16427 } 16428 sv.FirehoseArn = ptr.String(jtv) 16429 } 16430 16431 default: 16432 _, _ = key, value 16433 16434 } 16435 } 16436 *v = sv 16437 return nil 16438} 16439 16440func awsRestjson1_deserializeDocumentKinesisStreamConfig(v **types.KinesisStreamConfig, value interface{}) error { 16441 if v == nil { 16442 return fmt.Errorf("unexpected nil of type %T", v) 16443 } 16444 if value == nil { 16445 return nil 16446 } 16447 16448 shape, ok := value.(map[string]interface{}) 16449 if !ok { 16450 return fmt.Errorf("unexpected JSON type %v", value) 16451 } 16452 16453 var sv *types.KinesisStreamConfig 16454 if *v == nil { 16455 sv = &types.KinesisStreamConfig{} 16456 } else { 16457 sv = *v 16458 } 16459 16460 for key, value := range shape { 16461 switch key { 16462 case "StreamArn": 16463 if value != nil { 16464 jtv, ok := value.(string) 16465 if !ok { 16466 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 16467 } 16468 sv.StreamArn = ptr.String(jtv) 16469 } 16470 16471 default: 16472 _, _ = key, value 16473 16474 } 16475 } 16476 *v = sv 16477 return nil 16478} 16479 16480func awsRestjson1_deserializeDocumentKinesisVideoStreamConfig(v **types.KinesisVideoStreamConfig, value interface{}) error { 16481 if v == nil { 16482 return fmt.Errorf("unexpected nil of type %T", v) 16483 } 16484 if value == nil { 16485 return nil 16486 } 16487 16488 shape, ok := value.(map[string]interface{}) 16489 if !ok { 16490 return fmt.Errorf("unexpected JSON type %v", value) 16491 } 16492 16493 var sv *types.KinesisVideoStreamConfig 16494 if *v == nil { 16495 sv = &types.KinesisVideoStreamConfig{} 16496 } else { 16497 sv = *v 16498 } 16499 16500 for key, value := range shape { 16501 switch key { 16502 case "EncryptionConfig": 16503 if err := awsRestjson1_deserializeDocumentEncryptionConfig(&sv.EncryptionConfig, value); err != nil { 16504 return err 16505 } 16506 16507 case "Prefix": 16508 if value != nil { 16509 jtv, ok := value.(string) 16510 if !ok { 16511 return fmt.Errorf("expected Prefix to be of type string, got %T instead", value) 16512 } 16513 sv.Prefix = ptr.String(jtv) 16514 } 16515 16516 case "RetentionPeriodHours": 16517 if value != nil { 16518 jtv, ok := value.(json.Number) 16519 if !ok { 16520 return fmt.Errorf("expected Hours to be json.Number, got %T instead", value) 16521 } 16522 i64, err := jtv.Int64() 16523 if err != nil { 16524 return err 16525 } 16526 sv.RetentionPeriodHours = int32(i64) 16527 } 16528 16529 default: 16530 _, _ = key, value 16531 16532 } 16533 } 16534 *v = sv 16535 return nil 16536} 16537 16538func awsRestjson1_deserializeDocumentLexBot(v **types.LexBot, value interface{}) error { 16539 if v == nil { 16540 return fmt.Errorf("unexpected nil of type %T", v) 16541 } 16542 if value == nil { 16543 return nil 16544 } 16545 16546 shape, ok := value.(map[string]interface{}) 16547 if !ok { 16548 return fmt.Errorf("unexpected JSON type %v", value) 16549 } 16550 16551 var sv *types.LexBot 16552 if *v == nil { 16553 sv = &types.LexBot{} 16554 } else { 16555 sv = *v 16556 } 16557 16558 for key, value := range shape { 16559 switch key { 16560 case "LexRegion": 16561 if value != nil { 16562 jtv, ok := value.(string) 16563 if !ok { 16564 return fmt.Errorf("expected LexRegion to be of type string, got %T instead", value) 16565 } 16566 sv.LexRegion = ptr.String(jtv) 16567 } 16568 16569 case "Name": 16570 if value != nil { 16571 jtv, ok := value.(string) 16572 if !ok { 16573 return fmt.Errorf("expected BotName to be of type string, got %T instead", value) 16574 } 16575 sv.Name = ptr.String(jtv) 16576 } 16577 16578 default: 16579 _, _ = key, value 16580 16581 } 16582 } 16583 *v = sv 16584 return nil 16585} 16586 16587func awsRestjson1_deserializeDocumentLexBotsList(v *[]types.LexBot, value interface{}) error { 16588 if v == nil { 16589 return fmt.Errorf("unexpected nil of type %T", v) 16590 } 16591 if value == nil { 16592 return nil 16593 } 16594 16595 shape, ok := value.([]interface{}) 16596 if !ok { 16597 return fmt.Errorf("unexpected JSON type %v", value) 16598 } 16599 16600 var cv []types.LexBot 16601 if *v == nil { 16602 cv = []types.LexBot{} 16603 } else { 16604 cv = *v 16605 } 16606 16607 for _, value := range shape { 16608 var col types.LexBot 16609 destAddr := &col 16610 if err := awsRestjson1_deserializeDocumentLexBot(&destAddr, value); err != nil { 16611 return err 16612 } 16613 col = *destAddr 16614 cv = append(cv, col) 16615 16616 } 16617 *v = cv 16618 return nil 16619} 16620 16621func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 16622 if v == nil { 16623 return fmt.Errorf("unexpected nil of type %T", v) 16624 } 16625 if value == nil { 16626 return nil 16627 } 16628 16629 shape, ok := value.(map[string]interface{}) 16630 if !ok { 16631 return fmt.Errorf("unexpected JSON type %v", value) 16632 } 16633 16634 var sv *types.LimitExceededException 16635 if *v == nil { 16636 sv = &types.LimitExceededException{} 16637 } else { 16638 sv = *v 16639 } 16640 16641 for key, value := range shape { 16642 switch key { 16643 case "Message": 16644 if value != nil { 16645 jtv, ok := value.(string) 16646 if !ok { 16647 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 16648 } 16649 sv.Message = ptr.String(jtv) 16650 } 16651 16652 default: 16653 _, _ = key, value 16654 16655 } 16656 } 16657 *v = sv 16658 return nil 16659} 16660 16661func awsRestjson1_deserializeDocumentMediaConcurrencies(v *[]types.MediaConcurrency, value interface{}) error { 16662 if v == nil { 16663 return fmt.Errorf("unexpected nil of type %T", v) 16664 } 16665 if value == nil { 16666 return nil 16667 } 16668 16669 shape, ok := value.([]interface{}) 16670 if !ok { 16671 return fmt.Errorf("unexpected JSON type %v", value) 16672 } 16673 16674 var cv []types.MediaConcurrency 16675 if *v == nil { 16676 cv = []types.MediaConcurrency{} 16677 } else { 16678 cv = *v 16679 } 16680 16681 for _, value := range shape { 16682 var col types.MediaConcurrency 16683 destAddr := &col 16684 if err := awsRestjson1_deserializeDocumentMediaConcurrency(&destAddr, value); err != nil { 16685 return err 16686 } 16687 col = *destAddr 16688 cv = append(cv, col) 16689 16690 } 16691 *v = cv 16692 return nil 16693} 16694 16695func awsRestjson1_deserializeDocumentMediaConcurrency(v **types.MediaConcurrency, value interface{}) error { 16696 if v == nil { 16697 return fmt.Errorf("unexpected nil of type %T", v) 16698 } 16699 if value == nil { 16700 return nil 16701 } 16702 16703 shape, ok := value.(map[string]interface{}) 16704 if !ok { 16705 return fmt.Errorf("unexpected JSON type %v", value) 16706 } 16707 16708 var sv *types.MediaConcurrency 16709 if *v == nil { 16710 sv = &types.MediaConcurrency{} 16711 } else { 16712 sv = *v 16713 } 16714 16715 for key, value := range shape { 16716 switch key { 16717 case "Channel": 16718 if value != nil { 16719 jtv, ok := value.(string) 16720 if !ok { 16721 return fmt.Errorf("expected Channel to be of type string, got %T instead", value) 16722 } 16723 sv.Channel = types.Channel(jtv) 16724 } 16725 16726 case "Concurrency": 16727 if value != nil { 16728 jtv, ok := value.(json.Number) 16729 if !ok { 16730 return fmt.Errorf("expected Concurrency to be json.Number, got %T instead", value) 16731 } 16732 i64, err := jtv.Int64() 16733 if err != nil { 16734 return err 16735 } 16736 sv.Concurrency = int32(i64) 16737 } 16738 16739 default: 16740 _, _ = key, value 16741 16742 } 16743 } 16744 *v = sv 16745 return nil 16746} 16747 16748func awsRestjson1_deserializeDocumentOriginsList(v *[]string, value interface{}) error { 16749 if v == nil { 16750 return fmt.Errorf("unexpected nil of type %T", v) 16751 } 16752 if value == nil { 16753 return nil 16754 } 16755 16756 shape, ok := value.([]interface{}) 16757 if !ok { 16758 return fmt.Errorf("unexpected JSON type %v", value) 16759 } 16760 16761 var cv []string 16762 if *v == nil { 16763 cv = []string{} 16764 } else { 16765 cv = *v 16766 } 16767 16768 for _, value := range shape { 16769 var col string 16770 if value != nil { 16771 jtv, ok := value.(string) 16772 if !ok { 16773 return fmt.Errorf("expected Origin to be of type string, got %T instead", value) 16774 } 16775 col = jtv 16776 } 16777 cv = append(cv, col) 16778 16779 } 16780 *v = cv 16781 return nil 16782} 16783 16784func awsRestjson1_deserializeDocumentOutboundCallerConfig(v **types.OutboundCallerConfig, value interface{}) error { 16785 if v == nil { 16786 return fmt.Errorf("unexpected nil of type %T", v) 16787 } 16788 if value == nil { 16789 return nil 16790 } 16791 16792 shape, ok := value.(map[string]interface{}) 16793 if !ok { 16794 return fmt.Errorf("unexpected JSON type %v", value) 16795 } 16796 16797 var sv *types.OutboundCallerConfig 16798 if *v == nil { 16799 sv = &types.OutboundCallerConfig{} 16800 } else { 16801 sv = *v 16802 } 16803 16804 for key, value := range shape { 16805 switch key { 16806 case "OutboundCallerIdName": 16807 if value != nil { 16808 jtv, ok := value.(string) 16809 if !ok { 16810 return fmt.Errorf("expected OutboundCallerIdName to be of type string, got %T instead", value) 16811 } 16812 sv.OutboundCallerIdName = ptr.String(jtv) 16813 } 16814 16815 case "OutboundCallerIdNumberId": 16816 if value != nil { 16817 jtv, ok := value.(string) 16818 if !ok { 16819 return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) 16820 } 16821 sv.OutboundCallerIdNumberId = ptr.String(jtv) 16822 } 16823 16824 case "OutboundFlowId": 16825 if value != nil { 16826 jtv, ok := value.(string) 16827 if !ok { 16828 return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) 16829 } 16830 sv.OutboundFlowId = ptr.String(jtv) 16831 } 16832 16833 default: 16834 _, _ = key, value 16835 16836 } 16837 } 16838 *v = sv 16839 return nil 16840} 16841 16842func awsRestjson1_deserializeDocumentOutboundContactNotPermittedException(v **types.OutboundContactNotPermittedException, value interface{}) error { 16843 if v == nil { 16844 return fmt.Errorf("unexpected nil of type %T", v) 16845 } 16846 if value == nil { 16847 return nil 16848 } 16849 16850 shape, ok := value.(map[string]interface{}) 16851 if !ok { 16852 return fmt.Errorf("unexpected JSON type %v", value) 16853 } 16854 16855 var sv *types.OutboundContactNotPermittedException 16856 if *v == nil { 16857 sv = &types.OutboundContactNotPermittedException{} 16858 } else { 16859 sv = *v 16860 } 16861 16862 for key, value := range shape { 16863 switch key { 16864 case "Message": 16865 if value != nil { 16866 jtv, ok := value.(string) 16867 if !ok { 16868 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 16869 } 16870 sv.Message = ptr.String(jtv) 16871 } 16872 16873 default: 16874 _, _ = key, value 16875 16876 } 16877 } 16878 *v = sv 16879 return nil 16880} 16881 16882func awsRestjson1_deserializeDocumentPhoneNumberQuickConnectConfig(v **types.PhoneNumberQuickConnectConfig, value interface{}) error { 16883 if v == nil { 16884 return fmt.Errorf("unexpected nil of type %T", v) 16885 } 16886 if value == nil { 16887 return nil 16888 } 16889 16890 shape, ok := value.(map[string]interface{}) 16891 if !ok { 16892 return fmt.Errorf("unexpected JSON type %v", value) 16893 } 16894 16895 var sv *types.PhoneNumberQuickConnectConfig 16896 if *v == nil { 16897 sv = &types.PhoneNumberQuickConnectConfig{} 16898 } else { 16899 sv = *v 16900 } 16901 16902 for key, value := range shape { 16903 switch key { 16904 case "PhoneNumber": 16905 if value != nil { 16906 jtv, ok := value.(string) 16907 if !ok { 16908 return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) 16909 } 16910 sv.PhoneNumber = ptr.String(jtv) 16911 } 16912 16913 default: 16914 _, _ = key, value 16915 16916 } 16917 } 16918 *v = sv 16919 return nil 16920} 16921 16922func awsRestjson1_deserializeDocumentPhoneNumberSummary(v **types.PhoneNumberSummary, value interface{}) error { 16923 if v == nil { 16924 return fmt.Errorf("unexpected nil of type %T", v) 16925 } 16926 if value == nil { 16927 return nil 16928 } 16929 16930 shape, ok := value.(map[string]interface{}) 16931 if !ok { 16932 return fmt.Errorf("unexpected JSON type %v", value) 16933 } 16934 16935 var sv *types.PhoneNumberSummary 16936 if *v == nil { 16937 sv = &types.PhoneNumberSummary{} 16938 } else { 16939 sv = *v 16940 } 16941 16942 for key, value := range shape { 16943 switch key { 16944 case "Arn": 16945 if value != nil { 16946 jtv, ok := value.(string) 16947 if !ok { 16948 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 16949 } 16950 sv.Arn = ptr.String(jtv) 16951 } 16952 16953 case "Id": 16954 if value != nil { 16955 jtv, ok := value.(string) 16956 if !ok { 16957 return fmt.Errorf("expected PhoneNumberId to be of type string, got %T instead", value) 16958 } 16959 sv.Id = ptr.String(jtv) 16960 } 16961 16962 case "PhoneNumber": 16963 if value != nil { 16964 jtv, ok := value.(string) 16965 if !ok { 16966 return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) 16967 } 16968 sv.PhoneNumber = ptr.String(jtv) 16969 } 16970 16971 case "PhoneNumberCountryCode": 16972 if value != nil { 16973 jtv, ok := value.(string) 16974 if !ok { 16975 return fmt.Errorf("expected PhoneNumberCountryCode to be of type string, got %T instead", value) 16976 } 16977 sv.PhoneNumberCountryCode = types.PhoneNumberCountryCode(jtv) 16978 } 16979 16980 case "PhoneNumberType": 16981 if value != nil { 16982 jtv, ok := value.(string) 16983 if !ok { 16984 return fmt.Errorf("expected PhoneNumberType to be of type string, got %T instead", value) 16985 } 16986 sv.PhoneNumberType = types.PhoneNumberType(jtv) 16987 } 16988 16989 default: 16990 _, _ = key, value 16991 16992 } 16993 } 16994 *v = sv 16995 return nil 16996} 16997 16998func awsRestjson1_deserializeDocumentPhoneNumberSummaryList(v *[]types.PhoneNumberSummary, value interface{}) error { 16999 if v == nil { 17000 return fmt.Errorf("unexpected nil of type %T", v) 17001 } 17002 if value == nil { 17003 return nil 17004 } 17005 17006 shape, ok := value.([]interface{}) 17007 if !ok { 17008 return fmt.Errorf("unexpected JSON type %v", value) 17009 } 17010 17011 var cv []types.PhoneNumberSummary 17012 if *v == nil { 17013 cv = []types.PhoneNumberSummary{} 17014 } else { 17015 cv = *v 17016 } 17017 17018 for _, value := range shape { 17019 var col types.PhoneNumberSummary 17020 destAddr := &col 17021 if err := awsRestjson1_deserializeDocumentPhoneNumberSummary(&destAddr, value); err != nil { 17022 return err 17023 } 17024 col = *destAddr 17025 cv = append(cv, col) 17026 17027 } 17028 *v = cv 17029 return nil 17030} 17031 17032func awsRestjson1_deserializeDocumentProblemDetail(v **types.ProblemDetail, value interface{}) error { 17033 if v == nil { 17034 return fmt.Errorf("unexpected nil of type %T", v) 17035 } 17036 if value == nil { 17037 return nil 17038 } 17039 17040 shape, ok := value.(map[string]interface{}) 17041 if !ok { 17042 return fmt.Errorf("unexpected JSON type %v", value) 17043 } 17044 17045 var sv *types.ProblemDetail 17046 if *v == nil { 17047 sv = &types.ProblemDetail{} 17048 } else { 17049 sv = *v 17050 } 17051 17052 for key, value := range shape { 17053 switch key { 17054 case "message": 17055 if value != nil { 17056 jtv, ok := value.(string) 17057 if !ok { 17058 return fmt.Errorf("expected ProblemMessageString to be of type string, got %T instead", value) 17059 } 17060 sv.Message = ptr.String(jtv) 17061 } 17062 17063 default: 17064 _, _ = key, value 17065 17066 } 17067 } 17068 *v = sv 17069 return nil 17070} 17071 17072func awsRestjson1_deserializeDocumentProblems(v *[]types.ProblemDetail, value interface{}) error { 17073 if v == nil { 17074 return fmt.Errorf("unexpected nil of type %T", v) 17075 } 17076 if value == nil { 17077 return nil 17078 } 17079 17080 shape, ok := value.([]interface{}) 17081 if !ok { 17082 return fmt.Errorf("unexpected JSON type %v", value) 17083 } 17084 17085 var cv []types.ProblemDetail 17086 if *v == nil { 17087 cv = []types.ProblemDetail{} 17088 } else { 17089 cv = *v 17090 } 17091 17092 for _, value := range shape { 17093 var col types.ProblemDetail 17094 destAddr := &col 17095 if err := awsRestjson1_deserializeDocumentProblemDetail(&destAddr, value); err != nil { 17096 return err 17097 } 17098 col = *destAddr 17099 cv = append(cv, col) 17100 17101 } 17102 *v = cv 17103 return nil 17104} 17105 17106func awsRestjson1_deserializeDocumentPromptSummary(v **types.PromptSummary, value interface{}) error { 17107 if v == nil { 17108 return fmt.Errorf("unexpected nil of type %T", v) 17109 } 17110 if value == nil { 17111 return nil 17112 } 17113 17114 shape, ok := value.(map[string]interface{}) 17115 if !ok { 17116 return fmt.Errorf("unexpected JSON type %v", value) 17117 } 17118 17119 var sv *types.PromptSummary 17120 if *v == nil { 17121 sv = &types.PromptSummary{} 17122 } else { 17123 sv = *v 17124 } 17125 17126 for key, value := range shape { 17127 switch key { 17128 case "Arn": 17129 if value != nil { 17130 jtv, ok := value.(string) 17131 if !ok { 17132 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17133 } 17134 sv.Arn = ptr.String(jtv) 17135 } 17136 17137 case "Id": 17138 if value != nil { 17139 jtv, ok := value.(string) 17140 if !ok { 17141 return fmt.Errorf("expected PromptId to be of type string, got %T instead", value) 17142 } 17143 sv.Id = ptr.String(jtv) 17144 } 17145 17146 case "Name": 17147 if value != nil { 17148 jtv, ok := value.(string) 17149 if !ok { 17150 return fmt.Errorf("expected PromptName to be of type string, got %T instead", value) 17151 } 17152 sv.Name = ptr.String(jtv) 17153 } 17154 17155 default: 17156 _, _ = key, value 17157 17158 } 17159 } 17160 *v = sv 17161 return nil 17162} 17163 17164func awsRestjson1_deserializeDocumentPromptSummaryList(v *[]types.PromptSummary, value interface{}) error { 17165 if v == nil { 17166 return fmt.Errorf("unexpected nil of type %T", v) 17167 } 17168 if value == nil { 17169 return nil 17170 } 17171 17172 shape, ok := value.([]interface{}) 17173 if !ok { 17174 return fmt.Errorf("unexpected JSON type %v", value) 17175 } 17176 17177 var cv []types.PromptSummary 17178 if *v == nil { 17179 cv = []types.PromptSummary{} 17180 } else { 17181 cv = *v 17182 } 17183 17184 for _, value := range shape { 17185 var col types.PromptSummary 17186 destAddr := &col 17187 if err := awsRestjson1_deserializeDocumentPromptSummary(&destAddr, value); err != nil { 17188 return err 17189 } 17190 col = *destAddr 17191 cv = append(cv, col) 17192 17193 } 17194 *v = cv 17195 return nil 17196} 17197 17198func awsRestjson1_deserializeDocumentQueue(v **types.Queue, value interface{}) error { 17199 if v == nil { 17200 return fmt.Errorf("unexpected nil of type %T", v) 17201 } 17202 if value == nil { 17203 return nil 17204 } 17205 17206 shape, ok := value.(map[string]interface{}) 17207 if !ok { 17208 return fmt.Errorf("unexpected JSON type %v", value) 17209 } 17210 17211 var sv *types.Queue 17212 if *v == nil { 17213 sv = &types.Queue{} 17214 } else { 17215 sv = *v 17216 } 17217 17218 for key, value := range shape { 17219 switch key { 17220 case "Description": 17221 if value != nil { 17222 jtv, ok := value.(string) 17223 if !ok { 17224 return fmt.Errorf("expected QueueDescription to be of type string, got %T instead", value) 17225 } 17226 sv.Description = ptr.String(jtv) 17227 } 17228 17229 case "HoursOfOperationId": 17230 if value != nil { 17231 jtv, ok := value.(string) 17232 if !ok { 17233 return fmt.Errorf("expected HoursOfOperationId to be of type string, got %T instead", value) 17234 } 17235 sv.HoursOfOperationId = ptr.String(jtv) 17236 } 17237 17238 case "MaxContacts": 17239 if value != nil { 17240 jtv, ok := value.(json.Number) 17241 if !ok { 17242 return fmt.Errorf("expected QueueMaxContacts to be json.Number, got %T instead", value) 17243 } 17244 i64, err := jtv.Int64() 17245 if err != nil { 17246 return err 17247 } 17248 sv.MaxContacts = int32(i64) 17249 } 17250 17251 case "Name": 17252 if value != nil { 17253 jtv, ok := value.(string) 17254 if !ok { 17255 return fmt.Errorf("expected CommonNameLength127 to be of type string, got %T instead", value) 17256 } 17257 sv.Name = ptr.String(jtv) 17258 } 17259 17260 case "OutboundCallerConfig": 17261 if err := awsRestjson1_deserializeDocumentOutboundCallerConfig(&sv.OutboundCallerConfig, value); err != nil { 17262 return err 17263 } 17264 17265 case "QueueArn": 17266 if value != nil { 17267 jtv, ok := value.(string) 17268 if !ok { 17269 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17270 } 17271 sv.QueueArn = ptr.String(jtv) 17272 } 17273 17274 case "QueueId": 17275 if value != nil { 17276 jtv, ok := value.(string) 17277 if !ok { 17278 return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) 17279 } 17280 sv.QueueId = ptr.String(jtv) 17281 } 17282 17283 case "Status": 17284 if value != nil { 17285 jtv, ok := value.(string) 17286 if !ok { 17287 return fmt.Errorf("expected QueueStatus to be of type string, got %T instead", value) 17288 } 17289 sv.Status = types.QueueStatus(jtv) 17290 } 17291 17292 case "Tags": 17293 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 17294 return err 17295 } 17296 17297 default: 17298 _, _ = key, value 17299 17300 } 17301 } 17302 *v = sv 17303 return nil 17304} 17305 17306func awsRestjson1_deserializeDocumentQueueQuickConnectConfig(v **types.QueueQuickConnectConfig, value interface{}) error { 17307 if v == nil { 17308 return fmt.Errorf("unexpected nil of type %T", v) 17309 } 17310 if value == nil { 17311 return nil 17312 } 17313 17314 shape, ok := value.(map[string]interface{}) 17315 if !ok { 17316 return fmt.Errorf("unexpected JSON type %v", value) 17317 } 17318 17319 var sv *types.QueueQuickConnectConfig 17320 if *v == nil { 17321 sv = &types.QueueQuickConnectConfig{} 17322 } else { 17323 sv = *v 17324 } 17325 17326 for key, value := range shape { 17327 switch key { 17328 case "ContactFlowId": 17329 if value != nil { 17330 jtv, ok := value.(string) 17331 if !ok { 17332 return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) 17333 } 17334 sv.ContactFlowId = ptr.String(jtv) 17335 } 17336 17337 case "QueueId": 17338 if value != nil { 17339 jtv, ok := value.(string) 17340 if !ok { 17341 return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) 17342 } 17343 sv.QueueId = ptr.String(jtv) 17344 } 17345 17346 default: 17347 _, _ = key, value 17348 17349 } 17350 } 17351 *v = sv 17352 return nil 17353} 17354 17355func awsRestjson1_deserializeDocumentQueueReference(v **types.QueueReference, value interface{}) error { 17356 if v == nil { 17357 return fmt.Errorf("unexpected nil of type %T", v) 17358 } 17359 if value == nil { 17360 return nil 17361 } 17362 17363 shape, ok := value.(map[string]interface{}) 17364 if !ok { 17365 return fmt.Errorf("unexpected JSON type %v", value) 17366 } 17367 17368 var sv *types.QueueReference 17369 if *v == nil { 17370 sv = &types.QueueReference{} 17371 } else { 17372 sv = *v 17373 } 17374 17375 for key, value := range shape { 17376 switch key { 17377 case "Arn": 17378 if value != nil { 17379 jtv, ok := value.(string) 17380 if !ok { 17381 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17382 } 17383 sv.Arn = ptr.String(jtv) 17384 } 17385 17386 case "Id": 17387 if value != nil { 17388 jtv, ok := value.(string) 17389 if !ok { 17390 return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) 17391 } 17392 sv.Id = ptr.String(jtv) 17393 } 17394 17395 default: 17396 _, _ = key, value 17397 17398 } 17399 } 17400 *v = sv 17401 return nil 17402} 17403 17404func awsRestjson1_deserializeDocumentQueueSummary(v **types.QueueSummary, value interface{}) error { 17405 if v == nil { 17406 return fmt.Errorf("unexpected nil of type %T", v) 17407 } 17408 if value == nil { 17409 return nil 17410 } 17411 17412 shape, ok := value.(map[string]interface{}) 17413 if !ok { 17414 return fmt.Errorf("unexpected JSON type %v", value) 17415 } 17416 17417 var sv *types.QueueSummary 17418 if *v == nil { 17419 sv = &types.QueueSummary{} 17420 } else { 17421 sv = *v 17422 } 17423 17424 for key, value := range shape { 17425 switch key { 17426 case "Arn": 17427 if value != nil { 17428 jtv, ok := value.(string) 17429 if !ok { 17430 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17431 } 17432 sv.Arn = ptr.String(jtv) 17433 } 17434 17435 case "Id": 17436 if value != nil { 17437 jtv, ok := value.(string) 17438 if !ok { 17439 return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) 17440 } 17441 sv.Id = ptr.String(jtv) 17442 } 17443 17444 case "Name": 17445 if value != nil { 17446 jtv, ok := value.(string) 17447 if !ok { 17448 return fmt.Errorf("expected QueueName to be of type string, got %T instead", value) 17449 } 17450 sv.Name = ptr.String(jtv) 17451 } 17452 17453 case "QueueType": 17454 if value != nil { 17455 jtv, ok := value.(string) 17456 if !ok { 17457 return fmt.Errorf("expected QueueType to be of type string, got %T instead", value) 17458 } 17459 sv.QueueType = types.QueueType(jtv) 17460 } 17461 17462 default: 17463 _, _ = key, value 17464 17465 } 17466 } 17467 *v = sv 17468 return nil 17469} 17470 17471func awsRestjson1_deserializeDocumentQueueSummaryList(v *[]types.QueueSummary, value interface{}) error { 17472 if v == nil { 17473 return fmt.Errorf("unexpected nil of type %T", v) 17474 } 17475 if value == nil { 17476 return nil 17477 } 17478 17479 shape, ok := value.([]interface{}) 17480 if !ok { 17481 return fmt.Errorf("unexpected JSON type %v", value) 17482 } 17483 17484 var cv []types.QueueSummary 17485 if *v == nil { 17486 cv = []types.QueueSummary{} 17487 } else { 17488 cv = *v 17489 } 17490 17491 for _, value := range shape { 17492 var col types.QueueSummary 17493 destAddr := &col 17494 if err := awsRestjson1_deserializeDocumentQueueSummary(&destAddr, value); err != nil { 17495 return err 17496 } 17497 col = *destAddr 17498 cv = append(cv, col) 17499 17500 } 17501 *v = cv 17502 return nil 17503} 17504 17505func awsRestjson1_deserializeDocumentQuickConnect(v **types.QuickConnect, value interface{}) error { 17506 if v == nil { 17507 return fmt.Errorf("unexpected nil of type %T", v) 17508 } 17509 if value == nil { 17510 return nil 17511 } 17512 17513 shape, ok := value.(map[string]interface{}) 17514 if !ok { 17515 return fmt.Errorf("unexpected JSON type %v", value) 17516 } 17517 17518 var sv *types.QuickConnect 17519 if *v == nil { 17520 sv = &types.QuickConnect{} 17521 } else { 17522 sv = *v 17523 } 17524 17525 for key, value := range shape { 17526 switch key { 17527 case "Description": 17528 if value != nil { 17529 jtv, ok := value.(string) 17530 if !ok { 17531 return fmt.Errorf("expected QuickConnectDescription to be of type string, got %T instead", value) 17532 } 17533 sv.Description = ptr.String(jtv) 17534 } 17535 17536 case "Name": 17537 if value != nil { 17538 jtv, ok := value.(string) 17539 if !ok { 17540 return fmt.Errorf("expected QuickConnectName to be of type string, got %T instead", value) 17541 } 17542 sv.Name = ptr.String(jtv) 17543 } 17544 17545 case "QuickConnectARN": 17546 if value != nil { 17547 jtv, ok := value.(string) 17548 if !ok { 17549 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17550 } 17551 sv.QuickConnectARN = ptr.String(jtv) 17552 } 17553 17554 case "QuickConnectConfig": 17555 if err := awsRestjson1_deserializeDocumentQuickConnectConfig(&sv.QuickConnectConfig, value); err != nil { 17556 return err 17557 } 17558 17559 case "QuickConnectId": 17560 if value != nil { 17561 jtv, ok := value.(string) 17562 if !ok { 17563 return fmt.Errorf("expected QuickConnectId to be of type string, got %T instead", value) 17564 } 17565 sv.QuickConnectId = ptr.String(jtv) 17566 } 17567 17568 case "Tags": 17569 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 17570 return err 17571 } 17572 17573 default: 17574 _, _ = key, value 17575 17576 } 17577 } 17578 *v = sv 17579 return nil 17580} 17581 17582func awsRestjson1_deserializeDocumentQuickConnectConfig(v **types.QuickConnectConfig, value interface{}) error { 17583 if v == nil { 17584 return fmt.Errorf("unexpected nil of type %T", v) 17585 } 17586 if value == nil { 17587 return nil 17588 } 17589 17590 shape, ok := value.(map[string]interface{}) 17591 if !ok { 17592 return fmt.Errorf("unexpected JSON type %v", value) 17593 } 17594 17595 var sv *types.QuickConnectConfig 17596 if *v == nil { 17597 sv = &types.QuickConnectConfig{} 17598 } else { 17599 sv = *v 17600 } 17601 17602 for key, value := range shape { 17603 switch key { 17604 case "PhoneConfig": 17605 if err := awsRestjson1_deserializeDocumentPhoneNumberQuickConnectConfig(&sv.PhoneConfig, value); err != nil { 17606 return err 17607 } 17608 17609 case "QueueConfig": 17610 if err := awsRestjson1_deserializeDocumentQueueQuickConnectConfig(&sv.QueueConfig, value); err != nil { 17611 return err 17612 } 17613 17614 case "QuickConnectType": 17615 if value != nil { 17616 jtv, ok := value.(string) 17617 if !ok { 17618 return fmt.Errorf("expected QuickConnectType to be of type string, got %T instead", value) 17619 } 17620 sv.QuickConnectType = types.QuickConnectType(jtv) 17621 } 17622 17623 case "UserConfig": 17624 if err := awsRestjson1_deserializeDocumentUserQuickConnectConfig(&sv.UserConfig, value); err != nil { 17625 return err 17626 } 17627 17628 default: 17629 _, _ = key, value 17630 17631 } 17632 } 17633 *v = sv 17634 return nil 17635} 17636 17637func awsRestjson1_deserializeDocumentQuickConnectSummary(v **types.QuickConnectSummary, value interface{}) error { 17638 if v == nil { 17639 return fmt.Errorf("unexpected nil of type %T", v) 17640 } 17641 if value == nil { 17642 return nil 17643 } 17644 17645 shape, ok := value.(map[string]interface{}) 17646 if !ok { 17647 return fmt.Errorf("unexpected JSON type %v", value) 17648 } 17649 17650 var sv *types.QuickConnectSummary 17651 if *v == nil { 17652 sv = &types.QuickConnectSummary{} 17653 } else { 17654 sv = *v 17655 } 17656 17657 for key, value := range shape { 17658 switch key { 17659 case "Arn": 17660 if value != nil { 17661 jtv, ok := value.(string) 17662 if !ok { 17663 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17664 } 17665 sv.Arn = ptr.String(jtv) 17666 } 17667 17668 case "Id": 17669 if value != nil { 17670 jtv, ok := value.(string) 17671 if !ok { 17672 return fmt.Errorf("expected QuickConnectId to be of type string, got %T instead", value) 17673 } 17674 sv.Id = ptr.String(jtv) 17675 } 17676 17677 case "Name": 17678 if value != nil { 17679 jtv, ok := value.(string) 17680 if !ok { 17681 return fmt.Errorf("expected QuickConnectName to be of type string, got %T instead", value) 17682 } 17683 sv.Name = ptr.String(jtv) 17684 } 17685 17686 case "QuickConnectType": 17687 if value != nil { 17688 jtv, ok := value.(string) 17689 if !ok { 17690 return fmt.Errorf("expected QuickConnectType to be of type string, got %T instead", value) 17691 } 17692 sv.QuickConnectType = types.QuickConnectType(jtv) 17693 } 17694 17695 default: 17696 _, _ = key, value 17697 17698 } 17699 } 17700 *v = sv 17701 return nil 17702} 17703 17704func awsRestjson1_deserializeDocumentQuickConnectSummaryList(v *[]types.QuickConnectSummary, value interface{}) error { 17705 if v == nil { 17706 return fmt.Errorf("unexpected nil of type %T", v) 17707 } 17708 if value == nil { 17709 return nil 17710 } 17711 17712 shape, ok := value.([]interface{}) 17713 if !ok { 17714 return fmt.Errorf("unexpected JSON type %v", value) 17715 } 17716 17717 var cv []types.QuickConnectSummary 17718 if *v == nil { 17719 cv = []types.QuickConnectSummary{} 17720 } else { 17721 cv = *v 17722 } 17723 17724 for _, value := range shape { 17725 var col types.QuickConnectSummary 17726 destAddr := &col 17727 if err := awsRestjson1_deserializeDocumentQuickConnectSummary(&destAddr, value); err != nil { 17728 return err 17729 } 17730 col = *destAddr 17731 cv = append(cv, col) 17732 17733 } 17734 *v = cv 17735 return nil 17736} 17737 17738func awsRestjson1_deserializeDocumentResourceConflictException(v **types.ResourceConflictException, value interface{}) error { 17739 if v == nil { 17740 return fmt.Errorf("unexpected nil of type %T", v) 17741 } 17742 if value == nil { 17743 return nil 17744 } 17745 17746 shape, ok := value.(map[string]interface{}) 17747 if !ok { 17748 return fmt.Errorf("unexpected JSON type %v", value) 17749 } 17750 17751 var sv *types.ResourceConflictException 17752 if *v == nil { 17753 sv = &types.ResourceConflictException{} 17754 } else { 17755 sv = *v 17756 } 17757 17758 for key, value := range shape { 17759 switch key { 17760 case "Message": 17761 if value != nil { 17762 jtv, ok := value.(string) 17763 if !ok { 17764 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 17765 } 17766 sv.Message = ptr.String(jtv) 17767 } 17768 17769 default: 17770 _, _ = key, value 17771 17772 } 17773 } 17774 *v = sv 17775 return nil 17776} 17777 17778func awsRestjson1_deserializeDocumentResourceInUseException(v **types.ResourceInUseException, value interface{}) error { 17779 if v == nil { 17780 return fmt.Errorf("unexpected nil of type %T", v) 17781 } 17782 if value == nil { 17783 return nil 17784 } 17785 17786 shape, ok := value.(map[string]interface{}) 17787 if !ok { 17788 return fmt.Errorf("unexpected JSON type %v", value) 17789 } 17790 17791 var sv *types.ResourceInUseException 17792 if *v == nil { 17793 sv = &types.ResourceInUseException{} 17794 } else { 17795 sv = *v 17796 } 17797 17798 for key, value := range shape { 17799 switch key { 17800 case "Message": 17801 if value != nil { 17802 jtv, ok := value.(string) 17803 if !ok { 17804 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 17805 } 17806 sv.Message = ptr.String(jtv) 17807 } 17808 17809 case "ResourceId": 17810 if value != nil { 17811 jtv, ok := value.(string) 17812 if !ok { 17813 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17814 } 17815 sv.ResourceId = ptr.String(jtv) 17816 } 17817 17818 case "ResourceType": 17819 if value != nil { 17820 jtv, ok := value.(string) 17821 if !ok { 17822 return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value) 17823 } 17824 sv.ResourceType = types.ResourceType(jtv) 17825 } 17826 17827 default: 17828 _, _ = key, value 17829 17830 } 17831 } 17832 *v = sv 17833 return nil 17834} 17835 17836func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 17837 if v == nil { 17838 return fmt.Errorf("unexpected nil of type %T", v) 17839 } 17840 if value == nil { 17841 return nil 17842 } 17843 17844 shape, ok := value.(map[string]interface{}) 17845 if !ok { 17846 return fmt.Errorf("unexpected JSON type %v", value) 17847 } 17848 17849 var sv *types.ResourceNotFoundException 17850 if *v == nil { 17851 sv = &types.ResourceNotFoundException{} 17852 } else { 17853 sv = *v 17854 } 17855 17856 for key, value := range shape { 17857 switch key { 17858 case "Message": 17859 if value != nil { 17860 jtv, ok := value.(string) 17861 if !ok { 17862 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 17863 } 17864 sv.Message = ptr.String(jtv) 17865 } 17866 17867 default: 17868 _, _ = key, value 17869 17870 } 17871 } 17872 *v = sv 17873 return nil 17874} 17875 17876func awsRestjson1_deserializeDocumentRoutingProfile(v **types.RoutingProfile, value interface{}) error { 17877 if v == nil { 17878 return fmt.Errorf("unexpected nil of type %T", v) 17879 } 17880 if value == nil { 17881 return nil 17882 } 17883 17884 shape, ok := value.(map[string]interface{}) 17885 if !ok { 17886 return fmt.Errorf("unexpected JSON type %v", value) 17887 } 17888 17889 var sv *types.RoutingProfile 17890 if *v == nil { 17891 sv = &types.RoutingProfile{} 17892 } else { 17893 sv = *v 17894 } 17895 17896 for key, value := range shape { 17897 switch key { 17898 case "DefaultOutboundQueueId": 17899 if value != nil { 17900 jtv, ok := value.(string) 17901 if !ok { 17902 return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) 17903 } 17904 sv.DefaultOutboundQueueId = ptr.String(jtv) 17905 } 17906 17907 case "Description": 17908 if value != nil { 17909 jtv, ok := value.(string) 17910 if !ok { 17911 return fmt.Errorf("expected RoutingProfileDescription to be of type string, got %T instead", value) 17912 } 17913 sv.Description = ptr.String(jtv) 17914 } 17915 17916 case "InstanceId": 17917 if value != nil { 17918 jtv, ok := value.(string) 17919 if !ok { 17920 return fmt.Errorf("expected InstanceId to be of type string, got %T instead", value) 17921 } 17922 sv.InstanceId = ptr.String(jtv) 17923 } 17924 17925 case "MediaConcurrencies": 17926 if err := awsRestjson1_deserializeDocumentMediaConcurrencies(&sv.MediaConcurrencies, value); err != nil { 17927 return err 17928 } 17929 17930 case "Name": 17931 if value != nil { 17932 jtv, ok := value.(string) 17933 if !ok { 17934 return fmt.Errorf("expected RoutingProfileName to be of type string, got %T instead", value) 17935 } 17936 sv.Name = ptr.String(jtv) 17937 } 17938 17939 case "RoutingProfileArn": 17940 if value != nil { 17941 jtv, ok := value.(string) 17942 if !ok { 17943 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 17944 } 17945 sv.RoutingProfileArn = ptr.String(jtv) 17946 } 17947 17948 case "RoutingProfileId": 17949 if value != nil { 17950 jtv, ok := value.(string) 17951 if !ok { 17952 return fmt.Errorf("expected RoutingProfileId to be of type string, got %T instead", value) 17953 } 17954 sv.RoutingProfileId = ptr.String(jtv) 17955 } 17956 17957 case "Tags": 17958 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 17959 return err 17960 } 17961 17962 default: 17963 _, _ = key, value 17964 17965 } 17966 } 17967 *v = sv 17968 return nil 17969} 17970 17971func awsRestjson1_deserializeDocumentRoutingProfileQueueConfigSummary(v **types.RoutingProfileQueueConfigSummary, value interface{}) error { 17972 if v == nil { 17973 return fmt.Errorf("unexpected nil of type %T", v) 17974 } 17975 if value == nil { 17976 return nil 17977 } 17978 17979 shape, ok := value.(map[string]interface{}) 17980 if !ok { 17981 return fmt.Errorf("unexpected JSON type %v", value) 17982 } 17983 17984 var sv *types.RoutingProfileQueueConfigSummary 17985 if *v == nil { 17986 sv = &types.RoutingProfileQueueConfigSummary{} 17987 } else { 17988 sv = *v 17989 } 17990 17991 for key, value := range shape { 17992 switch key { 17993 case "Channel": 17994 if value != nil { 17995 jtv, ok := value.(string) 17996 if !ok { 17997 return fmt.Errorf("expected Channel to be of type string, got %T instead", value) 17998 } 17999 sv.Channel = types.Channel(jtv) 18000 } 18001 18002 case "Delay": 18003 if value != nil { 18004 jtv, ok := value.(json.Number) 18005 if !ok { 18006 return fmt.Errorf("expected Delay to be json.Number, got %T instead", value) 18007 } 18008 i64, err := jtv.Int64() 18009 if err != nil { 18010 return err 18011 } 18012 sv.Delay = int32(i64) 18013 } 18014 18015 case "Priority": 18016 if value != nil { 18017 jtv, ok := value.(json.Number) 18018 if !ok { 18019 return fmt.Errorf("expected Priority to be json.Number, got %T instead", value) 18020 } 18021 i64, err := jtv.Int64() 18022 if err != nil { 18023 return err 18024 } 18025 sv.Priority = int32(i64) 18026 } 18027 18028 case "QueueArn": 18029 if value != nil { 18030 jtv, ok := value.(string) 18031 if !ok { 18032 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 18033 } 18034 sv.QueueArn = ptr.String(jtv) 18035 } 18036 18037 case "QueueId": 18038 if value != nil { 18039 jtv, ok := value.(string) 18040 if !ok { 18041 return fmt.Errorf("expected QueueId to be of type string, got %T instead", value) 18042 } 18043 sv.QueueId = ptr.String(jtv) 18044 } 18045 18046 case "QueueName": 18047 if value != nil { 18048 jtv, ok := value.(string) 18049 if !ok { 18050 return fmt.Errorf("expected QueueName to be of type string, got %T instead", value) 18051 } 18052 sv.QueueName = ptr.String(jtv) 18053 } 18054 18055 default: 18056 _, _ = key, value 18057 18058 } 18059 } 18060 *v = sv 18061 return nil 18062} 18063 18064func awsRestjson1_deserializeDocumentRoutingProfileQueueConfigSummaryList(v *[]types.RoutingProfileQueueConfigSummary, value interface{}) error { 18065 if v == nil { 18066 return fmt.Errorf("unexpected nil of type %T", v) 18067 } 18068 if value == nil { 18069 return nil 18070 } 18071 18072 shape, ok := value.([]interface{}) 18073 if !ok { 18074 return fmt.Errorf("unexpected JSON type %v", value) 18075 } 18076 18077 var cv []types.RoutingProfileQueueConfigSummary 18078 if *v == nil { 18079 cv = []types.RoutingProfileQueueConfigSummary{} 18080 } else { 18081 cv = *v 18082 } 18083 18084 for _, value := range shape { 18085 var col types.RoutingProfileQueueConfigSummary 18086 destAddr := &col 18087 if err := awsRestjson1_deserializeDocumentRoutingProfileQueueConfigSummary(&destAddr, value); err != nil { 18088 return err 18089 } 18090 col = *destAddr 18091 cv = append(cv, col) 18092 18093 } 18094 *v = cv 18095 return nil 18096} 18097 18098func awsRestjson1_deserializeDocumentRoutingProfileSummary(v **types.RoutingProfileSummary, value interface{}) error { 18099 if v == nil { 18100 return fmt.Errorf("unexpected nil of type %T", v) 18101 } 18102 if value == nil { 18103 return nil 18104 } 18105 18106 shape, ok := value.(map[string]interface{}) 18107 if !ok { 18108 return fmt.Errorf("unexpected JSON type %v", value) 18109 } 18110 18111 var sv *types.RoutingProfileSummary 18112 if *v == nil { 18113 sv = &types.RoutingProfileSummary{} 18114 } else { 18115 sv = *v 18116 } 18117 18118 for key, value := range shape { 18119 switch key { 18120 case "Arn": 18121 if value != nil { 18122 jtv, ok := value.(string) 18123 if !ok { 18124 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 18125 } 18126 sv.Arn = ptr.String(jtv) 18127 } 18128 18129 case "Id": 18130 if value != nil { 18131 jtv, ok := value.(string) 18132 if !ok { 18133 return fmt.Errorf("expected RoutingProfileId to be of type string, got %T instead", value) 18134 } 18135 sv.Id = ptr.String(jtv) 18136 } 18137 18138 case "Name": 18139 if value != nil { 18140 jtv, ok := value.(string) 18141 if !ok { 18142 return fmt.Errorf("expected RoutingProfileName to be of type string, got %T instead", value) 18143 } 18144 sv.Name = ptr.String(jtv) 18145 } 18146 18147 default: 18148 _, _ = key, value 18149 18150 } 18151 } 18152 *v = sv 18153 return nil 18154} 18155 18156func awsRestjson1_deserializeDocumentRoutingProfileSummaryList(v *[]types.RoutingProfileSummary, value interface{}) error { 18157 if v == nil { 18158 return fmt.Errorf("unexpected nil of type %T", v) 18159 } 18160 if value == nil { 18161 return nil 18162 } 18163 18164 shape, ok := value.([]interface{}) 18165 if !ok { 18166 return fmt.Errorf("unexpected JSON type %v", value) 18167 } 18168 18169 var cv []types.RoutingProfileSummary 18170 if *v == nil { 18171 cv = []types.RoutingProfileSummary{} 18172 } else { 18173 cv = *v 18174 } 18175 18176 for _, value := range shape { 18177 var col types.RoutingProfileSummary 18178 destAddr := &col 18179 if err := awsRestjson1_deserializeDocumentRoutingProfileSummary(&destAddr, value); err != nil { 18180 return err 18181 } 18182 col = *destAddr 18183 cv = append(cv, col) 18184 18185 } 18186 *v = cv 18187 return nil 18188} 18189 18190func awsRestjson1_deserializeDocumentS3Config(v **types.S3Config, value interface{}) error { 18191 if v == nil { 18192 return fmt.Errorf("unexpected nil of type %T", v) 18193 } 18194 if value == nil { 18195 return nil 18196 } 18197 18198 shape, ok := value.(map[string]interface{}) 18199 if !ok { 18200 return fmt.Errorf("unexpected JSON type %v", value) 18201 } 18202 18203 var sv *types.S3Config 18204 if *v == nil { 18205 sv = &types.S3Config{} 18206 } else { 18207 sv = *v 18208 } 18209 18210 for key, value := range shape { 18211 switch key { 18212 case "BucketName": 18213 if value != nil { 18214 jtv, ok := value.(string) 18215 if !ok { 18216 return fmt.Errorf("expected BucketName to be of type string, got %T instead", value) 18217 } 18218 sv.BucketName = ptr.String(jtv) 18219 } 18220 18221 case "BucketPrefix": 18222 if value != nil { 18223 jtv, ok := value.(string) 18224 if !ok { 18225 return fmt.Errorf("expected Prefix to be of type string, got %T instead", value) 18226 } 18227 sv.BucketPrefix = ptr.String(jtv) 18228 } 18229 18230 case "EncryptionConfig": 18231 if err := awsRestjson1_deserializeDocumentEncryptionConfig(&sv.EncryptionConfig, value); err != nil { 18232 return err 18233 } 18234 18235 default: 18236 _, _ = key, value 18237 18238 } 18239 } 18240 *v = sv 18241 return nil 18242} 18243 18244func awsRestjson1_deserializeDocumentSecurityKey(v **types.SecurityKey, value interface{}) error { 18245 if v == nil { 18246 return fmt.Errorf("unexpected nil of type %T", v) 18247 } 18248 if value == nil { 18249 return nil 18250 } 18251 18252 shape, ok := value.(map[string]interface{}) 18253 if !ok { 18254 return fmt.Errorf("unexpected JSON type %v", value) 18255 } 18256 18257 var sv *types.SecurityKey 18258 if *v == nil { 18259 sv = &types.SecurityKey{} 18260 } else { 18261 sv = *v 18262 } 18263 18264 for key, value := range shape { 18265 switch key { 18266 case "AssociationId": 18267 if value != nil { 18268 jtv, ok := value.(string) 18269 if !ok { 18270 return fmt.Errorf("expected AssociationId to be of type string, got %T instead", value) 18271 } 18272 sv.AssociationId = ptr.String(jtv) 18273 } 18274 18275 case "CreationTime": 18276 if value != nil { 18277 jtv, ok := value.(json.Number) 18278 if !ok { 18279 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 18280 } 18281 f64, err := jtv.Float64() 18282 if err != nil { 18283 return err 18284 } 18285 sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 18286 } 18287 18288 case "Key": 18289 if value != nil { 18290 jtv, ok := value.(string) 18291 if !ok { 18292 return fmt.Errorf("expected PEM to be of type string, got %T instead", value) 18293 } 18294 sv.Key = ptr.String(jtv) 18295 } 18296 18297 default: 18298 _, _ = key, value 18299 18300 } 18301 } 18302 *v = sv 18303 return nil 18304} 18305 18306func awsRestjson1_deserializeDocumentSecurityKeysList(v *[]types.SecurityKey, value interface{}) error { 18307 if v == nil { 18308 return fmt.Errorf("unexpected nil of type %T", v) 18309 } 18310 if value == nil { 18311 return nil 18312 } 18313 18314 shape, ok := value.([]interface{}) 18315 if !ok { 18316 return fmt.Errorf("unexpected JSON type %v", value) 18317 } 18318 18319 var cv []types.SecurityKey 18320 if *v == nil { 18321 cv = []types.SecurityKey{} 18322 } else { 18323 cv = *v 18324 } 18325 18326 for _, value := range shape { 18327 var col types.SecurityKey 18328 destAddr := &col 18329 if err := awsRestjson1_deserializeDocumentSecurityKey(&destAddr, value); err != nil { 18330 return err 18331 } 18332 col = *destAddr 18333 cv = append(cv, col) 18334 18335 } 18336 *v = cv 18337 return nil 18338} 18339 18340func awsRestjson1_deserializeDocumentSecurityProfileIds(v *[]string, value interface{}) error { 18341 if v == nil { 18342 return fmt.Errorf("unexpected nil of type %T", v) 18343 } 18344 if value == nil { 18345 return nil 18346 } 18347 18348 shape, ok := value.([]interface{}) 18349 if !ok { 18350 return fmt.Errorf("unexpected JSON type %v", value) 18351 } 18352 18353 var cv []string 18354 if *v == nil { 18355 cv = []string{} 18356 } else { 18357 cv = *v 18358 } 18359 18360 for _, value := range shape { 18361 var col string 18362 if value != nil { 18363 jtv, ok := value.(string) 18364 if !ok { 18365 return fmt.Errorf("expected SecurityProfileId to be of type string, got %T instead", value) 18366 } 18367 col = jtv 18368 } 18369 cv = append(cv, col) 18370 18371 } 18372 *v = cv 18373 return nil 18374} 18375 18376func awsRestjson1_deserializeDocumentSecurityProfileSummary(v **types.SecurityProfileSummary, value interface{}) error { 18377 if v == nil { 18378 return fmt.Errorf("unexpected nil of type %T", v) 18379 } 18380 if value == nil { 18381 return nil 18382 } 18383 18384 shape, ok := value.(map[string]interface{}) 18385 if !ok { 18386 return fmt.Errorf("unexpected JSON type %v", value) 18387 } 18388 18389 var sv *types.SecurityProfileSummary 18390 if *v == nil { 18391 sv = &types.SecurityProfileSummary{} 18392 } else { 18393 sv = *v 18394 } 18395 18396 for key, value := range shape { 18397 switch key { 18398 case "Arn": 18399 if value != nil { 18400 jtv, ok := value.(string) 18401 if !ok { 18402 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 18403 } 18404 sv.Arn = ptr.String(jtv) 18405 } 18406 18407 case "Id": 18408 if value != nil { 18409 jtv, ok := value.(string) 18410 if !ok { 18411 return fmt.Errorf("expected SecurityProfileId to be of type string, got %T instead", value) 18412 } 18413 sv.Id = ptr.String(jtv) 18414 } 18415 18416 case "Name": 18417 if value != nil { 18418 jtv, ok := value.(string) 18419 if !ok { 18420 return fmt.Errorf("expected SecurityProfileName to be of type string, got %T instead", value) 18421 } 18422 sv.Name = ptr.String(jtv) 18423 } 18424 18425 default: 18426 _, _ = key, value 18427 18428 } 18429 } 18430 *v = sv 18431 return nil 18432} 18433 18434func awsRestjson1_deserializeDocumentSecurityProfileSummaryList(v *[]types.SecurityProfileSummary, value interface{}) error { 18435 if v == nil { 18436 return fmt.Errorf("unexpected nil of type %T", v) 18437 } 18438 if value == nil { 18439 return nil 18440 } 18441 18442 shape, ok := value.([]interface{}) 18443 if !ok { 18444 return fmt.Errorf("unexpected JSON type %v", value) 18445 } 18446 18447 var cv []types.SecurityProfileSummary 18448 if *v == nil { 18449 cv = []types.SecurityProfileSummary{} 18450 } else { 18451 cv = *v 18452 } 18453 18454 for _, value := range shape { 18455 var col types.SecurityProfileSummary 18456 destAddr := &col 18457 if err := awsRestjson1_deserializeDocumentSecurityProfileSummary(&destAddr, value); err != nil { 18458 return err 18459 } 18460 col = *destAddr 18461 cv = append(cv, col) 18462 18463 } 18464 *v = cv 18465 return nil 18466} 18467 18468func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error { 18469 if v == nil { 18470 return fmt.Errorf("unexpected nil of type %T", v) 18471 } 18472 if value == nil { 18473 return nil 18474 } 18475 18476 shape, ok := value.(map[string]interface{}) 18477 if !ok { 18478 return fmt.Errorf("unexpected JSON type %v", value) 18479 } 18480 18481 var sv *types.ServiceQuotaExceededException 18482 if *v == nil { 18483 sv = &types.ServiceQuotaExceededException{} 18484 } else { 18485 sv = *v 18486 } 18487 18488 for key, value := range shape { 18489 switch key { 18490 case "Message": 18491 if value != nil { 18492 jtv, ok := value.(string) 18493 if !ok { 18494 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 18495 } 18496 sv.Message = ptr.String(jtv) 18497 } 18498 18499 default: 18500 _, _ = key, value 18501 18502 } 18503 } 18504 *v = sv 18505 return nil 18506} 18507 18508func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 18509 if v == nil { 18510 return fmt.Errorf("unexpected nil of type %T", v) 18511 } 18512 if value == nil { 18513 return nil 18514 } 18515 18516 shape, ok := value.(map[string]interface{}) 18517 if !ok { 18518 return fmt.Errorf("unexpected JSON type %v", value) 18519 } 18520 18521 var mv map[string]string 18522 if *v == nil { 18523 mv = map[string]string{} 18524 } else { 18525 mv = *v 18526 } 18527 18528 for key, value := range shape { 18529 var parsedVal string 18530 if value != nil { 18531 jtv, ok := value.(string) 18532 if !ok { 18533 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 18534 } 18535 parsedVal = jtv 18536 } 18537 mv[key] = parsedVal 18538 18539 } 18540 *v = mv 18541 return nil 18542} 18543 18544func awsRestjson1_deserializeDocumentThreshold(v **types.Threshold, value interface{}) error { 18545 if v == nil { 18546 return fmt.Errorf("unexpected nil of type %T", v) 18547 } 18548 if value == nil { 18549 return nil 18550 } 18551 18552 shape, ok := value.(map[string]interface{}) 18553 if !ok { 18554 return fmt.Errorf("unexpected JSON type %v", value) 18555 } 18556 18557 var sv *types.Threshold 18558 if *v == nil { 18559 sv = &types.Threshold{} 18560 } else { 18561 sv = *v 18562 } 18563 18564 for key, value := range shape { 18565 switch key { 18566 case "Comparison": 18567 if value != nil { 18568 jtv, ok := value.(string) 18569 if !ok { 18570 return fmt.Errorf("expected Comparison to be of type string, got %T instead", value) 18571 } 18572 sv.Comparison = types.Comparison(jtv) 18573 } 18574 18575 case "ThresholdValue": 18576 if value != nil { 18577 jtv, ok := value.(json.Number) 18578 if !ok { 18579 return fmt.Errorf("expected ThresholdValue to be json.Number, got %T instead", value) 18580 } 18581 f64, err := jtv.Float64() 18582 if err != nil { 18583 return err 18584 } 18585 sv.ThresholdValue = ptr.Float64(f64) 18586 } 18587 18588 default: 18589 _, _ = key, value 18590 18591 } 18592 } 18593 *v = sv 18594 return nil 18595} 18596 18597func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 18598 if v == nil { 18599 return fmt.Errorf("unexpected nil of type %T", v) 18600 } 18601 if value == nil { 18602 return nil 18603 } 18604 18605 shape, ok := value.(map[string]interface{}) 18606 if !ok { 18607 return fmt.Errorf("unexpected JSON type %v", value) 18608 } 18609 18610 var sv *types.ThrottlingException 18611 if *v == nil { 18612 sv = &types.ThrottlingException{} 18613 } else { 18614 sv = *v 18615 } 18616 18617 for key, value := range shape { 18618 switch key { 18619 case "Message": 18620 if value != nil { 18621 jtv, ok := value.(string) 18622 if !ok { 18623 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 18624 } 18625 sv.Message = ptr.String(jtv) 18626 } 18627 18628 default: 18629 _, _ = key, value 18630 18631 } 18632 } 18633 *v = sv 18634 return nil 18635} 18636 18637func awsRestjson1_deserializeDocumentUseCase(v **types.UseCase, value interface{}) error { 18638 if v == nil { 18639 return fmt.Errorf("unexpected nil of type %T", v) 18640 } 18641 if value == nil { 18642 return nil 18643 } 18644 18645 shape, ok := value.(map[string]interface{}) 18646 if !ok { 18647 return fmt.Errorf("unexpected JSON type %v", value) 18648 } 18649 18650 var sv *types.UseCase 18651 if *v == nil { 18652 sv = &types.UseCase{} 18653 } else { 18654 sv = *v 18655 } 18656 18657 for key, value := range shape { 18658 switch key { 18659 case "UseCaseArn": 18660 if value != nil { 18661 jtv, ok := value.(string) 18662 if !ok { 18663 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 18664 } 18665 sv.UseCaseArn = ptr.String(jtv) 18666 } 18667 18668 case "UseCaseId": 18669 if value != nil { 18670 jtv, ok := value.(string) 18671 if !ok { 18672 return fmt.Errorf("expected UseCaseId to be of type string, got %T instead", value) 18673 } 18674 sv.UseCaseId = ptr.String(jtv) 18675 } 18676 18677 case "UseCaseType": 18678 if value != nil { 18679 jtv, ok := value.(string) 18680 if !ok { 18681 return fmt.Errorf("expected UseCaseType to be of type string, got %T instead", value) 18682 } 18683 sv.UseCaseType = types.UseCaseType(jtv) 18684 } 18685 18686 default: 18687 _, _ = key, value 18688 18689 } 18690 } 18691 *v = sv 18692 return nil 18693} 18694 18695func awsRestjson1_deserializeDocumentUseCaseSummaryList(v *[]types.UseCase, value interface{}) error { 18696 if v == nil { 18697 return fmt.Errorf("unexpected nil of type %T", v) 18698 } 18699 if value == nil { 18700 return nil 18701 } 18702 18703 shape, ok := value.([]interface{}) 18704 if !ok { 18705 return fmt.Errorf("unexpected JSON type %v", value) 18706 } 18707 18708 var cv []types.UseCase 18709 if *v == nil { 18710 cv = []types.UseCase{} 18711 } else { 18712 cv = *v 18713 } 18714 18715 for _, value := range shape { 18716 var col types.UseCase 18717 destAddr := &col 18718 if err := awsRestjson1_deserializeDocumentUseCase(&destAddr, value); err != nil { 18719 return err 18720 } 18721 col = *destAddr 18722 cv = append(cv, col) 18723 18724 } 18725 *v = cv 18726 return nil 18727} 18728 18729func awsRestjson1_deserializeDocumentUser(v **types.User, value interface{}) error { 18730 if v == nil { 18731 return fmt.Errorf("unexpected nil of type %T", v) 18732 } 18733 if value == nil { 18734 return nil 18735 } 18736 18737 shape, ok := value.(map[string]interface{}) 18738 if !ok { 18739 return fmt.Errorf("unexpected JSON type %v", value) 18740 } 18741 18742 var sv *types.User 18743 if *v == nil { 18744 sv = &types.User{} 18745 } else { 18746 sv = *v 18747 } 18748 18749 for key, value := range shape { 18750 switch key { 18751 case "Arn": 18752 if value != nil { 18753 jtv, ok := value.(string) 18754 if !ok { 18755 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 18756 } 18757 sv.Arn = ptr.String(jtv) 18758 } 18759 18760 case "DirectoryUserId": 18761 if value != nil { 18762 jtv, ok := value.(string) 18763 if !ok { 18764 return fmt.Errorf("expected DirectoryUserId to be of type string, got %T instead", value) 18765 } 18766 sv.DirectoryUserId = ptr.String(jtv) 18767 } 18768 18769 case "HierarchyGroupId": 18770 if value != nil { 18771 jtv, ok := value.(string) 18772 if !ok { 18773 return fmt.Errorf("expected HierarchyGroupId to be of type string, got %T instead", value) 18774 } 18775 sv.HierarchyGroupId = ptr.String(jtv) 18776 } 18777 18778 case "Id": 18779 if value != nil { 18780 jtv, ok := value.(string) 18781 if !ok { 18782 return fmt.Errorf("expected UserId to be of type string, got %T instead", value) 18783 } 18784 sv.Id = ptr.String(jtv) 18785 } 18786 18787 case "IdentityInfo": 18788 if err := awsRestjson1_deserializeDocumentUserIdentityInfo(&sv.IdentityInfo, value); err != nil { 18789 return err 18790 } 18791 18792 case "PhoneConfig": 18793 if err := awsRestjson1_deserializeDocumentUserPhoneConfig(&sv.PhoneConfig, value); err != nil { 18794 return err 18795 } 18796 18797 case "RoutingProfileId": 18798 if value != nil { 18799 jtv, ok := value.(string) 18800 if !ok { 18801 return fmt.Errorf("expected RoutingProfileId to be of type string, got %T instead", value) 18802 } 18803 sv.RoutingProfileId = ptr.String(jtv) 18804 } 18805 18806 case "SecurityProfileIds": 18807 if err := awsRestjson1_deserializeDocumentSecurityProfileIds(&sv.SecurityProfileIds, value); err != nil { 18808 return err 18809 } 18810 18811 case "Tags": 18812 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 18813 return err 18814 } 18815 18816 case "Username": 18817 if value != nil { 18818 jtv, ok := value.(string) 18819 if !ok { 18820 return fmt.Errorf("expected AgentUsername to be of type string, got %T instead", value) 18821 } 18822 sv.Username = ptr.String(jtv) 18823 } 18824 18825 default: 18826 _, _ = key, value 18827 18828 } 18829 } 18830 *v = sv 18831 return nil 18832} 18833 18834func awsRestjson1_deserializeDocumentUserIdentityInfo(v **types.UserIdentityInfo, value interface{}) error { 18835 if v == nil { 18836 return fmt.Errorf("unexpected nil of type %T", v) 18837 } 18838 if value == nil { 18839 return nil 18840 } 18841 18842 shape, ok := value.(map[string]interface{}) 18843 if !ok { 18844 return fmt.Errorf("unexpected JSON type %v", value) 18845 } 18846 18847 var sv *types.UserIdentityInfo 18848 if *v == nil { 18849 sv = &types.UserIdentityInfo{} 18850 } else { 18851 sv = *v 18852 } 18853 18854 for key, value := range shape { 18855 switch key { 18856 case "Email": 18857 if value != nil { 18858 jtv, ok := value.(string) 18859 if !ok { 18860 return fmt.Errorf("expected Email to be of type string, got %T instead", value) 18861 } 18862 sv.Email = ptr.String(jtv) 18863 } 18864 18865 case "FirstName": 18866 if value != nil { 18867 jtv, ok := value.(string) 18868 if !ok { 18869 return fmt.Errorf("expected AgentFirstName to be of type string, got %T instead", value) 18870 } 18871 sv.FirstName = ptr.String(jtv) 18872 } 18873 18874 case "LastName": 18875 if value != nil { 18876 jtv, ok := value.(string) 18877 if !ok { 18878 return fmt.Errorf("expected AgentLastName to be of type string, got %T instead", value) 18879 } 18880 sv.LastName = ptr.String(jtv) 18881 } 18882 18883 default: 18884 _, _ = key, value 18885 18886 } 18887 } 18888 *v = sv 18889 return nil 18890} 18891 18892func awsRestjson1_deserializeDocumentUserNotFoundException(v **types.UserNotFoundException, value interface{}) error { 18893 if v == nil { 18894 return fmt.Errorf("unexpected nil of type %T", v) 18895 } 18896 if value == nil { 18897 return nil 18898 } 18899 18900 shape, ok := value.(map[string]interface{}) 18901 if !ok { 18902 return fmt.Errorf("unexpected JSON type %v", value) 18903 } 18904 18905 var sv *types.UserNotFoundException 18906 if *v == nil { 18907 sv = &types.UserNotFoundException{} 18908 } else { 18909 sv = *v 18910 } 18911 18912 for key, value := range shape { 18913 switch key { 18914 case "Message": 18915 if value != nil { 18916 jtv, ok := value.(string) 18917 if !ok { 18918 return fmt.Errorf("expected Message to be of type string, got %T instead", value) 18919 } 18920 sv.Message = ptr.String(jtv) 18921 } 18922 18923 default: 18924 _, _ = key, value 18925 18926 } 18927 } 18928 *v = sv 18929 return nil 18930} 18931 18932func awsRestjson1_deserializeDocumentUserPhoneConfig(v **types.UserPhoneConfig, value interface{}) error { 18933 if v == nil { 18934 return fmt.Errorf("unexpected nil of type %T", v) 18935 } 18936 if value == nil { 18937 return nil 18938 } 18939 18940 shape, ok := value.(map[string]interface{}) 18941 if !ok { 18942 return fmt.Errorf("unexpected JSON type %v", value) 18943 } 18944 18945 var sv *types.UserPhoneConfig 18946 if *v == nil { 18947 sv = &types.UserPhoneConfig{} 18948 } else { 18949 sv = *v 18950 } 18951 18952 for key, value := range shape { 18953 switch key { 18954 case "AfterContactWorkTimeLimit": 18955 if value != nil { 18956 jtv, ok := value.(json.Number) 18957 if !ok { 18958 return fmt.Errorf("expected AfterContactWorkTimeLimit to be json.Number, got %T instead", value) 18959 } 18960 i64, err := jtv.Int64() 18961 if err != nil { 18962 return err 18963 } 18964 sv.AfterContactWorkTimeLimit = int32(i64) 18965 } 18966 18967 case "AutoAccept": 18968 if value != nil { 18969 jtv, ok := value.(bool) 18970 if !ok { 18971 return fmt.Errorf("expected AutoAccept to be of type *bool, got %T instead", value) 18972 } 18973 sv.AutoAccept = jtv 18974 } 18975 18976 case "DeskPhoneNumber": 18977 if value != nil { 18978 jtv, ok := value.(string) 18979 if !ok { 18980 return fmt.Errorf("expected PhoneNumber to be of type string, got %T instead", value) 18981 } 18982 sv.DeskPhoneNumber = ptr.String(jtv) 18983 } 18984 18985 case "PhoneType": 18986 if value != nil { 18987 jtv, ok := value.(string) 18988 if !ok { 18989 return fmt.Errorf("expected PhoneType to be of type string, got %T instead", value) 18990 } 18991 sv.PhoneType = types.PhoneType(jtv) 18992 } 18993 18994 default: 18995 _, _ = key, value 18996 18997 } 18998 } 18999 *v = sv 19000 return nil 19001} 19002 19003func awsRestjson1_deserializeDocumentUserQuickConnectConfig(v **types.UserQuickConnectConfig, value interface{}) error { 19004 if v == nil { 19005 return fmt.Errorf("unexpected nil of type %T", v) 19006 } 19007 if value == nil { 19008 return nil 19009 } 19010 19011 shape, ok := value.(map[string]interface{}) 19012 if !ok { 19013 return fmt.Errorf("unexpected JSON type %v", value) 19014 } 19015 19016 var sv *types.UserQuickConnectConfig 19017 if *v == nil { 19018 sv = &types.UserQuickConnectConfig{} 19019 } else { 19020 sv = *v 19021 } 19022 19023 for key, value := range shape { 19024 switch key { 19025 case "ContactFlowId": 19026 if value != nil { 19027 jtv, ok := value.(string) 19028 if !ok { 19029 return fmt.Errorf("expected ContactFlowId to be of type string, got %T instead", value) 19030 } 19031 sv.ContactFlowId = ptr.String(jtv) 19032 } 19033 19034 case "UserId": 19035 if value != nil { 19036 jtv, ok := value.(string) 19037 if !ok { 19038 return fmt.Errorf("expected UserId to be of type string, got %T instead", value) 19039 } 19040 sv.UserId = ptr.String(jtv) 19041 } 19042 19043 default: 19044 _, _ = key, value 19045 19046 } 19047 } 19048 *v = sv 19049 return nil 19050} 19051 19052func awsRestjson1_deserializeDocumentUserSummary(v **types.UserSummary, value interface{}) error { 19053 if v == nil { 19054 return fmt.Errorf("unexpected nil of type %T", v) 19055 } 19056 if value == nil { 19057 return nil 19058 } 19059 19060 shape, ok := value.(map[string]interface{}) 19061 if !ok { 19062 return fmt.Errorf("unexpected JSON type %v", value) 19063 } 19064 19065 var sv *types.UserSummary 19066 if *v == nil { 19067 sv = &types.UserSummary{} 19068 } else { 19069 sv = *v 19070 } 19071 19072 for key, value := range shape { 19073 switch key { 19074 case "Arn": 19075 if value != nil { 19076 jtv, ok := value.(string) 19077 if !ok { 19078 return fmt.Errorf("expected ARN to be of type string, got %T instead", value) 19079 } 19080 sv.Arn = ptr.String(jtv) 19081 } 19082 19083 case "Id": 19084 if value != nil { 19085 jtv, ok := value.(string) 19086 if !ok { 19087 return fmt.Errorf("expected UserId to be of type string, got %T instead", value) 19088 } 19089 sv.Id = ptr.String(jtv) 19090 } 19091 19092 case "Username": 19093 if value != nil { 19094 jtv, ok := value.(string) 19095 if !ok { 19096 return fmt.Errorf("expected AgentUsername to be of type string, got %T instead", value) 19097 } 19098 sv.Username = ptr.String(jtv) 19099 } 19100 19101 default: 19102 _, _ = key, value 19103 19104 } 19105 } 19106 *v = sv 19107 return nil 19108} 19109 19110func awsRestjson1_deserializeDocumentUserSummaryList(v *[]types.UserSummary, value interface{}) error { 19111 if v == nil { 19112 return fmt.Errorf("unexpected nil of type %T", v) 19113 } 19114 if value == nil { 19115 return nil 19116 } 19117 19118 shape, ok := value.([]interface{}) 19119 if !ok { 19120 return fmt.Errorf("unexpected JSON type %v", value) 19121 } 19122 19123 var cv []types.UserSummary 19124 if *v == nil { 19125 cv = []types.UserSummary{} 19126 } else { 19127 cv = *v 19128 } 19129 19130 for _, value := range shape { 19131 var col types.UserSummary 19132 destAddr := &col 19133 if err := awsRestjson1_deserializeDocumentUserSummary(&destAddr, value); err != nil { 19134 return err 19135 } 19136 col = *destAddr 19137 cv = append(cv, col) 19138 19139 } 19140 *v = cv 19141 return nil 19142} 19143