1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package kms 4 5import ( 6 "bytes" 7 "context" 8 "encoding/base64" 9 "encoding/json" 10 "fmt" 11 "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" 12 "github.com/aws/aws-sdk-go-v2/service/kms/types" 13 smithy "github.com/aws/smithy-go" 14 smithyio "github.com/aws/smithy-go/io" 15 "github.com/aws/smithy-go/middleware" 16 "github.com/aws/smithy-go/ptr" 17 smithytime "github.com/aws/smithy-go/time" 18 smithyhttp "github.com/aws/smithy-go/transport/http" 19 "io" 20 "io/ioutil" 21 "strings" 22) 23 24type awsAwsjson11_deserializeOpCancelKeyDeletion struct { 25} 26 27func (*awsAwsjson11_deserializeOpCancelKeyDeletion) ID() string { 28 return "OperationDeserializer" 29} 30 31func (m *awsAwsjson11_deserializeOpCancelKeyDeletion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 32 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 33) { 34 out, metadata, err = next.HandleDeserialize(ctx, in) 35 if err != nil { 36 return out, metadata, err 37 } 38 39 response, ok := out.RawResponse.(*smithyhttp.Response) 40 if !ok { 41 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 42 } 43 44 if response.StatusCode < 200 || response.StatusCode >= 300 { 45 return out, metadata, awsAwsjson11_deserializeOpErrorCancelKeyDeletion(response, &metadata) 46 } 47 output := &CancelKeyDeletionOutput{} 48 out.Result = output 49 50 var buff [1024]byte 51 ringBuffer := smithyio.NewRingBuffer(buff[:]) 52 53 body := io.TeeReader(response.Body, ringBuffer) 54 decoder := json.NewDecoder(body) 55 decoder.UseNumber() 56 var shape interface{} 57 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 58 var snapshot bytes.Buffer 59 io.Copy(&snapshot, ringBuffer) 60 err = &smithy.DeserializationError{ 61 Err: fmt.Errorf("failed to decode response body, %w", err), 62 Snapshot: snapshot.Bytes(), 63 } 64 return out, metadata, err 65 } 66 67 err = awsAwsjson11_deserializeOpDocumentCancelKeyDeletionOutput(&output, shape) 68 if err != nil { 69 var snapshot bytes.Buffer 70 io.Copy(&snapshot, ringBuffer) 71 err = &smithy.DeserializationError{ 72 Err: fmt.Errorf("failed to decode response body, %w", err), 73 Snapshot: snapshot.Bytes(), 74 } 75 return out, metadata, err 76 } 77 78 return out, metadata, err 79} 80 81func awsAwsjson11_deserializeOpErrorCancelKeyDeletion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 82 var errorBuffer bytes.Buffer 83 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 84 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 85 } 86 errorBody := bytes.NewReader(errorBuffer.Bytes()) 87 88 errorCode := "UnknownError" 89 errorMessage := errorCode 90 91 code := response.Header.Get("X-Amzn-ErrorType") 92 if len(code) != 0 { 93 errorCode = restjson.SanitizeErrorCode(code) 94 } 95 96 var buff [1024]byte 97 ringBuffer := smithyio.NewRingBuffer(buff[:]) 98 99 body := io.TeeReader(errorBody, ringBuffer) 100 decoder := json.NewDecoder(body) 101 decoder.UseNumber() 102 code, message, err := restjson.GetErrorInfo(decoder) 103 if err != nil { 104 var snapshot bytes.Buffer 105 io.Copy(&snapshot, ringBuffer) 106 err = &smithy.DeserializationError{ 107 Err: fmt.Errorf("failed to decode response body, %w", err), 108 Snapshot: snapshot.Bytes(), 109 } 110 return err 111 } 112 113 errorBody.Seek(0, io.SeekStart) 114 if len(code) != 0 { 115 errorCode = restjson.SanitizeErrorCode(code) 116 } 117 if len(message) != 0 { 118 errorMessage = message 119 } 120 121 switch { 122 case strings.EqualFold("DependencyTimeoutException", errorCode): 123 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 124 125 case strings.EqualFold("InvalidArnException", errorCode): 126 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 127 128 case strings.EqualFold("KMSInternalException", errorCode): 129 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 130 131 case strings.EqualFold("KMSInvalidStateException", errorCode): 132 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 133 134 case strings.EqualFold("NotFoundException", errorCode): 135 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 136 137 default: 138 genericError := &smithy.GenericAPIError{ 139 Code: errorCode, 140 Message: errorMessage, 141 } 142 return genericError 143 144 } 145} 146 147type awsAwsjson11_deserializeOpConnectCustomKeyStore struct { 148} 149 150func (*awsAwsjson11_deserializeOpConnectCustomKeyStore) ID() string { 151 return "OperationDeserializer" 152} 153 154func (m *awsAwsjson11_deserializeOpConnectCustomKeyStore) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 155 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 156) { 157 out, metadata, err = next.HandleDeserialize(ctx, in) 158 if err != nil { 159 return out, metadata, err 160 } 161 162 response, ok := out.RawResponse.(*smithyhttp.Response) 163 if !ok { 164 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 165 } 166 167 if response.StatusCode < 200 || response.StatusCode >= 300 { 168 return out, metadata, awsAwsjson11_deserializeOpErrorConnectCustomKeyStore(response, &metadata) 169 } 170 output := &ConnectCustomKeyStoreOutput{} 171 out.Result = output 172 173 var buff [1024]byte 174 ringBuffer := smithyio.NewRingBuffer(buff[:]) 175 176 body := io.TeeReader(response.Body, ringBuffer) 177 decoder := json.NewDecoder(body) 178 decoder.UseNumber() 179 var shape interface{} 180 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 181 var snapshot bytes.Buffer 182 io.Copy(&snapshot, ringBuffer) 183 err = &smithy.DeserializationError{ 184 Err: fmt.Errorf("failed to decode response body, %w", err), 185 Snapshot: snapshot.Bytes(), 186 } 187 return out, metadata, err 188 } 189 190 err = awsAwsjson11_deserializeOpDocumentConnectCustomKeyStoreOutput(&output, shape) 191 if err != nil { 192 var snapshot bytes.Buffer 193 io.Copy(&snapshot, ringBuffer) 194 err = &smithy.DeserializationError{ 195 Err: fmt.Errorf("failed to decode response body, %w", err), 196 Snapshot: snapshot.Bytes(), 197 } 198 return out, metadata, err 199 } 200 201 return out, metadata, err 202} 203 204func awsAwsjson11_deserializeOpErrorConnectCustomKeyStore(response *smithyhttp.Response, metadata *middleware.Metadata) error { 205 var errorBuffer bytes.Buffer 206 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 207 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 208 } 209 errorBody := bytes.NewReader(errorBuffer.Bytes()) 210 211 errorCode := "UnknownError" 212 errorMessage := errorCode 213 214 code := response.Header.Get("X-Amzn-ErrorType") 215 if len(code) != 0 { 216 errorCode = restjson.SanitizeErrorCode(code) 217 } 218 219 var buff [1024]byte 220 ringBuffer := smithyio.NewRingBuffer(buff[:]) 221 222 body := io.TeeReader(errorBody, ringBuffer) 223 decoder := json.NewDecoder(body) 224 decoder.UseNumber() 225 code, message, err := restjson.GetErrorInfo(decoder) 226 if err != nil { 227 var snapshot bytes.Buffer 228 io.Copy(&snapshot, ringBuffer) 229 err = &smithy.DeserializationError{ 230 Err: fmt.Errorf("failed to decode response body, %w", err), 231 Snapshot: snapshot.Bytes(), 232 } 233 return err 234 } 235 236 errorBody.Seek(0, io.SeekStart) 237 if len(code) != 0 { 238 errorCode = restjson.SanitizeErrorCode(code) 239 } 240 if len(message) != 0 { 241 errorMessage = message 242 } 243 244 switch { 245 case strings.EqualFold("CloudHsmClusterInvalidConfigurationException", errorCode): 246 return awsAwsjson11_deserializeErrorCloudHsmClusterInvalidConfigurationException(response, errorBody) 247 248 case strings.EqualFold("CloudHsmClusterNotActiveException", errorCode): 249 return awsAwsjson11_deserializeErrorCloudHsmClusterNotActiveException(response, errorBody) 250 251 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 252 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 253 254 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 255 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 256 257 case strings.EqualFold("KMSInternalException", errorCode): 258 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 259 260 default: 261 genericError := &smithy.GenericAPIError{ 262 Code: errorCode, 263 Message: errorMessage, 264 } 265 return genericError 266 267 } 268} 269 270type awsAwsjson11_deserializeOpCreateAlias struct { 271} 272 273func (*awsAwsjson11_deserializeOpCreateAlias) ID() string { 274 return "OperationDeserializer" 275} 276 277func (m *awsAwsjson11_deserializeOpCreateAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 278 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 279) { 280 out, metadata, err = next.HandleDeserialize(ctx, in) 281 if err != nil { 282 return out, metadata, err 283 } 284 285 response, ok := out.RawResponse.(*smithyhttp.Response) 286 if !ok { 287 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 288 } 289 290 if response.StatusCode < 200 || response.StatusCode >= 300 { 291 return out, metadata, awsAwsjson11_deserializeOpErrorCreateAlias(response, &metadata) 292 } 293 output := &CreateAliasOutput{} 294 out.Result = output 295 296 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 297 return out, metadata, &smithy.DeserializationError{ 298 Err: fmt.Errorf("failed to discard response body, %w", err), 299 } 300 } 301 302 return out, metadata, err 303} 304 305func awsAwsjson11_deserializeOpErrorCreateAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 306 var errorBuffer bytes.Buffer 307 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 308 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 309 } 310 errorBody := bytes.NewReader(errorBuffer.Bytes()) 311 312 errorCode := "UnknownError" 313 errorMessage := errorCode 314 315 code := response.Header.Get("X-Amzn-ErrorType") 316 if len(code) != 0 { 317 errorCode = restjson.SanitizeErrorCode(code) 318 } 319 320 var buff [1024]byte 321 ringBuffer := smithyio.NewRingBuffer(buff[:]) 322 323 body := io.TeeReader(errorBody, ringBuffer) 324 decoder := json.NewDecoder(body) 325 decoder.UseNumber() 326 code, message, err := restjson.GetErrorInfo(decoder) 327 if err != nil { 328 var snapshot bytes.Buffer 329 io.Copy(&snapshot, ringBuffer) 330 err = &smithy.DeserializationError{ 331 Err: fmt.Errorf("failed to decode response body, %w", err), 332 Snapshot: snapshot.Bytes(), 333 } 334 return err 335 } 336 337 errorBody.Seek(0, io.SeekStart) 338 if len(code) != 0 { 339 errorCode = restjson.SanitizeErrorCode(code) 340 } 341 if len(message) != 0 { 342 errorMessage = message 343 } 344 345 switch { 346 case strings.EqualFold("AlreadyExistsException", errorCode): 347 return awsAwsjson11_deserializeErrorAlreadyExistsException(response, errorBody) 348 349 case strings.EqualFold("DependencyTimeoutException", errorCode): 350 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 351 352 case strings.EqualFold("InvalidAliasNameException", errorCode): 353 return awsAwsjson11_deserializeErrorInvalidAliasNameException(response, errorBody) 354 355 case strings.EqualFold("KMSInternalException", errorCode): 356 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 357 358 case strings.EqualFold("KMSInvalidStateException", errorCode): 359 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 360 361 case strings.EqualFold("LimitExceededException", errorCode): 362 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 363 364 case strings.EqualFold("NotFoundException", errorCode): 365 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 366 367 default: 368 genericError := &smithy.GenericAPIError{ 369 Code: errorCode, 370 Message: errorMessage, 371 } 372 return genericError 373 374 } 375} 376 377type awsAwsjson11_deserializeOpCreateCustomKeyStore struct { 378} 379 380func (*awsAwsjson11_deserializeOpCreateCustomKeyStore) ID() string { 381 return "OperationDeserializer" 382} 383 384func (m *awsAwsjson11_deserializeOpCreateCustomKeyStore) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 385 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 386) { 387 out, metadata, err = next.HandleDeserialize(ctx, in) 388 if err != nil { 389 return out, metadata, err 390 } 391 392 response, ok := out.RawResponse.(*smithyhttp.Response) 393 if !ok { 394 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 395 } 396 397 if response.StatusCode < 200 || response.StatusCode >= 300 { 398 return out, metadata, awsAwsjson11_deserializeOpErrorCreateCustomKeyStore(response, &metadata) 399 } 400 output := &CreateCustomKeyStoreOutput{} 401 out.Result = output 402 403 var buff [1024]byte 404 ringBuffer := smithyio.NewRingBuffer(buff[:]) 405 406 body := io.TeeReader(response.Body, ringBuffer) 407 decoder := json.NewDecoder(body) 408 decoder.UseNumber() 409 var shape interface{} 410 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 411 var snapshot bytes.Buffer 412 io.Copy(&snapshot, ringBuffer) 413 err = &smithy.DeserializationError{ 414 Err: fmt.Errorf("failed to decode response body, %w", err), 415 Snapshot: snapshot.Bytes(), 416 } 417 return out, metadata, err 418 } 419 420 err = awsAwsjson11_deserializeOpDocumentCreateCustomKeyStoreOutput(&output, shape) 421 if err != nil { 422 var snapshot bytes.Buffer 423 io.Copy(&snapshot, ringBuffer) 424 err = &smithy.DeserializationError{ 425 Err: fmt.Errorf("failed to decode response body, %w", err), 426 Snapshot: snapshot.Bytes(), 427 } 428 return out, metadata, err 429 } 430 431 return out, metadata, err 432} 433 434func awsAwsjson11_deserializeOpErrorCreateCustomKeyStore(response *smithyhttp.Response, metadata *middleware.Metadata) error { 435 var errorBuffer bytes.Buffer 436 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 437 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 438 } 439 errorBody := bytes.NewReader(errorBuffer.Bytes()) 440 441 errorCode := "UnknownError" 442 errorMessage := errorCode 443 444 code := response.Header.Get("X-Amzn-ErrorType") 445 if len(code) != 0 { 446 errorCode = restjson.SanitizeErrorCode(code) 447 } 448 449 var buff [1024]byte 450 ringBuffer := smithyio.NewRingBuffer(buff[:]) 451 452 body := io.TeeReader(errorBody, ringBuffer) 453 decoder := json.NewDecoder(body) 454 decoder.UseNumber() 455 code, message, err := restjson.GetErrorInfo(decoder) 456 if err != nil { 457 var snapshot bytes.Buffer 458 io.Copy(&snapshot, ringBuffer) 459 err = &smithy.DeserializationError{ 460 Err: fmt.Errorf("failed to decode response body, %w", err), 461 Snapshot: snapshot.Bytes(), 462 } 463 return err 464 } 465 466 errorBody.Seek(0, io.SeekStart) 467 if len(code) != 0 { 468 errorCode = restjson.SanitizeErrorCode(code) 469 } 470 if len(message) != 0 { 471 errorMessage = message 472 } 473 474 switch { 475 case strings.EqualFold("CloudHsmClusterInUseException", errorCode): 476 return awsAwsjson11_deserializeErrorCloudHsmClusterInUseException(response, errorBody) 477 478 case strings.EqualFold("CloudHsmClusterInvalidConfigurationException", errorCode): 479 return awsAwsjson11_deserializeErrorCloudHsmClusterInvalidConfigurationException(response, errorBody) 480 481 case strings.EqualFold("CloudHsmClusterNotActiveException", errorCode): 482 return awsAwsjson11_deserializeErrorCloudHsmClusterNotActiveException(response, errorBody) 483 484 case strings.EqualFold("CloudHsmClusterNotFoundException", errorCode): 485 return awsAwsjson11_deserializeErrorCloudHsmClusterNotFoundException(response, errorBody) 486 487 case strings.EqualFold("CustomKeyStoreNameInUseException", errorCode): 488 return awsAwsjson11_deserializeErrorCustomKeyStoreNameInUseException(response, errorBody) 489 490 case strings.EqualFold("IncorrectTrustAnchorException", errorCode): 491 return awsAwsjson11_deserializeErrorIncorrectTrustAnchorException(response, errorBody) 492 493 case strings.EqualFold("KMSInternalException", errorCode): 494 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 495 496 default: 497 genericError := &smithy.GenericAPIError{ 498 Code: errorCode, 499 Message: errorMessage, 500 } 501 return genericError 502 503 } 504} 505 506type awsAwsjson11_deserializeOpCreateGrant struct { 507} 508 509func (*awsAwsjson11_deserializeOpCreateGrant) ID() string { 510 return "OperationDeserializer" 511} 512 513func (m *awsAwsjson11_deserializeOpCreateGrant) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 514 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 515) { 516 out, metadata, err = next.HandleDeserialize(ctx, in) 517 if err != nil { 518 return out, metadata, err 519 } 520 521 response, ok := out.RawResponse.(*smithyhttp.Response) 522 if !ok { 523 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 524 } 525 526 if response.StatusCode < 200 || response.StatusCode >= 300 { 527 return out, metadata, awsAwsjson11_deserializeOpErrorCreateGrant(response, &metadata) 528 } 529 output := &CreateGrantOutput{} 530 out.Result = output 531 532 var buff [1024]byte 533 ringBuffer := smithyio.NewRingBuffer(buff[:]) 534 535 body := io.TeeReader(response.Body, ringBuffer) 536 decoder := json.NewDecoder(body) 537 decoder.UseNumber() 538 var shape interface{} 539 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 540 var snapshot bytes.Buffer 541 io.Copy(&snapshot, ringBuffer) 542 err = &smithy.DeserializationError{ 543 Err: fmt.Errorf("failed to decode response body, %w", err), 544 Snapshot: snapshot.Bytes(), 545 } 546 return out, metadata, err 547 } 548 549 err = awsAwsjson11_deserializeOpDocumentCreateGrantOutput(&output, shape) 550 if err != nil { 551 var snapshot bytes.Buffer 552 io.Copy(&snapshot, ringBuffer) 553 err = &smithy.DeserializationError{ 554 Err: fmt.Errorf("failed to decode response body, %w", err), 555 Snapshot: snapshot.Bytes(), 556 } 557 return out, metadata, err 558 } 559 560 return out, metadata, err 561} 562 563func awsAwsjson11_deserializeOpErrorCreateGrant(response *smithyhttp.Response, metadata *middleware.Metadata) error { 564 var errorBuffer bytes.Buffer 565 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 566 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 567 } 568 errorBody := bytes.NewReader(errorBuffer.Bytes()) 569 570 errorCode := "UnknownError" 571 errorMessage := errorCode 572 573 code := response.Header.Get("X-Amzn-ErrorType") 574 if len(code) != 0 { 575 errorCode = restjson.SanitizeErrorCode(code) 576 } 577 578 var buff [1024]byte 579 ringBuffer := smithyio.NewRingBuffer(buff[:]) 580 581 body := io.TeeReader(errorBody, ringBuffer) 582 decoder := json.NewDecoder(body) 583 decoder.UseNumber() 584 code, message, err := restjson.GetErrorInfo(decoder) 585 if err != nil { 586 var snapshot bytes.Buffer 587 io.Copy(&snapshot, ringBuffer) 588 err = &smithy.DeserializationError{ 589 Err: fmt.Errorf("failed to decode response body, %w", err), 590 Snapshot: snapshot.Bytes(), 591 } 592 return err 593 } 594 595 errorBody.Seek(0, io.SeekStart) 596 if len(code) != 0 { 597 errorCode = restjson.SanitizeErrorCode(code) 598 } 599 if len(message) != 0 { 600 errorMessage = message 601 } 602 603 switch { 604 case strings.EqualFold("DependencyTimeoutException", errorCode): 605 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 606 607 case strings.EqualFold("DisabledException", errorCode): 608 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 609 610 case strings.EqualFold("InvalidArnException", errorCode): 611 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 612 613 case strings.EqualFold("InvalidGrantTokenException", errorCode): 614 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 615 616 case strings.EqualFold("KMSInternalException", errorCode): 617 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 618 619 case strings.EqualFold("KMSInvalidStateException", errorCode): 620 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 621 622 case strings.EqualFold("LimitExceededException", errorCode): 623 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 624 625 case strings.EqualFold("NotFoundException", errorCode): 626 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 627 628 default: 629 genericError := &smithy.GenericAPIError{ 630 Code: errorCode, 631 Message: errorMessage, 632 } 633 return genericError 634 635 } 636} 637 638type awsAwsjson11_deserializeOpCreateKey struct { 639} 640 641func (*awsAwsjson11_deserializeOpCreateKey) ID() string { 642 return "OperationDeserializer" 643} 644 645func (m *awsAwsjson11_deserializeOpCreateKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 646 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 647) { 648 out, metadata, err = next.HandleDeserialize(ctx, in) 649 if err != nil { 650 return out, metadata, err 651 } 652 653 response, ok := out.RawResponse.(*smithyhttp.Response) 654 if !ok { 655 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 656 } 657 658 if response.StatusCode < 200 || response.StatusCode >= 300 { 659 return out, metadata, awsAwsjson11_deserializeOpErrorCreateKey(response, &metadata) 660 } 661 output := &CreateKeyOutput{} 662 out.Result = output 663 664 var buff [1024]byte 665 ringBuffer := smithyio.NewRingBuffer(buff[:]) 666 667 body := io.TeeReader(response.Body, ringBuffer) 668 decoder := json.NewDecoder(body) 669 decoder.UseNumber() 670 var shape interface{} 671 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 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 out, metadata, err 679 } 680 681 err = awsAwsjson11_deserializeOpDocumentCreateKeyOutput(&output, shape) 682 if err != nil { 683 var snapshot bytes.Buffer 684 io.Copy(&snapshot, ringBuffer) 685 err = &smithy.DeserializationError{ 686 Err: fmt.Errorf("failed to decode response body, %w", err), 687 Snapshot: snapshot.Bytes(), 688 } 689 return out, metadata, err 690 } 691 692 return out, metadata, err 693} 694 695func awsAwsjson11_deserializeOpErrorCreateKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 696 var errorBuffer bytes.Buffer 697 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 698 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 699 } 700 errorBody := bytes.NewReader(errorBuffer.Bytes()) 701 702 errorCode := "UnknownError" 703 errorMessage := errorCode 704 705 code := response.Header.Get("X-Amzn-ErrorType") 706 if len(code) != 0 { 707 errorCode = restjson.SanitizeErrorCode(code) 708 } 709 710 var buff [1024]byte 711 ringBuffer := smithyio.NewRingBuffer(buff[:]) 712 713 body := io.TeeReader(errorBody, ringBuffer) 714 decoder := json.NewDecoder(body) 715 decoder.UseNumber() 716 code, message, err := restjson.GetErrorInfo(decoder) 717 if err != nil { 718 var snapshot bytes.Buffer 719 io.Copy(&snapshot, ringBuffer) 720 err = &smithy.DeserializationError{ 721 Err: fmt.Errorf("failed to decode response body, %w", err), 722 Snapshot: snapshot.Bytes(), 723 } 724 return err 725 } 726 727 errorBody.Seek(0, io.SeekStart) 728 if len(code) != 0 { 729 errorCode = restjson.SanitizeErrorCode(code) 730 } 731 if len(message) != 0 { 732 errorMessage = message 733 } 734 735 switch { 736 case strings.EqualFold("CloudHsmClusterInvalidConfigurationException", errorCode): 737 return awsAwsjson11_deserializeErrorCloudHsmClusterInvalidConfigurationException(response, errorBody) 738 739 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 740 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 741 742 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 743 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 744 745 case strings.EqualFold("DependencyTimeoutException", errorCode): 746 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 747 748 case strings.EqualFold("InvalidArnException", errorCode): 749 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 750 751 case strings.EqualFold("KMSInternalException", errorCode): 752 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 753 754 case strings.EqualFold("LimitExceededException", errorCode): 755 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 756 757 case strings.EqualFold("MalformedPolicyDocumentException", errorCode): 758 return awsAwsjson11_deserializeErrorMalformedPolicyDocumentException(response, errorBody) 759 760 case strings.EqualFold("TagException", errorCode): 761 return awsAwsjson11_deserializeErrorTagException(response, errorBody) 762 763 case strings.EqualFold("UnsupportedOperationException", errorCode): 764 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 765 766 default: 767 genericError := &smithy.GenericAPIError{ 768 Code: errorCode, 769 Message: errorMessage, 770 } 771 return genericError 772 773 } 774} 775 776type awsAwsjson11_deserializeOpDecrypt struct { 777} 778 779func (*awsAwsjson11_deserializeOpDecrypt) ID() string { 780 return "OperationDeserializer" 781} 782 783func (m *awsAwsjson11_deserializeOpDecrypt) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 784 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 785) { 786 out, metadata, err = next.HandleDeserialize(ctx, in) 787 if err != nil { 788 return out, metadata, err 789 } 790 791 response, ok := out.RawResponse.(*smithyhttp.Response) 792 if !ok { 793 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 794 } 795 796 if response.StatusCode < 200 || response.StatusCode >= 300 { 797 return out, metadata, awsAwsjson11_deserializeOpErrorDecrypt(response, &metadata) 798 } 799 output := &DecryptOutput{} 800 out.Result = output 801 802 var buff [1024]byte 803 ringBuffer := smithyio.NewRingBuffer(buff[:]) 804 805 body := io.TeeReader(response.Body, ringBuffer) 806 decoder := json.NewDecoder(body) 807 decoder.UseNumber() 808 var shape interface{} 809 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 810 var snapshot bytes.Buffer 811 io.Copy(&snapshot, ringBuffer) 812 err = &smithy.DeserializationError{ 813 Err: fmt.Errorf("failed to decode response body, %w", err), 814 Snapshot: snapshot.Bytes(), 815 } 816 return out, metadata, err 817 } 818 819 err = awsAwsjson11_deserializeOpDocumentDecryptOutput(&output, shape) 820 if err != nil { 821 var snapshot bytes.Buffer 822 io.Copy(&snapshot, ringBuffer) 823 err = &smithy.DeserializationError{ 824 Err: fmt.Errorf("failed to decode response body, %w", err), 825 Snapshot: snapshot.Bytes(), 826 } 827 return out, metadata, err 828 } 829 830 return out, metadata, err 831} 832 833func awsAwsjson11_deserializeOpErrorDecrypt(response *smithyhttp.Response, metadata *middleware.Metadata) error { 834 var errorBuffer bytes.Buffer 835 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 836 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 837 } 838 errorBody := bytes.NewReader(errorBuffer.Bytes()) 839 840 errorCode := "UnknownError" 841 errorMessage := errorCode 842 843 code := response.Header.Get("X-Amzn-ErrorType") 844 if len(code) != 0 { 845 errorCode = restjson.SanitizeErrorCode(code) 846 } 847 848 var buff [1024]byte 849 ringBuffer := smithyio.NewRingBuffer(buff[:]) 850 851 body := io.TeeReader(errorBody, ringBuffer) 852 decoder := json.NewDecoder(body) 853 decoder.UseNumber() 854 code, message, err := restjson.GetErrorInfo(decoder) 855 if err != nil { 856 var snapshot bytes.Buffer 857 io.Copy(&snapshot, ringBuffer) 858 err = &smithy.DeserializationError{ 859 Err: fmt.Errorf("failed to decode response body, %w", err), 860 Snapshot: snapshot.Bytes(), 861 } 862 return err 863 } 864 865 errorBody.Seek(0, io.SeekStart) 866 if len(code) != 0 { 867 errorCode = restjson.SanitizeErrorCode(code) 868 } 869 if len(message) != 0 { 870 errorMessage = message 871 } 872 873 switch { 874 case strings.EqualFold("DependencyTimeoutException", errorCode): 875 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 876 877 case strings.EqualFold("DisabledException", errorCode): 878 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 879 880 case strings.EqualFold("IncorrectKeyException", errorCode): 881 return awsAwsjson11_deserializeErrorIncorrectKeyException(response, errorBody) 882 883 case strings.EqualFold("InvalidCiphertextException", errorCode): 884 return awsAwsjson11_deserializeErrorInvalidCiphertextException(response, errorBody) 885 886 case strings.EqualFold("InvalidGrantTokenException", errorCode): 887 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 888 889 case strings.EqualFold("InvalidKeyUsageException", errorCode): 890 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 891 892 case strings.EqualFold("KMSInternalException", errorCode): 893 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 894 895 case strings.EqualFold("KMSInvalidStateException", errorCode): 896 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 897 898 case strings.EqualFold("KeyUnavailableException", errorCode): 899 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 900 901 case strings.EqualFold("NotFoundException", errorCode): 902 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 903 904 default: 905 genericError := &smithy.GenericAPIError{ 906 Code: errorCode, 907 Message: errorMessage, 908 } 909 return genericError 910 911 } 912} 913 914type awsAwsjson11_deserializeOpDeleteAlias struct { 915} 916 917func (*awsAwsjson11_deserializeOpDeleteAlias) ID() string { 918 return "OperationDeserializer" 919} 920 921func (m *awsAwsjson11_deserializeOpDeleteAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 922 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 923) { 924 out, metadata, err = next.HandleDeserialize(ctx, in) 925 if err != nil { 926 return out, metadata, err 927 } 928 929 response, ok := out.RawResponse.(*smithyhttp.Response) 930 if !ok { 931 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 932 } 933 934 if response.StatusCode < 200 || response.StatusCode >= 300 { 935 return out, metadata, awsAwsjson11_deserializeOpErrorDeleteAlias(response, &metadata) 936 } 937 output := &DeleteAliasOutput{} 938 out.Result = output 939 940 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 941 return out, metadata, &smithy.DeserializationError{ 942 Err: fmt.Errorf("failed to discard response body, %w", err), 943 } 944 } 945 946 return out, metadata, err 947} 948 949func awsAwsjson11_deserializeOpErrorDeleteAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 950 var errorBuffer bytes.Buffer 951 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 952 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 953 } 954 errorBody := bytes.NewReader(errorBuffer.Bytes()) 955 956 errorCode := "UnknownError" 957 errorMessage := errorCode 958 959 code := response.Header.Get("X-Amzn-ErrorType") 960 if len(code) != 0 { 961 errorCode = restjson.SanitizeErrorCode(code) 962 } 963 964 var buff [1024]byte 965 ringBuffer := smithyio.NewRingBuffer(buff[:]) 966 967 body := io.TeeReader(errorBody, ringBuffer) 968 decoder := json.NewDecoder(body) 969 decoder.UseNumber() 970 code, message, err := restjson.GetErrorInfo(decoder) 971 if err != nil { 972 var snapshot bytes.Buffer 973 io.Copy(&snapshot, ringBuffer) 974 err = &smithy.DeserializationError{ 975 Err: fmt.Errorf("failed to decode response body, %w", err), 976 Snapshot: snapshot.Bytes(), 977 } 978 return err 979 } 980 981 errorBody.Seek(0, io.SeekStart) 982 if len(code) != 0 { 983 errorCode = restjson.SanitizeErrorCode(code) 984 } 985 if len(message) != 0 { 986 errorMessage = message 987 } 988 989 switch { 990 case strings.EqualFold("DependencyTimeoutException", errorCode): 991 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 992 993 case strings.EqualFold("KMSInternalException", errorCode): 994 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 995 996 case strings.EqualFold("KMSInvalidStateException", errorCode): 997 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 998 999 case strings.EqualFold("NotFoundException", errorCode): 1000 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1001 1002 default: 1003 genericError := &smithy.GenericAPIError{ 1004 Code: errorCode, 1005 Message: errorMessage, 1006 } 1007 return genericError 1008 1009 } 1010} 1011 1012type awsAwsjson11_deserializeOpDeleteCustomKeyStore struct { 1013} 1014 1015func (*awsAwsjson11_deserializeOpDeleteCustomKeyStore) ID() string { 1016 return "OperationDeserializer" 1017} 1018 1019func (m *awsAwsjson11_deserializeOpDeleteCustomKeyStore) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1020 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1021) { 1022 out, metadata, err = next.HandleDeserialize(ctx, in) 1023 if err != nil { 1024 return out, metadata, err 1025 } 1026 1027 response, ok := out.RawResponse.(*smithyhttp.Response) 1028 if !ok { 1029 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1030 } 1031 1032 if response.StatusCode < 200 || response.StatusCode >= 300 { 1033 return out, metadata, awsAwsjson11_deserializeOpErrorDeleteCustomKeyStore(response, &metadata) 1034 } 1035 output := &DeleteCustomKeyStoreOutput{} 1036 out.Result = output 1037 1038 var buff [1024]byte 1039 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1040 1041 body := io.TeeReader(response.Body, ringBuffer) 1042 decoder := json.NewDecoder(body) 1043 decoder.UseNumber() 1044 var shape interface{} 1045 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1046 var snapshot bytes.Buffer 1047 io.Copy(&snapshot, ringBuffer) 1048 err = &smithy.DeserializationError{ 1049 Err: fmt.Errorf("failed to decode response body, %w", err), 1050 Snapshot: snapshot.Bytes(), 1051 } 1052 return out, metadata, err 1053 } 1054 1055 err = awsAwsjson11_deserializeOpDocumentDeleteCustomKeyStoreOutput(&output, shape) 1056 if err != nil { 1057 var snapshot bytes.Buffer 1058 io.Copy(&snapshot, ringBuffer) 1059 err = &smithy.DeserializationError{ 1060 Err: fmt.Errorf("failed to decode response body, %w", err), 1061 Snapshot: snapshot.Bytes(), 1062 } 1063 return out, metadata, err 1064 } 1065 1066 return out, metadata, err 1067} 1068 1069func awsAwsjson11_deserializeOpErrorDeleteCustomKeyStore(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1070 var errorBuffer bytes.Buffer 1071 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1072 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1073 } 1074 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1075 1076 errorCode := "UnknownError" 1077 errorMessage := errorCode 1078 1079 code := response.Header.Get("X-Amzn-ErrorType") 1080 if len(code) != 0 { 1081 errorCode = restjson.SanitizeErrorCode(code) 1082 } 1083 1084 var buff [1024]byte 1085 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1086 1087 body := io.TeeReader(errorBody, ringBuffer) 1088 decoder := json.NewDecoder(body) 1089 decoder.UseNumber() 1090 code, message, err := restjson.GetErrorInfo(decoder) 1091 if err != nil { 1092 var snapshot bytes.Buffer 1093 io.Copy(&snapshot, ringBuffer) 1094 err = &smithy.DeserializationError{ 1095 Err: fmt.Errorf("failed to decode response body, %w", err), 1096 Snapshot: snapshot.Bytes(), 1097 } 1098 return err 1099 } 1100 1101 errorBody.Seek(0, io.SeekStart) 1102 if len(code) != 0 { 1103 errorCode = restjson.SanitizeErrorCode(code) 1104 } 1105 if len(message) != 0 { 1106 errorMessage = message 1107 } 1108 1109 switch { 1110 case strings.EqualFold("CustomKeyStoreHasCMKsException", errorCode): 1111 return awsAwsjson11_deserializeErrorCustomKeyStoreHasCMKsException(response, errorBody) 1112 1113 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 1114 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 1115 1116 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 1117 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 1118 1119 case strings.EqualFold("KMSInternalException", errorCode): 1120 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1121 1122 default: 1123 genericError := &smithy.GenericAPIError{ 1124 Code: errorCode, 1125 Message: errorMessage, 1126 } 1127 return genericError 1128 1129 } 1130} 1131 1132type awsAwsjson11_deserializeOpDeleteImportedKeyMaterial struct { 1133} 1134 1135func (*awsAwsjson11_deserializeOpDeleteImportedKeyMaterial) ID() string { 1136 return "OperationDeserializer" 1137} 1138 1139func (m *awsAwsjson11_deserializeOpDeleteImportedKeyMaterial) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1140 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1141) { 1142 out, metadata, err = next.HandleDeserialize(ctx, in) 1143 if err != nil { 1144 return out, metadata, err 1145 } 1146 1147 response, ok := out.RawResponse.(*smithyhttp.Response) 1148 if !ok { 1149 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1150 } 1151 1152 if response.StatusCode < 200 || response.StatusCode >= 300 { 1153 return out, metadata, awsAwsjson11_deserializeOpErrorDeleteImportedKeyMaterial(response, &metadata) 1154 } 1155 output := &DeleteImportedKeyMaterialOutput{} 1156 out.Result = output 1157 1158 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1159 return out, metadata, &smithy.DeserializationError{ 1160 Err: fmt.Errorf("failed to discard response body, %w", err), 1161 } 1162 } 1163 1164 return out, metadata, err 1165} 1166 1167func awsAwsjson11_deserializeOpErrorDeleteImportedKeyMaterial(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1168 var errorBuffer bytes.Buffer 1169 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1170 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1171 } 1172 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1173 1174 errorCode := "UnknownError" 1175 errorMessage := errorCode 1176 1177 code := response.Header.Get("X-Amzn-ErrorType") 1178 if len(code) != 0 { 1179 errorCode = restjson.SanitizeErrorCode(code) 1180 } 1181 1182 var buff [1024]byte 1183 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1184 1185 body := io.TeeReader(errorBody, ringBuffer) 1186 decoder := json.NewDecoder(body) 1187 decoder.UseNumber() 1188 code, message, err := restjson.GetErrorInfo(decoder) 1189 if err != nil { 1190 var snapshot bytes.Buffer 1191 io.Copy(&snapshot, ringBuffer) 1192 err = &smithy.DeserializationError{ 1193 Err: fmt.Errorf("failed to decode response body, %w", err), 1194 Snapshot: snapshot.Bytes(), 1195 } 1196 return err 1197 } 1198 1199 errorBody.Seek(0, io.SeekStart) 1200 if len(code) != 0 { 1201 errorCode = restjson.SanitizeErrorCode(code) 1202 } 1203 if len(message) != 0 { 1204 errorMessage = message 1205 } 1206 1207 switch { 1208 case strings.EqualFold("DependencyTimeoutException", errorCode): 1209 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1210 1211 case strings.EqualFold("InvalidArnException", errorCode): 1212 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1213 1214 case strings.EqualFold("KMSInternalException", errorCode): 1215 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1216 1217 case strings.EqualFold("KMSInvalidStateException", errorCode): 1218 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1219 1220 case strings.EqualFold("NotFoundException", errorCode): 1221 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1222 1223 case strings.EqualFold("UnsupportedOperationException", errorCode): 1224 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 1225 1226 default: 1227 genericError := &smithy.GenericAPIError{ 1228 Code: errorCode, 1229 Message: errorMessage, 1230 } 1231 return genericError 1232 1233 } 1234} 1235 1236type awsAwsjson11_deserializeOpDescribeCustomKeyStores struct { 1237} 1238 1239func (*awsAwsjson11_deserializeOpDescribeCustomKeyStores) ID() string { 1240 return "OperationDeserializer" 1241} 1242 1243func (m *awsAwsjson11_deserializeOpDescribeCustomKeyStores) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1244 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1245) { 1246 out, metadata, err = next.HandleDeserialize(ctx, in) 1247 if err != nil { 1248 return out, metadata, err 1249 } 1250 1251 response, ok := out.RawResponse.(*smithyhttp.Response) 1252 if !ok { 1253 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1254 } 1255 1256 if response.StatusCode < 200 || response.StatusCode >= 300 { 1257 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeCustomKeyStores(response, &metadata) 1258 } 1259 output := &DescribeCustomKeyStoresOutput{} 1260 out.Result = output 1261 1262 var buff [1024]byte 1263 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1264 1265 body := io.TeeReader(response.Body, ringBuffer) 1266 decoder := json.NewDecoder(body) 1267 decoder.UseNumber() 1268 var shape interface{} 1269 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1270 var snapshot bytes.Buffer 1271 io.Copy(&snapshot, ringBuffer) 1272 err = &smithy.DeserializationError{ 1273 Err: fmt.Errorf("failed to decode response body, %w", err), 1274 Snapshot: snapshot.Bytes(), 1275 } 1276 return out, metadata, err 1277 } 1278 1279 err = awsAwsjson11_deserializeOpDocumentDescribeCustomKeyStoresOutput(&output, shape) 1280 if err != nil { 1281 var snapshot bytes.Buffer 1282 io.Copy(&snapshot, ringBuffer) 1283 err = &smithy.DeserializationError{ 1284 Err: fmt.Errorf("failed to decode response body, %w", err), 1285 Snapshot: snapshot.Bytes(), 1286 } 1287 return out, metadata, err 1288 } 1289 1290 return out, metadata, err 1291} 1292 1293func awsAwsjson11_deserializeOpErrorDescribeCustomKeyStores(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1294 var errorBuffer bytes.Buffer 1295 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1296 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1297 } 1298 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1299 1300 errorCode := "UnknownError" 1301 errorMessage := errorCode 1302 1303 code := response.Header.Get("X-Amzn-ErrorType") 1304 if len(code) != 0 { 1305 errorCode = restjson.SanitizeErrorCode(code) 1306 } 1307 1308 var buff [1024]byte 1309 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1310 1311 body := io.TeeReader(errorBody, ringBuffer) 1312 decoder := json.NewDecoder(body) 1313 decoder.UseNumber() 1314 code, message, err := restjson.GetErrorInfo(decoder) 1315 if err != nil { 1316 var snapshot bytes.Buffer 1317 io.Copy(&snapshot, ringBuffer) 1318 err = &smithy.DeserializationError{ 1319 Err: fmt.Errorf("failed to decode response body, %w", err), 1320 Snapshot: snapshot.Bytes(), 1321 } 1322 return err 1323 } 1324 1325 errorBody.Seek(0, io.SeekStart) 1326 if len(code) != 0 { 1327 errorCode = restjson.SanitizeErrorCode(code) 1328 } 1329 if len(message) != 0 { 1330 errorMessage = message 1331 } 1332 1333 switch { 1334 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 1335 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 1336 1337 case strings.EqualFold("InvalidMarkerException", errorCode): 1338 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 1339 1340 case strings.EqualFold("KMSInternalException", errorCode): 1341 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1342 1343 default: 1344 genericError := &smithy.GenericAPIError{ 1345 Code: errorCode, 1346 Message: errorMessage, 1347 } 1348 return genericError 1349 1350 } 1351} 1352 1353type awsAwsjson11_deserializeOpDescribeKey struct { 1354} 1355 1356func (*awsAwsjson11_deserializeOpDescribeKey) ID() string { 1357 return "OperationDeserializer" 1358} 1359 1360func (m *awsAwsjson11_deserializeOpDescribeKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1361 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1362) { 1363 out, metadata, err = next.HandleDeserialize(ctx, in) 1364 if err != nil { 1365 return out, metadata, err 1366 } 1367 1368 response, ok := out.RawResponse.(*smithyhttp.Response) 1369 if !ok { 1370 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1371 } 1372 1373 if response.StatusCode < 200 || response.StatusCode >= 300 { 1374 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeKey(response, &metadata) 1375 } 1376 output := &DescribeKeyOutput{} 1377 out.Result = output 1378 1379 var buff [1024]byte 1380 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1381 1382 body := io.TeeReader(response.Body, ringBuffer) 1383 decoder := json.NewDecoder(body) 1384 decoder.UseNumber() 1385 var shape interface{} 1386 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1387 var snapshot bytes.Buffer 1388 io.Copy(&snapshot, ringBuffer) 1389 err = &smithy.DeserializationError{ 1390 Err: fmt.Errorf("failed to decode response body, %w", err), 1391 Snapshot: snapshot.Bytes(), 1392 } 1393 return out, metadata, err 1394 } 1395 1396 err = awsAwsjson11_deserializeOpDocumentDescribeKeyOutput(&output, shape) 1397 if err != nil { 1398 var snapshot bytes.Buffer 1399 io.Copy(&snapshot, ringBuffer) 1400 err = &smithy.DeserializationError{ 1401 Err: fmt.Errorf("failed to decode response body, %w", err), 1402 Snapshot: snapshot.Bytes(), 1403 } 1404 return out, metadata, err 1405 } 1406 1407 return out, metadata, err 1408} 1409 1410func awsAwsjson11_deserializeOpErrorDescribeKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1411 var errorBuffer bytes.Buffer 1412 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1413 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1414 } 1415 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1416 1417 errorCode := "UnknownError" 1418 errorMessage := errorCode 1419 1420 code := response.Header.Get("X-Amzn-ErrorType") 1421 if len(code) != 0 { 1422 errorCode = restjson.SanitizeErrorCode(code) 1423 } 1424 1425 var buff [1024]byte 1426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1427 1428 body := io.TeeReader(errorBody, ringBuffer) 1429 decoder := json.NewDecoder(body) 1430 decoder.UseNumber() 1431 code, message, err := restjson.GetErrorInfo(decoder) 1432 if err != nil { 1433 var snapshot bytes.Buffer 1434 io.Copy(&snapshot, ringBuffer) 1435 err = &smithy.DeserializationError{ 1436 Err: fmt.Errorf("failed to decode response body, %w", err), 1437 Snapshot: snapshot.Bytes(), 1438 } 1439 return err 1440 } 1441 1442 errorBody.Seek(0, io.SeekStart) 1443 if len(code) != 0 { 1444 errorCode = restjson.SanitizeErrorCode(code) 1445 } 1446 if len(message) != 0 { 1447 errorMessage = message 1448 } 1449 1450 switch { 1451 case strings.EqualFold("DependencyTimeoutException", errorCode): 1452 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1453 1454 case strings.EqualFold("InvalidArnException", errorCode): 1455 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1456 1457 case strings.EqualFold("KMSInternalException", errorCode): 1458 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1459 1460 case strings.EqualFold("NotFoundException", errorCode): 1461 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1462 1463 default: 1464 genericError := &smithy.GenericAPIError{ 1465 Code: errorCode, 1466 Message: errorMessage, 1467 } 1468 return genericError 1469 1470 } 1471} 1472 1473type awsAwsjson11_deserializeOpDisableKey struct { 1474} 1475 1476func (*awsAwsjson11_deserializeOpDisableKey) ID() string { 1477 return "OperationDeserializer" 1478} 1479 1480func (m *awsAwsjson11_deserializeOpDisableKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1481 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1482) { 1483 out, metadata, err = next.HandleDeserialize(ctx, in) 1484 if err != nil { 1485 return out, metadata, err 1486 } 1487 1488 response, ok := out.RawResponse.(*smithyhttp.Response) 1489 if !ok { 1490 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1491 } 1492 1493 if response.StatusCode < 200 || response.StatusCode >= 300 { 1494 return out, metadata, awsAwsjson11_deserializeOpErrorDisableKey(response, &metadata) 1495 } 1496 output := &DisableKeyOutput{} 1497 out.Result = output 1498 1499 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1500 return out, metadata, &smithy.DeserializationError{ 1501 Err: fmt.Errorf("failed to discard response body, %w", err), 1502 } 1503 } 1504 1505 return out, metadata, err 1506} 1507 1508func awsAwsjson11_deserializeOpErrorDisableKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1509 var errorBuffer bytes.Buffer 1510 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1511 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1512 } 1513 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1514 1515 errorCode := "UnknownError" 1516 errorMessage := errorCode 1517 1518 code := response.Header.Get("X-Amzn-ErrorType") 1519 if len(code) != 0 { 1520 errorCode = restjson.SanitizeErrorCode(code) 1521 } 1522 1523 var buff [1024]byte 1524 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1525 1526 body := io.TeeReader(errorBody, ringBuffer) 1527 decoder := json.NewDecoder(body) 1528 decoder.UseNumber() 1529 code, message, err := restjson.GetErrorInfo(decoder) 1530 if err != nil { 1531 var snapshot bytes.Buffer 1532 io.Copy(&snapshot, ringBuffer) 1533 err = &smithy.DeserializationError{ 1534 Err: fmt.Errorf("failed to decode response body, %w", err), 1535 Snapshot: snapshot.Bytes(), 1536 } 1537 return err 1538 } 1539 1540 errorBody.Seek(0, io.SeekStart) 1541 if len(code) != 0 { 1542 errorCode = restjson.SanitizeErrorCode(code) 1543 } 1544 if len(message) != 0 { 1545 errorMessage = message 1546 } 1547 1548 switch { 1549 case strings.EqualFold("DependencyTimeoutException", errorCode): 1550 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1551 1552 case strings.EqualFold("InvalidArnException", errorCode): 1553 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1554 1555 case strings.EqualFold("KMSInternalException", errorCode): 1556 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1557 1558 case strings.EqualFold("KMSInvalidStateException", errorCode): 1559 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1560 1561 case strings.EqualFold("NotFoundException", errorCode): 1562 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1563 1564 default: 1565 genericError := &smithy.GenericAPIError{ 1566 Code: errorCode, 1567 Message: errorMessage, 1568 } 1569 return genericError 1570 1571 } 1572} 1573 1574type awsAwsjson11_deserializeOpDisableKeyRotation struct { 1575} 1576 1577func (*awsAwsjson11_deserializeOpDisableKeyRotation) ID() string { 1578 return "OperationDeserializer" 1579} 1580 1581func (m *awsAwsjson11_deserializeOpDisableKeyRotation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1582 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1583) { 1584 out, metadata, err = next.HandleDeserialize(ctx, in) 1585 if err != nil { 1586 return out, metadata, err 1587 } 1588 1589 response, ok := out.RawResponse.(*smithyhttp.Response) 1590 if !ok { 1591 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1592 } 1593 1594 if response.StatusCode < 200 || response.StatusCode >= 300 { 1595 return out, metadata, awsAwsjson11_deserializeOpErrorDisableKeyRotation(response, &metadata) 1596 } 1597 output := &DisableKeyRotationOutput{} 1598 out.Result = output 1599 1600 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1601 return out, metadata, &smithy.DeserializationError{ 1602 Err: fmt.Errorf("failed to discard response body, %w", err), 1603 } 1604 } 1605 1606 return out, metadata, err 1607} 1608 1609func awsAwsjson11_deserializeOpErrorDisableKeyRotation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1610 var errorBuffer bytes.Buffer 1611 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1612 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1613 } 1614 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1615 1616 errorCode := "UnknownError" 1617 errorMessage := errorCode 1618 1619 code := response.Header.Get("X-Amzn-ErrorType") 1620 if len(code) != 0 { 1621 errorCode = restjson.SanitizeErrorCode(code) 1622 } 1623 1624 var buff [1024]byte 1625 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1626 1627 body := io.TeeReader(errorBody, ringBuffer) 1628 decoder := json.NewDecoder(body) 1629 decoder.UseNumber() 1630 code, message, err := restjson.GetErrorInfo(decoder) 1631 if err != nil { 1632 var snapshot bytes.Buffer 1633 io.Copy(&snapshot, ringBuffer) 1634 err = &smithy.DeserializationError{ 1635 Err: fmt.Errorf("failed to decode response body, %w", err), 1636 Snapshot: snapshot.Bytes(), 1637 } 1638 return err 1639 } 1640 1641 errorBody.Seek(0, io.SeekStart) 1642 if len(code) != 0 { 1643 errorCode = restjson.SanitizeErrorCode(code) 1644 } 1645 if len(message) != 0 { 1646 errorMessage = message 1647 } 1648 1649 switch { 1650 case strings.EqualFold("DependencyTimeoutException", errorCode): 1651 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1652 1653 case strings.EqualFold("DisabledException", errorCode): 1654 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 1655 1656 case strings.EqualFold("InvalidArnException", errorCode): 1657 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1658 1659 case strings.EqualFold("KMSInternalException", errorCode): 1660 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1661 1662 case strings.EqualFold("KMSInvalidStateException", errorCode): 1663 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1664 1665 case strings.EqualFold("NotFoundException", errorCode): 1666 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1667 1668 case strings.EqualFold("UnsupportedOperationException", errorCode): 1669 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 1670 1671 default: 1672 genericError := &smithy.GenericAPIError{ 1673 Code: errorCode, 1674 Message: errorMessage, 1675 } 1676 return genericError 1677 1678 } 1679} 1680 1681type awsAwsjson11_deserializeOpDisconnectCustomKeyStore struct { 1682} 1683 1684func (*awsAwsjson11_deserializeOpDisconnectCustomKeyStore) ID() string { 1685 return "OperationDeserializer" 1686} 1687 1688func (m *awsAwsjson11_deserializeOpDisconnectCustomKeyStore) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1689 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1690) { 1691 out, metadata, err = next.HandleDeserialize(ctx, in) 1692 if err != nil { 1693 return out, metadata, err 1694 } 1695 1696 response, ok := out.RawResponse.(*smithyhttp.Response) 1697 if !ok { 1698 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1699 } 1700 1701 if response.StatusCode < 200 || response.StatusCode >= 300 { 1702 return out, metadata, awsAwsjson11_deserializeOpErrorDisconnectCustomKeyStore(response, &metadata) 1703 } 1704 output := &DisconnectCustomKeyStoreOutput{} 1705 out.Result = output 1706 1707 var buff [1024]byte 1708 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1709 1710 body := io.TeeReader(response.Body, ringBuffer) 1711 decoder := json.NewDecoder(body) 1712 decoder.UseNumber() 1713 var shape interface{} 1714 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1715 var snapshot bytes.Buffer 1716 io.Copy(&snapshot, ringBuffer) 1717 err = &smithy.DeserializationError{ 1718 Err: fmt.Errorf("failed to decode response body, %w", err), 1719 Snapshot: snapshot.Bytes(), 1720 } 1721 return out, metadata, err 1722 } 1723 1724 err = awsAwsjson11_deserializeOpDocumentDisconnectCustomKeyStoreOutput(&output, shape) 1725 if err != nil { 1726 var snapshot bytes.Buffer 1727 io.Copy(&snapshot, ringBuffer) 1728 err = &smithy.DeserializationError{ 1729 Err: fmt.Errorf("failed to decode response body, %w", err), 1730 Snapshot: snapshot.Bytes(), 1731 } 1732 return out, metadata, err 1733 } 1734 1735 return out, metadata, err 1736} 1737 1738func awsAwsjson11_deserializeOpErrorDisconnectCustomKeyStore(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1739 var errorBuffer bytes.Buffer 1740 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1741 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1742 } 1743 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1744 1745 errorCode := "UnknownError" 1746 errorMessage := errorCode 1747 1748 code := response.Header.Get("X-Amzn-ErrorType") 1749 if len(code) != 0 { 1750 errorCode = restjson.SanitizeErrorCode(code) 1751 } 1752 1753 var buff [1024]byte 1754 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1755 1756 body := io.TeeReader(errorBody, ringBuffer) 1757 decoder := json.NewDecoder(body) 1758 decoder.UseNumber() 1759 code, message, err := restjson.GetErrorInfo(decoder) 1760 if err != nil { 1761 var snapshot bytes.Buffer 1762 io.Copy(&snapshot, ringBuffer) 1763 err = &smithy.DeserializationError{ 1764 Err: fmt.Errorf("failed to decode response body, %w", err), 1765 Snapshot: snapshot.Bytes(), 1766 } 1767 return err 1768 } 1769 1770 errorBody.Seek(0, io.SeekStart) 1771 if len(code) != 0 { 1772 errorCode = restjson.SanitizeErrorCode(code) 1773 } 1774 if len(message) != 0 { 1775 errorMessage = message 1776 } 1777 1778 switch { 1779 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 1780 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 1781 1782 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 1783 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 1784 1785 case strings.EqualFold("KMSInternalException", errorCode): 1786 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1787 1788 default: 1789 genericError := &smithy.GenericAPIError{ 1790 Code: errorCode, 1791 Message: errorMessage, 1792 } 1793 return genericError 1794 1795 } 1796} 1797 1798type awsAwsjson11_deserializeOpEnableKey struct { 1799} 1800 1801func (*awsAwsjson11_deserializeOpEnableKey) ID() string { 1802 return "OperationDeserializer" 1803} 1804 1805func (m *awsAwsjson11_deserializeOpEnableKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1806 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1807) { 1808 out, metadata, err = next.HandleDeserialize(ctx, in) 1809 if err != nil { 1810 return out, metadata, err 1811 } 1812 1813 response, ok := out.RawResponse.(*smithyhttp.Response) 1814 if !ok { 1815 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1816 } 1817 1818 if response.StatusCode < 200 || response.StatusCode >= 300 { 1819 return out, metadata, awsAwsjson11_deserializeOpErrorEnableKey(response, &metadata) 1820 } 1821 output := &EnableKeyOutput{} 1822 out.Result = output 1823 1824 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1825 return out, metadata, &smithy.DeserializationError{ 1826 Err: fmt.Errorf("failed to discard response body, %w", err), 1827 } 1828 } 1829 1830 return out, metadata, err 1831} 1832 1833func awsAwsjson11_deserializeOpErrorEnableKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1834 var errorBuffer bytes.Buffer 1835 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1836 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1837 } 1838 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1839 1840 errorCode := "UnknownError" 1841 errorMessage := errorCode 1842 1843 code := response.Header.Get("X-Amzn-ErrorType") 1844 if len(code) != 0 { 1845 errorCode = restjson.SanitizeErrorCode(code) 1846 } 1847 1848 var buff [1024]byte 1849 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1850 1851 body := io.TeeReader(errorBody, ringBuffer) 1852 decoder := json.NewDecoder(body) 1853 decoder.UseNumber() 1854 code, message, err := restjson.GetErrorInfo(decoder) 1855 if err != nil { 1856 var snapshot bytes.Buffer 1857 io.Copy(&snapshot, ringBuffer) 1858 err = &smithy.DeserializationError{ 1859 Err: fmt.Errorf("failed to decode response body, %w", err), 1860 Snapshot: snapshot.Bytes(), 1861 } 1862 return err 1863 } 1864 1865 errorBody.Seek(0, io.SeekStart) 1866 if len(code) != 0 { 1867 errorCode = restjson.SanitizeErrorCode(code) 1868 } 1869 if len(message) != 0 { 1870 errorMessage = message 1871 } 1872 1873 switch { 1874 case strings.EqualFold("DependencyTimeoutException", errorCode): 1875 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1876 1877 case strings.EqualFold("InvalidArnException", errorCode): 1878 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1879 1880 case strings.EqualFold("KMSInternalException", errorCode): 1881 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1882 1883 case strings.EqualFold("KMSInvalidStateException", errorCode): 1884 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1885 1886 case strings.EqualFold("LimitExceededException", errorCode): 1887 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 1888 1889 case strings.EqualFold("NotFoundException", errorCode): 1890 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1891 1892 default: 1893 genericError := &smithy.GenericAPIError{ 1894 Code: errorCode, 1895 Message: errorMessage, 1896 } 1897 return genericError 1898 1899 } 1900} 1901 1902type awsAwsjson11_deserializeOpEnableKeyRotation struct { 1903} 1904 1905func (*awsAwsjson11_deserializeOpEnableKeyRotation) ID() string { 1906 return "OperationDeserializer" 1907} 1908 1909func (m *awsAwsjson11_deserializeOpEnableKeyRotation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1910 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1911) { 1912 out, metadata, err = next.HandleDeserialize(ctx, in) 1913 if err != nil { 1914 return out, metadata, err 1915 } 1916 1917 response, ok := out.RawResponse.(*smithyhttp.Response) 1918 if !ok { 1919 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1920 } 1921 1922 if response.StatusCode < 200 || response.StatusCode >= 300 { 1923 return out, metadata, awsAwsjson11_deserializeOpErrorEnableKeyRotation(response, &metadata) 1924 } 1925 output := &EnableKeyRotationOutput{} 1926 out.Result = output 1927 1928 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1929 return out, metadata, &smithy.DeserializationError{ 1930 Err: fmt.Errorf("failed to discard response body, %w", err), 1931 } 1932 } 1933 1934 return out, metadata, err 1935} 1936 1937func awsAwsjson11_deserializeOpErrorEnableKeyRotation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1938 var errorBuffer bytes.Buffer 1939 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1940 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1941 } 1942 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1943 1944 errorCode := "UnknownError" 1945 errorMessage := errorCode 1946 1947 code := response.Header.Get("X-Amzn-ErrorType") 1948 if len(code) != 0 { 1949 errorCode = restjson.SanitizeErrorCode(code) 1950 } 1951 1952 var buff [1024]byte 1953 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1954 1955 body := io.TeeReader(errorBody, ringBuffer) 1956 decoder := json.NewDecoder(body) 1957 decoder.UseNumber() 1958 code, message, err := restjson.GetErrorInfo(decoder) 1959 if err != nil { 1960 var snapshot bytes.Buffer 1961 io.Copy(&snapshot, ringBuffer) 1962 err = &smithy.DeserializationError{ 1963 Err: fmt.Errorf("failed to decode response body, %w", err), 1964 Snapshot: snapshot.Bytes(), 1965 } 1966 return err 1967 } 1968 1969 errorBody.Seek(0, io.SeekStart) 1970 if len(code) != 0 { 1971 errorCode = restjson.SanitizeErrorCode(code) 1972 } 1973 if len(message) != 0 { 1974 errorMessage = message 1975 } 1976 1977 switch { 1978 case strings.EqualFold("DependencyTimeoutException", errorCode): 1979 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1980 1981 case strings.EqualFold("DisabledException", errorCode): 1982 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 1983 1984 case strings.EqualFold("InvalidArnException", errorCode): 1985 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1986 1987 case strings.EqualFold("KMSInternalException", errorCode): 1988 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1989 1990 case strings.EqualFold("KMSInvalidStateException", errorCode): 1991 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1992 1993 case strings.EqualFold("NotFoundException", errorCode): 1994 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1995 1996 case strings.EqualFold("UnsupportedOperationException", errorCode): 1997 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 1998 1999 default: 2000 genericError := &smithy.GenericAPIError{ 2001 Code: errorCode, 2002 Message: errorMessage, 2003 } 2004 return genericError 2005 2006 } 2007} 2008 2009type awsAwsjson11_deserializeOpEncrypt struct { 2010} 2011 2012func (*awsAwsjson11_deserializeOpEncrypt) ID() string { 2013 return "OperationDeserializer" 2014} 2015 2016func (m *awsAwsjson11_deserializeOpEncrypt) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2017 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2018) { 2019 out, metadata, err = next.HandleDeserialize(ctx, in) 2020 if err != nil { 2021 return out, metadata, err 2022 } 2023 2024 response, ok := out.RawResponse.(*smithyhttp.Response) 2025 if !ok { 2026 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2027 } 2028 2029 if response.StatusCode < 200 || response.StatusCode >= 300 { 2030 return out, metadata, awsAwsjson11_deserializeOpErrorEncrypt(response, &metadata) 2031 } 2032 output := &EncryptOutput{} 2033 out.Result = output 2034 2035 var buff [1024]byte 2036 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2037 2038 body := io.TeeReader(response.Body, ringBuffer) 2039 decoder := json.NewDecoder(body) 2040 decoder.UseNumber() 2041 var shape interface{} 2042 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2043 var snapshot bytes.Buffer 2044 io.Copy(&snapshot, ringBuffer) 2045 err = &smithy.DeserializationError{ 2046 Err: fmt.Errorf("failed to decode response body, %w", err), 2047 Snapshot: snapshot.Bytes(), 2048 } 2049 return out, metadata, err 2050 } 2051 2052 err = awsAwsjson11_deserializeOpDocumentEncryptOutput(&output, shape) 2053 if err != nil { 2054 var snapshot bytes.Buffer 2055 io.Copy(&snapshot, ringBuffer) 2056 err = &smithy.DeserializationError{ 2057 Err: fmt.Errorf("failed to decode response body, %w", err), 2058 Snapshot: snapshot.Bytes(), 2059 } 2060 return out, metadata, err 2061 } 2062 2063 return out, metadata, err 2064} 2065 2066func awsAwsjson11_deserializeOpErrorEncrypt(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2067 var errorBuffer bytes.Buffer 2068 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2069 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2070 } 2071 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2072 2073 errorCode := "UnknownError" 2074 errorMessage := errorCode 2075 2076 code := response.Header.Get("X-Amzn-ErrorType") 2077 if len(code) != 0 { 2078 errorCode = restjson.SanitizeErrorCode(code) 2079 } 2080 2081 var buff [1024]byte 2082 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2083 2084 body := io.TeeReader(errorBody, ringBuffer) 2085 decoder := json.NewDecoder(body) 2086 decoder.UseNumber() 2087 code, message, err := restjson.GetErrorInfo(decoder) 2088 if err != nil { 2089 var snapshot bytes.Buffer 2090 io.Copy(&snapshot, ringBuffer) 2091 err = &smithy.DeserializationError{ 2092 Err: fmt.Errorf("failed to decode response body, %w", err), 2093 Snapshot: snapshot.Bytes(), 2094 } 2095 return err 2096 } 2097 2098 errorBody.Seek(0, io.SeekStart) 2099 if len(code) != 0 { 2100 errorCode = restjson.SanitizeErrorCode(code) 2101 } 2102 if len(message) != 0 { 2103 errorMessage = message 2104 } 2105 2106 switch { 2107 case strings.EqualFold("DependencyTimeoutException", errorCode): 2108 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2109 2110 case strings.EqualFold("DisabledException", errorCode): 2111 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2112 2113 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2114 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2115 2116 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2117 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2118 2119 case strings.EqualFold("KMSInternalException", errorCode): 2120 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2121 2122 case strings.EqualFold("KMSInvalidStateException", errorCode): 2123 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 2124 2125 case strings.EqualFold("KeyUnavailableException", errorCode): 2126 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 2127 2128 case strings.EqualFold("NotFoundException", errorCode): 2129 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2130 2131 default: 2132 genericError := &smithy.GenericAPIError{ 2133 Code: errorCode, 2134 Message: errorMessage, 2135 } 2136 return genericError 2137 2138 } 2139} 2140 2141type awsAwsjson11_deserializeOpGenerateDataKey struct { 2142} 2143 2144func (*awsAwsjson11_deserializeOpGenerateDataKey) ID() string { 2145 return "OperationDeserializer" 2146} 2147 2148func (m *awsAwsjson11_deserializeOpGenerateDataKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2149 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2150) { 2151 out, metadata, err = next.HandleDeserialize(ctx, in) 2152 if err != nil { 2153 return out, metadata, err 2154 } 2155 2156 response, ok := out.RawResponse.(*smithyhttp.Response) 2157 if !ok { 2158 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2159 } 2160 2161 if response.StatusCode < 200 || response.StatusCode >= 300 { 2162 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKey(response, &metadata) 2163 } 2164 output := &GenerateDataKeyOutput{} 2165 out.Result = output 2166 2167 var buff [1024]byte 2168 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2169 2170 body := io.TeeReader(response.Body, ringBuffer) 2171 decoder := json.NewDecoder(body) 2172 decoder.UseNumber() 2173 var shape interface{} 2174 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2175 var snapshot bytes.Buffer 2176 io.Copy(&snapshot, ringBuffer) 2177 err = &smithy.DeserializationError{ 2178 Err: fmt.Errorf("failed to decode response body, %w", err), 2179 Snapshot: snapshot.Bytes(), 2180 } 2181 return out, metadata, err 2182 } 2183 2184 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyOutput(&output, shape) 2185 if err != nil { 2186 var snapshot bytes.Buffer 2187 io.Copy(&snapshot, ringBuffer) 2188 err = &smithy.DeserializationError{ 2189 Err: fmt.Errorf("failed to decode response body, %w", err), 2190 Snapshot: snapshot.Bytes(), 2191 } 2192 return out, metadata, err 2193 } 2194 2195 return out, metadata, err 2196} 2197 2198func awsAwsjson11_deserializeOpErrorGenerateDataKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2199 var errorBuffer bytes.Buffer 2200 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2201 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2202 } 2203 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2204 2205 errorCode := "UnknownError" 2206 errorMessage := errorCode 2207 2208 code := response.Header.Get("X-Amzn-ErrorType") 2209 if len(code) != 0 { 2210 errorCode = restjson.SanitizeErrorCode(code) 2211 } 2212 2213 var buff [1024]byte 2214 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2215 2216 body := io.TeeReader(errorBody, ringBuffer) 2217 decoder := json.NewDecoder(body) 2218 decoder.UseNumber() 2219 code, message, err := restjson.GetErrorInfo(decoder) 2220 if err != nil { 2221 var snapshot bytes.Buffer 2222 io.Copy(&snapshot, ringBuffer) 2223 err = &smithy.DeserializationError{ 2224 Err: fmt.Errorf("failed to decode response body, %w", err), 2225 Snapshot: snapshot.Bytes(), 2226 } 2227 return err 2228 } 2229 2230 errorBody.Seek(0, io.SeekStart) 2231 if len(code) != 0 { 2232 errorCode = restjson.SanitizeErrorCode(code) 2233 } 2234 if len(message) != 0 { 2235 errorMessage = message 2236 } 2237 2238 switch { 2239 case strings.EqualFold("DependencyTimeoutException", errorCode): 2240 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2241 2242 case strings.EqualFold("DisabledException", errorCode): 2243 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2244 2245 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2246 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2247 2248 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2249 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2250 2251 case strings.EqualFold("KMSInternalException", errorCode): 2252 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2253 2254 case strings.EqualFold("KMSInvalidStateException", errorCode): 2255 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 2256 2257 case strings.EqualFold("KeyUnavailableException", errorCode): 2258 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 2259 2260 case strings.EqualFold("NotFoundException", errorCode): 2261 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2262 2263 default: 2264 genericError := &smithy.GenericAPIError{ 2265 Code: errorCode, 2266 Message: errorMessage, 2267 } 2268 return genericError 2269 2270 } 2271} 2272 2273type awsAwsjson11_deserializeOpGenerateDataKeyPair struct { 2274} 2275 2276func (*awsAwsjson11_deserializeOpGenerateDataKeyPair) ID() string { 2277 return "OperationDeserializer" 2278} 2279 2280func (m *awsAwsjson11_deserializeOpGenerateDataKeyPair) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2281 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2282) { 2283 out, metadata, err = next.HandleDeserialize(ctx, in) 2284 if err != nil { 2285 return out, metadata, err 2286 } 2287 2288 response, ok := out.RawResponse.(*smithyhttp.Response) 2289 if !ok { 2290 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2291 } 2292 2293 if response.StatusCode < 200 || response.StatusCode >= 300 { 2294 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKeyPair(response, &metadata) 2295 } 2296 output := &GenerateDataKeyPairOutput{} 2297 out.Result = output 2298 2299 var buff [1024]byte 2300 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2301 2302 body := io.TeeReader(response.Body, ringBuffer) 2303 decoder := json.NewDecoder(body) 2304 decoder.UseNumber() 2305 var shape interface{} 2306 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2307 var snapshot bytes.Buffer 2308 io.Copy(&snapshot, ringBuffer) 2309 err = &smithy.DeserializationError{ 2310 Err: fmt.Errorf("failed to decode response body, %w", err), 2311 Snapshot: snapshot.Bytes(), 2312 } 2313 return out, metadata, err 2314 } 2315 2316 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairOutput(&output, shape) 2317 if err != nil { 2318 var snapshot bytes.Buffer 2319 io.Copy(&snapshot, ringBuffer) 2320 err = &smithy.DeserializationError{ 2321 Err: fmt.Errorf("failed to decode response body, %w", err), 2322 Snapshot: snapshot.Bytes(), 2323 } 2324 return out, metadata, err 2325 } 2326 2327 return out, metadata, err 2328} 2329 2330func awsAwsjson11_deserializeOpErrorGenerateDataKeyPair(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2331 var errorBuffer bytes.Buffer 2332 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2333 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2334 } 2335 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2336 2337 errorCode := "UnknownError" 2338 errorMessage := errorCode 2339 2340 code := response.Header.Get("X-Amzn-ErrorType") 2341 if len(code) != 0 { 2342 errorCode = restjson.SanitizeErrorCode(code) 2343 } 2344 2345 var buff [1024]byte 2346 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2347 2348 body := io.TeeReader(errorBody, ringBuffer) 2349 decoder := json.NewDecoder(body) 2350 decoder.UseNumber() 2351 code, message, err := restjson.GetErrorInfo(decoder) 2352 if err != nil { 2353 var snapshot bytes.Buffer 2354 io.Copy(&snapshot, ringBuffer) 2355 err = &smithy.DeserializationError{ 2356 Err: fmt.Errorf("failed to decode response body, %w", err), 2357 Snapshot: snapshot.Bytes(), 2358 } 2359 return err 2360 } 2361 2362 errorBody.Seek(0, io.SeekStart) 2363 if len(code) != 0 { 2364 errorCode = restjson.SanitizeErrorCode(code) 2365 } 2366 if len(message) != 0 { 2367 errorMessage = message 2368 } 2369 2370 switch { 2371 case strings.EqualFold("DependencyTimeoutException", errorCode): 2372 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2373 2374 case strings.EqualFold("DisabledException", errorCode): 2375 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2376 2377 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2378 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2379 2380 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2381 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2382 2383 case strings.EqualFold("KMSInternalException", errorCode): 2384 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2385 2386 case strings.EqualFold("KMSInvalidStateException", errorCode): 2387 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 2388 2389 case strings.EqualFold("KeyUnavailableException", errorCode): 2390 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 2391 2392 case strings.EqualFold("NotFoundException", errorCode): 2393 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2394 2395 case strings.EqualFold("UnsupportedOperationException", errorCode): 2396 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 2397 2398 default: 2399 genericError := &smithy.GenericAPIError{ 2400 Code: errorCode, 2401 Message: errorMessage, 2402 } 2403 return genericError 2404 2405 } 2406} 2407 2408type awsAwsjson11_deserializeOpGenerateDataKeyPairWithoutPlaintext struct { 2409} 2410 2411func (*awsAwsjson11_deserializeOpGenerateDataKeyPairWithoutPlaintext) ID() string { 2412 return "OperationDeserializer" 2413} 2414 2415func (m *awsAwsjson11_deserializeOpGenerateDataKeyPairWithoutPlaintext) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2416 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2417) { 2418 out, metadata, err = next.HandleDeserialize(ctx, in) 2419 if err != nil { 2420 return out, metadata, err 2421 } 2422 2423 response, ok := out.RawResponse.(*smithyhttp.Response) 2424 if !ok { 2425 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2426 } 2427 2428 if response.StatusCode < 200 || response.StatusCode >= 300 { 2429 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKeyPairWithoutPlaintext(response, &metadata) 2430 } 2431 output := &GenerateDataKeyPairWithoutPlaintextOutput{} 2432 out.Result = output 2433 2434 var buff [1024]byte 2435 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2436 2437 body := io.TeeReader(response.Body, ringBuffer) 2438 decoder := json.NewDecoder(body) 2439 decoder.UseNumber() 2440 var shape interface{} 2441 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2442 var snapshot bytes.Buffer 2443 io.Copy(&snapshot, ringBuffer) 2444 err = &smithy.DeserializationError{ 2445 Err: fmt.Errorf("failed to decode response body, %w", err), 2446 Snapshot: snapshot.Bytes(), 2447 } 2448 return out, metadata, err 2449 } 2450 2451 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairWithoutPlaintextOutput(&output, shape) 2452 if err != nil { 2453 var snapshot bytes.Buffer 2454 io.Copy(&snapshot, ringBuffer) 2455 err = &smithy.DeserializationError{ 2456 Err: fmt.Errorf("failed to decode response body, %w", err), 2457 Snapshot: snapshot.Bytes(), 2458 } 2459 return out, metadata, err 2460 } 2461 2462 return out, metadata, err 2463} 2464 2465func awsAwsjson11_deserializeOpErrorGenerateDataKeyPairWithoutPlaintext(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2466 var errorBuffer bytes.Buffer 2467 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2468 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2469 } 2470 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2471 2472 errorCode := "UnknownError" 2473 errorMessage := errorCode 2474 2475 code := response.Header.Get("X-Amzn-ErrorType") 2476 if len(code) != 0 { 2477 errorCode = restjson.SanitizeErrorCode(code) 2478 } 2479 2480 var buff [1024]byte 2481 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2482 2483 body := io.TeeReader(errorBody, ringBuffer) 2484 decoder := json.NewDecoder(body) 2485 decoder.UseNumber() 2486 code, message, err := restjson.GetErrorInfo(decoder) 2487 if err != nil { 2488 var snapshot bytes.Buffer 2489 io.Copy(&snapshot, ringBuffer) 2490 err = &smithy.DeserializationError{ 2491 Err: fmt.Errorf("failed to decode response body, %w", err), 2492 Snapshot: snapshot.Bytes(), 2493 } 2494 return err 2495 } 2496 2497 errorBody.Seek(0, io.SeekStart) 2498 if len(code) != 0 { 2499 errorCode = restjson.SanitizeErrorCode(code) 2500 } 2501 if len(message) != 0 { 2502 errorMessage = message 2503 } 2504 2505 switch { 2506 case strings.EqualFold("DependencyTimeoutException", errorCode): 2507 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2508 2509 case strings.EqualFold("DisabledException", errorCode): 2510 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2511 2512 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2513 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2514 2515 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2516 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2517 2518 case strings.EqualFold("KMSInternalException", errorCode): 2519 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2520 2521 case strings.EqualFold("KMSInvalidStateException", errorCode): 2522 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 2523 2524 case strings.EqualFold("KeyUnavailableException", errorCode): 2525 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 2526 2527 case strings.EqualFold("NotFoundException", errorCode): 2528 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2529 2530 case strings.EqualFold("UnsupportedOperationException", errorCode): 2531 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 2532 2533 default: 2534 genericError := &smithy.GenericAPIError{ 2535 Code: errorCode, 2536 Message: errorMessage, 2537 } 2538 return genericError 2539 2540 } 2541} 2542 2543type awsAwsjson11_deserializeOpGenerateDataKeyWithoutPlaintext struct { 2544} 2545 2546func (*awsAwsjson11_deserializeOpGenerateDataKeyWithoutPlaintext) ID() string { 2547 return "OperationDeserializer" 2548} 2549 2550func (m *awsAwsjson11_deserializeOpGenerateDataKeyWithoutPlaintext) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2551 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2552) { 2553 out, metadata, err = next.HandleDeserialize(ctx, in) 2554 if err != nil { 2555 return out, metadata, err 2556 } 2557 2558 response, ok := out.RawResponse.(*smithyhttp.Response) 2559 if !ok { 2560 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2561 } 2562 2563 if response.StatusCode < 200 || response.StatusCode >= 300 { 2564 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKeyWithoutPlaintext(response, &metadata) 2565 } 2566 output := &GenerateDataKeyWithoutPlaintextOutput{} 2567 out.Result = output 2568 2569 var buff [1024]byte 2570 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2571 2572 body := io.TeeReader(response.Body, ringBuffer) 2573 decoder := json.NewDecoder(body) 2574 decoder.UseNumber() 2575 var shape interface{} 2576 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2577 var snapshot bytes.Buffer 2578 io.Copy(&snapshot, ringBuffer) 2579 err = &smithy.DeserializationError{ 2580 Err: fmt.Errorf("failed to decode response body, %w", err), 2581 Snapshot: snapshot.Bytes(), 2582 } 2583 return out, metadata, err 2584 } 2585 2586 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyWithoutPlaintextOutput(&output, shape) 2587 if err != nil { 2588 var snapshot bytes.Buffer 2589 io.Copy(&snapshot, ringBuffer) 2590 err = &smithy.DeserializationError{ 2591 Err: fmt.Errorf("failed to decode response body, %w", err), 2592 Snapshot: snapshot.Bytes(), 2593 } 2594 return out, metadata, err 2595 } 2596 2597 return out, metadata, err 2598} 2599 2600func awsAwsjson11_deserializeOpErrorGenerateDataKeyWithoutPlaintext(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2601 var errorBuffer bytes.Buffer 2602 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2603 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2604 } 2605 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2606 2607 errorCode := "UnknownError" 2608 errorMessage := errorCode 2609 2610 code := response.Header.Get("X-Amzn-ErrorType") 2611 if len(code) != 0 { 2612 errorCode = restjson.SanitizeErrorCode(code) 2613 } 2614 2615 var buff [1024]byte 2616 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2617 2618 body := io.TeeReader(errorBody, ringBuffer) 2619 decoder := json.NewDecoder(body) 2620 decoder.UseNumber() 2621 code, message, err := restjson.GetErrorInfo(decoder) 2622 if err != nil { 2623 var snapshot bytes.Buffer 2624 io.Copy(&snapshot, ringBuffer) 2625 err = &smithy.DeserializationError{ 2626 Err: fmt.Errorf("failed to decode response body, %w", err), 2627 Snapshot: snapshot.Bytes(), 2628 } 2629 return err 2630 } 2631 2632 errorBody.Seek(0, io.SeekStart) 2633 if len(code) != 0 { 2634 errorCode = restjson.SanitizeErrorCode(code) 2635 } 2636 if len(message) != 0 { 2637 errorMessage = message 2638 } 2639 2640 switch { 2641 case strings.EqualFold("DependencyTimeoutException", errorCode): 2642 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2643 2644 case strings.EqualFold("DisabledException", errorCode): 2645 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2646 2647 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2648 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2649 2650 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2651 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2652 2653 case strings.EqualFold("KMSInternalException", errorCode): 2654 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2655 2656 case strings.EqualFold("KMSInvalidStateException", errorCode): 2657 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 2658 2659 case strings.EqualFold("KeyUnavailableException", errorCode): 2660 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 2661 2662 case strings.EqualFold("NotFoundException", errorCode): 2663 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2664 2665 default: 2666 genericError := &smithy.GenericAPIError{ 2667 Code: errorCode, 2668 Message: errorMessage, 2669 } 2670 return genericError 2671 2672 } 2673} 2674 2675type awsAwsjson11_deserializeOpGenerateRandom struct { 2676} 2677 2678func (*awsAwsjson11_deserializeOpGenerateRandom) ID() string { 2679 return "OperationDeserializer" 2680} 2681 2682func (m *awsAwsjson11_deserializeOpGenerateRandom) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2683 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2684) { 2685 out, metadata, err = next.HandleDeserialize(ctx, in) 2686 if err != nil { 2687 return out, metadata, err 2688 } 2689 2690 response, ok := out.RawResponse.(*smithyhttp.Response) 2691 if !ok { 2692 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2693 } 2694 2695 if response.StatusCode < 200 || response.StatusCode >= 300 { 2696 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateRandom(response, &metadata) 2697 } 2698 output := &GenerateRandomOutput{} 2699 out.Result = output 2700 2701 var buff [1024]byte 2702 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2703 2704 body := io.TeeReader(response.Body, ringBuffer) 2705 decoder := json.NewDecoder(body) 2706 decoder.UseNumber() 2707 var shape interface{} 2708 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2709 var snapshot bytes.Buffer 2710 io.Copy(&snapshot, ringBuffer) 2711 err = &smithy.DeserializationError{ 2712 Err: fmt.Errorf("failed to decode response body, %w", err), 2713 Snapshot: snapshot.Bytes(), 2714 } 2715 return out, metadata, err 2716 } 2717 2718 err = awsAwsjson11_deserializeOpDocumentGenerateRandomOutput(&output, shape) 2719 if err != nil { 2720 var snapshot bytes.Buffer 2721 io.Copy(&snapshot, ringBuffer) 2722 err = &smithy.DeserializationError{ 2723 Err: fmt.Errorf("failed to decode response body, %w", err), 2724 Snapshot: snapshot.Bytes(), 2725 } 2726 return out, metadata, err 2727 } 2728 2729 return out, metadata, err 2730} 2731 2732func awsAwsjson11_deserializeOpErrorGenerateRandom(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2733 var errorBuffer bytes.Buffer 2734 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2735 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2736 } 2737 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2738 2739 errorCode := "UnknownError" 2740 errorMessage := errorCode 2741 2742 code := response.Header.Get("X-Amzn-ErrorType") 2743 if len(code) != 0 { 2744 errorCode = restjson.SanitizeErrorCode(code) 2745 } 2746 2747 var buff [1024]byte 2748 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2749 2750 body := io.TeeReader(errorBody, ringBuffer) 2751 decoder := json.NewDecoder(body) 2752 decoder.UseNumber() 2753 code, message, err := restjson.GetErrorInfo(decoder) 2754 if err != nil { 2755 var snapshot bytes.Buffer 2756 io.Copy(&snapshot, ringBuffer) 2757 err = &smithy.DeserializationError{ 2758 Err: fmt.Errorf("failed to decode response body, %w", err), 2759 Snapshot: snapshot.Bytes(), 2760 } 2761 return err 2762 } 2763 2764 errorBody.Seek(0, io.SeekStart) 2765 if len(code) != 0 { 2766 errorCode = restjson.SanitizeErrorCode(code) 2767 } 2768 if len(message) != 0 { 2769 errorMessage = message 2770 } 2771 2772 switch { 2773 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 2774 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 2775 2776 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 2777 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 2778 2779 case strings.EqualFold("DependencyTimeoutException", errorCode): 2780 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2781 2782 case strings.EqualFold("KMSInternalException", errorCode): 2783 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2784 2785 default: 2786 genericError := &smithy.GenericAPIError{ 2787 Code: errorCode, 2788 Message: errorMessage, 2789 } 2790 return genericError 2791 2792 } 2793} 2794 2795type awsAwsjson11_deserializeOpGetKeyPolicy struct { 2796} 2797 2798func (*awsAwsjson11_deserializeOpGetKeyPolicy) ID() string { 2799 return "OperationDeserializer" 2800} 2801 2802func (m *awsAwsjson11_deserializeOpGetKeyPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2803 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2804) { 2805 out, metadata, err = next.HandleDeserialize(ctx, in) 2806 if err != nil { 2807 return out, metadata, err 2808 } 2809 2810 response, ok := out.RawResponse.(*smithyhttp.Response) 2811 if !ok { 2812 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2813 } 2814 2815 if response.StatusCode < 200 || response.StatusCode >= 300 { 2816 return out, metadata, awsAwsjson11_deserializeOpErrorGetKeyPolicy(response, &metadata) 2817 } 2818 output := &GetKeyPolicyOutput{} 2819 out.Result = output 2820 2821 var buff [1024]byte 2822 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2823 2824 body := io.TeeReader(response.Body, ringBuffer) 2825 decoder := json.NewDecoder(body) 2826 decoder.UseNumber() 2827 var shape interface{} 2828 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2829 var snapshot bytes.Buffer 2830 io.Copy(&snapshot, ringBuffer) 2831 err = &smithy.DeserializationError{ 2832 Err: fmt.Errorf("failed to decode response body, %w", err), 2833 Snapshot: snapshot.Bytes(), 2834 } 2835 return out, metadata, err 2836 } 2837 2838 err = awsAwsjson11_deserializeOpDocumentGetKeyPolicyOutput(&output, shape) 2839 if err != nil { 2840 var snapshot bytes.Buffer 2841 io.Copy(&snapshot, ringBuffer) 2842 err = &smithy.DeserializationError{ 2843 Err: fmt.Errorf("failed to decode response body, %w", err), 2844 Snapshot: snapshot.Bytes(), 2845 } 2846 return out, metadata, err 2847 } 2848 2849 return out, metadata, err 2850} 2851 2852func awsAwsjson11_deserializeOpErrorGetKeyPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2853 var errorBuffer bytes.Buffer 2854 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2855 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2856 } 2857 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2858 2859 errorCode := "UnknownError" 2860 errorMessage := errorCode 2861 2862 code := response.Header.Get("X-Amzn-ErrorType") 2863 if len(code) != 0 { 2864 errorCode = restjson.SanitizeErrorCode(code) 2865 } 2866 2867 var buff [1024]byte 2868 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2869 2870 body := io.TeeReader(errorBody, ringBuffer) 2871 decoder := json.NewDecoder(body) 2872 decoder.UseNumber() 2873 code, message, err := restjson.GetErrorInfo(decoder) 2874 if err != nil { 2875 var snapshot bytes.Buffer 2876 io.Copy(&snapshot, ringBuffer) 2877 err = &smithy.DeserializationError{ 2878 Err: fmt.Errorf("failed to decode response body, %w", err), 2879 Snapshot: snapshot.Bytes(), 2880 } 2881 return err 2882 } 2883 2884 errorBody.Seek(0, io.SeekStart) 2885 if len(code) != 0 { 2886 errorCode = restjson.SanitizeErrorCode(code) 2887 } 2888 if len(message) != 0 { 2889 errorMessage = message 2890 } 2891 2892 switch { 2893 case strings.EqualFold("DependencyTimeoutException", errorCode): 2894 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2895 2896 case strings.EqualFold("InvalidArnException", errorCode): 2897 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 2898 2899 case strings.EqualFold("KMSInternalException", errorCode): 2900 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2901 2902 case strings.EqualFold("KMSInvalidStateException", errorCode): 2903 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 2904 2905 case strings.EqualFold("NotFoundException", errorCode): 2906 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2907 2908 default: 2909 genericError := &smithy.GenericAPIError{ 2910 Code: errorCode, 2911 Message: errorMessage, 2912 } 2913 return genericError 2914 2915 } 2916} 2917 2918type awsAwsjson11_deserializeOpGetKeyRotationStatus struct { 2919} 2920 2921func (*awsAwsjson11_deserializeOpGetKeyRotationStatus) ID() string { 2922 return "OperationDeserializer" 2923} 2924 2925func (m *awsAwsjson11_deserializeOpGetKeyRotationStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2926 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2927) { 2928 out, metadata, err = next.HandleDeserialize(ctx, in) 2929 if err != nil { 2930 return out, metadata, err 2931 } 2932 2933 response, ok := out.RawResponse.(*smithyhttp.Response) 2934 if !ok { 2935 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2936 } 2937 2938 if response.StatusCode < 200 || response.StatusCode >= 300 { 2939 return out, metadata, awsAwsjson11_deserializeOpErrorGetKeyRotationStatus(response, &metadata) 2940 } 2941 output := &GetKeyRotationStatusOutput{} 2942 out.Result = output 2943 2944 var buff [1024]byte 2945 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2946 2947 body := io.TeeReader(response.Body, ringBuffer) 2948 decoder := json.NewDecoder(body) 2949 decoder.UseNumber() 2950 var shape interface{} 2951 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2952 var snapshot bytes.Buffer 2953 io.Copy(&snapshot, ringBuffer) 2954 err = &smithy.DeserializationError{ 2955 Err: fmt.Errorf("failed to decode response body, %w", err), 2956 Snapshot: snapshot.Bytes(), 2957 } 2958 return out, metadata, err 2959 } 2960 2961 err = awsAwsjson11_deserializeOpDocumentGetKeyRotationStatusOutput(&output, shape) 2962 if err != nil { 2963 var snapshot bytes.Buffer 2964 io.Copy(&snapshot, ringBuffer) 2965 err = &smithy.DeserializationError{ 2966 Err: fmt.Errorf("failed to decode response body, %w", err), 2967 Snapshot: snapshot.Bytes(), 2968 } 2969 return out, metadata, err 2970 } 2971 2972 return out, metadata, err 2973} 2974 2975func awsAwsjson11_deserializeOpErrorGetKeyRotationStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2976 var errorBuffer bytes.Buffer 2977 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2978 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2979 } 2980 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2981 2982 errorCode := "UnknownError" 2983 errorMessage := errorCode 2984 2985 code := response.Header.Get("X-Amzn-ErrorType") 2986 if len(code) != 0 { 2987 errorCode = restjson.SanitizeErrorCode(code) 2988 } 2989 2990 var buff [1024]byte 2991 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2992 2993 body := io.TeeReader(errorBody, ringBuffer) 2994 decoder := json.NewDecoder(body) 2995 decoder.UseNumber() 2996 code, message, err := restjson.GetErrorInfo(decoder) 2997 if err != nil { 2998 var snapshot bytes.Buffer 2999 io.Copy(&snapshot, ringBuffer) 3000 err = &smithy.DeserializationError{ 3001 Err: fmt.Errorf("failed to decode response body, %w", err), 3002 Snapshot: snapshot.Bytes(), 3003 } 3004 return err 3005 } 3006 3007 errorBody.Seek(0, io.SeekStart) 3008 if len(code) != 0 { 3009 errorCode = restjson.SanitizeErrorCode(code) 3010 } 3011 if len(message) != 0 { 3012 errorMessage = message 3013 } 3014 3015 switch { 3016 case strings.EqualFold("DependencyTimeoutException", errorCode): 3017 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3018 3019 case strings.EqualFold("InvalidArnException", errorCode): 3020 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3021 3022 case strings.EqualFold("KMSInternalException", errorCode): 3023 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3024 3025 case strings.EqualFold("KMSInvalidStateException", errorCode): 3026 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3027 3028 case strings.EqualFold("NotFoundException", errorCode): 3029 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3030 3031 case strings.EqualFold("UnsupportedOperationException", errorCode): 3032 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3033 3034 default: 3035 genericError := &smithy.GenericAPIError{ 3036 Code: errorCode, 3037 Message: errorMessage, 3038 } 3039 return genericError 3040 3041 } 3042} 3043 3044type awsAwsjson11_deserializeOpGetParametersForImport struct { 3045} 3046 3047func (*awsAwsjson11_deserializeOpGetParametersForImport) ID() string { 3048 return "OperationDeserializer" 3049} 3050 3051func (m *awsAwsjson11_deserializeOpGetParametersForImport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3052 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3053) { 3054 out, metadata, err = next.HandleDeserialize(ctx, in) 3055 if err != nil { 3056 return out, metadata, err 3057 } 3058 3059 response, ok := out.RawResponse.(*smithyhttp.Response) 3060 if !ok { 3061 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3062 } 3063 3064 if response.StatusCode < 200 || response.StatusCode >= 300 { 3065 return out, metadata, awsAwsjson11_deserializeOpErrorGetParametersForImport(response, &metadata) 3066 } 3067 output := &GetParametersForImportOutput{} 3068 out.Result = output 3069 3070 var buff [1024]byte 3071 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3072 3073 body := io.TeeReader(response.Body, ringBuffer) 3074 decoder := json.NewDecoder(body) 3075 decoder.UseNumber() 3076 var shape interface{} 3077 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3078 var snapshot bytes.Buffer 3079 io.Copy(&snapshot, ringBuffer) 3080 err = &smithy.DeserializationError{ 3081 Err: fmt.Errorf("failed to decode response body, %w", err), 3082 Snapshot: snapshot.Bytes(), 3083 } 3084 return out, metadata, err 3085 } 3086 3087 err = awsAwsjson11_deserializeOpDocumentGetParametersForImportOutput(&output, shape) 3088 if err != nil { 3089 var snapshot bytes.Buffer 3090 io.Copy(&snapshot, ringBuffer) 3091 err = &smithy.DeserializationError{ 3092 Err: fmt.Errorf("failed to decode response body, %w", err), 3093 Snapshot: snapshot.Bytes(), 3094 } 3095 return out, metadata, err 3096 } 3097 3098 return out, metadata, err 3099} 3100 3101func awsAwsjson11_deserializeOpErrorGetParametersForImport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3102 var errorBuffer bytes.Buffer 3103 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3104 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3105 } 3106 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3107 3108 errorCode := "UnknownError" 3109 errorMessage := errorCode 3110 3111 code := response.Header.Get("X-Amzn-ErrorType") 3112 if len(code) != 0 { 3113 errorCode = restjson.SanitizeErrorCode(code) 3114 } 3115 3116 var buff [1024]byte 3117 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3118 3119 body := io.TeeReader(errorBody, ringBuffer) 3120 decoder := json.NewDecoder(body) 3121 decoder.UseNumber() 3122 code, message, err := restjson.GetErrorInfo(decoder) 3123 if err != nil { 3124 var snapshot bytes.Buffer 3125 io.Copy(&snapshot, ringBuffer) 3126 err = &smithy.DeserializationError{ 3127 Err: fmt.Errorf("failed to decode response body, %w", err), 3128 Snapshot: snapshot.Bytes(), 3129 } 3130 return err 3131 } 3132 3133 errorBody.Seek(0, io.SeekStart) 3134 if len(code) != 0 { 3135 errorCode = restjson.SanitizeErrorCode(code) 3136 } 3137 if len(message) != 0 { 3138 errorMessage = message 3139 } 3140 3141 switch { 3142 case strings.EqualFold("DependencyTimeoutException", errorCode): 3143 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3144 3145 case strings.EqualFold("InvalidArnException", errorCode): 3146 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3147 3148 case strings.EqualFold("KMSInternalException", errorCode): 3149 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3150 3151 case strings.EqualFold("KMSInvalidStateException", errorCode): 3152 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3153 3154 case strings.EqualFold("NotFoundException", errorCode): 3155 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3156 3157 case strings.EqualFold("UnsupportedOperationException", errorCode): 3158 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3159 3160 default: 3161 genericError := &smithy.GenericAPIError{ 3162 Code: errorCode, 3163 Message: errorMessage, 3164 } 3165 return genericError 3166 3167 } 3168} 3169 3170type awsAwsjson11_deserializeOpGetPublicKey struct { 3171} 3172 3173func (*awsAwsjson11_deserializeOpGetPublicKey) ID() string { 3174 return "OperationDeserializer" 3175} 3176 3177func (m *awsAwsjson11_deserializeOpGetPublicKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3178 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3179) { 3180 out, metadata, err = next.HandleDeserialize(ctx, in) 3181 if err != nil { 3182 return out, metadata, err 3183 } 3184 3185 response, ok := out.RawResponse.(*smithyhttp.Response) 3186 if !ok { 3187 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3188 } 3189 3190 if response.StatusCode < 200 || response.StatusCode >= 300 { 3191 return out, metadata, awsAwsjson11_deserializeOpErrorGetPublicKey(response, &metadata) 3192 } 3193 output := &GetPublicKeyOutput{} 3194 out.Result = output 3195 3196 var buff [1024]byte 3197 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3198 3199 body := io.TeeReader(response.Body, ringBuffer) 3200 decoder := json.NewDecoder(body) 3201 decoder.UseNumber() 3202 var shape interface{} 3203 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3204 var snapshot bytes.Buffer 3205 io.Copy(&snapshot, ringBuffer) 3206 err = &smithy.DeserializationError{ 3207 Err: fmt.Errorf("failed to decode response body, %w", err), 3208 Snapshot: snapshot.Bytes(), 3209 } 3210 return out, metadata, err 3211 } 3212 3213 err = awsAwsjson11_deserializeOpDocumentGetPublicKeyOutput(&output, shape) 3214 if err != nil { 3215 var snapshot bytes.Buffer 3216 io.Copy(&snapshot, ringBuffer) 3217 err = &smithy.DeserializationError{ 3218 Err: fmt.Errorf("failed to decode response body, %w", err), 3219 Snapshot: snapshot.Bytes(), 3220 } 3221 return out, metadata, err 3222 } 3223 3224 return out, metadata, err 3225} 3226 3227func awsAwsjson11_deserializeOpErrorGetPublicKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3228 var errorBuffer bytes.Buffer 3229 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3230 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3231 } 3232 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3233 3234 errorCode := "UnknownError" 3235 errorMessage := errorCode 3236 3237 code := response.Header.Get("X-Amzn-ErrorType") 3238 if len(code) != 0 { 3239 errorCode = restjson.SanitizeErrorCode(code) 3240 } 3241 3242 var buff [1024]byte 3243 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3244 3245 body := io.TeeReader(errorBody, ringBuffer) 3246 decoder := json.NewDecoder(body) 3247 decoder.UseNumber() 3248 code, message, err := restjson.GetErrorInfo(decoder) 3249 if err != nil { 3250 var snapshot bytes.Buffer 3251 io.Copy(&snapshot, ringBuffer) 3252 err = &smithy.DeserializationError{ 3253 Err: fmt.Errorf("failed to decode response body, %w", err), 3254 Snapshot: snapshot.Bytes(), 3255 } 3256 return err 3257 } 3258 3259 errorBody.Seek(0, io.SeekStart) 3260 if len(code) != 0 { 3261 errorCode = restjson.SanitizeErrorCode(code) 3262 } 3263 if len(message) != 0 { 3264 errorMessage = message 3265 } 3266 3267 switch { 3268 case strings.EqualFold("DependencyTimeoutException", errorCode): 3269 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3270 3271 case strings.EqualFold("DisabledException", errorCode): 3272 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 3273 3274 case strings.EqualFold("InvalidArnException", errorCode): 3275 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3276 3277 case strings.EqualFold("InvalidGrantTokenException", errorCode): 3278 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 3279 3280 case strings.EqualFold("InvalidKeyUsageException", errorCode): 3281 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 3282 3283 case strings.EqualFold("KMSInternalException", errorCode): 3284 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3285 3286 case strings.EqualFold("KMSInvalidStateException", errorCode): 3287 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3288 3289 case strings.EqualFold("KeyUnavailableException", errorCode): 3290 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 3291 3292 case strings.EqualFold("NotFoundException", errorCode): 3293 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3294 3295 case strings.EqualFold("UnsupportedOperationException", errorCode): 3296 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3297 3298 default: 3299 genericError := &smithy.GenericAPIError{ 3300 Code: errorCode, 3301 Message: errorMessage, 3302 } 3303 return genericError 3304 3305 } 3306} 3307 3308type awsAwsjson11_deserializeOpImportKeyMaterial struct { 3309} 3310 3311func (*awsAwsjson11_deserializeOpImportKeyMaterial) ID() string { 3312 return "OperationDeserializer" 3313} 3314 3315func (m *awsAwsjson11_deserializeOpImportKeyMaterial) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3316 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3317) { 3318 out, metadata, err = next.HandleDeserialize(ctx, in) 3319 if err != nil { 3320 return out, metadata, err 3321 } 3322 3323 response, ok := out.RawResponse.(*smithyhttp.Response) 3324 if !ok { 3325 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3326 } 3327 3328 if response.StatusCode < 200 || response.StatusCode >= 300 { 3329 return out, metadata, awsAwsjson11_deserializeOpErrorImportKeyMaterial(response, &metadata) 3330 } 3331 output := &ImportKeyMaterialOutput{} 3332 out.Result = output 3333 3334 var buff [1024]byte 3335 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3336 3337 body := io.TeeReader(response.Body, ringBuffer) 3338 decoder := json.NewDecoder(body) 3339 decoder.UseNumber() 3340 var shape interface{} 3341 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3342 var snapshot bytes.Buffer 3343 io.Copy(&snapshot, ringBuffer) 3344 err = &smithy.DeserializationError{ 3345 Err: fmt.Errorf("failed to decode response body, %w", err), 3346 Snapshot: snapshot.Bytes(), 3347 } 3348 return out, metadata, err 3349 } 3350 3351 err = awsAwsjson11_deserializeOpDocumentImportKeyMaterialOutput(&output, shape) 3352 if err != nil { 3353 var snapshot bytes.Buffer 3354 io.Copy(&snapshot, ringBuffer) 3355 err = &smithy.DeserializationError{ 3356 Err: fmt.Errorf("failed to decode response body, %w", err), 3357 Snapshot: snapshot.Bytes(), 3358 } 3359 return out, metadata, err 3360 } 3361 3362 return out, metadata, err 3363} 3364 3365func awsAwsjson11_deserializeOpErrorImportKeyMaterial(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3366 var errorBuffer bytes.Buffer 3367 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3368 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3369 } 3370 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3371 3372 errorCode := "UnknownError" 3373 errorMessage := errorCode 3374 3375 code := response.Header.Get("X-Amzn-ErrorType") 3376 if len(code) != 0 { 3377 errorCode = restjson.SanitizeErrorCode(code) 3378 } 3379 3380 var buff [1024]byte 3381 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3382 3383 body := io.TeeReader(errorBody, ringBuffer) 3384 decoder := json.NewDecoder(body) 3385 decoder.UseNumber() 3386 code, message, err := restjson.GetErrorInfo(decoder) 3387 if err != nil { 3388 var snapshot bytes.Buffer 3389 io.Copy(&snapshot, ringBuffer) 3390 err = &smithy.DeserializationError{ 3391 Err: fmt.Errorf("failed to decode response body, %w", err), 3392 Snapshot: snapshot.Bytes(), 3393 } 3394 return err 3395 } 3396 3397 errorBody.Seek(0, io.SeekStart) 3398 if len(code) != 0 { 3399 errorCode = restjson.SanitizeErrorCode(code) 3400 } 3401 if len(message) != 0 { 3402 errorMessage = message 3403 } 3404 3405 switch { 3406 case strings.EqualFold("DependencyTimeoutException", errorCode): 3407 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3408 3409 case strings.EqualFold("ExpiredImportTokenException", errorCode): 3410 return awsAwsjson11_deserializeErrorExpiredImportTokenException(response, errorBody) 3411 3412 case strings.EqualFold("IncorrectKeyMaterialException", errorCode): 3413 return awsAwsjson11_deserializeErrorIncorrectKeyMaterialException(response, errorBody) 3414 3415 case strings.EqualFold("InvalidArnException", errorCode): 3416 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3417 3418 case strings.EqualFold("InvalidCiphertextException", errorCode): 3419 return awsAwsjson11_deserializeErrorInvalidCiphertextException(response, errorBody) 3420 3421 case strings.EqualFold("InvalidImportTokenException", errorCode): 3422 return awsAwsjson11_deserializeErrorInvalidImportTokenException(response, errorBody) 3423 3424 case strings.EqualFold("KMSInternalException", errorCode): 3425 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3426 3427 case strings.EqualFold("KMSInvalidStateException", errorCode): 3428 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3429 3430 case strings.EqualFold("NotFoundException", errorCode): 3431 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3432 3433 case strings.EqualFold("UnsupportedOperationException", errorCode): 3434 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3435 3436 default: 3437 genericError := &smithy.GenericAPIError{ 3438 Code: errorCode, 3439 Message: errorMessage, 3440 } 3441 return genericError 3442 3443 } 3444} 3445 3446type awsAwsjson11_deserializeOpListAliases struct { 3447} 3448 3449func (*awsAwsjson11_deserializeOpListAliases) ID() string { 3450 return "OperationDeserializer" 3451} 3452 3453func (m *awsAwsjson11_deserializeOpListAliases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3454 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3455) { 3456 out, metadata, err = next.HandleDeserialize(ctx, in) 3457 if err != nil { 3458 return out, metadata, err 3459 } 3460 3461 response, ok := out.RawResponse.(*smithyhttp.Response) 3462 if !ok { 3463 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3464 } 3465 3466 if response.StatusCode < 200 || response.StatusCode >= 300 { 3467 return out, metadata, awsAwsjson11_deserializeOpErrorListAliases(response, &metadata) 3468 } 3469 output := &ListAliasesOutput{} 3470 out.Result = output 3471 3472 var buff [1024]byte 3473 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3474 3475 body := io.TeeReader(response.Body, ringBuffer) 3476 decoder := json.NewDecoder(body) 3477 decoder.UseNumber() 3478 var shape interface{} 3479 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3480 var snapshot bytes.Buffer 3481 io.Copy(&snapshot, ringBuffer) 3482 err = &smithy.DeserializationError{ 3483 Err: fmt.Errorf("failed to decode response body, %w", err), 3484 Snapshot: snapshot.Bytes(), 3485 } 3486 return out, metadata, err 3487 } 3488 3489 err = awsAwsjson11_deserializeOpDocumentListAliasesOutput(&output, shape) 3490 if err != nil { 3491 var snapshot bytes.Buffer 3492 io.Copy(&snapshot, ringBuffer) 3493 err = &smithy.DeserializationError{ 3494 Err: fmt.Errorf("failed to decode response body, %w", err), 3495 Snapshot: snapshot.Bytes(), 3496 } 3497 return out, metadata, err 3498 } 3499 3500 return out, metadata, err 3501} 3502 3503func awsAwsjson11_deserializeOpErrorListAliases(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3504 var errorBuffer bytes.Buffer 3505 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3506 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3507 } 3508 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3509 3510 errorCode := "UnknownError" 3511 errorMessage := errorCode 3512 3513 code := response.Header.Get("X-Amzn-ErrorType") 3514 if len(code) != 0 { 3515 errorCode = restjson.SanitizeErrorCode(code) 3516 } 3517 3518 var buff [1024]byte 3519 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3520 3521 body := io.TeeReader(errorBody, ringBuffer) 3522 decoder := json.NewDecoder(body) 3523 decoder.UseNumber() 3524 code, message, err := restjson.GetErrorInfo(decoder) 3525 if err != nil { 3526 var snapshot bytes.Buffer 3527 io.Copy(&snapshot, ringBuffer) 3528 err = &smithy.DeserializationError{ 3529 Err: fmt.Errorf("failed to decode response body, %w", err), 3530 Snapshot: snapshot.Bytes(), 3531 } 3532 return err 3533 } 3534 3535 errorBody.Seek(0, io.SeekStart) 3536 if len(code) != 0 { 3537 errorCode = restjson.SanitizeErrorCode(code) 3538 } 3539 if len(message) != 0 { 3540 errorMessage = message 3541 } 3542 3543 switch { 3544 case strings.EqualFold("DependencyTimeoutException", errorCode): 3545 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3546 3547 case strings.EqualFold("InvalidArnException", errorCode): 3548 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3549 3550 case strings.EqualFold("InvalidMarkerException", errorCode): 3551 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 3552 3553 case strings.EqualFold("KMSInternalException", errorCode): 3554 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3555 3556 case strings.EqualFold("NotFoundException", errorCode): 3557 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3558 3559 default: 3560 genericError := &smithy.GenericAPIError{ 3561 Code: errorCode, 3562 Message: errorMessage, 3563 } 3564 return genericError 3565 3566 } 3567} 3568 3569type awsAwsjson11_deserializeOpListGrants struct { 3570} 3571 3572func (*awsAwsjson11_deserializeOpListGrants) ID() string { 3573 return "OperationDeserializer" 3574} 3575 3576func (m *awsAwsjson11_deserializeOpListGrants) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3577 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3578) { 3579 out, metadata, err = next.HandleDeserialize(ctx, in) 3580 if err != nil { 3581 return out, metadata, err 3582 } 3583 3584 response, ok := out.RawResponse.(*smithyhttp.Response) 3585 if !ok { 3586 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3587 } 3588 3589 if response.StatusCode < 200 || response.StatusCode >= 300 { 3590 return out, metadata, awsAwsjson11_deserializeOpErrorListGrants(response, &metadata) 3591 } 3592 output := &ListGrantsOutput{} 3593 out.Result = output 3594 3595 var buff [1024]byte 3596 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3597 3598 body := io.TeeReader(response.Body, ringBuffer) 3599 decoder := json.NewDecoder(body) 3600 decoder.UseNumber() 3601 var shape interface{} 3602 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3603 var snapshot bytes.Buffer 3604 io.Copy(&snapshot, ringBuffer) 3605 err = &smithy.DeserializationError{ 3606 Err: fmt.Errorf("failed to decode response body, %w", err), 3607 Snapshot: snapshot.Bytes(), 3608 } 3609 return out, metadata, err 3610 } 3611 3612 err = awsAwsjson11_deserializeOpDocumentListGrantsOutput(&output, shape) 3613 if err != nil { 3614 var snapshot bytes.Buffer 3615 io.Copy(&snapshot, ringBuffer) 3616 err = &smithy.DeserializationError{ 3617 Err: fmt.Errorf("failed to decode response body, %w", err), 3618 Snapshot: snapshot.Bytes(), 3619 } 3620 return out, metadata, err 3621 } 3622 3623 return out, metadata, err 3624} 3625 3626func awsAwsjson11_deserializeOpErrorListGrants(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3627 var errorBuffer bytes.Buffer 3628 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3629 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3630 } 3631 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3632 3633 errorCode := "UnknownError" 3634 errorMessage := errorCode 3635 3636 code := response.Header.Get("X-Amzn-ErrorType") 3637 if len(code) != 0 { 3638 errorCode = restjson.SanitizeErrorCode(code) 3639 } 3640 3641 var buff [1024]byte 3642 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3643 3644 body := io.TeeReader(errorBody, ringBuffer) 3645 decoder := json.NewDecoder(body) 3646 decoder.UseNumber() 3647 code, message, err := restjson.GetErrorInfo(decoder) 3648 if err != nil { 3649 var snapshot bytes.Buffer 3650 io.Copy(&snapshot, ringBuffer) 3651 err = &smithy.DeserializationError{ 3652 Err: fmt.Errorf("failed to decode response body, %w", err), 3653 Snapshot: snapshot.Bytes(), 3654 } 3655 return err 3656 } 3657 3658 errorBody.Seek(0, io.SeekStart) 3659 if len(code) != 0 { 3660 errorCode = restjson.SanitizeErrorCode(code) 3661 } 3662 if len(message) != 0 { 3663 errorMessage = message 3664 } 3665 3666 switch { 3667 case strings.EqualFold("DependencyTimeoutException", errorCode): 3668 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3669 3670 case strings.EqualFold("InvalidArnException", errorCode): 3671 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3672 3673 case strings.EqualFold("InvalidGrantIdException", errorCode): 3674 return awsAwsjson11_deserializeErrorInvalidGrantIdException(response, errorBody) 3675 3676 case strings.EqualFold("InvalidMarkerException", errorCode): 3677 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 3678 3679 case strings.EqualFold("KMSInternalException", errorCode): 3680 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3681 3682 case strings.EqualFold("KMSInvalidStateException", errorCode): 3683 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3684 3685 case strings.EqualFold("NotFoundException", errorCode): 3686 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3687 3688 default: 3689 genericError := &smithy.GenericAPIError{ 3690 Code: errorCode, 3691 Message: errorMessage, 3692 } 3693 return genericError 3694 3695 } 3696} 3697 3698type awsAwsjson11_deserializeOpListKeyPolicies struct { 3699} 3700 3701func (*awsAwsjson11_deserializeOpListKeyPolicies) ID() string { 3702 return "OperationDeserializer" 3703} 3704 3705func (m *awsAwsjson11_deserializeOpListKeyPolicies) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3706 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3707) { 3708 out, metadata, err = next.HandleDeserialize(ctx, in) 3709 if err != nil { 3710 return out, metadata, err 3711 } 3712 3713 response, ok := out.RawResponse.(*smithyhttp.Response) 3714 if !ok { 3715 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3716 } 3717 3718 if response.StatusCode < 200 || response.StatusCode >= 300 { 3719 return out, metadata, awsAwsjson11_deserializeOpErrorListKeyPolicies(response, &metadata) 3720 } 3721 output := &ListKeyPoliciesOutput{} 3722 out.Result = output 3723 3724 var buff [1024]byte 3725 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3726 3727 body := io.TeeReader(response.Body, ringBuffer) 3728 decoder := json.NewDecoder(body) 3729 decoder.UseNumber() 3730 var shape interface{} 3731 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3732 var snapshot bytes.Buffer 3733 io.Copy(&snapshot, ringBuffer) 3734 err = &smithy.DeserializationError{ 3735 Err: fmt.Errorf("failed to decode response body, %w", err), 3736 Snapshot: snapshot.Bytes(), 3737 } 3738 return out, metadata, err 3739 } 3740 3741 err = awsAwsjson11_deserializeOpDocumentListKeyPoliciesOutput(&output, shape) 3742 if err != nil { 3743 var snapshot bytes.Buffer 3744 io.Copy(&snapshot, ringBuffer) 3745 err = &smithy.DeserializationError{ 3746 Err: fmt.Errorf("failed to decode response body, %w", err), 3747 Snapshot: snapshot.Bytes(), 3748 } 3749 return out, metadata, err 3750 } 3751 3752 return out, metadata, err 3753} 3754 3755func awsAwsjson11_deserializeOpErrorListKeyPolicies(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3756 var errorBuffer bytes.Buffer 3757 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3758 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3759 } 3760 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3761 3762 errorCode := "UnknownError" 3763 errorMessage := errorCode 3764 3765 code := response.Header.Get("X-Amzn-ErrorType") 3766 if len(code) != 0 { 3767 errorCode = restjson.SanitizeErrorCode(code) 3768 } 3769 3770 var buff [1024]byte 3771 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3772 3773 body := io.TeeReader(errorBody, ringBuffer) 3774 decoder := json.NewDecoder(body) 3775 decoder.UseNumber() 3776 code, message, err := restjson.GetErrorInfo(decoder) 3777 if err != nil { 3778 var snapshot bytes.Buffer 3779 io.Copy(&snapshot, ringBuffer) 3780 err = &smithy.DeserializationError{ 3781 Err: fmt.Errorf("failed to decode response body, %w", err), 3782 Snapshot: snapshot.Bytes(), 3783 } 3784 return err 3785 } 3786 3787 errorBody.Seek(0, io.SeekStart) 3788 if len(code) != 0 { 3789 errorCode = restjson.SanitizeErrorCode(code) 3790 } 3791 if len(message) != 0 { 3792 errorMessage = message 3793 } 3794 3795 switch { 3796 case strings.EqualFold("DependencyTimeoutException", errorCode): 3797 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3798 3799 case strings.EqualFold("InvalidArnException", errorCode): 3800 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3801 3802 case strings.EqualFold("KMSInternalException", errorCode): 3803 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3804 3805 case strings.EqualFold("KMSInvalidStateException", errorCode): 3806 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3807 3808 case strings.EqualFold("NotFoundException", errorCode): 3809 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3810 3811 default: 3812 genericError := &smithy.GenericAPIError{ 3813 Code: errorCode, 3814 Message: errorMessage, 3815 } 3816 return genericError 3817 3818 } 3819} 3820 3821type awsAwsjson11_deserializeOpListKeys struct { 3822} 3823 3824func (*awsAwsjson11_deserializeOpListKeys) ID() string { 3825 return "OperationDeserializer" 3826} 3827 3828func (m *awsAwsjson11_deserializeOpListKeys) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3829 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3830) { 3831 out, metadata, err = next.HandleDeserialize(ctx, in) 3832 if err != nil { 3833 return out, metadata, err 3834 } 3835 3836 response, ok := out.RawResponse.(*smithyhttp.Response) 3837 if !ok { 3838 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3839 } 3840 3841 if response.StatusCode < 200 || response.StatusCode >= 300 { 3842 return out, metadata, awsAwsjson11_deserializeOpErrorListKeys(response, &metadata) 3843 } 3844 output := &ListKeysOutput{} 3845 out.Result = output 3846 3847 var buff [1024]byte 3848 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3849 3850 body := io.TeeReader(response.Body, ringBuffer) 3851 decoder := json.NewDecoder(body) 3852 decoder.UseNumber() 3853 var shape interface{} 3854 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3855 var snapshot bytes.Buffer 3856 io.Copy(&snapshot, ringBuffer) 3857 err = &smithy.DeserializationError{ 3858 Err: fmt.Errorf("failed to decode response body, %w", err), 3859 Snapshot: snapshot.Bytes(), 3860 } 3861 return out, metadata, err 3862 } 3863 3864 err = awsAwsjson11_deserializeOpDocumentListKeysOutput(&output, shape) 3865 if err != nil { 3866 var snapshot bytes.Buffer 3867 io.Copy(&snapshot, ringBuffer) 3868 err = &smithy.DeserializationError{ 3869 Err: fmt.Errorf("failed to decode response body, %w", err), 3870 Snapshot: snapshot.Bytes(), 3871 } 3872 return out, metadata, err 3873 } 3874 3875 return out, metadata, err 3876} 3877 3878func awsAwsjson11_deserializeOpErrorListKeys(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3879 var errorBuffer bytes.Buffer 3880 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3881 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3882 } 3883 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3884 3885 errorCode := "UnknownError" 3886 errorMessage := errorCode 3887 3888 code := response.Header.Get("X-Amzn-ErrorType") 3889 if len(code) != 0 { 3890 errorCode = restjson.SanitizeErrorCode(code) 3891 } 3892 3893 var buff [1024]byte 3894 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3895 3896 body := io.TeeReader(errorBody, ringBuffer) 3897 decoder := json.NewDecoder(body) 3898 decoder.UseNumber() 3899 code, message, err := restjson.GetErrorInfo(decoder) 3900 if err != nil { 3901 var snapshot bytes.Buffer 3902 io.Copy(&snapshot, ringBuffer) 3903 err = &smithy.DeserializationError{ 3904 Err: fmt.Errorf("failed to decode response body, %w", err), 3905 Snapshot: snapshot.Bytes(), 3906 } 3907 return err 3908 } 3909 3910 errorBody.Seek(0, io.SeekStart) 3911 if len(code) != 0 { 3912 errorCode = restjson.SanitizeErrorCode(code) 3913 } 3914 if len(message) != 0 { 3915 errorMessage = message 3916 } 3917 3918 switch { 3919 case strings.EqualFold("DependencyTimeoutException", errorCode): 3920 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3921 3922 case strings.EqualFold("InvalidMarkerException", errorCode): 3923 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 3924 3925 case strings.EqualFold("KMSInternalException", errorCode): 3926 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3927 3928 default: 3929 genericError := &smithy.GenericAPIError{ 3930 Code: errorCode, 3931 Message: errorMessage, 3932 } 3933 return genericError 3934 3935 } 3936} 3937 3938type awsAwsjson11_deserializeOpListResourceTags struct { 3939} 3940 3941func (*awsAwsjson11_deserializeOpListResourceTags) ID() string { 3942 return "OperationDeserializer" 3943} 3944 3945func (m *awsAwsjson11_deserializeOpListResourceTags) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3946 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3947) { 3948 out, metadata, err = next.HandleDeserialize(ctx, in) 3949 if err != nil { 3950 return out, metadata, err 3951 } 3952 3953 response, ok := out.RawResponse.(*smithyhttp.Response) 3954 if !ok { 3955 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3956 } 3957 3958 if response.StatusCode < 200 || response.StatusCode >= 300 { 3959 return out, metadata, awsAwsjson11_deserializeOpErrorListResourceTags(response, &metadata) 3960 } 3961 output := &ListResourceTagsOutput{} 3962 out.Result = output 3963 3964 var buff [1024]byte 3965 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3966 3967 body := io.TeeReader(response.Body, ringBuffer) 3968 decoder := json.NewDecoder(body) 3969 decoder.UseNumber() 3970 var shape interface{} 3971 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3972 var snapshot bytes.Buffer 3973 io.Copy(&snapshot, ringBuffer) 3974 err = &smithy.DeserializationError{ 3975 Err: fmt.Errorf("failed to decode response body, %w", err), 3976 Snapshot: snapshot.Bytes(), 3977 } 3978 return out, metadata, err 3979 } 3980 3981 err = awsAwsjson11_deserializeOpDocumentListResourceTagsOutput(&output, shape) 3982 if err != nil { 3983 var snapshot bytes.Buffer 3984 io.Copy(&snapshot, ringBuffer) 3985 err = &smithy.DeserializationError{ 3986 Err: fmt.Errorf("failed to decode response body, %w", err), 3987 Snapshot: snapshot.Bytes(), 3988 } 3989 return out, metadata, err 3990 } 3991 3992 return out, metadata, err 3993} 3994 3995func awsAwsjson11_deserializeOpErrorListResourceTags(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3996 var errorBuffer bytes.Buffer 3997 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3998 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3999 } 4000 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4001 4002 errorCode := "UnknownError" 4003 errorMessage := errorCode 4004 4005 code := response.Header.Get("X-Amzn-ErrorType") 4006 if len(code) != 0 { 4007 errorCode = restjson.SanitizeErrorCode(code) 4008 } 4009 4010 var buff [1024]byte 4011 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4012 4013 body := io.TeeReader(errorBody, ringBuffer) 4014 decoder := json.NewDecoder(body) 4015 decoder.UseNumber() 4016 code, message, err := restjson.GetErrorInfo(decoder) 4017 if err != nil { 4018 var snapshot bytes.Buffer 4019 io.Copy(&snapshot, ringBuffer) 4020 err = &smithy.DeserializationError{ 4021 Err: fmt.Errorf("failed to decode response body, %w", err), 4022 Snapshot: snapshot.Bytes(), 4023 } 4024 return err 4025 } 4026 4027 errorBody.Seek(0, io.SeekStart) 4028 if len(code) != 0 { 4029 errorCode = restjson.SanitizeErrorCode(code) 4030 } 4031 if len(message) != 0 { 4032 errorMessage = message 4033 } 4034 4035 switch { 4036 case strings.EqualFold("InvalidArnException", errorCode): 4037 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4038 4039 case strings.EqualFold("InvalidMarkerException", errorCode): 4040 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 4041 4042 case strings.EqualFold("KMSInternalException", errorCode): 4043 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4044 4045 case strings.EqualFold("NotFoundException", errorCode): 4046 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4047 4048 default: 4049 genericError := &smithy.GenericAPIError{ 4050 Code: errorCode, 4051 Message: errorMessage, 4052 } 4053 return genericError 4054 4055 } 4056} 4057 4058type awsAwsjson11_deserializeOpListRetirableGrants struct { 4059} 4060 4061func (*awsAwsjson11_deserializeOpListRetirableGrants) ID() string { 4062 return "OperationDeserializer" 4063} 4064 4065func (m *awsAwsjson11_deserializeOpListRetirableGrants) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4066 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4067) { 4068 out, metadata, err = next.HandleDeserialize(ctx, in) 4069 if err != nil { 4070 return out, metadata, err 4071 } 4072 4073 response, ok := out.RawResponse.(*smithyhttp.Response) 4074 if !ok { 4075 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4076 } 4077 4078 if response.StatusCode < 200 || response.StatusCode >= 300 { 4079 return out, metadata, awsAwsjson11_deserializeOpErrorListRetirableGrants(response, &metadata) 4080 } 4081 output := &ListRetirableGrantsOutput{} 4082 out.Result = output 4083 4084 var buff [1024]byte 4085 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4086 4087 body := io.TeeReader(response.Body, ringBuffer) 4088 decoder := json.NewDecoder(body) 4089 decoder.UseNumber() 4090 var shape interface{} 4091 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4092 var snapshot bytes.Buffer 4093 io.Copy(&snapshot, ringBuffer) 4094 err = &smithy.DeserializationError{ 4095 Err: fmt.Errorf("failed to decode response body, %w", err), 4096 Snapshot: snapshot.Bytes(), 4097 } 4098 return out, metadata, err 4099 } 4100 4101 err = awsAwsjson11_deserializeOpDocumentListRetirableGrantsOutput(&output, shape) 4102 if err != nil { 4103 var snapshot bytes.Buffer 4104 io.Copy(&snapshot, ringBuffer) 4105 err = &smithy.DeserializationError{ 4106 Err: fmt.Errorf("failed to decode response body, %w", err), 4107 Snapshot: snapshot.Bytes(), 4108 } 4109 return out, metadata, err 4110 } 4111 4112 return out, metadata, err 4113} 4114 4115func awsAwsjson11_deserializeOpErrorListRetirableGrants(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4116 var errorBuffer bytes.Buffer 4117 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4118 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4119 } 4120 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4121 4122 errorCode := "UnknownError" 4123 errorMessage := errorCode 4124 4125 code := response.Header.Get("X-Amzn-ErrorType") 4126 if len(code) != 0 { 4127 errorCode = restjson.SanitizeErrorCode(code) 4128 } 4129 4130 var buff [1024]byte 4131 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4132 4133 body := io.TeeReader(errorBody, ringBuffer) 4134 decoder := json.NewDecoder(body) 4135 decoder.UseNumber() 4136 code, message, err := restjson.GetErrorInfo(decoder) 4137 if err != nil { 4138 var snapshot bytes.Buffer 4139 io.Copy(&snapshot, ringBuffer) 4140 err = &smithy.DeserializationError{ 4141 Err: fmt.Errorf("failed to decode response body, %w", err), 4142 Snapshot: snapshot.Bytes(), 4143 } 4144 return err 4145 } 4146 4147 errorBody.Seek(0, io.SeekStart) 4148 if len(code) != 0 { 4149 errorCode = restjson.SanitizeErrorCode(code) 4150 } 4151 if len(message) != 0 { 4152 errorMessage = message 4153 } 4154 4155 switch { 4156 case strings.EqualFold("DependencyTimeoutException", errorCode): 4157 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4158 4159 case strings.EqualFold("InvalidArnException", errorCode): 4160 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4161 4162 case strings.EqualFold("InvalidMarkerException", errorCode): 4163 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 4164 4165 case strings.EqualFold("KMSInternalException", errorCode): 4166 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4167 4168 case strings.EqualFold("NotFoundException", errorCode): 4169 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4170 4171 default: 4172 genericError := &smithy.GenericAPIError{ 4173 Code: errorCode, 4174 Message: errorMessage, 4175 } 4176 return genericError 4177 4178 } 4179} 4180 4181type awsAwsjson11_deserializeOpPutKeyPolicy struct { 4182} 4183 4184func (*awsAwsjson11_deserializeOpPutKeyPolicy) ID() string { 4185 return "OperationDeserializer" 4186} 4187 4188func (m *awsAwsjson11_deserializeOpPutKeyPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4189 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4190) { 4191 out, metadata, err = next.HandleDeserialize(ctx, in) 4192 if err != nil { 4193 return out, metadata, err 4194 } 4195 4196 response, ok := out.RawResponse.(*smithyhttp.Response) 4197 if !ok { 4198 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4199 } 4200 4201 if response.StatusCode < 200 || response.StatusCode >= 300 { 4202 return out, metadata, awsAwsjson11_deserializeOpErrorPutKeyPolicy(response, &metadata) 4203 } 4204 output := &PutKeyPolicyOutput{} 4205 out.Result = output 4206 4207 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4208 return out, metadata, &smithy.DeserializationError{ 4209 Err: fmt.Errorf("failed to discard response body, %w", err), 4210 } 4211 } 4212 4213 return out, metadata, err 4214} 4215 4216func awsAwsjson11_deserializeOpErrorPutKeyPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4217 var errorBuffer bytes.Buffer 4218 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4219 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4220 } 4221 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4222 4223 errorCode := "UnknownError" 4224 errorMessage := errorCode 4225 4226 code := response.Header.Get("X-Amzn-ErrorType") 4227 if len(code) != 0 { 4228 errorCode = restjson.SanitizeErrorCode(code) 4229 } 4230 4231 var buff [1024]byte 4232 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4233 4234 body := io.TeeReader(errorBody, ringBuffer) 4235 decoder := json.NewDecoder(body) 4236 decoder.UseNumber() 4237 code, message, err := restjson.GetErrorInfo(decoder) 4238 if err != nil { 4239 var snapshot bytes.Buffer 4240 io.Copy(&snapshot, ringBuffer) 4241 err = &smithy.DeserializationError{ 4242 Err: fmt.Errorf("failed to decode response body, %w", err), 4243 Snapshot: snapshot.Bytes(), 4244 } 4245 return err 4246 } 4247 4248 errorBody.Seek(0, io.SeekStart) 4249 if len(code) != 0 { 4250 errorCode = restjson.SanitizeErrorCode(code) 4251 } 4252 if len(message) != 0 { 4253 errorMessage = message 4254 } 4255 4256 switch { 4257 case strings.EqualFold("DependencyTimeoutException", errorCode): 4258 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4259 4260 case strings.EqualFold("InvalidArnException", errorCode): 4261 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4262 4263 case strings.EqualFold("KMSInternalException", errorCode): 4264 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4265 4266 case strings.EqualFold("KMSInvalidStateException", errorCode): 4267 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4268 4269 case strings.EqualFold("LimitExceededException", errorCode): 4270 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 4271 4272 case strings.EqualFold("MalformedPolicyDocumentException", errorCode): 4273 return awsAwsjson11_deserializeErrorMalformedPolicyDocumentException(response, errorBody) 4274 4275 case strings.EqualFold("NotFoundException", errorCode): 4276 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4277 4278 case strings.EqualFold("UnsupportedOperationException", errorCode): 4279 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 4280 4281 default: 4282 genericError := &smithy.GenericAPIError{ 4283 Code: errorCode, 4284 Message: errorMessage, 4285 } 4286 return genericError 4287 4288 } 4289} 4290 4291type awsAwsjson11_deserializeOpReEncrypt struct { 4292} 4293 4294func (*awsAwsjson11_deserializeOpReEncrypt) ID() string { 4295 return "OperationDeserializer" 4296} 4297 4298func (m *awsAwsjson11_deserializeOpReEncrypt) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4299 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4300) { 4301 out, metadata, err = next.HandleDeserialize(ctx, in) 4302 if err != nil { 4303 return out, metadata, err 4304 } 4305 4306 response, ok := out.RawResponse.(*smithyhttp.Response) 4307 if !ok { 4308 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4309 } 4310 4311 if response.StatusCode < 200 || response.StatusCode >= 300 { 4312 return out, metadata, awsAwsjson11_deserializeOpErrorReEncrypt(response, &metadata) 4313 } 4314 output := &ReEncryptOutput{} 4315 out.Result = output 4316 4317 var buff [1024]byte 4318 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4319 4320 body := io.TeeReader(response.Body, ringBuffer) 4321 decoder := json.NewDecoder(body) 4322 decoder.UseNumber() 4323 var shape interface{} 4324 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4325 var snapshot bytes.Buffer 4326 io.Copy(&snapshot, ringBuffer) 4327 err = &smithy.DeserializationError{ 4328 Err: fmt.Errorf("failed to decode response body, %w", err), 4329 Snapshot: snapshot.Bytes(), 4330 } 4331 return out, metadata, err 4332 } 4333 4334 err = awsAwsjson11_deserializeOpDocumentReEncryptOutput(&output, shape) 4335 if err != nil { 4336 var snapshot bytes.Buffer 4337 io.Copy(&snapshot, ringBuffer) 4338 err = &smithy.DeserializationError{ 4339 Err: fmt.Errorf("failed to decode response body, %w", err), 4340 Snapshot: snapshot.Bytes(), 4341 } 4342 return out, metadata, err 4343 } 4344 4345 return out, metadata, err 4346} 4347 4348func awsAwsjson11_deserializeOpErrorReEncrypt(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4349 var errorBuffer bytes.Buffer 4350 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4351 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4352 } 4353 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4354 4355 errorCode := "UnknownError" 4356 errorMessage := errorCode 4357 4358 code := response.Header.Get("X-Amzn-ErrorType") 4359 if len(code) != 0 { 4360 errorCode = restjson.SanitizeErrorCode(code) 4361 } 4362 4363 var buff [1024]byte 4364 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4365 4366 body := io.TeeReader(errorBody, ringBuffer) 4367 decoder := json.NewDecoder(body) 4368 decoder.UseNumber() 4369 code, message, err := restjson.GetErrorInfo(decoder) 4370 if err != nil { 4371 var snapshot bytes.Buffer 4372 io.Copy(&snapshot, ringBuffer) 4373 err = &smithy.DeserializationError{ 4374 Err: fmt.Errorf("failed to decode response body, %w", err), 4375 Snapshot: snapshot.Bytes(), 4376 } 4377 return err 4378 } 4379 4380 errorBody.Seek(0, io.SeekStart) 4381 if len(code) != 0 { 4382 errorCode = restjson.SanitizeErrorCode(code) 4383 } 4384 if len(message) != 0 { 4385 errorMessage = message 4386 } 4387 4388 switch { 4389 case strings.EqualFold("DependencyTimeoutException", errorCode): 4390 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4391 4392 case strings.EqualFold("DisabledException", errorCode): 4393 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 4394 4395 case strings.EqualFold("IncorrectKeyException", errorCode): 4396 return awsAwsjson11_deserializeErrorIncorrectKeyException(response, errorBody) 4397 4398 case strings.EqualFold("InvalidCiphertextException", errorCode): 4399 return awsAwsjson11_deserializeErrorInvalidCiphertextException(response, errorBody) 4400 4401 case strings.EqualFold("InvalidGrantTokenException", errorCode): 4402 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 4403 4404 case strings.EqualFold("InvalidKeyUsageException", errorCode): 4405 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 4406 4407 case strings.EqualFold("KMSInternalException", errorCode): 4408 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4409 4410 case strings.EqualFold("KMSInvalidStateException", errorCode): 4411 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4412 4413 case strings.EqualFold("KeyUnavailableException", errorCode): 4414 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 4415 4416 case strings.EqualFold("NotFoundException", errorCode): 4417 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4418 4419 default: 4420 genericError := &smithy.GenericAPIError{ 4421 Code: errorCode, 4422 Message: errorMessage, 4423 } 4424 return genericError 4425 4426 } 4427} 4428 4429type awsAwsjson11_deserializeOpReplicateKey struct { 4430} 4431 4432func (*awsAwsjson11_deserializeOpReplicateKey) ID() string { 4433 return "OperationDeserializer" 4434} 4435 4436func (m *awsAwsjson11_deserializeOpReplicateKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4437 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4438) { 4439 out, metadata, err = next.HandleDeserialize(ctx, in) 4440 if err != nil { 4441 return out, metadata, err 4442 } 4443 4444 response, ok := out.RawResponse.(*smithyhttp.Response) 4445 if !ok { 4446 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4447 } 4448 4449 if response.StatusCode < 200 || response.StatusCode >= 300 { 4450 return out, metadata, awsAwsjson11_deserializeOpErrorReplicateKey(response, &metadata) 4451 } 4452 output := &ReplicateKeyOutput{} 4453 out.Result = output 4454 4455 var buff [1024]byte 4456 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4457 4458 body := io.TeeReader(response.Body, ringBuffer) 4459 decoder := json.NewDecoder(body) 4460 decoder.UseNumber() 4461 var shape interface{} 4462 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4463 var snapshot bytes.Buffer 4464 io.Copy(&snapshot, ringBuffer) 4465 err = &smithy.DeserializationError{ 4466 Err: fmt.Errorf("failed to decode response body, %w", err), 4467 Snapshot: snapshot.Bytes(), 4468 } 4469 return out, metadata, err 4470 } 4471 4472 err = awsAwsjson11_deserializeOpDocumentReplicateKeyOutput(&output, shape) 4473 if err != nil { 4474 var snapshot bytes.Buffer 4475 io.Copy(&snapshot, ringBuffer) 4476 err = &smithy.DeserializationError{ 4477 Err: fmt.Errorf("failed to decode response body, %w", err), 4478 Snapshot: snapshot.Bytes(), 4479 } 4480 return out, metadata, err 4481 } 4482 4483 return out, metadata, err 4484} 4485 4486func awsAwsjson11_deserializeOpErrorReplicateKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4487 var errorBuffer bytes.Buffer 4488 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4489 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4490 } 4491 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4492 4493 errorCode := "UnknownError" 4494 errorMessage := errorCode 4495 4496 code := response.Header.Get("X-Amzn-ErrorType") 4497 if len(code) != 0 { 4498 errorCode = restjson.SanitizeErrorCode(code) 4499 } 4500 4501 var buff [1024]byte 4502 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4503 4504 body := io.TeeReader(errorBody, ringBuffer) 4505 decoder := json.NewDecoder(body) 4506 decoder.UseNumber() 4507 code, message, err := restjson.GetErrorInfo(decoder) 4508 if err != nil { 4509 var snapshot bytes.Buffer 4510 io.Copy(&snapshot, ringBuffer) 4511 err = &smithy.DeserializationError{ 4512 Err: fmt.Errorf("failed to decode response body, %w", err), 4513 Snapshot: snapshot.Bytes(), 4514 } 4515 return err 4516 } 4517 4518 errorBody.Seek(0, io.SeekStart) 4519 if len(code) != 0 { 4520 errorCode = restjson.SanitizeErrorCode(code) 4521 } 4522 if len(message) != 0 { 4523 errorMessage = message 4524 } 4525 4526 switch { 4527 case strings.EqualFold("AlreadyExistsException", errorCode): 4528 return awsAwsjson11_deserializeErrorAlreadyExistsException(response, errorBody) 4529 4530 case strings.EqualFold("DisabledException", errorCode): 4531 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 4532 4533 case strings.EqualFold("InvalidArnException", errorCode): 4534 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4535 4536 case strings.EqualFold("KMSInternalException", errorCode): 4537 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4538 4539 case strings.EqualFold("KMSInvalidStateException", errorCode): 4540 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4541 4542 case strings.EqualFold("LimitExceededException", errorCode): 4543 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 4544 4545 case strings.EqualFold("MalformedPolicyDocumentException", errorCode): 4546 return awsAwsjson11_deserializeErrorMalformedPolicyDocumentException(response, errorBody) 4547 4548 case strings.EqualFold("NotFoundException", errorCode): 4549 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4550 4551 case strings.EqualFold("TagException", errorCode): 4552 return awsAwsjson11_deserializeErrorTagException(response, errorBody) 4553 4554 case strings.EqualFold("UnsupportedOperationException", errorCode): 4555 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 4556 4557 default: 4558 genericError := &smithy.GenericAPIError{ 4559 Code: errorCode, 4560 Message: errorMessage, 4561 } 4562 return genericError 4563 4564 } 4565} 4566 4567type awsAwsjson11_deserializeOpRetireGrant struct { 4568} 4569 4570func (*awsAwsjson11_deserializeOpRetireGrant) ID() string { 4571 return "OperationDeserializer" 4572} 4573 4574func (m *awsAwsjson11_deserializeOpRetireGrant) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4575 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4576) { 4577 out, metadata, err = next.HandleDeserialize(ctx, in) 4578 if err != nil { 4579 return out, metadata, err 4580 } 4581 4582 response, ok := out.RawResponse.(*smithyhttp.Response) 4583 if !ok { 4584 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4585 } 4586 4587 if response.StatusCode < 200 || response.StatusCode >= 300 { 4588 return out, metadata, awsAwsjson11_deserializeOpErrorRetireGrant(response, &metadata) 4589 } 4590 output := &RetireGrantOutput{} 4591 out.Result = output 4592 4593 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4594 return out, metadata, &smithy.DeserializationError{ 4595 Err: fmt.Errorf("failed to discard response body, %w", err), 4596 } 4597 } 4598 4599 return out, metadata, err 4600} 4601 4602func awsAwsjson11_deserializeOpErrorRetireGrant(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4603 var errorBuffer bytes.Buffer 4604 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4605 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4606 } 4607 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4608 4609 errorCode := "UnknownError" 4610 errorMessage := errorCode 4611 4612 code := response.Header.Get("X-Amzn-ErrorType") 4613 if len(code) != 0 { 4614 errorCode = restjson.SanitizeErrorCode(code) 4615 } 4616 4617 var buff [1024]byte 4618 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4619 4620 body := io.TeeReader(errorBody, ringBuffer) 4621 decoder := json.NewDecoder(body) 4622 decoder.UseNumber() 4623 code, message, err := restjson.GetErrorInfo(decoder) 4624 if err != nil { 4625 var snapshot bytes.Buffer 4626 io.Copy(&snapshot, ringBuffer) 4627 err = &smithy.DeserializationError{ 4628 Err: fmt.Errorf("failed to decode response body, %w", err), 4629 Snapshot: snapshot.Bytes(), 4630 } 4631 return err 4632 } 4633 4634 errorBody.Seek(0, io.SeekStart) 4635 if len(code) != 0 { 4636 errorCode = restjson.SanitizeErrorCode(code) 4637 } 4638 if len(message) != 0 { 4639 errorMessage = message 4640 } 4641 4642 switch { 4643 case strings.EqualFold("DependencyTimeoutException", errorCode): 4644 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4645 4646 case strings.EqualFold("InvalidArnException", errorCode): 4647 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4648 4649 case strings.EqualFold("InvalidGrantIdException", errorCode): 4650 return awsAwsjson11_deserializeErrorInvalidGrantIdException(response, errorBody) 4651 4652 case strings.EqualFold("InvalidGrantTokenException", errorCode): 4653 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 4654 4655 case strings.EqualFold("KMSInternalException", errorCode): 4656 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4657 4658 case strings.EqualFold("KMSInvalidStateException", errorCode): 4659 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4660 4661 case strings.EqualFold("NotFoundException", errorCode): 4662 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4663 4664 default: 4665 genericError := &smithy.GenericAPIError{ 4666 Code: errorCode, 4667 Message: errorMessage, 4668 } 4669 return genericError 4670 4671 } 4672} 4673 4674type awsAwsjson11_deserializeOpRevokeGrant struct { 4675} 4676 4677func (*awsAwsjson11_deserializeOpRevokeGrant) ID() string { 4678 return "OperationDeserializer" 4679} 4680 4681func (m *awsAwsjson11_deserializeOpRevokeGrant) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4682 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4683) { 4684 out, metadata, err = next.HandleDeserialize(ctx, in) 4685 if err != nil { 4686 return out, metadata, err 4687 } 4688 4689 response, ok := out.RawResponse.(*smithyhttp.Response) 4690 if !ok { 4691 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4692 } 4693 4694 if response.StatusCode < 200 || response.StatusCode >= 300 { 4695 return out, metadata, awsAwsjson11_deserializeOpErrorRevokeGrant(response, &metadata) 4696 } 4697 output := &RevokeGrantOutput{} 4698 out.Result = output 4699 4700 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4701 return out, metadata, &smithy.DeserializationError{ 4702 Err: fmt.Errorf("failed to discard response body, %w", err), 4703 } 4704 } 4705 4706 return out, metadata, err 4707} 4708 4709func awsAwsjson11_deserializeOpErrorRevokeGrant(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4710 var errorBuffer bytes.Buffer 4711 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4712 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4713 } 4714 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4715 4716 errorCode := "UnknownError" 4717 errorMessage := errorCode 4718 4719 code := response.Header.Get("X-Amzn-ErrorType") 4720 if len(code) != 0 { 4721 errorCode = restjson.SanitizeErrorCode(code) 4722 } 4723 4724 var buff [1024]byte 4725 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4726 4727 body := io.TeeReader(errorBody, ringBuffer) 4728 decoder := json.NewDecoder(body) 4729 decoder.UseNumber() 4730 code, message, err := restjson.GetErrorInfo(decoder) 4731 if err != nil { 4732 var snapshot bytes.Buffer 4733 io.Copy(&snapshot, ringBuffer) 4734 err = &smithy.DeserializationError{ 4735 Err: fmt.Errorf("failed to decode response body, %w", err), 4736 Snapshot: snapshot.Bytes(), 4737 } 4738 return err 4739 } 4740 4741 errorBody.Seek(0, io.SeekStart) 4742 if len(code) != 0 { 4743 errorCode = restjson.SanitizeErrorCode(code) 4744 } 4745 if len(message) != 0 { 4746 errorMessage = message 4747 } 4748 4749 switch { 4750 case strings.EqualFold("DependencyTimeoutException", errorCode): 4751 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4752 4753 case strings.EqualFold("InvalidArnException", errorCode): 4754 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4755 4756 case strings.EqualFold("InvalidGrantIdException", errorCode): 4757 return awsAwsjson11_deserializeErrorInvalidGrantIdException(response, errorBody) 4758 4759 case strings.EqualFold("KMSInternalException", errorCode): 4760 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4761 4762 case strings.EqualFold("KMSInvalidStateException", errorCode): 4763 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4764 4765 case strings.EqualFold("NotFoundException", errorCode): 4766 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4767 4768 default: 4769 genericError := &smithy.GenericAPIError{ 4770 Code: errorCode, 4771 Message: errorMessage, 4772 } 4773 return genericError 4774 4775 } 4776} 4777 4778type awsAwsjson11_deserializeOpScheduleKeyDeletion struct { 4779} 4780 4781func (*awsAwsjson11_deserializeOpScheduleKeyDeletion) ID() string { 4782 return "OperationDeserializer" 4783} 4784 4785func (m *awsAwsjson11_deserializeOpScheduleKeyDeletion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4786 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4787) { 4788 out, metadata, err = next.HandleDeserialize(ctx, in) 4789 if err != nil { 4790 return out, metadata, err 4791 } 4792 4793 response, ok := out.RawResponse.(*smithyhttp.Response) 4794 if !ok { 4795 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4796 } 4797 4798 if response.StatusCode < 200 || response.StatusCode >= 300 { 4799 return out, metadata, awsAwsjson11_deserializeOpErrorScheduleKeyDeletion(response, &metadata) 4800 } 4801 output := &ScheduleKeyDeletionOutput{} 4802 out.Result = output 4803 4804 var buff [1024]byte 4805 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4806 4807 body := io.TeeReader(response.Body, ringBuffer) 4808 decoder := json.NewDecoder(body) 4809 decoder.UseNumber() 4810 var shape interface{} 4811 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4812 var snapshot bytes.Buffer 4813 io.Copy(&snapshot, ringBuffer) 4814 err = &smithy.DeserializationError{ 4815 Err: fmt.Errorf("failed to decode response body, %w", err), 4816 Snapshot: snapshot.Bytes(), 4817 } 4818 return out, metadata, err 4819 } 4820 4821 err = awsAwsjson11_deserializeOpDocumentScheduleKeyDeletionOutput(&output, shape) 4822 if err != nil { 4823 var snapshot bytes.Buffer 4824 io.Copy(&snapshot, ringBuffer) 4825 err = &smithy.DeserializationError{ 4826 Err: fmt.Errorf("failed to decode response body, %w", err), 4827 Snapshot: snapshot.Bytes(), 4828 } 4829 return out, metadata, err 4830 } 4831 4832 return out, metadata, err 4833} 4834 4835func awsAwsjson11_deserializeOpErrorScheduleKeyDeletion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4836 var errorBuffer bytes.Buffer 4837 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4838 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4839 } 4840 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4841 4842 errorCode := "UnknownError" 4843 errorMessage := errorCode 4844 4845 code := response.Header.Get("X-Amzn-ErrorType") 4846 if len(code) != 0 { 4847 errorCode = restjson.SanitizeErrorCode(code) 4848 } 4849 4850 var buff [1024]byte 4851 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4852 4853 body := io.TeeReader(errorBody, ringBuffer) 4854 decoder := json.NewDecoder(body) 4855 decoder.UseNumber() 4856 code, message, err := restjson.GetErrorInfo(decoder) 4857 if err != nil { 4858 var snapshot bytes.Buffer 4859 io.Copy(&snapshot, ringBuffer) 4860 err = &smithy.DeserializationError{ 4861 Err: fmt.Errorf("failed to decode response body, %w", err), 4862 Snapshot: snapshot.Bytes(), 4863 } 4864 return err 4865 } 4866 4867 errorBody.Seek(0, io.SeekStart) 4868 if len(code) != 0 { 4869 errorCode = restjson.SanitizeErrorCode(code) 4870 } 4871 if len(message) != 0 { 4872 errorMessage = message 4873 } 4874 4875 switch { 4876 case strings.EqualFold("DependencyTimeoutException", errorCode): 4877 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4878 4879 case strings.EqualFold("InvalidArnException", errorCode): 4880 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4881 4882 case strings.EqualFold("KMSInternalException", errorCode): 4883 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4884 4885 case strings.EqualFold("KMSInvalidStateException", errorCode): 4886 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4887 4888 case strings.EqualFold("NotFoundException", errorCode): 4889 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4890 4891 default: 4892 genericError := &smithy.GenericAPIError{ 4893 Code: errorCode, 4894 Message: errorMessage, 4895 } 4896 return genericError 4897 4898 } 4899} 4900 4901type awsAwsjson11_deserializeOpSign struct { 4902} 4903 4904func (*awsAwsjson11_deserializeOpSign) ID() string { 4905 return "OperationDeserializer" 4906} 4907 4908func (m *awsAwsjson11_deserializeOpSign) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4909 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4910) { 4911 out, metadata, err = next.HandleDeserialize(ctx, in) 4912 if err != nil { 4913 return out, metadata, err 4914 } 4915 4916 response, ok := out.RawResponse.(*smithyhttp.Response) 4917 if !ok { 4918 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4919 } 4920 4921 if response.StatusCode < 200 || response.StatusCode >= 300 { 4922 return out, metadata, awsAwsjson11_deserializeOpErrorSign(response, &metadata) 4923 } 4924 output := &SignOutput{} 4925 out.Result = output 4926 4927 var buff [1024]byte 4928 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4929 4930 body := io.TeeReader(response.Body, ringBuffer) 4931 decoder := json.NewDecoder(body) 4932 decoder.UseNumber() 4933 var shape interface{} 4934 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4935 var snapshot bytes.Buffer 4936 io.Copy(&snapshot, ringBuffer) 4937 err = &smithy.DeserializationError{ 4938 Err: fmt.Errorf("failed to decode response body, %w", err), 4939 Snapshot: snapshot.Bytes(), 4940 } 4941 return out, metadata, err 4942 } 4943 4944 err = awsAwsjson11_deserializeOpDocumentSignOutput(&output, shape) 4945 if err != nil { 4946 var snapshot bytes.Buffer 4947 io.Copy(&snapshot, ringBuffer) 4948 err = &smithy.DeserializationError{ 4949 Err: fmt.Errorf("failed to decode response body, %w", err), 4950 Snapshot: snapshot.Bytes(), 4951 } 4952 return out, metadata, err 4953 } 4954 4955 return out, metadata, err 4956} 4957 4958func awsAwsjson11_deserializeOpErrorSign(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4959 var errorBuffer bytes.Buffer 4960 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4961 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4962 } 4963 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4964 4965 errorCode := "UnknownError" 4966 errorMessage := errorCode 4967 4968 code := response.Header.Get("X-Amzn-ErrorType") 4969 if len(code) != 0 { 4970 errorCode = restjson.SanitizeErrorCode(code) 4971 } 4972 4973 var buff [1024]byte 4974 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4975 4976 body := io.TeeReader(errorBody, ringBuffer) 4977 decoder := json.NewDecoder(body) 4978 decoder.UseNumber() 4979 code, message, err := restjson.GetErrorInfo(decoder) 4980 if err != nil { 4981 var snapshot bytes.Buffer 4982 io.Copy(&snapshot, ringBuffer) 4983 err = &smithy.DeserializationError{ 4984 Err: fmt.Errorf("failed to decode response body, %w", err), 4985 Snapshot: snapshot.Bytes(), 4986 } 4987 return err 4988 } 4989 4990 errorBody.Seek(0, io.SeekStart) 4991 if len(code) != 0 { 4992 errorCode = restjson.SanitizeErrorCode(code) 4993 } 4994 if len(message) != 0 { 4995 errorMessage = message 4996 } 4997 4998 switch { 4999 case strings.EqualFold("DependencyTimeoutException", errorCode): 5000 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 5001 5002 case strings.EqualFold("DisabledException", errorCode): 5003 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 5004 5005 case strings.EqualFold("InvalidGrantTokenException", errorCode): 5006 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 5007 5008 case strings.EqualFold("InvalidKeyUsageException", errorCode): 5009 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 5010 5011 case strings.EqualFold("KMSInternalException", errorCode): 5012 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5013 5014 case strings.EqualFold("KMSInvalidStateException", errorCode): 5015 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5016 5017 case strings.EqualFold("KeyUnavailableException", errorCode): 5018 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 5019 5020 case strings.EqualFold("NotFoundException", errorCode): 5021 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5022 5023 default: 5024 genericError := &smithy.GenericAPIError{ 5025 Code: errorCode, 5026 Message: errorMessage, 5027 } 5028 return genericError 5029 5030 } 5031} 5032 5033type awsAwsjson11_deserializeOpTagResource struct { 5034} 5035 5036func (*awsAwsjson11_deserializeOpTagResource) ID() string { 5037 return "OperationDeserializer" 5038} 5039 5040func (m *awsAwsjson11_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5041 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5042) { 5043 out, metadata, err = next.HandleDeserialize(ctx, in) 5044 if err != nil { 5045 return out, metadata, err 5046 } 5047 5048 response, ok := out.RawResponse.(*smithyhttp.Response) 5049 if !ok { 5050 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5051 } 5052 5053 if response.StatusCode < 200 || response.StatusCode >= 300 { 5054 return out, metadata, awsAwsjson11_deserializeOpErrorTagResource(response, &metadata) 5055 } 5056 output := &TagResourceOutput{} 5057 out.Result = output 5058 5059 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5060 return out, metadata, &smithy.DeserializationError{ 5061 Err: fmt.Errorf("failed to discard response body, %w", err), 5062 } 5063 } 5064 5065 return out, metadata, err 5066} 5067 5068func awsAwsjson11_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5069 var errorBuffer bytes.Buffer 5070 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5071 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5072 } 5073 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5074 5075 errorCode := "UnknownError" 5076 errorMessage := errorCode 5077 5078 code := response.Header.Get("X-Amzn-ErrorType") 5079 if len(code) != 0 { 5080 errorCode = restjson.SanitizeErrorCode(code) 5081 } 5082 5083 var buff [1024]byte 5084 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5085 5086 body := io.TeeReader(errorBody, ringBuffer) 5087 decoder := json.NewDecoder(body) 5088 decoder.UseNumber() 5089 code, message, err := restjson.GetErrorInfo(decoder) 5090 if err != nil { 5091 var snapshot bytes.Buffer 5092 io.Copy(&snapshot, ringBuffer) 5093 err = &smithy.DeserializationError{ 5094 Err: fmt.Errorf("failed to decode response body, %w", err), 5095 Snapshot: snapshot.Bytes(), 5096 } 5097 return err 5098 } 5099 5100 errorBody.Seek(0, io.SeekStart) 5101 if len(code) != 0 { 5102 errorCode = restjson.SanitizeErrorCode(code) 5103 } 5104 if len(message) != 0 { 5105 errorMessage = message 5106 } 5107 5108 switch { 5109 case strings.EqualFold("InvalidArnException", errorCode): 5110 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 5111 5112 case strings.EqualFold("KMSInternalException", errorCode): 5113 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5114 5115 case strings.EqualFold("KMSInvalidStateException", errorCode): 5116 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5117 5118 case strings.EqualFold("LimitExceededException", errorCode): 5119 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 5120 5121 case strings.EqualFold("NotFoundException", errorCode): 5122 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5123 5124 case strings.EqualFold("TagException", errorCode): 5125 return awsAwsjson11_deserializeErrorTagException(response, errorBody) 5126 5127 default: 5128 genericError := &smithy.GenericAPIError{ 5129 Code: errorCode, 5130 Message: errorMessage, 5131 } 5132 return genericError 5133 5134 } 5135} 5136 5137type awsAwsjson11_deserializeOpUntagResource struct { 5138} 5139 5140func (*awsAwsjson11_deserializeOpUntagResource) ID() string { 5141 return "OperationDeserializer" 5142} 5143 5144func (m *awsAwsjson11_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5145 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5146) { 5147 out, metadata, err = next.HandleDeserialize(ctx, in) 5148 if err != nil { 5149 return out, metadata, err 5150 } 5151 5152 response, ok := out.RawResponse.(*smithyhttp.Response) 5153 if !ok { 5154 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5155 } 5156 5157 if response.StatusCode < 200 || response.StatusCode >= 300 { 5158 return out, metadata, awsAwsjson11_deserializeOpErrorUntagResource(response, &metadata) 5159 } 5160 output := &UntagResourceOutput{} 5161 out.Result = output 5162 5163 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5164 return out, metadata, &smithy.DeserializationError{ 5165 Err: fmt.Errorf("failed to discard response body, %w", err), 5166 } 5167 } 5168 5169 return out, metadata, err 5170} 5171 5172func awsAwsjson11_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5173 var errorBuffer bytes.Buffer 5174 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5175 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5176 } 5177 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5178 5179 errorCode := "UnknownError" 5180 errorMessage := errorCode 5181 5182 code := response.Header.Get("X-Amzn-ErrorType") 5183 if len(code) != 0 { 5184 errorCode = restjson.SanitizeErrorCode(code) 5185 } 5186 5187 var buff [1024]byte 5188 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5189 5190 body := io.TeeReader(errorBody, ringBuffer) 5191 decoder := json.NewDecoder(body) 5192 decoder.UseNumber() 5193 code, message, err := restjson.GetErrorInfo(decoder) 5194 if err != nil { 5195 var snapshot bytes.Buffer 5196 io.Copy(&snapshot, ringBuffer) 5197 err = &smithy.DeserializationError{ 5198 Err: fmt.Errorf("failed to decode response body, %w", err), 5199 Snapshot: snapshot.Bytes(), 5200 } 5201 return err 5202 } 5203 5204 errorBody.Seek(0, io.SeekStart) 5205 if len(code) != 0 { 5206 errorCode = restjson.SanitizeErrorCode(code) 5207 } 5208 if len(message) != 0 { 5209 errorMessage = message 5210 } 5211 5212 switch { 5213 case strings.EqualFold("InvalidArnException", errorCode): 5214 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 5215 5216 case strings.EqualFold("KMSInternalException", errorCode): 5217 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5218 5219 case strings.EqualFold("KMSInvalidStateException", errorCode): 5220 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5221 5222 case strings.EqualFold("NotFoundException", errorCode): 5223 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5224 5225 case strings.EqualFold("TagException", errorCode): 5226 return awsAwsjson11_deserializeErrorTagException(response, errorBody) 5227 5228 default: 5229 genericError := &smithy.GenericAPIError{ 5230 Code: errorCode, 5231 Message: errorMessage, 5232 } 5233 return genericError 5234 5235 } 5236} 5237 5238type awsAwsjson11_deserializeOpUpdateAlias struct { 5239} 5240 5241func (*awsAwsjson11_deserializeOpUpdateAlias) ID() string { 5242 return "OperationDeserializer" 5243} 5244 5245func (m *awsAwsjson11_deserializeOpUpdateAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5246 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5247) { 5248 out, metadata, err = next.HandleDeserialize(ctx, in) 5249 if err != nil { 5250 return out, metadata, err 5251 } 5252 5253 response, ok := out.RawResponse.(*smithyhttp.Response) 5254 if !ok { 5255 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5256 } 5257 5258 if response.StatusCode < 200 || response.StatusCode >= 300 { 5259 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateAlias(response, &metadata) 5260 } 5261 output := &UpdateAliasOutput{} 5262 out.Result = output 5263 5264 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5265 return out, metadata, &smithy.DeserializationError{ 5266 Err: fmt.Errorf("failed to discard response body, %w", err), 5267 } 5268 } 5269 5270 return out, metadata, err 5271} 5272 5273func awsAwsjson11_deserializeOpErrorUpdateAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5274 var errorBuffer bytes.Buffer 5275 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5276 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5277 } 5278 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5279 5280 errorCode := "UnknownError" 5281 errorMessage := errorCode 5282 5283 code := response.Header.Get("X-Amzn-ErrorType") 5284 if len(code) != 0 { 5285 errorCode = restjson.SanitizeErrorCode(code) 5286 } 5287 5288 var buff [1024]byte 5289 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5290 5291 body := io.TeeReader(errorBody, ringBuffer) 5292 decoder := json.NewDecoder(body) 5293 decoder.UseNumber() 5294 code, message, err := restjson.GetErrorInfo(decoder) 5295 if err != nil { 5296 var snapshot bytes.Buffer 5297 io.Copy(&snapshot, ringBuffer) 5298 err = &smithy.DeserializationError{ 5299 Err: fmt.Errorf("failed to decode response body, %w", err), 5300 Snapshot: snapshot.Bytes(), 5301 } 5302 return err 5303 } 5304 5305 errorBody.Seek(0, io.SeekStart) 5306 if len(code) != 0 { 5307 errorCode = restjson.SanitizeErrorCode(code) 5308 } 5309 if len(message) != 0 { 5310 errorMessage = message 5311 } 5312 5313 switch { 5314 case strings.EqualFold("DependencyTimeoutException", errorCode): 5315 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 5316 5317 case strings.EqualFold("KMSInternalException", errorCode): 5318 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5319 5320 case strings.EqualFold("KMSInvalidStateException", errorCode): 5321 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5322 5323 case strings.EqualFold("LimitExceededException", errorCode): 5324 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 5325 5326 case strings.EqualFold("NotFoundException", errorCode): 5327 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5328 5329 default: 5330 genericError := &smithy.GenericAPIError{ 5331 Code: errorCode, 5332 Message: errorMessage, 5333 } 5334 return genericError 5335 5336 } 5337} 5338 5339type awsAwsjson11_deserializeOpUpdateCustomKeyStore struct { 5340} 5341 5342func (*awsAwsjson11_deserializeOpUpdateCustomKeyStore) ID() string { 5343 return "OperationDeserializer" 5344} 5345 5346func (m *awsAwsjson11_deserializeOpUpdateCustomKeyStore) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5347 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5348) { 5349 out, metadata, err = next.HandleDeserialize(ctx, in) 5350 if err != nil { 5351 return out, metadata, err 5352 } 5353 5354 response, ok := out.RawResponse.(*smithyhttp.Response) 5355 if !ok { 5356 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5357 } 5358 5359 if response.StatusCode < 200 || response.StatusCode >= 300 { 5360 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateCustomKeyStore(response, &metadata) 5361 } 5362 output := &UpdateCustomKeyStoreOutput{} 5363 out.Result = output 5364 5365 var buff [1024]byte 5366 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5367 5368 body := io.TeeReader(response.Body, ringBuffer) 5369 decoder := json.NewDecoder(body) 5370 decoder.UseNumber() 5371 var shape interface{} 5372 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5373 var snapshot bytes.Buffer 5374 io.Copy(&snapshot, ringBuffer) 5375 err = &smithy.DeserializationError{ 5376 Err: fmt.Errorf("failed to decode response body, %w", err), 5377 Snapshot: snapshot.Bytes(), 5378 } 5379 return out, metadata, err 5380 } 5381 5382 err = awsAwsjson11_deserializeOpDocumentUpdateCustomKeyStoreOutput(&output, shape) 5383 if err != nil { 5384 var snapshot bytes.Buffer 5385 io.Copy(&snapshot, ringBuffer) 5386 err = &smithy.DeserializationError{ 5387 Err: fmt.Errorf("failed to decode response body, %w", err), 5388 Snapshot: snapshot.Bytes(), 5389 } 5390 return out, metadata, err 5391 } 5392 5393 return out, metadata, err 5394} 5395 5396func awsAwsjson11_deserializeOpErrorUpdateCustomKeyStore(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5397 var errorBuffer bytes.Buffer 5398 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5399 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5400 } 5401 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5402 5403 errorCode := "UnknownError" 5404 errorMessage := errorCode 5405 5406 code := response.Header.Get("X-Amzn-ErrorType") 5407 if len(code) != 0 { 5408 errorCode = restjson.SanitizeErrorCode(code) 5409 } 5410 5411 var buff [1024]byte 5412 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5413 5414 body := io.TeeReader(errorBody, ringBuffer) 5415 decoder := json.NewDecoder(body) 5416 decoder.UseNumber() 5417 code, message, err := restjson.GetErrorInfo(decoder) 5418 if err != nil { 5419 var snapshot bytes.Buffer 5420 io.Copy(&snapshot, ringBuffer) 5421 err = &smithy.DeserializationError{ 5422 Err: fmt.Errorf("failed to decode response body, %w", err), 5423 Snapshot: snapshot.Bytes(), 5424 } 5425 return err 5426 } 5427 5428 errorBody.Seek(0, io.SeekStart) 5429 if len(code) != 0 { 5430 errorCode = restjson.SanitizeErrorCode(code) 5431 } 5432 if len(message) != 0 { 5433 errorMessage = message 5434 } 5435 5436 switch { 5437 case strings.EqualFold("CloudHsmClusterInvalidConfigurationException", errorCode): 5438 return awsAwsjson11_deserializeErrorCloudHsmClusterInvalidConfigurationException(response, errorBody) 5439 5440 case strings.EqualFold("CloudHsmClusterNotActiveException", errorCode): 5441 return awsAwsjson11_deserializeErrorCloudHsmClusterNotActiveException(response, errorBody) 5442 5443 case strings.EqualFold("CloudHsmClusterNotFoundException", errorCode): 5444 return awsAwsjson11_deserializeErrorCloudHsmClusterNotFoundException(response, errorBody) 5445 5446 case strings.EqualFold("CloudHsmClusterNotRelatedException", errorCode): 5447 return awsAwsjson11_deserializeErrorCloudHsmClusterNotRelatedException(response, errorBody) 5448 5449 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 5450 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 5451 5452 case strings.EqualFold("CustomKeyStoreNameInUseException", errorCode): 5453 return awsAwsjson11_deserializeErrorCustomKeyStoreNameInUseException(response, errorBody) 5454 5455 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 5456 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 5457 5458 case strings.EqualFold("KMSInternalException", errorCode): 5459 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5460 5461 default: 5462 genericError := &smithy.GenericAPIError{ 5463 Code: errorCode, 5464 Message: errorMessage, 5465 } 5466 return genericError 5467 5468 } 5469} 5470 5471type awsAwsjson11_deserializeOpUpdateKeyDescription struct { 5472} 5473 5474func (*awsAwsjson11_deserializeOpUpdateKeyDescription) ID() string { 5475 return "OperationDeserializer" 5476} 5477 5478func (m *awsAwsjson11_deserializeOpUpdateKeyDescription) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5479 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5480) { 5481 out, metadata, err = next.HandleDeserialize(ctx, in) 5482 if err != nil { 5483 return out, metadata, err 5484 } 5485 5486 response, ok := out.RawResponse.(*smithyhttp.Response) 5487 if !ok { 5488 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5489 } 5490 5491 if response.StatusCode < 200 || response.StatusCode >= 300 { 5492 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateKeyDescription(response, &metadata) 5493 } 5494 output := &UpdateKeyDescriptionOutput{} 5495 out.Result = output 5496 5497 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5498 return out, metadata, &smithy.DeserializationError{ 5499 Err: fmt.Errorf("failed to discard response body, %w", err), 5500 } 5501 } 5502 5503 return out, metadata, err 5504} 5505 5506func awsAwsjson11_deserializeOpErrorUpdateKeyDescription(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5507 var errorBuffer bytes.Buffer 5508 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5509 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5510 } 5511 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5512 5513 errorCode := "UnknownError" 5514 errorMessage := errorCode 5515 5516 code := response.Header.Get("X-Amzn-ErrorType") 5517 if len(code) != 0 { 5518 errorCode = restjson.SanitizeErrorCode(code) 5519 } 5520 5521 var buff [1024]byte 5522 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5523 5524 body := io.TeeReader(errorBody, ringBuffer) 5525 decoder := json.NewDecoder(body) 5526 decoder.UseNumber() 5527 code, message, err := restjson.GetErrorInfo(decoder) 5528 if err != nil { 5529 var snapshot bytes.Buffer 5530 io.Copy(&snapshot, ringBuffer) 5531 err = &smithy.DeserializationError{ 5532 Err: fmt.Errorf("failed to decode response body, %w", err), 5533 Snapshot: snapshot.Bytes(), 5534 } 5535 return err 5536 } 5537 5538 errorBody.Seek(0, io.SeekStart) 5539 if len(code) != 0 { 5540 errorCode = restjson.SanitizeErrorCode(code) 5541 } 5542 if len(message) != 0 { 5543 errorMessage = message 5544 } 5545 5546 switch { 5547 case strings.EqualFold("DependencyTimeoutException", errorCode): 5548 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 5549 5550 case strings.EqualFold("InvalidArnException", errorCode): 5551 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 5552 5553 case strings.EqualFold("KMSInternalException", errorCode): 5554 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5555 5556 case strings.EqualFold("KMSInvalidStateException", errorCode): 5557 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5558 5559 case strings.EqualFold("NotFoundException", errorCode): 5560 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5561 5562 default: 5563 genericError := &smithy.GenericAPIError{ 5564 Code: errorCode, 5565 Message: errorMessage, 5566 } 5567 return genericError 5568 5569 } 5570} 5571 5572type awsAwsjson11_deserializeOpUpdatePrimaryRegion struct { 5573} 5574 5575func (*awsAwsjson11_deserializeOpUpdatePrimaryRegion) ID() string { 5576 return "OperationDeserializer" 5577} 5578 5579func (m *awsAwsjson11_deserializeOpUpdatePrimaryRegion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5580 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5581) { 5582 out, metadata, err = next.HandleDeserialize(ctx, in) 5583 if err != nil { 5584 return out, metadata, err 5585 } 5586 5587 response, ok := out.RawResponse.(*smithyhttp.Response) 5588 if !ok { 5589 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5590 } 5591 5592 if response.StatusCode < 200 || response.StatusCode >= 300 { 5593 return out, metadata, awsAwsjson11_deserializeOpErrorUpdatePrimaryRegion(response, &metadata) 5594 } 5595 output := &UpdatePrimaryRegionOutput{} 5596 out.Result = output 5597 5598 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5599 return out, metadata, &smithy.DeserializationError{ 5600 Err: fmt.Errorf("failed to discard response body, %w", err), 5601 } 5602 } 5603 5604 return out, metadata, err 5605} 5606 5607func awsAwsjson11_deserializeOpErrorUpdatePrimaryRegion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5608 var errorBuffer bytes.Buffer 5609 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5610 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5611 } 5612 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5613 5614 errorCode := "UnknownError" 5615 errorMessage := errorCode 5616 5617 code := response.Header.Get("X-Amzn-ErrorType") 5618 if len(code) != 0 { 5619 errorCode = restjson.SanitizeErrorCode(code) 5620 } 5621 5622 var buff [1024]byte 5623 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5624 5625 body := io.TeeReader(errorBody, ringBuffer) 5626 decoder := json.NewDecoder(body) 5627 decoder.UseNumber() 5628 code, message, err := restjson.GetErrorInfo(decoder) 5629 if err != nil { 5630 var snapshot bytes.Buffer 5631 io.Copy(&snapshot, ringBuffer) 5632 err = &smithy.DeserializationError{ 5633 Err: fmt.Errorf("failed to decode response body, %w", err), 5634 Snapshot: snapshot.Bytes(), 5635 } 5636 return err 5637 } 5638 5639 errorBody.Seek(0, io.SeekStart) 5640 if len(code) != 0 { 5641 errorCode = restjson.SanitizeErrorCode(code) 5642 } 5643 if len(message) != 0 { 5644 errorMessage = message 5645 } 5646 5647 switch { 5648 case strings.EqualFold("DisabledException", errorCode): 5649 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 5650 5651 case strings.EqualFold("InvalidArnException", errorCode): 5652 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 5653 5654 case strings.EqualFold("KMSInternalException", errorCode): 5655 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5656 5657 case strings.EqualFold("KMSInvalidStateException", errorCode): 5658 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5659 5660 case strings.EqualFold("NotFoundException", errorCode): 5661 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5662 5663 case strings.EqualFold("UnsupportedOperationException", errorCode): 5664 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 5665 5666 default: 5667 genericError := &smithy.GenericAPIError{ 5668 Code: errorCode, 5669 Message: errorMessage, 5670 } 5671 return genericError 5672 5673 } 5674} 5675 5676type awsAwsjson11_deserializeOpVerify struct { 5677} 5678 5679func (*awsAwsjson11_deserializeOpVerify) ID() string { 5680 return "OperationDeserializer" 5681} 5682 5683func (m *awsAwsjson11_deserializeOpVerify) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5684 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5685) { 5686 out, metadata, err = next.HandleDeserialize(ctx, in) 5687 if err != nil { 5688 return out, metadata, err 5689 } 5690 5691 response, ok := out.RawResponse.(*smithyhttp.Response) 5692 if !ok { 5693 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5694 } 5695 5696 if response.StatusCode < 200 || response.StatusCode >= 300 { 5697 return out, metadata, awsAwsjson11_deserializeOpErrorVerify(response, &metadata) 5698 } 5699 output := &VerifyOutput{} 5700 out.Result = output 5701 5702 var buff [1024]byte 5703 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5704 5705 body := io.TeeReader(response.Body, ringBuffer) 5706 decoder := json.NewDecoder(body) 5707 decoder.UseNumber() 5708 var shape interface{} 5709 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5710 var snapshot bytes.Buffer 5711 io.Copy(&snapshot, ringBuffer) 5712 err = &smithy.DeserializationError{ 5713 Err: fmt.Errorf("failed to decode response body, %w", err), 5714 Snapshot: snapshot.Bytes(), 5715 } 5716 return out, metadata, err 5717 } 5718 5719 err = awsAwsjson11_deserializeOpDocumentVerifyOutput(&output, shape) 5720 if err != nil { 5721 var snapshot bytes.Buffer 5722 io.Copy(&snapshot, ringBuffer) 5723 err = &smithy.DeserializationError{ 5724 Err: fmt.Errorf("failed to decode response body, %w", err), 5725 Snapshot: snapshot.Bytes(), 5726 } 5727 return out, metadata, err 5728 } 5729 5730 return out, metadata, err 5731} 5732 5733func awsAwsjson11_deserializeOpErrorVerify(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5734 var errorBuffer bytes.Buffer 5735 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5736 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5737 } 5738 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5739 5740 errorCode := "UnknownError" 5741 errorMessage := errorCode 5742 5743 code := response.Header.Get("X-Amzn-ErrorType") 5744 if len(code) != 0 { 5745 errorCode = restjson.SanitizeErrorCode(code) 5746 } 5747 5748 var buff [1024]byte 5749 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5750 5751 body := io.TeeReader(errorBody, ringBuffer) 5752 decoder := json.NewDecoder(body) 5753 decoder.UseNumber() 5754 code, message, err := restjson.GetErrorInfo(decoder) 5755 if err != nil { 5756 var snapshot bytes.Buffer 5757 io.Copy(&snapshot, ringBuffer) 5758 err = &smithy.DeserializationError{ 5759 Err: fmt.Errorf("failed to decode response body, %w", err), 5760 Snapshot: snapshot.Bytes(), 5761 } 5762 return err 5763 } 5764 5765 errorBody.Seek(0, io.SeekStart) 5766 if len(code) != 0 { 5767 errorCode = restjson.SanitizeErrorCode(code) 5768 } 5769 if len(message) != 0 { 5770 errorMessage = message 5771 } 5772 5773 switch { 5774 case strings.EqualFold("DependencyTimeoutException", errorCode): 5775 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 5776 5777 case strings.EqualFold("DisabledException", errorCode): 5778 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 5779 5780 case strings.EqualFold("InvalidGrantTokenException", errorCode): 5781 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 5782 5783 case strings.EqualFold("InvalidKeyUsageException", errorCode): 5784 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 5785 5786 case strings.EqualFold("KMSInternalException", errorCode): 5787 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5788 5789 case strings.EqualFold("KMSInvalidSignatureException", errorCode): 5790 return awsAwsjson11_deserializeErrorKMSInvalidSignatureException(response, errorBody) 5791 5792 case strings.EqualFold("KMSInvalidStateException", errorCode): 5793 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5794 5795 case strings.EqualFold("KeyUnavailableException", errorCode): 5796 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 5797 5798 case strings.EqualFold("NotFoundException", errorCode): 5799 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5800 5801 default: 5802 genericError := &smithy.GenericAPIError{ 5803 Code: errorCode, 5804 Message: errorMessage, 5805 } 5806 return genericError 5807 5808 } 5809} 5810 5811func awsAwsjson11_deserializeErrorAlreadyExistsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5812 var buff [1024]byte 5813 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5814 5815 body := io.TeeReader(errorBody, ringBuffer) 5816 decoder := json.NewDecoder(body) 5817 decoder.UseNumber() 5818 var shape interface{} 5819 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5820 var snapshot bytes.Buffer 5821 io.Copy(&snapshot, ringBuffer) 5822 err = &smithy.DeserializationError{ 5823 Err: fmt.Errorf("failed to decode response body, %w", err), 5824 Snapshot: snapshot.Bytes(), 5825 } 5826 return err 5827 } 5828 5829 output := &types.AlreadyExistsException{} 5830 err := awsAwsjson11_deserializeDocumentAlreadyExistsException(&output, shape) 5831 5832 if err != nil { 5833 var snapshot bytes.Buffer 5834 io.Copy(&snapshot, ringBuffer) 5835 err = &smithy.DeserializationError{ 5836 Err: fmt.Errorf("failed to decode response body, %w", err), 5837 Snapshot: snapshot.Bytes(), 5838 } 5839 return err 5840 } 5841 5842 errorBody.Seek(0, io.SeekStart) 5843 return output 5844} 5845 5846func awsAwsjson11_deserializeErrorCloudHsmClusterInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5847 var buff [1024]byte 5848 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5849 5850 body := io.TeeReader(errorBody, ringBuffer) 5851 decoder := json.NewDecoder(body) 5852 decoder.UseNumber() 5853 var shape interface{} 5854 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5855 var snapshot bytes.Buffer 5856 io.Copy(&snapshot, ringBuffer) 5857 err = &smithy.DeserializationError{ 5858 Err: fmt.Errorf("failed to decode response body, %w", err), 5859 Snapshot: snapshot.Bytes(), 5860 } 5861 return err 5862 } 5863 5864 output := &types.CloudHsmClusterInUseException{} 5865 err := awsAwsjson11_deserializeDocumentCloudHsmClusterInUseException(&output, shape) 5866 5867 if err != nil { 5868 var snapshot bytes.Buffer 5869 io.Copy(&snapshot, ringBuffer) 5870 err = &smithy.DeserializationError{ 5871 Err: fmt.Errorf("failed to decode response body, %w", err), 5872 Snapshot: snapshot.Bytes(), 5873 } 5874 return err 5875 } 5876 5877 errorBody.Seek(0, io.SeekStart) 5878 return output 5879} 5880 5881func awsAwsjson11_deserializeErrorCloudHsmClusterInvalidConfigurationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5882 var buff [1024]byte 5883 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5884 5885 body := io.TeeReader(errorBody, ringBuffer) 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 err 5897 } 5898 5899 output := &types.CloudHsmClusterInvalidConfigurationException{} 5900 err := awsAwsjson11_deserializeDocumentCloudHsmClusterInvalidConfigurationException(&output, shape) 5901 5902 if err != nil { 5903 var snapshot bytes.Buffer 5904 io.Copy(&snapshot, ringBuffer) 5905 err = &smithy.DeserializationError{ 5906 Err: fmt.Errorf("failed to decode response body, %w", err), 5907 Snapshot: snapshot.Bytes(), 5908 } 5909 return err 5910 } 5911 5912 errorBody.Seek(0, io.SeekStart) 5913 return output 5914} 5915 5916func awsAwsjson11_deserializeErrorCloudHsmClusterNotActiveException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5917 var buff [1024]byte 5918 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5919 5920 body := io.TeeReader(errorBody, ringBuffer) 5921 decoder := json.NewDecoder(body) 5922 decoder.UseNumber() 5923 var shape interface{} 5924 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5925 var snapshot bytes.Buffer 5926 io.Copy(&snapshot, ringBuffer) 5927 err = &smithy.DeserializationError{ 5928 Err: fmt.Errorf("failed to decode response body, %w", err), 5929 Snapshot: snapshot.Bytes(), 5930 } 5931 return err 5932 } 5933 5934 output := &types.CloudHsmClusterNotActiveException{} 5935 err := awsAwsjson11_deserializeDocumentCloudHsmClusterNotActiveException(&output, shape) 5936 5937 if err != nil { 5938 var snapshot bytes.Buffer 5939 io.Copy(&snapshot, ringBuffer) 5940 err = &smithy.DeserializationError{ 5941 Err: fmt.Errorf("failed to decode response body, %w", err), 5942 Snapshot: snapshot.Bytes(), 5943 } 5944 return err 5945 } 5946 5947 errorBody.Seek(0, io.SeekStart) 5948 return output 5949} 5950 5951func awsAwsjson11_deserializeErrorCloudHsmClusterNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5952 var buff [1024]byte 5953 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5954 5955 body := io.TeeReader(errorBody, ringBuffer) 5956 decoder := json.NewDecoder(body) 5957 decoder.UseNumber() 5958 var shape interface{} 5959 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5960 var snapshot bytes.Buffer 5961 io.Copy(&snapshot, ringBuffer) 5962 err = &smithy.DeserializationError{ 5963 Err: fmt.Errorf("failed to decode response body, %w", err), 5964 Snapshot: snapshot.Bytes(), 5965 } 5966 return err 5967 } 5968 5969 output := &types.CloudHsmClusterNotFoundException{} 5970 err := awsAwsjson11_deserializeDocumentCloudHsmClusterNotFoundException(&output, shape) 5971 5972 if err != nil { 5973 var snapshot bytes.Buffer 5974 io.Copy(&snapshot, ringBuffer) 5975 err = &smithy.DeserializationError{ 5976 Err: fmt.Errorf("failed to decode response body, %w", err), 5977 Snapshot: snapshot.Bytes(), 5978 } 5979 return err 5980 } 5981 5982 errorBody.Seek(0, io.SeekStart) 5983 return output 5984} 5985 5986func awsAwsjson11_deserializeErrorCloudHsmClusterNotRelatedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5987 var buff [1024]byte 5988 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5989 5990 body := io.TeeReader(errorBody, ringBuffer) 5991 decoder := json.NewDecoder(body) 5992 decoder.UseNumber() 5993 var shape interface{} 5994 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5995 var snapshot bytes.Buffer 5996 io.Copy(&snapshot, ringBuffer) 5997 err = &smithy.DeserializationError{ 5998 Err: fmt.Errorf("failed to decode response body, %w", err), 5999 Snapshot: snapshot.Bytes(), 6000 } 6001 return err 6002 } 6003 6004 output := &types.CloudHsmClusterNotRelatedException{} 6005 err := awsAwsjson11_deserializeDocumentCloudHsmClusterNotRelatedException(&output, shape) 6006 6007 if err != nil { 6008 var snapshot bytes.Buffer 6009 io.Copy(&snapshot, ringBuffer) 6010 err = &smithy.DeserializationError{ 6011 Err: fmt.Errorf("failed to decode response body, %w", err), 6012 Snapshot: snapshot.Bytes(), 6013 } 6014 return err 6015 } 6016 6017 errorBody.Seek(0, io.SeekStart) 6018 return output 6019} 6020 6021func awsAwsjson11_deserializeErrorCustomKeyStoreHasCMKsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6022 var buff [1024]byte 6023 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6024 6025 body := io.TeeReader(errorBody, ringBuffer) 6026 decoder := json.NewDecoder(body) 6027 decoder.UseNumber() 6028 var shape interface{} 6029 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6030 var snapshot bytes.Buffer 6031 io.Copy(&snapshot, ringBuffer) 6032 err = &smithy.DeserializationError{ 6033 Err: fmt.Errorf("failed to decode response body, %w", err), 6034 Snapshot: snapshot.Bytes(), 6035 } 6036 return err 6037 } 6038 6039 output := &types.CustomKeyStoreHasCMKsException{} 6040 err := awsAwsjson11_deserializeDocumentCustomKeyStoreHasCMKsException(&output, shape) 6041 6042 if err != nil { 6043 var snapshot bytes.Buffer 6044 io.Copy(&snapshot, ringBuffer) 6045 err = &smithy.DeserializationError{ 6046 Err: fmt.Errorf("failed to decode response body, %w", err), 6047 Snapshot: snapshot.Bytes(), 6048 } 6049 return err 6050 } 6051 6052 errorBody.Seek(0, io.SeekStart) 6053 return output 6054} 6055 6056func awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6057 var buff [1024]byte 6058 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6059 6060 body := io.TeeReader(errorBody, ringBuffer) 6061 decoder := json.NewDecoder(body) 6062 decoder.UseNumber() 6063 var shape interface{} 6064 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6065 var snapshot bytes.Buffer 6066 io.Copy(&snapshot, ringBuffer) 6067 err = &smithy.DeserializationError{ 6068 Err: fmt.Errorf("failed to decode response body, %w", err), 6069 Snapshot: snapshot.Bytes(), 6070 } 6071 return err 6072 } 6073 6074 output := &types.CustomKeyStoreInvalidStateException{} 6075 err := awsAwsjson11_deserializeDocumentCustomKeyStoreInvalidStateException(&output, shape) 6076 6077 if err != nil { 6078 var snapshot bytes.Buffer 6079 io.Copy(&snapshot, ringBuffer) 6080 err = &smithy.DeserializationError{ 6081 Err: fmt.Errorf("failed to decode response body, %w", err), 6082 Snapshot: snapshot.Bytes(), 6083 } 6084 return err 6085 } 6086 6087 errorBody.Seek(0, io.SeekStart) 6088 return output 6089} 6090 6091func awsAwsjson11_deserializeErrorCustomKeyStoreNameInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6092 var buff [1024]byte 6093 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6094 6095 body := io.TeeReader(errorBody, ringBuffer) 6096 decoder := json.NewDecoder(body) 6097 decoder.UseNumber() 6098 var shape interface{} 6099 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6100 var snapshot bytes.Buffer 6101 io.Copy(&snapshot, ringBuffer) 6102 err = &smithy.DeserializationError{ 6103 Err: fmt.Errorf("failed to decode response body, %w", err), 6104 Snapshot: snapshot.Bytes(), 6105 } 6106 return err 6107 } 6108 6109 output := &types.CustomKeyStoreNameInUseException{} 6110 err := awsAwsjson11_deserializeDocumentCustomKeyStoreNameInUseException(&output, shape) 6111 6112 if err != nil { 6113 var snapshot bytes.Buffer 6114 io.Copy(&snapshot, ringBuffer) 6115 err = &smithy.DeserializationError{ 6116 Err: fmt.Errorf("failed to decode response body, %w", err), 6117 Snapshot: snapshot.Bytes(), 6118 } 6119 return err 6120 } 6121 6122 errorBody.Seek(0, io.SeekStart) 6123 return output 6124} 6125 6126func awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6127 var buff [1024]byte 6128 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6129 6130 body := io.TeeReader(errorBody, ringBuffer) 6131 decoder := json.NewDecoder(body) 6132 decoder.UseNumber() 6133 var shape interface{} 6134 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6135 var snapshot bytes.Buffer 6136 io.Copy(&snapshot, ringBuffer) 6137 err = &smithy.DeserializationError{ 6138 Err: fmt.Errorf("failed to decode response body, %w", err), 6139 Snapshot: snapshot.Bytes(), 6140 } 6141 return err 6142 } 6143 6144 output := &types.CustomKeyStoreNotFoundException{} 6145 err := awsAwsjson11_deserializeDocumentCustomKeyStoreNotFoundException(&output, shape) 6146 6147 if err != nil { 6148 var snapshot bytes.Buffer 6149 io.Copy(&snapshot, ringBuffer) 6150 err = &smithy.DeserializationError{ 6151 Err: fmt.Errorf("failed to decode response body, %w", err), 6152 Snapshot: snapshot.Bytes(), 6153 } 6154 return err 6155 } 6156 6157 errorBody.Seek(0, io.SeekStart) 6158 return output 6159} 6160 6161func awsAwsjson11_deserializeErrorDependencyTimeoutException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6162 var buff [1024]byte 6163 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6164 6165 body := io.TeeReader(errorBody, ringBuffer) 6166 decoder := json.NewDecoder(body) 6167 decoder.UseNumber() 6168 var shape interface{} 6169 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6170 var snapshot bytes.Buffer 6171 io.Copy(&snapshot, ringBuffer) 6172 err = &smithy.DeserializationError{ 6173 Err: fmt.Errorf("failed to decode response body, %w", err), 6174 Snapshot: snapshot.Bytes(), 6175 } 6176 return err 6177 } 6178 6179 output := &types.DependencyTimeoutException{} 6180 err := awsAwsjson11_deserializeDocumentDependencyTimeoutException(&output, shape) 6181 6182 if err != nil { 6183 var snapshot bytes.Buffer 6184 io.Copy(&snapshot, ringBuffer) 6185 err = &smithy.DeserializationError{ 6186 Err: fmt.Errorf("failed to decode response body, %w", err), 6187 Snapshot: snapshot.Bytes(), 6188 } 6189 return err 6190 } 6191 6192 errorBody.Seek(0, io.SeekStart) 6193 return output 6194} 6195 6196func awsAwsjson11_deserializeErrorDisabledException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6197 var buff [1024]byte 6198 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6199 6200 body := io.TeeReader(errorBody, ringBuffer) 6201 decoder := json.NewDecoder(body) 6202 decoder.UseNumber() 6203 var shape interface{} 6204 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6205 var snapshot bytes.Buffer 6206 io.Copy(&snapshot, ringBuffer) 6207 err = &smithy.DeserializationError{ 6208 Err: fmt.Errorf("failed to decode response body, %w", err), 6209 Snapshot: snapshot.Bytes(), 6210 } 6211 return err 6212 } 6213 6214 output := &types.DisabledException{} 6215 err := awsAwsjson11_deserializeDocumentDisabledException(&output, shape) 6216 6217 if err != nil { 6218 var snapshot bytes.Buffer 6219 io.Copy(&snapshot, ringBuffer) 6220 err = &smithy.DeserializationError{ 6221 Err: fmt.Errorf("failed to decode response body, %w", err), 6222 Snapshot: snapshot.Bytes(), 6223 } 6224 return err 6225 } 6226 6227 errorBody.Seek(0, io.SeekStart) 6228 return output 6229} 6230 6231func awsAwsjson11_deserializeErrorExpiredImportTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6232 var buff [1024]byte 6233 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6234 6235 body := io.TeeReader(errorBody, ringBuffer) 6236 decoder := json.NewDecoder(body) 6237 decoder.UseNumber() 6238 var shape interface{} 6239 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6240 var snapshot bytes.Buffer 6241 io.Copy(&snapshot, ringBuffer) 6242 err = &smithy.DeserializationError{ 6243 Err: fmt.Errorf("failed to decode response body, %w", err), 6244 Snapshot: snapshot.Bytes(), 6245 } 6246 return err 6247 } 6248 6249 output := &types.ExpiredImportTokenException{} 6250 err := awsAwsjson11_deserializeDocumentExpiredImportTokenException(&output, shape) 6251 6252 if err != nil { 6253 var snapshot bytes.Buffer 6254 io.Copy(&snapshot, ringBuffer) 6255 err = &smithy.DeserializationError{ 6256 Err: fmt.Errorf("failed to decode response body, %w", err), 6257 Snapshot: snapshot.Bytes(), 6258 } 6259 return err 6260 } 6261 6262 errorBody.Seek(0, io.SeekStart) 6263 return output 6264} 6265 6266func awsAwsjson11_deserializeErrorIncorrectKeyException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6267 var buff [1024]byte 6268 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6269 6270 body := io.TeeReader(errorBody, ringBuffer) 6271 decoder := json.NewDecoder(body) 6272 decoder.UseNumber() 6273 var shape interface{} 6274 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6275 var snapshot bytes.Buffer 6276 io.Copy(&snapshot, ringBuffer) 6277 err = &smithy.DeserializationError{ 6278 Err: fmt.Errorf("failed to decode response body, %w", err), 6279 Snapshot: snapshot.Bytes(), 6280 } 6281 return err 6282 } 6283 6284 output := &types.IncorrectKeyException{} 6285 err := awsAwsjson11_deserializeDocumentIncorrectKeyException(&output, shape) 6286 6287 if err != nil { 6288 var snapshot bytes.Buffer 6289 io.Copy(&snapshot, ringBuffer) 6290 err = &smithy.DeserializationError{ 6291 Err: fmt.Errorf("failed to decode response body, %w", err), 6292 Snapshot: snapshot.Bytes(), 6293 } 6294 return err 6295 } 6296 6297 errorBody.Seek(0, io.SeekStart) 6298 return output 6299} 6300 6301func awsAwsjson11_deserializeErrorIncorrectKeyMaterialException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6302 var buff [1024]byte 6303 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6304 6305 body := io.TeeReader(errorBody, ringBuffer) 6306 decoder := json.NewDecoder(body) 6307 decoder.UseNumber() 6308 var shape interface{} 6309 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6310 var snapshot bytes.Buffer 6311 io.Copy(&snapshot, ringBuffer) 6312 err = &smithy.DeserializationError{ 6313 Err: fmt.Errorf("failed to decode response body, %w", err), 6314 Snapshot: snapshot.Bytes(), 6315 } 6316 return err 6317 } 6318 6319 output := &types.IncorrectKeyMaterialException{} 6320 err := awsAwsjson11_deserializeDocumentIncorrectKeyMaterialException(&output, shape) 6321 6322 if err != nil { 6323 var snapshot bytes.Buffer 6324 io.Copy(&snapshot, ringBuffer) 6325 err = &smithy.DeserializationError{ 6326 Err: fmt.Errorf("failed to decode response body, %w", err), 6327 Snapshot: snapshot.Bytes(), 6328 } 6329 return err 6330 } 6331 6332 errorBody.Seek(0, io.SeekStart) 6333 return output 6334} 6335 6336func awsAwsjson11_deserializeErrorIncorrectTrustAnchorException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6337 var buff [1024]byte 6338 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6339 6340 body := io.TeeReader(errorBody, ringBuffer) 6341 decoder := json.NewDecoder(body) 6342 decoder.UseNumber() 6343 var shape interface{} 6344 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6345 var snapshot bytes.Buffer 6346 io.Copy(&snapshot, ringBuffer) 6347 err = &smithy.DeserializationError{ 6348 Err: fmt.Errorf("failed to decode response body, %w", err), 6349 Snapshot: snapshot.Bytes(), 6350 } 6351 return err 6352 } 6353 6354 output := &types.IncorrectTrustAnchorException{} 6355 err := awsAwsjson11_deserializeDocumentIncorrectTrustAnchorException(&output, shape) 6356 6357 if err != nil { 6358 var snapshot bytes.Buffer 6359 io.Copy(&snapshot, ringBuffer) 6360 err = &smithy.DeserializationError{ 6361 Err: fmt.Errorf("failed to decode response body, %w", err), 6362 Snapshot: snapshot.Bytes(), 6363 } 6364 return err 6365 } 6366 6367 errorBody.Seek(0, io.SeekStart) 6368 return output 6369} 6370 6371func awsAwsjson11_deserializeErrorInvalidAliasNameException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6372 var buff [1024]byte 6373 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6374 6375 body := io.TeeReader(errorBody, ringBuffer) 6376 decoder := json.NewDecoder(body) 6377 decoder.UseNumber() 6378 var shape interface{} 6379 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6380 var snapshot bytes.Buffer 6381 io.Copy(&snapshot, ringBuffer) 6382 err = &smithy.DeserializationError{ 6383 Err: fmt.Errorf("failed to decode response body, %w", err), 6384 Snapshot: snapshot.Bytes(), 6385 } 6386 return err 6387 } 6388 6389 output := &types.InvalidAliasNameException{} 6390 err := awsAwsjson11_deserializeDocumentInvalidAliasNameException(&output, shape) 6391 6392 if err != nil { 6393 var snapshot bytes.Buffer 6394 io.Copy(&snapshot, ringBuffer) 6395 err = &smithy.DeserializationError{ 6396 Err: fmt.Errorf("failed to decode response body, %w", err), 6397 Snapshot: snapshot.Bytes(), 6398 } 6399 return err 6400 } 6401 6402 errorBody.Seek(0, io.SeekStart) 6403 return output 6404} 6405 6406func awsAwsjson11_deserializeErrorInvalidArnException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6407 var buff [1024]byte 6408 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6409 6410 body := io.TeeReader(errorBody, ringBuffer) 6411 decoder := json.NewDecoder(body) 6412 decoder.UseNumber() 6413 var shape interface{} 6414 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6415 var snapshot bytes.Buffer 6416 io.Copy(&snapshot, ringBuffer) 6417 err = &smithy.DeserializationError{ 6418 Err: fmt.Errorf("failed to decode response body, %w", err), 6419 Snapshot: snapshot.Bytes(), 6420 } 6421 return err 6422 } 6423 6424 output := &types.InvalidArnException{} 6425 err := awsAwsjson11_deserializeDocumentInvalidArnException(&output, shape) 6426 6427 if err != nil { 6428 var snapshot bytes.Buffer 6429 io.Copy(&snapshot, ringBuffer) 6430 err = &smithy.DeserializationError{ 6431 Err: fmt.Errorf("failed to decode response body, %w", err), 6432 Snapshot: snapshot.Bytes(), 6433 } 6434 return err 6435 } 6436 6437 errorBody.Seek(0, io.SeekStart) 6438 return output 6439} 6440 6441func awsAwsjson11_deserializeErrorInvalidCiphertextException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6442 var buff [1024]byte 6443 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6444 6445 body := io.TeeReader(errorBody, ringBuffer) 6446 decoder := json.NewDecoder(body) 6447 decoder.UseNumber() 6448 var shape interface{} 6449 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6450 var snapshot bytes.Buffer 6451 io.Copy(&snapshot, ringBuffer) 6452 err = &smithy.DeserializationError{ 6453 Err: fmt.Errorf("failed to decode response body, %w", err), 6454 Snapshot: snapshot.Bytes(), 6455 } 6456 return err 6457 } 6458 6459 output := &types.InvalidCiphertextException{} 6460 err := awsAwsjson11_deserializeDocumentInvalidCiphertextException(&output, shape) 6461 6462 if err != nil { 6463 var snapshot bytes.Buffer 6464 io.Copy(&snapshot, ringBuffer) 6465 err = &smithy.DeserializationError{ 6466 Err: fmt.Errorf("failed to decode response body, %w", err), 6467 Snapshot: snapshot.Bytes(), 6468 } 6469 return err 6470 } 6471 6472 errorBody.Seek(0, io.SeekStart) 6473 return output 6474} 6475 6476func awsAwsjson11_deserializeErrorInvalidGrantIdException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6477 var buff [1024]byte 6478 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6479 6480 body := io.TeeReader(errorBody, ringBuffer) 6481 decoder := json.NewDecoder(body) 6482 decoder.UseNumber() 6483 var shape interface{} 6484 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6485 var snapshot bytes.Buffer 6486 io.Copy(&snapshot, ringBuffer) 6487 err = &smithy.DeserializationError{ 6488 Err: fmt.Errorf("failed to decode response body, %w", err), 6489 Snapshot: snapshot.Bytes(), 6490 } 6491 return err 6492 } 6493 6494 output := &types.InvalidGrantIdException{} 6495 err := awsAwsjson11_deserializeDocumentInvalidGrantIdException(&output, shape) 6496 6497 if err != nil { 6498 var snapshot bytes.Buffer 6499 io.Copy(&snapshot, ringBuffer) 6500 err = &smithy.DeserializationError{ 6501 Err: fmt.Errorf("failed to decode response body, %w", err), 6502 Snapshot: snapshot.Bytes(), 6503 } 6504 return err 6505 } 6506 6507 errorBody.Seek(0, io.SeekStart) 6508 return output 6509} 6510 6511func awsAwsjson11_deserializeErrorInvalidGrantTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6512 var buff [1024]byte 6513 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6514 6515 body := io.TeeReader(errorBody, ringBuffer) 6516 decoder := json.NewDecoder(body) 6517 decoder.UseNumber() 6518 var shape interface{} 6519 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6520 var snapshot bytes.Buffer 6521 io.Copy(&snapshot, ringBuffer) 6522 err = &smithy.DeserializationError{ 6523 Err: fmt.Errorf("failed to decode response body, %w", err), 6524 Snapshot: snapshot.Bytes(), 6525 } 6526 return err 6527 } 6528 6529 output := &types.InvalidGrantTokenException{} 6530 err := awsAwsjson11_deserializeDocumentInvalidGrantTokenException(&output, shape) 6531 6532 if err != nil { 6533 var snapshot bytes.Buffer 6534 io.Copy(&snapshot, ringBuffer) 6535 err = &smithy.DeserializationError{ 6536 Err: fmt.Errorf("failed to decode response body, %w", err), 6537 Snapshot: snapshot.Bytes(), 6538 } 6539 return err 6540 } 6541 6542 errorBody.Seek(0, io.SeekStart) 6543 return output 6544} 6545 6546func awsAwsjson11_deserializeErrorInvalidImportTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6547 var buff [1024]byte 6548 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6549 6550 body := io.TeeReader(errorBody, ringBuffer) 6551 decoder := json.NewDecoder(body) 6552 decoder.UseNumber() 6553 var shape interface{} 6554 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6555 var snapshot bytes.Buffer 6556 io.Copy(&snapshot, ringBuffer) 6557 err = &smithy.DeserializationError{ 6558 Err: fmt.Errorf("failed to decode response body, %w", err), 6559 Snapshot: snapshot.Bytes(), 6560 } 6561 return err 6562 } 6563 6564 output := &types.InvalidImportTokenException{} 6565 err := awsAwsjson11_deserializeDocumentInvalidImportTokenException(&output, shape) 6566 6567 if err != nil { 6568 var snapshot bytes.Buffer 6569 io.Copy(&snapshot, ringBuffer) 6570 err = &smithy.DeserializationError{ 6571 Err: fmt.Errorf("failed to decode response body, %w", err), 6572 Snapshot: snapshot.Bytes(), 6573 } 6574 return err 6575 } 6576 6577 errorBody.Seek(0, io.SeekStart) 6578 return output 6579} 6580 6581func awsAwsjson11_deserializeErrorInvalidKeyUsageException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6582 var buff [1024]byte 6583 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6584 6585 body := io.TeeReader(errorBody, ringBuffer) 6586 decoder := json.NewDecoder(body) 6587 decoder.UseNumber() 6588 var shape interface{} 6589 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6590 var snapshot bytes.Buffer 6591 io.Copy(&snapshot, ringBuffer) 6592 err = &smithy.DeserializationError{ 6593 Err: fmt.Errorf("failed to decode response body, %w", err), 6594 Snapshot: snapshot.Bytes(), 6595 } 6596 return err 6597 } 6598 6599 output := &types.InvalidKeyUsageException{} 6600 err := awsAwsjson11_deserializeDocumentInvalidKeyUsageException(&output, shape) 6601 6602 if err != nil { 6603 var snapshot bytes.Buffer 6604 io.Copy(&snapshot, ringBuffer) 6605 err = &smithy.DeserializationError{ 6606 Err: fmt.Errorf("failed to decode response body, %w", err), 6607 Snapshot: snapshot.Bytes(), 6608 } 6609 return err 6610 } 6611 6612 errorBody.Seek(0, io.SeekStart) 6613 return output 6614} 6615 6616func awsAwsjson11_deserializeErrorInvalidMarkerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6617 var buff [1024]byte 6618 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6619 6620 body := io.TeeReader(errorBody, ringBuffer) 6621 decoder := json.NewDecoder(body) 6622 decoder.UseNumber() 6623 var shape interface{} 6624 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6625 var snapshot bytes.Buffer 6626 io.Copy(&snapshot, ringBuffer) 6627 err = &smithy.DeserializationError{ 6628 Err: fmt.Errorf("failed to decode response body, %w", err), 6629 Snapshot: snapshot.Bytes(), 6630 } 6631 return err 6632 } 6633 6634 output := &types.InvalidMarkerException{} 6635 err := awsAwsjson11_deserializeDocumentInvalidMarkerException(&output, shape) 6636 6637 if err != nil { 6638 var snapshot bytes.Buffer 6639 io.Copy(&snapshot, ringBuffer) 6640 err = &smithy.DeserializationError{ 6641 Err: fmt.Errorf("failed to decode response body, %w", err), 6642 Snapshot: snapshot.Bytes(), 6643 } 6644 return err 6645 } 6646 6647 errorBody.Seek(0, io.SeekStart) 6648 return output 6649} 6650 6651func awsAwsjson11_deserializeErrorKeyUnavailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6652 var buff [1024]byte 6653 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6654 6655 body := io.TeeReader(errorBody, ringBuffer) 6656 decoder := json.NewDecoder(body) 6657 decoder.UseNumber() 6658 var shape interface{} 6659 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6660 var snapshot bytes.Buffer 6661 io.Copy(&snapshot, ringBuffer) 6662 err = &smithy.DeserializationError{ 6663 Err: fmt.Errorf("failed to decode response body, %w", err), 6664 Snapshot: snapshot.Bytes(), 6665 } 6666 return err 6667 } 6668 6669 output := &types.KeyUnavailableException{} 6670 err := awsAwsjson11_deserializeDocumentKeyUnavailableException(&output, shape) 6671 6672 if err != nil { 6673 var snapshot bytes.Buffer 6674 io.Copy(&snapshot, ringBuffer) 6675 err = &smithy.DeserializationError{ 6676 Err: fmt.Errorf("failed to decode response body, %w", err), 6677 Snapshot: snapshot.Bytes(), 6678 } 6679 return err 6680 } 6681 6682 errorBody.Seek(0, io.SeekStart) 6683 return output 6684} 6685 6686func awsAwsjson11_deserializeErrorKMSInternalException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6687 var buff [1024]byte 6688 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6689 6690 body := io.TeeReader(errorBody, ringBuffer) 6691 decoder := json.NewDecoder(body) 6692 decoder.UseNumber() 6693 var shape interface{} 6694 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6695 var snapshot bytes.Buffer 6696 io.Copy(&snapshot, ringBuffer) 6697 err = &smithy.DeserializationError{ 6698 Err: fmt.Errorf("failed to decode response body, %w", err), 6699 Snapshot: snapshot.Bytes(), 6700 } 6701 return err 6702 } 6703 6704 output := &types.KMSInternalException{} 6705 err := awsAwsjson11_deserializeDocumentKMSInternalException(&output, shape) 6706 6707 if err != nil { 6708 var snapshot bytes.Buffer 6709 io.Copy(&snapshot, ringBuffer) 6710 err = &smithy.DeserializationError{ 6711 Err: fmt.Errorf("failed to decode response body, %w", err), 6712 Snapshot: snapshot.Bytes(), 6713 } 6714 return err 6715 } 6716 6717 errorBody.Seek(0, io.SeekStart) 6718 return output 6719} 6720 6721func awsAwsjson11_deserializeErrorKMSInvalidSignatureException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6722 var buff [1024]byte 6723 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6724 6725 body := io.TeeReader(errorBody, ringBuffer) 6726 decoder := json.NewDecoder(body) 6727 decoder.UseNumber() 6728 var shape interface{} 6729 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6730 var snapshot bytes.Buffer 6731 io.Copy(&snapshot, ringBuffer) 6732 err = &smithy.DeserializationError{ 6733 Err: fmt.Errorf("failed to decode response body, %w", err), 6734 Snapshot: snapshot.Bytes(), 6735 } 6736 return err 6737 } 6738 6739 output := &types.KMSInvalidSignatureException{} 6740 err := awsAwsjson11_deserializeDocumentKMSInvalidSignatureException(&output, shape) 6741 6742 if err != nil { 6743 var snapshot bytes.Buffer 6744 io.Copy(&snapshot, ringBuffer) 6745 err = &smithy.DeserializationError{ 6746 Err: fmt.Errorf("failed to decode response body, %w", err), 6747 Snapshot: snapshot.Bytes(), 6748 } 6749 return err 6750 } 6751 6752 errorBody.Seek(0, io.SeekStart) 6753 return output 6754} 6755 6756func awsAwsjson11_deserializeErrorKMSInvalidStateException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6757 var buff [1024]byte 6758 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6759 6760 body := io.TeeReader(errorBody, ringBuffer) 6761 decoder := json.NewDecoder(body) 6762 decoder.UseNumber() 6763 var shape interface{} 6764 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6765 var snapshot bytes.Buffer 6766 io.Copy(&snapshot, ringBuffer) 6767 err = &smithy.DeserializationError{ 6768 Err: fmt.Errorf("failed to decode response body, %w", err), 6769 Snapshot: snapshot.Bytes(), 6770 } 6771 return err 6772 } 6773 6774 output := &types.KMSInvalidStateException{} 6775 err := awsAwsjson11_deserializeDocumentKMSInvalidStateException(&output, shape) 6776 6777 if err != nil { 6778 var snapshot bytes.Buffer 6779 io.Copy(&snapshot, ringBuffer) 6780 err = &smithy.DeserializationError{ 6781 Err: fmt.Errorf("failed to decode response body, %w", err), 6782 Snapshot: snapshot.Bytes(), 6783 } 6784 return err 6785 } 6786 6787 errorBody.Seek(0, io.SeekStart) 6788 return output 6789} 6790 6791func awsAwsjson11_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6792 var buff [1024]byte 6793 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6794 6795 body := io.TeeReader(errorBody, ringBuffer) 6796 decoder := json.NewDecoder(body) 6797 decoder.UseNumber() 6798 var shape interface{} 6799 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6800 var snapshot bytes.Buffer 6801 io.Copy(&snapshot, ringBuffer) 6802 err = &smithy.DeserializationError{ 6803 Err: fmt.Errorf("failed to decode response body, %w", err), 6804 Snapshot: snapshot.Bytes(), 6805 } 6806 return err 6807 } 6808 6809 output := &types.LimitExceededException{} 6810 err := awsAwsjson11_deserializeDocumentLimitExceededException(&output, shape) 6811 6812 if err != nil { 6813 var snapshot bytes.Buffer 6814 io.Copy(&snapshot, ringBuffer) 6815 err = &smithy.DeserializationError{ 6816 Err: fmt.Errorf("failed to decode response body, %w", err), 6817 Snapshot: snapshot.Bytes(), 6818 } 6819 return err 6820 } 6821 6822 errorBody.Seek(0, io.SeekStart) 6823 return output 6824} 6825 6826func awsAwsjson11_deserializeErrorMalformedPolicyDocumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6827 var buff [1024]byte 6828 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6829 6830 body := io.TeeReader(errorBody, ringBuffer) 6831 decoder := json.NewDecoder(body) 6832 decoder.UseNumber() 6833 var shape interface{} 6834 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6835 var snapshot bytes.Buffer 6836 io.Copy(&snapshot, ringBuffer) 6837 err = &smithy.DeserializationError{ 6838 Err: fmt.Errorf("failed to decode response body, %w", err), 6839 Snapshot: snapshot.Bytes(), 6840 } 6841 return err 6842 } 6843 6844 output := &types.MalformedPolicyDocumentException{} 6845 err := awsAwsjson11_deserializeDocumentMalformedPolicyDocumentException(&output, shape) 6846 6847 if err != nil { 6848 var snapshot bytes.Buffer 6849 io.Copy(&snapshot, ringBuffer) 6850 err = &smithy.DeserializationError{ 6851 Err: fmt.Errorf("failed to decode response body, %w", err), 6852 Snapshot: snapshot.Bytes(), 6853 } 6854 return err 6855 } 6856 6857 errorBody.Seek(0, io.SeekStart) 6858 return output 6859} 6860 6861func awsAwsjson11_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6862 var buff [1024]byte 6863 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6864 6865 body := io.TeeReader(errorBody, ringBuffer) 6866 decoder := json.NewDecoder(body) 6867 decoder.UseNumber() 6868 var shape interface{} 6869 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6870 var snapshot bytes.Buffer 6871 io.Copy(&snapshot, ringBuffer) 6872 err = &smithy.DeserializationError{ 6873 Err: fmt.Errorf("failed to decode response body, %w", err), 6874 Snapshot: snapshot.Bytes(), 6875 } 6876 return err 6877 } 6878 6879 output := &types.NotFoundException{} 6880 err := awsAwsjson11_deserializeDocumentNotFoundException(&output, shape) 6881 6882 if err != nil { 6883 var snapshot bytes.Buffer 6884 io.Copy(&snapshot, ringBuffer) 6885 err = &smithy.DeserializationError{ 6886 Err: fmt.Errorf("failed to decode response body, %w", err), 6887 Snapshot: snapshot.Bytes(), 6888 } 6889 return err 6890 } 6891 6892 errorBody.Seek(0, io.SeekStart) 6893 return output 6894} 6895 6896func awsAwsjson11_deserializeErrorTagException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6897 var buff [1024]byte 6898 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6899 6900 body := io.TeeReader(errorBody, ringBuffer) 6901 decoder := json.NewDecoder(body) 6902 decoder.UseNumber() 6903 var shape interface{} 6904 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6905 var snapshot bytes.Buffer 6906 io.Copy(&snapshot, ringBuffer) 6907 err = &smithy.DeserializationError{ 6908 Err: fmt.Errorf("failed to decode response body, %w", err), 6909 Snapshot: snapshot.Bytes(), 6910 } 6911 return err 6912 } 6913 6914 output := &types.TagException{} 6915 err := awsAwsjson11_deserializeDocumentTagException(&output, shape) 6916 6917 if err != nil { 6918 var snapshot bytes.Buffer 6919 io.Copy(&snapshot, ringBuffer) 6920 err = &smithy.DeserializationError{ 6921 Err: fmt.Errorf("failed to decode response body, %w", err), 6922 Snapshot: snapshot.Bytes(), 6923 } 6924 return err 6925 } 6926 6927 errorBody.Seek(0, io.SeekStart) 6928 return output 6929} 6930 6931func awsAwsjson11_deserializeErrorUnsupportedOperationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6932 var buff [1024]byte 6933 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6934 6935 body := io.TeeReader(errorBody, ringBuffer) 6936 decoder := json.NewDecoder(body) 6937 decoder.UseNumber() 6938 var shape interface{} 6939 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6940 var snapshot bytes.Buffer 6941 io.Copy(&snapshot, ringBuffer) 6942 err = &smithy.DeserializationError{ 6943 Err: fmt.Errorf("failed to decode response body, %w", err), 6944 Snapshot: snapshot.Bytes(), 6945 } 6946 return err 6947 } 6948 6949 output := &types.UnsupportedOperationException{} 6950 err := awsAwsjson11_deserializeDocumentUnsupportedOperationException(&output, shape) 6951 6952 if err != nil { 6953 var snapshot bytes.Buffer 6954 io.Copy(&snapshot, ringBuffer) 6955 err = &smithy.DeserializationError{ 6956 Err: fmt.Errorf("failed to decode response body, %w", err), 6957 Snapshot: snapshot.Bytes(), 6958 } 6959 return err 6960 } 6961 6962 errorBody.Seek(0, io.SeekStart) 6963 return output 6964} 6965 6966func awsAwsjson11_deserializeDocumentAliasList(v *[]types.AliasListEntry, value interface{}) error { 6967 if v == nil { 6968 return fmt.Errorf("unexpected nil of type %T", v) 6969 } 6970 if value == nil { 6971 return nil 6972 } 6973 6974 shape, ok := value.([]interface{}) 6975 if !ok { 6976 return fmt.Errorf("unexpected JSON type %v", value) 6977 } 6978 6979 var cv []types.AliasListEntry 6980 if *v == nil { 6981 cv = []types.AliasListEntry{} 6982 } else { 6983 cv = *v 6984 } 6985 6986 for _, value := range shape { 6987 var col types.AliasListEntry 6988 destAddr := &col 6989 if err := awsAwsjson11_deserializeDocumentAliasListEntry(&destAddr, value); err != nil { 6990 return err 6991 } 6992 col = *destAddr 6993 cv = append(cv, col) 6994 6995 } 6996 *v = cv 6997 return nil 6998} 6999 7000func awsAwsjson11_deserializeDocumentAliasListEntry(v **types.AliasListEntry, value interface{}) error { 7001 if v == nil { 7002 return fmt.Errorf("unexpected nil of type %T", v) 7003 } 7004 if value == nil { 7005 return nil 7006 } 7007 7008 shape, ok := value.(map[string]interface{}) 7009 if !ok { 7010 return fmt.Errorf("unexpected JSON type %v", value) 7011 } 7012 7013 var sv *types.AliasListEntry 7014 if *v == nil { 7015 sv = &types.AliasListEntry{} 7016 } else { 7017 sv = *v 7018 } 7019 7020 for key, value := range shape { 7021 switch key { 7022 case "AliasArn": 7023 if value != nil { 7024 jtv, ok := value.(string) 7025 if !ok { 7026 return fmt.Errorf("expected ArnType to be of type string, got %T instead", value) 7027 } 7028 sv.AliasArn = ptr.String(jtv) 7029 } 7030 7031 case "AliasName": 7032 if value != nil { 7033 jtv, ok := value.(string) 7034 if !ok { 7035 return fmt.Errorf("expected AliasNameType to be of type string, got %T instead", value) 7036 } 7037 sv.AliasName = ptr.String(jtv) 7038 } 7039 7040 case "CreationDate": 7041 if value != nil { 7042 switch jtv := value.(type) { 7043 case json.Number: 7044 f64, err := jtv.Float64() 7045 if err != nil { 7046 return err 7047 } 7048 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7049 7050 default: 7051 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 7052 7053 } 7054 } 7055 7056 case "LastUpdatedDate": 7057 if value != nil { 7058 switch jtv := value.(type) { 7059 case json.Number: 7060 f64, err := jtv.Float64() 7061 if err != nil { 7062 return err 7063 } 7064 sv.LastUpdatedDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7065 7066 default: 7067 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 7068 7069 } 7070 } 7071 7072 case "TargetKeyId": 7073 if value != nil { 7074 jtv, ok := value.(string) 7075 if !ok { 7076 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 7077 } 7078 sv.TargetKeyId = ptr.String(jtv) 7079 } 7080 7081 default: 7082 _, _ = key, value 7083 7084 } 7085 } 7086 *v = sv 7087 return nil 7088} 7089 7090func awsAwsjson11_deserializeDocumentAlreadyExistsException(v **types.AlreadyExistsException, value interface{}) error { 7091 if v == nil { 7092 return fmt.Errorf("unexpected nil of type %T", v) 7093 } 7094 if value == nil { 7095 return nil 7096 } 7097 7098 shape, ok := value.(map[string]interface{}) 7099 if !ok { 7100 return fmt.Errorf("unexpected JSON type %v", value) 7101 } 7102 7103 var sv *types.AlreadyExistsException 7104 if *v == nil { 7105 sv = &types.AlreadyExistsException{} 7106 } else { 7107 sv = *v 7108 } 7109 7110 for key, value := range shape { 7111 switch key { 7112 case "message": 7113 if value != nil { 7114 jtv, ok := value.(string) 7115 if !ok { 7116 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7117 } 7118 sv.Message = ptr.String(jtv) 7119 } 7120 7121 default: 7122 _, _ = key, value 7123 7124 } 7125 } 7126 *v = sv 7127 return nil 7128} 7129 7130func awsAwsjson11_deserializeDocumentCloudHsmClusterInUseException(v **types.CloudHsmClusterInUseException, value interface{}) error { 7131 if v == nil { 7132 return fmt.Errorf("unexpected nil of type %T", v) 7133 } 7134 if value == nil { 7135 return nil 7136 } 7137 7138 shape, ok := value.(map[string]interface{}) 7139 if !ok { 7140 return fmt.Errorf("unexpected JSON type %v", value) 7141 } 7142 7143 var sv *types.CloudHsmClusterInUseException 7144 if *v == nil { 7145 sv = &types.CloudHsmClusterInUseException{} 7146 } else { 7147 sv = *v 7148 } 7149 7150 for key, value := range shape { 7151 switch key { 7152 case "message": 7153 if value != nil { 7154 jtv, ok := value.(string) 7155 if !ok { 7156 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7157 } 7158 sv.Message = ptr.String(jtv) 7159 } 7160 7161 default: 7162 _, _ = key, value 7163 7164 } 7165 } 7166 *v = sv 7167 return nil 7168} 7169 7170func awsAwsjson11_deserializeDocumentCloudHsmClusterInvalidConfigurationException(v **types.CloudHsmClusterInvalidConfigurationException, value interface{}) error { 7171 if v == nil { 7172 return fmt.Errorf("unexpected nil of type %T", v) 7173 } 7174 if value == nil { 7175 return nil 7176 } 7177 7178 shape, ok := value.(map[string]interface{}) 7179 if !ok { 7180 return fmt.Errorf("unexpected JSON type %v", value) 7181 } 7182 7183 var sv *types.CloudHsmClusterInvalidConfigurationException 7184 if *v == nil { 7185 sv = &types.CloudHsmClusterInvalidConfigurationException{} 7186 } else { 7187 sv = *v 7188 } 7189 7190 for key, value := range shape { 7191 switch key { 7192 case "message": 7193 if value != nil { 7194 jtv, ok := value.(string) 7195 if !ok { 7196 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7197 } 7198 sv.Message = ptr.String(jtv) 7199 } 7200 7201 default: 7202 _, _ = key, value 7203 7204 } 7205 } 7206 *v = sv 7207 return nil 7208} 7209 7210func awsAwsjson11_deserializeDocumentCloudHsmClusterNotActiveException(v **types.CloudHsmClusterNotActiveException, value interface{}) error { 7211 if v == nil { 7212 return fmt.Errorf("unexpected nil of type %T", v) 7213 } 7214 if value == nil { 7215 return nil 7216 } 7217 7218 shape, ok := value.(map[string]interface{}) 7219 if !ok { 7220 return fmt.Errorf("unexpected JSON type %v", value) 7221 } 7222 7223 var sv *types.CloudHsmClusterNotActiveException 7224 if *v == nil { 7225 sv = &types.CloudHsmClusterNotActiveException{} 7226 } else { 7227 sv = *v 7228 } 7229 7230 for key, value := range shape { 7231 switch key { 7232 case "message": 7233 if value != nil { 7234 jtv, ok := value.(string) 7235 if !ok { 7236 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7237 } 7238 sv.Message = ptr.String(jtv) 7239 } 7240 7241 default: 7242 _, _ = key, value 7243 7244 } 7245 } 7246 *v = sv 7247 return nil 7248} 7249 7250func awsAwsjson11_deserializeDocumentCloudHsmClusterNotFoundException(v **types.CloudHsmClusterNotFoundException, value interface{}) error { 7251 if v == nil { 7252 return fmt.Errorf("unexpected nil of type %T", v) 7253 } 7254 if value == nil { 7255 return nil 7256 } 7257 7258 shape, ok := value.(map[string]interface{}) 7259 if !ok { 7260 return fmt.Errorf("unexpected JSON type %v", value) 7261 } 7262 7263 var sv *types.CloudHsmClusterNotFoundException 7264 if *v == nil { 7265 sv = &types.CloudHsmClusterNotFoundException{} 7266 } else { 7267 sv = *v 7268 } 7269 7270 for key, value := range shape { 7271 switch key { 7272 case "message": 7273 if value != nil { 7274 jtv, ok := value.(string) 7275 if !ok { 7276 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7277 } 7278 sv.Message = ptr.String(jtv) 7279 } 7280 7281 default: 7282 _, _ = key, value 7283 7284 } 7285 } 7286 *v = sv 7287 return nil 7288} 7289 7290func awsAwsjson11_deserializeDocumentCloudHsmClusterNotRelatedException(v **types.CloudHsmClusterNotRelatedException, value interface{}) error { 7291 if v == nil { 7292 return fmt.Errorf("unexpected nil of type %T", v) 7293 } 7294 if value == nil { 7295 return nil 7296 } 7297 7298 shape, ok := value.(map[string]interface{}) 7299 if !ok { 7300 return fmt.Errorf("unexpected JSON type %v", value) 7301 } 7302 7303 var sv *types.CloudHsmClusterNotRelatedException 7304 if *v == nil { 7305 sv = &types.CloudHsmClusterNotRelatedException{} 7306 } else { 7307 sv = *v 7308 } 7309 7310 for key, value := range shape { 7311 switch key { 7312 case "message": 7313 if value != nil { 7314 jtv, ok := value.(string) 7315 if !ok { 7316 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7317 } 7318 sv.Message = ptr.String(jtv) 7319 } 7320 7321 default: 7322 _, _ = key, value 7323 7324 } 7325 } 7326 *v = sv 7327 return nil 7328} 7329 7330func awsAwsjson11_deserializeDocumentCustomKeyStoreHasCMKsException(v **types.CustomKeyStoreHasCMKsException, value interface{}) error { 7331 if v == nil { 7332 return fmt.Errorf("unexpected nil of type %T", v) 7333 } 7334 if value == nil { 7335 return nil 7336 } 7337 7338 shape, ok := value.(map[string]interface{}) 7339 if !ok { 7340 return fmt.Errorf("unexpected JSON type %v", value) 7341 } 7342 7343 var sv *types.CustomKeyStoreHasCMKsException 7344 if *v == nil { 7345 sv = &types.CustomKeyStoreHasCMKsException{} 7346 } else { 7347 sv = *v 7348 } 7349 7350 for key, value := range shape { 7351 switch key { 7352 case "message": 7353 if value != nil { 7354 jtv, ok := value.(string) 7355 if !ok { 7356 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7357 } 7358 sv.Message = ptr.String(jtv) 7359 } 7360 7361 default: 7362 _, _ = key, value 7363 7364 } 7365 } 7366 *v = sv 7367 return nil 7368} 7369 7370func awsAwsjson11_deserializeDocumentCustomKeyStoreInvalidStateException(v **types.CustomKeyStoreInvalidStateException, value interface{}) error { 7371 if v == nil { 7372 return fmt.Errorf("unexpected nil of type %T", v) 7373 } 7374 if value == nil { 7375 return nil 7376 } 7377 7378 shape, ok := value.(map[string]interface{}) 7379 if !ok { 7380 return fmt.Errorf("unexpected JSON type %v", value) 7381 } 7382 7383 var sv *types.CustomKeyStoreInvalidStateException 7384 if *v == nil { 7385 sv = &types.CustomKeyStoreInvalidStateException{} 7386 } else { 7387 sv = *v 7388 } 7389 7390 for key, value := range shape { 7391 switch key { 7392 case "message": 7393 if value != nil { 7394 jtv, ok := value.(string) 7395 if !ok { 7396 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7397 } 7398 sv.Message = ptr.String(jtv) 7399 } 7400 7401 default: 7402 _, _ = key, value 7403 7404 } 7405 } 7406 *v = sv 7407 return nil 7408} 7409 7410func awsAwsjson11_deserializeDocumentCustomKeyStoreNameInUseException(v **types.CustomKeyStoreNameInUseException, value interface{}) error { 7411 if v == nil { 7412 return fmt.Errorf("unexpected nil of type %T", v) 7413 } 7414 if value == nil { 7415 return nil 7416 } 7417 7418 shape, ok := value.(map[string]interface{}) 7419 if !ok { 7420 return fmt.Errorf("unexpected JSON type %v", value) 7421 } 7422 7423 var sv *types.CustomKeyStoreNameInUseException 7424 if *v == nil { 7425 sv = &types.CustomKeyStoreNameInUseException{} 7426 } else { 7427 sv = *v 7428 } 7429 7430 for key, value := range shape { 7431 switch key { 7432 case "message": 7433 if value != nil { 7434 jtv, ok := value.(string) 7435 if !ok { 7436 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7437 } 7438 sv.Message = ptr.String(jtv) 7439 } 7440 7441 default: 7442 _, _ = key, value 7443 7444 } 7445 } 7446 *v = sv 7447 return nil 7448} 7449 7450func awsAwsjson11_deserializeDocumentCustomKeyStoreNotFoundException(v **types.CustomKeyStoreNotFoundException, value interface{}) error { 7451 if v == nil { 7452 return fmt.Errorf("unexpected nil of type %T", v) 7453 } 7454 if value == nil { 7455 return nil 7456 } 7457 7458 shape, ok := value.(map[string]interface{}) 7459 if !ok { 7460 return fmt.Errorf("unexpected JSON type %v", value) 7461 } 7462 7463 var sv *types.CustomKeyStoreNotFoundException 7464 if *v == nil { 7465 sv = &types.CustomKeyStoreNotFoundException{} 7466 } else { 7467 sv = *v 7468 } 7469 7470 for key, value := range shape { 7471 switch key { 7472 case "message": 7473 if value != nil { 7474 jtv, ok := value.(string) 7475 if !ok { 7476 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7477 } 7478 sv.Message = ptr.String(jtv) 7479 } 7480 7481 default: 7482 _, _ = key, value 7483 7484 } 7485 } 7486 *v = sv 7487 return nil 7488} 7489 7490func awsAwsjson11_deserializeDocumentCustomKeyStoresList(v *[]types.CustomKeyStoresListEntry, value interface{}) error { 7491 if v == nil { 7492 return fmt.Errorf("unexpected nil of type %T", v) 7493 } 7494 if value == nil { 7495 return nil 7496 } 7497 7498 shape, ok := value.([]interface{}) 7499 if !ok { 7500 return fmt.Errorf("unexpected JSON type %v", value) 7501 } 7502 7503 var cv []types.CustomKeyStoresListEntry 7504 if *v == nil { 7505 cv = []types.CustomKeyStoresListEntry{} 7506 } else { 7507 cv = *v 7508 } 7509 7510 for _, value := range shape { 7511 var col types.CustomKeyStoresListEntry 7512 destAddr := &col 7513 if err := awsAwsjson11_deserializeDocumentCustomKeyStoresListEntry(&destAddr, value); err != nil { 7514 return err 7515 } 7516 col = *destAddr 7517 cv = append(cv, col) 7518 7519 } 7520 *v = cv 7521 return nil 7522} 7523 7524func awsAwsjson11_deserializeDocumentCustomKeyStoresListEntry(v **types.CustomKeyStoresListEntry, value interface{}) error { 7525 if v == nil { 7526 return fmt.Errorf("unexpected nil of type %T", v) 7527 } 7528 if value == nil { 7529 return nil 7530 } 7531 7532 shape, ok := value.(map[string]interface{}) 7533 if !ok { 7534 return fmt.Errorf("unexpected JSON type %v", value) 7535 } 7536 7537 var sv *types.CustomKeyStoresListEntry 7538 if *v == nil { 7539 sv = &types.CustomKeyStoresListEntry{} 7540 } else { 7541 sv = *v 7542 } 7543 7544 for key, value := range shape { 7545 switch key { 7546 case "CloudHsmClusterId": 7547 if value != nil { 7548 jtv, ok := value.(string) 7549 if !ok { 7550 return fmt.Errorf("expected CloudHsmClusterIdType to be of type string, got %T instead", value) 7551 } 7552 sv.CloudHsmClusterId = ptr.String(jtv) 7553 } 7554 7555 case "ConnectionErrorCode": 7556 if value != nil { 7557 jtv, ok := value.(string) 7558 if !ok { 7559 return fmt.Errorf("expected ConnectionErrorCodeType to be of type string, got %T instead", value) 7560 } 7561 sv.ConnectionErrorCode = types.ConnectionErrorCodeType(jtv) 7562 } 7563 7564 case "ConnectionState": 7565 if value != nil { 7566 jtv, ok := value.(string) 7567 if !ok { 7568 return fmt.Errorf("expected ConnectionStateType to be of type string, got %T instead", value) 7569 } 7570 sv.ConnectionState = types.ConnectionStateType(jtv) 7571 } 7572 7573 case "CreationDate": 7574 if value != nil { 7575 switch jtv := value.(type) { 7576 case json.Number: 7577 f64, err := jtv.Float64() 7578 if err != nil { 7579 return err 7580 } 7581 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7582 7583 default: 7584 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 7585 7586 } 7587 } 7588 7589 case "CustomKeyStoreId": 7590 if value != nil { 7591 jtv, ok := value.(string) 7592 if !ok { 7593 return fmt.Errorf("expected CustomKeyStoreIdType to be of type string, got %T instead", value) 7594 } 7595 sv.CustomKeyStoreId = ptr.String(jtv) 7596 } 7597 7598 case "CustomKeyStoreName": 7599 if value != nil { 7600 jtv, ok := value.(string) 7601 if !ok { 7602 return fmt.Errorf("expected CustomKeyStoreNameType to be of type string, got %T instead", value) 7603 } 7604 sv.CustomKeyStoreName = ptr.String(jtv) 7605 } 7606 7607 case "TrustAnchorCertificate": 7608 if value != nil { 7609 jtv, ok := value.(string) 7610 if !ok { 7611 return fmt.Errorf("expected TrustAnchorCertificateType to be of type string, got %T instead", value) 7612 } 7613 sv.TrustAnchorCertificate = ptr.String(jtv) 7614 } 7615 7616 default: 7617 _, _ = key, value 7618 7619 } 7620 } 7621 *v = sv 7622 return nil 7623} 7624 7625func awsAwsjson11_deserializeDocumentDependencyTimeoutException(v **types.DependencyTimeoutException, value interface{}) error { 7626 if v == nil { 7627 return fmt.Errorf("unexpected nil of type %T", v) 7628 } 7629 if value == nil { 7630 return nil 7631 } 7632 7633 shape, ok := value.(map[string]interface{}) 7634 if !ok { 7635 return fmt.Errorf("unexpected JSON type %v", value) 7636 } 7637 7638 var sv *types.DependencyTimeoutException 7639 if *v == nil { 7640 sv = &types.DependencyTimeoutException{} 7641 } else { 7642 sv = *v 7643 } 7644 7645 for key, value := range shape { 7646 switch key { 7647 case "message": 7648 if value != nil { 7649 jtv, ok := value.(string) 7650 if !ok { 7651 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7652 } 7653 sv.Message = ptr.String(jtv) 7654 } 7655 7656 default: 7657 _, _ = key, value 7658 7659 } 7660 } 7661 *v = sv 7662 return nil 7663} 7664 7665func awsAwsjson11_deserializeDocumentDisabledException(v **types.DisabledException, value interface{}) error { 7666 if v == nil { 7667 return fmt.Errorf("unexpected nil of type %T", v) 7668 } 7669 if value == nil { 7670 return nil 7671 } 7672 7673 shape, ok := value.(map[string]interface{}) 7674 if !ok { 7675 return fmt.Errorf("unexpected JSON type %v", value) 7676 } 7677 7678 var sv *types.DisabledException 7679 if *v == nil { 7680 sv = &types.DisabledException{} 7681 } else { 7682 sv = *v 7683 } 7684 7685 for key, value := range shape { 7686 switch key { 7687 case "message": 7688 if value != nil { 7689 jtv, ok := value.(string) 7690 if !ok { 7691 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7692 } 7693 sv.Message = ptr.String(jtv) 7694 } 7695 7696 default: 7697 _, _ = key, value 7698 7699 } 7700 } 7701 *v = sv 7702 return nil 7703} 7704 7705func awsAwsjson11_deserializeDocumentEncryptionAlgorithmSpecList(v *[]types.EncryptionAlgorithmSpec, value interface{}) error { 7706 if v == nil { 7707 return fmt.Errorf("unexpected nil of type %T", v) 7708 } 7709 if value == nil { 7710 return nil 7711 } 7712 7713 shape, ok := value.([]interface{}) 7714 if !ok { 7715 return fmt.Errorf("unexpected JSON type %v", value) 7716 } 7717 7718 var cv []types.EncryptionAlgorithmSpec 7719 if *v == nil { 7720 cv = []types.EncryptionAlgorithmSpec{} 7721 } else { 7722 cv = *v 7723 } 7724 7725 for _, value := range shape { 7726 var col types.EncryptionAlgorithmSpec 7727 if value != nil { 7728 jtv, ok := value.(string) 7729 if !ok { 7730 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 7731 } 7732 col = types.EncryptionAlgorithmSpec(jtv) 7733 } 7734 cv = append(cv, col) 7735 7736 } 7737 *v = cv 7738 return nil 7739} 7740 7741func awsAwsjson11_deserializeDocumentEncryptionContextType(v *map[string]string, value interface{}) error { 7742 if v == nil { 7743 return fmt.Errorf("unexpected nil of type %T", v) 7744 } 7745 if value == nil { 7746 return nil 7747 } 7748 7749 shape, ok := value.(map[string]interface{}) 7750 if !ok { 7751 return fmt.Errorf("unexpected JSON type %v", value) 7752 } 7753 7754 var mv map[string]string 7755 if *v == nil { 7756 mv = map[string]string{} 7757 } else { 7758 mv = *v 7759 } 7760 7761 for key, value := range shape { 7762 var parsedVal string 7763 if value != nil { 7764 jtv, ok := value.(string) 7765 if !ok { 7766 return fmt.Errorf("expected EncryptionContextValue to be of type string, got %T instead", value) 7767 } 7768 parsedVal = jtv 7769 } 7770 mv[key] = parsedVal 7771 7772 } 7773 *v = mv 7774 return nil 7775} 7776 7777func awsAwsjson11_deserializeDocumentExpiredImportTokenException(v **types.ExpiredImportTokenException, value interface{}) error { 7778 if v == nil { 7779 return fmt.Errorf("unexpected nil of type %T", v) 7780 } 7781 if value == nil { 7782 return nil 7783 } 7784 7785 shape, ok := value.(map[string]interface{}) 7786 if !ok { 7787 return fmt.Errorf("unexpected JSON type %v", value) 7788 } 7789 7790 var sv *types.ExpiredImportTokenException 7791 if *v == nil { 7792 sv = &types.ExpiredImportTokenException{} 7793 } else { 7794 sv = *v 7795 } 7796 7797 for key, value := range shape { 7798 switch key { 7799 case "message": 7800 if value != nil { 7801 jtv, ok := value.(string) 7802 if !ok { 7803 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7804 } 7805 sv.Message = ptr.String(jtv) 7806 } 7807 7808 default: 7809 _, _ = key, value 7810 7811 } 7812 } 7813 *v = sv 7814 return nil 7815} 7816 7817func awsAwsjson11_deserializeDocumentGrantConstraints(v **types.GrantConstraints, value interface{}) error { 7818 if v == nil { 7819 return fmt.Errorf("unexpected nil of type %T", v) 7820 } 7821 if value == nil { 7822 return nil 7823 } 7824 7825 shape, ok := value.(map[string]interface{}) 7826 if !ok { 7827 return fmt.Errorf("unexpected JSON type %v", value) 7828 } 7829 7830 var sv *types.GrantConstraints 7831 if *v == nil { 7832 sv = &types.GrantConstraints{} 7833 } else { 7834 sv = *v 7835 } 7836 7837 for key, value := range shape { 7838 switch key { 7839 case "EncryptionContextEquals": 7840 if err := awsAwsjson11_deserializeDocumentEncryptionContextType(&sv.EncryptionContextEquals, value); err != nil { 7841 return err 7842 } 7843 7844 case "EncryptionContextSubset": 7845 if err := awsAwsjson11_deserializeDocumentEncryptionContextType(&sv.EncryptionContextSubset, value); err != nil { 7846 return err 7847 } 7848 7849 default: 7850 _, _ = key, value 7851 7852 } 7853 } 7854 *v = sv 7855 return nil 7856} 7857 7858func awsAwsjson11_deserializeDocumentGrantList(v *[]types.GrantListEntry, value interface{}) error { 7859 if v == nil { 7860 return fmt.Errorf("unexpected nil of type %T", v) 7861 } 7862 if value == nil { 7863 return nil 7864 } 7865 7866 shape, ok := value.([]interface{}) 7867 if !ok { 7868 return fmt.Errorf("unexpected JSON type %v", value) 7869 } 7870 7871 var cv []types.GrantListEntry 7872 if *v == nil { 7873 cv = []types.GrantListEntry{} 7874 } else { 7875 cv = *v 7876 } 7877 7878 for _, value := range shape { 7879 var col types.GrantListEntry 7880 destAddr := &col 7881 if err := awsAwsjson11_deserializeDocumentGrantListEntry(&destAddr, value); err != nil { 7882 return err 7883 } 7884 col = *destAddr 7885 cv = append(cv, col) 7886 7887 } 7888 *v = cv 7889 return nil 7890} 7891 7892func awsAwsjson11_deserializeDocumentGrantListEntry(v **types.GrantListEntry, value interface{}) error { 7893 if v == nil { 7894 return fmt.Errorf("unexpected nil of type %T", v) 7895 } 7896 if value == nil { 7897 return nil 7898 } 7899 7900 shape, ok := value.(map[string]interface{}) 7901 if !ok { 7902 return fmt.Errorf("unexpected JSON type %v", value) 7903 } 7904 7905 var sv *types.GrantListEntry 7906 if *v == nil { 7907 sv = &types.GrantListEntry{} 7908 } else { 7909 sv = *v 7910 } 7911 7912 for key, value := range shape { 7913 switch key { 7914 case "Constraints": 7915 if err := awsAwsjson11_deserializeDocumentGrantConstraints(&sv.Constraints, value); err != nil { 7916 return err 7917 } 7918 7919 case "CreationDate": 7920 if value != nil { 7921 switch jtv := value.(type) { 7922 case json.Number: 7923 f64, err := jtv.Float64() 7924 if err != nil { 7925 return err 7926 } 7927 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7928 7929 default: 7930 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 7931 7932 } 7933 } 7934 7935 case "GranteePrincipal": 7936 if value != nil { 7937 jtv, ok := value.(string) 7938 if !ok { 7939 return fmt.Errorf("expected PrincipalIdType to be of type string, got %T instead", value) 7940 } 7941 sv.GranteePrincipal = ptr.String(jtv) 7942 } 7943 7944 case "GrantId": 7945 if value != nil { 7946 jtv, ok := value.(string) 7947 if !ok { 7948 return fmt.Errorf("expected GrantIdType to be of type string, got %T instead", value) 7949 } 7950 sv.GrantId = ptr.String(jtv) 7951 } 7952 7953 case "IssuingAccount": 7954 if value != nil { 7955 jtv, ok := value.(string) 7956 if !ok { 7957 return fmt.Errorf("expected PrincipalIdType to be of type string, got %T instead", value) 7958 } 7959 sv.IssuingAccount = ptr.String(jtv) 7960 } 7961 7962 case "KeyId": 7963 if value != nil { 7964 jtv, ok := value.(string) 7965 if !ok { 7966 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 7967 } 7968 sv.KeyId = ptr.String(jtv) 7969 } 7970 7971 case "Name": 7972 if value != nil { 7973 jtv, ok := value.(string) 7974 if !ok { 7975 return fmt.Errorf("expected GrantNameType to be of type string, got %T instead", value) 7976 } 7977 sv.Name = ptr.String(jtv) 7978 } 7979 7980 case "Operations": 7981 if err := awsAwsjson11_deserializeDocumentGrantOperationList(&sv.Operations, value); err != nil { 7982 return err 7983 } 7984 7985 case "RetiringPrincipal": 7986 if value != nil { 7987 jtv, ok := value.(string) 7988 if !ok { 7989 return fmt.Errorf("expected PrincipalIdType to be of type string, got %T instead", value) 7990 } 7991 sv.RetiringPrincipal = ptr.String(jtv) 7992 } 7993 7994 default: 7995 _, _ = key, value 7996 7997 } 7998 } 7999 *v = sv 8000 return nil 8001} 8002 8003func awsAwsjson11_deserializeDocumentGrantOperationList(v *[]types.GrantOperation, value interface{}) error { 8004 if v == nil { 8005 return fmt.Errorf("unexpected nil of type %T", v) 8006 } 8007 if value == nil { 8008 return nil 8009 } 8010 8011 shape, ok := value.([]interface{}) 8012 if !ok { 8013 return fmt.Errorf("unexpected JSON type %v", value) 8014 } 8015 8016 var cv []types.GrantOperation 8017 if *v == nil { 8018 cv = []types.GrantOperation{} 8019 } else { 8020 cv = *v 8021 } 8022 8023 for _, value := range shape { 8024 var col types.GrantOperation 8025 if value != nil { 8026 jtv, ok := value.(string) 8027 if !ok { 8028 return fmt.Errorf("expected GrantOperation to be of type string, got %T instead", value) 8029 } 8030 col = types.GrantOperation(jtv) 8031 } 8032 cv = append(cv, col) 8033 8034 } 8035 *v = cv 8036 return nil 8037} 8038 8039func awsAwsjson11_deserializeDocumentIncorrectKeyException(v **types.IncorrectKeyException, value interface{}) error { 8040 if v == nil { 8041 return fmt.Errorf("unexpected nil of type %T", v) 8042 } 8043 if value == nil { 8044 return nil 8045 } 8046 8047 shape, ok := value.(map[string]interface{}) 8048 if !ok { 8049 return fmt.Errorf("unexpected JSON type %v", value) 8050 } 8051 8052 var sv *types.IncorrectKeyException 8053 if *v == nil { 8054 sv = &types.IncorrectKeyException{} 8055 } else { 8056 sv = *v 8057 } 8058 8059 for key, value := range shape { 8060 switch key { 8061 case "message": 8062 if value != nil { 8063 jtv, ok := value.(string) 8064 if !ok { 8065 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8066 } 8067 sv.Message = ptr.String(jtv) 8068 } 8069 8070 default: 8071 _, _ = key, value 8072 8073 } 8074 } 8075 *v = sv 8076 return nil 8077} 8078 8079func awsAwsjson11_deserializeDocumentIncorrectKeyMaterialException(v **types.IncorrectKeyMaterialException, value interface{}) error { 8080 if v == nil { 8081 return fmt.Errorf("unexpected nil of type %T", v) 8082 } 8083 if value == nil { 8084 return nil 8085 } 8086 8087 shape, ok := value.(map[string]interface{}) 8088 if !ok { 8089 return fmt.Errorf("unexpected JSON type %v", value) 8090 } 8091 8092 var sv *types.IncorrectKeyMaterialException 8093 if *v == nil { 8094 sv = &types.IncorrectKeyMaterialException{} 8095 } else { 8096 sv = *v 8097 } 8098 8099 for key, value := range shape { 8100 switch key { 8101 case "message": 8102 if value != nil { 8103 jtv, ok := value.(string) 8104 if !ok { 8105 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8106 } 8107 sv.Message = ptr.String(jtv) 8108 } 8109 8110 default: 8111 _, _ = key, value 8112 8113 } 8114 } 8115 *v = sv 8116 return nil 8117} 8118 8119func awsAwsjson11_deserializeDocumentIncorrectTrustAnchorException(v **types.IncorrectTrustAnchorException, value interface{}) error { 8120 if v == nil { 8121 return fmt.Errorf("unexpected nil of type %T", v) 8122 } 8123 if value == nil { 8124 return nil 8125 } 8126 8127 shape, ok := value.(map[string]interface{}) 8128 if !ok { 8129 return fmt.Errorf("unexpected JSON type %v", value) 8130 } 8131 8132 var sv *types.IncorrectTrustAnchorException 8133 if *v == nil { 8134 sv = &types.IncorrectTrustAnchorException{} 8135 } else { 8136 sv = *v 8137 } 8138 8139 for key, value := range shape { 8140 switch key { 8141 case "message": 8142 if value != nil { 8143 jtv, ok := value.(string) 8144 if !ok { 8145 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8146 } 8147 sv.Message = ptr.String(jtv) 8148 } 8149 8150 default: 8151 _, _ = key, value 8152 8153 } 8154 } 8155 *v = sv 8156 return nil 8157} 8158 8159func awsAwsjson11_deserializeDocumentInvalidAliasNameException(v **types.InvalidAliasNameException, value interface{}) error { 8160 if v == nil { 8161 return fmt.Errorf("unexpected nil of type %T", v) 8162 } 8163 if value == nil { 8164 return nil 8165 } 8166 8167 shape, ok := value.(map[string]interface{}) 8168 if !ok { 8169 return fmt.Errorf("unexpected JSON type %v", value) 8170 } 8171 8172 var sv *types.InvalidAliasNameException 8173 if *v == nil { 8174 sv = &types.InvalidAliasNameException{} 8175 } else { 8176 sv = *v 8177 } 8178 8179 for key, value := range shape { 8180 switch key { 8181 case "message": 8182 if value != nil { 8183 jtv, ok := value.(string) 8184 if !ok { 8185 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8186 } 8187 sv.Message = ptr.String(jtv) 8188 } 8189 8190 default: 8191 _, _ = key, value 8192 8193 } 8194 } 8195 *v = sv 8196 return nil 8197} 8198 8199func awsAwsjson11_deserializeDocumentInvalidArnException(v **types.InvalidArnException, value interface{}) error { 8200 if v == nil { 8201 return fmt.Errorf("unexpected nil of type %T", v) 8202 } 8203 if value == nil { 8204 return nil 8205 } 8206 8207 shape, ok := value.(map[string]interface{}) 8208 if !ok { 8209 return fmt.Errorf("unexpected JSON type %v", value) 8210 } 8211 8212 var sv *types.InvalidArnException 8213 if *v == nil { 8214 sv = &types.InvalidArnException{} 8215 } else { 8216 sv = *v 8217 } 8218 8219 for key, value := range shape { 8220 switch key { 8221 case "message": 8222 if value != nil { 8223 jtv, ok := value.(string) 8224 if !ok { 8225 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8226 } 8227 sv.Message = ptr.String(jtv) 8228 } 8229 8230 default: 8231 _, _ = key, value 8232 8233 } 8234 } 8235 *v = sv 8236 return nil 8237} 8238 8239func awsAwsjson11_deserializeDocumentInvalidCiphertextException(v **types.InvalidCiphertextException, value interface{}) error { 8240 if v == nil { 8241 return fmt.Errorf("unexpected nil of type %T", v) 8242 } 8243 if value == nil { 8244 return nil 8245 } 8246 8247 shape, ok := value.(map[string]interface{}) 8248 if !ok { 8249 return fmt.Errorf("unexpected JSON type %v", value) 8250 } 8251 8252 var sv *types.InvalidCiphertextException 8253 if *v == nil { 8254 sv = &types.InvalidCiphertextException{} 8255 } else { 8256 sv = *v 8257 } 8258 8259 for key, value := range shape { 8260 switch key { 8261 case "message": 8262 if value != nil { 8263 jtv, ok := value.(string) 8264 if !ok { 8265 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8266 } 8267 sv.Message = ptr.String(jtv) 8268 } 8269 8270 default: 8271 _, _ = key, value 8272 8273 } 8274 } 8275 *v = sv 8276 return nil 8277} 8278 8279func awsAwsjson11_deserializeDocumentInvalidGrantIdException(v **types.InvalidGrantIdException, value interface{}) error { 8280 if v == nil { 8281 return fmt.Errorf("unexpected nil of type %T", v) 8282 } 8283 if value == nil { 8284 return nil 8285 } 8286 8287 shape, ok := value.(map[string]interface{}) 8288 if !ok { 8289 return fmt.Errorf("unexpected JSON type %v", value) 8290 } 8291 8292 var sv *types.InvalidGrantIdException 8293 if *v == nil { 8294 sv = &types.InvalidGrantIdException{} 8295 } else { 8296 sv = *v 8297 } 8298 8299 for key, value := range shape { 8300 switch key { 8301 case "message": 8302 if value != nil { 8303 jtv, ok := value.(string) 8304 if !ok { 8305 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8306 } 8307 sv.Message = ptr.String(jtv) 8308 } 8309 8310 default: 8311 _, _ = key, value 8312 8313 } 8314 } 8315 *v = sv 8316 return nil 8317} 8318 8319func awsAwsjson11_deserializeDocumentInvalidGrantTokenException(v **types.InvalidGrantTokenException, value interface{}) error { 8320 if v == nil { 8321 return fmt.Errorf("unexpected nil of type %T", v) 8322 } 8323 if value == nil { 8324 return nil 8325 } 8326 8327 shape, ok := value.(map[string]interface{}) 8328 if !ok { 8329 return fmt.Errorf("unexpected JSON type %v", value) 8330 } 8331 8332 var sv *types.InvalidGrantTokenException 8333 if *v == nil { 8334 sv = &types.InvalidGrantTokenException{} 8335 } else { 8336 sv = *v 8337 } 8338 8339 for key, value := range shape { 8340 switch key { 8341 case "message": 8342 if value != nil { 8343 jtv, ok := value.(string) 8344 if !ok { 8345 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8346 } 8347 sv.Message = ptr.String(jtv) 8348 } 8349 8350 default: 8351 _, _ = key, value 8352 8353 } 8354 } 8355 *v = sv 8356 return nil 8357} 8358 8359func awsAwsjson11_deserializeDocumentInvalidImportTokenException(v **types.InvalidImportTokenException, value interface{}) error { 8360 if v == nil { 8361 return fmt.Errorf("unexpected nil of type %T", v) 8362 } 8363 if value == nil { 8364 return nil 8365 } 8366 8367 shape, ok := value.(map[string]interface{}) 8368 if !ok { 8369 return fmt.Errorf("unexpected JSON type %v", value) 8370 } 8371 8372 var sv *types.InvalidImportTokenException 8373 if *v == nil { 8374 sv = &types.InvalidImportTokenException{} 8375 } else { 8376 sv = *v 8377 } 8378 8379 for key, value := range shape { 8380 switch key { 8381 case "message": 8382 if value != nil { 8383 jtv, ok := value.(string) 8384 if !ok { 8385 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8386 } 8387 sv.Message = ptr.String(jtv) 8388 } 8389 8390 default: 8391 _, _ = key, value 8392 8393 } 8394 } 8395 *v = sv 8396 return nil 8397} 8398 8399func awsAwsjson11_deserializeDocumentInvalidKeyUsageException(v **types.InvalidKeyUsageException, value interface{}) error { 8400 if v == nil { 8401 return fmt.Errorf("unexpected nil of type %T", v) 8402 } 8403 if value == nil { 8404 return nil 8405 } 8406 8407 shape, ok := value.(map[string]interface{}) 8408 if !ok { 8409 return fmt.Errorf("unexpected JSON type %v", value) 8410 } 8411 8412 var sv *types.InvalidKeyUsageException 8413 if *v == nil { 8414 sv = &types.InvalidKeyUsageException{} 8415 } else { 8416 sv = *v 8417 } 8418 8419 for key, value := range shape { 8420 switch key { 8421 case "message": 8422 if value != nil { 8423 jtv, ok := value.(string) 8424 if !ok { 8425 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8426 } 8427 sv.Message = ptr.String(jtv) 8428 } 8429 8430 default: 8431 _, _ = key, value 8432 8433 } 8434 } 8435 *v = sv 8436 return nil 8437} 8438 8439func awsAwsjson11_deserializeDocumentInvalidMarkerException(v **types.InvalidMarkerException, value interface{}) error { 8440 if v == nil { 8441 return fmt.Errorf("unexpected nil of type %T", v) 8442 } 8443 if value == nil { 8444 return nil 8445 } 8446 8447 shape, ok := value.(map[string]interface{}) 8448 if !ok { 8449 return fmt.Errorf("unexpected JSON type %v", value) 8450 } 8451 8452 var sv *types.InvalidMarkerException 8453 if *v == nil { 8454 sv = &types.InvalidMarkerException{} 8455 } else { 8456 sv = *v 8457 } 8458 8459 for key, value := range shape { 8460 switch key { 8461 case "message": 8462 if value != nil { 8463 jtv, ok := value.(string) 8464 if !ok { 8465 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8466 } 8467 sv.Message = ptr.String(jtv) 8468 } 8469 8470 default: 8471 _, _ = key, value 8472 8473 } 8474 } 8475 *v = sv 8476 return nil 8477} 8478 8479func awsAwsjson11_deserializeDocumentKeyList(v *[]types.KeyListEntry, value interface{}) error { 8480 if v == nil { 8481 return fmt.Errorf("unexpected nil of type %T", v) 8482 } 8483 if value == nil { 8484 return nil 8485 } 8486 8487 shape, ok := value.([]interface{}) 8488 if !ok { 8489 return fmt.Errorf("unexpected JSON type %v", value) 8490 } 8491 8492 var cv []types.KeyListEntry 8493 if *v == nil { 8494 cv = []types.KeyListEntry{} 8495 } else { 8496 cv = *v 8497 } 8498 8499 for _, value := range shape { 8500 var col types.KeyListEntry 8501 destAddr := &col 8502 if err := awsAwsjson11_deserializeDocumentKeyListEntry(&destAddr, value); err != nil { 8503 return err 8504 } 8505 col = *destAddr 8506 cv = append(cv, col) 8507 8508 } 8509 *v = cv 8510 return nil 8511} 8512 8513func awsAwsjson11_deserializeDocumentKeyListEntry(v **types.KeyListEntry, value interface{}) error { 8514 if v == nil { 8515 return fmt.Errorf("unexpected nil of type %T", v) 8516 } 8517 if value == nil { 8518 return nil 8519 } 8520 8521 shape, ok := value.(map[string]interface{}) 8522 if !ok { 8523 return fmt.Errorf("unexpected JSON type %v", value) 8524 } 8525 8526 var sv *types.KeyListEntry 8527 if *v == nil { 8528 sv = &types.KeyListEntry{} 8529 } else { 8530 sv = *v 8531 } 8532 8533 for key, value := range shape { 8534 switch key { 8535 case "KeyArn": 8536 if value != nil { 8537 jtv, ok := value.(string) 8538 if !ok { 8539 return fmt.Errorf("expected ArnType to be of type string, got %T instead", value) 8540 } 8541 sv.KeyArn = ptr.String(jtv) 8542 } 8543 8544 case "KeyId": 8545 if value != nil { 8546 jtv, ok := value.(string) 8547 if !ok { 8548 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 8549 } 8550 sv.KeyId = ptr.String(jtv) 8551 } 8552 8553 default: 8554 _, _ = key, value 8555 8556 } 8557 } 8558 *v = sv 8559 return nil 8560} 8561 8562func awsAwsjson11_deserializeDocumentKeyMetadata(v **types.KeyMetadata, value interface{}) error { 8563 if v == nil { 8564 return fmt.Errorf("unexpected nil of type %T", v) 8565 } 8566 if value == nil { 8567 return nil 8568 } 8569 8570 shape, ok := value.(map[string]interface{}) 8571 if !ok { 8572 return fmt.Errorf("unexpected JSON type %v", value) 8573 } 8574 8575 var sv *types.KeyMetadata 8576 if *v == nil { 8577 sv = &types.KeyMetadata{} 8578 } else { 8579 sv = *v 8580 } 8581 8582 for key, value := range shape { 8583 switch key { 8584 case "Arn": 8585 if value != nil { 8586 jtv, ok := value.(string) 8587 if !ok { 8588 return fmt.Errorf("expected ArnType to be of type string, got %T instead", value) 8589 } 8590 sv.Arn = ptr.String(jtv) 8591 } 8592 8593 case "AWSAccountId": 8594 if value != nil { 8595 jtv, ok := value.(string) 8596 if !ok { 8597 return fmt.Errorf("expected AWSAccountIdType to be of type string, got %T instead", value) 8598 } 8599 sv.AWSAccountId = ptr.String(jtv) 8600 } 8601 8602 case "CloudHsmClusterId": 8603 if value != nil { 8604 jtv, ok := value.(string) 8605 if !ok { 8606 return fmt.Errorf("expected CloudHsmClusterIdType to be of type string, got %T instead", value) 8607 } 8608 sv.CloudHsmClusterId = ptr.String(jtv) 8609 } 8610 8611 case "CreationDate": 8612 if value != nil { 8613 switch jtv := value.(type) { 8614 case json.Number: 8615 f64, err := jtv.Float64() 8616 if err != nil { 8617 return err 8618 } 8619 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8620 8621 default: 8622 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 8623 8624 } 8625 } 8626 8627 case "CustomerMasterKeySpec": 8628 if value != nil { 8629 jtv, ok := value.(string) 8630 if !ok { 8631 return fmt.Errorf("expected CustomerMasterKeySpec to be of type string, got %T instead", value) 8632 } 8633 sv.CustomerMasterKeySpec = types.CustomerMasterKeySpec(jtv) 8634 } 8635 8636 case "CustomKeyStoreId": 8637 if value != nil { 8638 jtv, ok := value.(string) 8639 if !ok { 8640 return fmt.Errorf("expected CustomKeyStoreIdType to be of type string, got %T instead", value) 8641 } 8642 sv.CustomKeyStoreId = ptr.String(jtv) 8643 } 8644 8645 case "DeletionDate": 8646 if value != nil { 8647 switch jtv := value.(type) { 8648 case json.Number: 8649 f64, err := jtv.Float64() 8650 if err != nil { 8651 return err 8652 } 8653 sv.DeletionDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8654 8655 default: 8656 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 8657 8658 } 8659 } 8660 8661 case "Description": 8662 if value != nil { 8663 jtv, ok := value.(string) 8664 if !ok { 8665 return fmt.Errorf("expected DescriptionType to be of type string, got %T instead", value) 8666 } 8667 sv.Description = ptr.String(jtv) 8668 } 8669 8670 case "Enabled": 8671 if value != nil { 8672 jtv, ok := value.(bool) 8673 if !ok { 8674 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 8675 } 8676 sv.Enabled = jtv 8677 } 8678 8679 case "EncryptionAlgorithms": 8680 if err := awsAwsjson11_deserializeDocumentEncryptionAlgorithmSpecList(&sv.EncryptionAlgorithms, value); err != nil { 8681 return err 8682 } 8683 8684 case "ExpirationModel": 8685 if value != nil { 8686 jtv, ok := value.(string) 8687 if !ok { 8688 return fmt.Errorf("expected ExpirationModelType to be of type string, got %T instead", value) 8689 } 8690 sv.ExpirationModel = types.ExpirationModelType(jtv) 8691 } 8692 8693 case "KeyId": 8694 if value != nil { 8695 jtv, ok := value.(string) 8696 if !ok { 8697 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 8698 } 8699 sv.KeyId = ptr.String(jtv) 8700 } 8701 8702 case "KeyManager": 8703 if value != nil { 8704 jtv, ok := value.(string) 8705 if !ok { 8706 return fmt.Errorf("expected KeyManagerType to be of type string, got %T instead", value) 8707 } 8708 sv.KeyManager = types.KeyManagerType(jtv) 8709 } 8710 8711 case "KeySpec": 8712 if value != nil { 8713 jtv, ok := value.(string) 8714 if !ok { 8715 return fmt.Errorf("expected KeySpec to be of type string, got %T instead", value) 8716 } 8717 sv.KeySpec = types.KeySpec(jtv) 8718 } 8719 8720 case "KeyState": 8721 if value != nil { 8722 jtv, ok := value.(string) 8723 if !ok { 8724 return fmt.Errorf("expected KeyState to be of type string, got %T instead", value) 8725 } 8726 sv.KeyState = types.KeyState(jtv) 8727 } 8728 8729 case "KeyUsage": 8730 if value != nil { 8731 jtv, ok := value.(string) 8732 if !ok { 8733 return fmt.Errorf("expected KeyUsageType to be of type string, got %T instead", value) 8734 } 8735 sv.KeyUsage = types.KeyUsageType(jtv) 8736 } 8737 8738 case "MultiRegion": 8739 if value != nil { 8740 jtv, ok := value.(bool) 8741 if !ok { 8742 return fmt.Errorf("expected NullableBooleanType to be of type *bool, got %T instead", value) 8743 } 8744 sv.MultiRegion = ptr.Bool(jtv) 8745 } 8746 8747 case "MultiRegionConfiguration": 8748 if err := awsAwsjson11_deserializeDocumentMultiRegionConfiguration(&sv.MultiRegionConfiguration, value); err != nil { 8749 return err 8750 } 8751 8752 case "Origin": 8753 if value != nil { 8754 jtv, ok := value.(string) 8755 if !ok { 8756 return fmt.Errorf("expected OriginType to be of type string, got %T instead", value) 8757 } 8758 sv.Origin = types.OriginType(jtv) 8759 } 8760 8761 case "PendingDeletionWindowInDays": 8762 if value != nil { 8763 jtv, ok := value.(json.Number) 8764 if !ok { 8765 return fmt.Errorf("expected PendingWindowInDaysType to be json.Number, got %T instead", value) 8766 } 8767 i64, err := jtv.Int64() 8768 if err != nil { 8769 return err 8770 } 8771 sv.PendingDeletionWindowInDays = ptr.Int32(int32(i64)) 8772 } 8773 8774 case "SigningAlgorithms": 8775 if err := awsAwsjson11_deserializeDocumentSigningAlgorithmSpecList(&sv.SigningAlgorithms, value); err != nil { 8776 return err 8777 } 8778 8779 case "ValidTo": 8780 if value != nil { 8781 switch jtv := value.(type) { 8782 case json.Number: 8783 f64, err := jtv.Float64() 8784 if err != nil { 8785 return err 8786 } 8787 sv.ValidTo = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8788 8789 default: 8790 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 8791 8792 } 8793 } 8794 8795 default: 8796 _, _ = key, value 8797 8798 } 8799 } 8800 *v = sv 8801 return nil 8802} 8803 8804func awsAwsjson11_deserializeDocumentKeyUnavailableException(v **types.KeyUnavailableException, value interface{}) error { 8805 if v == nil { 8806 return fmt.Errorf("unexpected nil of type %T", v) 8807 } 8808 if value == nil { 8809 return nil 8810 } 8811 8812 shape, ok := value.(map[string]interface{}) 8813 if !ok { 8814 return fmt.Errorf("unexpected JSON type %v", value) 8815 } 8816 8817 var sv *types.KeyUnavailableException 8818 if *v == nil { 8819 sv = &types.KeyUnavailableException{} 8820 } else { 8821 sv = *v 8822 } 8823 8824 for key, value := range shape { 8825 switch key { 8826 case "message": 8827 if value != nil { 8828 jtv, ok := value.(string) 8829 if !ok { 8830 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8831 } 8832 sv.Message = ptr.String(jtv) 8833 } 8834 8835 default: 8836 _, _ = key, value 8837 8838 } 8839 } 8840 *v = sv 8841 return nil 8842} 8843 8844func awsAwsjson11_deserializeDocumentKMSInternalException(v **types.KMSInternalException, value interface{}) error { 8845 if v == nil { 8846 return fmt.Errorf("unexpected nil of type %T", v) 8847 } 8848 if value == nil { 8849 return nil 8850 } 8851 8852 shape, ok := value.(map[string]interface{}) 8853 if !ok { 8854 return fmt.Errorf("unexpected JSON type %v", value) 8855 } 8856 8857 var sv *types.KMSInternalException 8858 if *v == nil { 8859 sv = &types.KMSInternalException{} 8860 } else { 8861 sv = *v 8862 } 8863 8864 for key, value := range shape { 8865 switch key { 8866 case "message": 8867 if value != nil { 8868 jtv, ok := value.(string) 8869 if !ok { 8870 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8871 } 8872 sv.Message = ptr.String(jtv) 8873 } 8874 8875 default: 8876 _, _ = key, value 8877 8878 } 8879 } 8880 *v = sv 8881 return nil 8882} 8883 8884func awsAwsjson11_deserializeDocumentKMSInvalidSignatureException(v **types.KMSInvalidSignatureException, value interface{}) error { 8885 if v == nil { 8886 return fmt.Errorf("unexpected nil of type %T", v) 8887 } 8888 if value == nil { 8889 return nil 8890 } 8891 8892 shape, ok := value.(map[string]interface{}) 8893 if !ok { 8894 return fmt.Errorf("unexpected JSON type %v", value) 8895 } 8896 8897 var sv *types.KMSInvalidSignatureException 8898 if *v == nil { 8899 sv = &types.KMSInvalidSignatureException{} 8900 } else { 8901 sv = *v 8902 } 8903 8904 for key, value := range shape { 8905 switch key { 8906 case "message": 8907 if value != nil { 8908 jtv, ok := value.(string) 8909 if !ok { 8910 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8911 } 8912 sv.Message = ptr.String(jtv) 8913 } 8914 8915 default: 8916 _, _ = key, value 8917 8918 } 8919 } 8920 *v = sv 8921 return nil 8922} 8923 8924func awsAwsjson11_deserializeDocumentKMSInvalidStateException(v **types.KMSInvalidStateException, value interface{}) error { 8925 if v == nil { 8926 return fmt.Errorf("unexpected nil of type %T", v) 8927 } 8928 if value == nil { 8929 return nil 8930 } 8931 8932 shape, ok := value.(map[string]interface{}) 8933 if !ok { 8934 return fmt.Errorf("unexpected JSON type %v", value) 8935 } 8936 8937 var sv *types.KMSInvalidStateException 8938 if *v == nil { 8939 sv = &types.KMSInvalidStateException{} 8940 } else { 8941 sv = *v 8942 } 8943 8944 for key, value := range shape { 8945 switch key { 8946 case "message": 8947 if value != nil { 8948 jtv, ok := value.(string) 8949 if !ok { 8950 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8951 } 8952 sv.Message = ptr.String(jtv) 8953 } 8954 8955 default: 8956 _, _ = key, value 8957 8958 } 8959 } 8960 *v = sv 8961 return nil 8962} 8963 8964func awsAwsjson11_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 8965 if v == nil { 8966 return fmt.Errorf("unexpected nil of type %T", v) 8967 } 8968 if value == nil { 8969 return nil 8970 } 8971 8972 shape, ok := value.(map[string]interface{}) 8973 if !ok { 8974 return fmt.Errorf("unexpected JSON type %v", value) 8975 } 8976 8977 var sv *types.LimitExceededException 8978 if *v == nil { 8979 sv = &types.LimitExceededException{} 8980 } else { 8981 sv = *v 8982 } 8983 8984 for key, value := range shape { 8985 switch key { 8986 case "message": 8987 if value != nil { 8988 jtv, ok := value.(string) 8989 if !ok { 8990 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8991 } 8992 sv.Message = ptr.String(jtv) 8993 } 8994 8995 default: 8996 _, _ = key, value 8997 8998 } 8999 } 9000 *v = sv 9001 return nil 9002} 9003 9004func awsAwsjson11_deserializeDocumentMalformedPolicyDocumentException(v **types.MalformedPolicyDocumentException, value interface{}) error { 9005 if v == nil { 9006 return fmt.Errorf("unexpected nil of type %T", v) 9007 } 9008 if value == nil { 9009 return nil 9010 } 9011 9012 shape, ok := value.(map[string]interface{}) 9013 if !ok { 9014 return fmt.Errorf("unexpected JSON type %v", value) 9015 } 9016 9017 var sv *types.MalformedPolicyDocumentException 9018 if *v == nil { 9019 sv = &types.MalformedPolicyDocumentException{} 9020 } else { 9021 sv = *v 9022 } 9023 9024 for key, value := range shape { 9025 switch key { 9026 case "message": 9027 if value != nil { 9028 jtv, ok := value.(string) 9029 if !ok { 9030 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 9031 } 9032 sv.Message = ptr.String(jtv) 9033 } 9034 9035 default: 9036 _, _ = key, value 9037 9038 } 9039 } 9040 *v = sv 9041 return nil 9042} 9043 9044func awsAwsjson11_deserializeDocumentMultiRegionConfiguration(v **types.MultiRegionConfiguration, value interface{}) error { 9045 if v == nil { 9046 return fmt.Errorf("unexpected nil of type %T", v) 9047 } 9048 if value == nil { 9049 return nil 9050 } 9051 9052 shape, ok := value.(map[string]interface{}) 9053 if !ok { 9054 return fmt.Errorf("unexpected JSON type %v", value) 9055 } 9056 9057 var sv *types.MultiRegionConfiguration 9058 if *v == nil { 9059 sv = &types.MultiRegionConfiguration{} 9060 } else { 9061 sv = *v 9062 } 9063 9064 for key, value := range shape { 9065 switch key { 9066 case "MultiRegionKeyType": 9067 if value != nil { 9068 jtv, ok := value.(string) 9069 if !ok { 9070 return fmt.Errorf("expected MultiRegionKeyType to be of type string, got %T instead", value) 9071 } 9072 sv.MultiRegionKeyType = types.MultiRegionKeyType(jtv) 9073 } 9074 9075 case "PrimaryKey": 9076 if err := awsAwsjson11_deserializeDocumentMultiRegionKey(&sv.PrimaryKey, value); err != nil { 9077 return err 9078 } 9079 9080 case "ReplicaKeys": 9081 if err := awsAwsjson11_deserializeDocumentMultiRegionKeyList(&sv.ReplicaKeys, value); err != nil { 9082 return err 9083 } 9084 9085 default: 9086 _, _ = key, value 9087 9088 } 9089 } 9090 *v = sv 9091 return nil 9092} 9093 9094func awsAwsjson11_deserializeDocumentMultiRegionKey(v **types.MultiRegionKey, value interface{}) error { 9095 if v == nil { 9096 return fmt.Errorf("unexpected nil of type %T", v) 9097 } 9098 if value == nil { 9099 return nil 9100 } 9101 9102 shape, ok := value.(map[string]interface{}) 9103 if !ok { 9104 return fmt.Errorf("unexpected JSON type %v", value) 9105 } 9106 9107 var sv *types.MultiRegionKey 9108 if *v == nil { 9109 sv = &types.MultiRegionKey{} 9110 } else { 9111 sv = *v 9112 } 9113 9114 for key, value := range shape { 9115 switch key { 9116 case "Arn": 9117 if value != nil { 9118 jtv, ok := value.(string) 9119 if !ok { 9120 return fmt.Errorf("expected ArnType to be of type string, got %T instead", value) 9121 } 9122 sv.Arn = ptr.String(jtv) 9123 } 9124 9125 case "Region": 9126 if value != nil { 9127 jtv, ok := value.(string) 9128 if !ok { 9129 return fmt.Errorf("expected RegionType to be of type string, got %T instead", value) 9130 } 9131 sv.Region = ptr.String(jtv) 9132 } 9133 9134 default: 9135 _, _ = key, value 9136 9137 } 9138 } 9139 *v = sv 9140 return nil 9141} 9142 9143func awsAwsjson11_deserializeDocumentMultiRegionKeyList(v *[]types.MultiRegionKey, value interface{}) error { 9144 if v == nil { 9145 return fmt.Errorf("unexpected nil of type %T", v) 9146 } 9147 if value == nil { 9148 return nil 9149 } 9150 9151 shape, ok := value.([]interface{}) 9152 if !ok { 9153 return fmt.Errorf("unexpected JSON type %v", value) 9154 } 9155 9156 var cv []types.MultiRegionKey 9157 if *v == nil { 9158 cv = []types.MultiRegionKey{} 9159 } else { 9160 cv = *v 9161 } 9162 9163 for _, value := range shape { 9164 var col types.MultiRegionKey 9165 destAddr := &col 9166 if err := awsAwsjson11_deserializeDocumentMultiRegionKey(&destAddr, value); err != nil { 9167 return err 9168 } 9169 col = *destAddr 9170 cv = append(cv, col) 9171 9172 } 9173 *v = cv 9174 return nil 9175} 9176 9177func awsAwsjson11_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 9178 if v == nil { 9179 return fmt.Errorf("unexpected nil of type %T", v) 9180 } 9181 if value == nil { 9182 return nil 9183 } 9184 9185 shape, ok := value.(map[string]interface{}) 9186 if !ok { 9187 return fmt.Errorf("unexpected JSON type %v", value) 9188 } 9189 9190 var sv *types.NotFoundException 9191 if *v == nil { 9192 sv = &types.NotFoundException{} 9193 } else { 9194 sv = *v 9195 } 9196 9197 for key, value := range shape { 9198 switch key { 9199 case "message": 9200 if value != nil { 9201 jtv, ok := value.(string) 9202 if !ok { 9203 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 9204 } 9205 sv.Message = ptr.String(jtv) 9206 } 9207 9208 default: 9209 _, _ = key, value 9210 9211 } 9212 } 9213 *v = sv 9214 return nil 9215} 9216 9217func awsAwsjson11_deserializeDocumentPolicyNameList(v *[]string, value interface{}) error { 9218 if v == nil { 9219 return fmt.Errorf("unexpected nil of type %T", v) 9220 } 9221 if value == nil { 9222 return nil 9223 } 9224 9225 shape, ok := value.([]interface{}) 9226 if !ok { 9227 return fmt.Errorf("unexpected JSON type %v", value) 9228 } 9229 9230 var cv []string 9231 if *v == nil { 9232 cv = []string{} 9233 } else { 9234 cv = *v 9235 } 9236 9237 for _, value := range shape { 9238 var col string 9239 if value != nil { 9240 jtv, ok := value.(string) 9241 if !ok { 9242 return fmt.Errorf("expected PolicyNameType to be of type string, got %T instead", value) 9243 } 9244 col = jtv 9245 } 9246 cv = append(cv, col) 9247 9248 } 9249 *v = cv 9250 return nil 9251} 9252 9253func awsAwsjson11_deserializeDocumentSigningAlgorithmSpecList(v *[]types.SigningAlgorithmSpec, value interface{}) error { 9254 if v == nil { 9255 return fmt.Errorf("unexpected nil of type %T", v) 9256 } 9257 if value == nil { 9258 return nil 9259 } 9260 9261 shape, ok := value.([]interface{}) 9262 if !ok { 9263 return fmt.Errorf("unexpected JSON type %v", value) 9264 } 9265 9266 var cv []types.SigningAlgorithmSpec 9267 if *v == nil { 9268 cv = []types.SigningAlgorithmSpec{} 9269 } else { 9270 cv = *v 9271 } 9272 9273 for _, value := range shape { 9274 var col types.SigningAlgorithmSpec 9275 if value != nil { 9276 jtv, ok := value.(string) 9277 if !ok { 9278 return fmt.Errorf("expected SigningAlgorithmSpec to be of type string, got %T instead", value) 9279 } 9280 col = types.SigningAlgorithmSpec(jtv) 9281 } 9282 cv = append(cv, col) 9283 9284 } 9285 *v = cv 9286 return nil 9287} 9288 9289func awsAwsjson11_deserializeDocumentTag(v **types.Tag, value interface{}) error { 9290 if v == nil { 9291 return fmt.Errorf("unexpected nil of type %T", v) 9292 } 9293 if value == nil { 9294 return nil 9295 } 9296 9297 shape, ok := value.(map[string]interface{}) 9298 if !ok { 9299 return fmt.Errorf("unexpected JSON type %v", value) 9300 } 9301 9302 var sv *types.Tag 9303 if *v == nil { 9304 sv = &types.Tag{} 9305 } else { 9306 sv = *v 9307 } 9308 9309 for key, value := range shape { 9310 switch key { 9311 case "TagKey": 9312 if value != nil { 9313 jtv, ok := value.(string) 9314 if !ok { 9315 return fmt.Errorf("expected TagKeyType to be of type string, got %T instead", value) 9316 } 9317 sv.TagKey = ptr.String(jtv) 9318 } 9319 9320 case "TagValue": 9321 if value != nil { 9322 jtv, ok := value.(string) 9323 if !ok { 9324 return fmt.Errorf("expected TagValueType to be of type string, got %T instead", value) 9325 } 9326 sv.TagValue = ptr.String(jtv) 9327 } 9328 9329 default: 9330 _, _ = key, value 9331 9332 } 9333 } 9334 *v = sv 9335 return nil 9336} 9337 9338func awsAwsjson11_deserializeDocumentTagException(v **types.TagException, value interface{}) error { 9339 if v == nil { 9340 return fmt.Errorf("unexpected nil of type %T", v) 9341 } 9342 if value == nil { 9343 return nil 9344 } 9345 9346 shape, ok := value.(map[string]interface{}) 9347 if !ok { 9348 return fmt.Errorf("unexpected JSON type %v", value) 9349 } 9350 9351 var sv *types.TagException 9352 if *v == nil { 9353 sv = &types.TagException{} 9354 } else { 9355 sv = *v 9356 } 9357 9358 for key, value := range shape { 9359 switch key { 9360 case "message": 9361 if value != nil { 9362 jtv, ok := value.(string) 9363 if !ok { 9364 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 9365 } 9366 sv.Message = ptr.String(jtv) 9367 } 9368 9369 default: 9370 _, _ = key, value 9371 9372 } 9373 } 9374 *v = sv 9375 return nil 9376} 9377 9378func awsAwsjson11_deserializeDocumentTagList(v *[]types.Tag, value interface{}) error { 9379 if v == nil { 9380 return fmt.Errorf("unexpected nil of type %T", v) 9381 } 9382 if value == nil { 9383 return nil 9384 } 9385 9386 shape, ok := value.([]interface{}) 9387 if !ok { 9388 return fmt.Errorf("unexpected JSON type %v", value) 9389 } 9390 9391 var cv []types.Tag 9392 if *v == nil { 9393 cv = []types.Tag{} 9394 } else { 9395 cv = *v 9396 } 9397 9398 for _, value := range shape { 9399 var col types.Tag 9400 destAddr := &col 9401 if err := awsAwsjson11_deserializeDocumentTag(&destAddr, value); err != nil { 9402 return err 9403 } 9404 col = *destAddr 9405 cv = append(cv, col) 9406 9407 } 9408 *v = cv 9409 return nil 9410} 9411 9412func awsAwsjson11_deserializeDocumentUnsupportedOperationException(v **types.UnsupportedOperationException, value interface{}) error { 9413 if v == nil { 9414 return fmt.Errorf("unexpected nil of type %T", v) 9415 } 9416 if value == nil { 9417 return nil 9418 } 9419 9420 shape, ok := value.(map[string]interface{}) 9421 if !ok { 9422 return fmt.Errorf("unexpected JSON type %v", value) 9423 } 9424 9425 var sv *types.UnsupportedOperationException 9426 if *v == nil { 9427 sv = &types.UnsupportedOperationException{} 9428 } else { 9429 sv = *v 9430 } 9431 9432 for key, value := range shape { 9433 switch key { 9434 case "message": 9435 if value != nil { 9436 jtv, ok := value.(string) 9437 if !ok { 9438 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 9439 } 9440 sv.Message = ptr.String(jtv) 9441 } 9442 9443 default: 9444 _, _ = key, value 9445 9446 } 9447 } 9448 *v = sv 9449 return nil 9450} 9451 9452func awsAwsjson11_deserializeOpDocumentCancelKeyDeletionOutput(v **CancelKeyDeletionOutput, value interface{}) error { 9453 if v == nil { 9454 return fmt.Errorf("unexpected nil of type %T", v) 9455 } 9456 if value == nil { 9457 return nil 9458 } 9459 9460 shape, ok := value.(map[string]interface{}) 9461 if !ok { 9462 return fmt.Errorf("unexpected JSON type %v", value) 9463 } 9464 9465 var sv *CancelKeyDeletionOutput 9466 if *v == nil { 9467 sv = &CancelKeyDeletionOutput{} 9468 } else { 9469 sv = *v 9470 } 9471 9472 for key, value := range shape { 9473 switch key { 9474 case "KeyId": 9475 if value != nil { 9476 jtv, ok := value.(string) 9477 if !ok { 9478 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9479 } 9480 sv.KeyId = ptr.String(jtv) 9481 } 9482 9483 default: 9484 _, _ = key, value 9485 9486 } 9487 } 9488 *v = sv 9489 return nil 9490} 9491 9492func awsAwsjson11_deserializeOpDocumentConnectCustomKeyStoreOutput(v **ConnectCustomKeyStoreOutput, value interface{}) error { 9493 if v == nil { 9494 return fmt.Errorf("unexpected nil of type %T", v) 9495 } 9496 if value == nil { 9497 return nil 9498 } 9499 9500 shape, ok := value.(map[string]interface{}) 9501 if !ok { 9502 return fmt.Errorf("unexpected JSON type %v", value) 9503 } 9504 9505 var sv *ConnectCustomKeyStoreOutput 9506 if *v == nil { 9507 sv = &ConnectCustomKeyStoreOutput{} 9508 } else { 9509 sv = *v 9510 } 9511 9512 for key, value := range shape { 9513 switch key { 9514 default: 9515 _, _ = key, value 9516 9517 } 9518 } 9519 *v = sv 9520 return nil 9521} 9522 9523func awsAwsjson11_deserializeOpDocumentCreateCustomKeyStoreOutput(v **CreateCustomKeyStoreOutput, value interface{}) error { 9524 if v == nil { 9525 return fmt.Errorf("unexpected nil of type %T", v) 9526 } 9527 if value == nil { 9528 return nil 9529 } 9530 9531 shape, ok := value.(map[string]interface{}) 9532 if !ok { 9533 return fmt.Errorf("unexpected JSON type %v", value) 9534 } 9535 9536 var sv *CreateCustomKeyStoreOutput 9537 if *v == nil { 9538 sv = &CreateCustomKeyStoreOutput{} 9539 } else { 9540 sv = *v 9541 } 9542 9543 for key, value := range shape { 9544 switch key { 9545 case "CustomKeyStoreId": 9546 if value != nil { 9547 jtv, ok := value.(string) 9548 if !ok { 9549 return fmt.Errorf("expected CustomKeyStoreIdType to be of type string, got %T instead", value) 9550 } 9551 sv.CustomKeyStoreId = ptr.String(jtv) 9552 } 9553 9554 default: 9555 _, _ = key, value 9556 9557 } 9558 } 9559 *v = sv 9560 return nil 9561} 9562 9563func awsAwsjson11_deserializeOpDocumentCreateGrantOutput(v **CreateGrantOutput, value interface{}) error { 9564 if v == nil { 9565 return fmt.Errorf("unexpected nil of type %T", v) 9566 } 9567 if value == nil { 9568 return nil 9569 } 9570 9571 shape, ok := value.(map[string]interface{}) 9572 if !ok { 9573 return fmt.Errorf("unexpected JSON type %v", value) 9574 } 9575 9576 var sv *CreateGrantOutput 9577 if *v == nil { 9578 sv = &CreateGrantOutput{} 9579 } else { 9580 sv = *v 9581 } 9582 9583 for key, value := range shape { 9584 switch key { 9585 case "GrantId": 9586 if value != nil { 9587 jtv, ok := value.(string) 9588 if !ok { 9589 return fmt.Errorf("expected GrantIdType to be of type string, got %T instead", value) 9590 } 9591 sv.GrantId = ptr.String(jtv) 9592 } 9593 9594 case "GrantToken": 9595 if value != nil { 9596 jtv, ok := value.(string) 9597 if !ok { 9598 return fmt.Errorf("expected GrantTokenType to be of type string, got %T instead", value) 9599 } 9600 sv.GrantToken = ptr.String(jtv) 9601 } 9602 9603 default: 9604 _, _ = key, value 9605 9606 } 9607 } 9608 *v = sv 9609 return nil 9610} 9611 9612func awsAwsjson11_deserializeOpDocumentCreateKeyOutput(v **CreateKeyOutput, value interface{}) error { 9613 if v == nil { 9614 return fmt.Errorf("unexpected nil of type %T", v) 9615 } 9616 if value == nil { 9617 return nil 9618 } 9619 9620 shape, ok := value.(map[string]interface{}) 9621 if !ok { 9622 return fmt.Errorf("unexpected JSON type %v", value) 9623 } 9624 9625 var sv *CreateKeyOutput 9626 if *v == nil { 9627 sv = &CreateKeyOutput{} 9628 } else { 9629 sv = *v 9630 } 9631 9632 for key, value := range shape { 9633 switch key { 9634 case "KeyMetadata": 9635 if err := awsAwsjson11_deserializeDocumentKeyMetadata(&sv.KeyMetadata, value); err != nil { 9636 return err 9637 } 9638 9639 default: 9640 _, _ = key, value 9641 9642 } 9643 } 9644 *v = sv 9645 return nil 9646} 9647 9648func awsAwsjson11_deserializeOpDocumentDecryptOutput(v **DecryptOutput, value interface{}) error { 9649 if v == nil { 9650 return fmt.Errorf("unexpected nil of type %T", v) 9651 } 9652 if value == nil { 9653 return nil 9654 } 9655 9656 shape, ok := value.(map[string]interface{}) 9657 if !ok { 9658 return fmt.Errorf("unexpected JSON type %v", value) 9659 } 9660 9661 var sv *DecryptOutput 9662 if *v == nil { 9663 sv = &DecryptOutput{} 9664 } else { 9665 sv = *v 9666 } 9667 9668 for key, value := range shape { 9669 switch key { 9670 case "EncryptionAlgorithm": 9671 if value != nil { 9672 jtv, ok := value.(string) 9673 if !ok { 9674 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 9675 } 9676 sv.EncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 9677 } 9678 9679 case "KeyId": 9680 if value != nil { 9681 jtv, ok := value.(string) 9682 if !ok { 9683 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9684 } 9685 sv.KeyId = ptr.String(jtv) 9686 } 9687 9688 case "Plaintext": 9689 if value != nil { 9690 jtv, ok := value.(string) 9691 if !ok { 9692 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 9693 } 9694 dv, err := base64.StdEncoding.DecodeString(jtv) 9695 if err != nil { 9696 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 9697 } 9698 sv.Plaintext = dv 9699 } 9700 9701 default: 9702 _, _ = key, value 9703 9704 } 9705 } 9706 *v = sv 9707 return nil 9708} 9709 9710func awsAwsjson11_deserializeOpDocumentDeleteCustomKeyStoreOutput(v **DeleteCustomKeyStoreOutput, value interface{}) error { 9711 if v == nil { 9712 return fmt.Errorf("unexpected nil of type %T", v) 9713 } 9714 if value == nil { 9715 return nil 9716 } 9717 9718 shape, ok := value.(map[string]interface{}) 9719 if !ok { 9720 return fmt.Errorf("unexpected JSON type %v", value) 9721 } 9722 9723 var sv *DeleteCustomKeyStoreOutput 9724 if *v == nil { 9725 sv = &DeleteCustomKeyStoreOutput{} 9726 } else { 9727 sv = *v 9728 } 9729 9730 for key, value := range shape { 9731 switch key { 9732 default: 9733 _, _ = key, value 9734 9735 } 9736 } 9737 *v = sv 9738 return nil 9739} 9740 9741func awsAwsjson11_deserializeOpDocumentDescribeCustomKeyStoresOutput(v **DescribeCustomKeyStoresOutput, value interface{}) error { 9742 if v == nil { 9743 return fmt.Errorf("unexpected nil of type %T", v) 9744 } 9745 if value == nil { 9746 return nil 9747 } 9748 9749 shape, ok := value.(map[string]interface{}) 9750 if !ok { 9751 return fmt.Errorf("unexpected JSON type %v", value) 9752 } 9753 9754 var sv *DescribeCustomKeyStoresOutput 9755 if *v == nil { 9756 sv = &DescribeCustomKeyStoresOutput{} 9757 } else { 9758 sv = *v 9759 } 9760 9761 for key, value := range shape { 9762 switch key { 9763 case "CustomKeyStores": 9764 if err := awsAwsjson11_deserializeDocumentCustomKeyStoresList(&sv.CustomKeyStores, value); err != nil { 9765 return err 9766 } 9767 9768 case "NextMarker": 9769 if value != nil { 9770 jtv, ok := value.(string) 9771 if !ok { 9772 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 9773 } 9774 sv.NextMarker = ptr.String(jtv) 9775 } 9776 9777 case "Truncated": 9778 if value != nil { 9779 jtv, ok := value.(bool) 9780 if !ok { 9781 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 9782 } 9783 sv.Truncated = jtv 9784 } 9785 9786 default: 9787 _, _ = key, value 9788 9789 } 9790 } 9791 *v = sv 9792 return nil 9793} 9794 9795func awsAwsjson11_deserializeOpDocumentDescribeKeyOutput(v **DescribeKeyOutput, value interface{}) error { 9796 if v == nil { 9797 return fmt.Errorf("unexpected nil of type %T", v) 9798 } 9799 if value == nil { 9800 return nil 9801 } 9802 9803 shape, ok := value.(map[string]interface{}) 9804 if !ok { 9805 return fmt.Errorf("unexpected JSON type %v", value) 9806 } 9807 9808 var sv *DescribeKeyOutput 9809 if *v == nil { 9810 sv = &DescribeKeyOutput{} 9811 } else { 9812 sv = *v 9813 } 9814 9815 for key, value := range shape { 9816 switch key { 9817 case "KeyMetadata": 9818 if err := awsAwsjson11_deserializeDocumentKeyMetadata(&sv.KeyMetadata, value); err != nil { 9819 return err 9820 } 9821 9822 default: 9823 _, _ = key, value 9824 9825 } 9826 } 9827 *v = sv 9828 return nil 9829} 9830 9831func awsAwsjson11_deserializeOpDocumentDisconnectCustomKeyStoreOutput(v **DisconnectCustomKeyStoreOutput, value interface{}) error { 9832 if v == nil { 9833 return fmt.Errorf("unexpected nil of type %T", v) 9834 } 9835 if value == nil { 9836 return nil 9837 } 9838 9839 shape, ok := value.(map[string]interface{}) 9840 if !ok { 9841 return fmt.Errorf("unexpected JSON type %v", value) 9842 } 9843 9844 var sv *DisconnectCustomKeyStoreOutput 9845 if *v == nil { 9846 sv = &DisconnectCustomKeyStoreOutput{} 9847 } else { 9848 sv = *v 9849 } 9850 9851 for key, value := range shape { 9852 switch key { 9853 default: 9854 _, _ = key, value 9855 9856 } 9857 } 9858 *v = sv 9859 return nil 9860} 9861 9862func awsAwsjson11_deserializeOpDocumentEncryptOutput(v **EncryptOutput, value interface{}) error { 9863 if v == nil { 9864 return fmt.Errorf("unexpected nil of type %T", v) 9865 } 9866 if value == nil { 9867 return nil 9868 } 9869 9870 shape, ok := value.(map[string]interface{}) 9871 if !ok { 9872 return fmt.Errorf("unexpected JSON type %v", value) 9873 } 9874 9875 var sv *EncryptOutput 9876 if *v == nil { 9877 sv = &EncryptOutput{} 9878 } else { 9879 sv = *v 9880 } 9881 9882 for key, value := range shape { 9883 switch key { 9884 case "CiphertextBlob": 9885 if value != nil { 9886 jtv, ok := value.(string) 9887 if !ok { 9888 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9889 } 9890 dv, err := base64.StdEncoding.DecodeString(jtv) 9891 if err != nil { 9892 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9893 } 9894 sv.CiphertextBlob = dv 9895 } 9896 9897 case "EncryptionAlgorithm": 9898 if value != nil { 9899 jtv, ok := value.(string) 9900 if !ok { 9901 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 9902 } 9903 sv.EncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 9904 } 9905 9906 case "KeyId": 9907 if value != nil { 9908 jtv, ok := value.(string) 9909 if !ok { 9910 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9911 } 9912 sv.KeyId = ptr.String(jtv) 9913 } 9914 9915 default: 9916 _, _ = key, value 9917 9918 } 9919 } 9920 *v = sv 9921 return nil 9922} 9923 9924func awsAwsjson11_deserializeOpDocumentGenerateDataKeyOutput(v **GenerateDataKeyOutput, value interface{}) error { 9925 if v == nil { 9926 return fmt.Errorf("unexpected nil of type %T", v) 9927 } 9928 if value == nil { 9929 return nil 9930 } 9931 9932 shape, ok := value.(map[string]interface{}) 9933 if !ok { 9934 return fmt.Errorf("unexpected JSON type %v", value) 9935 } 9936 9937 var sv *GenerateDataKeyOutput 9938 if *v == nil { 9939 sv = &GenerateDataKeyOutput{} 9940 } else { 9941 sv = *v 9942 } 9943 9944 for key, value := range shape { 9945 switch key { 9946 case "CiphertextBlob": 9947 if value != nil { 9948 jtv, ok := value.(string) 9949 if !ok { 9950 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9951 } 9952 dv, err := base64.StdEncoding.DecodeString(jtv) 9953 if err != nil { 9954 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9955 } 9956 sv.CiphertextBlob = dv 9957 } 9958 9959 case "KeyId": 9960 if value != nil { 9961 jtv, ok := value.(string) 9962 if !ok { 9963 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9964 } 9965 sv.KeyId = ptr.String(jtv) 9966 } 9967 9968 case "Plaintext": 9969 if value != nil { 9970 jtv, ok := value.(string) 9971 if !ok { 9972 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 9973 } 9974 dv, err := base64.StdEncoding.DecodeString(jtv) 9975 if err != nil { 9976 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 9977 } 9978 sv.Plaintext = dv 9979 } 9980 9981 default: 9982 _, _ = key, value 9983 9984 } 9985 } 9986 *v = sv 9987 return nil 9988} 9989 9990func awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairOutput(v **GenerateDataKeyPairOutput, value interface{}) error { 9991 if v == nil { 9992 return fmt.Errorf("unexpected nil of type %T", v) 9993 } 9994 if value == nil { 9995 return nil 9996 } 9997 9998 shape, ok := value.(map[string]interface{}) 9999 if !ok { 10000 return fmt.Errorf("unexpected JSON type %v", value) 10001 } 10002 10003 var sv *GenerateDataKeyPairOutput 10004 if *v == nil { 10005 sv = &GenerateDataKeyPairOutput{} 10006 } else { 10007 sv = *v 10008 } 10009 10010 for key, value := range shape { 10011 switch key { 10012 case "KeyId": 10013 if value != nil { 10014 jtv, ok := value.(string) 10015 if !ok { 10016 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10017 } 10018 sv.KeyId = ptr.String(jtv) 10019 } 10020 10021 case "KeyPairSpec": 10022 if value != nil { 10023 jtv, ok := value.(string) 10024 if !ok { 10025 return fmt.Errorf("expected DataKeyPairSpec to be of type string, got %T instead", value) 10026 } 10027 sv.KeyPairSpec = types.DataKeyPairSpec(jtv) 10028 } 10029 10030 case "PrivateKeyCiphertextBlob": 10031 if value != nil { 10032 jtv, ok := value.(string) 10033 if !ok { 10034 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 10035 } 10036 dv, err := base64.StdEncoding.DecodeString(jtv) 10037 if err != nil { 10038 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 10039 } 10040 sv.PrivateKeyCiphertextBlob = dv 10041 } 10042 10043 case "PrivateKeyPlaintext": 10044 if value != nil { 10045 jtv, ok := value.(string) 10046 if !ok { 10047 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 10048 } 10049 dv, err := base64.StdEncoding.DecodeString(jtv) 10050 if err != nil { 10051 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 10052 } 10053 sv.PrivateKeyPlaintext = dv 10054 } 10055 10056 case "PublicKey": 10057 if value != nil { 10058 jtv, ok := value.(string) 10059 if !ok { 10060 return fmt.Errorf("expected PublicKeyType to be []byte, got %T instead", value) 10061 } 10062 dv, err := base64.StdEncoding.DecodeString(jtv) 10063 if err != nil { 10064 return fmt.Errorf("failed to base64 decode PublicKeyType, %w", err) 10065 } 10066 sv.PublicKey = dv 10067 } 10068 10069 default: 10070 _, _ = key, value 10071 10072 } 10073 } 10074 *v = sv 10075 return nil 10076} 10077 10078func awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairWithoutPlaintextOutput(v **GenerateDataKeyPairWithoutPlaintextOutput, value interface{}) error { 10079 if v == nil { 10080 return fmt.Errorf("unexpected nil of type %T", v) 10081 } 10082 if value == nil { 10083 return nil 10084 } 10085 10086 shape, ok := value.(map[string]interface{}) 10087 if !ok { 10088 return fmt.Errorf("unexpected JSON type %v", value) 10089 } 10090 10091 var sv *GenerateDataKeyPairWithoutPlaintextOutput 10092 if *v == nil { 10093 sv = &GenerateDataKeyPairWithoutPlaintextOutput{} 10094 } else { 10095 sv = *v 10096 } 10097 10098 for key, value := range shape { 10099 switch key { 10100 case "KeyId": 10101 if value != nil { 10102 jtv, ok := value.(string) 10103 if !ok { 10104 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10105 } 10106 sv.KeyId = ptr.String(jtv) 10107 } 10108 10109 case "KeyPairSpec": 10110 if value != nil { 10111 jtv, ok := value.(string) 10112 if !ok { 10113 return fmt.Errorf("expected DataKeyPairSpec to be of type string, got %T instead", value) 10114 } 10115 sv.KeyPairSpec = types.DataKeyPairSpec(jtv) 10116 } 10117 10118 case "PrivateKeyCiphertextBlob": 10119 if value != nil { 10120 jtv, ok := value.(string) 10121 if !ok { 10122 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 10123 } 10124 dv, err := base64.StdEncoding.DecodeString(jtv) 10125 if err != nil { 10126 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 10127 } 10128 sv.PrivateKeyCiphertextBlob = dv 10129 } 10130 10131 case "PublicKey": 10132 if value != nil { 10133 jtv, ok := value.(string) 10134 if !ok { 10135 return fmt.Errorf("expected PublicKeyType to be []byte, got %T instead", value) 10136 } 10137 dv, err := base64.StdEncoding.DecodeString(jtv) 10138 if err != nil { 10139 return fmt.Errorf("failed to base64 decode PublicKeyType, %w", err) 10140 } 10141 sv.PublicKey = dv 10142 } 10143 10144 default: 10145 _, _ = key, value 10146 10147 } 10148 } 10149 *v = sv 10150 return nil 10151} 10152 10153func awsAwsjson11_deserializeOpDocumentGenerateDataKeyWithoutPlaintextOutput(v **GenerateDataKeyWithoutPlaintextOutput, value interface{}) error { 10154 if v == nil { 10155 return fmt.Errorf("unexpected nil of type %T", v) 10156 } 10157 if value == nil { 10158 return nil 10159 } 10160 10161 shape, ok := value.(map[string]interface{}) 10162 if !ok { 10163 return fmt.Errorf("unexpected JSON type %v", value) 10164 } 10165 10166 var sv *GenerateDataKeyWithoutPlaintextOutput 10167 if *v == nil { 10168 sv = &GenerateDataKeyWithoutPlaintextOutput{} 10169 } else { 10170 sv = *v 10171 } 10172 10173 for key, value := range shape { 10174 switch key { 10175 case "CiphertextBlob": 10176 if value != nil { 10177 jtv, ok := value.(string) 10178 if !ok { 10179 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 10180 } 10181 dv, err := base64.StdEncoding.DecodeString(jtv) 10182 if err != nil { 10183 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 10184 } 10185 sv.CiphertextBlob = dv 10186 } 10187 10188 case "KeyId": 10189 if value != nil { 10190 jtv, ok := value.(string) 10191 if !ok { 10192 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10193 } 10194 sv.KeyId = ptr.String(jtv) 10195 } 10196 10197 default: 10198 _, _ = key, value 10199 10200 } 10201 } 10202 *v = sv 10203 return nil 10204} 10205 10206func awsAwsjson11_deserializeOpDocumentGenerateRandomOutput(v **GenerateRandomOutput, value interface{}) error { 10207 if v == nil { 10208 return fmt.Errorf("unexpected nil of type %T", v) 10209 } 10210 if value == nil { 10211 return nil 10212 } 10213 10214 shape, ok := value.(map[string]interface{}) 10215 if !ok { 10216 return fmt.Errorf("unexpected JSON type %v", value) 10217 } 10218 10219 var sv *GenerateRandomOutput 10220 if *v == nil { 10221 sv = &GenerateRandomOutput{} 10222 } else { 10223 sv = *v 10224 } 10225 10226 for key, value := range shape { 10227 switch key { 10228 case "Plaintext": 10229 if value != nil { 10230 jtv, ok := value.(string) 10231 if !ok { 10232 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 10233 } 10234 dv, err := base64.StdEncoding.DecodeString(jtv) 10235 if err != nil { 10236 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 10237 } 10238 sv.Plaintext = dv 10239 } 10240 10241 default: 10242 _, _ = key, value 10243 10244 } 10245 } 10246 *v = sv 10247 return nil 10248} 10249 10250func awsAwsjson11_deserializeOpDocumentGetKeyPolicyOutput(v **GetKeyPolicyOutput, value interface{}) error { 10251 if v == nil { 10252 return fmt.Errorf("unexpected nil of type %T", v) 10253 } 10254 if value == nil { 10255 return nil 10256 } 10257 10258 shape, ok := value.(map[string]interface{}) 10259 if !ok { 10260 return fmt.Errorf("unexpected JSON type %v", value) 10261 } 10262 10263 var sv *GetKeyPolicyOutput 10264 if *v == nil { 10265 sv = &GetKeyPolicyOutput{} 10266 } else { 10267 sv = *v 10268 } 10269 10270 for key, value := range shape { 10271 switch key { 10272 case "Policy": 10273 if value != nil { 10274 jtv, ok := value.(string) 10275 if !ok { 10276 return fmt.Errorf("expected PolicyType to be of type string, got %T instead", value) 10277 } 10278 sv.Policy = ptr.String(jtv) 10279 } 10280 10281 default: 10282 _, _ = key, value 10283 10284 } 10285 } 10286 *v = sv 10287 return nil 10288} 10289 10290func awsAwsjson11_deserializeOpDocumentGetKeyRotationStatusOutput(v **GetKeyRotationStatusOutput, value interface{}) error { 10291 if v == nil { 10292 return fmt.Errorf("unexpected nil of type %T", v) 10293 } 10294 if value == nil { 10295 return nil 10296 } 10297 10298 shape, ok := value.(map[string]interface{}) 10299 if !ok { 10300 return fmt.Errorf("unexpected JSON type %v", value) 10301 } 10302 10303 var sv *GetKeyRotationStatusOutput 10304 if *v == nil { 10305 sv = &GetKeyRotationStatusOutput{} 10306 } else { 10307 sv = *v 10308 } 10309 10310 for key, value := range shape { 10311 switch key { 10312 case "KeyRotationEnabled": 10313 if value != nil { 10314 jtv, ok := value.(bool) 10315 if !ok { 10316 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10317 } 10318 sv.KeyRotationEnabled = jtv 10319 } 10320 10321 default: 10322 _, _ = key, value 10323 10324 } 10325 } 10326 *v = sv 10327 return nil 10328} 10329 10330func awsAwsjson11_deserializeOpDocumentGetParametersForImportOutput(v **GetParametersForImportOutput, value interface{}) error { 10331 if v == nil { 10332 return fmt.Errorf("unexpected nil of type %T", v) 10333 } 10334 if value == nil { 10335 return nil 10336 } 10337 10338 shape, ok := value.(map[string]interface{}) 10339 if !ok { 10340 return fmt.Errorf("unexpected JSON type %v", value) 10341 } 10342 10343 var sv *GetParametersForImportOutput 10344 if *v == nil { 10345 sv = &GetParametersForImportOutput{} 10346 } else { 10347 sv = *v 10348 } 10349 10350 for key, value := range shape { 10351 switch key { 10352 case "ImportToken": 10353 if value != nil { 10354 jtv, ok := value.(string) 10355 if !ok { 10356 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 10357 } 10358 dv, err := base64.StdEncoding.DecodeString(jtv) 10359 if err != nil { 10360 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 10361 } 10362 sv.ImportToken = dv 10363 } 10364 10365 case "KeyId": 10366 if value != nil { 10367 jtv, ok := value.(string) 10368 if !ok { 10369 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10370 } 10371 sv.KeyId = ptr.String(jtv) 10372 } 10373 10374 case "ParametersValidTo": 10375 if value != nil { 10376 switch jtv := value.(type) { 10377 case json.Number: 10378 f64, err := jtv.Float64() 10379 if err != nil { 10380 return err 10381 } 10382 sv.ParametersValidTo = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10383 10384 default: 10385 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 10386 10387 } 10388 } 10389 10390 case "PublicKey": 10391 if value != nil { 10392 jtv, ok := value.(string) 10393 if !ok { 10394 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 10395 } 10396 dv, err := base64.StdEncoding.DecodeString(jtv) 10397 if err != nil { 10398 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 10399 } 10400 sv.PublicKey = dv 10401 } 10402 10403 default: 10404 _, _ = key, value 10405 10406 } 10407 } 10408 *v = sv 10409 return nil 10410} 10411 10412func awsAwsjson11_deserializeOpDocumentGetPublicKeyOutput(v **GetPublicKeyOutput, value interface{}) error { 10413 if v == nil { 10414 return fmt.Errorf("unexpected nil of type %T", v) 10415 } 10416 if value == nil { 10417 return nil 10418 } 10419 10420 shape, ok := value.(map[string]interface{}) 10421 if !ok { 10422 return fmt.Errorf("unexpected JSON type %v", value) 10423 } 10424 10425 var sv *GetPublicKeyOutput 10426 if *v == nil { 10427 sv = &GetPublicKeyOutput{} 10428 } else { 10429 sv = *v 10430 } 10431 10432 for key, value := range shape { 10433 switch key { 10434 case "CustomerMasterKeySpec": 10435 if value != nil { 10436 jtv, ok := value.(string) 10437 if !ok { 10438 return fmt.Errorf("expected CustomerMasterKeySpec to be of type string, got %T instead", value) 10439 } 10440 sv.CustomerMasterKeySpec = types.CustomerMasterKeySpec(jtv) 10441 } 10442 10443 case "EncryptionAlgorithms": 10444 if err := awsAwsjson11_deserializeDocumentEncryptionAlgorithmSpecList(&sv.EncryptionAlgorithms, value); err != nil { 10445 return err 10446 } 10447 10448 case "KeyId": 10449 if value != nil { 10450 jtv, ok := value.(string) 10451 if !ok { 10452 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10453 } 10454 sv.KeyId = ptr.String(jtv) 10455 } 10456 10457 case "KeySpec": 10458 if value != nil { 10459 jtv, ok := value.(string) 10460 if !ok { 10461 return fmt.Errorf("expected KeySpec to be of type string, got %T instead", value) 10462 } 10463 sv.KeySpec = types.KeySpec(jtv) 10464 } 10465 10466 case "KeyUsage": 10467 if value != nil { 10468 jtv, ok := value.(string) 10469 if !ok { 10470 return fmt.Errorf("expected KeyUsageType to be of type string, got %T instead", value) 10471 } 10472 sv.KeyUsage = types.KeyUsageType(jtv) 10473 } 10474 10475 case "PublicKey": 10476 if value != nil { 10477 jtv, ok := value.(string) 10478 if !ok { 10479 return fmt.Errorf("expected PublicKeyType to be []byte, got %T instead", value) 10480 } 10481 dv, err := base64.StdEncoding.DecodeString(jtv) 10482 if err != nil { 10483 return fmt.Errorf("failed to base64 decode PublicKeyType, %w", err) 10484 } 10485 sv.PublicKey = dv 10486 } 10487 10488 case "SigningAlgorithms": 10489 if err := awsAwsjson11_deserializeDocumentSigningAlgorithmSpecList(&sv.SigningAlgorithms, value); err != nil { 10490 return err 10491 } 10492 10493 default: 10494 _, _ = key, value 10495 10496 } 10497 } 10498 *v = sv 10499 return nil 10500} 10501 10502func awsAwsjson11_deserializeOpDocumentImportKeyMaterialOutput(v **ImportKeyMaterialOutput, value interface{}) error { 10503 if v == nil { 10504 return fmt.Errorf("unexpected nil of type %T", v) 10505 } 10506 if value == nil { 10507 return nil 10508 } 10509 10510 shape, ok := value.(map[string]interface{}) 10511 if !ok { 10512 return fmt.Errorf("unexpected JSON type %v", value) 10513 } 10514 10515 var sv *ImportKeyMaterialOutput 10516 if *v == nil { 10517 sv = &ImportKeyMaterialOutput{} 10518 } else { 10519 sv = *v 10520 } 10521 10522 for key, value := range shape { 10523 switch key { 10524 default: 10525 _, _ = key, value 10526 10527 } 10528 } 10529 *v = sv 10530 return nil 10531} 10532 10533func awsAwsjson11_deserializeOpDocumentListAliasesOutput(v **ListAliasesOutput, value interface{}) error { 10534 if v == nil { 10535 return fmt.Errorf("unexpected nil of type %T", v) 10536 } 10537 if value == nil { 10538 return nil 10539 } 10540 10541 shape, ok := value.(map[string]interface{}) 10542 if !ok { 10543 return fmt.Errorf("unexpected JSON type %v", value) 10544 } 10545 10546 var sv *ListAliasesOutput 10547 if *v == nil { 10548 sv = &ListAliasesOutput{} 10549 } else { 10550 sv = *v 10551 } 10552 10553 for key, value := range shape { 10554 switch key { 10555 case "Aliases": 10556 if err := awsAwsjson11_deserializeDocumentAliasList(&sv.Aliases, value); err != nil { 10557 return err 10558 } 10559 10560 case "NextMarker": 10561 if value != nil { 10562 jtv, ok := value.(string) 10563 if !ok { 10564 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10565 } 10566 sv.NextMarker = ptr.String(jtv) 10567 } 10568 10569 case "Truncated": 10570 if value != nil { 10571 jtv, ok := value.(bool) 10572 if !ok { 10573 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10574 } 10575 sv.Truncated = jtv 10576 } 10577 10578 default: 10579 _, _ = key, value 10580 10581 } 10582 } 10583 *v = sv 10584 return nil 10585} 10586 10587func awsAwsjson11_deserializeOpDocumentListGrantsOutput(v **ListGrantsOutput, value interface{}) error { 10588 if v == nil { 10589 return fmt.Errorf("unexpected nil of type %T", v) 10590 } 10591 if value == nil { 10592 return nil 10593 } 10594 10595 shape, ok := value.(map[string]interface{}) 10596 if !ok { 10597 return fmt.Errorf("unexpected JSON type %v", value) 10598 } 10599 10600 var sv *ListGrantsOutput 10601 if *v == nil { 10602 sv = &ListGrantsOutput{} 10603 } else { 10604 sv = *v 10605 } 10606 10607 for key, value := range shape { 10608 switch key { 10609 case "Grants": 10610 if err := awsAwsjson11_deserializeDocumentGrantList(&sv.Grants, value); err != nil { 10611 return err 10612 } 10613 10614 case "NextMarker": 10615 if value != nil { 10616 jtv, ok := value.(string) 10617 if !ok { 10618 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10619 } 10620 sv.NextMarker = ptr.String(jtv) 10621 } 10622 10623 case "Truncated": 10624 if value != nil { 10625 jtv, ok := value.(bool) 10626 if !ok { 10627 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10628 } 10629 sv.Truncated = jtv 10630 } 10631 10632 default: 10633 _, _ = key, value 10634 10635 } 10636 } 10637 *v = sv 10638 return nil 10639} 10640 10641func awsAwsjson11_deserializeOpDocumentListKeyPoliciesOutput(v **ListKeyPoliciesOutput, value interface{}) error { 10642 if v == nil { 10643 return fmt.Errorf("unexpected nil of type %T", v) 10644 } 10645 if value == nil { 10646 return nil 10647 } 10648 10649 shape, ok := value.(map[string]interface{}) 10650 if !ok { 10651 return fmt.Errorf("unexpected JSON type %v", value) 10652 } 10653 10654 var sv *ListKeyPoliciesOutput 10655 if *v == nil { 10656 sv = &ListKeyPoliciesOutput{} 10657 } else { 10658 sv = *v 10659 } 10660 10661 for key, value := range shape { 10662 switch key { 10663 case "NextMarker": 10664 if value != nil { 10665 jtv, ok := value.(string) 10666 if !ok { 10667 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10668 } 10669 sv.NextMarker = ptr.String(jtv) 10670 } 10671 10672 case "PolicyNames": 10673 if err := awsAwsjson11_deserializeDocumentPolicyNameList(&sv.PolicyNames, value); err != nil { 10674 return err 10675 } 10676 10677 case "Truncated": 10678 if value != nil { 10679 jtv, ok := value.(bool) 10680 if !ok { 10681 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10682 } 10683 sv.Truncated = jtv 10684 } 10685 10686 default: 10687 _, _ = key, value 10688 10689 } 10690 } 10691 *v = sv 10692 return nil 10693} 10694 10695func awsAwsjson11_deserializeOpDocumentListKeysOutput(v **ListKeysOutput, value interface{}) error { 10696 if v == nil { 10697 return fmt.Errorf("unexpected nil of type %T", v) 10698 } 10699 if value == nil { 10700 return nil 10701 } 10702 10703 shape, ok := value.(map[string]interface{}) 10704 if !ok { 10705 return fmt.Errorf("unexpected JSON type %v", value) 10706 } 10707 10708 var sv *ListKeysOutput 10709 if *v == nil { 10710 sv = &ListKeysOutput{} 10711 } else { 10712 sv = *v 10713 } 10714 10715 for key, value := range shape { 10716 switch key { 10717 case "Keys": 10718 if err := awsAwsjson11_deserializeDocumentKeyList(&sv.Keys, value); err != nil { 10719 return err 10720 } 10721 10722 case "NextMarker": 10723 if value != nil { 10724 jtv, ok := value.(string) 10725 if !ok { 10726 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10727 } 10728 sv.NextMarker = ptr.String(jtv) 10729 } 10730 10731 case "Truncated": 10732 if value != nil { 10733 jtv, ok := value.(bool) 10734 if !ok { 10735 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10736 } 10737 sv.Truncated = jtv 10738 } 10739 10740 default: 10741 _, _ = key, value 10742 10743 } 10744 } 10745 *v = sv 10746 return nil 10747} 10748 10749func awsAwsjson11_deserializeOpDocumentListResourceTagsOutput(v **ListResourceTagsOutput, value interface{}) error { 10750 if v == nil { 10751 return fmt.Errorf("unexpected nil of type %T", v) 10752 } 10753 if value == nil { 10754 return nil 10755 } 10756 10757 shape, ok := value.(map[string]interface{}) 10758 if !ok { 10759 return fmt.Errorf("unexpected JSON type %v", value) 10760 } 10761 10762 var sv *ListResourceTagsOutput 10763 if *v == nil { 10764 sv = &ListResourceTagsOutput{} 10765 } else { 10766 sv = *v 10767 } 10768 10769 for key, value := range shape { 10770 switch key { 10771 case "NextMarker": 10772 if value != nil { 10773 jtv, ok := value.(string) 10774 if !ok { 10775 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10776 } 10777 sv.NextMarker = ptr.String(jtv) 10778 } 10779 10780 case "Tags": 10781 if err := awsAwsjson11_deserializeDocumentTagList(&sv.Tags, value); err != nil { 10782 return err 10783 } 10784 10785 case "Truncated": 10786 if value != nil { 10787 jtv, ok := value.(bool) 10788 if !ok { 10789 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10790 } 10791 sv.Truncated = jtv 10792 } 10793 10794 default: 10795 _, _ = key, value 10796 10797 } 10798 } 10799 *v = sv 10800 return nil 10801} 10802 10803func awsAwsjson11_deserializeOpDocumentListRetirableGrantsOutput(v **ListRetirableGrantsOutput, value interface{}) error { 10804 if v == nil { 10805 return fmt.Errorf("unexpected nil of type %T", v) 10806 } 10807 if value == nil { 10808 return nil 10809 } 10810 10811 shape, ok := value.(map[string]interface{}) 10812 if !ok { 10813 return fmt.Errorf("unexpected JSON type %v", value) 10814 } 10815 10816 var sv *ListRetirableGrantsOutput 10817 if *v == nil { 10818 sv = &ListRetirableGrantsOutput{} 10819 } else { 10820 sv = *v 10821 } 10822 10823 for key, value := range shape { 10824 switch key { 10825 case "Grants": 10826 if err := awsAwsjson11_deserializeDocumentGrantList(&sv.Grants, value); err != nil { 10827 return err 10828 } 10829 10830 case "NextMarker": 10831 if value != nil { 10832 jtv, ok := value.(string) 10833 if !ok { 10834 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10835 } 10836 sv.NextMarker = ptr.String(jtv) 10837 } 10838 10839 case "Truncated": 10840 if value != nil { 10841 jtv, ok := value.(bool) 10842 if !ok { 10843 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10844 } 10845 sv.Truncated = jtv 10846 } 10847 10848 default: 10849 _, _ = key, value 10850 10851 } 10852 } 10853 *v = sv 10854 return nil 10855} 10856 10857func awsAwsjson11_deserializeOpDocumentReEncryptOutput(v **ReEncryptOutput, value interface{}) error { 10858 if v == nil { 10859 return fmt.Errorf("unexpected nil of type %T", v) 10860 } 10861 if value == nil { 10862 return nil 10863 } 10864 10865 shape, ok := value.(map[string]interface{}) 10866 if !ok { 10867 return fmt.Errorf("unexpected JSON type %v", value) 10868 } 10869 10870 var sv *ReEncryptOutput 10871 if *v == nil { 10872 sv = &ReEncryptOutput{} 10873 } else { 10874 sv = *v 10875 } 10876 10877 for key, value := range shape { 10878 switch key { 10879 case "CiphertextBlob": 10880 if value != nil { 10881 jtv, ok := value.(string) 10882 if !ok { 10883 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 10884 } 10885 dv, err := base64.StdEncoding.DecodeString(jtv) 10886 if err != nil { 10887 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 10888 } 10889 sv.CiphertextBlob = dv 10890 } 10891 10892 case "DestinationEncryptionAlgorithm": 10893 if value != nil { 10894 jtv, ok := value.(string) 10895 if !ok { 10896 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 10897 } 10898 sv.DestinationEncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 10899 } 10900 10901 case "KeyId": 10902 if value != nil { 10903 jtv, ok := value.(string) 10904 if !ok { 10905 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10906 } 10907 sv.KeyId = ptr.String(jtv) 10908 } 10909 10910 case "SourceEncryptionAlgorithm": 10911 if value != nil { 10912 jtv, ok := value.(string) 10913 if !ok { 10914 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 10915 } 10916 sv.SourceEncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 10917 } 10918 10919 case "SourceKeyId": 10920 if value != nil { 10921 jtv, ok := value.(string) 10922 if !ok { 10923 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10924 } 10925 sv.SourceKeyId = ptr.String(jtv) 10926 } 10927 10928 default: 10929 _, _ = key, value 10930 10931 } 10932 } 10933 *v = sv 10934 return nil 10935} 10936 10937func awsAwsjson11_deserializeOpDocumentReplicateKeyOutput(v **ReplicateKeyOutput, value interface{}) error { 10938 if v == nil { 10939 return fmt.Errorf("unexpected nil of type %T", v) 10940 } 10941 if value == nil { 10942 return nil 10943 } 10944 10945 shape, ok := value.(map[string]interface{}) 10946 if !ok { 10947 return fmt.Errorf("unexpected JSON type %v", value) 10948 } 10949 10950 var sv *ReplicateKeyOutput 10951 if *v == nil { 10952 sv = &ReplicateKeyOutput{} 10953 } else { 10954 sv = *v 10955 } 10956 10957 for key, value := range shape { 10958 switch key { 10959 case "ReplicaKeyMetadata": 10960 if err := awsAwsjson11_deserializeDocumentKeyMetadata(&sv.ReplicaKeyMetadata, value); err != nil { 10961 return err 10962 } 10963 10964 case "ReplicaPolicy": 10965 if value != nil { 10966 jtv, ok := value.(string) 10967 if !ok { 10968 return fmt.Errorf("expected PolicyType to be of type string, got %T instead", value) 10969 } 10970 sv.ReplicaPolicy = ptr.String(jtv) 10971 } 10972 10973 case "ReplicaTags": 10974 if err := awsAwsjson11_deserializeDocumentTagList(&sv.ReplicaTags, value); err != nil { 10975 return err 10976 } 10977 10978 default: 10979 _, _ = key, value 10980 10981 } 10982 } 10983 *v = sv 10984 return nil 10985} 10986 10987func awsAwsjson11_deserializeOpDocumentScheduleKeyDeletionOutput(v **ScheduleKeyDeletionOutput, value interface{}) error { 10988 if v == nil { 10989 return fmt.Errorf("unexpected nil of type %T", v) 10990 } 10991 if value == nil { 10992 return nil 10993 } 10994 10995 shape, ok := value.(map[string]interface{}) 10996 if !ok { 10997 return fmt.Errorf("unexpected JSON type %v", value) 10998 } 10999 11000 var sv *ScheduleKeyDeletionOutput 11001 if *v == nil { 11002 sv = &ScheduleKeyDeletionOutput{} 11003 } else { 11004 sv = *v 11005 } 11006 11007 for key, value := range shape { 11008 switch key { 11009 case "DeletionDate": 11010 if value != nil { 11011 switch jtv := value.(type) { 11012 case json.Number: 11013 f64, err := jtv.Float64() 11014 if err != nil { 11015 return err 11016 } 11017 sv.DeletionDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11018 11019 default: 11020 return fmt.Errorf("expected DateType to be a JSON Number, got %T instead", value) 11021 11022 } 11023 } 11024 11025 case "KeyId": 11026 if value != nil { 11027 jtv, ok := value.(string) 11028 if !ok { 11029 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 11030 } 11031 sv.KeyId = ptr.String(jtv) 11032 } 11033 11034 case "KeyState": 11035 if value != nil { 11036 jtv, ok := value.(string) 11037 if !ok { 11038 return fmt.Errorf("expected KeyState to be of type string, got %T instead", value) 11039 } 11040 sv.KeyState = types.KeyState(jtv) 11041 } 11042 11043 case "PendingWindowInDays": 11044 if value != nil { 11045 jtv, ok := value.(json.Number) 11046 if !ok { 11047 return fmt.Errorf("expected PendingWindowInDaysType to be json.Number, got %T instead", value) 11048 } 11049 i64, err := jtv.Int64() 11050 if err != nil { 11051 return err 11052 } 11053 sv.PendingWindowInDays = ptr.Int32(int32(i64)) 11054 } 11055 11056 default: 11057 _, _ = key, value 11058 11059 } 11060 } 11061 *v = sv 11062 return nil 11063} 11064 11065func awsAwsjson11_deserializeOpDocumentSignOutput(v **SignOutput, value interface{}) error { 11066 if v == nil { 11067 return fmt.Errorf("unexpected nil of type %T", v) 11068 } 11069 if value == nil { 11070 return nil 11071 } 11072 11073 shape, ok := value.(map[string]interface{}) 11074 if !ok { 11075 return fmt.Errorf("unexpected JSON type %v", value) 11076 } 11077 11078 var sv *SignOutput 11079 if *v == nil { 11080 sv = &SignOutput{} 11081 } else { 11082 sv = *v 11083 } 11084 11085 for key, value := range shape { 11086 switch key { 11087 case "KeyId": 11088 if value != nil { 11089 jtv, ok := value.(string) 11090 if !ok { 11091 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 11092 } 11093 sv.KeyId = ptr.String(jtv) 11094 } 11095 11096 case "Signature": 11097 if value != nil { 11098 jtv, ok := value.(string) 11099 if !ok { 11100 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 11101 } 11102 dv, err := base64.StdEncoding.DecodeString(jtv) 11103 if err != nil { 11104 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 11105 } 11106 sv.Signature = dv 11107 } 11108 11109 case "SigningAlgorithm": 11110 if value != nil { 11111 jtv, ok := value.(string) 11112 if !ok { 11113 return fmt.Errorf("expected SigningAlgorithmSpec to be of type string, got %T instead", value) 11114 } 11115 sv.SigningAlgorithm = types.SigningAlgorithmSpec(jtv) 11116 } 11117 11118 default: 11119 _, _ = key, value 11120 11121 } 11122 } 11123 *v = sv 11124 return nil 11125} 11126 11127func awsAwsjson11_deserializeOpDocumentUpdateCustomKeyStoreOutput(v **UpdateCustomKeyStoreOutput, value interface{}) error { 11128 if v == nil { 11129 return fmt.Errorf("unexpected nil of type %T", v) 11130 } 11131 if value == nil { 11132 return nil 11133 } 11134 11135 shape, ok := value.(map[string]interface{}) 11136 if !ok { 11137 return fmt.Errorf("unexpected JSON type %v", value) 11138 } 11139 11140 var sv *UpdateCustomKeyStoreOutput 11141 if *v == nil { 11142 sv = &UpdateCustomKeyStoreOutput{} 11143 } else { 11144 sv = *v 11145 } 11146 11147 for key, value := range shape { 11148 switch key { 11149 default: 11150 _, _ = key, value 11151 11152 } 11153 } 11154 *v = sv 11155 return nil 11156} 11157 11158func awsAwsjson11_deserializeOpDocumentVerifyOutput(v **VerifyOutput, value interface{}) error { 11159 if v == nil { 11160 return fmt.Errorf("unexpected nil of type %T", v) 11161 } 11162 if value == nil { 11163 return nil 11164 } 11165 11166 shape, ok := value.(map[string]interface{}) 11167 if !ok { 11168 return fmt.Errorf("unexpected JSON type %v", value) 11169 } 11170 11171 var sv *VerifyOutput 11172 if *v == nil { 11173 sv = &VerifyOutput{} 11174 } else { 11175 sv = *v 11176 } 11177 11178 for key, value := range shape { 11179 switch key { 11180 case "KeyId": 11181 if value != nil { 11182 jtv, ok := value.(string) 11183 if !ok { 11184 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 11185 } 11186 sv.KeyId = ptr.String(jtv) 11187 } 11188 11189 case "SignatureValid": 11190 if value != nil { 11191 jtv, ok := value.(bool) 11192 if !ok { 11193 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 11194 } 11195 sv.SignatureValid = jtv 11196 } 11197 11198 case "SigningAlgorithm": 11199 if value != nil { 11200 jtv, ok := value.(string) 11201 if !ok { 11202 return fmt.Errorf("expected SigningAlgorithmSpec to be of type string, got %T instead", value) 11203 } 11204 sv.SigningAlgorithm = types.SigningAlgorithmSpec(jtv) 11205 } 11206 11207 default: 11208 _, _ = key, value 11209 11210 } 11211 } 11212 *v = sv 11213 return nil 11214} 11215