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("KeyUnavailableException", errorCode): 893 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 894 895 case strings.EqualFold("KMSInternalException", errorCode): 896 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 897 898 case strings.EqualFold("KMSInvalidStateException", errorCode): 899 return awsAwsjson11_deserializeErrorKMSInvalidStateException(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("KMSInternalException", errorCode): 1338 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1339 1340 default: 1341 genericError := &smithy.GenericAPIError{ 1342 Code: errorCode, 1343 Message: errorMessage, 1344 } 1345 return genericError 1346 1347 } 1348} 1349 1350type awsAwsjson11_deserializeOpDescribeKey struct { 1351} 1352 1353func (*awsAwsjson11_deserializeOpDescribeKey) ID() string { 1354 return "OperationDeserializer" 1355} 1356 1357func (m *awsAwsjson11_deserializeOpDescribeKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1358 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1359) { 1360 out, metadata, err = next.HandleDeserialize(ctx, in) 1361 if err != nil { 1362 return out, metadata, err 1363 } 1364 1365 response, ok := out.RawResponse.(*smithyhttp.Response) 1366 if !ok { 1367 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1368 } 1369 1370 if response.StatusCode < 200 || response.StatusCode >= 300 { 1371 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeKey(response, &metadata) 1372 } 1373 output := &DescribeKeyOutput{} 1374 out.Result = output 1375 1376 var buff [1024]byte 1377 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1378 1379 body := io.TeeReader(response.Body, ringBuffer) 1380 decoder := json.NewDecoder(body) 1381 decoder.UseNumber() 1382 var shape interface{} 1383 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1384 var snapshot bytes.Buffer 1385 io.Copy(&snapshot, ringBuffer) 1386 err = &smithy.DeserializationError{ 1387 Err: fmt.Errorf("failed to decode response body, %w", err), 1388 Snapshot: snapshot.Bytes(), 1389 } 1390 return out, metadata, err 1391 } 1392 1393 err = awsAwsjson11_deserializeOpDocumentDescribeKeyOutput(&output, shape) 1394 if err != nil { 1395 var snapshot bytes.Buffer 1396 io.Copy(&snapshot, ringBuffer) 1397 err = &smithy.DeserializationError{ 1398 Err: fmt.Errorf("failed to decode response body, %w", err), 1399 Snapshot: snapshot.Bytes(), 1400 } 1401 return out, metadata, err 1402 } 1403 1404 return out, metadata, err 1405} 1406 1407func awsAwsjson11_deserializeOpErrorDescribeKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1408 var errorBuffer bytes.Buffer 1409 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1410 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1411 } 1412 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1413 1414 errorCode := "UnknownError" 1415 errorMessage := errorCode 1416 1417 code := response.Header.Get("X-Amzn-ErrorType") 1418 if len(code) != 0 { 1419 errorCode = restjson.SanitizeErrorCode(code) 1420 } 1421 1422 var buff [1024]byte 1423 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1424 1425 body := io.TeeReader(errorBody, ringBuffer) 1426 decoder := json.NewDecoder(body) 1427 decoder.UseNumber() 1428 code, message, err := restjson.GetErrorInfo(decoder) 1429 if err != nil { 1430 var snapshot bytes.Buffer 1431 io.Copy(&snapshot, ringBuffer) 1432 err = &smithy.DeserializationError{ 1433 Err: fmt.Errorf("failed to decode response body, %w", err), 1434 Snapshot: snapshot.Bytes(), 1435 } 1436 return err 1437 } 1438 1439 errorBody.Seek(0, io.SeekStart) 1440 if len(code) != 0 { 1441 errorCode = restjson.SanitizeErrorCode(code) 1442 } 1443 if len(message) != 0 { 1444 errorMessage = message 1445 } 1446 1447 switch { 1448 case strings.EqualFold("DependencyTimeoutException", errorCode): 1449 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1450 1451 case strings.EqualFold("InvalidArnException", errorCode): 1452 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1453 1454 case strings.EqualFold("KMSInternalException", errorCode): 1455 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1456 1457 case strings.EqualFold("NotFoundException", errorCode): 1458 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1459 1460 default: 1461 genericError := &smithy.GenericAPIError{ 1462 Code: errorCode, 1463 Message: errorMessage, 1464 } 1465 return genericError 1466 1467 } 1468} 1469 1470type awsAwsjson11_deserializeOpDisableKey struct { 1471} 1472 1473func (*awsAwsjson11_deserializeOpDisableKey) ID() string { 1474 return "OperationDeserializer" 1475} 1476 1477func (m *awsAwsjson11_deserializeOpDisableKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1478 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1479) { 1480 out, metadata, err = next.HandleDeserialize(ctx, in) 1481 if err != nil { 1482 return out, metadata, err 1483 } 1484 1485 response, ok := out.RawResponse.(*smithyhttp.Response) 1486 if !ok { 1487 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1488 } 1489 1490 if response.StatusCode < 200 || response.StatusCode >= 300 { 1491 return out, metadata, awsAwsjson11_deserializeOpErrorDisableKey(response, &metadata) 1492 } 1493 output := &DisableKeyOutput{} 1494 out.Result = output 1495 1496 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1497 return out, metadata, &smithy.DeserializationError{ 1498 Err: fmt.Errorf("failed to discard response body, %w", err), 1499 } 1500 } 1501 1502 return out, metadata, err 1503} 1504 1505func awsAwsjson11_deserializeOpErrorDisableKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1506 var errorBuffer bytes.Buffer 1507 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1508 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1509 } 1510 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1511 1512 errorCode := "UnknownError" 1513 errorMessage := errorCode 1514 1515 code := response.Header.Get("X-Amzn-ErrorType") 1516 if len(code) != 0 { 1517 errorCode = restjson.SanitizeErrorCode(code) 1518 } 1519 1520 var buff [1024]byte 1521 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1522 1523 body := io.TeeReader(errorBody, ringBuffer) 1524 decoder := json.NewDecoder(body) 1525 decoder.UseNumber() 1526 code, message, err := restjson.GetErrorInfo(decoder) 1527 if err != nil { 1528 var snapshot bytes.Buffer 1529 io.Copy(&snapshot, ringBuffer) 1530 err = &smithy.DeserializationError{ 1531 Err: fmt.Errorf("failed to decode response body, %w", err), 1532 Snapshot: snapshot.Bytes(), 1533 } 1534 return err 1535 } 1536 1537 errorBody.Seek(0, io.SeekStart) 1538 if len(code) != 0 { 1539 errorCode = restjson.SanitizeErrorCode(code) 1540 } 1541 if len(message) != 0 { 1542 errorMessage = message 1543 } 1544 1545 switch { 1546 case strings.EqualFold("DependencyTimeoutException", errorCode): 1547 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1548 1549 case strings.EqualFold("InvalidArnException", errorCode): 1550 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1551 1552 case strings.EqualFold("KMSInternalException", errorCode): 1553 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1554 1555 case strings.EqualFold("KMSInvalidStateException", errorCode): 1556 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1557 1558 case strings.EqualFold("NotFoundException", errorCode): 1559 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1560 1561 default: 1562 genericError := &smithy.GenericAPIError{ 1563 Code: errorCode, 1564 Message: errorMessage, 1565 } 1566 return genericError 1567 1568 } 1569} 1570 1571type awsAwsjson11_deserializeOpDisableKeyRotation struct { 1572} 1573 1574func (*awsAwsjson11_deserializeOpDisableKeyRotation) ID() string { 1575 return "OperationDeserializer" 1576} 1577 1578func (m *awsAwsjson11_deserializeOpDisableKeyRotation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1579 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1580) { 1581 out, metadata, err = next.HandleDeserialize(ctx, in) 1582 if err != nil { 1583 return out, metadata, err 1584 } 1585 1586 response, ok := out.RawResponse.(*smithyhttp.Response) 1587 if !ok { 1588 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1589 } 1590 1591 if response.StatusCode < 200 || response.StatusCode >= 300 { 1592 return out, metadata, awsAwsjson11_deserializeOpErrorDisableKeyRotation(response, &metadata) 1593 } 1594 output := &DisableKeyRotationOutput{} 1595 out.Result = output 1596 1597 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1598 return out, metadata, &smithy.DeserializationError{ 1599 Err: fmt.Errorf("failed to discard response body, %w", err), 1600 } 1601 } 1602 1603 return out, metadata, err 1604} 1605 1606func awsAwsjson11_deserializeOpErrorDisableKeyRotation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1607 var errorBuffer bytes.Buffer 1608 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1609 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1610 } 1611 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1612 1613 errorCode := "UnknownError" 1614 errorMessage := errorCode 1615 1616 code := response.Header.Get("X-Amzn-ErrorType") 1617 if len(code) != 0 { 1618 errorCode = restjson.SanitizeErrorCode(code) 1619 } 1620 1621 var buff [1024]byte 1622 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1623 1624 body := io.TeeReader(errorBody, ringBuffer) 1625 decoder := json.NewDecoder(body) 1626 decoder.UseNumber() 1627 code, message, err := restjson.GetErrorInfo(decoder) 1628 if err != nil { 1629 var snapshot bytes.Buffer 1630 io.Copy(&snapshot, ringBuffer) 1631 err = &smithy.DeserializationError{ 1632 Err: fmt.Errorf("failed to decode response body, %w", err), 1633 Snapshot: snapshot.Bytes(), 1634 } 1635 return err 1636 } 1637 1638 errorBody.Seek(0, io.SeekStart) 1639 if len(code) != 0 { 1640 errorCode = restjson.SanitizeErrorCode(code) 1641 } 1642 if len(message) != 0 { 1643 errorMessage = message 1644 } 1645 1646 switch { 1647 case strings.EqualFold("DependencyTimeoutException", errorCode): 1648 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1649 1650 case strings.EqualFold("DisabledException", errorCode): 1651 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 1652 1653 case strings.EqualFold("InvalidArnException", errorCode): 1654 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1655 1656 case strings.EqualFold("KMSInternalException", errorCode): 1657 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1658 1659 case strings.EqualFold("KMSInvalidStateException", errorCode): 1660 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1661 1662 case strings.EqualFold("NotFoundException", errorCode): 1663 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1664 1665 case strings.EqualFold("UnsupportedOperationException", errorCode): 1666 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 1667 1668 default: 1669 genericError := &smithy.GenericAPIError{ 1670 Code: errorCode, 1671 Message: errorMessage, 1672 } 1673 return genericError 1674 1675 } 1676} 1677 1678type awsAwsjson11_deserializeOpDisconnectCustomKeyStore struct { 1679} 1680 1681func (*awsAwsjson11_deserializeOpDisconnectCustomKeyStore) ID() string { 1682 return "OperationDeserializer" 1683} 1684 1685func (m *awsAwsjson11_deserializeOpDisconnectCustomKeyStore) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1686 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1687) { 1688 out, metadata, err = next.HandleDeserialize(ctx, in) 1689 if err != nil { 1690 return out, metadata, err 1691 } 1692 1693 response, ok := out.RawResponse.(*smithyhttp.Response) 1694 if !ok { 1695 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1696 } 1697 1698 if response.StatusCode < 200 || response.StatusCode >= 300 { 1699 return out, metadata, awsAwsjson11_deserializeOpErrorDisconnectCustomKeyStore(response, &metadata) 1700 } 1701 output := &DisconnectCustomKeyStoreOutput{} 1702 out.Result = output 1703 1704 var buff [1024]byte 1705 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1706 1707 body := io.TeeReader(response.Body, ringBuffer) 1708 decoder := json.NewDecoder(body) 1709 decoder.UseNumber() 1710 var shape interface{} 1711 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1712 var snapshot bytes.Buffer 1713 io.Copy(&snapshot, ringBuffer) 1714 err = &smithy.DeserializationError{ 1715 Err: fmt.Errorf("failed to decode response body, %w", err), 1716 Snapshot: snapshot.Bytes(), 1717 } 1718 return out, metadata, err 1719 } 1720 1721 err = awsAwsjson11_deserializeOpDocumentDisconnectCustomKeyStoreOutput(&output, shape) 1722 if err != nil { 1723 var snapshot bytes.Buffer 1724 io.Copy(&snapshot, ringBuffer) 1725 err = &smithy.DeserializationError{ 1726 Err: fmt.Errorf("failed to decode response body, %w", err), 1727 Snapshot: snapshot.Bytes(), 1728 } 1729 return out, metadata, err 1730 } 1731 1732 return out, metadata, err 1733} 1734 1735func awsAwsjson11_deserializeOpErrorDisconnectCustomKeyStore(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1736 var errorBuffer bytes.Buffer 1737 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1738 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1739 } 1740 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1741 1742 errorCode := "UnknownError" 1743 errorMessage := errorCode 1744 1745 code := response.Header.Get("X-Amzn-ErrorType") 1746 if len(code) != 0 { 1747 errorCode = restjson.SanitizeErrorCode(code) 1748 } 1749 1750 var buff [1024]byte 1751 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1752 1753 body := io.TeeReader(errorBody, ringBuffer) 1754 decoder := json.NewDecoder(body) 1755 decoder.UseNumber() 1756 code, message, err := restjson.GetErrorInfo(decoder) 1757 if err != nil { 1758 var snapshot bytes.Buffer 1759 io.Copy(&snapshot, ringBuffer) 1760 err = &smithy.DeserializationError{ 1761 Err: fmt.Errorf("failed to decode response body, %w", err), 1762 Snapshot: snapshot.Bytes(), 1763 } 1764 return err 1765 } 1766 1767 errorBody.Seek(0, io.SeekStart) 1768 if len(code) != 0 { 1769 errorCode = restjson.SanitizeErrorCode(code) 1770 } 1771 if len(message) != 0 { 1772 errorMessage = message 1773 } 1774 1775 switch { 1776 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 1777 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 1778 1779 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 1780 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 1781 1782 case strings.EqualFold("KMSInternalException", errorCode): 1783 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1784 1785 default: 1786 genericError := &smithy.GenericAPIError{ 1787 Code: errorCode, 1788 Message: errorMessage, 1789 } 1790 return genericError 1791 1792 } 1793} 1794 1795type awsAwsjson11_deserializeOpEnableKey struct { 1796} 1797 1798func (*awsAwsjson11_deserializeOpEnableKey) ID() string { 1799 return "OperationDeserializer" 1800} 1801 1802func (m *awsAwsjson11_deserializeOpEnableKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1803 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1804) { 1805 out, metadata, err = next.HandleDeserialize(ctx, in) 1806 if err != nil { 1807 return out, metadata, err 1808 } 1809 1810 response, ok := out.RawResponse.(*smithyhttp.Response) 1811 if !ok { 1812 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1813 } 1814 1815 if response.StatusCode < 200 || response.StatusCode >= 300 { 1816 return out, metadata, awsAwsjson11_deserializeOpErrorEnableKey(response, &metadata) 1817 } 1818 output := &EnableKeyOutput{} 1819 out.Result = output 1820 1821 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1822 return out, metadata, &smithy.DeserializationError{ 1823 Err: fmt.Errorf("failed to discard response body, %w", err), 1824 } 1825 } 1826 1827 return out, metadata, err 1828} 1829 1830func awsAwsjson11_deserializeOpErrorEnableKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1831 var errorBuffer bytes.Buffer 1832 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1833 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1834 } 1835 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1836 1837 errorCode := "UnknownError" 1838 errorMessage := errorCode 1839 1840 code := response.Header.Get("X-Amzn-ErrorType") 1841 if len(code) != 0 { 1842 errorCode = restjson.SanitizeErrorCode(code) 1843 } 1844 1845 var buff [1024]byte 1846 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1847 1848 body := io.TeeReader(errorBody, ringBuffer) 1849 decoder := json.NewDecoder(body) 1850 decoder.UseNumber() 1851 code, message, err := restjson.GetErrorInfo(decoder) 1852 if err != nil { 1853 var snapshot bytes.Buffer 1854 io.Copy(&snapshot, ringBuffer) 1855 err = &smithy.DeserializationError{ 1856 Err: fmt.Errorf("failed to decode response body, %w", err), 1857 Snapshot: snapshot.Bytes(), 1858 } 1859 return err 1860 } 1861 1862 errorBody.Seek(0, io.SeekStart) 1863 if len(code) != 0 { 1864 errorCode = restjson.SanitizeErrorCode(code) 1865 } 1866 if len(message) != 0 { 1867 errorMessage = message 1868 } 1869 1870 switch { 1871 case strings.EqualFold("DependencyTimeoutException", errorCode): 1872 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1873 1874 case strings.EqualFold("InvalidArnException", errorCode): 1875 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1876 1877 case strings.EqualFold("KMSInternalException", errorCode): 1878 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1879 1880 case strings.EqualFold("KMSInvalidStateException", errorCode): 1881 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1882 1883 case strings.EqualFold("LimitExceededException", errorCode): 1884 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 1885 1886 case strings.EqualFold("NotFoundException", errorCode): 1887 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1888 1889 default: 1890 genericError := &smithy.GenericAPIError{ 1891 Code: errorCode, 1892 Message: errorMessage, 1893 } 1894 return genericError 1895 1896 } 1897} 1898 1899type awsAwsjson11_deserializeOpEnableKeyRotation struct { 1900} 1901 1902func (*awsAwsjson11_deserializeOpEnableKeyRotation) ID() string { 1903 return "OperationDeserializer" 1904} 1905 1906func (m *awsAwsjson11_deserializeOpEnableKeyRotation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1907 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1908) { 1909 out, metadata, err = next.HandleDeserialize(ctx, in) 1910 if err != nil { 1911 return out, metadata, err 1912 } 1913 1914 response, ok := out.RawResponse.(*smithyhttp.Response) 1915 if !ok { 1916 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1917 } 1918 1919 if response.StatusCode < 200 || response.StatusCode >= 300 { 1920 return out, metadata, awsAwsjson11_deserializeOpErrorEnableKeyRotation(response, &metadata) 1921 } 1922 output := &EnableKeyRotationOutput{} 1923 out.Result = output 1924 1925 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1926 return out, metadata, &smithy.DeserializationError{ 1927 Err: fmt.Errorf("failed to discard response body, %w", err), 1928 } 1929 } 1930 1931 return out, metadata, err 1932} 1933 1934func awsAwsjson11_deserializeOpErrorEnableKeyRotation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1935 var errorBuffer bytes.Buffer 1936 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1937 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1938 } 1939 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1940 1941 errorCode := "UnknownError" 1942 errorMessage := errorCode 1943 1944 code := response.Header.Get("X-Amzn-ErrorType") 1945 if len(code) != 0 { 1946 errorCode = restjson.SanitizeErrorCode(code) 1947 } 1948 1949 var buff [1024]byte 1950 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1951 1952 body := io.TeeReader(errorBody, ringBuffer) 1953 decoder := json.NewDecoder(body) 1954 decoder.UseNumber() 1955 code, message, err := restjson.GetErrorInfo(decoder) 1956 if err != nil { 1957 var snapshot bytes.Buffer 1958 io.Copy(&snapshot, ringBuffer) 1959 err = &smithy.DeserializationError{ 1960 Err: fmt.Errorf("failed to decode response body, %w", err), 1961 Snapshot: snapshot.Bytes(), 1962 } 1963 return err 1964 } 1965 1966 errorBody.Seek(0, io.SeekStart) 1967 if len(code) != 0 { 1968 errorCode = restjson.SanitizeErrorCode(code) 1969 } 1970 if len(message) != 0 { 1971 errorMessage = message 1972 } 1973 1974 switch { 1975 case strings.EqualFold("DependencyTimeoutException", errorCode): 1976 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 1977 1978 case strings.EqualFold("DisabledException", errorCode): 1979 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 1980 1981 case strings.EqualFold("InvalidArnException", errorCode): 1982 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 1983 1984 case strings.EqualFold("KMSInternalException", errorCode): 1985 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 1986 1987 case strings.EqualFold("KMSInvalidStateException", errorCode): 1988 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 1989 1990 case strings.EqualFold("NotFoundException", errorCode): 1991 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 1992 1993 case strings.EqualFold("UnsupportedOperationException", errorCode): 1994 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 1995 1996 default: 1997 genericError := &smithy.GenericAPIError{ 1998 Code: errorCode, 1999 Message: errorMessage, 2000 } 2001 return genericError 2002 2003 } 2004} 2005 2006type awsAwsjson11_deserializeOpEncrypt struct { 2007} 2008 2009func (*awsAwsjson11_deserializeOpEncrypt) ID() string { 2010 return "OperationDeserializer" 2011} 2012 2013func (m *awsAwsjson11_deserializeOpEncrypt) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2014 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2015) { 2016 out, metadata, err = next.HandleDeserialize(ctx, in) 2017 if err != nil { 2018 return out, metadata, err 2019 } 2020 2021 response, ok := out.RawResponse.(*smithyhttp.Response) 2022 if !ok { 2023 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2024 } 2025 2026 if response.StatusCode < 200 || response.StatusCode >= 300 { 2027 return out, metadata, awsAwsjson11_deserializeOpErrorEncrypt(response, &metadata) 2028 } 2029 output := &EncryptOutput{} 2030 out.Result = output 2031 2032 var buff [1024]byte 2033 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2034 2035 body := io.TeeReader(response.Body, ringBuffer) 2036 decoder := json.NewDecoder(body) 2037 decoder.UseNumber() 2038 var shape interface{} 2039 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2040 var snapshot bytes.Buffer 2041 io.Copy(&snapshot, ringBuffer) 2042 err = &smithy.DeserializationError{ 2043 Err: fmt.Errorf("failed to decode response body, %w", err), 2044 Snapshot: snapshot.Bytes(), 2045 } 2046 return out, metadata, err 2047 } 2048 2049 err = awsAwsjson11_deserializeOpDocumentEncryptOutput(&output, shape) 2050 if err != nil { 2051 var snapshot bytes.Buffer 2052 io.Copy(&snapshot, ringBuffer) 2053 err = &smithy.DeserializationError{ 2054 Err: fmt.Errorf("failed to decode response body, %w", err), 2055 Snapshot: snapshot.Bytes(), 2056 } 2057 return out, metadata, err 2058 } 2059 2060 return out, metadata, err 2061} 2062 2063func awsAwsjson11_deserializeOpErrorEncrypt(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2064 var errorBuffer bytes.Buffer 2065 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2066 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2067 } 2068 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2069 2070 errorCode := "UnknownError" 2071 errorMessage := errorCode 2072 2073 code := response.Header.Get("X-Amzn-ErrorType") 2074 if len(code) != 0 { 2075 errorCode = restjson.SanitizeErrorCode(code) 2076 } 2077 2078 var buff [1024]byte 2079 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2080 2081 body := io.TeeReader(errorBody, ringBuffer) 2082 decoder := json.NewDecoder(body) 2083 decoder.UseNumber() 2084 code, message, err := restjson.GetErrorInfo(decoder) 2085 if err != nil { 2086 var snapshot bytes.Buffer 2087 io.Copy(&snapshot, ringBuffer) 2088 err = &smithy.DeserializationError{ 2089 Err: fmt.Errorf("failed to decode response body, %w", err), 2090 Snapshot: snapshot.Bytes(), 2091 } 2092 return err 2093 } 2094 2095 errorBody.Seek(0, io.SeekStart) 2096 if len(code) != 0 { 2097 errorCode = restjson.SanitizeErrorCode(code) 2098 } 2099 if len(message) != 0 { 2100 errorMessage = message 2101 } 2102 2103 switch { 2104 case strings.EqualFold("DependencyTimeoutException", errorCode): 2105 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2106 2107 case strings.EqualFold("DisabledException", errorCode): 2108 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2109 2110 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2111 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2112 2113 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2114 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2115 2116 case strings.EqualFold("KeyUnavailableException", errorCode): 2117 return awsAwsjson11_deserializeErrorKeyUnavailableException(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("NotFoundException", errorCode): 2126 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2127 2128 default: 2129 genericError := &smithy.GenericAPIError{ 2130 Code: errorCode, 2131 Message: errorMessage, 2132 } 2133 return genericError 2134 2135 } 2136} 2137 2138type awsAwsjson11_deserializeOpGenerateDataKey struct { 2139} 2140 2141func (*awsAwsjson11_deserializeOpGenerateDataKey) ID() string { 2142 return "OperationDeserializer" 2143} 2144 2145func (m *awsAwsjson11_deserializeOpGenerateDataKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2146 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2147) { 2148 out, metadata, err = next.HandleDeserialize(ctx, in) 2149 if err != nil { 2150 return out, metadata, err 2151 } 2152 2153 response, ok := out.RawResponse.(*smithyhttp.Response) 2154 if !ok { 2155 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2156 } 2157 2158 if response.StatusCode < 200 || response.StatusCode >= 300 { 2159 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKey(response, &metadata) 2160 } 2161 output := &GenerateDataKeyOutput{} 2162 out.Result = output 2163 2164 var buff [1024]byte 2165 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2166 2167 body := io.TeeReader(response.Body, ringBuffer) 2168 decoder := json.NewDecoder(body) 2169 decoder.UseNumber() 2170 var shape interface{} 2171 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2172 var snapshot bytes.Buffer 2173 io.Copy(&snapshot, ringBuffer) 2174 err = &smithy.DeserializationError{ 2175 Err: fmt.Errorf("failed to decode response body, %w", err), 2176 Snapshot: snapshot.Bytes(), 2177 } 2178 return out, metadata, err 2179 } 2180 2181 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyOutput(&output, shape) 2182 if err != nil { 2183 var snapshot bytes.Buffer 2184 io.Copy(&snapshot, ringBuffer) 2185 err = &smithy.DeserializationError{ 2186 Err: fmt.Errorf("failed to decode response body, %w", err), 2187 Snapshot: snapshot.Bytes(), 2188 } 2189 return out, metadata, err 2190 } 2191 2192 return out, metadata, err 2193} 2194 2195func awsAwsjson11_deserializeOpErrorGenerateDataKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2196 var errorBuffer bytes.Buffer 2197 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2198 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2199 } 2200 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2201 2202 errorCode := "UnknownError" 2203 errorMessage := errorCode 2204 2205 code := response.Header.Get("X-Amzn-ErrorType") 2206 if len(code) != 0 { 2207 errorCode = restjson.SanitizeErrorCode(code) 2208 } 2209 2210 var buff [1024]byte 2211 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2212 2213 body := io.TeeReader(errorBody, ringBuffer) 2214 decoder := json.NewDecoder(body) 2215 decoder.UseNumber() 2216 code, message, err := restjson.GetErrorInfo(decoder) 2217 if err != nil { 2218 var snapshot bytes.Buffer 2219 io.Copy(&snapshot, ringBuffer) 2220 err = &smithy.DeserializationError{ 2221 Err: fmt.Errorf("failed to decode response body, %w", err), 2222 Snapshot: snapshot.Bytes(), 2223 } 2224 return err 2225 } 2226 2227 errorBody.Seek(0, io.SeekStart) 2228 if len(code) != 0 { 2229 errorCode = restjson.SanitizeErrorCode(code) 2230 } 2231 if len(message) != 0 { 2232 errorMessage = message 2233 } 2234 2235 switch { 2236 case strings.EqualFold("DependencyTimeoutException", errorCode): 2237 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2238 2239 case strings.EqualFold("DisabledException", errorCode): 2240 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2241 2242 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2243 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2244 2245 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2246 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2247 2248 case strings.EqualFold("KeyUnavailableException", errorCode): 2249 return awsAwsjson11_deserializeErrorKeyUnavailableException(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("NotFoundException", errorCode): 2258 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2259 2260 default: 2261 genericError := &smithy.GenericAPIError{ 2262 Code: errorCode, 2263 Message: errorMessage, 2264 } 2265 return genericError 2266 2267 } 2268} 2269 2270type awsAwsjson11_deserializeOpGenerateDataKeyPair struct { 2271} 2272 2273func (*awsAwsjson11_deserializeOpGenerateDataKeyPair) ID() string { 2274 return "OperationDeserializer" 2275} 2276 2277func (m *awsAwsjson11_deserializeOpGenerateDataKeyPair) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2278 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2279) { 2280 out, metadata, err = next.HandleDeserialize(ctx, in) 2281 if err != nil { 2282 return out, metadata, err 2283 } 2284 2285 response, ok := out.RawResponse.(*smithyhttp.Response) 2286 if !ok { 2287 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2288 } 2289 2290 if response.StatusCode < 200 || response.StatusCode >= 300 { 2291 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKeyPair(response, &metadata) 2292 } 2293 output := &GenerateDataKeyPairOutput{} 2294 out.Result = output 2295 2296 var buff [1024]byte 2297 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2298 2299 body := io.TeeReader(response.Body, ringBuffer) 2300 decoder := json.NewDecoder(body) 2301 decoder.UseNumber() 2302 var shape interface{} 2303 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2304 var snapshot bytes.Buffer 2305 io.Copy(&snapshot, ringBuffer) 2306 err = &smithy.DeserializationError{ 2307 Err: fmt.Errorf("failed to decode response body, %w", err), 2308 Snapshot: snapshot.Bytes(), 2309 } 2310 return out, metadata, err 2311 } 2312 2313 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairOutput(&output, shape) 2314 if err != nil { 2315 var snapshot bytes.Buffer 2316 io.Copy(&snapshot, ringBuffer) 2317 err = &smithy.DeserializationError{ 2318 Err: fmt.Errorf("failed to decode response body, %w", err), 2319 Snapshot: snapshot.Bytes(), 2320 } 2321 return out, metadata, err 2322 } 2323 2324 return out, metadata, err 2325} 2326 2327func awsAwsjson11_deserializeOpErrorGenerateDataKeyPair(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2328 var errorBuffer bytes.Buffer 2329 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2330 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2331 } 2332 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2333 2334 errorCode := "UnknownError" 2335 errorMessage := errorCode 2336 2337 code := response.Header.Get("X-Amzn-ErrorType") 2338 if len(code) != 0 { 2339 errorCode = restjson.SanitizeErrorCode(code) 2340 } 2341 2342 var buff [1024]byte 2343 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2344 2345 body := io.TeeReader(errorBody, ringBuffer) 2346 decoder := json.NewDecoder(body) 2347 decoder.UseNumber() 2348 code, message, err := restjson.GetErrorInfo(decoder) 2349 if err != nil { 2350 var snapshot bytes.Buffer 2351 io.Copy(&snapshot, ringBuffer) 2352 err = &smithy.DeserializationError{ 2353 Err: fmt.Errorf("failed to decode response body, %w", err), 2354 Snapshot: snapshot.Bytes(), 2355 } 2356 return err 2357 } 2358 2359 errorBody.Seek(0, io.SeekStart) 2360 if len(code) != 0 { 2361 errorCode = restjson.SanitizeErrorCode(code) 2362 } 2363 if len(message) != 0 { 2364 errorMessage = message 2365 } 2366 2367 switch { 2368 case strings.EqualFold("DependencyTimeoutException", errorCode): 2369 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2370 2371 case strings.EqualFold("DisabledException", errorCode): 2372 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2373 2374 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2375 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2376 2377 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2378 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2379 2380 case strings.EqualFold("KeyUnavailableException", errorCode): 2381 return awsAwsjson11_deserializeErrorKeyUnavailableException(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("NotFoundException", errorCode): 2390 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2391 2392 case strings.EqualFold("UnsupportedOperationException", errorCode): 2393 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 2394 2395 default: 2396 genericError := &smithy.GenericAPIError{ 2397 Code: errorCode, 2398 Message: errorMessage, 2399 } 2400 return genericError 2401 2402 } 2403} 2404 2405type awsAwsjson11_deserializeOpGenerateDataKeyPairWithoutPlaintext struct { 2406} 2407 2408func (*awsAwsjson11_deserializeOpGenerateDataKeyPairWithoutPlaintext) ID() string { 2409 return "OperationDeserializer" 2410} 2411 2412func (m *awsAwsjson11_deserializeOpGenerateDataKeyPairWithoutPlaintext) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2413 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2414) { 2415 out, metadata, err = next.HandleDeserialize(ctx, in) 2416 if err != nil { 2417 return out, metadata, err 2418 } 2419 2420 response, ok := out.RawResponse.(*smithyhttp.Response) 2421 if !ok { 2422 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2423 } 2424 2425 if response.StatusCode < 200 || response.StatusCode >= 300 { 2426 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKeyPairWithoutPlaintext(response, &metadata) 2427 } 2428 output := &GenerateDataKeyPairWithoutPlaintextOutput{} 2429 out.Result = output 2430 2431 var buff [1024]byte 2432 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2433 2434 body := io.TeeReader(response.Body, ringBuffer) 2435 decoder := json.NewDecoder(body) 2436 decoder.UseNumber() 2437 var shape interface{} 2438 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2439 var snapshot bytes.Buffer 2440 io.Copy(&snapshot, ringBuffer) 2441 err = &smithy.DeserializationError{ 2442 Err: fmt.Errorf("failed to decode response body, %w", err), 2443 Snapshot: snapshot.Bytes(), 2444 } 2445 return out, metadata, err 2446 } 2447 2448 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairWithoutPlaintextOutput(&output, shape) 2449 if err != nil { 2450 var snapshot bytes.Buffer 2451 io.Copy(&snapshot, ringBuffer) 2452 err = &smithy.DeserializationError{ 2453 Err: fmt.Errorf("failed to decode response body, %w", err), 2454 Snapshot: snapshot.Bytes(), 2455 } 2456 return out, metadata, err 2457 } 2458 2459 return out, metadata, err 2460} 2461 2462func awsAwsjson11_deserializeOpErrorGenerateDataKeyPairWithoutPlaintext(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2463 var errorBuffer bytes.Buffer 2464 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2465 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2466 } 2467 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2468 2469 errorCode := "UnknownError" 2470 errorMessage := errorCode 2471 2472 code := response.Header.Get("X-Amzn-ErrorType") 2473 if len(code) != 0 { 2474 errorCode = restjson.SanitizeErrorCode(code) 2475 } 2476 2477 var buff [1024]byte 2478 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2479 2480 body := io.TeeReader(errorBody, ringBuffer) 2481 decoder := json.NewDecoder(body) 2482 decoder.UseNumber() 2483 code, message, err := restjson.GetErrorInfo(decoder) 2484 if err != nil { 2485 var snapshot bytes.Buffer 2486 io.Copy(&snapshot, ringBuffer) 2487 err = &smithy.DeserializationError{ 2488 Err: fmt.Errorf("failed to decode response body, %w", err), 2489 Snapshot: snapshot.Bytes(), 2490 } 2491 return err 2492 } 2493 2494 errorBody.Seek(0, io.SeekStart) 2495 if len(code) != 0 { 2496 errorCode = restjson.SanitizeErrorCode(code) 2497 } 2498 if len(message) != 0 { 2499 errorMessage = message 2500 } 2501 2502 switch { 2503 case strings.EqualFold("DependencyTimeoutException", errorCode): 2504 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2505 2506 case strings.EqualFold("DisabledException", errorCode): 2507 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2508 2509 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2510 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2511 2512 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2513 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2514 2515 case strings.EqualFold("KeyUnavailableException", errorCode): 2516 return awsAwsjson11_deserializeErrorKeyUnavailableException(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("NotFoundException", errorCode): 2525 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2526 2527 case strings.EqualFold("UnsupportedOperationException", errorCode): 2528 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 2529 2530 default: 2531 genericError := &smithy.GenericAPIError{ 2532 Code: errorCode, 2533 Message: errorMessage, 2534 } 2535 return genericError 2536 2537 } 2538} 2539 2540type awsAwsjson11_deserializeOpGenerateDataKeyWithoutPlaintext struct { 2541} 2542 2543func (*awsAwsjson11_deserializeOpGenerateDataKeyWithoutPlaintext) ID() string { 2544 return "OperationDeserializer" 2545} 2546 2547func (m *awsAwsjson11_deserializeOpGenerateDataKeyWithoutPlaintext) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2548 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2549) { 2550 out, metadata, err = next.HandleDeserialize(ctx, in) 2551 if err != nil { 2552 return out, metadata, err 2553 } 2554 2555 response, ok := out.RawResponse.(*smithyhttp.Response) 2556 if !ok { 2557 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2558 } 2559 2560 if response.StatusCode < 200 || response.StatusCode >= 300 { 2561 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateDataKeyWithoutPlaintext(response, &metadata) 2562 } 2563 output := &GenerateDataKeyWithoutPlaintextOutput{} 2564 out.Result = output 2565 2566 var buff [1024]byte 2567 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2568 2569 body := io.TeeReader(response.Body, ringBuffer) 2570 decoder := json.NewDecoder(body) 2571 decoder.UseNumber() 2572 var shape interface{} 2573 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2574 var snapshot bytes.Buffer 2575 io.Copy(&snapshot, ringBuffer) 2576 err = &smithy.DeserializationError{ 2577 Err: fmt.Errorf("failed to decode response body, %w", err), 2578 Snapshot: snapshot.Bytes(), 2579 } 2580 return out, metadata, err 2581 } 2582 2583 err = awsAwsjson11_deserializeOpDocumentGenerateDataKeyWithoutPlaintextOutput(&output, shape) 2584 if err != nil { 2585 var snapshot bytes.Buffer 2586 io.Copy(&snapshot, ringBuffer) 2587 err = &smithy.DeserializationError{ 2588 Err: fmt.Errorf("failed to decode response body, %w", err), 2589 Snapshot: snapshot.Bytes(), 2590 } 2591 return out, metadata, err 2592 } 2593 2594 return out, metadata, err 2595} 2596 2597func awsAwsjson11_deserializeOpErrorGenerateDataKeyWithoutPlaintext(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2598 var errorBuffer bytes.Buffer 2599 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2600 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2601 } 2602 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2603 2604 errorCode := "UnknownError" 2605 errorMessage := errorCode 2606 2607 code := response.Header.Get("X-Amzn-ErrorType") 2608 if len(code) != 0 { 2609 errorCode = restjson.SanitizeErrorCode(code) 2610 } 2611 2612 var buff [1024]byte 2613 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2614 2615 body := io.TeeReader(errorBody, ringBuffer) 2616 decoder := json.NewDecoder(body) 2617 decoder.UseNumber() 2618 code, message, err := restjson.GetErrorInfo(decoder) 2619 if err != nil { 2620 var snapshot bytes.Buffer 2621 io.Copy(&snapshot, ringBuffer) 2622 err = &smithy.DeserializationError{ 2623 Err: fmt.Errorf("failed to decode response body, %w", err), 2624 Snapshot: snapshot.Bytes(), 2625 } 2626 return err 2627 } 2628 2629 errorBody.Seek(0, io.SeekStart) 2630 if len(code) != 0 { 2631 errorCode = restjson.SanitizeErrorCode(code) 2632 } 2633 if len(message) != 0 { 2634 errorMessage = message 2635 } 2636 2637 switch { 2638 case strings.EqualFold("DependencyTimeoutException", errorCode): 2639 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2640 2641 case strings.EqualFold("DisabledException", errorCode): 2642 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 2643 2644 case strings.EqualFold("InvalidGrantTokenException", errorCode): 2645 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 2646 2647 case strings.EqualFold("InvalidKeyUsageException", errorCode): 2648 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 2649 2650 case strings.EqualFold("KeyUnavailableException", errorCode): 2651 return awsAwsjson11_deserializeErrorKeyUnavailableException(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("NotFoundException", errorCode): 2660 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2661 2662 default: 2663 genericError := &smithy.GenericAPIError{ 2664 Code: errorCode, 2665 Message: errorMessage, 2666 } 2667 return genericError 2668 2669 } 2670} 2671 2672type awsAwsjson11_deserializeOpGenerateRandom struct { 2673} 2674 2675func (*awsAwsjson11_deserializeOpGenerateRandom) ID() string { 2676 return "OperationDeserializer" 2677} 2678 2679func (m *awsAwsjson11_deserializeOpGenerateRandom) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2680 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2681) { 2682 out, metadata, err = next.HandleDeserialize(ctx, in) 2683 if err != nil { 2684 return out, metadata, err 2685 } 2686 2687 response, ok := out.RawResponse.(*smithyhttp.Response) 2688 if !ok { 2689 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2690 } 2691 2692 if response.StatusCode < 200 || response.StatusCode >= 300 { 2693 return out, metadata, awsAwsjson11_deserializeOpErrorGenerateRandom(response, &metadata) 2694 } 2695 output := &GenerateRandomOutput{} 2696 out.Result = output 2697 2698 var buff [1024]byte 2699 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2700 2701 body := io.TeeReader(response.Body, ringBuffer) 2702 decoder := json.NewDecoder(body) 2703 decoder.UseNumber() 2704 var shape interface{} 2705 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2706 var snapshot bytes.Buffer 2707 io.Copy(&snapshot, ringBuffer) 2708 err = &smithy.DeserializationError{ 2709 Err: fmt.Errorf("failed to decode response body, %w", err), 2710 Snapshot: snapshot.Bytes(), 2711 } 2712 return out, metadata, err 2713 } 2714 2715 err = awsAwsjson11_deserializeOpDocumentGenerateRandomOutput(&output, shape) 2716 if err != nil { 2717 var snapshot bytes.Buffer 2718 io.Copy(&snapshot, ringBuffer) 2719 err = &smithy.DeserializationError{ 2720 Err: fmt.Errorf("failed to decode response body, %w", err), 2721 Snapshot: snapshot.Bytes(), 2722 } 2723 return out, metadata, err 2724 } 2725 2726 return out, metadata, err 2727} 2728 2729func awsAwsjson11_deserializeOpErrorGenerateRandom(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2730 var errorBuffer bytes.Buffer 2731 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2732 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2733 } 2734 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2735 2736 errorCode := "UnknownError" 2737 errorMessage := errorCode 2738 2739 code := response.Header.Get("X-Amzn-ErrorType") 2740 if len(code) != 0 { 2741 errorCode = restjson.SanitizeErrorCode(code) 2742 } 2743 2744 var buff [1024]byte 2745 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2746 2747 body := io.TeeReader(errorBody, ringBuffer) 2748 decoder := json.NewDecoder(body) 2749 decoder.UseNumber() 2750 code, message, err := restjson.GetErrorInfo(decoder) 2751 if err != nil { 2752 var snapshot bytes.Buffer 2753 io.Copy(&snapshot, ringBuffer) 2754 err = &smithy.DeserializationError{ 2755 Err: fmt.Errorf("failed to decode response body, %w", err), 2756 Snapshot: snapshot.Bytes(), 2757 } 2758 return err 2759 } 2760 2761 errorBody.Seek(0, io.SeekStart) 2762 if len(code) != 0 { 2763 errorCode = restjson.SanitizeErrorCode(code) 2764 } 2765 if len(message) != 0 { 2766 errorMessage = message 2767 } 2768 2769 switch { 2770 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 2771 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 2772 2773 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 2774 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 2775 2776 case strings.EqualFold("DependencyTimeoutException", errorCode): 2777 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2778 2779 case strings.EqualFold("KMSInternalException", errorCode): 2780 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2781 2782 default: 2783 genericError := &smithy.GenericAPIError{ 2784 Code: errorCode, 2785 Message: errorMessage, 2786 } 2787 return genericError 2788 2789 } 2790} 2791 2792type awsAwsjson11_deserializeOpGetKeyPolicy struct { 2793} 2794 2795func (*awsAwsjson11_deserializeOpGetKeyPolicy) ID() string { 2796 return "OperationDeserializer" 2797} 2798 2799func (m *awsAwsjson11_deserializeOpGetKeyPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2800 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2801) { 2802 out, metadata, err = next.HandleDeserialize(ctx, in) 2803 if err != nil { 2804 return out, metadata, err 2805 } 2806 2807 response, ok := out.RawResponse.(*smithyhttp.Response) 2808 if !ok { 2809 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2810 } 2811 2812 if response.StatusCode < 200 || response.StatusCode >= 300 { 2813 return out, metadata, awsAwsjson11_deserializeOpErrorGetKeyPolicy(response, &metadata) 2814 } 2815 output := &GetKeyPolicyOutput{} 2816 out.Result = output 2817 2818 var buff [1024]byte 2819 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2820 2821 body := io.TeeReader(response.Body, ringBuffer) 2822 decoder := json.NewDecoder(body) 2823 decoder.UseNumber() 2824 var shape interface{} 2825 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2826 var snapshot bytes.Buffer 2827 io.Copy(&snapshot, ringBuffer) 2828 err = &smithy.DeserializationError{ 2829 Err: fmt.Errorf("failed to decode response body, %w", err), 2830 Snapshot: snapshot.Bytes(), 2831 } 2832 return out, metadata, err 2833 } 2834 2835 err = awsAwsjson11_deserializeOpDocumentGetKeyPolicyOutput(&output, shape) 2836 if err != nil { 2837 var snapshot bytes.Buffer 2838 io.Copy(&snapshot, ringBuffer) 2839 err = &smithy.DeserializationError{ 2840 Err: fmt.Errorf("failed to decode response body, %w", err), 2841 Snapshot: snapshot.Bytes(), 2842 } 2843 return out, metadata, err 2844 } 2845 2846 return out, metadata, err 2847} 2848 2849func awsAwsjson11_deserializeOpErrorGetKeyPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2850 var errorBuffer bytes.Buffer 2851 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2852 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2853 } 2854 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2855 2856 errorCode := "UnknownError" 2857 errorMessage := errorCode 2858 2859 code := response.Header.Get("X-Amzn-ErrorType") 2860 if len(code) != 0 { 2861 errorCode = restjson.SanitizeErrorCode(code) 2862 } 2863 2864 var buff [1024]byte 2865 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2866 2867 body := io.TeeReader(errorBody, ringBuffer) 2868 decoder := json.NewDecoder(body) 2869 decoder.UseNumber() 2870 code, message, err := restjson.GetErrorInfo(decoder) 2871 if err != nil { 2872 var snapshot bytes.Buffer 2873 io.Copy(&snapshot, ringBuffer) 2874 err = &smithy.DeserializationError{ 2875 Err: fmt.Errorf("failed to decode response body, %w", err), 2876 Snapshot: snapshot.Bytes(), 2877 } 2878 return err 2879 } 2880 2881 errorBody.Seek(0, io.SeekStart) 2882 if len(code) != 0 { 2883 errorCode = restjson.SanitizeErrorCode(code) 2884 } 2885 if len(message) != 0 { 2886 errorMessage = message 2887 } 2888 2889 switch { 2890 case strings.EqualFold("DependencyTimeoutException", errorCode): 2891 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 2892 2893 case strings.EqualFold("InvalidArnException", errorCode): 2894 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 2895 2896 case strings.EqualFold("KMSInternalException", errorCode): 2897 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 2898 2899 case strings.EqualFold("KMSInvalidStateException", errorCode): 2900 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 2901 2902 case strings.EqualFold("NotFoundException", errorCode): 2903 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 2904 2905 default: 2906 genericError := &smithy.GenericAPIError{ 2907 Code: errorCode, 2908 Message: errorMessage, 2909 } 2910 return genericError 2911 2912 } 2913} 2914 2915type awsAwsjson11_deserializeOpGetKeyRotationStatus struct { 2916} 2917 2918func (*awsAwsjson11_deserializeOpGetKeyRotationStatus) ID() string { 2919 return "OperationDeserializer" 2920} 2921 2922func (m *awsAwsjson11_deserializeOpGetKeyRotationStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2923 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2924) { 2925 out, metadata, err = next.HandleDeserialize(ctx, in) 2926 if err != nil { 2927 return out, metadata, err 2928 } 2929 2930 response, ok := out.RawResponse.(*smithyhttp.Response) 2931 if !ok { 2932 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2933 } 2934 2935 if response.StatusCode < 200 || response.StatusCode >= 300 { 2936 return out, metadata, awsAwsjson11_deserializeOpErrorGetKeyRotationStatus(response, &metadata) 2937 } 2938 output := &GetKeyRotationStatusOutput{} 2939 out.Result = output 2940 2941 var buff [1024]byte 2942 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2943 2944 body := io.TeeReader(response.Body, ringBuffer) 2945 decoder := json.NewDecoder(body) 2946 decoder.UseNumber() 2947 var shape interface{} 2948 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2949 var snapshot bytes.Buffer 2950 io.Copy(&snapshot, ringBuffer) 2951 err = &smithy.DeserializationError{ 2952 Err: fmt.Errorf("failed to decode response body, %w", err), 2953 Snapshot: snapshot.Bytes(), 2954 } 2955 return out, metadata, err 2956 } 2957 2958 err = awsAwsjson11_deserializeOpDocumentGetKeyRotationStatusOutput(&output, shape) 2959 if err != nil { 2960 var snapshot bytes.Buffer 2961 io.Copy(&snapshot, ringBuffer) 2962 err = &smithy.DeserializationError{ 2963 Err: fmt.Errorf("failed to decode response body, %w", err), 2964 Snapshot: snapshot.Bytes(), 2965 } 2966 return out, metadata, err 2967 } 2968 2969 return out, metadata, err 2970} 2971 2972func awsAwsjson11_deserializeOpErrorGetKeyRotationStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2973 var errorBuffer bytes.Buffer 2974 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2975 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2976 } 2977 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2978 2979 errorCode := "UnknownError" 2980 errorMessage := errorCode 2981 2982 code := response.Header.Get("X-Amzn-ErrorType") 2983 if len(code) != 0 { 2984 errorCode = restjson.SanitizeErrorCode(code) 2985 } 2986 2987 var buff [1024]byte 2988 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2989 2990 body := io.TeeReader(errorBody, ringBuffer) 2991 decoder := json.NewDecoder(body) 2992 decoder.UseNumber() 2993 code, message, err := restjson.GetErrorInfo(decoder) 2994 if err != nil { 2995 var snapshot bytes.Buffer 2996 io.Copy(&snapshot, ringBuffer) 2997 err = &smithy.DeserializationError{ 2998 Err: fmt.Errorf("failed to decode response body, %w", err), 2999 Snapshot: snapshot.Bytes(), 3000 } 3001 return err 3002 } 3003 3004 errorBody.Seek(0, io.SeekStart) 3005 if len(code) != 0 { 3006 errorCode = restjson.SanitizeErrorCode(code) 3007 } 3008 if len(message) != 0 { 3009 errorMessage = message 3010 } 3011 3012 switch { 3013 case strings.EqualFold("DependencyTimeoutException", errorCode): 3014 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3015 3016 case strings.EqualFold("InvalidArnException", errorCode): 3017 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3018 3019 case strings.EqualFold("KMSInternalException", errorCode): 3020 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3021 3022 case strings.EqualFold("KMSInvalidStateException", errorCode): 3023 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3024 3025 case strings.EqualFold("NotFoundException", errorCode): 3026 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3027 3028 case strings.EqualFold("UnsupportedOperationException", errorCode): 3029 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3030 3031 default: 3032 genericError := &smithy.GenericAPIError{ 3033 Code: errorCode, 3034 Message: errorMessage, 3035 } 3036 return genericError 3037 3038 } 3039} 3040 3041type awsAwsjson11_deserializeOpGetParametersForImport struct { 3042} 3043 3044func (*awsAwsjson11_deserializeOpGetParametersForImport) ID() string { 3045 return "OperationDeserializer" 3046} 3047 3048func (m *awsAwsjson11_deserializeOpGetParametersForImport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3049 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3050) { 3051 out, metadata, err = next.HandleDeserialize(ctx, in) 3052 if err != nil { 3053 return out, metadata, err 3054 } 3055 3056 response, ok := out.RawResponse.(*smithyhttp.Response) 3057 if !ok { 3058 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3059 } 3060 3061 if response.StatusCode < 200 || response.StatusCode >= 300 { 3062 return out, metadata, awsAwsjson11_deserializeOpErrorGetParametersForImport(response, &metadata) 3063 } 3064 output := &GetParametersForImportOutput{} 3065 out.Result = output 3066 3067 var buff [1024]byte 3068 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3069 3070 body := io.TeeReader(response.Body, ringBuffer) 3071 decoder := json.NewDecoder(body) 3072 decoder.UseNumber() 3073 var shape interface{} 3074 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3075 var snapshot bytes.Buffer 3076 io.Copy(&snapshot, ringBuffer) 3077 err = &smithy.DeserializationError{ 3078 Err: fmt.Errorf("failed to decode response body, %w", err), 3079 Snapshot: snapshot.Bytes(), 3080 } 3081 return out, metadata, err 3082 } 3083 3084 err = awsAwsjson11_deserializeOpDocumentGetParametersForImportOutput(&output, shape) 3085 if err != nil { 3086 var snapshot bytes.Buffer 3087 io.Copy(&snapshot, ringBuffer) 3088 err = &smithy.DeserializationError{ 3089 Err: fmt.Errorf("failed to decode response body, %w", err), 3090 Snapshot: snapshot.Bytes(), 3091 } 3092 return out, metadata, err 3093 } 3094 3095 return out, metadata, err 3096} 3097 3098func awsAwsjson11_deserializeOpErrorGetParametersForImport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3099 var errorBuffer bytes.Buffer 3100 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3101 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3102 } 3103 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3104 3105 errorCode := "UnknownError" 3106 errorMessage := errorCode 3107 3108 code := response.Header.Get("X-Amzn-ErrorType") 3109 if len(code) != 0 { 3110 errorCode = restjson.SanitizeErrorCode(code) 3111 } 3112 3113 var buff [1024]byte 3114 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3115 3116 body := io.TeeReader(errorBody, ringBuffer) 3117 decoder := json.NewDecoder(body) 3118 decoder.UseNumber() 3119 code, message, err := restjson.GetErrorInfo(decoder) 3120 if err != nil { 3121 var snapshot bytes.Buffer 3122 io.Copy(&snapshot, ringBuffer) 3123 err = &smithy.DeserializationError{ 3124 Err: fmt.Errorf("failed to decode response body, %w", err), 3125 Snapshot: snapshot.Bytes(), 3126 } 3127 return err 3128 } 3129 3130 errorBody.Seek(0, io.SeekStart) 3131 if len(code) != 0 { 3132 errorCode = restjson.SanitizeErrorCode(code) 3133 } 3134 if len(message) != 0 { 3135 errorMessage = message 3136 } 3137 3138 switch { 3139 case strings.EqualFold("DependencyTimeoutException", errorCode): 3140 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3141 3142 case strings.EqualFold("InvalidArnException", errorCode): 3143 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3144 3145 case strings.EqualFold("KMSInternalException", errorCode): 3146 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3147 3148 case strings.EqualFold("KMSInvalidStateException", errorCode): 3149 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3150 3151 case strings.EqualFold("NotFoundException", errorCode): 3152 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3153 3154 case strings.EqualFold("UnsupportedOperationException", errorCode): 3155 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3156 3157 default: 3158 genericError := &smithy.GenericAPIError{ 3159 Code: errorCode, 3160 Message: errorMessage, 3161 } 3162 return genericError 3163 3164 } 3165} 3166 3167type awsAwsjson11_deserializeOpGetPublicKey struct { 3168} 3169 3170func (*awsAwsjson11_deserializeOpGetPublicKey) ID() string { 3171 return "OperationDeserializer" 3172} 3173 3174func (m *awsAwsjson11_deserializeOpGetPublicKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3175 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3176) { 3177 out, metadata, err = next.HandleDeserialize(ctx, in) 3178 if err != nil { 3179 return out, metadata, err 3180 } 3181 3182 response, ok := out.RawResponse.(*smithyhttp.Response) 3183 if !ok { 3184 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3185 } 3186 3187 if response.StatusCode < 200 || response.StatusCode >= 300 { 3188 return out, metadata, awsAwsjson11_deserializeOpErrorGetPublicKey(response, &metadata) 3189 } 3190 output := &GetPublicKeyOutput{} 3191 out.Result = output 3192 3193 var buff [1024]byte 3194 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3195 3196 body := io.TeeReader(response.Body, ringBuffer) 3197 decoder := json.NewDecoder(body) 3198 decoder.UseNumber() 3199 var shape interface{} 3200 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3201 var snapshot bytes.Buffer 3202 io.Copy(&snapshot, ringBuffer) 3203 err = &smithy.DeserializationError{ 3204 Err: fmt.Errorf("failed to decode response body, %w", err), 3205 Snapshot: snapshot.Bytes(), 3206 } 3207 return out, metadata, err 3208 } 3209 3210 err = awsAwsjson11_deserializeOpDocumentGetPublicKeyOutput(&output, shape) 3211 if err != nil { 3212 var snapshot bytes.Buffer 3213 io.Copy(&snapshot, ringBuffer) 3214 err = &smithy.DeserializationError{ 3215 Err: fmt.Errorf("failed to decode response body, %w", err), 3216 Snapshot: snapshot.Bytes(), 3217 } 3218 return out, metadata, err 3219 } 3220 3221 return out, metadata, err 3222} 3223 3224func awsAwsjson11_deserializeOpErrorGetPublicKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3225 var errorBuffer bytes.Buffer 3226 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3227 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3228 } 3229 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3230 3231 errorCode := "UnknownError" 3232 errorMessage := errorCode 3233 3234 code := response.Header.Get("X-Amzn-ErrorType") 3235 if len(code) != 0 { 3236 errorCode = restjson.SanitizeErrorCode(code) 3237 } 3238 3239 var buff [1024]byte 3240 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3241 3242 body := io.TeeReader(errorBody, ringBuffer) 3243 decoder := json.NewDecoder(body) 3244 decoder.UseNumber() 3245 code, message, err := restjson.GetErrorInfo(decoder) 3246 if err != nil { 3247 var snapshot bytes.Buffer 3248 io.Copy(&snapshot, ringBuffer) 3249 err = &smithy.DeserializationError{ 3250 Err: fmt.Errorf("failed to decode response body, %w", err), 3251 Snapshot: snapshot.Bytes(), 3252 } 3253 return err 3254 } 3255 3256 errorBody.Seek(0, io.SeekStart) 3257 if len(code) != 0 { 3258 errorCode = restjson.SanitizeErrorCode(code) 3259 } 3260 if len(message) != 0 { 3261 errorMessage = message 3262 } 3263 3264 switch { 3265 case strings.EqualFold("DependencyTimeoutException", errorCode): 3266 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3267 3268 case strings.EqualFold("DisabledException", errorCode): 3269 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 3270 3271 case strings.EqualFold("InvalidArnException", errorCode): 3272 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3273 3274 case strings.EqualFold("InvalidGrantTokenException", errorCode): 3275 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 3276 3277 case strings.EqualFold("InvalidKeyUsageException", errorCode): 3278 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 3279 3280 case strings.EqualFold("KeyUnavailableException", errorCode): 3281 return awsAwsjson11_deserializeErrorKeyUnavailableException(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("NotFoundException", errorCode): 3290 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3291 3292 case strings.EqualFold("UnsupportedOperationException", errorCode): 3293 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3294 3295 default: 3296 genericError := &smithy.GenericAPIError{ 3297 Code: errorCode, 3298 Message: errorMessage, 3299 } 3300 return genericError 3301 3302 } 3303} 3304 3305type awsAwsjson11_deserializeOpImportKeyMaterial struct { 3306} 3307 3308func (*awsAwsjson11_deserializeOpImportKeyMaterial) ID() string { 3309 return "OperationDeserializer" 3310} 3311 3312func (m *awsAwsjson11_deserializeOpImportKeyMaterial) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3313 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3314) { 3315 out, metadata, err = next.HandleDeserialize(ctx, in) 3316 if err != nil { 3317 return out, metadata, err 3318 } 3319 3320 response, ok := out.RawResponse.(*smithyhttp.Response) 3321 if !ok { 3322 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3323 } 3324 3325 if response.StatusCode < 200 || response.StatusCode >= 300 { 3326 return out, metadata, awsAwsjson11_deserializeOpErrorImportKeyMaterial(response, &metadata) 3327 } 3328 output := &ImportKeyMaterialOutput{} 3329 out.Result = output 3330 3331 var buff [1024]byte 3332 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3333 3334 body := io.TeeReader(response.Body, ringBuffer) 3335 decoder := json.NewDecoder(body) 3336 decoder.UseNumber() 3337 var shape interface{} 3338 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3339 var snapshot bytes.Buffer 3340 io.Copy(&snapshot, ringBuffer) 3341 err = &smithy.DeserializationError{ 3342 Err: fmt.Errorf("failed to decode response body, %w", err), 3343 Snapshot: snapshot.Bytes(), 3344 } 3345 return out, metadata, err 3346 } 3347 3348 err = awsAwsjson11_deserializeOpDocumentImportKeyMaterialOutput(&output, shape) 3349 if err != nil { 3350 var snapshot bytes.Buffer 3351 io.Copy(&snapshot, ringBuffer) 3352 err = &smithy.DeserializationError{ 3353 Err: fmt.Errorf("failed to decode response body, %w", err), 3354 Snapshot: snapshot.Bytes(), 3355 } 3356 return out, metadata, err 3357 } 3358 3359 return out, metadata, err 3360} 3361 3362func awsAwsjson11_deserializeOpErrorImportKeyMaterial(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3363 var errorBuffer bytes.Buffer 3364 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3365 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3366 } 3367 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3368 3369 errorCode := "UnknownError" 3370 errorMessage := errorCode 3371 3372 code := response.Header.Get("X-Amzn-ErrorType") 3373 if len(code) != 0 { 3374 errorCode = restjson.SanitizeErrorCode(code) 3375 } 3376 3377 var buff [1024]byte 3378 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3379 3380 body := io.TeeReader(errorBody, ringBuffer) 3381 decoder := json.NewDecoder(body) 3382 decoder.UseNumber() 3383 code, message, err := restjson.GetErrorInfo(decoder) 3384 if err != nil { 3385 var snapshot bytes.Buffer 3386 io.Copy(&snapshot, ringBuffer) 3387 err = &smithy.DeserializationError{ 3388 Err: fmt.Errorf("failed to decode response body, %w", err), 3389 Snapshot: snapshot.Bytes(), 3390 } 3391 return err 3392 } 3393 3394 errorBody.Seek(0, io.SeekStart) 3395 if len(code) != 0 { 3396 errorCode = restjson.SanitizeErrorCode(code) 3397 } 3398 if len(message) != 0 { 3399 errorMessage = message 3400 } 3401 3402 switch { 3403 case strings.EqualFold("DependencyTimeoutException", errorCode): 3404 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3405 3406 case strings.EqualFold("ExpiredImportTokenException", errorCode): 3407 return awsAwsjson11_deserializeErrorExpiredImportTokenException(response, errorBody) 3408 3409 case strings.EqualFold("IncorrectKeyMaterialException", errorCode): 3410 return awsAwsjson11_deserializeErrorIncorrectKeyMaterialException(response, errorBody) 3411 3412 case strings.EqualFold("InvalidArnException", errorCode): 3413 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3414 3415 case strings.EqualFold("InvalidCiphertextException", errorCode): 3416 return awsAwsjson11_deserializeErrorInvalidCiphertextException(response, errorBody) 3417 3418 case strings.EqualFold("InvalidImportTokenException", errorCode): 3419 return awsAwsjson11_deserializeErrorInvalidImportTokenException(response, errorBody) 3420 3421 case strings.EqualFold("KMSInternalException", errorCode): 3422 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3423 3424 case strings.EqualFold("KMSInvalidStateException", errorCode): 3425 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3426 3427 case strings.EqualFold("NotFoundException", errorCode): 3428 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3429 3430 case strings.EqualFold("UnsupportedOperationException", errorCode): 3431 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 3432 3433 default: 3434 genericError := &smithy.GenericAPIError{ 3435 Code: errorCode, 3436 Message: errorMessage, 3437 } 3438 return genericError 3439 3440 } 3441} 3442 3443type awsAwsjson11_deserializeOpListAliases struct { 3444} 3445 3446func (*awsAwsjson11_deserializeOpListAliases) ID() string { 3447 return "OperationDeserializer" 3448} 3449 3450func (m *awsAwsjson11_deserializeOpListAliases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3451 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3452) { 3453 out, metadata, err = next.HandleDeserialize(ctx, in) 3454 if err != nil { 3455 return out, metadata, err 3456 } 3457 3458 response, ok := out.RawResponse.(*smithyhttp.Response) 3459 if !ok { 3460 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3461 } 3462 3463 if response.StatusCode < 200 || response.StatusCode >= 300 { 3464 return out, metadata, awsAwsjson11_deserializeOpErrorListAliases(response, &metadata) 3465 } 3466 output := &ListAliasesOutput{} 3467 out.Result = output 3468 3469 var buff [1024]byte 3470 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3471 3472 body := io.TeeReader(response.Body, ringBuffer) 3473 decoder := json.NewDecoder(body) 3474 decoder.UseNumber() 3475 var shape interface{} 3476 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3477 var snapshot bytes.Buffer 3478 io.Copy(&snapshot, ringBuffer) 3479 err = &smithy.DeserializationError{ 3480 Err: fmt.Errorf("failed to decode response body, %w", err), 3481 Snapshot: snapshot.Bytes(), 3482 } 3483 return out, metadata, err 3484 } 3485 3486 err = awsAwsjson11_deserializeOpDocumentListAliasesOutput(&output, shape) 3487 if err != nil { 3488 var snapshot bytes.Buffer 3489 io.Copy(&snapshot, ringBuffer) 3490 err = &smithy.DeserializationError{ 3491 Err: fmt.Errorf("failed to decode response body, %w", err), 3492 Snapshot: snapshot.Bytes(), 3493 } 3494 return out, metadata, err 3495 } 3496 3497 return out, metadata, err 3498} 3499 3500func awsAwsjson11_deserializeOpErrorListAliases(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3501 var errorBuffer bytes.Buffer 3502 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3503 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3504 } 3505 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3506 3507 errorCode := "UnknownError" 3508 errorMessage := errorCode 3509 3510 code := response.Header.Get("X-Amzn-ErrorType") 3511 if len(code) != 0 { 3512 errorCode = restjson.SanitizeErrorCode(code) 3513 } 3514 3515 var buff [1024]byte 3516 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3517 3518 body := io.TeeReader(errorBody, ringBuffer) 3519 decoder := json.NewDecoder(body) 3520 decoder.UseNumber() 3521 code, message, err := restjson.GetErrorInfo(decoder) 3522 if err != nil { 3523 var snapshot bytes.Buffer 3524 io.Copy(&snapshot, ringBuffer) 3525 err = &smithy.DeserializationError{ 3526 Err: fmt.Errorf("failed to decode response body, %w", err), 3527 Snapshot: snapshot.Bytes(), 3528 } 3529 return err 3530 } 3531 3532 errorBody.Seek(0, io.SeekStart) 3533 if len(code) != 0 { 3534 errorCode = restjson.SanitizeErrorCode(code) 3535 } 3536 if len(message) != 0 { 3537 errorMessage = message 3538 } 3539 3540 switch { 3541 case strings.EqualFold("DependencyTimeoutException", errorCode): 3542 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3543 3544 case strings.EqualFold("InvalidArnException", errorCode): 3545 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3546 3547 case strings.EqualFold("InvalidMarkerException", errorCode): 3548 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 3549 3550 case strings.EqualFold("KMSInternalException", errorCode): 3551 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3552 3553 case strings.EqualFold("NotFoundException", errorCode): 3554 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3555 3556 default: 3557 genericError := &smithy.GenericAPIError{ 3558 Code: errorCode, 3559 Message: errorMessage, 3560 } 3561 return genericError 3562 3563 } 3564} 3565 3566type awsAwsjson11_deserializeOpListGrants struct { 3567} 3568 3569func (*awsAwsjson11_deserializeOpListGrants) ID() string { 3570 return "OperationDeserializer" 3571} 3572 3573func (m *awsAwsjson11_deserializeOpListGrants) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3574 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3575) { 3576 out, metadata, err = next.HandleDeserialize(ctx, in) 3577 if err != nil { 3578 return out, metadata, err 3579 } 3580 3581 response, ok := out.RawResponse.(*smithyhttp.Response) 3582 if !ok { 3583 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3584 } 3585 3586 if response.StatusCode < 200 || response.StatusCode >= 300 { 3587 return out, metadata, awsAwsjson11_deserializeOpErrorListGrants(response, &metadata) 3588 } 3589 output := &ListGrantsOutput{} 3590 out.Result = output 3591 3592 var buff [1024]byte 3593 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3594 3595 body := io.TeeReader(response.Body, ringBuffer) 3596 decoder := json.NewDecoder(body) 3597 decoder.UseNumber() 3598 var shape interface{} 3599 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3600 var snapshot bytes.Buffer 3601 io.Copy(&snapshot, ringBuffer) 3602 err = &smithy.DeserializationError{ 3603 Err: fmt.Errorf("failed to decode response body, %w", err), 3604 Snapshot: snapshot.Bytes(), 3605 } 3606 return out, metadata, err 3607 } 3608 3609 err = awsAwsjson11_deserializeOpDocumentListGrantsOutput(&output, shape) 3610 if err != nil { 3611 var snapshot bytes.Buffer 3612 io.Copy(&snapshot, ringBuffer) 3613 err = &smithy.DeserializationError{ 3614 Err: fmt.Errorf("failed to decode response body, %w", err), 3615 Snapshot: snapshot.Bytes(), 3616 } 3617 return out, metadata, err 3618 } 3619 3620 return out, metadata, err 3621} 3622 3623func awsAwsjson11_deserializeOpErrorListGrants(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3624 var errorBuffer bytes.Buffer 3625 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3626 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3627 } 3628 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3629 3630 errorCode := "UnknownError" 3631 errorMessage := errorCode 3632 3633 code := response.Header.Get("X-Amzn-ErrorType") 3634 if len(code) != 0 { 3635 errorCode = restjson.SanitizeErrorCode(code) 3636 } 3637 3638 var buff [1024]byte 3639 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3640 3641 body := io.TeeReader(errorBody, ringBuffer) 3642 decoder := json.NewDecoder(body) 3643 decoder.UseNumber() 3644 code, message, err := restjson.GetErrorInfo(decoder) 3645 if err != nil { 3646 var snapshot bytes.Buffer 3647 io.Copy(&snapshot, ringBuffer) 3648 err = &smithy.DeserializationError{ 3649 Err: fmt.Errorf("failed to decode response body, %w", err), 3650 Snapshot: snapshot.Bytes(), 3651 } 3652 return err 3653 } 3654 3655 errorBody.Seek(0, io.SeekStart) 3656 if len(code) != 0 { 3657 errorCode = restjson.SanitizeErrorCode(code) 3658 } 3659 if len(message) != 0 { 3660 errorMessage = message 3661 } 3662 3663 switch { 3664 case strings.EqualFold("DependencyTimeoutException", errorCode): 3665 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3666 3667 case strings.EqualFold("InvalidArnException", errorCode): 3668 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3669 3670 case strings.EqualFold("InvalidGrantIdException", errorCode): 3671 return awsAwsjson11_deserializeErrorInvalidGrantIdException(response, errorBody) 3672 3673 case strings.EqualFold("InvalidMarkerException", errorCode): 3674 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 3675 3676 case strings.EqualFold("KMSInternalException", errorCode): 3677 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3678 3679 case strings.EqualFold("KMSInvalidStateException", errorCode): 3680 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3681 3682 case strings.EqualFold("NotFoundException", errorCode): 3683 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3684 3685 default: 3686 genericError := &smithy.GenericAPIError{ 3687 Code: errorCode, 3688 Message: errorMessage, 3689 } 3690 return genericError 3691 3692 } 3693} 3694 3695type awsAwsjson11_deserializeOpListKeyPolicies struct { 3696} 3697 3698func (*awsAwsjson11_deserializeOpListKeyPolicies) ID() string { 3699 return "OperationDeserializer" 3700} 3701 3702func (m *awsAwsjson11_deserializeOpListKeyPolicies) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3703 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3704) { 3705 out, metadata, err = next.HandleDeserialize(ctx, in) 3706 if err != nil { 3707 return out, metadata, err 3708 } 3709 3710 response, ok := out.RawResponse.(*smithyhttp.Response) 3711 if !ok { 3712 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3713 } 3714 3715 if response.StatusCode < 200 || response.StatusCode >= 300 { 3716 return out, metadata, awsAwsjson11_deserializeOpErrorListKeyPolicies(response, &metadata) 3717 } 3718 output := &ListKeyPoliciesOutput{} 3719 out.Result = output 3720 3721 var buff [1024]byte 3722 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3723 3724 body := io.TeeReader(response.Body, ringBuffer) 3725 decoder := json.NewDecoder(body) 3726 decoder.UseNumber() 3727 var shape interface{} 3728 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3729 var snapshot bytes.Buffer 3730 io.Copy(&snapshot, ringBuffer) 3731 err = &smithy.DeserializationError{ 3732 Err: fmt.Errorf("failed to decode response body, %w", err), 3733 Snapshot: snapshot.Bytes(), 3734 } 3735 return out, metadata, err 3736 } 3737 3738 err = awsAwsjson11_deserializeOpDocumentListKeyPoliciesOutput(&output, shape) 3739 if err != nil { 3740 var snapshot bytes.Buffer 3741 io.Copy(&snapshot, ringBuffer) 3742 err = &smithy.DeserializationError{ 3743 Err: fmt.Errorf("failed to decode response body, %w", err), 3744 Snapshot: snapshot.Bytes(), 3745 } 3746 return out, metadata, err 3747 } 3748 3749 return out, metadata, err 3750} 3751 3752func awsAwsjson11_deserializeOpErrorListKeyPolicies(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3753 var errorBuffer bytes.Buffer 3754 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3755 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3756 } 3757 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3758 3759 errorCode := "UnknownError" 3760 errorMessage := errorCode 3761 3762 code := response.Header.Get("X-Amzn-ErrorType") 3763 if len(code) != 0 { 3764 errorCode = restjson.SanitizeErrorCode(code) 3765 } 3766 3767 var buff [1024]byte 3768 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3769 3770 body := io.TeeReader(errorBody, ringBuffer) 3771 decoder := json.NewDecoder(body) 3772 decoder.UseNumber() 3773 code, message, err := restjson.GetErrorInfo(decoder) 3774 if err != nil { 3775 var snapshot bytes.Buffer 3776 io.Copy(&snapshot, ringBuffer) 3777 err = &smithy.DeserializationError{ 3778 Err: fmt.Errorf("failed to decode response body, %w", err), 3779 Snapshot: snapshot.Bytes(), 3780 } 3781 return err 3782 } 3783 3784 errorBody.Seek(0, io.SeekStart) 3785 if len(code) != 0 { 3786 errorCode = restjson.SanitizeErrorCode(code) 3787 } 3788 if len(message) != 0 { 3789 errorMessage = message 3790 } 3791 3792 switch { 3793 case strings.EqualFold("DependencyTimeoutException", errorCode): 3794 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3795 3796 case strings.EqualFold("InvalidArnException", errorCode): 3797 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 3798 3799 case strings.EqualFold("KMSInternalException", errorCode): 3800 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3801 3802 case strings.EqualFold("KMSInvalidStateException", errorCode): 3803 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 3804 3805 case strings.EqualFold("NotFoundException", errorCode): 3806 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 3807 3808 default: 3809 genericError := &smithy.GenericAPIError{ 3810 Code: errorCode, 3811 Message: errorMessage, 3812 } 3813 return genericError 3814 3815 } 3816} 3817 3818type awsAwsjson11_deserializeOpListKeys struct { 3819} 3820 3821func (*awsAwsjson11_deserializeOpListKeys) ID() string { 3822 return "OperationDeserializer" 3823} 3824 3825func (m *awsAwsjson11_deserializeOpListKeys) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3826 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3827) { 3828 out, metadata, err = next.HandleDeserialize(ctx, in) 3829 if err != nil { 3830 return out, metadata, err 3831 } 3832 3833 response, ok := out.RawResponse.(*smithyhttp.Response) 3834 if !ok { 3835 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3836 } 3837 3838 if response.StatusCode < 200 || response.StatusCode >= 300 { 3839 return out, metadata, awsAwsjson11_deserializeOpErrorListKeys(response, &metadata) 3840 } 3841 output := &ListKeysOutput{} 3842 out.Result = output 3843 3844 var buff [1024]byte 3845 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3846 3847 body := io.TeeReader(response.Body, ringBuffer) 3848 decoder := json.NewDecoder(body) 3849 decoder.UseNumber() 3850 var shape interface{} 3851 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3852 var snapshot bytes.Buffer 3853 io.Copy(&snapshot, ringBuffer) 3854 err = &smithy.DeserializationError{ 3855 Err: fmt.Errorf("failed to decode response body, %w", err), 3856 Snapshot: snapshot.Bytes(), 3857 } 3858 return out, metadata, err 3859 } 3860 3861 err = awsAwsjson11_deserializeOpDocumentListKeysOutput(&output, shape) 3862 if err != nil { 3863 var snapshot bytes.Buffer 3864 io.Copy(&snapshot, ringBuffer) 3865 err = &smithy.DeserializationError{ 3866 Err: fmt.Errorf("failed to decode response body, %w", err), 3867 Snapshot: snapshot.Bytes(), 3868 } 3869 return out, metadata, err 3870 } 3871 3872 return out, metadata, err 3873} 3874 3875func awsAwsjson11_deserializeOpErrorListKeys(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3876 var errorBuffer bytes.Buffer 3877 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3878 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3879 } 3880 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3881 3882 errorCode := "UnknownError" 3883 errorMessage := errorCode 3884 3885 code := response.Header.Get("X-Amzn-ErrorType") 3886 if len(code) != 0 { 3887 errorCode = restjson.SanitizeErrorCode(code) 3888 } 3889 3890 var buff [1024]byte 3891 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3892 3893 body := io.TeeReader(errorBody, ringBuffer) 3894 decoder := json.NewDecoder(body) 3895 decoder.UseNumber() 3896 code, message, err := restjson.GetErrorInfo(decoder) 3897 if err != nil { 3898 var snapshot bytes.Buffer 3899 io.Copy(&snapshot, ringBuffer) 3900 err = &smithy.DeserializationError{ 3901 Err: fmt.Errorf("failed to decode response body, %w", err), 3902 Snapshot: snapshot.Bytes(), 3903 } 3904 return err 3905 } 3906 3907 errorBody.Seek(0, io.SeekStart) 3908 if len(code) != 0 { 3909 errorCode = restjson.SanitizeErrorCode(code) 3910 } 3911 if len(message) != 0 { 3912 errorMessage = message 3913 } 3914 3915 switch { 3916 case strings.EqualFold("DependencyTimeoutException", errorCode): 3917 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 3918 3919 case strings.EqualFold("InvalidMarkerException", errorCode): 3920 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 3921 3922 case strings.EqualFold("KMSInternalException", errorCode): 3923 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 3924 3925 default: 3926 genericError := &smithy.GenericAPIError{ 3927 Code: errorCode, 3928 Message: errorMessage, 3929 } 3930 return genericError 3931 3932 } 3933} 3934 3935type awsAwsjson11_deserializeOpListResourceTags struct { 3936} 3937 3938func (*awsAwsjson11_deserializeOpListResourceTags) ID() string { 3939 return "OperationDeserializer" 3940} 3941 3942func (m *awsAwsjson11_deserializeOpListResourceTags) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3943 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3944) { 3945 out, metadata, err = next.HandleDeserialize(ctx, in) 3946 if err != nil { 3947 return out, metadata, err 3948 } 3949 3950 response, ok := out.RawResponse.(*smithyhttp.Response) 3951 if !ok { 3952 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3953 } 3954 3955 if response.StatusCode < 200 || response.StatusCode >= 300 { 3956 return out, metadata, awsAwsjson11_deserializeOpErrorListResourceTags(response, &metadata) 3957 } 3958 output := &ListResourceTagsOutput{} 3959 out.Result = output 3960 3961 var buff [1024]byte 3962 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3963 3964 body := io.TeeReader(response.Body, ringBuffer) 3965 decoder := json.NewDecoder(body) 3966 decoder.UseNumber() 3967 var shape interface{} 3968 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3969 var snapshot bytes.Buffer 3970 io.Copy(&snapshot, ringBuffer) 3971 err = &smithy.DeserializationError{ 3972 Err: fmt.Errorf("failed to decode response body, %w", err), 3973 Snapshot: snapshot.Bytes(), 3974 } 3975 return out, metadata, err 3976 } 3977 3978 err = awsAwsjson11_deserializeOpDocumentListResourceTagsOutput(&output, shape) 3979 if err != nil { 3980 var snapshot bytes.Buffer 3981 io.Copy(&snapshot, ringBuffer) 3982 err = &smithy.DeserializationError{ 3983 Err: fmt.Errorf("failed to decode response body, %w", err), 3984 Snapshot: snapshot.Bytes(), 3985 } 3986 return out, metadata, err 3987 } 3988 3989 return out, metadata, err 3990} 3991 3992func awsAwsjson11_deserializeOpErrorListResourceTags(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3993 var errorBuffer bytes.Buffer 3994 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3995 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3996 } 3997 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3998 3999 errorCode := "UnknownError" 4000 errorMessage := errorCode 4001 4002 code := response.Header.Get("X-Amzn-ErrorType") 4003 if len(code) != 0 { 4004 errorCode = restjson.SanitizeErrorCode(code) 4005 } 4006 4007 var buff [1024]byte 4008 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4009 4010 body := io.TeeReader(errorBody, ringBuffer) 4011 decoder := json.NewDecoder(body) 4012 decoder.UseNumber() 4013 code, message, err := restjson.GetErrorInfo(decoder) 4014 if err != nil { 4015 var snapshot bytes.Buffer 4016 io.Copy(&snapshot, ringBuffer) 4017 err = &smithy.DeserializationError{ 4018 Err: fmt.Errorf("failed to decode response body, %w", err), 4019 Snapshot: snapshot.Bytes(), 4020 } 4021 return err 4022 } 4023 4024 errorBody.Seek(0, io.SeekStart) 4025 if len(code) != 0 { 4026 errorCode = restjson.SanitizeErrorCode(code) 4027 } 4028 if len(message) != 0 { 4029 errorMessage = message 4030 } 4031 4032 switch { 4033 case strings.EqualFold("InvalidArnException", errorCode): 4034 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4035 4036 case strings.EqualFold("InvalidMarkerException", errorCode): 4037 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 4038 4039 case strings.EqualFold("KMSInternalException", errorCode): 4040 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4041 4042 case strings.EqualFold("NotFoundException", errorCode): 4043 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4044 4045 default: 4046 genericError := &smithy.GenericAPIError{ 4047 Code: errorCode, 4048 Message: errorMessage, 4049 } 4050 return genericError 4051 4052 } 4053} 4054 4055type awsAwsjson11_deserializeOpListRetirableGrants struct { 4056} 4057 4058func (*awsAwsjson11_deserializeOpListRetirableGrants) ID() string { 4059 return "OperationDeserializer" 4060} 4061 4062func (m *awsAwsjson11_deserializeOpListRetirableGrants) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4063 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4064) { 4065 out, metadata, err = next.HandleDeserialize(ctx, in) 4066 if err != nil { 4067 return out, metadata, err 4068 } 4069 4070 response, ok := out.RawResponse.(*smithyhttp.Response) 4071 if !ok { 4072 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4073 } 4074 4075 if response.StatusCode < 200 || response.StatusCode >= 300 { 4076 return out, metadata, awsAwsjson11_deserializeOpErrorListRetirableGrants(response, &metadata) 4077 } 4078 output := &ListRetirableGrantsOutput{} 4079 out.Result = output 4080 4081 var buff [1024]byte 4082 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4083 4084 body := io.TeeReader(response.Body, ringBuffer) 4085 decoder := json.NewDecoder(body) 4086 decoder.UseNumber() 4087 var shape interface{} 4088 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4089 var snapshot bytes.Buffer 4090 io.Copy(&snapshot, ringBuffer) 4091 err = &smithy.DeserializationError{ 4092 Err: fmt.Errorf("failed to decode response body, %w", err), 4093 Snapshot: snapshot.Bytes(), 4094 } 4095 return out, metadata, err 4096 } 4097 4098 err = awsAwsjson11_deserializeOpDocumentListRetirableGrantsOutput(&output, shape) 4099 if err != nil { 4100 var snapshot bytes.Buffer 4101 io.Copy(&snapshot, ringBuffer) 4102 err = &smithy.DeserializationError{ 4103 Err: fmt.Errorf("failed to decode response body, %w", err), 4104 Snapshot: snapshot.Bytes(), 4105 } 4106 return out, metadata, err 4107 } 4108 4109 return out, metadata, err 4110} 4111 4112func awsAwsjson11_deserializeOpErrorListRetirableGrants(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4113 var errorBuffer bytes.Buffer 4114 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4115 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4116 } 4117 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4118 4119 errorCode := "UnknownError" 4120 errorMessage := errorCode 4121 4122 code := response.Header.Get("X-Amzn-ErrorType") 4123 if len(code) != 0 { 4124 errorCode = restjson.SanitizeErrorCode(code) 4125 } 4126 4127 var buff [1024]byte 4128 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4129 4130 body := io.TeeReader(errorBody, ringBuffer) 4131 decoder := json.NewDecoder(body) 4132 decoder.UseNumber() 4133 code, message, err := restjson.GetErrorInfo(decoder) 4134 if err != nil { 4135 var snapshot bytes.Buffer 4136 io.Copy(&snapshot, ringBuffer) 4137 err = &smithy.DeserializationError{ 4138 Err: fmt.Errorf("failed to decode response body, %w", err), 4139 Snapshot: snapshot.Bytes(), 4140 } 4141 return err 4142 } 4143 4144 errorBody.Seek(0, io.SeekStart) 4145 if len(code) != 0 { 4146 errorCode = restjson.SanitizeErrorCode(code) 4147 } 4148 if len(message) != 0 { 4149 errorMessage = message 4150 } 4151 4152 switch { 4153 case strings.EqualFold("DependencyTimeoutException", errorCode): 4154 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4155 4156 case strings.EqualFold("InvalidArnException", errorCode): 4157 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4158 4159 case strings.EqualFold("InvalidMarkerException", errorCode): 4160 return awsAwsjson11_deserializeErrorInvalidMarkerException(response, errorBody) 4161 4162 case strings.EqualFold("KMSInternalException", errorCode): 4163 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4164 4165 case strings.EqualFold("NotFoundException", errorCode): 4166 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4167 4168 default: 4169 genericError := &smithy.GenericAPIError{ 4170 Code: errorCode, 4171 Message: errorMessage, 4172 } 4173 return genericError 4174 4175 } 4176} 4177 4178type awsAwsjson11_deserializeOpPutKeyPolicy struct { 4179} 4180 4181func (*awsAwsjson11_deserializeOpPutKeyPolicy) ID() string { 4182 return "OperationDeserializer" 4183} 4184 4185func (m *awsAwsjson11_deserializeOpPutKeyPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4186 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4187) { 4188 out, metadata, err = next.HandleDeserialize(ctx, in) 4189 if err != nil { 4190 return out, metadata, err 4191 } 4192 4193 response, ok := out.RawResponse.(*smithyhttp.Response) 4194 if !ok { 4195 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4196 } 4197 4198 if response.StatusCode < 200 || response.StatusCode >= 300 { 4199 return out, metadata, awsAwsjson11_deserializeOpErrorPutKeyPolicy(response, &metadata) 4200 } 4201 output := &PutKeyPolicyOutput{} 4202 out.Result = output 4203 4204 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4205 return out, metadata, &smithy.DeserializationError{ 4206 Err: fmt.Errorf("failed to discard response body, %w", err), 4207 } 4208 } 4209 4210 return out, metadata, err 4211} 4212 4213func awsAwsjson11_deserializeOpErrorPutKeyPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4214 var errorBuffer bytes.Buffer 4215 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4216 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4217 } 4218 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4219 4220 errorCode := "UnknownError" 4221 errorMessage := errorCode 4222 4223 code := response.Header.Get("X-Amzn-ErrorType") 4224 if len(code) != 0 { 4225 errorCode = restjson.SanitizeErrorCode(code) 4226 } 4227 4228 var buff [1024]byte 4229 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4230 4231 body := io.TeeReader(errorBody, ringBuffer) 4232 decoder := json.NewDecoder(body) 4233 decoder.UseNumber() 4234 code, message, err := restjson.GetErrorInfo(decoder) 4235 if err != nil { 4236 var snapshot bytes.Buffer 4237 io.Copy(&snapshot, ringBuffer) 4238 err = &smithy.DeserializationError{ 4239 Err: fmt.Errorf("failed to decode response body, %w", err), 4240 Snapshot: snapshot.Bytes(), 4241 } 4242 return err 4243 } 4244 4245 errorBody.Seek(0, io.SeekStart) 4246 if len(code) != 0 { 4247 errorCode = restjson.SanitizeErrorCode(code) 4248 } 4249 if len(message) != 0 { 4250 errorMessage = message 4251 } 4252 4253 switch { 4254 case strings.EqualFold("DependencyTimeoutException", errorCode): 4255 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4256 4257 case strings.EqualFold("InvalidArnException", errorCode): 4258 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4259 4260 case strings.EqualFold("KMSInternalException", errorCode): 4261 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4262 4263 case strings.EqualFold("KMSInvalidStateException", errorCode): 4264 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4265 4266 case strings.EqualFold("LimitExceededException", errorCode): 4267 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 4268 4269 case strings.EqualFold("MalformedPolicyDocumentException", errorCode): 4270 return awsAwsjson11_deserializeErrorMalformedPolicyDocumentException(response, errorBody) 4271 4272 case strings.EqualFold("NotFoundException", errorCode): 4273 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4274 4275 case strings.EqualFold("UnsupportedOperationException", errorCode): 4276 return awsAwsjson11_deserializeErrorUnsupportedOperationException(response, errorBody) 4277 4278 default: 4279 genericError := &smithy.GenericAPIError{ 4280 Code: errorCode, 4281 Message: errorMessage, 4282 } 4283 return genericError 4284 4285 } 4286} 4287 4288type awsAwsjson11_deserializeOpReEncrypt struct { 4289} 4290 4291func (*awsAwsjson11_deserializeOpReEncrypt) ID() string { 4292 return "OperationDeserializer" 4293} 4294 4295func (m *awsAwsjson11_deserializeOpReEncrypt) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4296 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4297) { 4298 out, metadata, err = next.HandleDeserialize(ctx, in) 4299 if err != nil { 4300 return out, metadata, err 4301 } 4302 4303 response, ok := out.RawResponse.(*smithyhttp.Response) 4304 if !ok { 4305 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4306 } 4307 4308 if response.StatusCode < 200 || response.StatusCode >= 300 { 4309 return out, metadata, awsAwsjson11_deserializeOpErrorReEncrypt(response, &metadata) 4310 } 4311 output := &ReEncryptOutput{} 4312 out.Result = output 4313 4314 var buff [1024]byte 4315 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4316 4317 body := io.TeeReader(response.Body, ringBuffer) 4318 decoder := json.NewDecoder(body) 4319 decoder.UseNumber() 4320 var shape interface{} 4321 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4322 var snapshot bytes.Buffer 4323 io.Copy(&snapshot, ringBuffer) 4324 err = &smithy.DeserializationError{ 4325 Err: fmt.Errorf("failed to decode response body, %w", err), 4326 Snapshot: snapshot.Bytes(), 4327 } 4328 return out, metadata, err 4329 } 4330 4331 err = awsAwsjson11_deserializeOpDocumentReEncryptOutput(&output, shape) 4332 if err != nil { 4333 var snapshot bytes.Buffer 4334 io.Copy(&snapshot, ringBuffer) 4335 err = &smithy.DeserializationError{ 4336 Err: fmt.Errorf("failed to decode response body, %w", err), 4337 Snapshot: snapshot.Bytes(), 4338 } 4339 return out, metadata, err 4340 } 4341 4342 return out, metadata, err 4343} 4344 4345func awsAwsjson11_deserializeOpErrorReEncrypt(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4346 var errorBuffer bytes.Buffer 4347 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4348 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4349 } 4350 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4351 4352 errorCode := "UnknownError" 4353 errorMessage := errorCode 4354 4355 code := response.Header.Get("X-Amzn-ErrorType") 4356 if len(code) != 0 { 4357 errorCode = restjson.SanitizeErrorCode(code) 4358 } 4359 4360 var buff [1024]byte 4361 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4362 4363 body := io.TeeReader(errorBody, ringBuffer) 4364 decoder := json.NewDecoder(body) 4365 decoder.UseNumber() 4366 code, message, err := restjson.GetErrorInfo(decoder) 4367 if err != nil { 4368 var snapshot bytes.Buffer 4369 io.Copy(&snapshot, ringBuffer) 4370 err = &smithy.DeserializationError{ 4371 Err: fmt.Errorf("failed to decode response body, %w", err), 4372 Snapshot: snapshot.Bytes(), 4373 } 4374 return err 4375 } 4376 4377 errorBody.Seek(0, io.SeekStart) 4378 if len(code) != 0 { 4379 errorCode = restjson.SanitizeErrorCode(code) 4380 } 4381 if len(message) != 0 { 4382 errorMessage = message 4383 } 4384 4385 switch { 4386 case strings.EqualFold("DependencyTimeoutException", errorCode): 4387 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4388 4389 case strings.EqualFold("DisabledException", errorCode): 4390 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 4391 4392 case strings.EqualFold("IncorrectKeyException", errorCode): 4393 return awsAwsjson11_deserializeErrorIncorrectKeyException(response, errorBody) 4394 4395 case strings.EqualFold("InvalidCiphertextException", errorCode): 4396 return awsAwsjson11_deserializeErrorInvalidCiphertextException(response, errorBody) 4397 4398 case strings.EqualFold("InvalidGrantTokenException", errorCode): 4399 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 4400 4401 case strings.EqualFold("InvalidKeyUsageException", errorCode): 4402 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 4403 4404 case strings.EqualFold("KeyUnavailableException", errorCode): 4405 return awsAwsjson11_deserializeErrorKeyUnavailableException(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("NotFoundException", errorCode): 4414 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4415 4416 default: 4417 genericError := &smithy.GenericAPIError{ 4418 Code: errorCode, 4419 Message: errorMessage, 4420 } 4421 return genericError 4422 4423 } 4424} 4425 4426type awsAwsjson11_deserializeOpRetireGrant struct { 4427} 4428 4429func (*awsAwsjson11_deserializeOpRetireGrant) ID() string { 4430 return "OperationDeserializer" 4431} 4432 4433func (m *awsAwsjson11_deserializeOpRetireGrant) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4434 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4435) { 4436 out, metadata, err = next.HandleDeserialize(ctx, in) 4437 if err != nil { 4438 return out, metadata, err 4439 } 4440 4441 response, ok := out.RawResponse.(*smithyhttp.Response) 4442 if !ok { 4443 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4444 } 4445 4446 if response.StatusCode < 200 || response.StatusCode >= 300 { 4447 return out, metadata, awsAwsjson11_deserializeOpErrorRetireGrant(response, &metadata) 4448 } 4449 output := &RetireGrantOutput{} 4450 out.Result = output 4451 4452 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4453 return out, metadata, &smithy.DeserializationError{ 4454 Err: fmt.Errorf("failed to discard response body, %w", err), 4455 } 4456 } 4457 4458 return out, metadata, err 4459} 4460 4461func awsAwsjson11_deserializeOpErrorRetireGrant(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4462 var errorBuffer bytes.Buffer 4463 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4464 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4465 } 4466 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4467 4468 errorCode := "UnknownError" 4469 errorMessage := errorCode 4470 4471 code := response.Header.Get("X-Amzn-ErrorType") 4472 if len(code) != 0 { 4473 errorCode = restjson.SanitizeErrorCode(code) 4474 } 4475 4476 var buff [1024]byte 4477 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4478 4479 body := io.TeeReader(errorBody, ringBuffer) 4480 decoder := json.NewDecoder(body) 4481 decoder.UseNumber() 4482 code, message, err := restjson.GetErrorInfo(decoder) 4483 if err != nil { 4484 var snapshot bytes.Buffer 4485 io.Copy(&snapshot, ringBuffer) 4486 err = &smithy.DeserializationError{ 4487 Err: fmt.Errorf("failed to decode response body, %w", err), 4488 Snapshot: snapshot.Bytes(), 4489 } 4490 return err 4491 } 4492 4493 errorBody.Seek(0, io.SeekStart) 4494 if len(code) != 0 { 4495 errorCode = restjson.SanitizeErrorCode(code) 4496 } 4497 if len(message) != 0 { 4498 errorMessage = message 4499 } 4500 4501 switch { 4502 case strings.EqualFold("DependencyTimeoutException", errorCode): 4503 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4504 4505 case strings.EqualFold("InvalidArnException", errorCode): 4506 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4507 4508 case strings.EqualFold("InvalidGrantIdException", errorCode): 4509 return awsAwsjson11_deserializeErrorInvalidGrantIdException(response, errorBody) 4510 4511 case strings.EqualFold("InvalidGrantTokenException", errorCode): 4512 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 4513 4514 case strings.EqualFold("KMSInternalException", errorCode): 4515 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4516 4517 case strings.EqualFold("KMSInvalidStateException", errorCode): 4518 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4519 4520 case strings.EqualFold("NotFoundException", errorCode): 4521 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4522 4523 default: 4524 genericError := &smithy.GenericAPIError{ 4525 Code: errorCode, 4526 Message: errorMessage, 4527 } 4528 return genericError 4529 4530 } 4531} 4532 4533type awsAwsjson11_deserializeOpRevokeGrant struct { 4534} 4535 4536func (*awsAwsjson11_deserializeOpRevokeGrant) ID() string { 4537 return "OperationDeserializer" 4538} 4539 4540func (m *awsAwsjson11_deserializeOpRevokeGrant) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4541 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4542) { 4543 out, metadata, err = next.HandleDeserialize(ctx, in) 4544 if err != nil { 4545 return out, metadata, err 4546 } 4547 4548 response, ok := out.RawResponse.(*smithyhttp.Response) 4549 if !ok { 4550 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4551 } 4552 4553 if response.StatusCode < 200 || response.StatusCode >= 300 { 4554 return out, metadata, awsAwsjson11_deserializeOpErrorRevokeGrant(response, &metadata) 4555 } 4556 output := &RevokeGrantOutput{} 4557 out.Result = output 4558 4559 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4560 return out, metadata, &smithy.DeserializationError{ 4561 Err: fmt.Errorf("failed to discard response body, %w", err), 4562 } 4563 } 4564 4565 return out, metadata, err 4566} 4567 4568func awsAwsjson11_deserializeOpErrorRevokeGrant(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4569 var errorBuffer bytes.Buffer 4570 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4571 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4572 } 4573 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4574 4575 errorCode := "UnknownError" 4576 errorMessage := errorCode 4577 4578 code := response.Header.Get("X-Amzn-ErrorType") 4579 if len(code) != 0 { 4580 errorCode = restjson.SanitizeErrorCode(code) 4581 } 4582 4583 var buff [1024]byte 4584 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4585 4586 body := io.TeeReader(errorBody, ringBuffer) 4587 decoder := json.NewDecoder(body) 4588 decoder.UseNumber() 4589 code, message, err := restjson.GetErrorInfo(decoder) 4590 if err != nil { 4591 var snapshot bytes.Buffer 4592 io.Copy(&snapshot, ringBuffer) 4593 err = &smithy.DeserializationError{ 4594 Err: fmt.Errorf("failed to decode response body, %w", err), 4595 Snapshot: snapshot.Bytes(), 4596 } 4597 return err 4598 } 4599 4600 errorBody.Seek(0, io.SeekStart) 4601 if len(code) != 0 { 4602 errorCode = restjson.SanitizeErrorCode(code) 4603 } 4604 if len(message) != 0 { 4605 errorMessage = message 4606 } 4607 4608 switch { 4609 case strings.EqualFold("DependencyTimeoutException", errorCode): 4610 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4611 4612 case strings.EqualFold("InvalidArnException", errorCode): 4613 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4614 4615 case strings.EqualFold("InvalidGrantIdException", errorCode): 4616 return awsAwsjson11_deserializeErrorInvalidGrantIdException(response, errorBody) 4617 4618 case strings.EqualFold("KMSInternalException", errorCode): 4619 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4620 4621 case strings.EqualFold("KMSInvalidStateException", errorCode): 4622 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4623 4624 case strings.EqualFold("NotFoundException", errorCode): 4625 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4626 4627 default: 4628 genericError := &smithy.GenericAPIError{ 4629 Code: errorCode, 4630 Message: errorMessage, 4631 } 4632 return genericError 4633 4634 } 4635} 4636 4637type awsAwsjson11_deserializeOpScheduleKeyDeletion struct { 4638} 4639 4640func (*awsAwsjson11_deserializeOpScheduleKeyDeletion) ID() string { 4641 return "OperationDeserializer" 4642} 4643 4644func (m *awsAwsjson11_deserializeOpScheduleKeyDeletion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4645 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4646) { 4647 out, metadata, err = next.HandleDeserialize(ctx, in) 4648 if err != nil { 4649 return out, metadata, err 4650 } 4651 4652 response, ok := out.RawResponse.(*smithyhttp.Response) 4653 if !ok { 4654 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4655 } 4656 4657 if response.StatusCode < 200 || response.StatusCode >= 300 { 4658 return out, metadata, awsAwsjson11_deserializeOpErrorScheduleKeyDeletion(response, &metadata) 4659 } 4660 output := &ScheduleKeyDeletionOutput{} 4661 out.Result = output 4662 4663 var buff [1024]byte 4664 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4665 4666 body := io.TeeReader(response.Body, ringBuffer) 4667 decoder := json.NewDecoder(body) 4668 decoder.UseNumber() 4669 var shape interface{} 4670 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4671 var snapshot bytes.Buffer 4672 io.Copy(&snapshot, ringBuffer) 4673 err = &smithy.DeserializationError{ 4674 Err: fmt.Errorf("failed to decode response body, %w", err), 4675 Snapshot: snapshot.Bytes(), 4676 } 4677 return out, metadata, err 4678 } 4679 4680 err = awsAwsjson11_deserializeOpDocumentScheduleKeyDeletionOutput(&output, shape) 4681 if err != nil { 4682 var snapshot bytes.Buffer 4683 io.Copy(&snapshot, ringBuffer) 4684 err = &smithy.DeserializationError{ 4685 Err: fmt.Errorf("failed to decode response body, %w", err), 4686 Snapshot: snapshot.Bytes(), 4687 } 4688 return out, metadata, err 4689 } 4690 4691 return out, metadata, err 4692} 4693 4694func awsAwsjson11_deserializeOpErrorScheduleKeyDeletion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4695 var errorBuffer bytes.Buffer 4696 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4697 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4698 } 4699 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4700 4701 errorCode := "UnknownError" 4702 errorMessage := errorCode 4703 4704 code := response.Header.Get("X-Amzn-ErrorType") 4705 if len(code) != 0 { 4706 errorCode = restjson.SanitizeErrorCode(code) 4707 } 4708 4709 var buff [1024]byte 4710 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4711 4712 body := io.TeeReader(errorBody, ringBuffer) 4713 decoder := json.NewDecoder(body) 4714 decoder.UseNumber() 4715 code, message, err := restjson.GetErrorInfo(decoder) 4716 if err != nil { 4717 var snapshot bytes.Buffer 4718 io.Copy(&snapshot, ringBuffer) 4719 err = &smithy.DeserializationError{ 4720 Err: fmt.Errorf("failed to decode response body, %w", err), 4721 Snapshot: snapshot.Bytes(), 4722 } 4723 return err 4724 } 4725 4726 errorBody.Seek(0, io.SeekStart) 4727 if len(code) != 0 { 4728 errorCode = restjson.SanitizeErrorCode(code) 4729 } 4730 if len(message) != 0 { 4731 errorMessage = message 4732 } 4733 4734 switch { 4735 case strings.EqualFold("DependencyTimeoutException", errorCode): 4736 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4737 4738 case strings.EqualFold("InvalidArnException", errorCode): 4739 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4740 4741 case strings.EqualFold("KMSInternalException", errorCode): 4742 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4743 4744 case strings.EqualFold("KMSInvalidStateException", errorCode): 4745 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4746 4747 case strings.EqualFold("NotFoundException", errorCode): 4748 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4749 4750 default: 4751 genericError := &smithy.GenericAPIError{ 4752 Code: errorCode, 4753 Message: errorMessage, 4754 } 4755 return genericError 4756 4757 } 4758} 4759 4760type awsAwsjson11_deserializeOpSign struct { 4761} 4762 4763func (*awsAwsjson11_deserializeOpSign) ID() string { 4764 return "OperationDeserializer" 4765} 4766 4767func (m *awsAwsjson11_deserializeOpSign) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4768 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4769) { 4770 out, metadata, err = next.HandleDeserialize(ctx, in) 4771 if err != nil { 4772 return out, metadata, err 4773 } 4774 4775 response, ok := out.RawResponse.(*smithyhttp.Response) 4776 if !ok { 4777 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4778 } 4779 4780 if response.StatusCode < 200 || response.StatusCode >= 300 { 4781 return out, metadata, awsAwsjson11_deserializeOpErrorSign(response, &metadata) 4782 } 4783 output := &SignOutput{} 4784 out.Result = output 4785 4786 var buff [1024]byte 4787 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4788 4789 body := io.TeeReader(response.Body, ringBuffer) 4790 decoder := json.NewDecoder(body) 4791 decoder.UseNumber() 4792 var shape interface{} 4793 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4794 var snapshot bytes.Buffer 4795 io.Copy(&snapshot, ringBuffer) 4796 err = &smithy.DeserializationError{ 4797 Err: fmt.Errorf("failed to decode response body, %w", err), 4798 Snapshot: snapshot.Bytes(), 4799 } 4800 return out, metadata, err 4801 } 4802 4803 err = awsAwsjson11_deserializeOpDocumentSignOutput(&output, shape) 4804 if err != nil { 4805 var snapshot bytes.Buffer 4806 io.Copy(&snapshot, ringBuffer) 4807 err = &smithy.DeserializationError{ 4808 Err: fmt.Errorf("failed to decode response body, %w", err), 4809 Snapshot: snapshot.Bytes(), 4810 } 4811 return out, metadata, err 4812 } 4813 4814 return out, metadata, err 4815} 4816 4817func awsAwsjson11_deserializeOpErrorSign(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4818 var errorBuffer bytes.Buffer 4819 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4820 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4821 } 4822 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4823 4824 errorCode := "UnknownError" 4825 errorMessage := errorCode 4826 4827 code := response.Header.Get("X-Amzn-ErrorType") 4828 if len(code) != 0 { 4829 errorCode = restjson.SanitizeErrorCode(code) 4830 } 4831 4832 var buff [1024]byte 4833 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4834 4835 body := io.TeeReader(errorBody, ringBuffer) 4836 decoder := json.NewDecoder(body) 4837 decoder.UseNumber() 4838 code, message, err := restjson.GetErrorInfo(decoder) 4839 if err != nil { 4840 var snapshot bytes.Buffer 4841 io.Copy(&snapshot, ringBuffer) 4842 err = &smithy.DeserializationError{ 4843 Err: fmt.Errorf("failed to decode response body, %w", err), 4844 Snapshot: snapshot.Bytes(), 4845 } 4846 return err 4847 } 4848 4849 errorBody.Seek(0, io.SeekStart) 4850 if len(code) != 0 { 4851 errorCode = restjson.SanitizeErrorCode(code) 4852 } 4853 if len(message) != 0 { 4854 errorMessage = message 4855 } 4856 4857 switch { 4858 case strings.EqualFold("DependencyTimeoutException", errorCode): 4859 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 4860 4861 case strings.EqualFold("DisabledException", errorCode): 4862 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 4863 4864 case strings.EqualFold("InvalidGrantTokenException", errorCode): 4865 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 4866 4867 case strings.EqualFold("InvalidKeyUsageException", errorCode): 4868 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 4869 4870 case strings.EqualFold("KeyUnavailableException", errorCode): 4871 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 4872 4873 case strings.EqualFold("KMSInternalException", errorCode): 4874 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4875 4876 case strings.EqualFold("KMSInvalidStateException", errorCode): 4877 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4878 4879 case strings.EqualFold("NotFoundException", errorCode): 4880 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4881 4882 default: 4883 genericError := &smithy.GenericAPIError{ 4884 Code: errorCode, 4885 Message: errorMessage, 4886 } 4887 return genericError 4888 4889 } 4890} 4891 4892type awsAwsjson11_deserializeOpTagResource struct { 4893} 4894 4895func (*awsAwsjson11_deserializeOpTagResource) ID() string { 4896 return "OperationDeserializer" 4897} 4898 4899func (m *awsAwsjson11_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4900 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4901) { 4902 out, metadata, err = next.HandleDeserialize(ctx, in) 4903 if err != nil { 4904 return out, metadata, err 4905 } 4906 4907 response, ok := out.RawResponse.(*smithyhttp.Response) 4908 if !ok { 4909 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4910 } 4911 4912 if response.StatusCode < 200 || response.StatusCode >= 300 { 4913 return out, metadata, awsAwsjson11_deserializeOpErrorTagResource(response, &metadata) 4914 } 4915 output := &TagResourceOutput{} 4916 out.Result = output 4917 4918 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4919 return out, metadata, &smithy.DeserializationError{ 4920 Err: fmt.Errorf("failed to discard response body, %w", err), 4921 } 4922 } 4923 4924 return out, metadata, err 4925} 4926 4927func awsAwsjson11_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4928 var errorBuffer bytes.Buffer 4929 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4930 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4931 } 4932 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4933 4934 errorCode := "UnknownError" 4935 errorMessage := errorCode 4936 4937 code := response.Header.Get("X-Amzn-ErrorType") 4938 if len(code) != 0 { 4939 errorCode = restjson.SanitizeErrorCode(code) 4940 } 4941 4942 var buff [1024]byte 4943 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4944 4945 body := io.TeeReader(errorBody, ringBuffer) 4946 decoder := json.NewDecoder(body) 4947 decoder.UseNumber() 4948 code, message, err := restjson.GetErrorInfo(decoder) 4949 if err != nil { 4950 var snapshot bytes.Buffer 4951 io.Copy(&snapshot, ringBuffer) 4952 err = &smithy.DeserializationError{ 4953 Err: fmt.Errorf("failed to decode response body, %w", err), 4954 Snapshot: snapshot.Bytes(), 4955 } 4956 return err 4957 } 4958 4959 errorBody.Seek(0, io.SeekStart) 4960 if len(code) != 0 { 4961 errorCode = restjson.SanitizeErrorCode(code) 4962 } 4963 if len(message) != 0 { 4964 errorMessage = message 4965 } 4966 4967 switch { 4968 case strings.EqualFold("InvalidArnException", errorCode): 4969 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 4970 4971 case strings.EqualFold("KMSInternalException", errorCode): 4972 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 4973 4974 case strings.EqualFold("KMSInvalidStateException", errorCode): 4975 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 4976 4977 case strings.EqualFold("LimitExceededException", errorCode): 4978 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 4979 4980 case strings.EqualFold("NotFoundException", errorCode): 4981 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 4982 4983 case strings.EqualFold("TagException", errorCode): 4984 return awsAwsjson11_deserializeErrorTagException(response, errorBody) 4985 4986 default: 4987 genericError := &smithy.GenericAPIError{ 4988 Code: errorCode, 4989 Message: errorMessage, 4990 } 4991 return genericError 4992 4993 } 4994} 4995 4996type awsAwsjson11_deserializeOpUntagResource struct { 4997} 4998 4999func (*awsAwsjson11_deserializeOpUntagResource) ID() string { 5000 return "OperationDeserializer" 5001} 5002 5003func (m *awsAwsjson11_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5004 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5005) { 5006 out, metadata, err = next.HandleDeserialize(ctx, in) 5007 if err != nil { 5008 return out, metadata, err 5009 } 5010 5011 response, ok := out.RawResponse.(*smithyhttp.Response) 5012 if !ok { 5013 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5014 } 5015 5016 if response.StatusCode < 200 || response.StatusCode >= 300 { 5017 return out, metadata, awsAwsjson11_deserializeOpErrorUntagResource(response, &metadata) 5018 } 5019 output := &UntagResourceOutput{} 5020 out.Result = output 5021 5022 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5023 return out, metadata, &smithy.DeserializationError{ 5024 Err: fmt.Errorf("failed to discard response body, %w", err), 5025 } 5026 } 5027 5028 return out, metadata, err 5029} 5030 5031func awsAwsjson11_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5032 var errorBuffer bytes.Buffer 5033 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5034 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5035 } 5036 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5037 5038 errorCode := "UnknownError" 5039 errorMessage := errorCode 5040 5041 code := response.Header.Get("X-Amzn-ErrorType") 5042 if len(code) != 0 { 5043 errorCode = restjson.SanitizeErrorCode(code) 5044 } 5045 5046 var buff [1024]byte 5047 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5048 5049 body := io.TeeReader(errorBody, ringBuffer) 5050 decoder := json.NewDecoder(body) 5051 decoder.UseNumber() 5052 code, message, err := restjson.GetErrorInfo(decoder) 5053 if err != nil { 5054 var snapshot bytes.Buffer 5055 io.Copy(&snapshot, ringBuffer) 5056 err = &smithy.DeserializationError{ 5057 Err: fmt.Errorf("failed to decode response body, %w", err), 5058 Snapshot: snapshot.Bytes(), 5059 } 5060 return err 5061 } 5062 5063 errorBody.Seek(0, io.SeekStart) 5064 if len(code) != 0 { 5065 errorCode = restjson.SanitizeErrorCode(code) 5066 } 5067 if len(message) != 0 { 5068 errorMessage = message 5069 } 5070 5071 switch { 5072 case strings.EqualFold("InvalidArnException", errorCode): 5073 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 5074 5075 case strings.EqualFold("KMSInternalException", errorCode): 5076 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5077 5078 case strings.EqualFold("KMSInvalidStateException", errorCode): 5079 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5080 5081 case strings.EqualFold("NotFoundException", errorCode): 5082 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5083 5084 case strings.EqualFold("TagException", errorCode): 5085 return awsAwsjson11_deserializeErrorTagException(response, errorBody) 5086 5087 default: 5088 genericError := &smithy.GenericAPIError{ 5089 Code: errorCode, 5090 Message: errorMessage, 5091 } 5092 return genericError 5093 5094 } 5095} 5096 5097type awsAwsjson11_deserializeOpUpdateAlias struct { 5098} 5099 5100func (*awsAwsjson11_deserializeOpUpdateAlias) ID() string { 5101 return "OperationDeserializer" 5102} 5103 5104func (m *awsAwsjson11_deserializeOpUpdateAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5105 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5106) { 5107 out, metadata, err = next.HandleDeserialize(ctx, in) 5108 if err != nil { 5109 return out, metadata, err 5110 } 5111 5112 response, ok := out.RawResponse.(*smithyhttp.Response) 5113 if !ok { 5114 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5115 } 5116 5117 if response.StatusCode < 200 || response.StatusCode >= 300 { 5118 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateAlias(response, &metadata) 5119 } 5120 output := &UpdateAliasOutput{} 5121 out.Result = output 5122 5123 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5124 return out, metadata, &smithy.DeserializationError{ 5125 Err: fmt.Errorf("failed to discard response body, %w", err), 5126 } 5127 } 5128 5129 return out, metadata, err 5130} 5131 5132func awsAwsjson11_deserializeOpErrorUpdateAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5133 var errorBuffer bytes.Buffer 5134 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5135 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5136 } 5137 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5138 5139 errorCode := "UnknownError" 5140 errorMessage := errorCode 5141 5142 code := response.Header.Get("X-Amzn-ErrorType") 5143 if len(code) != 0 { 5144 errorCode = restjson.SanitizeErrorCode(code) 5145 } 5146 5147 var buff [1024]byte 5148 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5149 5150 body := io.TeeReader(errorBody, ringBuffer) 5151 decoder := json.NewDecoder(body) 5152 decoder.UseNumber() 5153 code, message, err := restjson.GetErrorInfo(decoder) 5154 if err != nil { 5155 var snapshot bytes.Buffer 5156 io.Copy(&snapshot, ringBuffer) 5157 err = &smithy.DeserializationError{ 5158 Err: fmt.Errorf("failed to decode response body, %w", err), 5159 Snapshot: snapshot.Bytes(), 5160 } 5161 return err 5162 } 5163 5164 errorBody.Seek(0, io.SeekStart) 5165 if len(code) != 0 { 5166 errorCode = restjson.SanitizeErrorCode(code) 5167 } 5168 if len(message) != 0 { 5169 errorMessage = message 5170 } 5171 5172 switch { 5173 case strings.EqualFold("DependencyTimeoutException", errorCode): 5174 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 5175 5176 case strings.EqualFold("KMSInternalException", errorCode): 5177 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5178 5179 case strings.EqualFold("KMSInvalidStateException", errorCode): 5180 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5181 5182 case strings.EqualFold("LimitExceededException", errorCode): 5183 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 5184 5185 case strings.EqualFold("NotFoundException", errorCode): 5186 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5187 5188 default: 5189 genericError := &smithy.GenericAPIError{ 5190 Code: errorCode, 5191 Message: errorMessage, 5192 } 5193 return genericError 5194 5195 } 5196} 5197 5198type awsAwsjson11_deserializeOpUpdateCustomKeyStore struct { 5199} 5200 5201func (*awsAwsjson11_deserializeOpUpdateCustomKeyStore) ID() string { 5202 return "OperationDeserializer" 5203} 5204 5205func (m *awsAwsjson11_deserializeOpUpdateCustomKeyStore) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5206 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5207) { 5208 out, metadata, err = next.HandleDeserialize(ctx, in) 5209 if err != nil { 5210 return out, metadata, err 5211 } 5212 5213 response, ok := out.RawResponse.(*smithyhttp.Response) 5214 if !ok { 5215 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5216 } 5217 5218 if response.StatusCode < 200 || response.StatusCode >= 300 { 5219 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateCustomKeyStore(response, &metadata) 5220 } 5221 output := &UpdateCustomKeyStoreOutput{} 5222 out.Result = output 5223 5224 var buff [1024]byte 5225 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5226 5227 body := io.TeeReader(response.Body, ringBuffer) 5228 decoder := json.NewDecoder(body) 5229 decoder.UseNumber() 5230 var shape interface{} 5231 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5232 var snapshot bytes.Buffer 5233 io.Copy(&snapshot, ringBuffer) 5234 err = &smithy.DeserializationError{ 5235 Err: fmt.Errorf("failed to decode response body, %w", err), 5236 Snapshot: snapshot.Bytes(), 5237 } 5238 return out, metadata, err 5239 } 5240 5241 err = awsAwsjson11_deserializeOpDocumentUpdateCustomKeyStoreOutput(&output, shape) 5242 if err != nil { 5243 var snapshot bytes.Buffer 5244 io.Copy(&snapshot, ringBuffer) 5245 err = &smithy.DeserializationError{ 5246 Err: fmt.Errorf("failed to decode response body, %w", err), 5247 Snapshot: snapshot.Bytes(), 5248 } 5249 return out, metadata, err 5250 } 5251 5252 return out, metadata, err 5253} 5254 5255func awsAwsjson11_deserializeOpErrorUpdateCustomKeyStore(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5256 var errorBuffer bytes.Buffer 5257 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5258 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5259 } 5260 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5261 5262 errorCode := "UnknownError" 5263 errorMessage := errorCode 5264 5265 code := response.Header.Get("X-Amzn-ErrorType") 5266 if len(code) != 0 { 5267 errorCode = restjson.SanitizeErrorCode(code) 5268 } 5269 5270 var buff [1024]byte 5271 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5272 5273 body := io.TeeReader(errorBody, ringBuffer) 5274 decoder := json.NewDecoder(body) 5275 decoder.UseNumber() 5276 code, message, err := restjson.GetErrorInfo(decoder) 5277 if err != nil { 5278 var snapshot bytes.Buffer 5279 io.Copy(&snapshot, ringBuffer) 5280 err = &smithy.DeserializationError{ 5281 Err: fmt.Errorf("failed to decode response body, %w", err), 5282 Snapshot: snapshot.Bytes(), 5283 } 5284 return err 5285 } 5286 5287 errorBody.Seek(0, io.SeekStart) 5288 if len(code) != 0 { 5289 errorCode = restjson.SanitizeErrorCode(code) 5290 } 5291 if len(message) != 0 { 5292 errorMessage = message 5293 } 5294 5295 switch { 5296 case strings.EqualFold("CloudHsmClusterInvalidConfigurationException", errorCode): 5297 return awsAwsjson11_deserializeErrorCloudHsmClusterInvalidConfigurationException(response, errorBody) 5298 5299 case strings.EqualFold("CloudHsmClusterNotActiveException", errorCode): 5300 return awsAwsjson11_deserializeErrorCloudHsmClusterNotActiveException(response, errorBody) 5301 5302 case strings.EqualFold("CloudHsmClusterNotFoundException", errorCode): 5303 return awsAwsjson11_deserializeErrorCloudHsmClusterNotFoundException(response, errorBody) 5304 5305 case strings.EqualFold("CloudHsmClusterNotRelatedException", errorCode): 5306 return awsAwsjson11_deserializeErrorCloudHsmClusterNotRelatedException(response, errorBody) 5307 5308 case strings.EqualFold("CustomKeyStoreInvalidStateException", errorCode): 5309 return awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(response, errorBody) 5310 5311 case strings.EqualFold("CustomKeyStoreNameInUseException", errorCode): 5312 return awsAwsjson11_deserializeErrorCustomKeyStoreNameInUseException(response, errorBody) 5313 5314 case strings.EqualFold("CustomKeyStoreNotFoundException", errorCode): 5315 return awsAwsjson11_deserializeErrorCustomKeyStoreNotFoundException(response, errorBody) 5316 5317 case strings.EqualFold("KMSInternalException", errorCode): 5318 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5319 5320 default: 5321 genericError := &smithy.GenericAPIError{ 5322 Code: errorCode, 5323 Message: errorMessage, 5324 } 5325 return genericError 5326 5327 } 5328} 5329 5330type awsAwsjson11_deserializeOpUpdateKeyDescription struct { 5331} 5332 5333func (*awsAwsjson11_deserializeOpUpdateKeyDescription) ID() string { 5334 return "OperationDeserializer" 5335} 5336 5337func (m *awsAwsjson11_deserializeOpUpdateKeyDescription) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5338 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5339) { 5340 out, metadata, err = next.HandleDeserialize(ctx, in) 5341 if err != nil { 5342 return out, metadata, err 5343 } 5344 5345 response, ok := out.RawResponse.(*smithyhttp.Response) 5346 if !ok { 5347 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5348 } 5349 5350 if response.StatusCode < 200 || response.StatusCode >= 300 { 5351 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateKeyDescription(response, &metadata) 5352 } 5353 output := &UpdateKeyDescriptionOutput{} 5354 out.Result = output 5355 5356 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 5357 return out, metadata, &smithy.DeserializationError{ 5358 Err: fmt.Errorf("failed to discard response body, %w", err), 5359 } 5360 } 5361 5362 return out, metadata, err 5363} 5364 5365func awsAwsjson11_deserializeOpErrorUpdateKeyDescription(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5366 var errorBuffer bytes.Buffer 5367 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5368 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5369 } 5370 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5371 5372 errorCode := "UnknownError" 5373 errorMessage := errorCode 5374 5375 code := response.Header.Get("X-Amzn-ErrorType") 5376 if len(code) != 0 { 5377 errorCode = restjson.SanitizeErrorCode(code) 5378 } 5379 5380 var buff [1024]byte 5381 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5382 5383 body := io.TeeReader(errorBody, ringBuffer) 5384 decoder := json.NewDecoder(body) 5385 decoder.UseNumber() 5386 code, message, err := restjson.GetErrorInfo(decoder) 5387 if err != nil { 5388 var snapshot bytes.Buffer 5389 io.Copy(&snapshot, ringBuffer) 5390 err = &smithy.DeserializationError{ 5391 Err: fmt.Errorf("failed to decode response body, %w", err), 5392 Snapshot: snapshot.Bytes(), 5393 } 5394 return err 5395 } 5396 5397 errorBody.Seek(0, io.SeekStart) 5398 if len(code) != 0 { 5399 errorCode = restjson.SanitizeErrorCode(code) 5400 } 5401 if len(message) != 0 { 5402 errorMessage = message 5403 } 5404 5405 switch { 5406 case strings.EqualFold("DependencyTimeoutException", errorCode): 5407 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 5408 5409 case strings.EqualFold("InvalidArnException", errorCode): 5410 return awsAwsjson11_deserializeErrorInvalidArnException(response, errorBody) 5411 5412 case strings.EqualFold("KMSInternalException", errorCode): 5413 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5414 5415 case strings.EqualFold("KMSInvalidStateException", errorCode): 5416 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5417 5418 case strings.EqualFold("NotFoundException", errorCode): 5419 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5420 5421 default: 5422 genericError := &smithy.GenericAPIError{ 5423 Code: errorCode, 5424 Message: errorMessage, 5425 } 5426 return genericError 5427 5428 } 5429} 5430 5431type awsAwsjson11_deserializeOpVerify struct { 5432} 5433 5434func (*awsAwsjson11_deserializeOpVerify) ID() string { 5435 return "OperationDeserializer" 5436} 5437 5438func (m *awsAwsjson11_deserializeOpVerify) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5439 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5440) { 5441 out, metadata, err = next.HandleDeserialize(ctx, in) 5442 if err != nil { 5443 return out, metadata, err 5444 } 5445 5446 response, ok := out.RawResponse.(*smithyhttp.Response) 5447 if !ok { 5448 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5449 } 5450 5451 if response.StatusCode < 200 || response.StatusCode >= 300 { 5452 return out, metadata, awsAwsjson11_deserializeOpErrorVerify(response, &metadata) 5453 } 5454 output := &VerifyOutput{} 5455 out.Result = output 5456 5457 var buff [1024]byte 5458 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5459 5460 body := io.TeeReader(response.Body, ringBuffer) 5461 decoder := json.NewDecoder(body) 5462 decoder.UseNumber() 5463 var shape interface{} 5464 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5465 var snapshot bytes.Buffer 5466 io.Copy(&snapshot, ringBuffer) 5467 err = &smithy.DeserializationError{ 5468 Err: fmt.Errorf("failed to decode response body, %w", err), 5469 Snapshot: snapshot.Bytes(), 5470 } 5471 return out, metadata, err 5472 } 5473 5474 err = awsAwsjson11_deserializeOpDocumentVerifyOutput(&output, shape) 5475 if err != nil { 5476 var snapshot bytes.Buffer 5477 io.Copy(&snapshot, ringBuffer) 5478 err = &smithy.DeserializationError{ 5479 Err: fmt.Errorf("failed to decode response body, %w", err), 5480 Snapshot: snapshot.Bytes(), 5481 } 5482 return out, metadata, err 5483 } 5484 5485 return out, metadata, err 5486} 5487 5488func awsAwsjson11_deserializeOpErrorVerify(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5489 var errorBuffer bytes.Buffer 5490 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5491 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5492 } 5493 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5494 5495 errorCode := "UnknownError" 5496 errorMessage := errorCode 5497 5498 code := response.Header.Get("X-Amzn-ErrorType") 5499 if len(code) != 0 { 5500 errorCode = restjson.SanitizeErrorCode(code) 5501 } 5502 5503 var buff [1024]byte 5504 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5505 5506 body := io.TeeReader(errorBody, ringBuffer) 5507 decoder := json.NewDecoder(body) 5508 decoder.UseNumber() 5509 code, message, err := restjson.GetErrorInfo(decoder) 5510 if err != nil { 5511 var snapshot bytes.Buffer 5512 io.Copy(&snapshot, ringBuffer) 5513 err = &smithy.DeserializationError{ 5514 Err: fmt.Errorf("failed to decode response body, %w", err), 5515 Snapshot: snapshot.Bytes(), 5516 } 5517 return err 5518 } 5519 5520 errorBody.Seek(0, io.SeekStart) 5521 if len(code) != 0 { 5522 errorCode = restjson.SanitizeErrorCode(code) 5523 } 5524 if len(message) != 0 { 5525 errorMessage = message 5526 } 5527 5528 switch { 5529 case strings.EqualFold("DependencyTimeoutException", errorCode): 5530 return awsAwsjson11_deserializeErrorDependencyTimeoutException(response, errorBody) 5531 5532 case strings.EqualFold("DisabledException", errorCode): 5533 return awsAwsjson11_deserializeErrorDisabledException(response, errorBody) 5534 5535 case strings.EqualFold("InvalidGrantTokenException", errorCode): 5536 return awsAwsjson11_deserializeErrorInvalidGrantTokenException(response, errorBody) 5537 5538 case strings.EqualFold("InvalidKeyUsageException", errorCode): 5539 return awsAwsjson11_deserializeErrorInvalidKeyUsageException(response, errorBody) 5540 5541 case strings.EqualFold("KeyUnavailableException", errorCode): 5542 return awsAwsjson11_deserializeErrorKeyUnavailableException(response, errorBody) 5543 5544 case strings.EqualFold("KMSInternalException", errorCode): 5545 return awsAwsjson11_deserializeErrorKMSInternalException(response, errorBody) 5546 5547 case strings.EqualFold("KMSInvalidSignatureException", errorCode): 5548 return awsAwsjson11_deserializeErrorKMSInvalidSignatureException(response, errorBody) 5549 5550 case strings.EqualFold("KMSInvalidStateException", errorCode): 5551 return awsAwsjson11_deserializeErrorKMSInvalidStateException(response, errorBody) 5552 5553 case strings.EqualFold("NotFoundException", errorCode): 5554 return awsAwsjson11_deserializeErrorNotFoundException(response, errorBody) 5555 5556 default: 5557 genericError := &smithy.GenericAPIError{ 5558 Code: errorCode, 5559 Message: errorMessage, 5560 } 5561 return genericError 5562 5563 } 5564} 5565 5566func awsAwsjson11_deserializeErrorAlreadyExistsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5567 var buff [1024]byte 5568 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5569 5570 body := io.TeeReader(errorBody, ringBuffer) 5571 decoder := json.NewDecoder(body) 5572 decoder.UseNumber() 5573 var shape interface{} 5574 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5575 var snapshot bytes.Buffer 5576 io.Copy(&snapshot, ringBuffer) 5577 err = &smithy.DeserializationError{ 5578 Err: fmt.Errorf("failed to decode response body, %w", err), 5579 Snapshot: snapshot.Bytes(), 5580 } 5581 return err 5582 } 5583 5584 output := &types.AlreadyExistsException{} 5585 err := awsAwsjson11_deserializeDocumentAlreadyExistsException(&output, shape) 5586 5587 if err != nil { 5588 var snapshot bytes.Buffer 5589 io.Copy(&snapshot, ringBuffer) 5590 err = &smithy.DeserializationError{ 5591 Err: fmt.Errorf("failed to decode response body, %w", err), 5592 Snapshot: snapshot.Bytes(), 5593 } 5594 return err 5595 } 5596 5597 errorBody.Seek(0, io.SeekStart) 5598 return output 5599} 5600 5601func awsAwsjson11_deserializeErrorCloudHsmClusterInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5602 var buff [1024]byte 5603 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5604 5605 body := io.TeeReader(errorBody, ringBuffer) 5606 decoder := json.NewDecoder(body) 5607 decoder.UseNumber() 5608 var shape interface{} 5609 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5610 var snapshot bytes.Buffer 5611 io.Copy(&snapshot, ringBuffer) 5612 err = &smithy.DeserializationError{ 5613 Err: fmt.Errorf("failed to decode response body, %w", err), 5614 Snapshot: snapshot.Bytes(), 5615 } 5616 return err 5617 } 5618 5619 output := &types.CloudHsmClusterInUseException{} 5620 err := awsAwsjson11_deserializeDocumentCloudHsmClusterInUseException(&output, shape) 5621 5622 if err != nil { 5623 var snapshot bytes.Buffer 5624 io.Copy(&snapshot, ringBuffer) 5625 err = &smithy.DeserializationError{ 5626 Err: fmt.Errorf("failed to decode response body, %w", err), 5627 Snapshot: snapshot.Bytes(), 5628 } 5629 return err 5630 } 5631 5632 errorBody.Seek(0, io.SeekStart) 5633 return output 5634} 5635 5636func awsAwsjson11_deserializeErrorCloudHsmClusterInvalidConfigurationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5637 var buff [1024]byte 5638 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5639 5640 body := io.TeeReader(errorBody, ringBuffer) 5641 decoder := json.NewDecoder(body) 5642 decoder.UseNumber() 5643 var shape interface{} 5644 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5645 var snapshot bytes.Buffer 5646 io.Copy(&snapshot, ringBuffer) 5647 err = &smithy.DeserializationError{ 5648 Err: fmt.Errorf("failed to decode response body, %w", err), 5649 Snapshot: snapshot.Bytes(), 5650 } 5651 return err 5652 } 5653 5654 output := &types.CloudHsmClusterInvalidConfigurationException{} 5655 err := awsAwsjson11_deserializeDocumentCloudHsmClusterInvalidConfigurationException(&output, shape) 5656 5657 if err != nil { 5658 var snapshot bytes.Buffer 5659 io.Copy(&snapshot, ringBuffer) 5660 err = &smithy.DeserializationError{ 5661 Err: fmt.Errorf("failed to decode response body, %w", err), 5662 Snapshot: snapshot.Bytes(), 5663 } 5664 return err 5665 } 5666 5667 errorBody.Seek(0, io.SeekStart) 5668 return output 5669} 5670 5671func awsAwsjson11_deserializeErrorCloudHsmClusterNotActiveException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5672 var buff [1024]byte 5673 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5674 5675 body := io.TeeReader(errorBody, ringBuffer) 5676 decoder := json.NewDecoder(body) 5677 decoder.UseNumber() 5678 var shape interface{} 5679 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5680 var snapshot bytes.Buffer 5681 io.Copy(&snapshot, ringBuffer) 5682 err = &smithy.DeserializationError{ 5683 Err: fmt.Errorf("failed to decode response body, %w", err), 5684 Snapshot: snapshot.Bytes(), 5685 } 5686 return err 5687 } 5688 5689 output := &types.CloudHsmClusterNotActiveException{} 5690 err := awsAwsjson11_deserializeDocumentCloudHsmClusterNotActiveException(&output, shape) 5691 5692 if err != nil { 5693 var snapshot bytes.Buffer 5694 io.Copy(&snapshot, ringBuffer) 5695 err = &smithy.DeserializationError{ 5696 Err: fmt.Errorf("failed to decode response body, %w", err), 5697 Snapshot: snapshot.Bytes(), 5698 } 5699 return err 5700 } 5701 5702 errorBody.Seek(0, io.SeekStart) 5703 return output 5704} 5705 5706func awsAwsjson11_deserializeErrorCloudHsmClusterNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5707 var buff [1024]byte 5708 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5709 5710 body := io.TeeReader(errorBody, ringBuffer) 5711 decoder := json.NewDecoder(body) 5712 decoder.UseNumber() 5713 var shape interface{} 5714 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5715 var snapshot bytes.Buffer 5716 io.Copy(&snapshot, ringBuffer) 5717 err = &smithy.DeserializationError{ 5718 Err: fmt.Errorf("failed to decode response body, %w", err), 5719 Snapshot: snapshot.Bytes(), 5720 } 5721 return err 5722 } 5723 5724 output := &types.CloudHsmClusterNotFoundException{} 5725 err := awsAwsjson11_deserializeDocumentCloudHsmClusterNotFoundException(&output, shape) 5726 5727 if err != nil { 5728 var snapshot bytes.Buffer 5729 io.Copy(&snapshot, ringBuffer) 5730 err = &smithy.DeserializationError{ 5731 Err: fmt.Errorf("failed to decode response body, %w", err), 5732 Snapshot: snapshot.Bytes(), 5733 } 5734 return err 5735 } 5736 5737 errorBody.Seek(0, io.SeekStart) 5738 return output 5739} 5740 5741func awsAwsjson11_deserializeErrorCloudHsmClusterNotRelatedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5742 var buff [1024]byte 5743 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5744 5745 body := io.TeeReader(errorBody, ringBuffer) 5746 decoder := json.NewDecoder(body) 5747 decoder.UseNumber() 5748 var shape interface{} 5749 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5750 var snapshot bytes.Buffer 5751 io.Copy(&snapshot, ringBuffer) 5752 err = &smithy.DeserializationError{ 5753 Err: fmt.Errorf("failed to decode response body, %w", err), 5754 Snapshot: snapshot.Bytes(), 5755 } 5756 return err 5757 } 5758 5759 output := &types.CloudHsmClusterNotRelatedException{} 5760 err := awsAwsjson11_deserializeDocumentCloudHsmClusterNotRelatedException(&output, shape) 5761 5762 if err != nil { 5763 var snapshot bytes.Buffer 5764 io.Copy(&snapshot, ringBuffer) 5765 err = &smithy.DeserializationError{ 5766 Err: fmt.Errorf("failed to decode response body, %w", err), 5767 Snapshot: snapshot.Bytes(), 5768 } 5769 return err 5770 } 5771 5772 errorBody.Seek(0, io.SeekStart) 5773 return output 5774} 5775 5776func awsAwsjson11_deserializeErrorCustomKeyStoreHasCMKsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5777 var buff [1024]byte 5778 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5779 5780 body := io.TeeReader(errorBody, ringBuffer) 5781 decoder := json.NewDecoder(body) 5782 decoder.UseNumber() 5783 var shape interface{} 5784 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5785 var snapshot bytes.Buffer 5786 io.Copy(&snapshot, ringBuffer) 5787 err = &smithy.DeserializationError{ 5788 Err: fmt.Errorf("failed to decode response body, %w", err), 5789 Snapshot: snapshot.Bytes(), 5790 } 5791 return err 5792 } 5793 5794 output := &types.CustomKeyStoreHasCMKsException{} 5795 err := awsAwsjson11_deserializeDocumentCustomKeyStoreHasCMKsException(&output, shape) 5796 5797 if err != nil { 5798 var snapshot bytes.Buffer 5799 io.Copy(&snapshot, ringBuffer) 5800 err = &smithy.DeserializationError{ 5801 Err: fmt.Errorf("failed to decode response body, %w", err), 5802 Snapshot: snapshot.Bytes(), 5803 } 5804 return err 5805 } 5806 5807 errorBody.Seek(0, io.SeekStart) 5808 return output 5809} 5810 5811func awsAwsjson11_deserializeErrorCustomKeyStoreInvalidStateException(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.CustomKeyStoreInvalidStateException{} 5830 err := awsAwsjson11_deserializeDocumentCustomKeyStoreInvalidStateException(&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_deserializeErrorCustomKeyStoreNameInUseException(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.CustomKeyStoreNameInUseException{} 5865 err := awsAwsjson11_deserializeDocumentCustomKeyStoreNameInUseException(&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_deserializeErrorCustomKeyStoreNotFoundException(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.CustomKeyStoreNotFoundException{} 5900 err := awsAwsjson11_deserializeDocumentCustomKeyStoreNotFoundException(&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_deserializeErrorDependencyTimeoutException(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.DependencyTimeoutException{} 5935 err := awsAwsjson11_deserializeDocumentDependencyTimeoutException(&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_deserializeErrorDisabledException(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.DisabledException{} 5970 err := awsAwsjson11_deserializeDocumentDisabledException(&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_deserializeErrorExpiredImportTokenException(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.ExpiredImportTokenException{} 6005 err := awsAwsjson11_deserializeDocumentExpiredImportTokenException(&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_deserializeErrorIncorrectKeyException(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.IncorrectKeyException{} 6040 err := awsAwsjson11_deserializeDocumentIncorrectKeyException(&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_deserializeErrorIncorrectKeyMaterialException(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.IncorrectKeyMaterialException{} 6075 err := awsAwsjson11_deserializeDocumentIncorrectKeyMaterialException(&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_deserializeErrorIncorrectTrustAnchorException(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.IncorrectTrustAnchorException{} 6110 err := awsAwsjson11_deserializeDocumentIncorrectTrustAnchorException(&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_deserializeErrorInvalidAliasNameException(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.InvalidAliasNameException{} 6145 err := awsAwsjson11_deserializeDocumentInvalidAliasNameException(&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_deserializeErrorInvalidArnException(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.InvalidArnException{} 6180 err := awsAwsjson11_deserializeDocumentInvalidArnException(&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_deserializeErrorInvalidCiphertextException(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.InvalidCiphertextException{} 6215 err := awsAwsjson11_deserializeDocumentInvalidCiphertextException(&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_deserializeErrorInvalidGrantIdException(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.InvalidGrantIdException{} 6250 err := awsAwsjson11_deserializeDocumentInvalidGrantIdException(&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_deserializeErrorInvalidGrantTokenException(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.InvalidGrantTokenException{} 6285 err := awsAwsjson11_deserializeDocumentInvalidGrantTokenException(&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_deserializeErrorInvalidImportTokenException(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.InvalidImportTokenException{} 6320 err := awsAwsjson11_deserializeDocumentInvalidImportTokenException(&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_deserializeErrorInvalidKeyUsageException(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.InvalidKeyUsageException{} 6355 err := awsAwsjson11_deserializeDocumentInvalidKeyUsageException(&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_deserializeErrorInvalidMarkerException(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.InvalidMarkerException{} 6390 err := awsAwsjson11_deserializeDocumentInvalidMarkerException(&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_deserializeErrorKeyUnavailableException(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.KeyUnavailableException{} 6425 err := awsAwsjson11_deserializeDocumentKeyUnavailableException(&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_deserializeErrorKMSInternalException(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.KMSInternalException{} 6460 err := awsAwsjson11_deserializeDocumentKMSInternalException(&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_deserializeErrorKMSInvalidSignatureException(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.KMSInvalidSignatureException{} 6495 err := awsAwsjson11_deserializeDocumentKMSInvalidSignatureException(&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_deserializeErrorKMSInvalidStateException(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.KMSInvalidStateException{} 6530 err := awsAwsjson11_deserializeDocumentKMSInvalidStateException(&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_deserializeErrorLimitExceededException(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.LimitExceededException{} 6565 err := awsAwsjson11_deserializeDocumentLimitExceededException(&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_deserializeErrorMalformedPolicyDocumentException(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.MalformedPolicyDocumentException{} 6600 err := awsAwsjson11_deserializeDocumentMalformedPolicyDocumentException(&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_deserializeErrorNotFoundException(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.NotFoundException{} 6635 err := awsAwsjson11_deserializeDocumentNotFoundException(&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_deserializeErrorTagException(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.TagException{} 6670 err := awsAwsjson11_deserializeDocumentTagException(&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_deserializeErrorUnsupportedOperationException(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.UnsupportedOperationException{} 6705 err := awsAwsjson11_deserializeDocumentUnsupportedOperationException(&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_deserializeDocumentAliasList(v *[]types.AliasListEntry, value interface{}) error { 6722 if v == nil { 6723 return fmt.Errorf("unexpected nil of type %T", v) 6724 } 6725 if value == nil { 6726 return nil 6727 } 6728 6729 shape, ok := value.([]interface{}) 6730 if !ok { 6731 return fmt.Errorf("unexpected JSON type %v", value) 6732 } 6733 6734 var cv []types.AliasListEntry 6735 if *v == nil { 6736 cv = []types.AliasListEntry{} 6737 } else { 6738 cv = *v 6739 } 6740 6741 for _, value := range shape { 6742 var col types.AliasListEntry 6743 destAddr := &col 6744 if err := awsAwsjson11_deserializeDocumentAliasListEntry(&destAddr, value); err != nil { 6745 return err 6746 } 6747 col = *destAddr 6748 cv = append(cv, col) 6749 6750 } 6751 *v = cv 6752 return nil 6753} 6754 6755func awsAwsjson11_deserializeDocumentAliasListEntry(v **types.AliasListEntry, value interface{}) error { 6756 if v == nil { 6757 return fmt.Errorf("unexpected nil of type %T", v) 6758 } 6759 if value == nil { 6760 return nil 6761 } 6762 6763 shape, ok := value.(map[string]interface{}) 6764 if !ok { 6765 return fmt.Errorf("unexpected JSON type %v", value) 6766 } 6767 6768 var sv *types.AliasListEntry 6769 if *v == nil { 6770 sv = &types.AliasListEntry{} 6771 } else { 6772 sv = *v 6773 } 6774 6775 for key, value := range shape { 6776 switch key { 6777 case "AliasArn": 6778 if value != nil { 6779 jtv, ok := value.(string) 6780 if !ok { 6781 return fmt.Errorf("expected ArnType to be of type string, got %T instead", value) 6782 } 6783 sv.AliasArn = ptr.String(jtv) 6784 } 6785 6786 case "AliasName": 6787 if value != nil { 6788 jtv, ok := value.(string) 6789 if !ok { 6790 return fmt.Errorf("expected AliasNameType to be of type string, got %T instead", value) 6791 } 6792 sv.AliasName = ptr.String(jtv) 6793 } 6794 6795 case "CreationDate": 6796 if value != nil { 6797 jtv, ok := value.(json.Number) 6798 if !ok { 6799 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 6800 } 6801 f64, err := jtv.Float64() 6802 if err != nil { 6803 return err 6804 } 6805 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6806 } 6807 6808 case "LastUpdatedDate": 6809 if value != nil { 6810 jtv, ok := value.(json.Number) 6811 if !ok { 6812 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 6813 } 6814 f64, err := jtv.Float64() 6815 if err != nil { 6816 return err 6817 } 6818 sv.LastUpdatedDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6819 } 6820 6821 case "TargetKeyId": 6822 if value != nil { 6823 jtv, ok := value.(string) 6824 if !ok { 6825 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 6826 } 6827 sv.TargetKeyId = ptr.String(jtv) 6828 } 6829 6830 default: 6831 _, _ = key, value 6832 6833 } 6834 } 6835 *v = sv 6836 return nil 6837} 6838 6839func awsAwsjson11_deserializeDocumentAlreadyExistsException(v **types.AlreadyExistsException, value interface{}) error { 6840 if v == nil { 6841 return fmt.Errorf("unexpected nil of type %T", v) 6842 } 6843 if value == nil { 6844 return nil 6845 } 6846 6847 shape, ok := value.(map[string]interface{}) 6848 if !ok { 6849 return fmt.Errorf("unexpected JSON type %v", value) 6850 } 6851 6852 var sv *types.AlreadyExistsException 6853 if *v == nil { 6854 sv = &types.AlreadyExistsException{} 6855 } else { 6856 sv = *v 6857 } 6858 6859 for key, value := range shape { 6860 switch key { 6861 case "message": 6862 if value != nil { 6863 jtv, ok := value.(string) 6864 if !ok { 6865 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 6866 } 6867 sv.Message = ptr.String(jtv) 6868 } 6869 6870 default: 6871 _, _ = key, value 6872 6873 } 6874 } 6875 *v = sv 6876 return nil 6877} 6878 6879func awsAwsjson11_deserializeDocumentCloudHsmClusterInUseException(v **types.CloudHsmClusterInUseException, value interface{}) error { 6880 if v == nil { 6881 return fmt.Errorf("unexpected nil of type %T", v) 6882 } 6883 if value == nil { 6884 return nil 6885 } 6886 6887 shape, ok := value.(map[string]interface{}) 6888 if !ok { 6889 return fmt.Errorf("unexpected JSON type %v", value) 6890 } 6891 6892 var sv *types.CloudHsmClusterInUseException 6893 if *v == nil { 6894 sv = &types.CloudHsmClusterInUseException{} 6895 } else { 6896 sv = *v 6897 } 6898 6899 for key, value := range shape { 6900 switch key { 6901 case "message": 6902 if value != nil { 6903 jtv, ok := value.(string) 6904 if !ok { 6905 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 6906 } 6907 sv.Message = ptr.String(jtv) 6908 } 6909 6910 default: 6911 _, _ = key, value 6912 6913 } 6914 } 6915 *v = sv 6916 return nil 6917} 6918 6919func awsAwsjson11_deserializeDocumentCloudHsmClusterInvalidConfigurationException(v **types.CloudHsmClusterInvalidConfigurationException, value interface{}) error { 6920 if v == nil { 6921 return fmt.Errorf("unexpected nil of type %T", v) 6922 } 6923 if value == nil { 6924 return nil 6925 } 6926 6927 shape, ok := value.(map[string]interface{}) 6928 if !ok { 6929 return fmt.Errorf("unexpected JSON type %v", value) 6930 } 6931 6932 var sv *types.CloudHsmClusterInvalidConfigurationException 6933 if *v == nil { 6934 sv = &types.CloudHsmClusterInvalidConfigurationException{} 6935 } else { 6936 sv = *v 6937 } 6938 6939 for key, value := range shape { 6940 switch key { 6941 case "message": 6942 if value != nil { 6943 jtv, ok := value.(string) 6944 if !ok { 6945 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 6946 } 6947 sv.Message = ptr.String(jtv) 6948 } 6949 6950 default: 6951 _, _ = key, value 6952 6953 } 6954 } 6955 *v = sv 6956 return nil 6957} 6958 6959func awsAwsjson11_deserializeDocumentCloudHsmClusterNotActiveException(v **types.CloudHsmClusterNotActiveException, value interface{}) error { 6960 if v == nil { 6961 return fmt.Errorf("unexpected nil of type %T", v) 6962 } 6963 if value == nil { 6964 return nil 6965 } 6966 6967 shape, ok := value.(map[string]interface{}) 6968 if !ok { 6969 return fmt.Errorf("unexpected JSON type %v", value) 6970 } 6971 6972 var sv *types.CloudHsmClusterNotActiveException 6973 if *v == nil { 6974 sv = &types.CloudHsmClusterNotActiveException{} 6975 } else { 6976 sv = *v 6977 } 6978 6979 for key, value := range shape { 6980 switch key { 6981 case "message": 6982 if value != nil { 6983 jtv, ok := value.(string) 6984 if !ok { 6985 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 6986 } 6987 sv.Message = ptr.String(jtv) 6988 } 6989 6990 default: 6991 _, _ = key, value 6992 6993 } 6994 } 6995 *v = sv 6996 return nil 6997} 6998 6999func awsAwsjson11_deserializeDocumentCloudHsmClusterNotFoundException(v **types.CloudHsmClusterNotFoundException, value interface{}) error { 7000 if v == nil { 7001 return fmt.Errorf("unexpected nil of type %T", v) 7002 } 7003 if value == nil { 7004 return nil 7005 } 7006 7007 shape, ok := value.(map[string]interface{}) 7008 if !ok { 7009 return fmt.Errorf("unexpected JSON type %v", value) 7010 } 7011 7012 var sv *types.CloudHsmClusterNotFoundException 7013 if *v == nil { 7014 sv = &types.CloudHsmClusterNotFoundException{} 7015 } else { 7016 sv = *v 7017 } 7018 7019 for key, value := range shape { 7020 switch key { 7021 case "message": 7022 if value != nil { 7023 jtv, ok := value.(string) 7024 if !ok { 7025 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7026 } 7027 sv.Message = ptr.String(jtv) 7028 } 7029 7030 default: 7031 _, _ = key, value 7032 7033 } 7034 } 7035 *v = sv 7036 return nil 7037} 7038 7039func awsAwsjson11_deserializeDocumentCloudHsmClusterNotRelatedException(v **types.CloudHsmClusterNotRelatedException, value interface{}) error { 7040 if v == nil { 7041 return fmt.Errorf("unexpected nil of type %T", v) 7042 } 7043 if value == nil { 7044 return nil 7045 } 7046 7047 shape, ok := value.(map[string]interface{}) 7048 if !ok { 7049 return fmt.Errorf("unexpected JSON type %v", value) 7050 } 7051 7052 var sv *types.CloudHsmClusterNotRelatedException 7053 if *v == nil { 7054 sv = &types.CloudHsmClusterNotRelatedException{} 7055 } else { 7056 sv = *v 7057 } 7058 7059 for key, value := range shape { 7060 switch key { 7061 case "message": 7062 if value != nil { 7063 jtv, ok := value.(string) 7064 if !ok { 7065 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7066 } 7067 sv.Message = ptr.String(jtv) 7068 } 7069 7070 default: 7071 _, _ = key, value 7072 7073 } 7074 } 7075 *v = sv 7076 return nil 7077} 7078 7079func awsAwsjson11_deserializeDocumentCustomKeyStoreHasCMKsException(v **types.CustomKeyStoreHasCMKsException, value interface{}) error { 7080 if v == nil { 7081 return fmt.Errorf("unexpected nil of type %T", v) 7082 } 7083 if value == nil { 7084 return nil 7085 } 7086 7087 shape, ok := value.(map[string]interface{}) 7088 if !ok { 7089 return fmt.Errorf("unexpected JSON type %v", value) 7090 } 7091 7092 var sv *types.CustomKeyStoreHasCMKsException 7093 if *v == nil { 7094 sv = &types.CustomKeyStoreHasCMKsException{} 7095 } else { 7096 sv = *v 7097 } 7098 7099 for key, value := range shape { 7100 switch key { 7101 case "message": 7102 if value != nil { 7103 jtv, ok := value.(string) 7104 if !ok { 7105 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7106 } 7107 sv.Message = ptr.String(jtv) 7108 } 7109 7110 default: 7111 _, _ = key, value 7112 7113 } 7114 } 7115 *v = sv 7116 return nil 7117} 7118 7119func awsAwsjson11_deserializeDocumentCustomKeyStoreInvalidStateException(v **types.CustomKeyStoreInvalidStateException, value interface{}) error { 7120 if v == nil { 7121 return fmt.Errorf("unexpected nil of type %T", v) 7122 } 7123 if value == nil { 7124 return nil 7125 } 7126 7127 shape, ok := value.(map[string]interface{}) 7128 if !ok { 7129 return fmt.Errorf("unexpected JSON type %v", value) 7130 } 7131 7132 var sv *types.CustomKeyStoreInvalidStateException 7133 if *v == nil { 7134 sv = &types.CustomKeyStoreInvalidStateException{} 7135 } else { 7136 sv = *v 7137 } 7138 7139 for key, value := range shape { 7140 switch key { 7141 case "message": 7142 if value != nil { 7143 jtv, ok := value.(string) 7144 if !ok { 7145 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7146 } 7147 sv.Message = ptr.String(jtv) 7148 } 7149 7150 default: 7151 _, _ = key, value 7152 7153 } 7154 } 7155 *v = sv 7156 return nil 7157} 7158 7159func awsAwsjson11_deserializeDocumentCustomKeyStoreNameInUseException(v **types.CustomKeyStoreNameInUseException, value interface{}) error { 7160 if v == nil { 7161 return fmt.Errorf("unexpected nil of type %T", v) 7162 } 7163 if value == nil { 7164 return nil 7165 } 7166 7167 shape, ok := value.(map[string]interface{}) 7168 if !ok { 7169 return fmt.Errorf("unexpected JSON type %v", value) 7170 } 7171 7172 var sv *types.CustomKeyStoreNameInUseException 7173 if *v == nil { 7174 sv = &types.CustomKeyStoreNameInUseException{} 7175 } else { 7176 sv = *v 7177 } 7178 7179 for key, value := range shape { 7180 switch key { 7181 case "message": 7182 if value != nil { 7183 jtv, ok := value.(string) 7184 if !ok { 7185 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7186 } 7187 sv.Message = ptr.String(jtv) 7188 } 7189 7190 default: 7191 _, _ = key, value 7192 7193 } 7194 } 7195 *v = sv 7196 return nil 7197} 7198 7199func awsAwsjson11_deserializeDocumentCustomKeyStoreNotFoundException(v **types.CustomKeyStoreNotFoundException, value interface{}) error { 7200 if v == nil { 7201 return fmt.Errorf("unexpected nil of type %T", v) 7202 } 7203 if value == nil { 7204 return nil 7205 } 7206 7207 shape, ok := value.(map[string]interface{}) 7208 if !ok { 7209 return fmt.Errorf("unexpected JSON type %v", value) 7210 } 7211 7212 var sv *types.CustomKeyStoreNotFoundException 7213 if *v == nil { 7214 sv = &types.CustomKeyStoreNotFoundException{} 7215 } else { 7216 sv = *v 7217 } 7218 7219 for key, value := range shape { 7220 switch key { 7221 case "message": 7222 if value != nil { 7223 jtv, ok := value.(string) 7224 if !ok { 7225 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7226 } 7227 sv.Message = ptr.String(jtv) 7228 } 7229 7230 default: 7231 _, _ = key, value 7232 7233 } 7234 } 7235 *v = sv 7236 return nil 7237} 7238 7239func awsAwsjson11_deserializeDocumentCustomKeyStoresList(v *[]types.CustomKeyStoresListEntry, value interface{}) error { 7240 if v == nil { 7241 return fmt.Errorf("unexpected nil of type %T", v) 7242 } 7243 if value == nil { 7244 return nil 7245 } 7246 7247 shape, ok := value.([]interface{}) 7248 if !ok { 7249 return fmt.Errorf("unexpected JSON type %v", value) 7250 } 7251 7252 var cv []types.CustomKeyStoresListEntry 7253 if *v == nil { 7254 cv = []types.CustomKeyStoresListEntry{} 7255 } else { 7256 cv = *v 7257 } 7258 7259 for _, value := range shape { 7260 var col types.CustomKeyStoresListEntry 7261 destAddr := &col 7262 if err := awsAwsjson11_deserializeDocumentCustomKeyStoresListEntry(&destAddr, value); err != nil { 7263 return err 7264 } 7265 col = *destAddr 7266 cv = append(cv, col) 7267 7268 } 7269 *v = cv 7270 return nil 7271} 7272 7273func awsAwsjson11_deserializeDocumentCustomKeyStoresListEntry(v **types.CustomKeyStoresListEntry, value interface{}) error { 7274 if v == nil { 7275 return fmt.Errorf("unexpected nil of type %T", v) 7276 } 7277 if value == nil { 7278 return nil 7279 } 7280 7281 shape, ok := value.(map[string]interface{}) 7282 if !ok { 7283 return fmt.Errorf("unexpected JSON type %v", value) 7284 } 7285 7286 var sv *types.CustomKeyStoresListEntry 7287 if *v == nil { 7288 sv = &types.CustomKeyStoresListEntry{} 7289 } else { 7290 sv = *v 7291 } 7292 7293 for key, value := range shape { 7294 switch key { 7295 case "CloudHsmClusterId": 7296 if value != nil { 7297 jtv, ok := value.(string) 7298 if !ok { 7299 return fmt.Errorf("expected CloudHsmClusterIdType to be of type string, got %T instead", value) 7300 } 7301 sv.CloudHsmClusterId = ptr.String(jtv) 7302 } 7303 7304 case "ConnectionErrorCode": 7305 if value != nil { 7306 jtv, ok := value.(string) 7307 if !ok { 7308 return fmt.Errorf("expected ConnectionErrorCodeType to be of type string, got %T instead", value) 7309 } 7310 sv.ConnectionErrorCode = types.ConnectionErrorCodeType(jtv) 7311 } 7312 7313 case "ConnectionState": 7314 if value != nil { 7315 jtv, ok := value.(string) 7316 if !ok { 7317 return fmt.Errorf("expected ConnectionStateType to be of type string, got %T instead", value) 7318 } 7319 sv.ConnectionState = types.ConnectionStateType(jtv) 7320 } 7321 7322 case "CreationDate": 7323 if value != nil { 7324 jtv, ok := value.(json.Number) 7325 if !ok { 7326 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 7327 } 7328 f64, err := jtv.Float64() 7329 if err != nil { 7330 return err 7331 } 7332 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7333 } 7334 7335 case "CustomKeyStoreId": 7336 if value != nil { 7337 jtv, ok := value.(string) 7338 if !ok { 7339 return fmt.Errorf("expected CustomKeyStoreIdType to be of type string, got %T instead", value) 7340 } 7341 sv.CustomKeyStoreId = ptr.String(jtv) 7342 } 7343 7344 case "CustomKeyStoreName": 7345 if value != nil { 7346 jtv, ok := value.(string) 7347 if !ok { 7348 return fmt.Errorf("expected CustomKeyStoreNameType to be of type string, got %T instead", value) 7349 } 7350 sv.CustomKeyStoreName = ptr.String(jtv) 7351 } 7352 7353 case "TrustAnchorCertificate": 7354 if value != nil { 7355 jtv, ok := value.(string) 7356 if !ok { 7357 return fmt.Errorf("expected TrustAnchorCertificateType to be of type string, got %T instead", value) 7358 } 7359 sv.TrustAnchorCertificate = ptr.String(jtv) 7360 } 7361 7362 default: 7363 _, _ = key, value 7364 7365 } 7366 } 7367 *v = sv 7368 return nil 7369} 7370 7371func awsAwsjson11_deserializeDocumentDependencyTimeoutException(v **types.DependencyTimeoutException, value interface{}) error { 7372 if v == nil { 7373 return fmt.Errorf("unexpected nil of type %T", v) 7374 } 7375 if value == nil { 7376 return nil 7377 } 7378 7379 shape, ok := value.(map[string]interface{}) 7380 if !ok { 7381 return fmt.Errorf("unexpected JSON type %v", value) 7382 } 7383 7384 var sv *types.DependencyTimeoutException 7385 if *v == nil { 7386 sv = &types.DependencyTimeoutException{} 7387 } else { 7388 sv = *v 7389 } 7390 7391 for key, value := range shape { 7392 switch key { 7393 case "message": 7394 if value != nil { 7395 jtv, ok := value.(string) 7396 if !ok { 7397 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7398 } 7399 sv.Message = ptr.String(jtv) 7400 } 7401 7402 default: 7403 _, _ = key, value 7404 7405 } 7406 } 7407 *v = sv 7408 return nil 7409} 7410 7411func awsAwsjson11_deserializeDocumentDisabledException(v **types.DisabledException, value interface{}) error { 7412 if v == nil { 7413 return fmt.Errorf("unexpected nil of type %T", v) 7414 } 7415 if value == nil { 7416 return nil 7417 } 7418 7419 shape, ok := value.(map[string]interface{}) 7420 if !ok { 7421 return fmt.Errorf("unexpected JSON type %v", value) 7422 } 7423 7424 var sv *types.DisabledException 7425 if *v == nil { 7426 sv = &types.DisabledException{} 7427 } else { 7428 sv = *v 7429 } 7430 7431 for key, value := range shape { 7432 switch key { 7433 case "message": 7434 if value != nil { 7435 jtv, ok := value.(string) 7436 if !ok { 7437 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7438 } 7439 sv.Message = ptr.String(jtv) 7440 } 7441 7442 default: 7443 _, _ = key, value 7444 7445 } 7446 } 7447 *v = sv 7448 return nil 7449} 7450 7451func awsAwsjson11_deserializeDocumentEncryptionAlgorithmSpecList(v *[]types.EncryptionAlgorithmSpec, value interface{}) error { 7452 if v == nil { 7453 return fmt.Errorf("unexpected nil of type %T", v) 7454 } 7455 if value == nil { 7456 return nil 7457 } 7458 7459 shape, ok := value.([]interface{}) 7460 if !ok { 7461 return fmt.Errorf("unexpected JSON type %v", value) 7462 } 7463 7464 var cv []types.EncryptionAlgorithmSpec 7465 if *v == nil { 7466 cv = []types.EncryptionAlgorithmSpec{} 7467 } else { 7468 cv = *v 7469 } 7470 7471 for _, value := range shape { 7472 var col types.EncryptionAlgorithmSpec 7473 if value != nil { 7474 jtv, ok := value.(string) 7475 if !ok { 7476 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 7477 } 7478 col = types.EncryptionAlgorithmSpec(jtv) 7479 } 7480 cv = append(cv, col) 7481 7482 } 7483 *v = cv 7484 return nil 7485} 7486 7487func awsAwsjson11_deserializeDocumentEncryptionContextType(v *map[string]string, value interface{}) error { 7488 if v == nil { 7489 return fmt.Errorf("unexpected nil of type %T", v) 7490 } 7491 if value == nil { 7492 return nil 7493 } 7494 7495 shape, ok := value.(map[string]interface{}) 7496 if !ok { 7497 return fmt.Errorf("unexpected JSON type %v", value) 7498 } 7499 7500 var mv map[string]string 7501 if *v == nil { 7502 mv = map[string]string{} 7503 } else { 7504 mv = *v 7505 } 7506 7507 for key, value := range shape { 7508 var parsedVal string 7509 if value != nil { 7510 jtv, ok := value.(string) 7511 if !ok { 7512 return fmt.Errorf("expected EncryptionContextValue to be of type string, got %T instead", value) 7513 } 7514 parsedVal = jtv 7515 } 7516 mv[key] = parsedVal 7517 7518 } 7519 *v = mv 7520 return nil 7521} 7522 7523func awsAwsjson11_deserializeDocumentExpiredImportTokenException(v **types.ExpiredImportTokenException, value interface{}) error { 7524 if v == nil { 7525 return fmt.Errorf("unexpected nil of type %T", v) 7526 } 7527 if value == nil { 7528 return nil 7529 } 7530 7531 shape, ok := value.(map[string]interface{}) 7532 if !ok { 7533 return fmt.Errorf("unexpected JSON type %v", value) 7534 } 7535 7536 var sv *types.ExpiredImportTokenException 7537 if *v == nil { 7538 sv = &types.ExpiredImportTokenException{} 7539 } else { 7540 sv = *v 7541 } 7542 7543 for key, value := range shape { 7544 switch key { 7545 case "message": 7546 if value != nil { 7547 jtv, ok := value.(string) 7548 if !ok { 7549 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7550 } 7551 sv.Message = ptr.String(jtv) 7552 } 7553 7554 default: 7555 _, _ = key, value 7556 7557 } 7558 } 7559 *v = sv 7560 return nil 7561} 7562 7563func awsAwsjson11_deserializeDocumentGrantConstraints(v **types.GrantConstraints, value interface{}) error { 7564 if v == nil { 7565 return fmt.Errorf("unexpected nil of type %T", v) 7566 } 7567 if value == nil { 7568 return nil 7569 } 7570 7571 shape, ok := value.(map[string]interface{}) 7572 if !ok { 7573 return fmt.Errorf("unexpected JSON type %v", value) 7574 } 7575 7576 var sv *types.GrantConstraints 7577 if *v == nil { 7578 sv = &types.GrantConstraints{} 7579 } else { 7580 sv = *v 7581 } 7582 7583 for key, value := range shape { 7584 switch key { 7585 case "EncryptionContextEquals": 7586 if err := awsAwsjson11_deserializeDocumentEncryptionContextType(&sv.EncryptionContextEquals, value); err != nil { 7587 return err 7588 } 7589 7590 case "EncryptionContextSubset": 7591 if err := awsAwsjson11_deserializeDocumentEncryptionContextType(&sv.EncryptionContextSubset, value); err != nil { 7592 return err 7593 } 7594 7595 default: 7596 _, _ = key, value 7597 7598 } 7599 } 7600 *v = sv 7601 return nil 7602} 7603 7604func awsAwsjson11_deserializeDocumentGrantList(v *[]types.GrantListEntry, value interface{}) error { 7605 if v == nil { 7606 return fmt.Errorf("unexpected nil of type %T", v) 7607 } 7608 if value == nil { 7609 return nil 7610 } 7611 7612 shape, ok := value.([]interface{}) 7613 if !ok { 7614 return fmt.Errorf("unexpected JSON type %v", value) 7615 } 7616 7617 var cv []types.GrantListEntry 7618 if *v == nil { 7619 cv = []types.GrantListEntry{} 7620 } else { 7621 cv = *v 7622 } 7623 7624 for _, value := range shape { 7625 var col types.GrantListEntry 7626 destAddr := &col 7627 if err := awsAwsjson11_deserializeDocumentGrantListEntry(&destAddr, value); err != nil { 7628 return err 7629 } 7630 col = *destAddr 7631 cv = append(cv, col) 7632 7633 } 7634 *v = cv 7635 return nil 7636} 7637 7638func awsAwsjson11_deserializeDocumentGrantListEntry(v **types.GrantListEntry, value interface{}) error { 7639 if v == nil { 7640 return fmt.Errorf("unexpected nil of type %T", v) 7641 } 7642 if value == nil { 7643 return nil 7644 } 7645 7646 shape, ok := value.(map[string]interface{}) 7647 if !ok { 7648 return fmt.Errorf("unexpected JSON type %v", value) 7649 } 7650 7651 var sv *types.GrantListEntry 7652 if *v == nil { 7653 sv = &types.GrantListEntry{} 7654 } else { 7655 sv = *v 7656 } 7657 7658 for key, value := range shape { 7659 switch key { 7660 case "Constraints": 7661 if err := awsAwsjson11_deserializeDocumentGrantConstraints(&sv.Constraints, value); err != nil { 7662 return err 7663 } 7664 7665 case "CreationDate": 7666 if value != nil { 7667 jtv, ok := value.(json.Number) 7668 if !ok { 7669 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 7670 } 7671 f64, err := jtv.Float64() 7672 if err != nil { 7673 return err 7674 } 7675 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7676 } 7677 7678 case "GranteePrincipal": 7679 if value != nil { 7680 jtv, ok := value.(string) 7681 if !ok { 7682 return fmt.Errorf("expected PrincipalIdType to be of type string, got %T instead", value) 7683 } 7684 sv.GranteePrincipal = ptr.String(jtv) 7685 } 7686 7687 case "GrantId": 7688 if value != nil { 7689 jtv, ok := value.(string) 7690 if !ok { 7691 return fmt.Errorf("expected GrantIdType to be of type string, got %T instead", value) 7692 } 7693 sv.GrantId = ptr.String(jtv) 7694 } 7695 7696 case "IssuingAccount": 7697 if value != nil { 7698 jtv, ok := value.(string) 7699 if !ok { 7700 return fmt.Errorf("expected PrincipalIdType to be of type string, got %T instead", value) 7701 } 7702 sv.IssuingAccount = ptr.String(jtv) 7703 } 7704 7705 case "KeyId": 7706 if value != nil { 7707 jtv, ok := value.(string) 7708 if !ok { 7709 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 7710 } 7711 sv.KeyId = ptr.String(jtv) 7712 } 7713 7714 case "Name": 7715 if value != nil { 7716 jtv, ok := value.(string) 7717 if !ok { 7718 return fmt.Errorf("expected GrantNameType to be of type string, got %T instead", value) 7719 } 7720 sv.Name = ptr.String(jtv) 7721 } 7722 7723 case "Operations": 7724 if err := awsAwsjson11_deserializeDocumentGrantOperationList(&sv.Operations, value); err != nil { 7725 return err 7726 } 7727 7728 case "RetiringPrincipal": 7729 if value != nil { 7730 jtv, ok := value.(string) 7731 if !ok { 7732 return fmt.Errorf("expected PrincipalIdType to be of type string, got %T instead", value) 7733 } 7734 sv.RetiringPrincipal = ptr.String(jtv) 7735 } 7736 7737 default: 7738 _, _ = key, value 7739 7740 } 7741 } 7742 *v = sv 7743 return nil 7744} 7745 7746func awsAwsjson11_deserializeDocumentGrantOperationList(v *[]types.GrantOperation, value interface{}) error { 7747 if v == nil { 7748 return fmt.Errorf("unexpected nil of type %T", v) 7749 } 7750 if value == nil { 7751 return nil 7752 } 7753 7754 shape, ok := value.([]interface{}) 7755 if !ok { 7756 return fmt.Errorf("unexpected JSON type %v", value) 7757 } 7758 7759 var cv []types.GrantOperation 7760 if *v == nil { 7761 cv = []types.GrantOperation{} 7762 } else { 7763 cv = *v 7764 } 7765 7766 for _, value := range shape { 7767 var col types.GrantOperation 7768 if value != nil { 7769 jtv, ok := value.(string) 7770 if !ok { 7771 return fmt.Errorf("expected GrantOperation to be of type string, got %T instead", value) 7772 } 7773 col = types.GrantOperation(jtv) 7774 } 7775 cv = append(cv, col) 7776 7777 } 7778 *v = cv 7779 return nil 7780} 7781 7782func awsAwsjson11_deserializeDocumentIncorrectKeyException(v **types.IncorrectKeyException, value interface{}) error { 7783 if v == nil { 7784 return fmt.Errorf("unexpected nil of type %T", v) 7785 } 7786 if value == nil { 7787 return nil 7788 } 7789 7790 shape, ok := value.(map[string]interface{}) 7791 if !ok { 7792 return fmt.Errorf("unexpected JSON type %v", value) 7793 } 7794 7795 var sv *types.IncorrectKeyException 7796 if *v == nil { 7797 sv = &types.IncorrectKeyException{} 7798 } else { 7799 sv = *v 7800 } 7801 7802 for key, value := range shape { 7803 switch key { 7804 case "message": 7805 if value != nil { 7806 jtv, ok := value.(string) 7807 if !ok { 7808 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7809 } 7810 sv.Message = ptr.String(jtv) 7811 } 7812 7813 default: 7814 _, _ = key, value 7815 7816 } 7817 } 7818 *v = sv 7819 return nil 7820} 7821 7822func awsAwsjson11_deserializeDocumentIncorrectKeyMaterialException(v **types.IncorrectKeyMaterialException, value interface{}) error { 7823 if v == nil { 7824 return fmt.Errorf("unexpected nil of type %T", v) 7825 } 7826 if value == nil { 7827 return nil 7828 } 7829 7830 shape, ok := value.(map[string]interface{}) 7831 if !ok { 7832 return fmt.Errorf("unexpected JSON type %v", value) 7833 } 7834 7835 var sv *types.IncorrectKeyMaterialException 7836 if *v == nil { 7837 sv = &types.IncorrectKeyMaterialException{} 7838 } else { 7839 sv = *v 7840 } 7841 7842 for key, value := range shape { 7843 switch key { 7844 case "message": 7845 if value != nil { 7846 jtv, ok := value.(string) 7847 if !ok { 7848 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7849 } 7850 sv.Message = ptr.String(jtv) 7851 } 7852 7853 default: 7854 _, _ = key, value 7855 7856 } 7857 } 7858 *v = sv 7859 return nil 7860} 7861 7862func awsAwsjson11_deserializeDocumentIncorrectTrustAnchorException(v **types.IncorrectTrustAnchorException, value interface{}) error { 7863 if v == nil { 7864 return fmt.Errorf("unexpected nil of type %T", v) 7865 } 7866 if value == nil { 7867 return nil 7868 } 7869 7870 shape, ok := value.(map[string]interface{}) 7871 if !ok { 7872 return fmt.Errorf("unexpected JSON type %v", value) 7873 } 7874 7875 var sv *types.IncorrectTrustAnchorException 7876 if *v == nil { 7877 sv = &types.IncorrectTrustAnchorException{} 7878 } else { 7879 sv = *v 7880 } 7881 7882 for key, value := range shape { 7883 switch key { 7884 case "message": 7885 if value != nil { 7886 jtv, ok := value.(string) 7887 if !ok { 7888 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7889 } 7890 sv.Message = ptr.String(jtv) 7891 } 7892 7893 default: 7894 _, _ = key, value 7895 7896 } 7897 } 7898 *v = sv 7899 return nil 7900} 7901 7902func awsAwsjson11_deserializeDocumentInvalidAliasNameException(v **types.InvalidAliasNameException, value interface{}) error { 7903 if v == nil { 7904 return fmt.Errorf("unexpected nil of type %T", v) 7905 } 7906 if value == nil { 7907 return nil 7908 } 7909 7910 shape, ok := value.(map[string]interface{}) 7911 if !ok { 7912 return fmt.Errorf("unexpected JSON type %v", value) 7913 } 7914 7915 var sv *types.InvalidAliasNameException 7916 if *v == nil { 7917 sv = &types.InvalidAliasNameException{} 7918 } else { 7919 sv = *v 7920 } 7921 7922 for key, value := range shape { 7923 switch key { 7924 case "message": 7925 if value != nil { 7926 jtv, ok := value.(string) 7927 if !ok { 7928 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7929 } 7930 sv.Message = ptr.String(jtv) 7931 } 7932 7933 default: 7934 _, _ = key, value 7935 7936 } 7937 } 7938 *v = sv 7939 return nil 7940} 7941 7942func awsAwsjson11_deserializeDocumentInvalidArnException(v **types.InvalidArnException, value interface{}) error { 7943 if v == nil { 7944 return fmt.Errorf("unexpected nil of type %T", v) 7945 } 7946 if value == nil { 7947 return nil 7948 } 7949 7950 shape, ok := value.(map[string]interface{}) 7951 if !ok { 7952 return fmt.Errorf("unexpected JSON type %v", value) 7953 } 7954 7955 var sv *types.InvalidArnException 7956 if *v == nil { 7957 sv = &types.InvalidArnException{} 7958 } else { 7959 sv = *v 7960 } 7961 7962 for key, value := range shape { 7963 switch key { 7964 case "message": 7965 if value != nil { 7966 jtv, ok := value.(string) 7967 if !ok { 7968 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 7969 } 7970 sv.Message = ptr.String(jtv) 7971 } 7972 7973 default: 7974 _, _ = key, value 7975 7976 } 7977 } 7978 *v = sv 7979 return nil 7980} 7981 7982func awsAwsjson11_deserializeDocumentInvalidCiphertextException(v **types.InvalidCiphertextException, value interface{}) error { 7983 if v == nil { 7984 return fmt.Errorf("unexpected nil of type %T", v) 7985 } 7986 if value == nil { 7987 return nil 7988 } 7989 7990 shape, ok := value.(map[string]interface{}) 7991 if !ok { 7992 return fmt.Errorf("unexpected JSON type %v", value) 7993 } 7994 7995 var sv *types.InvalidCiphertextException 7996 if *v == nil { 7997 sv = &types.InvalidCiphertextException{} 7998 } else { 7999 sv = *v 8000 } 8001 8002 for key, value := range shape { 8003 switch key { 8004 case "message": 8005 if value != nil { 8006 jtv, ok := value.(string) 8007 if !ok { 8008 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8009 } 8010 sv.Message = ptr.String(jtv) 8011 } 8012 8013 default: 8014 _, _ = key, value 8015 8016 } 8017 } 8018 *v = sv 8019 return nil 8020} 8021 8022func awsAwsjson11_deserializeDocumentInvalidGrantIdException(v **types.InvalidGrantIdException, value interface{}) error { 8023 if v == nil { 8024 return fmt.Errorf("unexpected nil of type %T", v) 8025 } 8026 if value == nil { 8027 return nil 8028 } 8029 8030 shape, ok := value.(map[string]interface{}) 8031 if !ok { 8032 return fmt.Errorf("unexpected JSON type %v", value) 8033 } 8034 8035 var sv *types.InvalidGrantIdException 8036 if *v == nil { 8037 sv = &types.InvalidGrantIdException{} 8038 } else { 8039 sv = *v 8040 } 8041 8042 for key, value := range shape { 8043 switch key { 8044 case "message": 8045 if value != nil { 8046 jtv, ok := value.(string) 8047 if !ok { 8048 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8049 } 8050 sv.Message = ptr.String(jtv) 8051 } 8052 8053 default: 8054 _, _ = key, value 8055 8056 } 8057 } 8058 *v = sv 8059 return nil 8060} 8061 8062func awsAwsjson11_deserializeDocumentInvalidGrantTokenException(v **types.InvalidGrantTokenException, value interface{}) error { 8063 if v == nil { 8064 return fmt.Errorf("unexpected nil of type %T", v) 8065 } 8066 if value == nil { 8067 return nil 8068 } 8069 8070 shape, ok := value.(map[string]interface{}) 8071 if !ok { 8072 return fmt.Errorf("unexpected JSON type %v", value) 8073 } 8074 8075 var sv *types.InvalidGrantTokenException 8076 if *v == nil { 8077 sv = &types.InvalidGrantTokenException{} 8078 } else { 8079 sv = *v 8080 } 8081 8082 for key, value := range shape { 8083 switch key { 8084 case "message": 8085 if value != nil { 8086 jtv, ok := value.(string) 8087 if !ok { 8088 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8089 } 8090 sv.Message = ptr.String(jtv) 8091 } 8092 8093 default: 8094 _, _ = key, value 8095 8096 } 8097 } 8098 *v = sv 8099 return nil 8100} 8101 8102func awsAwsjson11_deserializeDocumentInvalidImportTokenException(v **types.InvalidImportTokenException, value interface{}) error { 8103 if v == nil { 8104 return fmt.Errorf("unexpected nil of type %T", v) 8105 } 8106 if value == nil { 8107 return nil 8108 } 8109 8110 shape, ok := value.(map[string]interface{}) 8111 if !ok { 8112 return fmt.Errorf("unexpected JSON type %v", value) 8113 } 8114 8115 var sv *types.InvalidImportTokenException 8116 if *v == nil { 8117 sv = &types.InvalidImportTokenException{} 8118 } else { 8119 sv = *v 8120 } 8121 8122 for key, value := range shape { 8123 switch key { 8124 case "message": 8125 if value != nil { 8126 jtv, ok := value.(string) 8127 if !ok { 8128 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8129 } 8130 sv.Message = ptr.String(jtv) 8131 } 8132 8133 default: 8134 _, _ = key, value 8135 8136 } 8137 } 8138 *v = sv 8139 return nil 8140} 8141 8142func awsAwsjson11_deserializeDocumentInvalidKeyUsageException(v **types.InvalidKeyUsageException, value interface{}) error { 8143 if v == nil { 8144 return fmt.Errorf("unexpected nil of type %T", v) 8145 } 8146 if value == nil { 8147 return nil 8148 } 8149 8150 shape, ok := value.(map[string]interface{}) 8151 if !ok { 8152 return fmt.Errorf("unexpected JSON type %v", value) 8153 } 8154 8155 var sv *types.InvalidKeyUsageException 8156 if *v == nil { 8157 sv = &types.InvalidKeyUsageException{} 8158 } else { 8159 sv = *v 8160 } 8161 8162 for key, value := range shape { 8163 switch key { 8164 case "message": 8165 if value != nil { 8166 jtv, ok := value.(string) 8167 if !ok { 8168 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8169 } 8170 sv.Message = ptr.String(jtv) 8171 } 8172 8173 default: 8174 _, _ = key, value 8175 8176 } 8177 } 8178 *v = sv 8179 return nil 8180} 8181 8182func awsAwsjson11_deserializeDocumentInvalidMarkerException(v **types.InvalidMarkerException, value interface{}) error { 8183 if v == nil { 8184 return fmt.Errorf("unexpected nil of type %T", v) 8185 } 8186 if value == nil { 8187 return nil 8188 } 8189 8190 shape, ok := value.(map[string]interface{}) 8191 if !ok { 8192 return fmt.Errorf("unexpected JSON type %v", value) 8193 } 8194 8195 var sv *types.InvalidMarkerException 8196 if *v == nil { 8197 sv = &types.InvalidMarkerException{} 8198 } else { 8199 sv = *v 8200 } 8201 8202 for key, value := range shape { 8203 switch key { 8204 case "message": 8205 if value != nil { 8206 jtv, ok := value.(string) 8207 if !ok { 8208 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8209 } 8210 sv.Message = ptr.String(jtv) 8211 } 8212 8213 default: 8214 _, _ = key, value 8215 8216 } 8217 } 8218 *v = sv 8219 return nil 8220} 8221 8222func awsAwsjson11_deserializeDocumentKeyList(v *[]types.KeyListEntry, value interface{}) error { 8223 if v == nil { 8224 return fmt.Errorf("unexpected nil of type %T", v) 8225 } 8226 if value == nil { 8227 return nil 8228 } 8229 8230 shape, ok := value.([]interface{}) 8231 if !ok { 8232 return fmt.Errorf("unexpected JSON type %v", value) 8233 } 8234 8235 var cv []types.KeyListEntry 8236 if *v == nil { 8237 cv = []types.KeyListEntry{} 8238 } else { 8239 cv = *v 8240 } 8241 8242 for _, value := range shape { 8243 var col types.KeyListEntry 8244 destAddr := &col 8245 if err := awsAwsjson11_deserializeDocumentKeyListEntry(&destAddr, value); err != nil { 8246 return err 8247 } 8248 col = *destAddr 8249 cv = append(cv, col) 8250 8251 } 8252 *v = cv 8253 return nil 8254} 8255 8256func awsAwsjson11_deserializeDocumentKeyListEntry(v **types.KeyListEntry, value interface{}) error { 8257 if v == nil { 8258 return fmt.Errorf("unexpected nil of type %T", v) 8259 } 8260 if value == nil { 8261 return nil 8262 } 8263 8264 shape, ok := value.(map[string]interface{}) 8265 if !ok { 8266 return fmt.Errorf("unexpected JSON type %v", value) 8267 } 8268 8269 var sv *types.KeyListEntry 8270 if *v == nil { 8271 sv = &types.KeyListEntry{} 8272 } else { 8273 sv = *v 8274 } 8275 8276 for key, value := range shape { 8277 switch key { 8278 case "KeyArn": 8279 if value != nil { 8280 jtv, ok := value.(string) 8281 if !ok { 8282 return fmt.Errorf("expected ArnType to be of type string, got %T instead", value) 8283 } 8284 sv.KeyArn = ptr.String(jtv) 8285 } 8286 8287 case "KeyId": 8288 if value != nil { 8289 jtv, ok := value.(string) 8290 if !ok { 8291 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 8292 } 8293 sv.KeyId = ptr.String(jtv) 8294 } 8295 8296 default: 8297 _, _ = key, value 8298 8299 } 8300 } 8301 *v = sv 8302 return nil 8303} 8304 8305func awsAwsjson11_deserializeDocumentKeyMetadata(v **types.KeyMetadata, value interface{}) error { 8306 if v == nil { 8307 return fmt.Errorf("unexpected nil of type %T", v) 8308 } 8309 if value == nil { 8310 return nil 8311 } 8312 8313 shape, ok := value.(map[string]interface{}) 8314 if !ok { 8315 return fmt.Errorf("unexpected JSON type %v", value) 8316 } 8317 8318 var sv *types.KeyMetadata 8319 if *v == nil { 8320 sv = &types.KeyMetadata{} 8321 } else { 8322 sv = *v 8323 } 8324 8325 for key, value := range shape { 8326 switch key { 8327 case "Arn": 8328 if value != nil { 8329 jtv, ok := value.(string) 8330 if !ok { 8331 return fmt.Errorf("expected ArnType to be of type string, got %T instead", value) 8332 } 8333 sv.Arn = ptr.String(jtv) 8334 } 8335 8336 case "AWSAccountId": 8337 if value != nil { 8338 jtv, ok := value.(string) 8339 if !ok { 8340 return fmt.Errorf("expected AWSAccountIdType to be of type string, got %T instead", value) 8341 } 8342 sv.AWSAccountId = ptr.String(jtv) 8343 } 8344 8345 case "CloudHsmClusterId": 8346 if value != nil { 8347 jtv, ok := value.(string) 8348 if !ok { 8349 return fmt.Errorf("expected CloudHsmClusterIdType to be of type string, got %T instead", value) 8350 } 8351 sv.CloudHsmClusterId = ptr.String(jtv) 8352 } 8353 8354 case "CreationDate": 8355 if value != nil { 8356 jtv, ok := value.(json.Number) 8357 if !ok { 8358 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 8359 } 8360 f64, err := jtv.Float64() 8361 if err != nil { 8362 return err 8363 } 8364 sv.CreationDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8365 } 8366 8367 case "CustomerMasterKeySpec": 8368 if value != nil { 8369 jtv, ok := value.(string) 8370 if !ok { 8371 return fmt.Errorf("expected CustomerMasterKeySpec to be of type string, got %T instead", value) 8372 } 8373 sv.CustomerMasterKeySpec = types.CustomerMasterKeySpec(jtv) 8374 } 8375 8376 case "CustomKeyStoreId": 8377 if value != nil { 8378 jtv, ok := value.(string) 8379 if !ok { 8380 return fmt.Errorf("expected CustomKeyStoreIdType to be of type string, got %T instead", value) 8381 } 8382 sv.CustomKeyStoreId = ptr.String(jtv) 8383 } 8384 8385 case "DeletionDate": 8386 if value != nil { 8387 jtv, ok := value.(json.Number) 8388 if !ok { 8389 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 8390 } 8391 f64, err := jtv.Float64() 8392 if err != nil { 8393 return err 8394 } 8395 sv.DeletionDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8396 } 8397 8398 case "Description": 8399 if value != nil { 8400 jtv, ok := value.(string) 8401 if !ok { 8402 return fmt.Errorf("expected DescriptionType to be of type string, got %T instead", value) 8403 } 8404 sv.Description = ptr.String(jtv) 8405 } 8406 8407 case "Enabled": 8408 if value != nil { 8409 jtv, ok := value.(bool) 8410 if !ok { 8411 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 8412 } 8413 sv.Enabled = jtv 8414 } 8415 8416 case "EncryptionAlgorithms": 8417 if err := awsAwsjson11_deserializeDocumentEncryptionAlgorithmSpecList(&sv.EncryptionAlgorithms, value); err != nil { 8418 return err 8419 } 8420 8421 case "ExpirationModel": 8422 if value != nil { 8423 jtv, ok := value.(string) 8424 if !ok { 8425 return fmt.Errorf("expected ExpirationModelType to be of type string, got %T instead", value) 8426 } 8427 sv.ExpirationModel = types.ExpirationModelType(jtv) 8428 } 8429 8430 case "KeyId": 8431 if value != nil { 8432 jtv, ok := value.(string) 8433 if !ok { 8434 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 8435 } 8436 sv.KeyId = ptr.String(jtv) 8437 } 8438 8439 case "KeyManager": 8440 if value != nil { 8441 jtv, ok := value.(string) 8442 if !ok { 8443 return fmt.Errorf("expected KeyManagerType to be of type string, got %T instead", value) 8444 } 8445 sv.KeyManager = types.KeyManagerType(jtv) 8446 } 8447 8448 case "KeyState": 8449 if value != nil { 8450 jtv, ok := value.(string) 8451 if !ok { 8452 return fmt.Errorf("expected KeyState to be of type string, got %T instead", value) 8453 } 8454 sv.KeyState = types.KeyState(jtv) 8455 } 8456 8457 case "KeyUsage": 8458 if value != nil { 8459 jtv, ok := value.(string) 8460 if !ok { 8461 return fmt.Errorf("expected KeyUsageType to be of type string, got %T instead", value) 8462 } 8463 sv.KeyUsage = types.KeyUsageType(jtv) 8464 } 8465 8466 case "Origin": 8467 if value != nil { 8468 jtv, ok := value.(string) 8469 if !ok { 8470 return fmt.Errorf("expected OriginType to be of type string, got %T instead", value) 8471 } 8472 sv.Origin = types.OriginType(jtv) 8473 } 8474 8475 case "SigningAlgorithms": 8476 if err := awsAwsjson11_deserializeDocumentSigningAlgorithmSpecList(&sv.SigningAlgorithms, value); err != nil { 8477 return err 8478 } 8479 8480 case "ValidTo": 8481 if value != nil { 8482 jtv, ok := value.(json.Number) 8483 if !ok { 8484 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 8485 } 8486 f64, err := jtv.Float64() 8487 if err != nil { 8488 return err 8489 } 8490 sv.ValidTo = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8491 } 8492 8493 default: 8494 _, _ = key, value 8495 8496 } 8497 } 8498 *v = sv 8499 return nil 8500} 8501 8502func awsAwsjson11_deserializeDocumentKeyUnavailableException(v **types.KeyUnavailableException, value interface{}) error { 8503 if v == nil { 8504 return fmt.Errorf("unexpected nil of type %T", v) 8505 } 8506 if value == nil { 8507 return nil 8508 } 8509 8510 shape, ok := value.(map[string]interface{}) 8511 if !ok { 8512 return fmt.Errorf("unexpected JSON type %v", value) 8513 } 8514 8515 var sv *types.KeyUnavailableException 8516 if *v == nil { 8517 sv = &types.KeyUnavailableException{} 8518 } else { 8519 sv = *v 8520 } 8521 8522 for key, value := range shape { 8523 switch key { 8524 case "message": 8525 if value != nil { 8526 jtv, ok := value.(string) 8527 if !ok { 8528 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8529 } 8530 sv.Message = ptr.String(jtv) 8531 } 8532 8533 default: 8534 _, _ = key, value 8535 8536 } 8537 } 8538 *v = sv 8539 return nil 8540} 8541 8542func awsAwsjson11_deserializeDocumentKMSInternalException(v **types.KMSInternalException, value interface{}) error { 8543 if v == nil { 8544 return fmt.Errorf("unexpected nil of type %T", v) 8545 } 8546 if value == nil { 8547 return nil 8548 } 8549 8550 shape, ok := value.(map[string]interface{}) 8551 if !ok { 8552 return fmt.Errorf("unexpected JSON type %v", value) 8553 } 8554 8555 var sv *types.KMSInternalException 8556 if *v == nil { 8557 sv = &types.KMSInternalException{} 8558 } else { 8559 sv = *v 8560 } 8561 8562 for key, value := range shape { 8563 switch key { 8564 case "message": 8565 if value != nil { 8566 jtv, ok := value.(string) 8567 if !ok { 8568 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8569 } 8570 sv.Message = ptr.String(jtv) 8571 } 8572 8573 default: 8574 _, _ = key, value 8575 8576 } 8577 } 8578 *v = sv 8579 return nil 8580} 8581 8582func awsAwsjson11_deserializeDocumentKMSInvalidSignatureException(v **types.KMSInvalidSignatureException, value interface{}) error { 8583 if v == nil { 8584 return fmt.Errorf("unexpected nil of type %T", v) 8585 } 8586 if value == nil { 8587 return nil 8588 } 8589 8590 shape, ok := value.(map[string]interface{}) 8591 if !ok { 8592 return fmt.Errorf("unexpected JSON type %v", value) 8593 } 8594 8595 var sv *types.KMSInvalidSignatureException 8596 if *v == nil { 8597 sv = &types.KMSInvalidSignatureException{} 8598 } else { 8599 sv = *v 8600 } 8601 8602 for key, value := range shape { 8603 switch key { 8604 case "message": 8605 if value != nil { 8606 jtv, ok := value.(string) 8607 if !ok { 8608 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8609 } 8610 sv.Message = ptr.String(jtv) 8611 } 8612 8613 default: 8614 _, _ = key, value 8615 8616 } 8617 } 8618 *v = sv 8619 return nil 8620} 8621 8622func awsAwsjson11_deserializeDocumentKMSInvalidStateException(v **types.KMSInvalidStateException, value interface{}) error { 8623 if v == nil { 8624 return fmt.Errorf("unexpected nil of type %T", v) 8625 } 8626 if value == nil { 8627 return nil 8628 } 8629 8630 shape, ok := value.(map[string]interface{}) 8631 if !ok { 8632 return fmt.Errorf("unexpected JSON type %v", value) 8633 } 8634 8635 var sv *types.KMSInvalidStateException 8636 if *v == nil { 8637 sv = &types.KMSInvalidStateException{} 8638 } else { 8639 sv = *v 8640 } 8641 8642 for key, value := range shape { 8643 switch key { 8644 case "message": 8645 if value != nil { 8646 jtv, ok := value.(string) 8647 if !ok { 8648 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8649 } 8650 sv.Message = ptr.String(jtv) 8651 } 8652 8653 default: 8654 _, _ = key, value 8655 8656 } 8657 } 8658 *v = sv 8659 return nil 8660} 8661 8662func awsAwsjson11_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 8663 if v == nil { 8664 return fmt.Errorf("unexpected nil of type %T", v) 8665 } 8666 if value == nil { 8667 return nil 8668 } 8669 8670 shape, ok := value.(map[string]interface{}) 8671 if !ok { 8672 return fmt.Errorf("unexpected JSON type %v", value) 8673 } 8674 8675 var sv *types.LimitExceededException 8676 if *v == nil { 8677 sv = &types.LimitExceededException{} 8678 } else { 8679 sv = *v 8680 } 8681 8682 for key, value := range shape { 8683 switch key { 8684 case "message": 8685 if value != nil { 8686 jtv, ok := value.(string) 8687 if !ok { 8688 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8689 } 8690 sv.Message = ptr.String(jtv) 8691 } 8692 8693 default: 8694 _, _ = key, value 8695 8696 } 8697 } 8698 *v = sv 8699 return nil 8700} 8701 8702func awsAwsjson11_deserializeDocumentMalformedPolicyDocumentException(v **types.MalformedPolicyDocumentException, value interface{}) error { 8703 if v == nil { 8704 return fmt.Errorf("unexpected nil of type %T", v) 8705 } 8706 if value == nil { 8707 return nil 8708 } 8709 8710 shape, ok := value.(map[string]interface{}) 8711 if !ok { 8712 return fmt.Errorf("unexpected JSON type %v", value) 8713 } 8714 8715 var sv *types.MalformedPolicyDocumentException 8716 if *v == nil { 8717 sv = &types.MalformedPolicyDocumentException{} 8718 } else { 8719 sv = *v 8720 } 8721 8722 for key, value := range shape { 8723 switch key { 8724 case "message": 8725 if value != nil { 8726 jtv, ok := value.(string) 8727 if !ok { 8728 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8729 } 8730 sv.Message = ptr.String(jtv) 8731 } 8732 8733 default: 8734 _, _ = key, value 8735 8736 } 8737 } 8738 *v = sv 8739 return nil 8740} 8741 8742func awsAwsjson11_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 8743 if v == nil { 8744 return fmt.Errorf("unexpected nil of type %T", v) 8745 } 8746 if value == nil { 8747 return nil 8748 } 8749 8750 shape, ok := value.(map[string]interface{}) 8751 if !ok { 8752 return fmt.Errorf("unexpected JSON type %v", value) 8753 } 8754 8755 var sv *types.NotFoundException 8756 if *v == nil { 8757 sv = &types.NotFoundException{} 8758 } else { 8759 sv = *v 8760 } 8761 8762 for key, value := range shape { 8763 switch key { 8764 case "message": 8765 if value != nil { 8766 jtv, ok := value.(string) 8767 if !ok { 8768 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8769 } 8770 sv.Message = ptr.String(jtv) 8771 } 8772 8773 default: 8774 _, _ = key, value 8775 8776 } 8777 } 8778 *v = sv 8779 return nil 8780} 8781 8782func awsAwsjson11_deserializeDocumentPolicyNameList(v *[]string, value interface{}) error { 8783 if v == nil { 8784 return fmt.Errorf("unexpected nil of type %T", v) 8785 } 8786 if value == nil { 8787 return nil 8788 } 8789 8790 shape, ok := value.([]interface{}) 8791 if !ok { 8792 return fmt.Errorf("unexpected JSON type %v", value) 8793 } 8794 8795 var cv []string 8796 if *v == nil { 8797 cv = []string{} 8798 } else { 8799 cv = *v 8800 } 8801 8802 for _, value := range shape { 8803 var col string 8804 if value != nil { 8805 jtv, ok := value.(string) 8806 if !ok { 8807 return fmt.Errorf("expected PolicyNameType to be of type string, got %T instead", value) 8808 } 8809 col = jtv 8810 } 8811 cv = append(cv, col) 8812 8813 } 8814 *v = cv 8815 return nil 8816} 8817 8818func awsAwsjson11_deserializeDocumentSigningAlgorithmSpecList(v *[]types.SigningAlgorithmSpec, value interface{}) error { 8819 if v == nil { 8820 return fmt.Errorf("unexpected nil of type %T", v) 8821 } 8822 if value == nil { 8823 return nil 8824 } 8825 8826 shape, ok := value.([]interface{}) 8827 if !ok { 8828 return fmt.Errorf("unexpected JSON type %v", value) 8829 } 8830 8831 var cv []types.SigningAlgorithmSpec 8832 if *v == nil { 8833 cv = []types.SigningAlgorithmSpec{} 8834 } else { 8835 cv = *v 8836 } 8837 8838 for _, value := range shape { 8839 var col types.SigningAlgorithmSpec 8840 if value != nil { 8841 jtv, ok := value.(string) 8842 if !ok { 8843 return fmt.Errorf("expected SigningAlgorithmSpec to be of type string, got %T instead", value) 8844 } 8845 col = types.SigningAlgorithmSpec(jtv) 8846 } 8847 cv = append(cv, col) 8848 8849 } 8850 *v = cv 8851 return nil 8852} 8853 8854func awsAwsjson11_deserializeDocumentTag(v **types.Tag, value interface{}) error { 8855 if v == nil { 8856 return fmt.Errorf("unexpected nil of type %T", v) 8857 } 8858 if value == nil { 8859 return nil 8860 } 8861 8862 shape, ok := value.(map[string]interface{}) 8863 if !ok { 8864 return fmt.Errorf("unexpected JSON type %v", value) 8865 } 8866 8867 var sv *types.Tag 8868 if *v == nil { 8869 sv = &types.Tag{} 8870 } else { 8871 sv = *v 8872 } 8873 8874 for key, value := range shape { 8875 switch key { 8876 case "TagKey": 8877 if value != nil { 8878 jtv, ok := value.(string) 8879 if !ok { 8880 return fmt.Errorf("expected TagKeyType to be of type string, got %T instead", value) 8881 } 8882 sv.TagKey = ptr.String(jtv) 8883 } 8884 8885 case "TagValue": 8886 if value != nil { 8887 jtv, ok := value.(string) 8888 if !ok { 8889 return fmt.Errorf("expected TagValueType to be of type string, got %T instead", value) 8890 } 8891 sv.TagValue = ptr.String(jtv) 8892 } 8893 8894 default: 8895 _, _ = key, value 8896 8897 } 8898 } 8899 *v = sv 8900 return nil 8901} 8902 8903func awsAwsjson11_deserializeDocumentTagException(v **types.TagException, value interface{}) error { 8904 if v == nil { 8905 return fmt.Errorf("unexpected nil of type %T", v) 8906 } 8907 if value == nil { 8908 return nil 8909 } 8910 8911 shape, ok := value.(map[string]interface{}) 8912 if !ok { 8913 return fmt.Errorf("unexpected JSON type %v", value) 8914 } 8915 8916 var sv *types.TagException 8917 if *v == nil { 8918 sv = &types.TagException{} 8919 } else { 8920 sv = *v 8921 } 8922 8923 for key, value := range shape { 8924 switch key { 8925 case "message": 8926 if value != nil { 8927 jtv, ok := value.(string) 8928 if !ok { 8929 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 8930 } 8931 sv.Message = ptr.String(jtv) 8932 } 8933 8934 default: 8935 _, _ = key, value 8936 8937 } 8938 } 8939 *v = sv 8940 return nil 8941} 8942 8943func awsAwsjson11_deserializeDocumentTagList(v *[]types.Tag, value interface{}) error { 8944 if v == nil { 8945 return fmt.Errorf("unexpected nil of type %T", v) 8946 } 8947 if value == nil { 8948 return nil 8949 } 8950 8951 shape, ok := value.([]interface{}) 8952 if !ok { 8953 return fmt.Errorf("unexpected JSON type %v", value) 8954 } 8955 8956 var cv []types.Tag 8957 if *v == nil { 8958 cv = []types.Tag{} 8959 } else { 8960 cv = *v 8961 } 8962 8963 for _, value := range shape { 8964 var col types.Tag 8965 destAddr := &col 8966 if err := awsAwsjson11_deserializeDocumentTag(&destAddr, value); err != nil { 8967 return err 8968 } 8969 col = *destAddr 8970 cv = append(cv, col) 8971 8972 } 8973 *v = cv 8974 return nil 8975} 8976 8977func awsAwsjson11_deserializeDocumentUnsupportedOperationException(v **types.UnsupportedOperationException, value interface{}) error { 8978 if v == nil { 8979 return fmt.Errorf("unexpected nil of type %T", v) 8980 } 8981 if value == nil { 8982 return nil 8983 } 8984 8985 shape, ok := value.(map[string]interface{}) 8986 if !ok { 8987 return fmt.Errorf("unexpected JSON type %v", value) 8988 } 8989 8990 var sv *types.UnsupportedOperationException 8991 if *v == nil { 8992 sv = &types.UnsupportedOperationException{} 8993 } else { 8994 sv = *v 8995 } 8996 8997 for key, value := range shape { 8998 switch key { 8999 case "message": 9000 if value != nil { 9001 jtv, ok := value.(string) 9002 if !ok { 9003 return fmt.Errorf("expected ErrorMessageType to be of type string, got %T instead", value) 9004 } 9005 sv.Message = ptr.String(jtv) 9006 } 9007 9008 default: 9009 _, _ = key, value 9010 9011 } 9012 } 9013 *v = sv 9014 return nil 9015} 9016 9017func awsAwsjson11_deserializeOpDocumentCancelKeyDeletionOutput(v **CancelKeyDeletionOutput, value interface{}) error { 9018 if v == nil { 9019 return fmt.Errorf("unexpected nil of type %T", v) 9020 } 9021 if value == nil { 9022 return nil 9023 } 9024 9025 shape, ok := value.(map[string]interface{}) 9026 if !ok { 9027 return fmt.Errorf("unexpected JSON type %v", value) 9028 } 9029 9030 var sv *CancelKeyDeletionOutput 9031 if *v == nil { 9032 sv = &CancelKeyDeletionOutput{} 9033 } else { 9034 sv = *v 9035 } 9036 9037 for key, value := range shape { 9038 switch key { 9039 case "KeyId": 9040 if value != nil { 9041 jtv, ok := value.(string) 9042 if !ok { 9043 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9044 } 9045 sv.KeyId = ptr.String(jtv) 9046 } 9047 9048 default: 9049 _, _ = key, value 9050 9051 } 9052 } 9053 *v = sv 9054 return nil 9055} 9056 9057func awsAwsjson11_deserializeOpDocumentConnectCustomKeyStoreOutput(v **ConnectCustomKeyStoreOutput, value interface{}) error { 9058 if v == nil { 9059 return fmt.Errorf("unexpected nil of type %T", v) 9060 } 9061 if value == nil { 9062 return nil 9063 } 9064 9065 shape, ok := value.(map[string]interface{}) 9066 if !ok { 9067 return fmt.Errorf("unexpected JSON type %v", value) 9068 } 9069 9070 var sv *ConnectCustomKeyStoreOutput 9071 if *v == nil { 9072 sv = &ConnectCustomKeyStoreOutput{} 9073 } else { 9074 sv = *v 9075 } 9076 9077 for key, value := range shape { 9078 switch key { 9079 default: 9080 _, _ = key, value 9081 9082 } 9083 } 9084 *v = sv 9085 return nil 9086} 9087 9088func awsAwsjson11_deserializeOpDocumentCreateCustomKeyStoreOutput(v **CreateCustomKeyStoreOutput, value interface{}) error { 9089 if v == nil { 9090 return fmt.Errorf("unexpected nil of type %T", v) 9091 } 9092 if value == nil { 9093 return nil 9094 } 9095 9096 shape, ok := value.(map[string]interface{}) 9097 if !ok { 9098 return fmt.Errorf("unexpected JSON type %v", value) 9099 } 9100 9101 var sv *CreateCustomKeyStoreOutput 9102 if *v == nil { 9103 sv = &CreateCustomKeyStoreOutput{} 9104 } else { 9105 sv = *v 9106 } 9107 9108 for key, value := range shape { 9109 switch key { 9110 case "CustomKeyStoreId": 9111 if value != nil { 9112 jtv, ok := value.(string) 9113 if !ok { 9114 return fmt.Errorf("expected CustomKeyStoreIdType to be of type string, got %T instead", value) 9115 } 9116 sv.CustomKeyStoreId = ptr.String(jtv) 9117 } 9118 9119 default: 9120 _, _ = key, value 9121 9122 } 9123 } 9124 *v = sv 9125 return nil 9126} 9127 9128func awsAwsjson11_deserializeOpDocumentCreateGrantOutput(v **CreateGrantOutput, value interface{}) error { 9129 if v == nil { 9130 return fmt.Errorf("unexpected nil of type %T", v) 9131 } 9132 if value == nil { 9133 return nil 9134 } 9135 9136 shape, ok := value.(map[string]interface{}) 9137 if !ok { 9138 return fmt.Errorf("unexpected JSON type %v", value) 9139 } 9140 9141 var sv *CreateGrantOutput 9142 if *v == nil { 9143 sv = &CreateGrantOutput{} 9144 } else { 9145 sv = *v 9146 } 9147 9148 for key, value := range shape { 9149 switch key { 9150 case "GrantId": 9151 if value != nil { 9152 jtv, ok := value.(string) 9153 if !ok { 9154 return fmt.Errorf("expected GrantIdType to be of type string, got %T instead", value) 9155 } 9156 sv.GrantId = ptr.String(jtv) 9157 } 9158 9159 case "GrantToken": 9160 if value != nil { 9161 jtv, ok := value.(string) 9162 if !ok { 9163 return fmt.Errorf("expected GrantTokenType to be of type string, got %T instead", value) 9164 } 9165 sv.GrantToken = ptr.String(jtv) 9166 } 9167 9168 default: 9169 _, _ = key, value 9170 9171 } 9172 } 9173 *v = sv 9174 return nil 9175} 9176 9177func awsAwsjson11_deserializeOpDocumentCreateKeyOutput(v **CreateKeyOutput, 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 *CreateKeyOutput 9191 if *v == nil { 9192 sv = &CreateKeyOutput{} 9193 } else { 9194 sv = *v 9195 } 9196 9197 for key, value := range shape { 9198 switch key { 9199 case "KeyMetadata": 9200 if err := awsAwsjson11_deserializeDocumentKeyMetadata(&sv.KeyMetadata, value); err != nil { 9201 return err 9202 } 9203 9204 default: 9205 _, _ = key, value 9206 9207 } 9208 } 9209 *v = sv 9210 return nil 9211} 9212 9213func awsAwsjson11_deserializeOpDocumentDecryptOutput(v **DecryptOutput, value interface{}) error { 9214 if v == nil { 9215 return fmt.Errorf("unexpected nil of type %T", v) 9216 } 9217 if value == nil { 9218 return nil 9219 } 9220 9221 shape, ok := value.(map[string]interface{}) 9222 if !ok { 9223 return fmt.Errorf("unexpected JSON type %v", value) 9224 } 9225 9226 var sv *DecryptOutput 9227 if *v == nil { 9228 sv = &DecryptOutput{} 9229 } else { 9230 sv = *v 9231 } 9232 9233 for key, value := range shape { 9234 switch key { 9235 case "EncryptionAlgorithm": 9236 if value != nil { 9237 jtv, ok := value.(string) 9238 if !ok { 9239 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 9240 } 9241 sv.EncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 9242 } 9243 9244 case "KeyId": 9245 if value != nil { 9246 jtv, ok := value.(string) 9247 if !ok { 9248 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9249 } 9250 sv.KeyId = ptr.String(jtv) 9251 } 9252 9253 case "Plaintext": 9254 if value != nil { 9255 jtv, ok := value.(string) 9256 if !ok { 9257 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 9258 } 9259 dv, err := base64.StdEncoding.DecodeString(jtv) 9260 if err != nil { 9261 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 9262 } 9263 sv.Plaintext = dv 9264 } 9265 9266 default: 9267 _, _ = key, value 9268 9269 } 9270 } 9271 *v = sv 9272 return nil 9273} 9274 9275func awsAwsjson11_deserializeOpDocumentDeleteCustomKeyStoreOutput(v **DeleteCustomKeyStoreOutput, value interface{}) error { 9276 if v == nil { 9277 return fmt.Errorf("unexpected nil of type %T", v) 9278 } 9279 if value == nil { 9280 return nil 9281 } 9282 9283 shape, ok := value.(map[string]interface{}) 9284 if !ok { 9285 return fmt.Errorf("unexpected JSON type %v", value) 9286 } 9287 9288 var sv *DeleteCustomKeyStoreOutput 9289 if *v == nil { 9290 sv = &DeleteCustomKeyStoreOutput{} 9291 } else { 9292 sv = *v 9293 } 9294 9295 for key, value := range shape { 9296 switch key { 9297 default: 9298 _, _ = key, value 9299 9300 } 9301 } 9302 *v = sv 9303 return nil 9304} 9305 9306func awsAwsjson11_deserializeOpDocumentDescribeCustomKeyStoresOutput(v **DescribeCustomKeyStoresOutput, value interface{}) error { 9307 if v == nil { 9308 return fmt.Errorf("unexpected nil of type %T", v) 9309 } 9310 if value == nil { 9311 return nil 9312 } 9313 9314 shape, ok := value.(map[string]interface{}) 9315 if !ok { 9316 return fmt.Errorf("unexpected JSON type %v", value) 9317 } 9318 9319 var sv *DescribeCustomKeyStoresOutput 9320 if *v == nil { 9321 sv = &DescribeCustomKeyStoresOutput{} 9322 } else { 9323 sv = *v 9324 } 9325 9326 for key, value := range shape { 9327 switch key { 9328 case "CustomKeyStores": 9329 if err := awsAwsjson11_deserializeDocumentCustomKeyStoresList(&sv.CustomKeyStores, value); err != nil { 9330 return err 9331 } 9332 9333 case "NextMarker": 9334 if value != nil { 9335 jtv, ok := value.(string) 9336 if !ok { 9337 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 9338 } 9339 sv.NextMarker = ptr.String(jtv) 9340 } 9341 9342 case "Truncated": 9343 if value != nil { 9344 jtv, ok := value.(bool) 9345 if !ok { 9346 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 9347 } 9348 sv.Truncated = jtv 9349 } 9350 9351 default: 9352 _, _ = key, value 9353 9354 } 9355 } 9356 *v = sv 9357 return nil 9358} 9359 9360func awsAwsjson11_deserializeOpDocumentDescribeKeyOutput(v **DescribeKeyOutput, value interface{}) error { 9361 if v == nil { 9362 return fmt.Errorf("unexpected nil of type %T", v) 9363 } 9364 if value == nil { 9365 return nil 9366 } 9367 9368 shape, ok := value.(map[string]interface{}) 9369 if !ok { 9370 return fmt.Errorf("unexpected JSON type %v", value) 9371 } 9372 9373 var sv *DescribeKeyOutput 9374 if *v == nil { 9375 sv = &DescribeKeyOutput{} 9376 } else { 9377 sv = *v 9378 } 9379 9380 for key, value := range shape { 9381 switch key { 9382 case "KeyMetadata": 9383 if err := awsAwsjson11_deserializeDocumentKeyMetadata(&sv.KeyMetadata, value); err != nil { 9384 return err 9385 } 9386 9387 default: 9388 _, _ = key, value 9389 9390 } 9391 } 9392 *v = sv 9393 return nil 9394} 9395 9396func awsAwsjson11_deserializeOpDocumentDisconnectCustomKeyStoreOutput(v **DisconnectCustomKeyStoreOutput, value interface{}) error { 9397 if v == nil { 9398 return fmt.Errorf("unexpected nil of type %T", v) 9399 } 9400 if value == nil { 9401 return nil 9402 } 9403 9404 shape, ok := value.(map[string]interface{}) 9405 if !ok { 9406 return fmt.Errorf("unexpected JSON type %v", value) 9407 } 9408 9409 var sv *DisconnectCustomKeyStoreOutput 9410 if *v == nil { 9411 sv = &DisconnectCustomKeyStoreOutput{} 9412 } else { 9413 sv = *v 9414 } 9415 9416 for key, value := range shape { 9417 switch key { 9418 default: 9419 _, _ = key, value 9420 9421 } 9422 } 9423 *v = sv 9424 return nil 9425} 9426 9427func awsAwsjson11_deserializeOpDocumentEncryptOutput(v **EncryptOutput, value interface{}) error { 9428 if v == nil { 9429 return fmt.Errorf("unexpected nil of type %T", v) 9430 } 9431 if value == nil { 9432 return nil 9433 } 9434 9435 shape, ok := value.(map[string]interface{}) 9436 if !ok { 9437 return fmt.Errorf("unexpected JSON type %v", value) 9438 } 9439 9440 var sv *EncryptOutput 9441 if *v == nil { 9442 sv = &EncryptOutput{} 9443 } else { 9444 sv = *v 9445 } 9446 9447 for key, value := range shape { 9448 switch key { 9449 case "CiphertextBlob": 9450 if value != nil { 9451 jtv, ok := value.(string) 9452 if !ok { 9453 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9454 } 9455 dv, err := base64.StdEncoding.DecodeString(jtv) 9456 if err != nil { 9457 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9458 } 9459 sv.CiphertextBlob = dv 9460 } 9461 9462 case "EncryptionAlgorithm": 9463 if value != nil { 9464 jtv, ok := value.(string) 9465 if !ok { 9466 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 9467 } 9468 sv.EncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 9469 } 9470 9471 case "KeyId": 9472 if value != nil { 9473 jtv, ok := value.(string) 9474 if !ok { 9475 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9476 } 9477 sv.KeyId = ptr.String(jtv) 9478 } 9479 9480 default: 9481 _, _ = key, value 9482 9483 } 9484 } 9485 *v = sv 9486 return nil 9487} 9488 9489func awsAwsjson11_deserializeOpDocumentGenerateDataKeyOutput(v **GenerateDataKeyOutput, value interface{}) error { 9490 if v == nil { 9491 return fmt.Errorf("unexpected nil of type %T", v) 9492 } 9493 if value == nil { 9494 return nil 9495 } 9496 9497 shape, ok := value.(map[string]interface{}) 9498 if !ok { 9499 return fmt.Errorf("unexpected JSON type %v", value) 9500 } 9501 9502 var sv *GenerateDataKeyOutput 9503 if *v == nil { 9504 sv = &GenerateDataKeyOutput{} 9505 } else { 9506 sv = *v 9507 } 9508 9509 for key, value := range shape { 9510 switch key { 9511 case "CiphertextBlob": 9512 if value != nil { 9513 jtv, ok := value.(string) 9514 if !ok { 9515 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9516 } 9517 dv, err := base64.StdEncoding.DecodeString(jtv) 9518 if err != nil { 9519 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9520 } 9521 sv.CiphertextBlob = dv 9522 } 9523 9524 case "KeyId": 9525 if value != nil { 9526 jtv, ok := value.(string) 9527 if !ok { 9528 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9529 } 9530 sv.KeyId = ptr.String(jtv) 9531 } 9532 9533 case "Plaintext": 9534 if value != nil { 9535 jtv, ok := value.(string) 9536 if !ok { 9537 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 9538 } 9539 dv, err := base64.StdEncoding.DecodeString(jtv) 9540 if err != nil { 9541 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 9542 } 9543 sv.Plaintext = dv 9544 } 9545 9546 default: 9547 _, _ = key, value 9548 9549 } 9550 } 9551 *v = sv 9552 return nil 9553} 9554 9555func awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairOutput(v **GenerateDataKeyPairOutput, value interface{}) error { 9556 if v == nil { 9557 return fmt.Errorf("unexpected nil of type %T", v) 9558 } 9559 if value == nil { 9560 return nil 9561 } 9562 9563 shape, ok := value.(map[string]interface{}) 9564 if !ok { 9565 return fmt.Errorf("unexpected JSON type %v", value) 9566 } 9567 9568 var sv *GenerateDataKeyPairOutput 9569 if *v == nil { 9570 sv = &GenerateDataKeyPairOutput{} 9571 } else { 9572 sv = *v 9573 } 9574 9575 for key, value := range shape { 9576 switch key { 9577 case "KeyId": 9578 if value != nil { 9579 jtv, ok := value.(string) 9580 if !ok { 9581 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9582 } 9583 sv.KeyId = ptr.String(jtv) 9584 } 9585 9586 case "KeyPairSpec": 9587 if value != nil { 9588 jtv, ok := value.(string) 9589 if !ok { 9590 return fmt.Errorf("expected DataKeyPairSpec to be of type string, got %T instead", value) 9591 } 9592 sv.KeyPairSpec = types.DataKeyPairSpec(jtv) 9593 } 9594 9595 case "PrivateKeyCiphertextBlob": 9596 if value != nil { 9597 jtv, ok := value.(string) 9598 if !ok { 9599 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9600 } 9601 dv, err := base64.StdEncoding.DecodeString(jtv) 9602 if err != nil { 9603 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9604 } 9605 sv.PrivateKeyCiphertextBlob = dv 9606 } 9607 9608 case "PrivateKeyPlaintext": 9609 if value != nil { 9610 jtv, ok := value.(string) 9611 if !ok { 9612 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 9613 } 9614 dv, err := base64.StdEncoding.DecodeString(jtv) 9615 if err != nil { 9616 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 9617 } 9618 sv.PrivateKeyPlaintext = dv 9619 } 9620 9621 case "PublicKey": 9622 if value != nil { 9623 jtv, ok := value.(string) 9624 if !ok { 9625 return fmt.Errorf("expected PublicKeyType to be []byte, got %T instead", value) 9626 } 9627 dv, err := base64.StdEncoding.DecodeString(jtv) 9628 if err != nil { 9629 return fmt.Errorf("failed to base64 decode PublicKeyType, %w", err) 9630 } 9631 sv.PublicKey = dv 9632 } 9633 9634 default: 9635 _, _ = key, value 9636 9637 } 9638 } 9639 *v = sv 9640 return nil 9641} 9642 9643func awsAwsjson11_deserializeOpDocumentGenerateDataKeyPairWithoutPlaintextOutput(v **GenerateDataKeyPairWithoutPlaintextOutput, value interface{}) error { 9644 if v == nil { 9645 return fmt.Errorf("unexpected nil of type %T", v) 9646 } 9647 if value == nil { 9648 return nil 9649 } 9650 9651 shape, ok := value.(map[string]interface{}) 9652 if !ok { 9653 return fmt.Errorf("unexpected JSON type %v", value) 9654 } 9655 9656 var sv *GenerateDataKeyPairWithoutPlaintextOutput 9657 if *v == nil { 9658 sv = &GenerateDataKeyPairWithoutPlaintextOutput{} 9659 } else { 9660 sv = *v 9661 } 9662 9663 for key, value := range shape { 9664 switch key { 9665 case "KeyId": 9666 if value != nil { 9667 jtv, ok := value.(string) 9668 if !ok { 9669 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9670 } 9671 sv.KeyId = ptr.String(jtv) 9672 } 9673 9674 case "KeyPairSpec": 9675 if value != nil { 9676 jtv, ok := value.(string) 9677 if !ok { 9678 return fmt.Errorf("expected DataKeyPairSpec to be of type string, got %T instead", value) 9679 } 9680 sv.KeyPairSpec = types.DataKeyPairSpec(jtv) 9681 } 9682 9683 case "PrivateKeyCiphertextBlob": 9684 if value != nil { 9685 jtv, ok := value.(string) 9686 if !ok { 9687 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9688 } 9689 dv, err := base64.StdEncoding.DecodeString(jtv) 9690 if err != nil { 9691 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9692 } 9693 sv.PrivateKeyCiphertextBlob = dv 9694 } 9695 9696 case "PublicKey": 9697 if value != nil { 9698 jtv, ok := value.(string) 9699 if !ok { 9700 return fmt.Errorf("expected PublicKeyType to be []byte, got %T instead", value) 9701 } 9702 dv, err := base64.StdEncoding.DecodeString(jtv) 9703 if err != nil { 9704 return fmt.Errorf("failed to base64 decode PublicKeyType, %w", err) 9705 } 9706 sv.PublicKey = dv 9707 } 9708 9709 default: 9710 _, _ = key, value 9711 9712 } 9713 } 9714 *v = sv 9715 return nil 9716} 9717 9718func awsAwsjson11_deserializeOpDocumentGenerateDataKeyWithoutPlaintextOutput(v **GenerateDataKeyWithoutPlaintextOutput, value interface{}) error { 9719 if v == nil { 9720 return fmt.Errorf("unexpected nil of type %T", v) 9721 } 9722 if value == nil { 9723 return nil 9724 } 9725 9726 shape, ok := value.(map[string]interface{}) 9727 if !ok { 9728 return fmt.Errorf("unexpected JSON type %v", value) 9729 } 9730 9731 var sv *GenerateDataKeyWithoutPlaintextOutput 9732 if *v == nil { 9733 sv = &GenerateDataKeyWithoutPlaintextOutput{} 9734 } else { 9735 sv = *v 9736 } 9737 9738 for key, value := range shape { 9739 switch key { 9740 case "CiphertextBlob": 9741 if value != nil { 9742 jtv, ok := value.(string) 9743 if !ok { 9744 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9745 } 9746 dv, err := base64.StdEncoding.DecodeString(jtv) 9747 if err != nil { 9748 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9749 } 9750 sv.CiphertextBlob = dv 9751 } 9752 9753 case "KeyId": 9754 if value != nil { 9755 jtv, ok := value.(string) 9756 if !ok { 9757 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9758 } 9759 sv.KeyId = ptr.String(jtv) 9760 } 9761 9762 default: 9763 _, _ = key, value 9764 9765 } 9766 } 9767 *v = sv 9768 return nil 9769} 9770 9771func awsAwsjson11_deserializeOpDocumentGenerateRandomOutput(v **GenerateRandomOutput, value interface{}) error { 9772 if v == nil { 9773 return fmt.Errorf("unexpected nil of type %T", v) 9774 } 9775 if value == nil { 9776 return nil 9777 } 9778 9779 shape, ok := value.(map[string]interface{}) 9780 if !ok { 9781 return fmt.Errorf("unexpected JSON type %v", value) 9782 } 9783 9784 var sv *GenerateRandomOutput 9785 if *v == nil { 9786 sv = &GenerateRandomOutput{} 9787 } else { 9788 sv = *v 9789 } 9790 9791 for key, value := range shape { 9792 switch key { 9793 case "Plaintext": 9794 if value != nil { 9795 jtv, ok := value.(string) 9796 if !ok { 9797 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 9798 } 9799 dv, err := base64.StdEncoding.DecodeString(jtv) 9800 if err != nil { 9801 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 9802 } 9803 sv.Plaintext = dv 9804 } 9805 9806 default: 9807 _, _ = key, value 9808 9809 } 9810 } 9811 *v = sv 9812 return nil 9813} 9814 9815func awsAwsjson11_deserializeOpDocumentGetKeyPolicyOutput(v **GetKeyPolicyOutput, value interface{}) error { 9816 if v == nil { 9817 return fmt.Errorf("unexpected nil of type %T", v) 9818 } 9819 if value == nil { 9820 return nil 9821 } 9822 9823 shape, ok := value.(map[string]interface{}) 9824 if !ok { 9825 return fmt.Errorf("unexpected JSON type %v", value) 9826 } 9827 9828 var sv *GetKeyPolicyOutput 9829 if *v == nil { 9830 sv = &GetKeyPolicyOutput{} 9831 } else { 9832 sv = *v 9833 } 9834 9835 for key, value := range shape { 9836 switch key { 9837 case "Policy": 9838 if value != nil { 9839 jtv, ok := value.(string) 9840 if !ok { 9841 return fmt.Errorf("expected PolicyType to be of type string, got %T instead", value) 9842 } 9843 sv.Policy = ptr.String(jtv) 9844 } 9845 9846 default: 9847 _, _ = key, value 9848 9849 } 9850 } 9851 *v = sv 9852 return nil 9853} 9854 9855func awsAwsjson11_deserializeOpDocumentGetKeyRotationStatusOutput(v **GetKeyRotationStatusOutput, value interface{}) error { 9856 if v == nil { 9857 return fmt.Errorf("unexpected nil of type %T", v) 9858 } 9859 if value == nil { 9860 return nil 9861 } 9862 9863 shape, ok := value.(map[string]interface{}) 9864 if !ok { 9865 return fmt.Errorf("unexpected JSON type %v", value) 9866 } 9867 9868 var sv *GetKeyRotationStatusOutput 9869 if *v == nil { 9870 sv = &GetKeyRotationStatusOutput{} 9871 } else { 9872 sv = *v 9873 } 9874 9875 for key, value := range shape { 9876 switch key { 9877 case "KeyRotationEnabled": 9878 if value != nil { 9879 jtv, ok := value.(bool) 9880 if !ok { 9881 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 9882 } 9883 sv.KeyRotationEnabled = jtv 9884 } 9885 9886 default: 9887 _, _ = key, value 9888 9889 } 9890 } 9891 *v = sv 9892 return nil 9893} 9894 9895func awsAwsjson11_deserializeOpDocumentGetParametersForImportOutput(v **GetParametersForImportOutput, value interface{}) error { 9896 if v == nil { 9897 return fmt.Errorf("unexpected nil of type %T", v) 9898 } 9899 if value == nil { 9900 return nil 9901 } 9902 9903 shape, ok := value.(map[string]interface{}) 9904 if !ok { 9905 return fmt.Errorf("unexpected JSON type %v", value) 9906 } 9907 9908 var sv *GetParametersForImportOutput 9909 if *v == nil { 9910 sv = &GetParametersForImportOutput{} 9911 } else { 9912 sv = *v 9913 } 9914 9915 for key, value := range shape { 9916 switch key { 9917 case "ImportToken": 9918 if value != nil { 9919 jtv, ok := value.(string) 9920 if !ok { 9921 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 9922 } 9923 dv, err := base64.StdEncoding.DecodeString(jtv) 9924 if err != nil { 9925 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 9926 } 9927 sv.ImportToken = dv 9928 } 9929 9930 case "KeyId": 9931 if value != nil { 9932 jtv, ok := value.(string) 9933 if !ok { 9934 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 9935 } 9936 sv.KeyId = ptr.String(jtv) 9937 } 9938 9939 case "ParametersValidTo": 9940 if value != nil { 9941 jtv, ok := value.(json.Number) 9942 if !ok { 9943 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 9944 } 9945 f64, err := jtv.Float64() 9946 if err != nil { 9947 return err 9948 } 9949 sv.ParametersValidTo = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9950 } 9951 9952 case "PublicKey": 9953 if value != nil { 9954 jtv, ok := value.(string) 9955 if !ok { 9956 return fmt.Errorf("expected PlaintextType to be []byte, got %T instead", value) 9957 } 9958 dv, err := base64.StdEncoding.DecodeString(jtv) 9959 if err != nil { 9960 return fmt.Errorf("failed to base64 decode PlaintextType, %w", err) 9961 } 9962 sv.PublicKey = dv 9963 } 9964 9965 default: 9966 _, _ = key, value 9967 9968 } 9969 } 9970 *v = sv 9971 return nil 9972} 9973 9974func awsAwsjson11_deserializeOpDocumentGetPublicKeyOutput(v **GetPublicKeyOutput, value interface{}) error { 9975 if v == nil { 9976 return fmt.Errorf("unexpected nil of type %T", v) 9977 } 9978 if value == nil { 9979 return nil 9980 } 9981 9982 shape, ok := value.(map[string]interface{}) 9983 if !ok { 9984 return fmt.Errorf("unexpected JSON type %v", value) 9985 } 9986 9987 var sv *GetPublicKeyOutput 9988 if *v == nil { 9989 sv = &GetPublicKeyOutput{} 9990 } else { 9991 sv = *v 9992 } 9993 9994 for key, value := range shape { 9995 switch key { 9996 case "CustomerMasterKeySpec": 9997 if value != nil { 9998 jtv, ok := value.(string) 9999 if !ok { 10000 return fmt.Errorf("expected CustomerMasterKeySpec to be of type string, got %T instead", value) 10001 } 10002 sv.CustomerMasterKeySpec = types.CustomerMasterKeySpec(jtv) 10003 } 10004 10005 case "EncryptionAlgorithms": 10006 if err := awsAwsjson11_deserializeDocumentEncryptionAlgorithmSpecList(&sv.EncryptionAlgorithms, value); err != nil { 10007 return err 10008 } 10009 10010 case "KeyId": 10011 if value != nil { 10012 jtv, ok := value.(string) 10013 if !ok { 10014 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10015 } 10016 sv.KeyId = ptr.String(jtv) 10017 } 10018 10019 case "KeyUsage": 10020 if value != nil { 10021 jtv, ok := value.(string) 10022 if !ok { 10023 return fmt.Errorf("expected KeyUsageType to be of type string, got %T instead", value) 10024 } 10025 sv.KeyUsage = types.KeyUsageType(jtv) 10026 } 10027 10028 case "PublicKey": 10029 if value != nil { 10030 jtv, ok := value.(string) 10031 if !ok { 10032 return fmt.Errorf("expected PublicKeyType to be []byte, got %T instead", value) 10033 } 10034 dv, err := base64.StdEncoding.DecodeString(jtv) 10035 if err != nil { 10036 return fmt.Errorf("failed to base64 decode PublicKeyType, %w", err) 10037 } 10038 sv.PublicKey = dv 10039 } 10040 10041 case "SigningAlgorithms": 10042 if err := awsAwsjson11_deserializeDocumentSigningAlgorithmSpecList(&sv.SigningAlgorithms, value); err != nil { 10043 return err 10044 } 10045 10046 default: 10047 _, _ = key, value 10048 10049 } 10050 } 10051 *v = sv 10052 return nil 10053} 10054 10055func awsAwsjson11_deserializeOpDocumentImportKeyMaterialOutput(v **ImportKeyMaterialOutput, value interface{}) error { 10056 if v == nil { 10057 return fmt.Errorf("unexpected nil of type %T", v) 10058 } 10059 if value == nil { 10060 return nil 10061 } 10062 10063 shape, ok := value.(map[string]interface{}) 10064 if !ok { 10065 return fmt.Errorf("unexpected JSON type %v", value) 10066 } 10067 10068 var sv *ImportKeyMaterialOutput 10069 if *v == nil { 10070 sv = &ImportKeyMaterialOutput{} 10071 } else { 10072 sv = *v 10073 } 10074 10075 for key, value := range shape { 10076 switch key { 10077 default: 10078 _, _ = key, value 10079 10080 } 10081 } 10082 *v = sv 10083 return nil 10084} 10085 10086func awsAwsjson11_deserializeOpDocumentListAliasesOutput(v **ListAliasesOutput, value interface{}) error { 10087 if v == nil { 10088 return fmt.Errorf("unexpected nil of type %T", v) 10089 } 10090 if value == nil { 10091 return nil 10092 } 10093 10094 shape, ok := value.(map[string]interface{}) 10095 if !ok { 10096 return fmt.Errorf("unexpected JSON type %v", value) 10097 } 10098 10099 var sv *ListAliasesOutput 10100 if *v == nil { 10101 sv = &ListAliasesOutput{} 10102 } else { 10103 sv = *v 10104 } 10105 10106 for key, value := range shape { 10107 switch key { 10108 case "Aliases": 10109 if err := awsAwsjson11_deserializeDocumentAliasList(&sv.Aliases, value); err != nil { 10110 return err 10111 } 10112 10113 case "NextMarker": 10114 if value != nil { 10115 jtv, ok := value.(string) 10116 if !ok { 10117 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10118 } 10119 sv.NextMarker = ptr.String(jtv) 10120 } 10121 10122 case "Truncated": 10123 if value != nil { 10124 jtv, ok := value.(bool) 10125 if !ok { 10126 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10127 } 10128 sv.Truncated = jtv 10129 } 10130 10131 default: 10132 _, _ = key, value 10133 10134 } 10135 } 10136 *v = sv 10137 return nil 10138} 10139 10140func awsAwsjson11_deserializeOpDocumentListGrantsOutput(v **ListGrantsOutput, value interface{}) error { 10141 if v == nil { 10142 return fmt.Errorf("unexpected nil of type %T", v) 10143 } 10144 if value == nil { 10145 return nil 10146 } 10147 10148 shape, ok := value.(map[string]interface{}) 10149 if !ok { 10150 return fmt.Errorf("unexpected JSON type %v", value) 10151 } 10152 10153 var sv *ListGrantsOutput 10154 if *v == nil { 10155 sv = &ListGrantsOutput{} 10156 } else { 10157 sv = *v 10158 } 10159 10160 for key, value := range shape { 10161 switch key { 10162 case "Grants": 10163 if err := awsAwsjson11_deserializeDocumentGrantList(&sv.Grants, value); err != nil { 10164 return err 10165 } 10166 10167 case "NextMarker": 10168 if value != nil { 10169 jtv, ok := value.(string) 10170 if !ok { 10171 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10172 } 10173 sv.NextMarker = ptr.String(jtv) 10174 } 10175 10176 case "Truncated": 10177 if value != nil { 10178 jtv, ok := value.(bool) 10179 if !ok { 10180 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10181 } 10182 sv.Truncated = jtv 10183 } 10184 10185 default: 10186 _, _ = key, value 10187 10188 } 10189 } 10190 *v = sv 10191 return nil 10192} 10193 10194func awsAwsjson11_deserializeOpDocumentListKeyPoliciesOutput(v **ListKeyPoliciesOutput, value interface{}) error { 10195 if v == nil { 10196 return fmt.Errorf("unexpected nil of type %T", v) 10197 } 10198 if value == nil { 10199 return nil 10200 } 10201 10202 shape, ok := value.(map[string]interface{}) 10203 if !ok { 10204 return fmt.Errorf("unexpected JSON type %v", value) 10205 } 10206 10207 var sv *ListKeyPoliciesOutput 10208 if *v == nil { 10209 sv = &ListKeyPoliciesOutput{} 10210 } else { 10211 sv = *v 10212 } 10213 10214 for key, value := range shape { 10215 switch key { 10216 case "NextMarker": 10217 if value != nil { 10218 jtv, ok := value.(string) 10219 if !ok { 10220 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10221 } 10222 sv.NextMarker = ptr.String(jtv) 10223 } 10224 10225 case "PolicyNames": 10226 if err := awsAwsjson11_deserializeDocumentPolicyNameList(&sv.PolicyNames, value); err != nil { 10227 return err 10228 } 10229 10230 case "Truncated": 10231 if value != nil { 10232 jtv, ok := value.(bool) 10233 if !ok { 10234 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10235 } 10236 sv.Truncated = jtv 10237 } 10238 10239 default: 10240 _, _ = key, value 10241 10242 } 10243 } 10244 *v = sv 10245 return nil 10246} 10247 10248func awsAwsjson11_deserializeOpDocumentListKeysOutput(v **ListKeysOutput, value interface{}) error { 10249 if v == nil { 10250 return fmt.Errorf("unexpected nil of type %T", v) 10251 } 10252 if value == nil { 10253 return nil 10254 } 10255 10256 shape, ok := value.(map[string]interface{}) 10257 if !ok { 10258 return fmt.Errorf("unexpected JSON type %v", value) 10259 } 10260 10261 var sv *ListKeysOutput 10262 if *v == nil { 10263 sv = &ListKeysOutput{} 10264 } else { 10265 sv = *v 10266 } 10267 10268 for key, value := range shape { 10269 switch key { 10270 case "Keys": 10271 if err := awsAwsjson11_deserializeDocumentKeyList(&sv.Keys, value); err != nil { 10272 return err 10273 } 10274 10275 case "NextMarker": 10276 if value != nil { 10277 jtv, ok := value.(string) 10278 if !ok { 10279 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10280 } 10281 sv.NextMarker = ptr.String(jtv) 10282 } 10283 10284 case "Truncated": 10285 if value != nil { 10286 jtv, ok := value.(bool) 10287 if !ok { 10288 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10289 } 10290 sv.Truncated = jtv 10291 } 10292 10293 default: 10294 _, _ = key, value 10295 10296 } 10297 } 10298 *v = sv 10299 return nil 10300} 10301 10302func awsAwsjson11_deserializeOpDocumentListResourceTagsOutput(v **ListResourceTagsOutput, value interface{}) error { 10303 if v == nil { 10304 return fmt.Errorf("unexpected nil of type %T", v) 10305 } 10306 if value == nil { 10307 return nil 10308 } 10309 10310 shape, ok := value.(map[string]interface{}) 10311 if !ok { 10312 return fmt.Errorf("unexpected JSON type %v", value) 10313 } 10314 10315 var sv *ListResourceTagsOutput 10316 if *v == nil { 10317 sv = &ListResourceTagsOutput{} 10318 } else { 10319 sv = *v 10320 } 10321 10322 for key, value := range shape { 10323 switch key { 10324 case "NextMarker": 10325 if value != nil { 10326 jtv, ok := value.(string) 10327 if !ok { 10328 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10329 } 10330 sv.NextMarker = ptr.String(jtv) 10331 } 10332 10333 case "Tags": 10334 if err := awsAwsjson11_deserializeDocumentTagList(&sv.Tags, value); err != nil { 10335 return err 10336 } 10337 10338 case "Truncated": 10339 if value != nil { 10340 jtv, ok := value.(bool) 10341 if !ok { 10342 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10343 } 10344 sv.Truncated = jtv 10345 } 10346 10347 default: 10348 _, _ = key, value 10349 10350 } 10351 } 10352 *v = sv 10353 return nil 10354} 10355 10356func awsAwsjson11_deserializeOpDocumentListRetirableGrantsOutput(v **ListRetirableGrantsOutput, value interface{}) error { 10357 if v == nil { 10358 return fmt.Errorf("unexpected nil of type %T", v) 10359 } 10360 if value == nil { 10361 return nil 10362 } 10363 10364 shape, ok := value.(map[string]interface{}) 10365 if !ok { 10366 return fmt.Errorf("unexpected JSON type %v", value) 10367 } 10368 10369 var sv *ListRetirableGrantsOutput 10370 if *v == nil { 10371 sv = &ListRetirableGrantsOutput{} 10372 } else { 10373 sv = *v 10374 } 10375 10376 for key, value := range shape { 10377 switch key { 10378 case "Grants": 10379 if err := awsAwsjson11_deserializeDocumentGrantList(&sv.Grants, value); err != nil { 10380 return err 10381 } 10382 10383 case "NextMarker": 10384 if value != nil { 10385 jtv, ok := value.(string) 10386 if !ok { 10387 return fmt.Errorf("expected MarkerType to be of type string, got %T instead", value) 10388 } 10389 sv.NextMarker = ptr.String(jtv) 10390 } 10391 10392 case "Truncated": 10393 if value != nil { 10394 jtv, ok := value.(bool) 10395 if !ok { 10396 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10397 } 10398 sv.Truncated = jtv 10399 } 10400 10401 default: 10402 _, _ = key, value 10403 10404 } 10405 } 10406 *v = sv 10407 return nil 10408} 10409 10410func awsAwsjson11_deserializeOpDocumentReEncryptOutput(v **ReEncryptOutput, value interface{}) error { 10411 if v == nil { 10412 return fmt.Errorf("unexpected nil of type %T", v) 10413 } 10414 if value == nil { 10415 return nil 10416 } 10417 10418 shape, ok := value.(map[string]interface{}) 10419 if !ok { 10420 return fmt.Errorf("unexpected JSON type %v", value) 10421 } 10422 10423 var sv *ReEncryptOutput 10424 if *v == nil { 10425 sv = &ReEncryptOutput{} 10426 } else { 10427 sv = *v 10428 } 10429 10430 for key, value := range shape { 10431 switch key { 10432 case "CiphertextBlob": 10433 if value != nil { 10434 jtv, ok := value.(string) 10435 if !ok { 10436 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 10437 } 10438 dv, err := base64.StdEncoding.DecodeString(jtv) 10439 if err != nil { 10440 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 10441 } 10442 sv.CiphertextBlob = dv 10443 } 10444 10445 case "DestinationEncryptionAlgorithm": 10446 if value != nil { 10447 jtv, ok := value.(string) 10448 if !ok { 10449 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 10450 } 10451 sv.DestinationEncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 10452 } 10453 10454 case "KeyId": 10455 if value != nil { 10456 jtv, ok := value.(string) 10457 if !ok { 10458 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10459 } 10460 sv.KeyId = ptr.String(jtv) 10461 } 10462 10463 case "SourceEncryptionAlgorithm": 10464 if value != nil { 10465 jtv, ok := value.(string) 10466 if !ok { 10467 return fmt.Errorf("expected EncryptionAlgorithmSpec to be of type string, got %T instead", value) 10468 } 10469 sv.SourceEncryptionAlgorithm = types.EncryptionAlgorithmSpec(jtv) 10470 } 10471 10472 case "SourceKeyId": 10473 if value != nil { 10474 jtv, ok := value.(string) 10475 if !ok { 10476 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10477 } 10478 sv.SourceKeyId = ptr.String(jtv) 10479 } 10480 10481 default: 10482 _, _ = key, value 10483 10484 } 10485 } 10486 *v = sv 10487 return nil 10488} 10489 10490func awsAwsjson11_deserializeOpDocumentScheduleKeyDeletionOutput(v **ScheduleKeyDeletionOutput, value interface{}) error { 10491 if v == nil { 10492 return fmt.Errorf("unexpected nil of type %T", v) 10493 } 10494 if value == nil { 10495 return nil 10496 } 10497 10498 shape, ok := value.(map[string]interface{}) 10499 if !ok { 10500 return fmt.Errorf("unexpected JSON type %v", value) 10501 } 10502 10503 var sv *ScheduleKeyDeletionOutput 10504 if *v == nil { 10505 sv = &ScheduleKeyDeletionOutput{} 10506 } else { 10507 sv = *v 10508 } 10509 10510 for key, value := range shape { 10511 switch key { 10512 case "DeletionDate": 10513 if value != nil { 10514 jtv, ok := value.(json.Number) 10515 if !ok { 10516 return fmt.Errorf("expected DateType to be json.Number, got %T instead", value) 10517 } 10518 f64, err := jtv.Float64() 10519 if err != nil { 10520 return err 10521 } 10522 sv.DeletionDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10523 } 10524 10525 case "KeyId": 10526 if value != nil { 10527 jtv, ok := value.(string) 10528 if !ok { 10529 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10530 } 10531 sv.KeyId = ptr.String(jtv) 10532 } 10533 10534 default: 10535 _, _ = key, value 10536 10537 } 10538 } 10539 *v = sv 10540 return nil 10541} 10542 10543func awsAwsjson11_deserializeOpDocumentSignOutput(v **SignOutput, value interface{}) error { 10544 if v == nil { 10545 return fmt.Errorf("unexpected nil of type %T", v) 10546 } 10547 if value == nil { 10548 return nil 10549 } 10550 10551 shape, ok := value.(map[string]interface{}) 10552 if !ok { 10553 return fmt.Errorf("unexpected JSON type %v", value) 10554 } 10555 10556 var sv *SignOutput 10557 if *v == nil { 10558 sv = &SignOutput{} 10559 } else { 10560 sv = *v 10561 } 10562 10563 for key, value := range shape { 10564 switch key { 10565 case "KeyId": 10566 if value != nil { 10567 jtv, ok := value.(string) 10568 if !ok { 10569 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10570 } 10571 sv.KeyId = ptr.String(jtv) 10572 } 10573 10574 case "Signature": 10575 if value != nil { 10576 jtv, ok := value.(string) 10577 if !ok { 10578 return fmt.Errorf("expected CiphertextType to be []byte, got %T instead", value) 10579 } 10580 dv, err := base64.StdEncoding.DecodeString(jtv) 10581 if err != nil { 10582 return fmt.Errorf("failed to base64 decode CiphertextType, %w", err) 10583 } 10584 sv.Signature = dv 10585 } 10586 10587 case "SigningAlgorithm": 10588 if value != nil { 10589 jtv, ok := value.(string) 10590 if !ok { 10591 return fmt.Errorf("expected SigningAlgorithmSpec to be of type string, got %T instead", value) 10592 } 10593 sv.SigningAlgorithm = types.SigningAlgorithmSpec(jtv) 10594 } 10595 10596 default: 10597 _, _ = key, value 10598 10599 } 10600 } 10601 *v = sv 10602 return nil 10603} 10604 10605func awsAwsjson11_deserializeOpDocumentUpdateCustomKeyStoreOutput(v **UpdateCustomKeyStoreOutput, value interface{}) error { 10606 if v == nil { 10607 return fmt.Errorf("unexpected nil of type %T", v) 10608 } 10609 if value == nil { 10610 return nil 10611 } 10612 10613 shape, ok := value.(map[string]interface{}) 10614 if !ok { 10615 return fmt.Errorf("unexpected JSON type %v", value) 10616 } 10617 10618 var sv *UpdateCustomKeyStoreOutput 10619 if *v == nil { 10620 sv = &UpdateCustomKeyStoreOutput{} 10621 } else { 10622 sv = *v 10623 } 10624 10625 for key, value := range shape { 10626 switch key { 10627 default: 10628 _, _ = key, value 10629 10630 } 10631 } 10632 *v = sv 10633 return nil 10634} 10635 10636func awsAwsjson11_deserializeOpDocumentVerifyOutput(v **VerifyOutput, value interface{}) error { 10637 if v == nil { 10638 return fmt.Errorf("unexpected nil of type %T", v) 10639 } 10640 if value == nil { 10641 return nil 10642 } 10643 10644 shape, ok := value.(map[string]interface{}) 10645 if !ok { 10646 return fmt.Errorf("unexpected JSON type %v", value) 10647 } 10648 10649 var sv *VerifyOutput 10650 if *v == nil { 10651 sv = &VerifyOutput{} 10652 } else { 10653 sv = *v 10654 } 10655 10656 for key, value := range shape { 10657 switch key { 10658 case "KeyId": 10659 if value != nil { 10660 jtv, ok := value.(string) 10661 if !ok { 10662 return fmt.Errorf("expected KeyIdType to be of type string, got %T instead", value) 10663 } 10664 sv.KeyId = ptr.String(jtv) 10665 } 10666 10667 case "SignatureValid": 10668 if value != nil { 10669 jtv, ok := value.(bool) 10670 if !ok { 10671 return fmt.Errorf("expected BooleanType to be of type *bool, got %T instead", value) 10672 } 10673 sv.SignatureValid = jtv 10674 } 10675 10676 case "SigningAlgorithm": 10677 if value != nil { 10678 jtv, ok := value.(string) 10679 if !ok { 10680 return fmt.Errorf("expected SigningAlgorithmSpec to be of type string, got %T instead", value) 10681 } 10682 sv.SigningAlgorithm = types.SigningAlgorithmSpec(jtv) 10683 } 10684 10685 default: 10686 _, _ = key, value 10687 10688 } 10689 } 10690 *v = sv 10691 return nil 10692} 10693