1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package glacier 4 5import ( 6 "bytes" 7 "context" 8 "encoding/json" 9 "fmt" 10 "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" 11 "github.com/aws/aws-sdk-go-v2/service/glacier/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithyhttp "github.com/aws/smithy-go/transport/http" 17 "io" 18 "io/ioutil" 19 "strings" 20) 21 22type awsRestjson1_deserializeOpAbortMultipartUpload struct { 23} 24 25func (*awsRestjson1_deserializeOpAbortMultipartUpload) ID() string { 26 return "OperationDeserializer" 27} 28 29func (m *awsRestjson1_deserializeOpAbortMultipartUpload) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 30 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 31) { 32 out, metadata, err = next.HandleDeserialize(ctx, in) 33 if err != nil { 34 return out, metadata, err 35 } 36 37 response, ok := out.RawResponse.(*smithyhttp.Response) 38 if !ok { 39 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 40 } 41 42 if response.StatusCode < 200 || response.StatusCode >= 300 { 43 return out, metadata, awsRestjson1_deserializeOpErrorAbortMultipartUpload(response, &metadata) 44 } 45 output := &AbortMultipartUploadOutput{} 46 out.Result = output 47 48 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 49 return out, metadata, &smithy.DeserializationError{ 50 Err: fmt.Errorf("failed to discard response body, %w", err), 51 } 52 } 53 54 return out, metadata, err 55} 56 57func awsRestjson1_deserializeOpErrorAbortMultipartUpload(response *smithyhttp.Response, metadata *middleware.Metadata) error { 58 var errorBuffer bytes.Buffer 59 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 60 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 61 } 62 errorBody := bytes.NewReader(errorBuffer.Bytes()) 63 64 errorCode := "UnknownError" 65 errorMessage := errorCode 66 67 code := response.Header.Get("X-Amzn-ErrorType") 68 if len(code) != 0 { 69 errorCode = restjson.SanitizeErrorCode(code) 70 } 71 72 var buff [1024]byte 73 ringBuffer := smithyio.NewRingBuffer(buff[:]) 74 75 body := io.TeeReader(errorBody, ringBuffer) 76 decoder := json.NewDecoder(body) 77 decoder.UseNumber() 78 code, message, err := restjson.GetErrorInfo(decoder) 79 if err != nil { 80 var snapshot bytes.Buffer 81 io.Copy(&snapshot, ringBuffer) 82 err = &smithy.DeserializationError{ 83 Err: fmt.Errorf("failed to decode response body, %w", err), 84 Snapshot: snapshot.Bytes(), 85 } 86 return err 87 } 88 89 errorBody.Seek(0, io.SeekStart) 90 if len(code) != 0 { 91 errorCode = restjson.SanitizeErrorCode(code) 92 } 93 if len(message) != 0 { 94 errorMessage = message 95 } 96 97 switch { 98 case strings.EqualFold("InvalidParameterValueException", errorCode): 99 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 100 101 case strings.EqualFold("MissingParameterValueException", errorCode): 102 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 103 104 case strings.EqualFold("ResourceNotFoundException", errorCode): 105 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 106 107 case strings.EqualFold("ServiceUnavailableException", errorCode): 108 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 109 110 default: 111 genericError := &smithy.GenericAPIError{ 112 Code: errorCode, 113 Message: errorMessage, 114 } 115 return genericError 116 117 } 118} 119 120type awsRestjson1_deserializeOpAbortVaultLock struct { 121} 122 123func (*awsRestjson1_deserializeOpAbortVaultLock) ID() string { 124 return "OperationDeserializer" 125} 126 127func (m *awsRestjson1_deserializeOpAbortVaultLock) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 128 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 129) { 130 out, metadata, err = next.HandleDeserialize(ctx, in) 131 if err != nil { 132 return out, metadata, err 133 } 134 135 response, ok := out.RawResponse.(*smithyhttp.Response) 136 if !ok { 137 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 138 } 139 140 if response.StatusCode < 200 || response.StatusCode >= 300 { 141 return out, metadata, awsRestjson1_deserializeOpErrorAbortVaultLock(response, &metadata) 142 } 143 output := &AbortVaultLockOutput{} 144 out.Result = output 145 146 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 147 return out, metadata, &smithy.DeserializationError{ 148 Err: fmt.Errorf("failed to discard response body, %w", err), 149 } 150 } 151 152 return out, metadata, err 153} 154 155func awsRestjson1_deserializeOpErrorAbortVaultLock(response *smithyhttp.Response, metadata *middleware.Metadata) error { 156 var errorBuffer bytes.Buffer 157 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 158 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 159 } 160 errorBody := bytes.NewReader(errorBuffer.Bytes()) 161 162 errorCode := "UnknownError" 163 errorMessage := errorCode 164 165 code := response.Header.Get("X-Amzn-ErrorType") 166 if len(code) != 0 { 167 errorCode = restjson.SanitizeErrorCode(code) 168 } 169 170 var buff [1024]byte 171 ringBuffer := smithyio.NewRingBuffer(buff[:]) 172 173 body := io.TeeReader(errorBody, ringBuffer) 174 decoder := json.NewDecoder(body) 175 decoder.UseNumber() 176 code, message, err := restjson.GetErrorInfo(decoder) 177 if err != nil { 178 var snapshot bytes.Buffer 179 io.Copy(&snapshot, ringBuffer) 180 err = &smithy.DeserializationError{ 181 Err: fmt.Errorf("failed to decode response body, %w", err), 182 Snapshot: snapshot.Bytes(), 183 } 184 return err 185 } 186 187 errorBody.Seek(0, io.SeekStart) 188 if len(code) != 0 { 189 errorCode = restjson.SanitizeErrorCode(code) 190 } 191 if len(message) != 0 { 192 errorMessage = message 193 } 194 195 switch { 196 case strings.EqualFold("InvalidParameterValueException", errorCode): 197 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 198 199 case strings.EqualFold("MissingParameterValueException", errorCode): 200 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 201 202 case strings.EqualFold("ResourceNotFoundException", errorCode): 203 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 204 205 case strings.EqualFold("ServiceUnavailableException", errorCode): 206 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 207 208 default: 209 genericError := &smithy.GenericAPIError{ 210 Code: errorCode, 211 Message: errorMessage, 212 } 213 return genericError 214 215 } 216} 217 218type awsRestjson1_deserializeOpAddTagsToVault struct { 219} 220 221func (*awsRestjson1_deserializeOpAddTagsToVault) ID() string { 222 return "OperationDeserializer" 223} 224 225func (m *awsRestjson1_deserializeOpAddTagsToVault) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 226 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 227) { 228 out, metadata, err = next.HandleDeserialize(ctx, in) 229 if err != nil { 230 return out, metadata, err 231 } 232 233 response, ok := out.RawResponse.(*smithyhttp.Response) 234 if !ok { 235 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 236 } 237 238 if response.StatusCode < 200 || response.StatusCode >= 300 { 239 return out, metadata, awsRestjson1_deserializeOpErrorAddTagsToVault(response, &metadata) 240 } 241 output := &AddTagsToVaultOutput{} 242 out.Result = output 243 244 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 245 return out, metadata, &smithy.DeserializationError{ 246 Err: fmt.Errorf("failed to discard response body, %w", err), 247 } 248 } 249 250 return out, metadata, err 251} 252 253func awsRestjson1_deserializeOpErrorAddTagsToVault(response *smithyhttp.Response, metadata *middleware.Metadata) error { 254 var errorBuffer bytes.Buffer 255 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 256 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 257 } 258 errorBody := bytes.NewReader(errorBuffer.Bytes()) 259 260 errorCode := "UnknownError" 261 errorMessage := errorCode 262 263 code := response.Header.Get("X-Amzn-ErrorType") 264 if len(code) != 0 { 265 errorCode = restjson.SanitizeErrorCode(code) 266 } 267 268 var buff [1024]byte 269 ringBuffer := smithyio.NewRingBuffer(buff[:]) 270 271 body := io.TeeReader(errorBody, ringBuffer) 272 decoder := json.NewDecoder(body) 273 decoder.UseNumber() 274 code, message, err := restjson.GetErrorInfo(decoder) 275 if err != nil { 276 var snapshot bytes.Buffer 277 io.Copy(&snapshot, ringBuffer) 278 err = &smithy.DeserializationError{ 279 Err: fmt.Errorf("failed to decode response body, %w", err), 280 Snapshot: snapshot.Bytes(), 281 } 282 return err 283 } 284 285 errorBody.Seek(0, io.SeekStart) 286 if len(code) != 0 { 287 errorCode = restjson.SanitizeErrorCode(code) 288 } 289 if len(message) != 0 { 290 errorMessage = message 291 } 292 293 switch { 294 case strings.EqualFold("InvalidParameterValueException", errorCode): 295 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 296 297 case strings.EqualFold("LimitExceededException", errorCode): 298 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 299 300 case strings.EqualFold("MissingParameterValueException", errorCode): 301 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 302 303 case strings.EqualFold("ResourceNotFoundException", errorCode): 304 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 305 306 case strings.EqualFold("ServiceUnavailableException", errorCode): 307 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 308 309 default: 310 genericError := &smithy.GenericAPIError{ 311 Code: errorCode, 312 Message: errorMessage, 313 } 314 return genericError 315 316 } 317} 318 319type awsRestjson1_deserializeOpCompleteMultipartUpload struct { 320} 321 322func (*awsRestjson1_deserializeOpCompleteMultipartUpload) ID() string { 323 return "OperationDeserializer" 324} 325 326func (m *awsRestjson1_deserializeOpCompleteMultipartUpload) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 327 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 328) { 329 out, metadata, err = next.HandleDeserialize(ctx, in) 330 if err != nil { 331 return out, metadata, err 332 } 333 334 response, ok := out.RawResponse.(*smithyhttp.Response) 335 if !ok { 336 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 337 } 338 339 if response.StatusCode < 200 || response.StatusCode >= 300 { 340 return out, metadata, awsRestjson1_deserializeOpErrorCompleteMultipartUpload(response, &metadata) 341 } 342 output := &CompleteMultipartUploadOutput{} 343 out.Result = output 344 345 err = awsRestjson1_deserializeOpHttpBindingsCompleteMultipartUploadOutput(output, response) 346 if err != nil { 347 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 348 } 349 350 return out, metadata, err 351} 352 353func awsRestjson1_deserializeOpErrorCompleteMultipartUpload(response *smithyhttp.Response, metadata *middleware.Metadata) error { 354 var errorBuffer bytes.Buffer 355 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 356 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 357 } 358 errorBody := bytes.NewReader(errorBuffer.Bytes()) 359 360 errorCode := "UnknownError" 361 errorMessage := errorCode 362 363 code := response.Header.Get("X-Amzn-ErrorType") 364 if len(code) != 0 { 365 errorCode = restjson.SanitizeErrorCode(code) 366 } 367 368 var buff [1024]byte 369 ringBuffer := smithyio.NewRingBuffer(buff[:]) 370 371 body := io.TeeReader(errorBody, ringBuffer) 372 decoder := json.NewDecoder(body) 373 decoder.UseNumber() 374 code, message, err := restjson.GetErrorInfo(decoder) 375 if err != nil { 376 var snapshot bytes.Buffer 377 io.Copy(&snapshot, ringBuffer) 378 err = &smithy.DeserializationError{ 379 Err: fmt.Errorf("failed to decode response body, %w", err), 380 Snapshot: snapshot.Bytes(), 381 } 382 return err 383 } 384 385 errorBody.Seek(0, io.SeekStart) 386 if len(code) != 0 { 387 errorCode = restjson.SanitizeErrorCode(code) 388 } 389 if len(message) != 0 { 390 errorMessage = message 391 } 392 393 switch { 394 case strings.EqualFold("InvalidParameterValueException", errorCode): 395 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 396 397 case strings.EqualFold("MissingParameterValueException", errorCode): 398 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 399 400 case strings.EqualFold("ResourceNotFoundException", errorCode): 401 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 402 403 case strings.EqualFold("ServiceUnavailableException", errorCode): 404 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 405 406 default: 407 genericError := &smithy.GenericAPIError{ 408 Code: errorCode, 409 Message: errorMessage, 410 } 411 return genericError 412 413 } 414} 415 416func awsRestjson1_deserializeOpHttpBindingsCompleteMultipartUploadOutput(v *CompleteMultipartUploadOutput, response *smithyhttp.Response) error { 417 if v == nil { 418 return fmt.Errorf("unsupported deserialization for nil %T", v) 419 } 420 421 if headerValues := response.Header.Values("x-amz-archive-id"); len(headerValues) != 0 { 422 headerValues[0] = strings.TrimSpace(headerValues[0]) 423 v.ArchiveId = ptr.String(headerValues[0]) 424 } 425 426 if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 { 427 headerValues[0] = strings.TrimSpace(headerValues[0]) 428 v.Checksum = ptr.String(headerValues[0]) 429 } 430 431 if headerValues := response.Header.Values("Location"); len(headerValues) != 0 { 432 headerValues[0] = strings.TrimSpace(headerValues[0]) 433 v.Location = ptr.String(headerValues[0]) 434 } 435 436 return nil 437} 438 439type awsRestjson1_deserializeOpCompleteVaultLock struct { 440} 441 442func (*awsRestjson1_deserializeOpCompleteVaultLock) ID() string { 443 return "OperationDeserializer" 444} 445 446func (m *awsRestjson1_deserializeOpCompleteVaultLock) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 447 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 448) { 449 out, metadata, err = next.HandleDeserialize(ctx, in) 450 if err != nil { 451 return out, metadata, err 452 } 453 454 response, ok := out.RawResponse.(*smithyhttp.Response) 455 if !ok { 456 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 457 } 458 459 if response.StatusCode < 200 || response.StatusCode >= 300 { 460 return out, metadata, awsRestjson1_deserializeOpErrorCompleteVaultLock(response, &metadata) 461 } 462 output := &CompleteVaultLockOutput{} 463 out.Result = output 464 465 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 466 return out, metadata, &smithy.DeserializationError{ 467 Err: fmt.Errorf("failed to discard response body, %w", err), 468 } 469 } 470 471 return out, metadata, err 472} 473 474func awsRestjson1_deserializeOpErrorCompleteVaultLock(response *smithyhttp.Response, metadata *middleware.Metadata) error { 475 var errorBuffer bytes.Buffer 476 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 477 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 478 } 479 errorBody := bytes.NewReader(errorBuffer.Bytes()) 480 481 errorCode := "UnknownError" 482 errorMessage := errorCode 483 484 code := response.Header.Get("X-Amzn-ErrorType") 485 if len(code) != 0 { 486 errorCode = restjson.SanitizeErrorCode(code) 487 } 488 489 var buff [1024]byte 490 ringBuffer := smithyio.NewRingBuffer(buff[:]) 491 492 body := io.TeeReader(errorBody, ringBuffer) 493 decoder := json.NewDecoder(body) 494 decoder.UseNumber() 495 code, message, err := restjson.GetErrorInfo(decoder) 496 if err != nil { 497 var snapshot bytes.Buffer 498 io.Copy(&snapshot, ringBuffer) 499 err = &smithy.DeserializationError{ 500 Err: fmt.Errorf("failed to decode response body, %w", err), 501 Snapshot: snapshot.Bytes(), 502 } 503 return err 504 } 505 506 errorBody.Seek(0, io.SeekStart) 507 if len(code) != 0 { 508 errorCode = restjson.SanitizeErrorCode(code) 509 } 510 if len(message) != 0 { 511 errorMessage = message 512 } 513 514 switch { 515 case strings.EqualFold("InvalidParameterValueException", errorCode): 516 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 517 518 case strings.EqualFold("MissingParameterValueException", errorCode): 519 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 520 521 case strings.EqualFold("ResourceNotFoundException", errorCode): 522 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 523 524 case strings.EqualFold("ServiceUnavailableException", errorCode): 525 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 526 527 default: 528 genericError := &smithy.GenericAPIError{ 529 Code: errorCode, 530 Message: errorMessage, 531 } 532 return genericError 533 534 } 535} 536 537type awsRestjson1_deserializeOpCreateVault struct { 538} 539 540func (*awsRestjson1_deserializeOpCreateVault) ID() string { 541 return "OperationDeserializer" 542} 543 544func (m *awsRestjson1_deserializeOpCreateVault) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 545 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 546) { 547 out, metadata, err = next.HandleDeserialize(ctx, in) 548 if err != nil { 549 return out, metadata, err 550 } 551 552 response, ok := out.RawResponse.(*smithyhttp.Response) 553 if !ok { 554 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 555 } 556 557 if response.StatusCode < 200 || response.StatusCode >= 300 { 558 return out, metadata, awsRestjson1_deserializeOpErrorCreateVault(response, &metadata) 559 } 560 output := &CreateVaultOutput{} 561 out.Result = output 562 563 err = awsRestjson1_deserializeOpHttpBindingsCreateVaultOutput(output, response) 564 if err != nil { 565 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 566 } 567 568 return out, metadata, err 569} 570 571func awsRestjson1_deserializeOpErrorCreateVault(response *smithyhttp.Response, metadata *middleware.Metadata) error { 572 var errorBuffer bytes.Buffer 573 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 574 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 575 } 576 errorBody := bytes.NewReader(errorBuffer.Bytes()) 577 578 errorCode := "UnknownError" 579 errorMessage := errorCode 580 581 code := response.Header.Get("X-Amzn-ErrorType") 582 if len(code) != 0 { 583 errorCode = restjson.SanitizeErrorCode(code) 584 } 585 586 var buff [1024]byte 587 ringBuffer := smithyio.NewRingBuffer(buff[:]) 588 589 body := io.TeeReader(errorBody, ringBuffer) 590 decoder := json.NewDecoder(body) 591 decoder.UseNumber() 592 code, message, err := restjson.GetErrorInfo(decoder) 593 if err != nil { 594 var snapshot bytes.Buffer 595 io.Copy(&snapshot, ringBuffer) 596 err = &smithy.DeserializationError{ 597 Err: fmt.Errorf("failed to decode response body, %w", err), 598 Snapshot: snapshot.Bytes(), 599 } 600 return err 601 } 602 603 errorBody.Seek(0, io.SeekStart) 604 if len(code) != 0 { 605 errorCode = restjson.SanitizeErrorCode(code) 606 } 607 if len(message) != 0 { 608 errorMessage = message 609 } 610 611 switch { 612 case strings.EqualFold("InvalidParameterValueException", errorCode): 613 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 614 615 case strings.EqualFold("LimitExceededException", errorCode): 616 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 617 618 case strings.EqualFold("MissingParameterValueException", errorCode): 619 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 620 621 case strings.EqualFold("ServiceUnavailableException", errorCode): 622 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 623 624 default: 625 genericError := &smithy.GenericAPIError{ 626 Code: errorCode, 627 Message: errorMessage, 628 } 629 return genericError 630 631 } 632} 633 634func awsRestjson1_deserializeOpHttpBindingsCreateVaultOutput(v *CreateVaultOutput, response *smithyhttp.Response) error { 635 if v == nil { 636 return fmt.Errorf("unsupported deserialization for nil %T", v) 637 } 638 639 if headerValues := response.Header.Values("Location"); len(headerValues) != 0 { 640 headerValues[0] = strings.TrimSpace(headerValues[0]) 641 v.Location = ptr.String(headerValues[0]) 642 } 643 644 return nil 645} 646 647type awsRestjson1_deserializeOpDeleteArchive struct { 648} 649 650func (*awsRestjson1_deserializeOpDeleteArchive) ID() string { 651 return "OperationDeserializer" 652} 653 654func (m *awsRestjson1_deserializeOpDeleteArchive) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 655 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 656) { 657 out, metadata, err = next.HandleDeserialize(ctx, in) 658 if err != nil { 659 return out, metadata, err 660 } 661 662 response, ok := out.RawResponse.(*smithyhttp.Response) 663 if !ok { 664 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 665 } 666 667 if response.StatusCode < 200 || response.StatusCode >= 300 { 668 return out, metadata, awsRestjson1_deserializeOpErrorDeleteArchive(response, &metadata) 669 } 670 output := &DeleteArchiveOutput{} 671 out.Result = output 672 673 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 674 return out, metadata, &smithy.DeserializationError{ 675 Err: fmt.Errorf("failed to discard response body, %w", err), 676 } 677 } 678 679 return out, metadata, err 680} 681 682func awsRestjson1_deserializeOpErrorDeleteArchive(response *smithyhttp.Response, metadata *middleware.Metadata) error { 683 var errorBuffer bytes.Buffer 684 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 685 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 686 } 687 errorBody := bytes.NewReader(errorBuffer.Bytes()) 688 689 errorCode := "UnknownError" 690 errorMessage := errorCode 691 692 code := response.Header.Get("X-Amzn-ErrorType") 693 if len(code) != 0 { 694 errorCode = restjson.SanitizeErrorCode(code) 695 } 696 697 var buff [1024]byte 698 ringBuffer := smithyio.NewRingBuffer(buff[:]) 699 700 body := io.TeeReader(errorBody, ringBuffer) 701 decoder := json.NewDecoder(body) 702 decoder.UseNumber() 703 code, message, err := restjson.GetErrorInfo(decoder) 704 if err != nil { 705 var snapshot bytes.Buffer 706 io.Copy(&snapshot, ringBuffer) 707 err = &smithy.DeserializationError{ 708 Err: fmt.Errorf("failed to decode response body, %w", err), 709 Snapshot: snapshot.Bytes(), 710 } 711 return err 712 } 713 714 errorBody.Seek(0, io.SeekStart) 715 if len(code) != 0 { 716 errorCode = restjson.SanitizeErrorCode(code) 717 } 718 if len(message) != 0 { 719 errorMessage = message 720 } 721 722 switch { 723 case strings.EqualFold("InvalidParameterValueException", errorCode): 724 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 725 726 case strings.EqualFold("MissingParameterValueException", errorCode): 727 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 728 729 case strings.EqualFold("ResourceNotFoundException", errorCode): 730 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 731 732 case strings.EqualFold("ServiceUnavailableException", errorCode): 733 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 734 735 default: 736 genericError := &smithy.GenericAPIError{ 737 Code: errorCode, 738 Message: errorMessage, 739 } 740 return genericError 741 742 } 743} 744 745type awsRestjson1_deserializeOpDeleteVault struct { 746} 747 748func (*awsRestjson1_deserializeOpDeleteVault) ID() string { 749 return "OperationDeserializer" 750} 751 752func (m *awsRestjson1_deserializeOpDeleteVault) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 753 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 754) { 755 out, metadata, err = next.HandleDeserialize(ctx, in) 756 if err != nil { 757 return out, metadata, err 758 } 759 760 response, ok := out.RawResponse.(*smithyhttp.Response) 761 if !ok { 762 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 763 } 764 765 if response.StatusCode < 200 || response.StatusCode >= 300 { 766 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVault(response, &metadata) 767 } 768 output := &DeleteVaultOutput{} 769 out.Result = output 770 771 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 772 return out, metadata, &smithy.DeserializationError{ 773 Err: fmt.Errorf("failed to discard response body, %w", err), 774 } 775 } 776 777 return out, metadata, err 778} 779 780func awsRestjson1_deserializeOpErrorDeleteVault(response *smithyhttp.Response, metadata *middleware.Metadata) error { 781 var errorBuffer bytes.Buffer 782 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 783 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 784 } 785 errorBody := bytes.NewReader(errorBuffer.Bytes()) 786 787 errorCode := "UnknownError" 788 errorMessage := errorCode 789 790 code := response.Header.Get("X-Amzn-ErrorType") 791 if len(code) != 0 { 792 errorCode = restjson.SanitizeErrorCode(code) 793 } 794 795 var buff [1024]byte 796 ringBuffer := smithyio.NewRingBuffer(buff[:]) 797 798 body := io.TeeReader(errorBody, ringBuffer) 799 decoder := json.NewDecoder(body) 800 decoder.UseNumber() 801 code, message, err := restjson.GetErrorInfo(decoder) 802 if err != nil { 803 var snapshot bytes.Buffer 804 io.Copy(&snapshot, ringBuffer) 805 err = &smithy.DeserializationError{ 806 Err: fmt.Errorf("failed to decode response body, %w", err), 807 Snapshot: snapshot.Bytes(), 808 } 809 return err 810 } 811 812 errorBody.Seek(0, io.SeekStart) 813 if len(code) != 0 { 814 errorCode = restjson.SanitizeErrorCode(code) 815 } 816 if len(message) != 0 { 817 errorMessage = message 818 } 819 820 switch { 821 case strings.EqualFold("InvalidParameterValueException", errorCode): 822 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 823 824 case strings.EqualFold("MissingParameterValueException", errorCode): 825 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 826 827 case strings.EqualFold("ResourceNotFoundException", errorCode): 828 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 829 830 case strings.EqualFold("ServiceUnavailableException", errorCode): 831 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 832 833 default: 834 genericError := &smithy.GenericAPIError{ 835 Code: errorCode, 836 Message: errorMessage, 837 } 838 return genericError 839 840 } 841} 842 843type awsRestjson1_deserializeOpDeleteVaultAccessPolicy struct { 844} 845 846func (*awsRestjson1_deserializeOpDeleteVaultAccessPolicy) ID() string { 847 return "OperationDeserializer" 848} 849 850func (m *awsRestjson1_deserializeOpDeleteVaultAccessPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 851 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 852) { 853 out, metadata, err = next.HandleDeserialize(ctx, in) 854 if err != nil { 855 return out, metadata, err 856 } 857 858 response, ok := out.RawResponse.(*smithyhttp.Response) 859 if !ok { 860 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 861 } 862 863 if response.StatusCode < 200 || response.StatusCode >= 300 { 864 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVaultAccessPolicy(response, &metadata) 865 } 866 output := &DeleteVaultAccessPolicyOutput{} 867 out.Result = output 868 869 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 870 return out, metadata, &smithy.DeserializationError{ 871 Err: fmt.Errorf("failed to discard response body, %w", err), 872 } 873 } 874 875 return out, metadata, err 876} 877 878func awsRestjson1_deserializeOpErrorDeleteVaultAccessPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 879 var errorBuffer bytes.Buffer 880 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 881 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 882 } 883 errorBody := bytes.NewReader(errorBuffer.Bytes()) 884 885 errorCode := "UnknownError" 886 errorMessage := errorCode 887 888 code := response.Header.Get("X-Amzn-ErrorType") 889 if len(code) != 0 { 890 errorCode = restjson.SanitizeErrorCode(code) 891 } 892 893 var buff [1024]byte 894 ringBuffer := smithyio.NewRingBuffer(buff[:]) 895 896 body := io.TeeReader(errorBody, ringBuffer) 897 decoder := json.NewDecoder(body) 898 decoder.UseNumber() 899 code, message, err := restjson.GetErrorInfo(decoder) 900 if err != nil { 901 var snapshot bytes.Buffer 902 io.Copy(&snapshot, ringBuffer) 903 err = &smithy.DeserializationError{ 904 Err: fmt.Errorf("failed to decode response body, %w", err), 905 Snapshot: snapshot.Bytes(), 906 } 907 return err 908 } 909 910 errorBody.Seek(0, io.SeekStart) 911 if len(code) != 0 { 912 errorCode = restjson.SanitizeErrorCode(code) 913 } 914 if len(message) != 0 { 915 errorMessage = message 916 } 917 918 switch { 919 case strings.EqualFold("InvalidParameterValueException", errorCode): 920 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 921 922 case strings.EqualFold("MissingParameterValueException", errorCode): 923 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 924 925 case strings.EqualFold("ResourceNotFoundException", errorCode): 926 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 927 928 case strings.EqualFold("ServiceUnavailableException", errorCode): 929 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 930 931 default: 932 genericError := &smithy.GenericAPIError{ 933 Code: errorCode, 934 Message: errorMessage, 935 } 936 return genericError 937 938 } 939} 940 941type awsRestjson1_deserializeOpDeleteVaultNotifications struct { 942} 943 944func (*awsRestjson1_deserializeOpDeleteVaultNotifications) ID() string { 945 return "OperationDeserializer" 946} 947 948func (m *awsRestjson1_deserializeOpDeleteVaultNotifications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 949 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 950) { 951 out, metadata, err = next.HandleDeserialize(ctx, in) 952 if err != nil { 953 return out, metadata, err 954 } 955 956 response, ok := out.RawResponse.(*smithyhttp.Response) 957 if !ok { 958 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 959 } 960 961 if response.StatusCode < 200 || response.StatusCode >= 300 { 962 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVaultNotifications(response, &metadata) 963 } 964 output := &DeleteVaultNotificationsOutput{} 965 out.Result = output 966 967 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 968 return out, metadata, &smithy.DeserializationError{ 969 Err: fmt.Errorf("failed to discard response body, %w", err), 970 } 971 } 972 973 return out, metadata, err 974} 975 976func awsRestjson1_deserializeOpErrorDeleteVaultNotifications(response *smithyhttp.Response, metadata *middleware.Metadata) error { 977 var errorBuffer bytes.Buffer 978 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 979 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 980 } 981 errorBody := bytes.NewReader(errorBuffer.Bytes()) 982 983 errorCode := "UnknownError" 984 errorMessage := errorCode 985 986 code := response.Header.Get("X-Amzn-ErrorType") 987 if len(code) != 0 { 988 errorCode = restjson.SanitizeErrorCode(code) 989 } 990 991 var buff [1024]byte 992 ringBuffer := smithyio.NewRingBuffer(buff[:]) 993 994 body := io.TeeReader(errorBody, ringBuffer) 995 decoder := json.NewDecoder(body) 996 decoder.UseNumber() 997 code, message, err := restjson.GetErrorInfo(decoder) 998 if err != nil { 999 var snapshot bytes.Buffer 1000 io.Copy(&snapshot, ringBuffer) 1001 err = &smithy.DeserializationError{ 1002 Err: fmt.Errorf("failed to decode response body, %w", err), 1003 Snapshot: snapshot.Bytes(), 1004 } 1005 return err 1006 } 1007 1008 errorBody.Seek(0, io.SeekStart) 1009 if len(code) != 0 { 1010 errorCode = restjson.SanitizeErrorCode(code) 1011 } 1012 if len(message) != 0 { 1013 errorMessage = message 1014 } 1015 1016 switch { 1017 case strings.EqualFold("InvalidParameterValueException", errorCode): 1018 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 1019 1020 case strings.EqualFold("MissingParameterValueException", errorCode): 1021 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 1022 1023 case strings.EqualFold("ResourceNotFoundException", errorCode): 1024 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1025 1026 case strings.EqualFold("ServiceUnavailableException", errorCode): 1027 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1028 1029 default: 1030 genericError := &smithy.GenericAPIError{ 1031 Code: errorCode, 1032 Message: errorMessage, 1033 } 1034 return genericError 1035 1036 } 1037} 1038 1039type awsRestjson1_deserializeOpDescribeJob struct { 1040} 1041 1042func (*awsRestjson1_deserializeOpDescribeJob) ID() string { 1043 return "OperationDeserializer" 1044} 1045 1046func (m *awsRestjson1_deserializeOpDescribeJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1047 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1048) { 1049 out, metadata, err = next.HandleDeserialize(ctx, in) 1050 if err != nil { 1051 return out, metadata, err 1052 } 1053 1054 response, ok := out.RawResponse.(*smithyhttp.Response) 1055 if !ok { 1056 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1057 } 1058 1059 if response.StatusCode < 200 || response.StatusCode >= 300 { 1060 return out, metadata, awsRestjson1_deserializeOpErrorDescribeJob(response, &metadata) 1061 } 1062 output := &DescribeJobOutput{} 1063 out.Result = output 1064 1065 var buff [1024]byte 1066 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1067 1068 body := io.TeeReader(response.Body, ringBuffer) 1069 1070 decoder := json.NewDecoder(body) 1071 decoder.UseNumber() 1072 var shape interface{} 1073 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1074 var snapshot bytes.Buffer 1075 io.Copy(&snapshot, ringBuffer) 1076 err = &smithy.DeserializationError{ 1077 Err: fmt.Errorf("failed to decode response body, %w", err), 1078 Snapshot: snapshot.Bytes(), 1079 } 1080 return out, metadata, err 1081 } 1082 1083 err = awsRestjson1_deserializeOpDocumentDescribeJobOutput(&output, shape) 1084 if err != nil { 1085 var snapshot bytes.Buffer 1086 io.Copy(&snapshot, ringBuffer) 1087 return out, metadata, &smithy.DeserializationError{ 1088 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1089 Snapshot: snapshot.Bytes(), 1090 } 1091 } 1092 1093 return out, metadata, err 1094} 1095 1096func awsRestjson1_deserializeOpErrorDescribeJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1097 var errorBuffer bytes.Buffer 1098 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1099 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1100 } 1101 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1102 1103 errorCode := "UnknownError" 1104 errorMessage := errorCode 1105 1106 code := response.Header.Get("X-Amzn-ErrorType") 1107 if len(code) != 0 { 1108 errorCode = restjson.SanitizeErrorCode(code) 1109 } 1110 1111 var buff [1024]byte 1112 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1113 1114 body := io.TeeReader(errorBody, ringBuffer) 1115 decoder := json.NewDecoder(body) 1116 decoder.UseNumber() 1117 code, message, err := restjson.GetErrorInfo(decoder) 1118 if err != nil { 1119 var snapshot bytes.Buffer 1120 io.Copy(&snapshot, ringBuffer) 1121 err = &smithy.DeserializationError{ 1122 Err: fmt.Errorf("failed to decode response body, %w", err), 1123 Snapshot: snapshot.Bytes(), 1124 } 1125 return err 1126 } 1127 1128 errorBody.Seek(0, io.SeekStart) 1129 if len(code) != 0 { 1130 errorCode = restjson.SanitizeErrorCode(code) 1131 } 1132 if len(message) != 0 { 1133 errorMessage = message 1134 } 1135 1136 switch { 1137 case strings.EqualFold("InvalidParameterValueException", errorCode): 1138 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 1139 1140 case strings.EqualFold("MissingParameterValueException", errorCode): 1141 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 1142 1143 case strings.EqualFold("ResourceNotFoundException", errorCode): 1144 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1145 1146 case strings.EqualFold("ServiceUnavailableException", errorCode): 1147 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1148 1149 default: 1150 genericError := &smithy.GenericAPIError{ 1151 Code: errorCode, 1152 Message: errorMessage, 1153 } 1154 return genericError 1155 1156 } 1157} 1158 1159func awsRestjson1_deserializeOpDocumentDescribeJobOutput(v **DescribeJobOutput, value interface{}) error { 1160 if v == nil { 1161 return fmt.Errorf("unexpected nil of type %T", v) 1162 } 1163 if value == nil { 1164 return nil 1165 } 1166 1167 shape, ok := value.(map[string]interface{}) 1168 if !ok { 1169 return fmt.Errorf("unexpected JSON type %v", value) 1170 } 1171 1172 var sv *DescribeJobOutput 1173 if *v == nil { 1174 sv = &DescribeJobOutput{} 1175 } else { 1176 sv = *v 1177 } 1178 1179 for key, value := range shape { 1180 switch key { 1181 case "Action": 1182 if value != nil { 1183 jtv, ok := value.(string) 1184 if !ok { 1185 return fmt.Errorf("expected ActionCode to be of type string, got %T instead", value) 1186 } 1187 sv.Action = types.ActionCode(jtv) 1188 } 1189 1190 case "ArchiveId": 1191 if value != nil { 1192 jtv, ok := value.(string) 1193 if !ok { 1194 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1195 } 1196 sv.ArchiveId = ptr.String(jtv) 1197 } 1198 1199 case "ArchiveSHA256TreeHash": 1200 if value != nil { 1201 jtv, ok := value.(string) 1202 if !ok { 1203 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1204 } 1205 sv.ArchiveSHA256TreeHash = ptr.String(jtv) 1206 } 1207 1208 case "ArchiveSizeInBytes": 1209 if value != nil { 1210 jtv, ok := value.(json.Number) 1211 if !ok { 1212 return fmt.Errorf("expected Size to be json.Number, got %T instead", value) 1213 } 1214 i64, err := jtv.Int64() 1215 if err != nil { 1216 return err 1217 } 1218 sv.ArchiveSizeInBytes = ptr.Int64(i64) 1219 } 1220 1221 case "Completed": 1222 if value != nil { 1223 jtv, ok := value.(bool) 1224 if !ok { 1225 return fmt.Errorf("expected boolean to be of type *bool, got %T instead", value) 1226 } 1227 sv.Completed = jtv 1228 } 1229 1230 case "CompletionDate": 1231 if value != nil { 1232 jtv, ok := value.(string) 1233 if !ok { 1234 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1235 } 1236 sv.CompletionDate = ptr.String(jtv) 1237 } 1238 1239 case "CreationDate": 1240 if value != nil { 1241 jtv, ok := value.(string) 1242 if !ok { 1243 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1244 } 1245 sv.CreationDate = ptr.String(jtv) 1246 } 1247 1248 case "InventoryRetrievalParameters": 1249 if err := awsRestjson1_deserializeDocumentInventoryRetrievalJobDescription(&sv.InventoryRetrievalParameters, value); err != nil { 1250 return err 1251 } 1252 1253 case "InventorySizeInBytes": 1254 if value != nil { 1255 jtv, ok := value.(json.Number) 1256 if !ok { 1257 return fmt.Errorf("expected Size to be json.Number, got %T instead", value) 1258 } 1259 i64, err := jtv.Int64() 1260 if err != nil { 1261 return err 1262 } 1263 sv.InventorySizeInBytes = ptr.Int64(i64) 1264 } 1265 1266 case "JobDescription": 1267 if value != nil { 1268 jtv, ok := value.(string) 1269 if !ok { 1270 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1271 } 1272 sv.JobDescription = ptr.String(jtv) 1273 } 1274 1275 case "JobId": 1276 if value != nil { 1277 jtv, ok := value.(string) 1278 if !ok { 1279 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1280 } 1281 sv.JobId = ptr.String(jtv) 1282 } 1283 1284 case "JobOutputPath": 1285 if value != nil { 1286 jtv, ok := value.(string) 1287 if !ok { 1288 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1289 } 1290 sv.JobOutputPath = ptr.String(jtv) 1291 } 1292 1293 case "OutputLocation": 1294 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 1295 return err 1296 } 1297 1298 case "RetrievalByteRange": 1299 if value != nil { 1300 jtv, ok := value.(string) 1301 if !ok { 1302 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1303 } 1304 sv.RetrievalByteRange = ptr.String(jtv) 1305 } 1306 1307 case "SelectParameters": 1308 if err := awsRestjson1_deserializeDocumentSelectParameters(&sv.SelectParameters, value); err != nil { 1309 return err 1310 } 1311 1312 case "SHA256TreeHash": 1313 if value != nil { 1314 jtv, ok := value.(string) 1315 if !ok { 1316 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1317 } 1318 sv.SHA256TreeHash = ptr.String(jtv) 1319 } 1320 1321 case "SNSTopic": 1322 if value != nil { 1323 jtv, ok := value.(string) 1324 if !ok { 1325 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1326 } 1327 sv.SNSTopic = ptr.String(jtv) 1328 } 1329 1330 case "StatusCode": 1331 if value != nil { 1332 jtv, ok := value.(string) 1333 if !ok { 1334 return fmt.Errorf("expected StatusCode to be of type string, got %T instead", value) 1335 } 1336 sv.StatusCode = types.StatusCode(jtv) 1337 } 1338 1339 case "StatusMessage": 1340 if value != nil { 1341 jtv, ok := value.(string) 1342 if !ok { 1343 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1344 } 1345 sv.StatusMessage = ptr.String(jtv) 1346 } 1347 1348 case "Tier": 1349 if value != nil { 1350 jtv, ok := value.(string) 1351 if !ok { 1352 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1353 } 1354 sv.Tier = ptr.String(jtv) 1355 } 1356 1357 case "VaultARN": 1358 if value != nil { 1359 jtv, ok := value.(string) 1360 if !ok { 1361 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1362 } 1363 sv.VaultARN = ptr.String(jtv) 1364 } 1365 1366 default: 1367 _, _ = key, value 1368 1369 } 1370 } 1371 *v = sv 1372 return nil 1373} 1374 1375type awsRestjson1_deserializeOpDescribeVault struct { 1376} 1377 1378func (*awsRestjson1_deserializeOpDescribeVault) ID() string { 1379 return "OperationDeserializer" 1380} 1381 1382func (m *awsRestjson1_deserializeOpDescribeVault) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1383 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1384) { 1385 out, metadata, err = next.HandleDeserialize(ctx, in) 1386 if err != nil { 1387 return out, metadata, err 1388 } 1389 1390 response, ok := out.RawResponse.(*smithyhttp.Response) 1391 if !ok { 1392 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1393 } 1394 1395 if response.StatusCode < 200 || response.StatusCode >= 300 { 1396 return out, metadata, awsRestjson1_deserializeOpErrorDescribeVault(response, &metadata) 1397 } 1398 output := &DescribeVaultOutput{} 1399 out.Result = output 1400 1401 var buff [1024]byte 1402 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1403 1404 body := io.TeeReader(response.Body, ringBuffer) 1405 1406 decoder := json.NewDecoder(body) 1407 decoder.UseNumber() 1408 var shape interface{} 1409 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1410 var snapshot bytes.Buffer 1411 io.Copy(&snapshot, ringBuffer) 1412 err = &smithy.DeserializationError{ 1413 Err: fmt.Errorf("failed to decode response body, %w", err), 1414 Snapshot: snapshot.Bytes(), 1415 } 1416 return out, metadata, err 1417 } 1418 1419 err = awsRestjson1_deserializeOpDocumentDescribeVaultOutput(&output, shape) 1420 if err != nil { 1421 var snapshot bytes.Buffer 1422 io.Copy(&snapshot, ringBuffer) 1423 return out, metadata, &smithy.DeserializationError{ 1424 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1425 Snapshot: snapshot.Bytes(), 1426 } 1427 } 1428 1429 return out, metadata, err 1430} 1431 1432func awsRestjson1_deserializeOpErrorDescribeVault(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1433 var errorBuffer bytes.Buffer 1434 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1435 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1436 } 1437 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1438 1439 errorCode := "UnknownError" 1440 errorMessage := errorCode 1441 1442 code := response.Header.Get("X-Amzn-ErrorType") 1443 if len(code) != 0 { 1444 errorCode = restjson.SanitizeErrorCode(code) 1445 } 1446 1447 var buff [1024]byte 1448 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1449 1450 body := io.TeeReader(errorBody, ringBuffer) 1451 decoder := json.NewDecoder(body) 1452 decoder.UseNumber() 1453 code, message, err := restjson.GetErrorInfo(decoder) 1454 if err != nil { 1455 var snapshot bytes.Buffer 1456 io.Copy(&snapshot, ringBuffer) 1457 err = &smithy.DeserializationError{ 1458 Err: fmt.Errorf("failed to decode response body, %w", err), 1459 Snapshot: snapshot.Bytes(), 1460 } 1461 return err 1462 } 1463 1464 errorBody.Seek(0, io.SeekStart) 1465 if len(code) != 0 { 1466 errorCode = restjson.SanitizeErrorCode(code) 1467 } 1468 if len(message) != 0 { 1469 errorMessage = message 1470 } 1471 1472 switch { 1473 case strings.EqualFold("InvalidParameterValueException", errorCode): 1474 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 1475 1476 case strings.EqualFold("MissingParameterValueException", errorCode): 1477 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 1478 1479 case strings.EqualFold("ResourceNotFoundException", errorCode): 1480 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1481 1482 case strings.EqualFold("ServiceUnavailableException", errorCode): 1483 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1484 1485 default: 1486 genericError := &smithy.GenericAPIError{ 1487 Code: errorCode, 1488 Message: errorMessage, 1489 } 1490 return genericError 1491 1492 } 1493} 1494 1495func awsRestjson1_deserializeOpDocumentDescribeVaultOutput(v **DescribeVaultOutput, value interface{}) error { 1496 if v == nil { 1497 return fmt.Errorf("unexpected nil of type %T", v) 1498 } 1499 if value == nil { 1500 return nil 1501 } 1502 1503 shape, ok := value.(map[string]interface{}) 1504 if !ok { 1505 return fmt.Errorf("unexpected JSON type %v", value) 1506 } 1507 1508 var sv *DescribeVaultOutput 1509 if *v == nil { 1510 sv = &DescribeVaultOutput{} 1511 } else { 1512 sv = *v 1513 } 1514 1515 for key, value := range shape { 1516 switch key { 1517 case "CreationDate": 1518 if value != nil { 1519 jtv, ok := value.(string) 1520 if !ok { 1521 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1522 } 1523 sv.CreationDate = ptr.String(jtv) 1524 } 1525 1526 case "LastInventoryDate": 1527 if value != nil { 1528 jtv, ok := value.(string) 1529 if !ok { 1530 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1531 } 1532 sv.LastInventoryDate = ptr.String(jtv) 1533 } 1534 1535 case "NumberOfArchives": 1536 if value != nil { 1537 jtv, ok := value.(json.Number) 1538 if !ok { 1539 return fmt.Errorf("expected long to be json.Number, got %T instead", value) 1540 } 1541 i64, err := jtv.Int64() 1542 if err != nil { 1543 return err 1544 } 1545 sv.NumberOfArchives = i64 1546 } 1547 1548 case "SizeInBytes": 1549 if value != nil { 1550 jtv, ok := value.(json.Number) 1551 if !ok { 1552 return fmt.Errorf("expected long to be json.Number, got %T instead", value) 1553 } 1554 i64, err := jtv.Int64() 1555 if err != nil { 1556 return err 1557 } 1558 sv.SizeInBytes = i64 1559 } 1560 1561 case "VaultARN": 1562 if value != nil { 1563 jtv, ok := value.(string) 1564 if !ok { 1565 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1566 } 1567 sv.VaultARN = ptr.String(jtv) 1568 } 1569 1570 case "VaultName": 1571 if value != nil { 1572 jtv, ok := value.(string) 1573 if !ok { 1574 return fmt.Errorf("expected string to be of type string, got %T instead", value) 1575 } 1576 sv.VaultName = ptr.String(jtv) 1577 } 1578 1579 default: 1580 _, _ = key, value 1581 1582 } 1583 } 1584 *v = sv 1585 return nil 1586} 1587 1588type awsRestjson1_deserializeOpGetDataRetrievalPolicy struct { 1589} 1590 1591func (*awsRestjson1_deserializeOpGetDataRetrievalPolicy) ID() string { 1592 return "OperationDeserializer" 1593} 1594 1595func (m *awsRestjson1_deserializeOpGetDataRetrievalPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1596 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1597) { 1598 out, metadata, err = next.HandleDeserialize(ctx, in) 1599 if err != nil { 1600 return out, metadata, err 1601 } 1602 1603 response, ok := out.RawResponse.(*smithyhttp.Response) 1604 if !ok { 1605 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1606 } 1607 1608 if response.StatusCode < 200 || response.StatusCode >= 300 { 1609 return out, metadata, awsRestjson1_deserializeOpErrorGetDataRetrievalPolicy(response, &metadata) 1610 } 1611 output := &GetDataRetrievalPolicyOutput{} 1612 out.Result = output 1613 1614 var buff [1024]byte 1615 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1616 1617 body := io.TeeReader(response.Body, ringBuffer) 1618 1619 decoder := json.NewDecoder(body) 1620 decoder.UseNumber() 1621 var shape interface{} 1622 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1623 var snapshot bytes.Buffer 1624 io.Copy(&snapshot, ringBuffer) 1625 err = &smithy.DeserializationError{ 1626 Err: fmt.Errorf("failed to decode response body, %w", err), 1627 Snapshot: snapshot.Bytes(), 1628 } 1629 return out, metadata, err 1630 } 1631 1632 err = awsRestjson1_deserializeOpDocumentGetDataRetrievalPolicyOutput(&output, shape) 1633 if err != nil { 1634 var snapshot bytes.Buffer 1635 io.Copy(&snapshot, ringBuffer) 1636 return out, metadata, &smithy.DeserializationError{ 1637 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1638 Snapshot: snapshot.Bytes(), 1639 } 1640 } 1641 1642 return out, metadata, err 1643} 1644 1645func awsRestjson1_deserializeOpErrorGetDataRetrievalPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1646 var errorBuffer bytes.Buffer 1647 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1648 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1649 } 1650 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1651 1652 errorCode := "UnknownError" 1653 errorMessage := errorCode 1654 1655 code := response.Header.Get("X-Amzn-ErrorType") 1656 if len(code) != 0 { 1657 errorCode = restjson.SanitizeErrorCode(code) 1658 } 1659 1660 var buff [1024]byte 1661 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1662 1663 body := io.TeeReader(errorBody, ringBuffer) 1664 decoder := json.NewDecoder(body) 1665 decoder.UseNumber() 1666 code, message, err := restjson.GetErrorInfo(decoder) 1667 if err != nil { 1668 var snapshot bytes.Buffer 1669 io.Copy(&snapshot, ringBuffer) 1670 err = &smithy.DeserializationError{ 1671 Err: fmt.Errorf("failed to decode response body, %w", err), 1672 Snapshot: snapshot.Bytes(), 1673 } 1674 return err 1675 } 1676 1677 errorBody.Seek(0, io.SeekStart) 1678 if len(code) != 0 { 1679 errorCode = restjson.SanitizeErrorCode(code) 1680 } 1681 if len(message) != 0 { 1682 errorMessage = message 1683 } 1684 1685 switch { 1686 case strings.EqualFold("InvalidParameterValueException", errorCode): 1687 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 1688 1689 case strings.EqualFold("MissingParameterValueException", errorCode): 1690 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 1691 1692 case strings.EqualFold("ServiceUnavailableException", errorCode): 1693 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1694 1695 default: 1696 genericError := &smithy.GenericAPIError{ 1697 Code: errorCode, 1698 Message: errorMessage, 1699 } 1700 return genericError 1701 1702 } 1703} 1704 1705func awsRestjson1_deserializeOpDocumentGetDataRetrievalPolicyOutput(v **GetDataRetrievalPolicyOutput, value interface{}) error { 1706 if v == nil { 1707 return fmt.Errorf("unexpected nil of type %T", v) 1708 } 1709 if value == nil { 1710 return nil 1711 } 1712 1713 shape, ok := value.(map[string]interface{}) 1714 if !ok { 1715 return fmt.Errorf("unexpected JSON type %v", value) 1716 } 1717 1718 var sv *GetDataRetrievalPolicyOutput 1719 if *v == nil { 1720 sv = &GetDataRetrievalPolicyOutput{} 1721 } else { 1722 sv = *v 1723 } 1724 1725 for key, value := range shape { 1726 switch key { 1727 case "Policy": 1728 if err := awsRestjson1_deserializeDocumentDataRetrievalPolicy(&sv.Policy, value); err != nil { 1729 return err 1730 } 1731 1732 default: 1733 _, _ = key, value 1734 1735 } 1736 } 1737 *v = sv 1738 return nil 1739} 1740 1741type awsRestjson1_deserializeOpGetJobOutput struct { 1742} 1743 1744func (*awsRestjson1_deserializeOpGetJobOutput) ID() string { 1745 return "OperationDeserializer" 1746} 1747 1748func (m *awsRestjson1_deserializeOpGetJobOutput) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1749 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1750) { 1751 out, metadata, err = next.HandleDeserialize(ctx, in) 1752 if err != nil { 1753 return out, metadata, err 1754 } 1755 1756 response, ok := out.RawResponse.(*smithyhttp.Response) 1757 if !ok { 1758 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1759 } 1760 1761 if response.StatusCode < 200 || response.StatusCode >= 300 { 1762 return out, metadata, awsRestjson1_deserializeOpErrorGetJobOutput(response, &metadata) 1763 } 1764 output := &GetJobOutputOutput{} 1765 out.Result = output 1766 1767 err = awsRestjson1_deserializeOpHttpBindingsGetJobOutputOutput(output, response) 1768 if err != nil { 1769 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 1770 } 1771 1772 err = awsRestjson1_deserializeOpDocumentGetJobOutputOutput(output, response.Body) 1773 if err != nil { 1774 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 1775 } 1776 1777 return out, metadata, err 1778} 1779 1780func awsRestjson1_deserializeOpErrorGetJobOutput(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1781 var errorBuffer bytes.Buffer 1782 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1783 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1784 } 1785 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1786 1787 errorCode := "UnknownError" 1788 errorMessage := errorCode 1789 1790 code := response.Header.Get("X-Amzn-ErrorType") 1791 if len(code) != 0 { 1792 errorCode = restjson.SanitizeErrorCode(code) 1793 } 1794 1795 var buff [1024]byte 1796 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1797 1798 body := io.TeeReader(errorBody, ringBuffer) 1799 decoder := json.NewDecoder(body) 1800 decoder.UseNumber() 1801 code, message, err := restjson.GetErrorInfo(decoder) 1802 if err != nil { 1803 var snapshot bytes.Buffer 1804 io.Copy(&snapshot, ringBuffer) 1805 err = &smithy.DeserializationError{ 1806 Err: fmt.Errorf("failed to decode response body, %w", err), 1807 Snapshot: snapshot.Bytes(), 1808 } 1809 return err 1810 } 1811 1812 errorBody.Seek(0, io.SeekStart) 1813 if len(code) != 0 { 1814 errorCode = restjson.SanitizeErrorCode(code) 1815 } 1816 if len(message) != 0 { 1817 errorMessage = message 1818 } 1819 1820 switch { 1821 case strings.EqualFold("InvalidParameterValueException", errorCode): 1822 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 1823 1824 case strings.EqualFold("MissingParameterValueException", errorCode): 1825 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 1826 1827 case strings.EqualFold("ResourceNotFoundException", errorCode): 1828 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1829 1830 case strings.EqualFold("ServiceUnavailableException", errorCode): 1831 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1832 1833 default: 1834 genericError := &smithy.GenericAPIError{ 1835 Code: errorCode, 1836 Message: errorMessage, 1837 } 1838 return genericError 1839 1840 } 1841} 1842 1843func awsRestjson1_deserializeOpHttpBindingsGetJobOutputOutput(v *GetJobOutputOutput, response *smithyhttp.Response) error { 1844 if v == nil { 1845 return fmt.Errorf("unsupported deserialization for nil %T", v) 1846 } 1847 1848 if headerValues := response.Header.Values("Accept-Ranges"); len(headerValues) != 0 { 1849 headerValues[0] = strings.TrimSpace(headerValues[0]) 1850 v.AcceptRanges = ptr.String(headerValues[0]) 1851 } 1852 1853 if headerValues := response.Header.Values("x-amz-archive-description"); len(headerValues) != 0 { 1854 headerValues[0] = strings.TrimSpace(headerValues[0]) 1855 v.ArchiveDescription = ptr.String(headerValues[0]) 1856 } 1857 1858 if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 { 1859 headerValues[0] = strings.TrimSpace(headerValues[0]) 1860 v.Checksum = ptr.String(headerValues[0]) 1861 } 1862 1863 if headerValues := response.Header.Values("Content-Range"); len(headerValues) != 0 { 1864 headerValues[0] = strings.TrimSpace(headerValues[0]) 1865 v.ContentRange = ptr.String(headerValues[0]) 1866 } 1867 1868 if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 { 1869 headerValues[0] = strings.TrimSpace(headerValues[0]) 1870 v.ContentType = ptr.String(headerValues[0]) 1871 } 1872 1873 v.Status = int32(response.StatusCode) 1874 1875 return nil 1876} 1877func awsRestjson1_deserializeOpDocumentGetJobOutputOutput(v *GetJobOutputOutput, body io.ReadCloser) error { 1878 if v == nil { 1879 return fmt.Errorf("unsupported deserialization of nil %T", v) 1880 } 1881 1882 v.Body = body 1883 return nil 1884} 1885 1886type awsRestjson1_deserializeOpGetVaultAccessPolicy struct { 1887} 1888 1889func (*awsRestjson1_deserializeOpGetVaultAccessPolicy) ID() string { 1890 return "OperationDeserializer" 1891} 1892 1893func (m *awsRestjson1_deserializeOpGetVaultAccessPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1894 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1895) { 1896 out, metadata, err = next.HandleDeserialize(ctx, in) 1897 if err != nil { 1898 return out, metadata, err 1899 } 1900 1901 response, ok := out.RawResponse.(*smithyhttp.Response) 1902 if !ok { 1903 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1904 } 1905 1906 if response.StatusCode < 200 || response.StatusCode >= 300 { 1907 return out, metadata, awsRestjson1_deserializeOpErrorGetVaultAccessPolicy(response, &metadata) 1908 } 1909 output := &GetVaultAccessPolicyOutput{} 1910 out.Result = output 1911 1912 var buff [1024]byte 1913 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1914 1915 body := io.TeeReader(response.Body, ringBuffer) 1916 1917 decoder := json.NewDecoder(body) 1918 decoder.UseNumber() 1919 var shape interface{} 1920 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1921 var snapshot bytes.Buffer 1922 io.Copy(&snapshot, ringBuffer) 1923 err = &smithy.DeserializationError{ 1924 Err: fmt.Errorf("failed to decode response body, %w", err), 1925 Snapshot: snapshot.Bytes(), 1926 } 1927 return out, metadata, err 1928 } 1929 1930 err = awsRestjson1_deserializeDocumentVaultAccessPolicy(&output.Policy, shape) 1931 if err != nil { 1932 var snapshot bytes.Buffer 1933 io.Copy(&snapshot, ringBuffer) 1934 return out, metadata, &smithy.DeserializationError{ 1935 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1936 Snapshot: snapshot.Bytes(), 1937 } 1938 } 1939 1940 return out, metadata, err 1941} 1942 1943func awsRestjson1_deserializeOpErrorGetVaultAccessPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1944 var errorBuffer bytes.Buffer 1945 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1946 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1947 } 1948 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1949 1950 errorCode := "UnknownError" 1951 errorMessage := errorCode 1952 1953 code := response.Header.Get("X-Amzn-ErrorType") 1954 if len(code) != 0 { 1955 errorCode = restjson.SanitizeErrorCode(code) 1956 } 1957 1958 var buff [1024]byte 1959 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1960 1961 body := io.TeeReader(errorBody, ringBuffer) 1962 decoder := json.NewDecoder(body) 1963 decoder.UseNumber() 1964 code, message, err := restjson.GetErrorInfo(decoder) 1965 if err != nil { 1966 var snapshot bytes.Buffer 1967 io.Copy(&snapshot, ringBuffer) 1968 err = &smithy.DeserializationError{ 1969 Err: fmt.Errorf("failed to decode response body, %w", err), 1970 Snapshot: snapshot.Bytes(), 1971 } 1972 return err 1973 } 1974 1975 errorBody.Seek(0, io.SeekStart) 1976 if len(code) != 0 { 1977 errorCode = restjson.SanitizeErrorCode(code) 1978 } 1979 if len(message) != 0 { 1980 errorMessage = message 1981 } 1982 1983 switch { 1984 case strings.EqualFold("InvalidParameterValueException", errorCode): 1985 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 1986 1987 case strings.EqualFold("MissingParameterValueException", errorCode): 1988 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 1989 1990 case strings.EqualFold("ResourceNotFoundException", errorCode): 1991 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1992 1993 case strings.EqualFold("ServiceUnavailableException", errorCode): 1994 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 1995 1996 default: 1997 genericError := &smithy.GenericAPIError{ 1998 Code: errorCode, 1999 Message: errorMessage, 2000 } 2001 return genericError 2002 2003 } 2004} 2005 2006func awsRestjson1_deserializeOpDocumentGetVaultAccessPolicyOutput(v **GetVaultAccessPolicyOutput, value interface{}) error { 2007 if v == nil { 2008 return fmt.Errorf("unexpected nil of type %T", v) 2009 } 2010 if value == nil { 2011 return nil 2012 } 2013 2014 shape, ok := value.(map[string]interface{}) 2015 if !ok { 2016 return fmt.Errorf("unexpected JSON type %v", value) 2017 } 2018 2019 var sv *GetVaultAccessPolicyOutput 2020 if *v == nil { 2021 sv = &GetVaultAccessPolicyOutput{} 2022 } else { 2023 sv = *v 2024 } 2025 2026 for key, value := range shape { 2027 switch key { 2028 case "policy": 2029 if err := awsRestjson1_deserializeDocumentVaultAccessPolicy(&sv.Policy, value); err != nil { 2030 return err 2031 } 2032 2033 default: 2034 _, _ = key, value 2035 2036 } 2037 } 2038 *v = sv 2039 return nil 2040} 2041 2042type awsRestjson1_deserializeOpGetVaultLock struct { 2043} 2044 2045func (*awsRestjson1_deserializeOpGetVaultLock) ID() string { 2046 return "OperationDeserializer" 2047} 2048 2049func (m *awsRestjson1_deserializeOpGetVaultLock) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2050 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2051) { 2052 out, metadata, err = next.HandleDeserialize(ctx, in) 2053 if err != nil { 2054 return out, metadata, err 2055 } 2056 2057 response, ok := out.RawResponse.(*smithyhttp.Response) 2058 if !ok { 2059 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2060 } 2061 2062 if response.StatusCode < 200 || response.StatusCode >= 300 { 2063 return out, metadata, awsRestjson1_deserializeOpErrorGetVaultLock(response, &metadata) 2064 } 2065 output := &GetVaultLockOutput{} 2066 out.Result = output 2067 2068 var buff [1024]byte 2069 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2070 2071 body := io.TeeReader(response.Body, ringBuffer) 2072 2073 decoder := json.NewDecoder(body) 2074 decoder.UseNumber() 2075 var shape interface{} 2076 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2077 var snapshot bytes.Buffer 2078 io.Copy(&snapshot, ringBuffer) 2079 err = &smithy.DeserializationError{ 2080 Err: fmt.Errorf("failed to decode response body, %w", err), 2081 Snapshot: snapshot.Bytes(), 2082 } 2083 return out, metadata, err 2084 } 2085 2086 err = awsRestjson1_deserializeOpDocumentGetVaultLockOutput(&output, shape) 2087 if err != nil { 2088 var snapshot bytes.Buffer 2089 io.Copy(&snapshot, ringBuffer) 2090 return out, metadata, &smithy.DeserializationError{ 2091 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2092 Snapshot: snapshot.Bytes(), 2093 } 2094 } 2095 2096 return out, metadata, err 2097} 2098 2099func awsRestjson1_deserializeOpErrorGetVaultLock(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2100 var errorBuffer bytes.Buffer 2101 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2102 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2103 } 2104 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2105 2106 errorCode := "UnknownError" 2107 errorMessage := errorCode 2108 2109 code := response.Header.Get("X-Amzn-ErrorType") 2110 if len(code) != 0 { 2111 errorCode = restjson.SanitizeErrorCode(code) 2112 } 2113 2114 var buff [1024]byte 2115 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2116 2117 body := io.TeeReader(errorBody, ringBuffer) 2118 decoder := json.NewDecoder(body) 2119 decoder.UseNumber() 2120 code, message, err := restjson.GetErrorInfo(decoder) 2121 if err != nil { 2122 var snapshot bytes.Buffer 2123 io.Copy(&snapshot, ringBuffer) 2124 err = &smithy.DeserializationError{ 2125 Err: fmt.Errorf("failed to decode response body, %w", err), 2126 Snapshot: snapshot.Bytes(), 2127 } 2128 return err 2129 } 2130 2131 errorBody.Seek(0, io.SeekStart) 2132 if len(code) != 0 { 2133 errorCode = restjson.SanitizeErrorCode(code) 2134 } 2135 if len(message) != 0 { 2136 errorMessage = message 2137 } 2138 2139 switch { 2140 case strings.EqualFold("InvalidParameterValueException", errorCode): 2141 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 2142 2143 case strings.EqualFold("MissingParameterValueException", errorCode): 2144 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 2145 2146 case strings.EqualFold("ResourceNotFoundException", errorCode): 2147 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2148 2149 case strings.EqualFold("ServiceUnavailableException", errorCode): 2150 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2151 2152 default: 2153 genericError := &smithy.GenericAPIError{ 2154 Code: errorCode, 2155 Message: errorMessage, 2156 } 2157 return genericError 2158 2159 } 2160} 2161 2162func awsRestjson1_deserializeOpDocumentGetVaultLockOutput(v **GetVaultLockOutput, value interface{}) error { 2163 if v == nil { 2164 return fmt.Errorf("unexpected nil of type %T", v) 2165 } 2166 if value == nil { 2167 return nil 2168 } 2169 2170 shape, ok := value.(map[string]interface{}) 2171 if !ok { 2172 return fmt.Errorf("unexpected JSON type %v", value) 2173 } 2174 2175 var sv *GetVaultLockOutput 2176 if *v == nil { 2177 sv = &GetVaultLockOutput{} 2178 } else { 2179 sv = *v 2180 } 2181 2182 for key, value := range shape { 2183 switch key { 2184 case "CreationDate": 2185 if value != nil { 2186 jtv, ok := value.(string) 2187 if !ok { 2188 return fmt.Errorf("expected string to be of type string, got %T instead", value) 2189 } 2190 sv.CreationDate = ptr.String(jtv) 2191 } 2192 2193 case "ExpirationDate": 2194 if value != nil { 2195 jtv, ok := value.(string) 2196 if !ok { 2197 return fmt.Errorf("expected string to be of type string, got %T instead", value) 2198 } 2199 sv.ExpirationDate = ptr.String(jtv) 2200 } 2201 2202 case "Policy": 2203 if value != nil { 2204 jtv, ok := value.(string) 2205 if !ok { 2206 return fmt.Errorf("expected string to be of type string, got %T instead", value) 2207 } 2208 sv.Policy = ptr.String(jtv) 2209 } 2210 2211 case "State": 2212 if value != nil { 2213 jtv, ok := value.(string) 2214 if !ok { 2215 return fmt.Errorf("expected string to be of type string, got %T instead", value) 2216 } 2217 sv.State = ptr.String(jtv) 2218 } 2219 2220 default: 2221 _, _ = key, value 2222 2223 } 2224 } 2225 *v = sv 2226 return nil 2227} 2228 2229type awsRestjson1_deserializeOpGetVaultNotifications struct { 2230} 2231 2232func (*awsRestjson1_deserializeOpGetVaultNotifications) ID() string { 2233 return "OperationDeserializer" 2234} 2235 2236func (m *awsRestjson1_deserializeOpGetVaultNotifications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2237 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2238) { 2239 out, metadata, err = next.HandleDeserialize(ctx, in) 2240 if err != nil { 2241 return out, metadata, err 2242 } 2243 2244 response, ok := out.RawResponse.(*smithyhttp.Response) 2245 if !ok { 2246 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2247 } 2248 2249 if response.StatusCode < 200 || response.StatusCode >= 300 { 2250 return out, metadata, awsRestjson1_deserializeOpErrorGetVaultNotifications(response, &metadata) 2251 } 2252 output := &GetVaultNotificationsOutput{} 2253 out.Result = output 2254 2255 var buff [1024]byte 2256 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2257 2258 body := io.TeeReader(response.Body, ringBuffer) 2259 2260 decoder := json.NewDecoder(body) 2261 decoder.UseNumber() 2262 var shape interface{} 2263 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2264 var snapshot bytes.Buffer 2265 io.Copy(&snapshot, ringBuffer) 2266 err = &smithy.DeserializationError{ 2267 Err: fmt.Errorf("failed to decode response body, %w", err), 2268 Snapshot: snapshot.Bytes(), 2269 } 2270 return out, metadata, err 2271 } 2272 2273 err = awsRestjson1_deserializeDocumentVaultNotificationConfig(&output.VaultNotificationConfig, shape) 2274 if err != nil { 2275 var snapshot bytes.Buffer 2276 io.Copy(&snapshot, ringBuffer) 2277 return out, metadata, &smithy.DeserializationError{ 2278 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2279 Snapshot: snapshot.Bytes(), 2280 } 2281 } 2282 2283 return out, metadata, err 2284} 2285 2286func awsRestjson1_deserializeOpErrorGetVaultNotifications(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2287 var errorBuffer bytes.Buffer 2288 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2289 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2290 } 2291 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2292 2293 errorCode := "UnknownError" 2294 errorMessage := errorCode 2295 2296 code := response.Header.Get("X-Amzn-ErrorType") 2297 if len(code) != 0 { 2298 errorCode = restjson.SanitizeErrorCode(code) 2299 } 2300 2301 var buff [1024]byte 2302 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2303 2304 body := io.TeeReader(errorBody, ringBuffer) 2305 decoder := json.NewDecoder(body) 2306 decoder.UseNumber() 2307 code, message, err := restjson.GetErrorInfo(decoder) 2308 if err != nil { 2309 var snapshot bytes.Buffer 2310 io.Copy(&snapshot, ringBuffer) 2311 err = &smithy.DeserializationError{ 2312 Err: fmt.Errorf("failed to decode response body, %w", err), 2313 Snapshot: snapshot.Bytes(), 2314 } 2315 return err 2316 } 2317 2318 errorBody.Seek(0, io.SeekStart) 2319 if len(code) != 0 { 2320 errorCode = restjson.SanitizeErrorCode(code) 2321 } 2322 if len(message) != 0 { 2323 errorMessage = message 2324 } 2325 2326 switch { 2327 case strings.EqualFold("InvalidParameterValueException", errorCode): 2328 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 2329 2330 case strings.EqualFold("MissingParameterValueException", errorCode): 2331 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 2332 2333 case strings.EqualFold("ResourceNotFoundException", errorCode): 2334 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2335 2336 case strings.EqualFold("ServiceUnavailableException", errorCode): 2337 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2338 2339 default: 2340 genericError := &smithy.GenericAPIError{ 2341 Code: errorCode, 2342 Message: errorMessage, 2343 } 2344 return genericError 2345 2346 } 2347} 2348 2349func awsRestjson1_deserializeOpDocumentGetVaultNotificationsOutput(v **GetVaultNotificationsOutput, value interface{}) error { 2350 if v == nil { 2351 return fmt.Errorf("unexpected nil of type %T", v) 2352 } 2353 if value == nil { 2354 return nil 2355 } 2356 2357 shape, ok := value.(map[string]interface{}) 2358 if !ok { 2359 return fmt.Errorf("unexpected JSON type %v", value) 2360 } 2361 2362 var sv *GetVaultNotificationsOutput 2363 if *v == nil { 2364 sv = &GetVaultNotificationsOutput{} 2365 } else { 2366 sv = *v 2367 } 2368 2369 for key, value := range shape { 2370 switch key { 2371 case "vaultNotificationConfig": 2372 if err := awsRestjson1_deserializeDocumentVaultNotificationConfig(&sv.VaultNotificationConfig, value); err != nil { 2373 return err 2374 } 2375 2376 default: 2377 _, _ = key, value 2378 2379 } 2380 } 2381 *v = sv 2382 return nil 2383} 2384 2385type awsRestjson1_deserializeOpInitiateJob struct { 2386} 2387 2388func (*awsRestjson1_deserializeOpInitiateJob) ID() string { 2389 return "OperationDeserializer" 2390} 2391 2392func (m *awsRestjson1_deserializeOpInitiateJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2393 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2394) { 2395 out, metadata, err = next.HandleDeserialize(ctx, in) 2396 if err != nil { 2397 return out, metadata, err 2398 } 2399 2400 response, ok := out.RawResponse.(*smithyhttp.Response) 2401 if !ok { 2402 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2403 } 2404 2405 if response.StatusCode < 200 || response.StatusCode >= 300 { 2406 return out, metadata, awsRestjson1_deserializeOpErrorInitiateJob(response, &metadata) 2407 } 2408 output := &InitiateJobOutput{} 2409 out.Result = output 2410 2411 err = awsRestjson1_deserializeOpHttpBindingsInitiateJobOutput(output, response) 2412 if err != nil { 2413 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 2414 } 2415 2416 return out, metadata, err 2417} 2418 2419func awsRestjson1_deserializeOpErrorInitiateJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2420 var errorBuffer bytes.Buffer 2421 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2422 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2423 } 2424 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2425 2426 errorCode := "UnknownError" 2427 errorMessage := errorCode 2428 2429 code := response.Header.Get("X-Amzn-ErrorType") 2430 if len(code) != 0 { 2431 errorCode = restjson.SanitizeErrorCode(code) 2432 } 2433 2434 var buff [1024]byte 2435 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2436 2437 body := io.TeeReader(errorBody, ringBuffer) 2438 decoder := json.NewDecoder(body) 2439 decoder.UseNumber() 2440 code, message, err := restjson.GetErrorInfo(decoder) 2441 if err != nil { 2442 var snapshot bytes.Buffer 2443 io.Copy(&snapshot, ringBuffer) 2444 err = &smithy.DeserializationError{ 2445 Err: fmt.Errorf("failed to decode response body, %w", err), 2446 Snapshot: snapshot.Bytes(), 2447 } 2448 return err 2449 } 2450 2451 errorBody.Seek(0, io.SeekStart) 2452 if len(code) != 0 { 2453 errorCode = restjson.SanitizeErrorCode(code) 2454 } 2455 if len(message) != 0 { 2456 errorMessage = message 2457 } 2458 2459 switch { 2460 case strings.EqualFold("InsufficientCapacityException", errorCode): 2461 return awsRestjson1_deserializeErrorInsufficientCapacityException(response, errorBody) 2462 2463 case strings.EqualFold("InvalidParameterValueException", errorCode): 2464 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 2465 2466 case strings.EqualFold("MissingParameterValueException", errorCode): 2467 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 2468 2469 case strings.EqualFold("PolicyEnforcedException", errorCode): 2470 return awsRestjson1_deserializeErrorPolicyEnforcedException(response, errorBody) 2471 2472 case strings.EqualFold("ResourceNotFoundException", errorCode): 2473 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2474 2475 case strings.EqualFold("ServiceUnavailableException", errorCode): 2476 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2477 2478 default: 2479 genericError := &smithy.GenericAPIError{ 2480 Code: errorCode, 2481 Message: errorMessage, 2482 } 2483 return genericError 2484 2485 } 2486} 2487 2488func awsRestjson1_deserializeOpHttpBindingsInitiateJobOutput(v *InitiateJobOutput, response *smithyhttp.Response) error { 2489 if v == nil { 2490 return fmt.Errorf("unsupported deserialization for nil %T", v) 2491 } 2492 2493 if headerValues := response.Header.Values("x-amz-job-id"); len(headerValues) != 0 { 2494 headerValues[0] = strings.TrimSpace(headerValues[0]) 2495 v.JobId = ptr.String(headerValues[0]) 2496 } 2497 2498 if headerValues := response.Header.Values("x-amz-job-output-path"); len(headerValues) != 0 { 2499 headerValues[0] = strings.TrimSpace(headerValues[0]) 2500 v.JobOutputPath = ptr.String(headerValues[0]) 2501 } 2502 2503 if headerValues := response.Header.Values("Location"); len(headerValues) != 0 { 2504 headerValues[0] = strings.TrimSpace(headerValues[0]) 2505 v.Location = ptr.String(headerValues[0]) 2506 } 2507 2508 return nil 2509} 2510 2511type awsRestjson1_deserializeOpInitiateMultipartUpload struct { 2512} 2513 2514func (*awsRestjson1_deserializeOpInitiateMultipartUpload) ID() string { 2515 return "OperationDeserializer" 2516} 2517 2518func (m *awsRestjson1_deserializeOpInitiateMultipartUpload) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2519 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2520) { 2521 out, metadata, err = next.HandleDeserialize(ctx, in) 2522 if err != nil { 2523 return out, metadata, err 2524 } 2525 2526 response, ok := out.RawResponse.(*smithyhttp.Response) 2527 if !ok { 2528 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2529 } 2530 2531 if response.StatusCode < 200 || response.StatusCode >= 300 { 2532 return out, metadata, awsRestjson1_deserializeOpErrorInitiateMultipartUpload(response, &metadata) 2533 } 2534 output := &InitiateMultipartUploadOutput{} 2535 out.Result = output 2536 2537 err = awsRestjson1_deserializeOpHttpBindingsInitiateMultipartUploadOutput(output, response) 2538 if err != nil { 2539 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 2540 } 2541 2542 return out, metadata, err 2543} 2544 2545func awsRestjson1_deserializeOpErrorInitiateMultipartUpload(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2546 var errorBuffer bytes.Buffer 2547 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2548 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2549 } 2550 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2551 2552 errorCode := "UnknownError" 2553 errorMessage := errorCode 2554 2555 code := response.Header.Get("X-Amzn-ErrorType") 2556 if len(code) != 0 { 2557 errorCode = restjson.SanitizeErrorCode(code) 2558 } 2559 2560 var buff [1024]byte 2561 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2562 2563 body := io.TeeReader(errorBody, ringBuffer) 2564 decoder := json.NewDecoder(body) 2565 decoder.UseNumber() 2566 code, message, err := restjson.GetErrorInfo(decoder) 2567 if err != nil { 2568 var snapshot bytes.Buffer 2569 io.Copy(&snapshot, ringBuffer) 2570 err = &smithy.DeserializationError{ 2571 Err: fmt.Errorf("failed to decode response body, %w", err), 2572 Snapshot: snapshot.Bytes(), 2573 } 2574 return err 2575 } 2576 2577 errorBody.Seek(0, io.SeekStart) 2578 if len(code) != 0 { 2579 errorCode = restjson.SanitizeErrorCode(code) 2580 } 2581 if len(message) != 0 { 2582 errorMessage = message 2583 } 2584 2585 switch { 2586 case strings.EqualFold("InvalidParameterValueException", errorCode): 2587 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 2588 2589 case strings.EqualFold("MissingParameterValueException", errorCode): 2590 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 2591 2592 case strings.EqualFold("ResourceNotFoundException", errorCode): 2593 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2594 2595 case strings.EqualFold("ServiceUnavailableException", errorCode): 2596 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2597 2598 default: 2599 genericError := &smithy.GenericAPIError{ 2600 Code: errorCode, 2601 Message: errorMessage, 2602 } 2603 return genericError 2604 2605 } 2606} 2607 2608func awsRestjson1_deserializeOpHttpBindingsInitiateMultipartUploadOutput(v *InitiateMultipartUploadOutput, response *smithyhttp.Response) error { 2609 if v == nil { 2610 return fmt.Errorf("unsupported deserialization for nil %T", v) 2611 } 2612 2613 if headerValues := response.Header.Values("Location"); len(headerValues) != 0 { 2614 headerValues[0] = strings.TrimSpace(headerValues[0]) 2615 v.Location = ptr.String(headerValues[0]) 2616 } 2617 2618 if headerValues := response.Header.Values("x-amz-multipart-upload-id"); len(headerValues) != 0 { 2619 headerValues[0] = strings.TrimSpace(headerValues[0]) 2620 v.UploadId = ptr.String(headerValues[0]) 2621 } 2622 2623 return nil 2624} 2625 2626type awsRestjson1_deserializeOpInitiateVaultLock struct { 2627} 2628 2629func (*awsRestjson1_deserializeOpInitiateVaultLock) ID() string { 2630 return "OperationDeserializer" 2631} 2632 2633func (m *awsRestjson1_deserializeOpInitiateVaultLock) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2634 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2635) { 2636 out, metadata, err = next.HandleDeserialize(ctx, in) 2637 if err != nil { 2638 return out, metadata, err 2639 } 2640 2641 response, ok := out.RawResponse.(*smithyhttp.Response) 2642 if !ok { 2643 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2644 } 2645 2646 if response.StatusCode < 200 || response.StatusCode >= 300 { 2647 return out, metadata, awsRestjson1_deserializeOpErrorInitiateVaultLock(response, &metadata) 2648 } 2649 output := &InitiateVaultLockOutput{} 2650 out.Result = output 2651 2652 err = awsRestjson1_deserializeOpHttpBindingsInitiateVaultLockOutput(output, response) 2653 if err != nil { 2654 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 2655 } 2656 2657 return out, metadata, err 2658} 2659 2660func awsRestjson1_deserializeOpErrorInitiateVaultLock(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2661 var errorBuffer bytes.Buffer 2662 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2663 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2664 } 2665 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2666 2667 errorCode := "UnknownError" 2668 errorMessage := errorCode 2669 2670 code := response.Header.Get("X-Amzn-ErrorType") 2671 if len(code) != 0 { 2672 errorCode = restjson.SanitizeErrorCode(code) 2673 } 2674 2675 var buff [1024]byte 2676 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2677 2678 body := io.TeeReader(errorBody, ringBuffer) 2679 decoder := json.NewDecoder(body) 2680 decoder.UseNumber() 2681 code, message, err := restjson.GetErrorInfo(decoder) 2682 if err != nil { 2683 var snapshot bytes.Buffer 2684 io.Copy(&snapshot, ringBuffer) 2685 err = &smithy.DeserializationError{ 2686 Err: fmt.Errorf("failed to decode response body, %w", err), 2687 Snapshot: snapshot.Bytes(), 2688 } 2689 return err 2690 } 2691 2692 errorBody.Seek(0, io.SeekStart) 2693 if len(code) != 0 { 2694 errorCode = restjson.SanitizeErrorCode(code) 2695 } 2696 if len(message) != 0 { 2697 errorMessage = message 2698 } 2699 2700 switch { 2701 case strings.EqualFold("InvalidParameterValueException", errorCode): 2702 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 2703 2704 case strings.EqualFold("MissingParameterValueException", errorCode): 2705 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 2706 2707 case strings.EqualFold("ResourceNotFoundException", errorCode): 2708 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2709 2710 case strings.EqualFold("ServiceUnavailableException", errorCode): 2711 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2712 2713 default: 2714 genericError := &smithy.GenericAPIError{ 2715 Code: errorCode, 2716 Message: errorMessage, 2717 } 2718 return genericError 2719 2720 } 2721} 2722 2723func awsRestjson1_deserializeOpHttpBindingsInitiateVaultLockOutput(v *InitiateVaultLockOutput, response *smithyhttp.Response) error { 2724 if v == nil { 2725 return fmt.Errorf("unsupported deserialization for nil %T", v) 2726 } 2727 2728 if headerValues := response.Header.Values("x-amz-lock-id"); len(headerValues) != 0 { 2729 headerValues[0] = strings.TrimSpace(headerValues[0]) 2730 v.LockId = ptr.String(headerValues[0]) 2731 } 2732 2733 return nil 2734} 2735 2736type awsRestjson1_deserializeOpListJobs struct { 2737} 2738 2739func (*awsRestjson1_deserializeOpListJobs) ID() string { 2740 return "OperationDeserializer" 2741} 2742 2743func (m *awsRestjson1_deserializeOpListJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2744 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2745) { 2746 out, metadata, err = next.HandleDeserialize(ctx, in) 2747 if err != nil { 2748 return out, metadata, err 2749 } 2750 2751 response, ok := out.RawResponse.(*smithyhttp.Response) 2752 if !ok { 2753 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2754 } 2755 2756 if response.StatusCode < 200 || response.StatusCode >= 300 { 2757 return out, metadata, awsRestjson1_deserializeOpErrorListJobs(response, &metadata) 2758 } 2759 output := &ListJobsOutput{} 2760 out.Result = output 2761 2762 var buff [1024]byte 2763 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2764 2765 body := io.TeeReader(response.Body, ringBuffer) 2766 2767 decoder := json.NewDecoder(body) 2768 decoder.UseNumber() 2769 var shape interface{} 2770 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2771 var snapshot bytes.Buffer 2772 io.Copy(&snapshot, ringBuffer) 2773 err = &smithy.DeserializationError{ 2774 Err: fmt.Errorf("failed to decode response body, %w", err), 2775 Snapshot: snapshot.Bytes(), 2776 } 2777 return out, metadata, err 2778 } 2779 2780 err = awsRestjson1_deserializeOpDocumentListJobsOutput(&output, shape) 2781 if err != nil { 2782 var snapshot bytes.Buffer 2783 io.Copy(&snapshot, ringBuffer) 2784 return out, metadata, &smithy.DeserializationError{ 2785 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2786 Snapshot: snapshot.Bytes(), 2787 } 2788 } 2789 2790 return out, metadata, err 2791} 2792 2793func awsRestjson1_deserializeOpErrorListJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2794 var errorBuffer bytes.Buffer 2795 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2796 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2797 } 2798 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2799 2800 errorCode := "UnknownError" 2801 errorMessage := errorCode 2802 2803 code := response.Header.Get("X-Amzn-ErrorType") 2804 if len(code) != 0 { 2805 errorCode = restjson.SanitizeErrorCode(code) 2806 } 2807 2808 var buff [1024]byte 2809 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2810 2811 body := io.TeeReader(errorBody, ringBuffer) 2812 decoder := json.NewDecoder(body) 2813 decoder.UseNumber() 2814 code, message, err := restjson.GetErrorInfo(decoder) 2815 if err != nil { 2816 var snapshot bytes.Buffer 2817 io.Copy(&snapshot, ringBuffer) 2818 err = &smithy.DeserializationError{ 2819 Err: fmt.Errorf("failed to decode response body, %w", err), 2820 Snapshot: snapshot.Bytes(), 2821 } 2822 return err 2823 } 2824 2825 errorBody.Seek(0, io.SeekStart) 2826 if len(code) != 0 { 2827 errorCode = restjson.SanitizeErrorCode(code) 2828 } 2829 if len(message) != 0 { 2830 errorMessage = message 2831 } 2832 2833 switch { 2834 case strings.EqualFold("InvalidParameterValueException", errorCode): 2835 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 2836 2837 case strings.EqualFold("MissingParameterValueException", errorCode): 2838 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 2839 2840 case strings.EqualFold("ResourceNotFoundException", errorCode): 2841 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2842 2843 case strings.EqualFold("ServiceUnavailableException", errorCode): 2844 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 2845 2846 default: 2847 genericError := &smithy.GenericAPIError{ 2848 Code: errorCode, 2849 Message: errorMessage, 2850 } 2851 return genericError 2852 2853 } 2854} 2855 2856func awsRestjson1_deserializeOpDocumentListJobsOutput(v **ListJobsOutput, value interface{}) error { 2857 if v == nil { 2858 return fmt.Errorf("unexpected nil of type %T", v) 2859 } 2860 if value == nil { 2861 return nil 2862 } 2863 2864 shape, ok := value.(map[string]interface{}) 2865 if !ok { 2866 return fmt.Errorf("unexpected JSON type %v", value) 2867 } 2868 2869 var sv *ListJobsOutput 2870 if *v == nil { 2871 sv = &ListJobsOutput{} 2872 } else { 2873 sv = *v 2874 } 2875 2876 for key, value := range shape { 2877 switch key { 2878 case "JobList": 2879 if err := awsRestjson1_deserializeDocumentJobList(&sv.JobList, value); err != nil { 2880 return err 2881 } 2882 2883 case "Marker": 2884 if value != nil { 2885 jtv, ok := value.(string) 2886 if !ok { 2887 return fmt.Errorf("expected string to be of type string, got %T instead", value) 2888 } 2889 sv.Marker = ptr.String(jtv) 2890 } 2891 2892 default: 2893 _, _ = key, value 2894 2895 } 2896 } 2897 *v = sv 2898 return nil 2899} 2900 2901type awsRestjson1_deserializeOpListMultipartUploads struct { 2902} 2903 2904func (*awsRestjson1_deserializeOpListMultipartUploads) ID() string { 2905 return "OperationDeserializer" 2906} 2907 2908func (m *awsRestjson1_deserializeOpListMultipartUploads) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2909 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2910) { 2911 out, metadata, err = next.HandleDeserialize(ctx, in) 2912 if err != nil { 2913 return out, metadata, err 2914 } 2915 2916 response, ok := out.RawResponse.(*smithyhttp.Response) 2917 if !ok { 2918 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2919 } 2920 2921 if response.StatusCode < 200 || response.StatusCode >= 300 { 2922 return out, metadata, awsRestjson1_deserializeOpErrorListMultipartUploads(response, &metadata) 2923 } 2924 output := &ListMultipartUploadsOutput{} 2925 out.Result = output 2926 2927 var buff [1024]byte 2928 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2929 2930 body := io.TeeReader(response.Body, ringBuffer) 2931 2932 decoder := json.NewDecoder(body) 2933 decoder.UseNumber() 2934 var shape interface{} 2935 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2936 var snapshot bytes.Buffer 2937 io.Copy(&snapshot, ringBuffer) 2938 err = &smithy.DeserializationError{ 2939 Err: fmt.Errorf("failed to decode response body, %w", err), 2940 Snapshot: snapshot.Bytes(), 2941 } 2942 return out, metadata, err 2943 } 2944 2945 err = awsRestjson1_deserializeOpDocumentListMultipartUploadsOutput(&output, shape) 2946 if err != nil { 2947 var snapshot bytes.Buffer 2948 io.Copy(&snapshot, ringBuffer) 2949 return out, metadata, &smithy.DeserializationError{ 2950 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2951 Snapshot: snapshot.Bytes(), 2952 } 2953 } 2954 2955 return out, metadata, err 2956} 2957 2958func awsRestjson1_deserializeOpErrorListMultipartUploads(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2959 var errorBuffer bytes.Buffer 2960 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2961 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2962 } 2963 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2964 2965 errorCode := "UnknownError" 2966 errorMessage := errorCode 2967 2968 code := response.Header.Get("X-Amzn-ErrorType") 2969 if len(code) != 0 { 2970 errorCode = restjson.SanitizeErrorCode(code) 2971 } 2972 2973 var buff [1024]byte 2974 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2975 2976 body := io.TeeReader(errorBody, ringBuffer) 2977 decoder := json.NewDecoder(body) 2978 decoder.UseNumber() 2979 code, message, err := restjson.GetErrorInfo(decoder) 2980 if err != nil { 2981 var snapshot bytes.Buffer 2982 io.Copy(&snapshot, ringBuffer) 2983 err = &smithy.DeserializationError{ 2984 Err: fmt.Errorf("failed to decode response body, %w", err), 2985 Snapshot: snapshot.Bytes(), 2986 } 2987 return err 2988 } 2989 2990 errorBody.Seek(0, io.SeekStart) 2991 if len(code) != 0 { 2992 errorCode = restjson.SanitizeErrorCode(code) 2993 } 2994 if len(message) != 0 { 2995 errorMessage = message 2996 } 2997 2998 switch { 2999 case strings.EqualFold("InvalidParameterValueException", errorCode): 3000 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 3001 3002 case strings.EqualFold("MissingParameterValueException", errorCode): 3003 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 3004 3005 case strings.EqualFold("ResourceNotFoundException", errorCode): 3006 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3007 3008 case strings.EqualFold("ServiceUnavailableException", errorCode): 3009 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3010 3011 default: 3012 genericError := &smithy.GenericAPIError{ 3013 Code: errorCode, 3014 Message: errorMessage, 3015 } 3016 return genericError 3017 3018 } 3019} 3020 3021func awsRestjson1_deserializeOpDocumentListMultipartUploadsOutput(v **ListMultipartUploadsOutput, value interface{}) error { 3022 if v == nil { 3023 return fmt.Errorf("unexpected nil of type %T", v) 3024 } 3025 if value == nil { 3026 return nil 3027 } 3028 3029 shape, ok := value.(map[string]interface{}) 3030 if !ok { 3031 return fmt.Errorf("unexpected JSON type %v", value) 3032 } 3033 3034 var sv *ListMultipartUploadsOutput 3035 if *v == nil { 3036 sv = &ListMultipartUploadsOutput{} 3037 } else { 3038 sv = *v 3039 } 3040 3041 for key, value := range shape { 3042 switch key { 3043 case "Marker": 3044 if value != nil { 3045 jtv, ok := value.(string) 3046 if !ok { 3047 return fmt.Errorf("expected string to be of type string, got %T instead", value) 3048 } 3049 sv.Marker = ptr.String(jtv) 3050 } 3051 3052 case "UploadsList": 3053 if err := awsRestjson1_deserializeDocumentUploadsList(&sv.UploadsList, value); err != nil { 3054 return err 3055 } 3056 3057 default: 3058 _, _ = key, value 3059 3060 } 3061 } 3062 *v = sv 3063 return nil 3064} 3065 3066type awsRestjson1_deserializeOpListParts struct { 3067} 3068 3069func (*awsRestjson1_deserializeOpListParts) ID() string { 3070 return "OperationDeserializer" 3071} 3072 3073func (m *awsRestjson1_deserializeOpListParts) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3074 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3075) { 3076 out, metadata, err = next.HandleDeserialize(ctx, in) 3077 if err != nil { 3078 return out, metadata, err 3079 } 3080 3081 response, ok := out.RawResponse.(*smithyhttp.Response) 3082 if !ok { 3083 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3084 } 3085 3086 if response.StatusCode < 200 || response.StatusCode >= 300 { 3087 return out, metadata, awsRestjson1_deserializeOpErrorListParts(response, &metadata) 3088 } 3089 output := &ListPartsOutput{} 3090 out.Result = output 3091 3092 var buff [1024]byte 3093 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3094 3095 body := io.TeeReader(response.Body, ringBuffer) 3096 3097 decoder := json.NewDecoder(body) 3098 decoder.UseNumber() 3099 var shape interface{} 3100 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3101 var snapshot bytes.Buffer 3102 io.Copy(&snapshot, ringBuffer) 3103 err = &smithy.DeserializationError{ 3104 Err: fmt.Errorf("failed to decode response body, %w", err), 3105 Snapshot: snapshot.Bytes(), 3106 } 3107 return out, metadata, err 3108 } 3109 3110 err = awsRestjson1_deserializeOpDocumentListPartsOutput(&output, shape) 3111 if err != nil { 3112 var snapshot bytes.Buffer 3113 io.Copy(&snapshot, ringBuffer) 3114 return out, metadata, &smithy.DeserializationError{ 3115 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3116 Snapshot: snapshot.Bytes(), 3117 } 3118 } 3119 3120 return out, metadata, err 3121} 3122 3123func awsRestjson1_deserializeOpErrorListParts(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3124 var errorBuffer bytes.Buffer 3125 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3126 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3127 } 3128 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3129 3130 errorCode := "UnknownError" 3131 errorMessage := errorCode 3132 3133 code := response.Header.Get("X-Amzn-ErrorType") 3134 if len(code) != 0 { 3135 errorCode = restjson.SanitizeErrorCode(code) 3136 } 3137 3138 var buff [1024]byte 3139 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3140 3141 body := io.TeeReader(errorBody, ringBuffer) 3142 decoder := json.NewDecoder(body) 3143 decoder.UseNumber() 3144 code, message, err := restjson.GetErrorInfo(decoder) 3145 if err != nil { 3146 var snapshot bytes.Buffer 3147 io.Copy(&snapshot, ringBuffer) 3148 err = &smithy.DeserializationError{ 3149 Err: fmt.Errorf("failed to decode response body, %w", err), 3150 Snapshot: snapshot.Bytes(), 3151 } 3152 return err 3153 } 3154 3155 errorBody.Seek(0, io.SeekStart) 3156 if len(code) != 0 { 3157 errorCode = restjson.SanitizeErrorCode(code) 3158 } 3159 if len(message) != 0 { 3160 errorMessage = message 3161 } 3162 3163 switch { 3164 case strings.EqualFold("InvalidParameterValueException", errorCode): 3165 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 3166 3167 case strings.EqualFold("MissingParameterValueException", errorCode): 3168 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 3169 3170 case strings.EqualFold("ResourceNotFoundException", errorCode): 3171 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3172 3173 case strings.EqualFold("ServiceUnavailableException", errorCode): 3174 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3175 3176 default: 3177 genericError := &smithy.GenericAPIError{ 3178 Code: errorCode, 3179 Message: errorMessage, 3180 } 3181 return genericError 3182 3183 } 3184} 3185 3186func awsRestjson1_deserializeOpDocumentListPartsOutput(v **ListPartsOutput, value interface{}) error { 3187 if v == nil { 3188 return fmt.Errorf("unexpected nil of type %T", v) 3189 } 3190 if value == nil { 3191 return nil 3192 } 3193 3194 shape, ok := value.(map[string]interface{}) 3195 if !ok { 3196 return fmt.Errorf("unexpected JSON type %v", value) 3197 } 3198 3199 var sv *ListPartsOutput 3200 if *v == nil { 3201 sv = &ListPartsOutput{} 3202 } else { 3203 sv = *v 3204 } 3205 3206 for key, value := range shape { 3207 switch key { 3208 case "ArchiveDescription": 3209 if value != nil { 3210 jtv, ok := value.(string) 3211 if !ok { 3212 return fmt.Errorf("expected string to be of type string, got %T instead", value) 3213 } 3214 sv.ArchiveDescription = ptr.String(jtv) 3215 } 3216 3217 case "CreationDate": 3218 if value != nil { 3219 jtv, ok := value.(string) 3220 if !ok { 3221 return fmt.Errorf("expected string to be of type string, got %T instead", value) 3222 } 3223 sv.CreationDate = ptr.String(jtv) 3224 } 3225 3226 case "Marker": 3227 if value != nil { 3228 jtv, ok := value.(string) 3229 if !ok { 3230 return fmt.Errorf("expected string to be of type string, got %T instead", value) 3231 } 3232 sv.Marker = ptr.String(jtv) 3233 } 3234 3235 case "MultipartUploadId": 3236 if value != nil { 3237 jtv, ok := value.(string) 3238 if !ok { 3239 return fmt.Errorf("expected string to be of type string, got %T instead", value) 3240 } 3241 sv.MultipartUploadId = ptr.String(jtv) 3242 } 3243 3244 case "Parts": 3245 if err := awsRestjson1_deserializeDocumentPartList(&sv.Parts, value); err != nil { 3246 return err 3247 } 3248 3249 case "PartSizeInBytes": 3250 if value != nil { 3251 jtv, ok := value.(json.Number) 3252 if !ok { 3253 return fmt.Errorf("expected long to be json.Number, got %T instead", value) 3254 } 3255 i64, err := jtv.Int64() 3256 if err != nil { 3257 return err 3258 } 3259 sv.PartSizeInBytes = i64 3260 } 3261 3262 case "VaultARN": 3263 if value != nil { 3264 jtv, ok := value.(string) 3265 if !ok { 3266 return fmt.Errorf("expected string to be of type string, got %T instead", value) 3267 } 3268 sv.VaultARN = ptr.String(jtv) 3269 } 3270 3271 default: 3272 _, _ = key, value 3273 3274 } 3275 } 3276 *v = sv 3277 return nil 3278} 3279 3280type awsRestjson1_deserializeOpListProvisionedCapacity struct { 3281} 3282 3283func (*awsRestjson1_deserializeOpListProvisionedCapacity) ID() string { 3284 return "OperationDeserializer" 3285} 3286 3287func (m *awsRestjson1_deserializeOpListProvisionedCapacity) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3288 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3289) { 3290 out, metadata, err = next.HandleDeserialize(ctx, in) 3291 if err != nil { 3292 return out, metadata, err 3293 } 3294 3295 response, ok := out.RawResponse.(*smithyhttp.Response) 3296 if !ok { 3297 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3298 } 3299 3300 if response.StatusCode < 200 || response.StatusCode >= 300 { 3301 return out, metadata, awsRestjson1_deserializeOpErrorListProvisionedCapacity(response, &metadata) 3302 } 3303 output := &ListProvisionedCapacityOutput{} 3304 out.Result = output 3305 3306 var buff [1024]byte 3307 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3308 3309 body := io.TeeReader(response.Body, ringBuffer) 3310 3311 decoder := json.NewDecoder(body) 3312 decoder.UseNumber() 3313 var shape interface{} 3314 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3315 var snapshot bytes.Buffer 3316 io.Copy(&snapshot, ringBuffer) 3317 err = &smithy.DeserializationError{ 3318 Err: fmt.Errorf("failed to decode response body, %w", err), 3319 Snapshot: snapshot.Bytes(), 3320 } 3321 return out, metadata, err 3322 } 3323 3324 err = awsRestjson1_deserializeOpDocumentListProvisionedCapacityOutput(&output, shape) 3325 if err != nil { 3326 var snapshot bytes.Buffer 3327 io.Copy(&snapshot, ringBuffer) 3328 return out, metadata, &smithy.DeserializationError{ 3329 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3330 Snapshot: snapshot.Bytes(), 3331 } 3332 } 3333 3334 return out, metadata, err 3335} 3336 3337func awsRestjson1_deserializeOpErrorListProvisionedCapacity(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3338 var errorBuffer bytes.Buffer 3339 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3340 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3341 } 3342 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3343 3344 errorCode := "UnknownError" 3345 errorMessage := errorCode 3346 3347 code := response.Header.Get("X-Amzn-ErrorType") 3348 if len(code) != 0 { 3349 errorCode = restjson.SanitizeErrorCode(code) 3350 } 3351 3352 var buff [1024]byte 3353 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3354 3355 body := io.TeeReader(errorBody, ringBuffer) 3356 decoder := json.NewDecoder(body) 3357 decoder.UseNumber() 3358 code, message, err := restjson.GetErrorInfo(decoder) 3359 if err != nil { 3360 var snapshot bytes.Buffer 3361 io.Copy(&snapshot, ringBuffer) 3362 err = &smithy.DeserializationError{ 3363 Err: fmt.Errorf("failed to decode response body, %w", err), 3364 Snapshot: snapshot.Bytes(), 3365 } 3366 return err 3367 } 3368 3369 errorBody.Seek(0, io.SeekStart) 3370 if len(code) != 0 { 3371 errorCode = restjson.SanitizeErrorCode(code) 3372 } 3373 if len(message) != 0 { 3374 errorMessage = message 3375 } 3376 3377 switch { 3378 case strings.EqualFold("InvalidParameterValueException", errorCode): 3379 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 3380 3381 case strings.EqualFold("MissingParameterValueException", errorCode): 3382 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 3383 3384 case strings.EqualFold("ServiceUnavailableException", errorCode): 3385 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3386 3387 default: 3388 genericError := &smithy.GenericAPIError{ 3389 Code: errorCode, 3390 Message: errorMessage, 3391 } 3392 return genericError 3393 3394 } 3395} 3396 3397func awsRestjson1_deserializeOpDocumentListProvisionedCapacityOutput(v **ListProvisionedCapacityOutput, value interface{}) error { 3398 if v == nil { 3399 return fmt.Errorf("unexpected nil of type %T", v) 3400 } 3401 if value == nil { 3402 return nil 3403 } 3404 3405 shape, ok := value.(map[string]interface{}) 3406 if !ok { 3407 return fmt.Errorf("unexpected JSON type %v", value) 3408 } 3409 3410 var sv *ListProvisionedCapacityOutput 3411 if *v == nil { 3412 sv = &ListProvisionedCapacityOutput{} 3413 } else { 3414 sv = *v 3415 } 3416 3417 for key, value := range shape { 3418 switch key { 3419 case "ProvisionedCapacityList": 3420 if err := awsRestjson1_deserializeDocumentProvisionedCapacityList(&sv.ProvisionedCapacityList, value); err != nil { 3421 return err 3422 } 3423 3424 default: 3425 _, _ = key, value 3426 3427 } 3428 } 3429 *v = sv 3430 return nil 3431} 3432 3433type awsRestjson1_deserializeOpListTagsForVault struct { 3434} 3435 3436func (*awsRestjson1_deserializeOpListTagsForVault) ID() string { 3437 return "OperationDeserializer" 3438} 3439 3440func (m *awsRestjson1_deserializeOpListTagsForVault) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3441 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3442) { 3443 out, metadata, err = next.HandleDeserialize(ctx, in) 3444 if err != nil { 3445 return out, metadata, err 3446 } 3447 3448 response, ok := out.RawResponse.(*smithyhttp.Response) 3449 if !ok { 3450 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3451 } 3452 3453 if response.StatusCode < 200 || response.StatusCode >= 300 { 3454 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForVault(response, &metadata) 3455 } 3456 output := &ListTagsForVaultOutput{} 3457 out.Result = output 3458 3459 var buff [1024]byte 3460 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3461 3462 body := io.TeeReader(response.Body, ringBuffer) 3463 3464 decoder := json.NewDecoder(body) 3465 decoder.UseNumber() 3466 var shape interface{} 3467 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3468 var snapshot bytes.Buffer 3469 io.Copy(&snapshot, ringBuffer) 3470 err = &smithy.DeserializationError{ 3471 Err: fmt.Errorf("failed to decode response body, %w", err), 3472 Snapshot: snapshot.Bytes(), 3473 } 3474 return out, metadata, err 3475 } 3476 3477 err = awsRestjson1_deserializeOpDocumentListTagsForVaultOutput(&output, shape) 3478 if err != nil { 3479 var snapshot bytes.Buffer 3480 io.Copy(&snapshot, ringBuffer) 3481 return out, metadata, &smithy.DeserializationError{ 3482 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3483 Snapshot: snapshot.Bytes(), 3484 } 3485 } 3486 3487 return out, metadata, err 3488} 3489 3490func awsRestjson1_deserializeOpErrorListTagsForVault(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3491 var errorBuffer bytes.Buffer 3492 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3493 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3494 } 3495 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3496 3497 errorCode := "UnknownError" 3498 errorMessage := errorCode 3499 3500 code := response.Header.Get("X-Amzn-ErrorType") 3501 if len(code) != 0 { 3502 errorCode = restjson.SanitizeErrorCode(code) 3503 } 3504 3505 var buff [1024]byte 3506 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3507 3508 body := io.TeeReader(errorBody, ringBuffer) 3509 decoder := json.NewDecoder(body) 3510 decoder.UseNumber() 3511 code, message, err := restjson.GetErrorInfo(decoder) 3512 if err != nil { 3513 var snapshot bytes.Buffer 3514 io.Copy(&snapshot, ringBuffer) 3515 err = &smithy.DeserializationError{ 3516 Err: fmt.Errorf("failed to decode response body, %w", err), 3517 Snapshot: snapshot.Bytes(), 3518 } 3519 return err 3520 } 3521 3522 errorBody.Seek(0, io.SeekStart) 3523 if len(code) != 0 { 3524 errorCode = restjson.SanitizeErrorCode(code) 3525 } 3526 if len(message) != 0 { 3527 errorMessage = message 3528 } 3529 3530 switch { 3531 case strings.EqualFold("InvalidParameterValueException", errorCode): 3532 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 3533 3534 case strings.EqualFold("MissingParameterValueException", errorCode): 3535 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 3536 3537 case strings.EqualFold("ResourceNotFoundException", errorCode): 3538 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3539 3540 case strings.EqualFold("ServiceUnavailableException", errorCode): 3541 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3542 3543 default: 3544 genericError := &smithy.GenericAPIError{ 3545 Code: errorCode, 3546 Message: errorMessage, 3547 } 3548 return genericError 3549 3550 } 3551} 3552 3553func awsRestjson1_deserializeOpDocumentListTagsForVaultOutput(v **ListTagsForVaultOutput, value interface{}) error { 3554 if v == nil { 3555 return fmt.Errorf("unexpected nil of type %T", v) 3556 } 3557 if value == nil { 3558 return nil 3559 } 3560 3561 shape, ok := value.(map[string]interface{}) 3562 if !ok { 3563 return fmt.Errorf("unexpected JSON type %v", value) 3564 } 3565 3566 var sv *ListTagsForVaultOutput 3567 if *v == nil { 3568 sv = &ListTagsForVaultOutput{} 3569 } else { 3570 sv = *v 3571 } 3572 3573 for key, value := range shape { 3574 switch key { 3575 case "Tags": 3576 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 3577 return err 3578 } 3579 3580 default: 3581 _, _ = key, value 3582 3583 } 3584 } 3585 *v = sv 3586 return nil 3587} 3588 3589type awsRestjson1_deserializeOpListVaults struct { 3590} 3591 3592func (*awsRestjson1_deserializeOpListVaults) ID() string { 3593 return "OperationDeserializer" 3594} 3595 3596func (m *awsRestjson1_deserializeOpListVaults) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3597 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3598) { 3599 out, metadata, err = next.HandleDeserialize(ctx, in) 3600 if err != nil { 3601 return out, metadata, err 3602 } 3603 3604 response, ok := out.RawResponse.(*smithyhttp.Response) 3605 if !ok { 3606 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3607 } 3608 3609 if response.StatusCode < 200 || response.StatusCode >= 300 { 3610 return out, metadata, awsRestjson1_deserializeOpErrorListVaults(response, &metadata) 3611 } 3612 output := &ListVaultsOutput{} 3613 out.Result = output 3614 3615 var buff [1024]byte 3616 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3617 3618 body := io.TeeReader(response.Body, ringBuffer) 3619 3620 decoder := json.NewDecoder(body) 3621 decoder.UseNumber() 3622 var shape interface{} 3623 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3624 var snapshot bytes.Buffer 3625 io.Copy(&snapshot, ringBuffer) 3626 err = &smithy.DeserializationError{ 3627 Err: fmt.Errorf("failed to decode response body, %w", err), 3628 Snapshot: snapshot.Bytes(), 3629 } 3630 return out, metadata, err 3631 } 3632 3633 err = awsRestjson1_deserializeOpDocumentListVaultsOutput(&output, shape) 3634 if err != nil { 3635 var snapshot bytes.Buffer 3636 io.Copy(&snapshot, ringBuffer) 3637 return out, metadata, &smithy.DeserializationError{ 3638 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3639 Snapshot: snapshot.Bytes(), 3640 } 3641 } 3642 3643 return out, metadata, err 3644} 3645 3646func awsRestjson1_deserializeOpErrorListVaults(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3647 var errorBuffer bytes.Buffer 3648 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3649 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3650 } 3651 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3652 3653 errorCode := "UnknownError" 3654 errorMessage := errorCode 3655 3656 code := response.Header.Get("X-Amzn-ErrorType") 3657 if len(code) != 0 { 3658 errorCode = restjson.SanitizeErrorCode(code) 3659 } 3660 3661 var buff [1024]byte 3662 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3663 3664 body := io.TeeReader(errorBody, ringBuffer) 3665 decoder := json.NewDecoder(body) 3666 decoder.UseNumber() 3667 code, message, err := restjson.GetErrorInfo(decoder) 3668 if err != nil { 3669 var snapshot bytes.Buffer 3670 io.Copy(&snapshot, ringBuffer) 3671 err = &smithy.DeserializationError{ 3672 Err: fmt.Errorf("failed to decode response body, %w", err), 3673 Snapshot: snapshot.Bytes(), 3674 } 3675 return err 3676 } 3677 3678 errorBody.Seek(0, io.SeekStart) 3679 if len(code) != 0 { 3680 errorCode = restjson.SanitizeErrorCode(code) 3681 } 3682 if len(message) != 0 { 3683 errorMessage = message 3684 } 3685 3686 switch { 3687 case strings.EqualFold("InvalidParameterValueException", errorCode): 3688 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 3689 3690 case strings.EqualFold("MissingParameterValueException", errorCode): 3691 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 3692 3693 case strings.EqualFold("ResourceNotFoundException", errorCode): 3694 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3695 3696 case strings.EqualFold("ServiceUnavailableException", errorCode): 3697 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3698 3699 default: 3700 genericError := &smithy.GenericAPIError{ 3701 Code: errorCode, 3702 Message: errorMessage, 3703 } 3704 return genericError 3705 3706 } 3707} 3708 3709func awsRestjson1_deserializeOpDocumentListVaultsOutput(v **ListVaultsOutput, value interface{}) error { 3710 if v == nil { 3711 return fmt.Errorf("unexpected nil of type %T", v) 3712 } 3713 if value == nil { 3714 return nil 3715 } 3716 3717 shape, ok := value.(map[string]interface{}) 3718 if !ok { 3719 return fmt.Errorf("unexpected JSON type %v", value) 3720 } 3721 3722 var sv *ListVaultsOutput 3723 if *v == nil { 3724 sv = &ListVaultsOutput{} 3725 } else { 3726 sv = *v 3727 } 3728 3729 for key, value := range shape { 3730 switch key { 3731 case "Marker": 3732 if value != nil { 3733 jtv, ok := value.(string) 3734 if !ok { 3735 return fmt.Errorf("expected string to be of type string, got %T instead", value) 3736 } 3737 sv.Marker = ptr.String(jtv) 3738 } 3739 3740 case "VaultList": 3741 if err := awsRestjson1_deserializeDocumentVaultList(&sv.VaultList, value); err != nil { 3742 return err 3743 } 3744 3745 default: 3746 _, _ = key, value 3747 3748 } 3749 } 3750 *v = sv 3751 return nil 3752} 3753 3754type awsRestjson1_deserializeOpPurchaseProvisionedCapacity struct { 3755} 3756 3757func (*awsRestjson1_deserializeOpPurchaseProvisionedCapacity) ID() string { 3758 return "OperationDeserializer" 3759} 3760 3761func (m *awsRestjson1_deserializeOpPurchaseProvisionedCapacity) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3762 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3763) { 3764 out, metadata, err = next.HandleDeserialize(ctx, in) 3765 if err != nil { 3766 return out, metadata, err 3767 } 3768 3769 response, ok := out.RawResponse.(*smithyhttp.Response) 3770 if !ok { 3771 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3772 } 3773 3774 if response.StatusCode < 200 || response.StatusCode >= 300 { 3775 return out, metadata, awsRestjson1_deserializeOpErrorPurchaseProvisionedCapacity(response, &metadata) 3776 } 3777 output := &PurchaseProvisionedCapacityOutput{} 3778 out.Result = output 3779 3780 err = awsRestjson1_deserializeOpHttpBindingsPurchaseProvisionedCapacityOutput(output, response) 3781 if err != nil { 3782 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 3783 } 3784 3785 return out, metadata, err 3786} 3787 3788func awsRestjson1_deserializeOpErrorPurchaseProvisionedCapacity(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3789 var errorBuffer bytes.Buffer 3790 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3791 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3792 } 3793 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3794 3795 errorCode := "UnknownError" 3796 errorMessage := errorCode 3797 3798 code := response.Header.Get("X-Amzn-ErrorType") 3799 if len(code) != 0 { 3800 errorCode = restjson.SanitizeErrorCode(code) 3801 } 3802 3803 var buff [1024]byte 3804 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3805 3806 body := io.TeeReader(errorBody, ringBuffer) 3807 decoder := json.NewDecoder(body) 3808 decoder.UseNumber() 3809 code, message, err := restjson.GetErrorInfo(decoder) 3810 if err != nil { 3811 var snapshot bytes.Buffer 3812 io.Copy(&snapshot, ringBuffer) 3813 err = &smithy.DeserializationError{ 3814 Err: fmt.Errorf("failed to decode response body, %w", err), 3815 Snapshot: snapshot.Bytes(), 3816 } 3817 return err 3818 } 3819 3820 errorBody.Seek(0, io.SeekStart) 3821 if len(code) != 0 { 3822 errorCode = restjson.SanitizeErrorCode(code) 3823 } 3824 if len(message) != 0 { 3825 errorMessage = message 3826 } 3827 3828 switch { 3829 case strings.EqualFold("InvalidParameterValueException", errorCode): 3830 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 3831 3832 case strings.EqualFold("LimitExceededException", errorCode): 3833 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 3834 3835 case strings.EqualFold("MissingParameterValueException", errorCode): 3836 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 3837 3838 case strings.EqualFold("ServiceUnavailableException", errorCode): 3839 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3840 3841 default: 3842 genericError := &smithy.GenericAPIError{ 3843 Code: errorCode, 3844 Message: errorMessage, 3845 } 3846 return genericError 3847 3848 } 3849} 3850 3851func awsRestjson1_deserializeOpHttpBindingsPurchaseProvisionedCapacityOutput(v *PurchaseProvisionedCapacityOutput, response *smithyhttp.Response) error { 3852 if v == nil { 3853 return fmt.Errorf("unsupported deserialization for nil %T", v) 3854 } 3855 3856 if headerValues := response.Header.Values("x-amz-capacity-id"); len(headerValues) != 0 { 3857 headerValues[0] = strings.TrimSpace(headerValues[0]) 3858 v.CapacityId = ptr.String(headerValues[0]) 3859 } 3860 3861 return nil 3862} 3863 3864type awsRestjson1_deserializeOpRemoveTagsFromVault struct { 3865} 3866 3867func (*awsRestjson1_deserializeOpRemoveTagsFromVault) ID() string { 3868 return "OperationDeserializer" 3869} 3870 3871func (m *awsRestjson1_deserializeOpRemoveTagsFromVault) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3872 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3873) { 3874 out, metadata, err = next.HandleDeserialize(ctx, in) 3875 if err != nil { 3876 return out, metadata, err 3877 } 3878 3879 response, ok := out.RawResponse.(*smithyhttp.Response) 3880 if !ok { 3881 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3882 } 3883 3884 if response.StatusCode < 200 || response.StatusCode >= 300 { 3885 return out, metadata, awsRestjson1_deserializeOpErrorRemoveTagsFromVault(response, &metadata) 3886 } 3887 output := &RemoveTagsFromVaultOutput{} 3888 out.Result = output 3889 3890 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3891 return out, metadata, &smithy.DeserializationError{ 3892 Err: fmt.Errorf("failed to discard response body, %w", err), 3893 } 3894 } 3895 3896 return out, metadata, err 3897} 3898 3899func awsRestjson1_deserializeOpErrorRemoveTagsFromVault(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3900 var errorBuffer bytes.Buffer 3901 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3902 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3903 } 3904 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3905 3906 errorCode := "UnknownError" 3907 errorMessage := errorCode 3908 3909 code := response.Header.Get("X-Amzn-ErrorType") 3910 if len(code) != 0 { 3911 errorCode = restjson.SanitizeErrorCode(code) 3912 } 3913 3914 var buff [1024]byte 3915 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3916 3917 body := io.TeeReader(errorBody, ringBuffer) 3918 decoder := json.NewDecoder(body) 3919 decoder.UseNumber() 3920 code, message, err := restjson.GetErrorInfo(decoder) 3921 if err != nil { 3922 var snapshot bytes.Buffer 3923 io.Copy(&snapshot, ringBuffer) 3924 err = &smithy.DeserializationError{ 3925 Err: fmt.Errorf("failed to decode response body, %w", err), 3926 Snapshot: snapshot.Bytes(), 3927 } 3928 return err 3929 } 3930 3931 errorBody.Seek(0, io.SeekStart) 3932 if len(code) != 0 { 3933 errorCode = restjson.SanitizeErrorCode(code) 3934 } 3935 if len(message) != 0 { 3936 errorMessage = message 3937 } 3938 3939 switch { 3940 case strings.EqualFold("InvalidParameterValueException", errorCode): 3941 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 3942 3943 case strings.EqualFold("MissingParameterValueException", errorCode): 3944 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 3945 3946 case strings.EqualFold("ResourceNotFoundException", errorCode): 3947 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3948 3949 case strings.EqualFold("ServiceUnavailableException", errorCode): 3950 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 3951 3952 default: 3953 genericError := &smithy.GenericAPIError{ 3954 Code: errorCode, 3955 Message: errorMessage, 3956 } 3957 return genericError 3958 3959 } 3960} 3961 3962type awsRestjson1_deserializeOpSetDataRetrievalPolicy struct { 3963} 3964 3965func (*awsRestjson1_deserializeOpSetDataRetrievalPolicy) ID() string { 3966 return "OperationDeserializer" 3967} 3968 3969func (m *awsRestjson1_deserializeOpSetDataRetrievalPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3970 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3971) { 3972 out, metadata, err = next.HandleDeserialize(ctx, in) 3973 if err != nil { 3974 return out, metadata, err 3975 } 3976 3977 response, ok := out.RawResponse.(*smithyhttp.Response) 3978 if !ok { 3979 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3980 } 3981 3982 if response.StatusCode < 200 || response.StatusCode >= 300 { 3983 return out, metadata, awsRestjson1_deserializeOpErrorSetDataRetrievalPolicy(response, &metadata) 3984 } 3985 output := &SetDataRetrievalPolicyOutput{} 3986 out.Result = output 3987 3988 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3989 return out, metadata, &smithy.DeserializationError{ 3990 Err: fmt.Errorf("failed to discard response body, %w", err), 3991 } 3992 } 3993 3994 return out, metadata, err 3995} 3996 3997func awsRestjson1_deserializeOpErrorSetDataRetrievalPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3998 var errorBuffer bytes.Buffer 3999 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4000 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4001 } 4002 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4003 4004 errorCode := "UnknownError" 4005 errorMessage := errorCode 4006 4007 code := response.Header.Get("X-Amzn-ErrorType") 4008 if len(code) != 0 { 4009 errorCode = restjson.SanitizeErrorCode(code) 4010 } 4011 4012 var buff [1024]byte 4013 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4014 4015 body := io.TeeReader(errorBody, ringBuffer) 4016 decoder := json.NewDecoder(body) 4017 decoder.UseNumber() 4018 code, message, err := restjson.GetErrorInfo(decoder) 4019 if err != nil { 4020 var snapshot bytes.Buffer 4021 io.Copy(&snapshot, ringBuffer) 4022 err = &smithy.DeserializationError{ 4023 Err: fmt.Errorf("failed to decode response body, %w", err), 4024 Snapshot: snapshot.Bytes(), 4025 } 4026 return err 4027 } 4028 4029 errorBody.Seek(0, io.SeekStart) 4030 if len(code) != 0 { 4031 errorCode = restjson.SanitizeErrorCode(code) 4032 } 4033 if len(message) != 0 { 4034 errorMessage = message 4035 } 4036 4037 switch { 4038 case strings.EqualFold("InvalidParameterValueException", errorCode): 4039 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 4040 4041 case strings.EqualFold("MissingParameterValueException", errorCode): 4042 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 4043 4044 case strings.EqualFold("ServiceUnavailableException", errorCode): 4045 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4046 4047 default: 4048 genericError := &smithy.GenericAPIError{ 4049 Code: errorCode, 4050 Message: errorMessage, 4051 } 4052 return genericError 4053 4054 } 4055} 4056 4057type awsRestjson1_deserializeOpSetVaultAccessPolicy struct { 4058} 4059 4060func (*awsRestjson1_deserializeOpSetVaultAccessPolicy) ID() string { 4061 return "OperationDeserializer" 4062} 4063 4064func (m *awsRestjson1_deserializeOpSetVaultAccessPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4065 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4066) { 4067 out, metadata, err = next.HandleDeserialize(ctx, in) 4068 if err != nil { 4069 return out, metadata, err 4070 } 4071 4072 response, ok := out.RawResponse.(*smithyhttp.Response) 4073 if !ok { 4074 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4075 } 4076 4077 if response.StatusCode < 200 || response.StatusCode >= 300 { 4078 return out, metadata, awsRestjson1_deserializeOpErrorSetVaultAccessPolicy(response, &metadata) 4079 } 4080 output := &SetVaultAccessPolicyOutput{} 4081 out.Result = output 4082 4083 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4084 return out, metadata, &smithy.DeserializationError{ 4085 Err: fmt.Errorf("failed to discard response body, %w", err), 4086 } 4087 } 4088 4089 return out, metadata, err 4090} 4091 4092func awsRestjson1_deserializeOpErrorSetVaultAccessPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4093 var errorBuffer bytes.Buffer 4094 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4095 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4096 } 4097 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4098 4099 errorCode := "UnknownError" 4100 errorMessage := errorCode 4101 4102 code := response.Header.Get("X-Amzn-ErrorType") 4103 if len(code) != 0 { 4104 errorCode = restjson.SanitizeErrorCode(code) 4105 } 4106 4107 var buff [1024]byte 4108 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4109 4110 body := io.TeeReader(errorBody, ringBuffer) 4111 decoder := json.NewDecoder(body) 4112 decoder.UseNumber() 4113 code, message, err := restjson.GetErrorInfo(decoder) 4114 if err != nil { 4115 var snapshot bytes.Buffer 4116 io.Copy(&snapshot, ringBuffer) 4117 err = &smithy.DeserializationError{ 4118 Err: fmt.Errorf("failed to decode response body, %w", err), 4119 Snapshot: snapshot.Bytes(), 4120 } 4121 return err 4122 } 4123 4124 errorBody.Seek(0, io.SeekStart) 4125 if len(code) != 0 { 4126 errorCode = restjson.SanitizeErrorCode(code) 4127 } 4128 if len(message) != 0 { 4129 errorMessage = message 4130 } 4131 4132 switch { 4133 case strings.EqualFold("InvalidParameterValueException", errorCode): 4134 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 4135 4136 case strings.EqualFold("MissingParameterValueException", errorCode): 4137 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 4138 4139 case strings.EqualFold("ResourceNotFoundException", errorCode): 4140 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4141 4142 case strings.EqualFold("ServiceUnavailableException", errorCode): 4143 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4144 4145 default: 4146 genericError := &smithy.GenericAPIError{ 4147 Code: errorCode, 4148 Message: errorMessage, 4149 } 4150 return genericError 4151 4152 } 4153} 4154 4155type awsRestjson1_deserializeOpSetVaultNotifications struct { 4156} 4157 4158func (*awsRestjson1_deserializeOpSetVaultNotifications) ID() string { 4159 return "OperationDeserializer" 4160} 4161 4162func (m *awsRestjson1_deserializeOpSetVaultNotifications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4163 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4164) { 4165 out, metadata, err = next.HandleDeserialize(ctx, in) 4166 if err != nil { 4167 return out, metadata, err 4168 } 4169 4170 response, ok := out.RawResponse.(*smithyhttp.Response) 4171 if !ok { 4172 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4173 } 4174 4175 if response.StatusCode < 200 || response.StatusCode >= 300 { 4176 return out, metadata, awsRestjson1_deserializeOpErrorSetVaultNotifications(response, &metadata) 4177 } 4178 output := &SetVaultNotificationsOutput{} 4179 out.Result = output 4180 4181 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4182 return out, metadata, &smithy.DeserializationError{ 4183 Err: fmt.Errorf("failed to discard response body, %w", err), 4184 } 4185 } 4186 4187 return out, metadata, err 4188} 4189 4190func awsRestjson1_deserializeOpErrorSetVaultNotifications(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4191 var errorBuffer bytes.Buffer 4192 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4193 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4194 } 4195 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4196 4197 errorCode := "UnknownError" 4198 errorMessage := errorCode 4199 4200 code := response.Header.Get("X-Amzn-ErrorType") 4201 if len(code) != 0 { 4202 errorCode = restjson.SanitizeErrorCode(code) 4203 } 4204 4205 var buff [1024]byte 4206 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4207 4208 body := io.TeeReader(errorBody, ringBuffer) 4209 decoder := json.NewDecoder(body) 4210 decoder.UseNumber() 4211 code, message, err := restjson.GetErrorInfo(decoder) 4212 if err != nil { 4213 var snapshot bytes.Buffer 4214 io.Copy(&snapshot, ringBuffer) 4215 err = &smithy.DeserializationError{ 4216 Err: fmt.Errorf("failed to decode response body, %w", err), 4217 Snapshot: snapshot.Bytes(), 4218 } 4219 return err 4220 } 4221 4222 errorBody.Seek(0, io.SeekStart) 4223 if len(code) != 0 { 4224 errorCode = restjson.SanitizeErrorCode(code) 4225 } 4226 if len(message) != 0 { 4227 errorMessage = message 4228 } 4229 4230 switch { 4231 case strings.EqualFold("InvalidParameterValueException", errorCode): 4232 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 4233 4234 case strings.EqualFold("MissingParameterValueException", errorCode): 4235 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 4236 4237 case strings.EqualFold("ResourceNotFoundException", errorCode): 4238 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4239 4240 case strings.EqualFold("ServiceUnavailableException", errorCode): 4241 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4242 4243 default: 4244 genericError := &smithy.GenericAPIError{ 4245 Code: errorCode, 4246 Message: errorMessage, 4247 } 4248 return genericError 4249 4250 } 4251} 4252 4253type awsRestjson1_deserializeOpUploadArchive struct { 4254} 4255 4256func (*awsRestjson1_deserializeOpUploadArchive) ID() string { 4257 return "OperationDeserializer" 4258} 4259 4260func (m *awsRestjson1_deserializeOpUploadArchive) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4261 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4262) { 4263 out, metadata, err = next.HandleDeserialize(ctx, in) 4264 if err != nil { 4265 return out, metadata, err 4266 } 4267 4268 response, ok := out.RawResponse.(*smithyhttp.Response) 4269 if !ok { 4270 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4271 } 4272 4273 if response.StatusCode < 200 || response.StatusCode >= 300 { 4274 return out, metadata, awsRestjson1_deserializeOpErrorUploadArchive(response, &metadata) 4275 } 4276 output := &UploadArchiveOutput{} 4277 out.Result = output 4278 4279 err = awsRestjson1_deserializeOpHttpBindingsUploadArchiveOutput(output, response) 4280 if err != nil { 4281 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 4282 } 4283 4284 return out, metadata, err 4285} 4286 4287func awsRestjson1_deserializeOpErrorUploadArchive(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4288 var errorBuffer bytes.Buffer 4289 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4290 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4291 } 4292 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4293 4294 errorCode := "UnknownError" 4295 errorMessage := errorCode 4296 4297 code := response.Header.Get("X-Amzn-ErrorType") 4298 if len(code) != 0 { 4299 errorCode = restjson.SanitizeErrorCode(code) 4300 } 4301 4302 var buff [1024]byte 4303 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4304 4305 body := io.TeeReader(errorBody, ringBuffer) 4306 decoder := json.NewDecoder(body) 4307 decoder.UseNumber() 4308 code, message, err := restjson.GetErrorInfo(decoder) 4309 if err != nil { 4310 var snapshot bytes.Buffer 4311 io.Copy(&snapshot, ringBuffer) 4312 err = &smithy.DeserializationError{ 4313 Err: fmt.Errorf("failed to decode response body, %w", err), 4314 Snapshot: snapshot.Bytes(), 4315 } 4316 return err 4317 } 4318 4319 errorBody.Seek(0, io.SeekStart) 4320 if len(code) != 0 { 4321 errorCode = restjson.SanitizeErrorCode(code) 4322 } 4323 if len(message) != 0 { 4324 errorMessage = message 4325 } 4326 4327 switch { 4328 case strings.EqualFold("InvalidParameterValueException", errorCode): 4329 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 4330 4331 case strings.EqualFold("MissingParameterValueException", errorCode): 4332 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 4333 4334 case strings.EqualFold("RequestTimeoutException", errorCode): 4335 return awsRestjson1_deserializeErrorRequestTimeoutException(response, errorBody) 4336 4337 case strings.EqualFold("ResourceNotFoundException", errorCode): 4338 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4339 4340 case strings.EqualFold("ServiceUnavailableException", errorCode): 4341 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4342 4343 default: 4344 genericError := &smithy.GenericAPIError{ 4345 Code: errorCode, 4346 Message: errorMessage, 4347 } 4348 return genericError 4349 4350 } 4351} 4352 4353func awsRestjson1_deserializeOpHttpBindingsUploadArchiveOutput(v *UploadArchiveOutput, response *smithyhttp.Response) error { 4354 if v == nil { 4355 return fmt.Errorf("unsupported deserialization for nil %T", v) 4356 } 4357 4358 if headerValues := response.Header.Values("x-amz-archive-id"); len(headerValues) != 0 { 4359 headerValues[0] = strings.TrimSpace(headerValues[0]) 4360 v.ArchiveId = ptr.String(headerValues[0]) 4361 } 4362 4363 if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 { 4364 headerValues[0] = strings.TrimSpace(headerValues[0]) 4365 v.Checksum = ptr.String(headerValues[0]) 4366 } 4367 4368 if headerValues := response.Header.Values("Location"); len(headerValues) != 0 { 4369 headerValues[0] = strings.TrimSpace(headerValues[0]) 4370 v.Location = ptr.String(headerValues[0]) 4371 } 4372 4373 return nil 4374} 4375 4376type awsRestjson1_deserializeOpUploadMultipartPart struct { 4377} 4378 4379func (*awsRestjson1_deserializeOpUploadMultipartPart) ID() string { 4380 return "OperationDeserializer" 4381} 4382 4383func (m *awsRestjson1_deserializeOpUploadMultipartPart) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4384 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4385) { 4386 out, metadata, err = next.HandleDeserialize(ctx, in) 4387 if err != nil { 4388 return out, metadata, err 4389 } 4390 4391 response, ok := out.RawResponse.(*smithyhttp.Response) 4392 if !ok { 4393 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4394 } 4395 4396 if response.StatusCode < 200 || response.StatusCode >= 300 { 4397 return out, metadata, awsRestjson1_deserializeOpErrorUploadMultipartPart(response, &metadata) 4398 } 4399 output := &UploadMultipartPartOutput{} 4400 out.Result = output 4401 4402 err = awsRestjson1_deserializeOpHttpBindingsUploadMultipartPartOutput(output, response) 4403 if err != nil { 4404 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} 4405 } 4406 4407 return out, metadata, err 4408} 4409 4410func awsRestjson1_deserializeOpErrorUploadMultipartPart(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4411 var errorBuffer bytes.Buffer 4412 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4413 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4414 } 4415 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4416 4417 errorCode := "UnknownError" 4418 errorMessage := errorCode 4419 4420 code := response.Header.Get("X-Amzn-ErrorType") 4421 if len(code) != 0 { 4422 errorCode = restjson.SanitizeErrorCode(code) 4423 } 4424 4425 var buff [1024]byte 4426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4427 4428 body := io.TeeReader(errorBody, ringBuffer) 4429 decoder := json.NewDecoder(body) 4430 decoder.UseNumber() 4431 code, message, err := restjson.GetErrorInfo(decoder) 4432 if err != nil { 4433 var snapshot bytes.Buffer 4434 io.Copy(&snapshot, ringBuffer) 4435 err = &smithy.DeserializationError{ 4436 Err: fmt.Errorf("failed to decode response body, %w", err), 4437 Snapshot: snapshot.Bytes(), 4438 } 4439 return err 4440 } 4441 4442 errorBody.Seek(0, io.SeekStart) 4443 if len(code) != 0 { 4444 errorCode = restjson.SanitizeErrorCode(code) 4445 } 4446 if len(message) != 0 { 4447 errorMessage = message 4448 } 4449 4450 switch { 4451 case strings.EqualFold("InvalidParameterValueException", errorCode): 4452 return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) 4453 4454 case strings.EqualFold("MissingParameterValueException", errorCode): 4455 return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody) 4456 4457 case strings.EqualFold("RequestTimeoutException", errorCode): 4458 return awsRestjson1_deserializeErrorRequestTimeoutException(response, errorBody) 4459 4460 case strings.EqualFold("ResourceNotFoundException", errorCode): 4461 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4462 4463 case strings.EqualFold("ServiceUnavailableException", errorCode): 4464 return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) 4465 4466 default: 4467 genericError := &smithy.GenericAPIError{ 4468 Code: errorCode, 4469 Message: errorMessage, 4470 } 4471 return genericError 4472 4473 } 4474} 4475 4476func awsRestjson1_deserializeOpHttpBindingsUploadMultipartPartOutput(v *UploadMultipartPartOutput, response *smithyhttp.Response) error { 4477 if v == nil { 4478 return fmt.Errorf("unsupported deserialization for nil %T", v) 4479 } 4480 4481 if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 { 4482 headerValues[0] = strings.TrimSpace(headerValues[0]) 4483 v.Checksum = ptr.String(headerValues[0]) 4484 } 4485 4486 return nil 4487} 4488func awsRestjson1_deserializeErrorInsufficientCapacityException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4489 output := &types.InsufficientCapacityException{} 4490 var buff [1024]byte 4491 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4492 4493 body := io.TeeReader(errorBody, ringBuffer) 4494 decoder := json.NewDecoder(body) 4495 decoder.UseNumber() 4496 var shape interface{} 4497 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4498 var snapshot bytes.Buffer 4499 io.Copy(&snapshot, ringBuffer) 4500 err = &smithy.DeserializationError{ 4501 Err: fmt.Errorf("failed to decode response body, %w", err), 4502 Snapshot: snapshot.Bytes(), 4503 } 4504 return err 4505 } 4506 4507 err := awsRestjson1_deserializeDocumentInsufficientCapacityException(&output, shape) 4508 4509 if err != nil { 4510 var snapshot bytes.Buffer 4511 io.Copy(&snapshot, ringBuffer) 4512 err = &smithy.DeserializationError{ 4513 Err: fmt.Errorf("failed to decode response body, %w", err), 4514 Snapshot: snapshot.Bytes(), 4515 } 4516 return err 4517 } 4518 4519 errorBody.Seek(0, io.SeekStart) 4520 4521 return output 4522} 4523 4524func awsRestjson1_deserializeErrorInvalidParameterValueException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4525 output := &types.InvalidParameterValueException{} 4526 var buff [1024]byte 4527 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4528 4529 body := io.TeeReader(errorBody, ringBuffer) 4530 decoder := json.NewDecoder(body) 4531 decoder.UseNumber() 4532 var shape interface{} 4533 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4534 var snapshot bytes.Buffer 4535 io.Copy(&snapshot, ringBuffer) 4536 err = &smithy.DeserializationError{ 4537 Err: fmt.Errorf("failed to decode response body, %w", err), 4538 Snapshot: snapshot.Bytes(), 4539 } 4540 return err 4541 } 4542 4543 err := awsRestjson1_deserializeDocumentInvalidParameterValueException(&output, shape) 4544 4545 if err != nil { 4546 var snapshot bytes.Buffer 4547 io.Copy(&snapshot, ringBuffer) 4548 err = &smithy.DeserializationError{ 4549 Err: fmt.Errorf("failed to decode response body, %w", err), 4550 Snapshot: snapshot.Bytes(), 4551 } 4552 return err 4553 } 4554 4555 errorBody.Seek(0, io.SeekStart) 4556 4557 return output 4558} 4559 4560func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4561 output := &types.LimitExceededException{} 4562 var buff [1024]byte 4563 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4564 4565 body := io.TeeReader(errorBody, ringBuffer) 4566 decoder := json.NewDecoder(body) 4567 decoder.UseNumber() 4568 var shape interface{} 4569 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4570 var snapshot bytes.Buffer 4571 io.Copy(&snapshot, ringBuffer) 4572 err = &smithy.DeserializationError{ 4573 Err: fmt.Errorf("failed to decode response body, %w", err), 4574 Snapshot: snapshot.Bytes(), 4575 } 4576 return err 4577 } 4578 4579 err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) 4580 4581 if err != nil { 4582 var snapshot bytes.Buffer 4583 io.Copy(&snapshot, ringBuffer) 4584 err = &smithy.DeserializationError{ 4585 Err: fmt.Errorf("failed to decode response body, %w", err), 4586 Snapshot: snapshot.Bytes(), 4587 } 4588 return err 4589 } 4590 4591 errorBody.Seek(0, io.SeekStart) 4592 4593 return output 4594} 4595 4596func awsRestjson1_deserializeErrorMissingParameterValueException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4597 output := &types.MissingParameterValueException{} 4598 var buff [1024]byte 4599 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4600 4601 body := io.TeeReader(errorBody, ringBuffer) 4602 decoder := json.NewDecoder(body) 4603 decoder.UseNumber() 4604 var shape interface{} 4605 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4606 var snapshot bytes.Buffer 4607 io.Copy(&snapshot, ringBuffer) 4608 err = &smithy.DeserializationError{ 4609 Err: fmt.Errorf("failed to decode response body, %w", err), 4610 Snapshot: snapshot.Bytes(), 4611 } 4612 return err 4613 } 4614 4615 err := awsRestjson1_deserializeDocumentMissingParameterValueException(&output, shape) 4616 4617 if err != nil { 4618 var snapshot bytes.Buffer 4619 io.Copy(&snapshot, ringBuffer) 4620 err = &smithy.DeserializationError{ 4621 Err: fmt.Errorf("failed to decode response body, %w", err), 4622 Snapshot: snapshot.Bytes(), 4623 } 4624 return err 4625 } 4626 4627 errorBody.Seek(0, io.SeekStart) 4628 4629 return output 4630} 4631 4632func awsRestjson1_deserializeErrorPolicyEnforcedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4633 output := &types.PolicyEnforcedException{} 4634 var buff [1024]byte 4635 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4636 4637 body := io.TeeReader(errorBody, ringBuffer) 4638 decoder := json.NewDecoder(body) 4639 decoder.UseNumber() 4640 var shape interface{} 4641 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4642 var snapshot bytes.Buffer 4643 io.Copy(&snapshot, ringBuffer) 4644 err = &smithy.DeserializationError{ 4645 Err: fmt.Errorf("failed to decode response body, %w", err), 4646 Snapshot: snapshot.Bytes(), 4647 } 4648 return err 4649 } 4650 4651 err := awsRestjson1_deserializeDocumentPolicyEnforcedException(&output, shape) 4652 4653 if err != nil { 4654 var snapshot bytes.Buffer 4655 io.Copy(&snapshot, ringBuffer) 4656 err = &smithy.DeserializationError{ 4657 Err: fmt.Errorf("failed to decode response body, %w", err), 4658 Snapshot: snapshot.Bytes(), 4659 } 4660 return err 4661 } 4662 4663 errorBody.Seek(0, io.SeekStart) 4664 4665 return output 4666} 4667 4668func awsRestjson1_deserializeErrorRequestTimeoutException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4669 output := &types.RequestTimeoutException{} 4670 var buff [1024]byte 4671 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4672 4673 body := io.TeeReader(errorBody, ringBuffer) 4674 decoder := json.NewDecoder(body) 4675 decoder.UseNumber() 4676 var shape interface{} 4677 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4678 var snapshot bytes.Buffer 4679 io.Copy(&snapshot, ringBuffer) 4680 err = &smithy.DeserializationError{ 4681 Err: fmt.Errorf("failed to decode response body, %w", err), 4682 Snapshot: snapshot.Bytes(), 4683 } 4684 return err 4685 } 4686 4687 err := awsRestjson1_deserializeDocumentRequestTimeoutException(&output, shape) 4688 4689 if err != nil { 4690 var snapshot bytes.Buffer 4691 io.Copy(&snapshot, ringBuffer) 4692 err = &smithy.DeserializationError{ 4693 Err: fmt.Errorf("failed to decode response body, %w", err), 4694 Snapshot: snapshot.Bytes(), 4695 } 4696 return err 4697 } 4698 4699 errorBody.Seek(0, io.SeekStart) 4700 4701 return output 4702} 4703 4704func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4705 output := &types.ResourceNotFoundException{} 4706 var buff [1024]byte 4707 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4708 4709 body := io.TeeReader(errorBody, ringBuffer) 4710 decoder := json.NewDecoder(body) 4711 decoder.UseNumber() 4712 var shape interface{} 4713 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4714 var snapshot bytes.Buffer 4715 io.Copy(&snapshot, ringBuffer) 4716 err = &smithy.DeserializationError{ 4717 Err: fmt.Errorf("failed to decode response body, %w", err), 4718 Snapshot: snapshot.Bytes(), 4719 } 4720 return err 4721 } 4722 4723 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 4724 4725 if err != nil { 4726 var snapshot bytes.Buffer 4727 io.Copy(&snapshot, ringBuffer) 4728 err = &smithy.DeserializationError{ 4729 Err: fmt.Errorf("failed to decode response body, %w", err), 4730 Snapshot: snapshot.Bytes(), 4731 } 4732 return err 4733 } 4734 4735 errorBody.Seek(0, io.SeekStart) 4736 4737 return output 4738} 4739 4740func awsRestjson1_deserializeErrorServiceUnavailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4741 output := &types.ServiceUnavailableException{} 4742 var buff [1024]byte 4743 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4744 4745 body := io.TeeReader(errorBody, ringBuffer) 4746 decoder := json.NewDecoder(body) 4747 decoder.UseNumber() 4748 var shape interface{} 4749 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4750 var snapshot bytes.Buffer 4751 io.Copy(&snapshot, ringBuffer) 4752 err = &smithy.DeserializationError{ 4753 Err: fmt.Errorf("failed to decode response body, %w", err), 4754 Snapshot: snapshot.Bytes(), 4755 } 4756 return err 4757 } 4758 4759 err := awsRestjson1_deserializeDocumentServiceUnavailableException(&output, shape) 4760 4761 if err != nil { 4762 var snapshot bytes.Buffer 4763 io.Copy(&snapshot, ringBuffer) 4764 err = &smithy.DeserializationError{ 4765 Err: fmt.Errorf("failed to decode response body, %w", err), 4766 Snapshot: snapshot.Bytes(), 4767 } 4768 return err 4769 } 4770 4771 errorBody.Seek(0, io.SeekStart) 4772 4773 return output 4774} 4775 4776func awsRestjson1_deserializeDocumentAccessControlPolicyList(v *[]types.Grant, value interface{}) error { 4777 if v == nil { 4778 return fmt.Errorf("unexpected nil of type %T", v) 4779 } 4780 if value == nil { 4781 return nil 4782 } 4783 4784 shape, ok := value.([]interface{}) 4785 if !ok { 4786 return fmt.Errorf("unexpected JSON type %v", value) 4787 } 4788 4789 var cv []types.Grant 4790 if *v == nil { 4791 cv = []types.Grant{} 4792 } else { 4793 cv = *v 4794 } 4795 4796 for _, value := range shape { 4797 var col types.Grant 4798 destAddr := &col 4799 if err := awsRestjson1_deserializeDocumentGrant(&destAddr, value); err != nil { 4800 return err 4801 } 4802 col = *destAddr 4803 cv = append(cv, col) 4804 4805 } 4806 *v = cv 4807 return nil 4808} 4809 4810func awsRestjson1_deserializeDocumentCSVInput(v **types.CSVInput, value interface{}) error { 4811 if v == nil { 4812 return fmt.Errorf("unexpected nil of type %T", v) 4813 } 4814 if value == nil { 4815 return nil 4816 } 4817 4818 shape, ok := value.(map[string]interface{}) 4819 if !ok { 4820 return fmt.Errorf("unexpected JSON type %v", value) 4821 } 4822 4823 var sv *types.CSVInput 4824 if *v == nil { 4825 sv = &types.CSVInput{} 4826 } else { 4827 sv = *v 4828 } 4829 4830 for key, value := range shape { 4831 switch key { 4832 case "Comments": 4833 if value != nil { 4834 jtv, ok := value.(string) 4835 if !ok { 4836 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4837 } 4838 sv.Comments = ptr.String(jtv) 4839 } 4840 4841 case "FieldDelimiter": 4842 if value != nil { 4843 jtv, ok := value.(string) 4844 if !ok { 4845 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4846 } 4847 sv.FieldDelimiter = ptr.String(jtv) 4848 } 4849 4850 case "FileHeaderInfo": 4851 if value != nil { 4852 jtv, ok := value.(string) 4853 if !ok { 4854 return fmt.Errorf("expected FileHeaderInfo to be of type string, got %T instead", value) 4855 } 4856 sv.FileHeaderInfo = types.FileHeaderInfo(jtv) 4857 } 4858 4859 case "QuoteCharacter": 4860 if value != nil { 4861 jtv, ok := value.(string) 4862 if !ok { 4863 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4864 } 4865 sv.QuoteCharacter = ptr.String(jtv) 4866 } 4867 4868 case "QuoteEscapeCharacter": 4869 if value != nil { 4870 jtv, ok := value.(string) 4871 if !ok { 4872 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4873 } 4874 sv.QuoteEscapeCharacter = ptr.String(jtv) 4875 } 4876 4877 case "RecordDelimiter": 4878 if value != nil { 4879 jtv, ok := value.(string) 4880 if !ok { 4881 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4882 } 4883 sv.RecordDelimiter = ptr.String(jtv) 4884 } 4885 4886 default: 4887 _, _ = key, value 4888 4889 } 4890 } 4891 *v = sv 4892 return nil 4893} 4894 4895func awsRestjson1_deserializeDocumentCSVOutput(v **types.CSVOutput, value interface{}) error { 4896 if v == nil { 4897 return fmt.Errorf("unexpected nil of type %T", v) 4898 } 4899 if value == nil { 4900 return nil 4901 } 4902 4903 shape, ok := value.(map[string]interface{}) 4904 if !ok { 4905 return fmt.Errorf("unexpected JSON type %v", value) 4906 } 4907 4908 var sv *types.CSVOutput 4909 if *v == nil { 4910 sv = &types.CSVOutput{} 4911 } else { 4912 sv = *v 4913 } 4914 4915 for key, value := range shape { 4916 switch key { 4917 case "FieldDelimiter": 4918 if value != nil { 4919 jtv, ok := value.(string) 4920 if !ok { 4921 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4922 } 4923 sv.FieldDelimiter = ptr.String(jtv) 4924 } 4925 4926 case "QuoteCharacter": 4927 if value != nil { 4928 jtv, ok := value.(string) 4929 if !ok { 4930 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4931 } 4932 sv.QuoteCharacter = ptr.String(jtv) 4933 } 4934 4935 case "QuoteEscapeCharacter": 4936 if value != nil { 4937 jtv, ok := value.(string) 4938 if !ok { 4939 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4940 } 4941 sv.QuoteEscapeCharacter = ptr.String(jtv) 4942 } 4943 4944 case "QuoteFields": 4945 if value != nil { 4946 jtv, ok := value.(string) 4947 if !ok { 4948 return fmt.Errorf("expected QuoteFields to be of type string, got %T instead", value) 4949 } 4950 sv.QuoteFields = types.QuoteFields(jtv) 4951 } 4952 4953 case "RecordDelimiter": 4954 if value != nil { 4955 jtv, ok := value.(string) 4956 if !ok { 4957 return fmt.Errorf("expected string to be of type string, got %T instead", value) 4958 } 4959 sv.RecordDelimiter = ptr.String(jtv) 4960 } 4961 4962 default: 4963 _, _ = key, value 4964 4965 } 4966 } 4967 *v = sv 4968 return nil 4969} 4970 4971func awsRestjson1_deserializeDocumentDataRetrievalPolicy(v **types.DataRetrievalPolicy, value interface{}) error { 4972 if v == nil { 4973 return fmt.Errorf("unexpected nil of type %T", v) 4974 } 4975 if value == nil { 4976 return nil 4977 } 4978 4979 shape, ok := value.(map[string]interface{}) 4980 if !ok { 4981 return fmt.Errorf("unexpected JSON type %v", value) 4982 } 4983 4984 var sv *types.DataRetrievalPolicy 4985 if *v == nil { 4986 sv = &types.DataRetrievalPolicy{} 4987 } else { 4988 sv = *v 4989 } 4990 4991 for key, value := range shape { 4992 switch key { 4993 case "Rules": 4994 if err := awsRestjson1_deserializeDocumentDataRetrievalRulesList(&sv.Rules, value); err != nil { 4995 return err 4996 } 4997 4998 default: 4999 _, _ = key, value 5000 5001 } 5002 } 5003 *v = sv 5004 return nil 5005} 5006 5007func awsRestjson1_deserializeDocumentDataRetrievalRule(v **types.DataRetrievalRule, value interface{}) error { 5008 if v == nil { 5009 return fmt.Errorf("unexpected nil of type %T", v) 5010 } 5011 if value == nil { 5012 return nil 5013 } 5014 5015 shape, ok := value.(map[string]interface{}) 5016 if !ok { 5017 return fmt.Errorf("unexpected JSON type %v", value) 5018 } 5019 5020 var sv *types.DataRetrievalRule 5021 if *v == nil { 5022 sv = &types.DataRetrievalRule{} 5023 } else { 5024 sv = *v 5025 } 5026 5027 for key, value := range shape { 5028 switch key { 5029 case "BytesPerHour": 5030 if value != nil { 5031 jtv, ok := value.(json.Number) 5032 if !ok { 5033 return fmt.Errorf("expected NullableLong to be json.Number, got %T instead", value) 5034 } 5035 i64, err := jtv.Int64() 5036 if err != nil { 5037 return err 5038 } 5039 sv.BytesPerHour = ptr.Int64(i64) 5040 } 5041 5042 case "Strategy": 5043 if value != nil { 5044 jtv, ok := value.(string) 5045 if !ok { 5046 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5047 } 5048 sv.Strategy = ptr.String(jtv) 5049 } 5050 5051 default: 5052 _, _ = key, value 5053 5054 } 5055 } 5056 *v = sv 5057 return nil 5058} 5059 5060func awsRestjson1_deserializeDocumentDataRetrievalRulesList(v *[]types.DataRetrievalRule, value interface{}) error { 5061 if v == nil { 5062 return fmt.Errorf("unexpected nil of type %T", v) 5063 } 5064 if value == nil { 5065 return nil 5066 } 5067 5068 shape, ok := value.([]interface{}) 5069 if !ok { 5070 return fmt.Errorf("unexpected JSON type %v", value) 5071 } 5072 5073 var cv []types.DataRetrievalRule 5074 if *v == nil { 5075 cv = []types.DataRetrievalRule{} 5076 } else { 5077 cv = *v 5078 } 5079 5080 for _, value := range shape { 5081 var col types.DataRetrievalRule 5082 destAddr := &col 5083 if err := awsRestjson1_deserializeDocumentDataRetrievalRule(&destAddr, value); err != nil { 5084 return err 5085 } 5086 col = *destAddr 5087 cv = append(cv, col) 5088 5089 } 5090 *v = cv 5091 return nil 5092} 5093 5094func awsRestjson1_deserializeDocumentDescribeVaultOutput(v **types.DescribeVaultOutput, value interface{}) error { 5095 if v == nil { 5096 return fmt.Errorf("unexpected nil of type %T", v) 5097 } 5098 if value == nil { 5099 return nil 5100 } 5101 5102 shape, ok := value.(map[string]interface{}) 5103 if !ok { 5104 return fmt.Errorf("unexpected JSON type %v", value) 5105 } 5106 5107 var sv *types.DescribeVaultOutput 5108 if *v == nil { 5109 sv = &types.DescribeVaultOutput{} 5110 } else { 5111 sv = *v 5112 } 5113 5114 for key, value := range shape { 5115 switch key { 5116 case "CreationDate": 5117 if value != nil { 5118 jtv, ok := value.(string) 5119 if !ok { 5120 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5121 } 5122 sv.CreationDate = ptr.String(jtv) 5123 } 5124 5125 case "LastInventoryDate": 5126 if value != nil { 5127 jtv, ok := value.(string) 5128 if !ok { 5129 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5130 } 5131 sv.LastInventoryDate = ptr.String(jtv) 5132 } 5133 5134 case "NumberOfArchives": 5135 if value != nil { 5136 jtv, ok := value.(json.Number) 5137 if !ok { 5138 return fmt.Errorf("expected long to be json.Number, got %T instead", value) 5139 } 5140 i64, err := jtv.Int64() 5141 if err != nil { 5142 return err 5143 } 5144 sv.NumberOfArchives = i64 5145 } 5146 5147 case "SizeInBytes": 5148 if value != nil { 5149 jtv, ok := value.(json.Number) 5150 if !ok { 5151 return fmt.Errorf("expected long to be json.Number, got %T instead", value) 5152 } 5153 i64, err := jtv.Int64() 5154 if err != nil { 5155 return err 5156 } 5157 sv.SizeInBytes = i64 5158 } 5159 5160 case "VaultARN": 5161 if value != nil { 5162 jtv, ok := value.(string) 5163 if !ok { 5164 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5165 } 5166 sv.VaultARN = ptr.String(jtv) 5167 } 5168 5169 case "VaultName": 5170 if value != nil { 5171 jtv, ok := value.(string) 5172 if !ok { 5173 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5174 } 5175 sv.VaultName = ptr.String(jtv) 5176 } 5177 5178 default: 5179 _, _ = key, value 5180 5181 } 5182 } 5183 *v = sv 5184 return nil 5185} 5186 5187func awsRestjson1_deserializeDocumentEncryption(v **types.Encryption, value interface{}) error { 5188 if v == nil { 5189 return fmt.Errorf("unexpected nil of type %T", v) 5190 } 5191 if value == nil { 5192 return nil 5193 } 5194 5195 shape, ok := value.(map[string]interface{}) 5196 if !ok { 5197 return fmt.Errorf("unexpected JSON type %v", value) 5198 } 5199 5200 var sv *types.Encryption 5201 if *v == nil { 5202 sv = &types.Encryption{} 5203 } else { 5204 sv = *v 5205 } 5206 5207 for key, value := range shape { 5208 switch key { 5209 case "EncryptionType": 5210 if value != nil { 5211 jtv, ok := value.(string) 5212 if !ok { 5213 return fmt.Errorf("expected EncryptionType to be of type string, got %T instead", value) 5214 } 5215 sv.EncryptionType = types.EncryptionType(jtv) 5216 } 5217 5218 case "KMSContext": 5219 if value != nil { 5220 jtv, ok := value.(string) 5221 if !ok { 5222 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5223 } 5224 sv.KMSContext = ptr.String(jtv) 5225 } 5226 5227 case "KMSKeyId": 5228 if value != nil { 5229 jtv, ok := value.(string) 5230 if !ok { 5231 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5232 } 5233 sv.KMSKeyId = ptr.String(jtv) 5234 } 5235 5236 default: 5237 _, _ = key, value 5238 5239 } 5240 } 5241 *v = sv 5242 return nil 5243} 5244 5245func awsRestjson1_deserializeDocumentGlacierJobDescription(v **types.GlacierJobDescription, value interface{}) error { 5246 if v == nil { 5247 return fmt.Errorf("unexpected nil of type %T", v) 5248 } 5249 if value == nil { 5250 return nil 5251 } 5252 5253 shape, ok := value.(map[string]interface{}) 5254 if !ok { 5255 return fmt.Errorf("unexpected JSON type %v", value) 5256 } 5257 5258 var sv *types.GlacierJobDescription 5259 if *v == nil { 5260 sv = &types.GlacierJobDescription{} 5261 } else { 5262 sv = *v 5263 } 5264 5265 for key, value := range shape { 5266 switch key { 5267 case "Action": 5268 if value != nil { 5269 jtv, ok := value.(string) 5270 if !ok { 5271 return fmt.Errorf("expected ActionCode to be of type string, got %T instead", value) 5272 } 5273 sv.Action = types.ActionCode(jtv) 5274 } 5275 5276 case "ArchiveId": 5277 if value != nil { 5278 jtv, ok := value.(string) 5279 if !ok { 5280 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5281 } 5282 sv.ArchiveId = ptr.String(jtv) 5283 } 5284 5285 case "ArchiveSHA256TreeHash": 5286 if value != nil { 5287 jtv, ok := value.(string) 5288 if !ok { 5289 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5290 } 5291 sv.ArchiveSHA256TreeHash = ptr.String(jtv) 5292 } 5293 5294 case "ArchiveSizeInBytes": 5295 if value != nil { 5296 jtv, ok := value.(json.Number) 5297 if !ok { 5298 return fmt.Errorf("expected Size to be json.Number, got %T instead", value) 5299 } 5300 i64, err := jtv.Int64() 5301 if err != nil { 5302 return err 5303 } 5304 sv.ArchiveSizeInBytes = ptr.Int64(i64) 5305 } 5306 5307 case "Completed": 5308 if value != nil { 5309 jtv, ok := value.(bool) 5310 if !ok { 5311 return fmt.Errorf("expected boolean to be of type *bool, got %T instead", value) 5312 } 5313 sv.Completed = jtv 5314 } 5315 5316 case "CompletionDate": 5317 if value != nil { 5318 jtv, ok := value.(string) 5319 if !ok { 5320 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5321 } 5322 sv.CompletionDate = ptr.String(jtv) 5323 } 5324 5325 case "CreationDate": 5326 if value != nil { 5327 jtv, ok := value.(string) 5328 if !ok { 5329 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5330 } 5331 sv.CreationDate = ptr.String(jtv) 5332 } 5333 5334 case "InventoryRetrievalParameters": 5335 if err := awsRestjson1_deserializeDocumentInventoryRetrievalJobDescription(&sv.InventoryRetrievalParameters, value); err != nil { 5336 return err 5337 } 5338 5339 case "InventorySizeInBytes": 5340 if value != nil { 5341 jtv, ok := value.(json.Number) 5342 if !ok { 5343 return fmt.Errorf("expected Size to be json.Number, got %T instead", value) 5344 } 5345 i64, err := jtv.Int64() 5346 if err != nil { 5347 return err 5348 } 5349 sv.InventorySizeInBytes = ptr.Int64(i64) 5350 } 5351 5352 case "JobDescription": 5353 if value != nil { 5354 jtv, ok := value.(string) 5355 if !ok { 5356 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5357 } 5358 sv.JobDescription = ptr.String(jtv) 5359 } 5360 5361 case "JobId": 5362 if value != nil { 5363 jtv, ok := value.(string) 5364 if !ok { 5365 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5366 } 5367 sv.JobId = ptr.String(jtv) 5368 } 5369 5370 case "JobOutputPath": 5371 if value != nil { 5372 jtv, ok := value.(string) 5373 if !ok { 5374 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5375 } 5376 sv.JobOutputPath = ptr.String(jtv) 5377 } 5378 5379 case "OutputLocation": 5380 if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil { 5381 return err 5382 } 5383 5384 case "RetrievalByteRange": 5385 if value != nil { 5386 jtv, ok := value.(string) 5387 if !ok { 5388 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5389 } 5390 sv.RetrievalByteRange = ptr.String(jtv) 5391 } 5392 5393 case "SelectParameters": 5394 if err := awsRestjson1_deserializeDocumentSelectParameters(&sv.SelectParameters, value); err != nil { 5395 return err 5396 } 5397 5398 case "SHA256TreeHash": 5399 if value != nil { 5400 jtv, ok := value.(string) 5401 if !ok { 5402 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5403 } 5404 sv.SHA256TreeHash = ptr.String(jtv) 5405 } 5406 5407 case "SNSTopic": 5408 if value != nil { 5409 jtv, ok := value.(string) 5410 if !ok { 5411 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5412 } 5413 sv.SNSTopic = ptr.String(jtv) 5414 } 5415 5416 case "StatusCode": 5417 if value != nil { 5418 jtv, ok := value.(string) 5419 if !ok { 5420 return fmt.Errorf("expected StatusCode to be of type string, got %T instead", value) 5421 } 5422 sv.StatusCode = types.StatusCode(jtv) 5423 } 5424 5425 case "StatusMessage": 5426 if value != nil { 5427 jtv, ok := value.(string) 5428 if !ok { 5429 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5430 } 5431 sv.StatusMessage = ptr.String(jtv) 5432 } 5433 5434 case "Tier": 5435 if value != nil { 5436 jtv, ok := value.(string) 5437 if !ok { 5438 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5439 } 5440 sv.Tier = ptr.String(jtv) 5441 } 5442 5443 case "VaultARN": 5444 if value != nil { 5445 jtv, ok := value.(string) 5446 if !ok { 5447 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5448 } 5449 sv.VaultARN = ptr.String(jtv) 5450 } 5451 5452 default: 5453 _, _ = key, value 5454 5455 } 5456 } 5457 *v = sv 5458 return nil 5459} 5460 5461func awsRestjson1_deserializeDocumentGrant(v **types.Grant, value interface{}) error { 5462 if v == nil { 5463 return fmt.Errorf("unexpected nil of type %T", v) 5464 } 5465 if value == nil { 5466 return nil 5467 } 5468 5469 shape, ok := value.(map[string]interface{}) 5470 if !ok { 5471 return fmt.Errorf("unexpected JSON type %v", value) 5472 } 5473 5474 var sv *types.Grant 5475 if *v == nil { 5476 sv = &types.Grant{} 5477 } else { 5478 sv = *v 5479 } 5480 5481 for key, value := range shape { 5482 switch key { 5483 case "Grantee": 5484 if err := awsRestjson1_deserializeDocumentGrantee(&sv.Grantee, value); err != nil { 5485 return err 5486 } 5487 5488 case "Permission": 5489 if value != nil { 5490 jtv, ok := value.(string) 5491 if !ok { 5492 return fmt.Errorf("expected Permission to be of type string, got %T instead", value) 5493 } 5494 sv.Permission = types.Permission(jtv) 5495 } 5496 5497 default: 5498 _, _ = key, value 5499 5500 } 5501 } 5502 *v = sv 5503 return nil 5504} 5505 5506func awsRestjson1_deserializeDocumentGrantee(v **types.Grantee, value interface{}) error { 5507 if v == nil { 5508 return fmt.Errorf("unexpected nil of type %T", v) 5509 } 5510 if value == nil { 5511 return nil 5512 } 5513 5514 shape, ok := value.(map[string]interface{}) 5515 if !ok { 5516 return fmt.Errorf("unexpected JSON type %v", value) 5517 } 5518 5519 var sv *types.Grantee 5520 if *v == nil { 5521 sv = &types.Grantee{} 5522 } else { 5523 sv = *v 5524 } 5525 5526 for key, value := range shape { 5527 switch key { 5528 case "DisplayName": 5529 if value != nil { 5530 jtv, ok := value.(string) 5531 if !ok { 5532 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5533 } 5534 sv.DisplayName = ptr.String(jtv) 5535 } 5536 5537 case "EmailAddress": 5538 if value != nil { 5539 jtv, ok := value.(string) 5540 if !ok { 5541 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5542 } 5543 sv.EmailAddress = ptr.String(jtv) 5544 } 5545 5546 case "ID": 5547 if value != nil { 5548 jtv, ok := value.(string) 5549 if !ok { 5550 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5551 } 5552 sv.ID = ptr.String(jtv) 5553 } 5554 5555 case "Type": 5556 if value != nil { 5557 jtv, ok := value.(string) 5558 if !ok { 5559 return fmt.Errorf("expected Type to be of type string, got %T instead", value) 5560 } 5561 sv.Type = types.Type(jtv) 5562 } 5563 5564 case "URI": 5565 if value != nil { 5566 jtv, ok := value.(string) 5567 if !ok { 5568 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5569 } 5570 sv.URI = ptr.String(jtv) 5571 } 5572 5573 default: 5574 _, _ = key, value 5575 5576 } 5577 } 5578 *v = sv 5579 return nil 5580} 5581 5582func awsRestjson1_deserializeDocumentHashmap(v *map[string]string, value interface{}) error { 5583 if v == nil { 5584 return fmt.Errorf("unexpected nil of type %T", v) 5585 } 5586 if value == nil { 5587 return nil 5588 } 5589 5590 shape, ok := value.(map[string]interface{}) 5591 if !ok { 5592 return fmt.Errorf("unexpected JSON type %v", value) 5593 } 5594 5595 var mv map[string]string 5596 if *v == nil { 5597 mv = map[string]string{} 5598 } else { 5599 mv = *v 5600 } 5601 5602 for key, value := range shape { 5603 var parsedVal string 5604 if value != nil { 5605 jtv, ok := value.(string) 5606 if !ok { 5607 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5608 } 5609 parsedVal = jtv 5610 } 5611 mv[key] = parsedVal 5612 5613 } 5614 *v = mv 5615 return nil 5616} 5617 5618func awsRestjson1_deserializeDocumentInputSerialization(v **types.InputSerialization, value interface{}) error { 5619 if v == nil { 5620 return fmt.Errorf("unexpected nil of type %T", v) 5621 } 5622 if value == nil { 5623 return nil 5624 } 5625 5626 shape, ok := value.(map[string]interface{}) 5627 if !ok { 5628 return fmt.Errorf("unexpected JSON type %v", value) 5629 } 5630 5631 var sv *types.InputSerialization 5632 if *v == nil { 5633 sv = &types.InputSerialization{} 5634 } else { 5635 sv = *v 5636 } 5637 5638 for key, value := range shape { 5639 switch key { 5640 case "csv": 5641 if err := awsRestjson1_deserializeDocumentCSVInput(&sv.Csv, value); err != nil { 5642 return err 5643 } 5644 5645 default: 5646 _, _ = key, value 5647 5648 } 5649 } 5650 *v = sv 5651 return nil 5652} 5653 5654func awsRestjson1_deserializeDocumentInsufficientCapacityException(v **types.InsufficientCapacityException, value interface{}) error { 5655 if v == nil { 5656 return fmt.Errorf("unexpected nil of type %T", v) 5657 } 5658 if value == nil { 5659 return nil 5660 } 5661 5662 shape, ok := value.(map[string]interface{}) 5663 if !ok { 5664 return fmt.Errorf("unexpected JSON type %v", value) 5665 } 5666 5667 var sv *types.InsufficientCapacityException 5668 if *v == nil { 5669 sv = &types.InsufficientCapacityException{} 5670 } else { 5671 sv = *v 5672 } 5673 5674 for key, value := range shape { 5675 switch key { 5676 case "code": 5677 if value != nil { 5678 jtv, ok := value.(string) 5679 if !ok { 5680 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5681 } 5682 sv.Code = ptr.String(jtv) 5683 } 5684 5685 case "message": 5686 if value != nil { 5687 jtv, ok := value.(string) 5688 if !ok { 5689 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5690 } 5691 sv.Message = ptr.String(jtv) 5692 } 5693 5694 case "type": 5695 if value != nil { 5696 jtv, ok := value.(string) 5697 if !ok { 5698 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5699 } 5700 sv.Type = ptr.String(jtv) 5701 } 5702 5703 default: 5704 _, _ = key, value 5705 5706 } 5707 } 5708 *v = sv 5709 return nil 5710} 5711 5712func awsRestjson1_deserializeDocumentInvalidParameterValueException(v **types.InvalidParameterValueException, value interface{}) error { 5713 if v == nil { 5714 return fmt.Errorf("unexpected nil of type %T", v) 5715 } 5716 if value == nil { 5717 return nil 5718 } 5719 5720 shape, ok := value.(map[string]interface{}) 5721 if !ok { 5722 return fmt.Errorf("unexpected JSON type %v", value) 5723 } 5724 5725 var sv *types.InvalidParameterValueException 5726 if *v == nil { 5727 sv = &types.InvalidParameterValueException{} 5728 } else { 5729 sv = *v 5730 } 5731 5732 for key, value := range shape { 5733 switch key { 5734 case "code": 5735 if value != nil { 5736 jtv, ok := value.(string) 5737 if !ok { 5738 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5739 } 5740 sv.Code = ptr.String(jtv) 5741 } 5742 5743 case "message": 5744 if value != nil { 5745 jtv, ok := value.(string) 5746 if !ok { 5747 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5748 } 5749 sv.Message = ptr.String(jtv) 5750 } 5751 5752 case "type": 5753 if value != nil { 5754 jtv, ok := value.(string) 5755 if !ok { 5756 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5757 } 5758 sv.Type = ptr.String(jtv) 5759 } 5760 5761 default: 5762 _, _ = key, value 5763 5764 } 5765 } 5766 *v = sv 5767 return nil 5768} 5769 5770func awsRestjson1_deserializeDocumentInventoryRetrievalJobDescription(v **types.InventoryRetrievalJobDescription, value interface{}) error { 5771 if v == nil { 5772 return fmt.Errorf("unexpected nil of type %T", v) 5773 } 5774 if value == nil { 5775 return nil 5776 } 5777 5778 shape, ok := value.(map[string]interface{}) 5779 if !ok { 5780 return fmt.Errorf("unexpected JSON type %v", value) 5781 } 5782 5783 var sv *types.InventoryRetrievalJobDescription 5784 if *v == nil { 5785 sv = &types.InventoryRetrievalJobDescription{} 5786 } else { 5787 sv = *v 5788 } 5789 5790 for key, value := range shape { 5791 switch key { 5792 case "EndDate": 5793 if value != nil { 5794 jtv, ok := value.(string) 5795 if !ok { 5796 return fmt.Errorf("expected DateTime to be of type string, got %T instead", value) 5797 } 5798 sv.EndDate = ptr.String(jtv) 5799 } 5800 5801 case "Format": 5802 if value != nil { 5803 jtv, ok := value.(string) 5804 if !ok { 5805 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5806 } 5807 sv.Format = ptr.String(jtv) 5808 } 5809 5810 case "Limit": 5811 if value != nil { 5812 jtv, ok := value.(string) 5813 if !ok { 5814 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5815 } 5816 sv.Limit = ptr.String(jtv) 5817 } 5818 5819 case "Marker": 5820 if value != nil { 5821 jtv, ok := value.(string) 5822 if !ok { 5823 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5824 } 5825 sv.Marker = ptr.String(jtv) 5826 } 5827 5828 case "StartDate": 5829 if value != nil { 5830 jtv, ok := value.(string) 5831 if !ok { 5832 return fmt.Errorf("expected DateTime to be of type string, got %T instead", value) 5833 } 5834 sv.StartDate = ptr.String(jtv) 5835 } 5836 5837 default: 5838 _, _ = key, value 5839 5840 } 5841 } 5842 *v = sv 5843 return nil 5844} 5845 5846func awsRestjson1_deserializeDocumentJobList(v *[]types.GlacierJobDescription, value interface{}) error { 5847 if v == nil { 5848 return fmt.Errorf("unexpected nil of type %T", v) 5849 } 5850 if value == nil { 5851 return nil 5852 } 5853 5854 shape, ok := value.([]interface{}) 5855 if !ok { 5856 return fmt.Errorf("unexpected JSON type %v", value) 5857 } 5858 5859 var cv []types.GlacierJobDescription 5860 if *v == nil { 5861 cv = []types.GlacierJobDescription{} 5862 } else { 5863 cv = *v 5864 } 5865 5866 for _, value := range shape { 5867 var col types.GlacierJobDescription 5868 destAddr := &col 5869 if err := awsRestjson1_deserializeDocumentGlacierJobDescription(&destAddr, value); err != nil { 5870 return err 5871 } 5872 col = *destAddr 5873 cv = append(cv, col) 5874 5875 } 5876 *v = cv 5877 return nil 5878} 5879 5880func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 5881 if v == nil { 5882 return fmt.Errorf("unexpected nil of type %T", v) 5883 } 5884 if value == nil { 5885 return nil 5886 } 5887 5888 shape, ok := value.(map[string]interface{}) 5889 if !ok { 5890 return fmt.Errorf("unexpected JSON type %v", value) 5891 } 5892 5893 var sv *types.LimitExceededException 5894 if *v == nil { 5895 sv = &types.LimitExceededException{} 5896 } else { 5897 sv = *v 5898 } 5899 5900 for key, value := range shape { 5901 switch key { 5902 case "code": 5903 if value != nil { 5904 jtv, ok := value.(string) 5905 if !ok { 5906 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5907 } 5908 sv.Code = ptr.String(jtv) 5909 } 5910 5911 case "message": 5912 if value != nil { 5913 jtv, ok := value.(string) 5914 if !ok { 5915 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5916 } 5917 sv.Message = ptr.String(jtv) 5918 } 5919 5920 case "type": 5921 if value != nil { 5922 jtv, ok := value.(string) 5923 if !ok { 5924 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5925 } 5926 sv.Type = ptr.String(jtv) 5927 } 5928 5929 default: 5930 _, _ = key, value 5931 5932 } 5933 } 5934 *v = sv 5935 return nil 5936} 5937 5938func awsRestjson1_deserializeDocumentMissingParameterValueException(v **types.MissingParameterValueException, value interface{}) error { 5939 if v == nil { 5940 return fmt.Errorf("unexpected nil of type %T", v) 5941 } 5942 if value == nil { 5943 return nil 5944 } 5945 5946 shape, ok := value.(map[string]interface{}) 5947 if !ok { 5948 return fmt.Errorf("unexpected JSON type %v", value) 5949 } 5950 5951 var sv *types.MissingParameterValueException 5952 if *v == nil { 5953 sv = &types.MissingParameterValueException{} 5954 } else { 5955 sv = *v 5956 } 5957 5958 for key, value := range shape { 5959 switch key { 5960 case "code": 5961 if value != nil { 5962 jtv, ok := value.(string) 5963 if !ok { 5964 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5965 } 5966 sv.Code = ptr.String(jtv) 5967 } 5968 5969 case "message": 5970 if value != nil { 5971 jtv, ok := value.(string) 5972 if !ok { 5973 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5974 } 5975 sv.Message = ptr.String(jtv) 5976 } 5977 5978 case "type": 5979 if value != nil { 5980 jtv, ok := value.(string) 5981 if !ok { 5982 return fmt.Errorf("expected string to be of type string, got %T instead", value) 5983 } 5984 sv.Type = ptr.String(jtv) 5985 } 5986 5987 default: 5988 _, _ = key, value 5989 5990 } 5991 } 5992 *v = sv 5993 return nil 5994} 5995 5996func awsRestjson1_deserializeDocumentNotificationEventList(v *[]string, value interface{}) error { 5997 if v == nil { 5998 return fmt.Errorf("unexpected nil of type %T", v) 5999 } 6000 if value == nil { 6001 return nil 6002 } 6003 6004 shape, ok := value.([]interface{}) 6005 if !ok { 6006 return fmt.Errorf("unexpected JSON type %v", value) 6007 } 6008 6009 var cv []string 6010 if *v == nil { 6011 cv = []string{} 6012 } else { 6013 cv = *v 6014 } 6015 6016 for _, value := range shape { 6017 var col string 6018 if value != nil { 6019 jtv, ok := value.(string) 6020 if !ok { 6021 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6022 } 6023 col = jtv 6024 } 6025 cv = append(cv, col) 6026 6027 } 6028 *v = cv 6029 return nil 6030} 6031 6032func awsRestjson1_deserializeDocumentOutputLocation(v **types.OutputLocation, value interface{}) error { 6033 if v == nil { 6034 return fmt.Errorf("unexpected nil of type %T", v) 6035 } 6036 if value == nil { 6037 return nil 6038 } 6039 6040 shape, ok := value.(map[string]interface{}) 6041 if !ok { 6042 return fmt.Errorf("unexpected JSON type %v", value) 6043 } 6044 6045 var sv *types.OutputLocation 6046 if *v == nil { 6047 sv = &types.OutputLocation{} 6048 } else { 6049 sv = *v 6050 } 6051 6052 for key, value := range shape { 6053 switch key { 6054 case "S3": 6055 if err := awsRestjson1_deserializeDocumentS3Location(&sv.S3, value); err != nil { 6056 return err 6057 } 6058 6059 default: 6060 _, _ = key, value 6061 6062 } 6063 } 6064 *v = sv 6065 return nil 6066} 6067 6068func awsRestjson1_deserializeDocumentOutputSerialization(v **types.OutputSerialization, value interface{}) error { 6069 if v == nil { 6070 return fmt.Errorf("unexpected nil of type %T", v) 6071 } 6072 if value == nil { 6073 return nil 6074 } 6075 6076 shape, ok := value.(map[string]interface{}) 6077 if !ok { 6078 return fmt.Errorf("unexpected JSON type %v", value) 6079 } 6080 6081 var sv *types.OutputSerialization 6082 if *v == nil { 6083 sv = &types.OutputSerialization{} 6084 } else { 6085 sv = *v 6086 } 6087 6088 for key, value := range shape { 6089 switch key { 6090 case "csv": 6091 if err := awsRestjson1_deserializeDocumentCSVOutput(&sv.Csv, value); err != nil { 6092 return err 6093 } 6094 6095 default: 6096 _, _ = key, value 6097 6098 } 6099 } 6100 *v = sv 6101 return nil 6102} 6103 6104func awsRestjson1_deserializeDocumentPartList(v *[]types.PartListElement, value interface{}) error { 6105 if v == nil { 6106 return fmt.Errorf("unexpected nil of type %T", v) 6107 } 6108 if value == nil { 6109 return nil 6110 } 6111 6112 shape, ok := value.([]interface{}) 6113 if !ok { 6114 return fmt.Errorf("unexpected JSON type %v", value) 6115 } 6116 6117 var cv []types.PartListElement 6118 if *v == nil { 6119 cv = []types.PartListElement{} 6120 } else { 6121 cv = *v 6122 } 6123 6124 for _, value := range shape { 6125 var col types.PartListElement 6126 destAddr := &col 6127 if err := awsRestjson1_deserializeDocumentPartListElement(&destAddr, value); err != nil { 6128 return err 6129 } 6130 col = *destAddr 6131 cv = append(cv, col) 6132 6133 } 6134 *v = cv 6135 return nil 6136} 6137 6138func awsRestjson1_deserializeDocumentPartListElement(v **types.PartListElement, value interface{}) error { 6139 if v == nil { 6140 return fmt.Errorf("unexpected nil of type %T", v) 6141 } 6142 if value == nil { 6143 return nil 6144 } 6145 6146 shape, ok := value.(map[string]interface{}) 6147 if !ok { 6148 return fmt.Errorf("unexpected JSON type %v", value) 6149 } 6150 6151 var sv *types.PartListElement 6152 if *v == nil { 6153 sv = &types.PartListElement{} 6154 } else { 6155 sv = *v 6156 } 6157 6158 for key, value := range shape { 6159 switch key { 6160 case "RangeInBytes": 6161 if value != nil { 6162 jtv, ok := value.(string) 6163 if !ok { 6164 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6165 } 6166 sv.RangeInBytes = ptr.String(jtv) 6167 } 6168 6169 case "SHA256TreeHash": 6170 if value != nil { 6171 jtv, ok := value.(string) 6172 if !ok { 6173 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6174 } 6175 sv.SHA256TreeHash = ptr.String(jtv) 6176 } 6177 6178 default: 6179 _, _ = key, value 6180 6181 } 6182 } 6183 *v = sv 6184 return nil 6185} 6186 6187func awsRestjson1_deserializeDocumentPolicyEnforcedException(v **types.PolicyEnforcedException, value interface{}) error { 6188 if v == nil { 6189 return fmt.Errorf("unexpected nil of type %T", v) 6190 } 6191 if value == nil { 6192 return nil 6193 } 6194 6195 shape, ok := value.(map[string]interface{}) 6196 if !ok { 6197 return fmt.Errorf("unexpected JSON type %v", value) 6198 } 6199 6200 var sv *types.PolicyEnforcedException 6201 if *v == nil { 6202 sv = &types.PolicyEnforcedException{} 6203 } else { 6204 sv = *v 6205 } 6206 6207 for key, value := range shape { 6208 switch key { 6209 case "code": 6210 if value != nil { 6211 jtv, ok := value.(string) 6212 if !ok { 6213 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6214 } 6215 sv.Code = ptr.String(jtv) 6216 } 6217 6218 case "message": 6219 if value != nil { 6220 jtv, ok := value.(string) 6221 if !ok { 6222 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6223 } 6224 sv.Message = ptr.String(jtv) 6225 } 6226 6227 case "type": 6228 if value != nil { 6229 jtv, ok := value.(string) 6230 if !ok { 6231 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6232 } 6233 sv.Type = ptr.String(jtv) 6234 } 6235 6236 default: 6237 _, _ = key, value 6238 6239 } 6240 } 6241 *v = sv 6242 return nil 6243} 6244 6245func awsRestjson1_deserializeDocumentProvisionedCapacityDescription(v **types.ProvisionedCapacityDescription, value interface{}) error { 6246 if v == nil { 6247 return fmt.Errorf("unexpected nil of type %T", v) 6248 } 6249 if value == nil { 6250 return nil 6251 } 6252 6253 shape, ok := value.(map[string]interface{}) 6254 if !ok { 6255 return fmt.Errorf("unexpected JSON type %v", value) 6256 } 6257 6258 var sv *types.ProvisionedCapacityDescription 6259 if *v == nil { 6260 sv = &types.ProvisionedCapacityDescription{} 6261 } else { 6262 sv = *v 6263 } 6264 6265 for key, value := range shape { 6266 switch key { 6267 case "CapacityId": 6268 if value != nil { 6269 jtv, ok := value.(string) 6270 if !ok { 6271 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6272 } 6273 sv.CapacityId = ptr.String(jtv) 6274 } 6275 6276 case "ExpirationDate": 6277 if value != nil { 6278 jtv, ok := value.(string) 6279 if !ok { 6280 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6281 } 6282 sv.ExpirationDate = ptr.String(jtv) 6283 } 6284 6285 case "StartDate": 6286 if value != nil { 6287 jtv, ok := value.(string) 6288 if !ok { 6289 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6290 } 6291 sv.StartDate = ptr.String(jtv) 6292 } 6293 6294 default: 6295 _, _ = key, value 6296 6297 } 6298 } 6299 *v = sv 6300 return nil 6301} 6302 6303func awsRestjson1_deserializeDocumentProvisionedCapacityList(v *[]types.ProvisionedCapacityDescription, value interface{}) error { 6304 if v == nil { 6305 return fmt.Errorf("unexpected nil of type %T", v) 6306 } 6307 if value == nil { 6308 return nil 6309 } 6310 6311 shape, ok := value.([]interface{}) 6312 if !ok { 6313 return fmt.Errorf("unexpected JSON type %v", value) 6314 } 6315 6316 var cv []types.ProvisionedCapacityDescription 6317 if *v == nil { 6318 cv = []types.ProvisionedCapacityDescription{} 6319 } else { 6320 cv = *v 6321 } 6322 6323 for _, value := range shape { 6324 var col types.ProvisionedCapacityDescription 6325 destAddr := &col 6326 if err := awsRestjson1_deserializeDocumentProvisionedCapacityDescription(&destAddr, value); err != nil { 6327 return err 6328 } 6329 col = *destAddr 6330 cv = append(cv, col) 6331 6332 } 6333 *v = cv 6334 return nil 6335} 6336 6337func awsRestjson1_deserializeDocumentRequestTimeoutException(v **types.RequestTimeoutException, value interface{}) error { 6338 if v == nil { 6339 return fmt.Errorf("unexpected nil of type %T", v) 6340 } 6341 if value == nil { 6342 return nil 6343 } 6344 6345 shape, ok := value.(map[string]interface{}) 6346 if !ok { 6347 return fmt.Errorf("unexpected JSON type %v", value) 6348 } 6349 6350 var sv *types.RequestTimeoutException 6351 if *v == nil { 6352 sv = &types.RequestTimeoutException{} 6353 } else { 6354 sv = *v 6355 } 6356 6357 for key, value := range shape { 6358 switch key { 6359 case "code": 6360 if value != nil { 6361 jtv, ok := value.(string) 6362 if !ok { 6363 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6364 } 6365 sv.Code = ptr.String(jtv) 6366 } 6367 6368 case "message": 6369 if value != nil { 6370 jtv, ok := value.(string) 6371 if !ok { 6372 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6373 } 6374 sv.Message = ptr.String(jtv) 6375 } 6376 6377 case "type": 6378 if value != nil { 6379 jtv, ok := value.(string) 6380 if !ok { 6381 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6382 } 6383 sv.Type = ptr.String(jtv) 6384 } 6385 6386 default: 6387 _, _ = key, value 6388 6389 } 6390 } 6391 *v = sv 6392 return nil 6393} 6394 6395func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 6396 if v == nil { 6397 return fmt.Errorf("unexpected nil of type %T", v) 6398 } 6399 if value == nil { 6400 return nil 6401 } 6402 6403 shape, ok := value.(map[string]interface{}) 6404 if !ok { 6405 return fmt.Errorf("unexpected JSON type %v", value) 6406 } 6407 6408 var sv *types.ResourceNotFoundException 6409 if *v == nil { 6410 sv = &types.ResourceNotFoundException{} 6411 } else { 6412 sv = *v 6413 } 6414 6415 for key, value := range shape { 6416 switch key { 6417 case "code": 6418 if value != nil { 6419 jtv, ok := value.(string) 6420 if !ok { 6421 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6422 } 6423 sv.Code = ptr.String(jtv) 6424 } 6425 6426 case "message": 6427 if value != nil { 6428 jtv, ok := value.(string) 6429 if !ok { 6430 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6431 } 6432 sv.Message = ptr.String(jtv) 6433 } 6434 6435 case "type": 6436 if value != nil { 6437 jtv, ok := value.(string) 6438 if !ok { 6439 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6440 } 6441 sv.Type = ptr.String(jtv) 6442 } 6443 6444 default: 6445 _, _ = key, value 6446 6447 } 6448 } 6449 *v = sv 6450 return nil 6451} 6452 6453func awsRestjson1_deserializeDocumentS3Location(v **types.S3Location, value interface{}) error { 6454 if v == nil { 6455 return fmt.Errorf("unexpected nil of type %T", v) 6456 } 6457 if value == nil { 6458 return nil 6459 } 6460 6461 shape, ok := value.(map[string]interface{}) 6462 if !ok { 6463 return fmt.Errorf("unexpected JSON type %v", value) 6464 } 6465 6466 var sv *types.S3Location 6467 if *v == nil { 6468 sv = &types.S3Location{} 6469 } else { 6470 sv = *v 6471 } 6472 6473 for key, value := range shape { 6474 switch key { 6475 case "AccessControlList": 6476 if err := awsRestjson1_deserializeDocumentAccessControlPolicyList(&sv.AccessControlList, value); err != nil { 6477 return err 6478 } 6479 6480 case "BucketName": 6481 if value != nil { 6482 jtv, ok := value.(string) 6483 if !ok { 6484 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6485 } 6486 sv.BucketName = ptr.String(jtv) 6487 } 6488 6489 case "CannedACL": 6490 if value != nil { 6491 jtv, ok := value.(string) 6492 if !ok { 6493 return fmt.Errorf("expected CannedACL to be of type string, got %T instead", value) 6494 } 6495 sv.CannedACL = types.CannedACL(jtv) 6496 } 6497 6498 case "Encryption": 6499 if err := awsRestjson1_deserializeDocumentEncryption(&sv.Encryption, value); err != nil { 6500 return err 6501 } 6502 6503 case "Prefix": 6504 if value != nil { 6505 jtv, ok := value.(string) 6506 if !ok { 6507 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6508 } 6509 sv.Prefix = ptr.String(jtv) 6510 } 6511 6512 case "StorageClass": 6513 if value != nil { 6514 jtv, ok := value.(string) 6515 if !ok { 6516 return fmt.Errorf("expected StorageClass to be of type string, got %T instead", value) 6517 } 6518 sv.StorageClass = types.StorageClass(jtv) 6519 } 6520 6521 case "Tagging": 6522 if err := awsRestjson1_deserializeDocumentHashmap(&sv.Tagging, value); err != nil { 6523 return err 6524 } 6525 6526 case "UserMetadata": 6527 if err := awsRestjson1_deserializeDocumentHashmap(&sv.UserMetadata, value); err != nil { 6528 return err 6529 } 6530 6531 default: 6532 _, _ = key, value 6533 6534 } 6535 } 6536 *v = sv 6537 return nil 6538} 6539 6540func awsRestjson1_deserializeDocumentSelectParameters(v **types.SelectParameters, value interface{}) error { 6541 if v == nil { 6542 return fmt.Errorf("unexpected nil of type %T", v) 6543 } 6544 if value == nil { 6545 return nil 6546 } 6547 6548 shape, ok := value.(map[string]interface{}) 6549 if !ok { 6550 return fmt.Errorf("unexpected JSON type %v", value) 6551 } 6552 6553 var sv *types.SelectParameters 6554 if *v == nil { 6555 sv = &types.SelectParameters{} 6556 } else { 6557 sv = *v 6558 } 6559 6560 for key, value := range shape { 6561 switch key { 6562 case "Expression": 6563 if value != nil { 6564 jtv, ok := value.(string) 6565 if !ok { 6566 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6567 } 6568 sv.Expression = ptr.String(jtv) 6569 } 6570 6571 case "ExpressionType": 6572 if value != nil { 6573 jtv, ok := value.(string) 6574 if !ok { 6575 return fmt.Errorf("expected ExpressionType to be of type string, got %T instead", value) 6576 } 6577 sv.ExpressionType = types.ExpressionType(jtv) 6578 } 6579 6580 case "InputSerialization": 6581 if err := awsRestjson1_deserializeDocumentInputSerialization(&sv.InputSerialization, value); err != nil { 6582 return err 6583 } 6584 6585 case "OutputSerialization": 6586 if err := awsRestjson1_deserializeDocumentOutputSerialization(&sv.OutputSerialization, value); err != nil { 6587 return err 6588 } 6589 6590 default: 6591 _, _ = key, value 6592 6593 } 6594 } 6595 *v = sv 6596 return nil 6597} 6598 6599func awsRestjson1_deserializeDocumentServiceUnavailableException(v **types.ServiceUnavailableException, value interface{}) error { 6600 if v == nil { 6601 return fmt.Errorf("unexpected nil of type %T", v) 6602 } 6603 if value == nil { 6604 return nil 6605 } 6606 6607 shape, ok := value.(map[string]interface{}) 6608 if !ok { 6609 return fmt.Errorf("unexpected JSON type %v", value) 6610 } 6611 6612 var sv *types.ServiceUnavailableException 6613 if *v == nil { 6614 sv = &types.ServiceUnavailableException{} 6615 } else { 6616 sv = *v 6617 } 6618 6619 for key, value := range shape { 6620 switch key { 6621 case "code": 6622 if value != nil { 6623 jtv, ok := value.(string) 6624 if !ok { 6625 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6626 } 6627 sv.Code = ptr.String(jtv) 6628 } 6629 6630 case "message": 6631 if value != nil { 6632 jtv, ok := value.(string) 6633 if !ok { 6634 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6635 } 6636 sv.Message = ptr.String(jtv) 6637 } 6638 6639 case "type": 6640 if value != nil { 6641 jtv, ok := value.(string) 6642 if !ok { 6643 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6644 } 6645 sv.Type = ptr.String(jtv) 6646 } 6647 6648 default: 6649 _, _ = key, value 6650 6651 } 6652 } 6653 *v = sv 6654 return nil 6655} 6656 6657func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 6658 if v == nil { 6659 return fmt.Errorf("unexpected nil of type %T", v) 6660 } 6661 if value == nil { 6662 return nil 6663 } 6664 6665 shape, ok := value.(map[string]interface{}) 6666 if !ok { 6667 return fmt.Errorf("unexpected JSON type %v", value) 6668 } 6669 6670 var mv map[string]string 6671 if *v == nil { 6672 mv = map[string]string{} 6673 } else { 6674 mv = *v 6675 } 6676 6677 for key, value := range shape { 6678 var parsedVal string 6679 if value != nil { 6680 jtv, ok := value.(string) 6681 if !ok { 6682 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 6683 } 6684 parsedVal = jtv 6685 } 6686 mv[key] = parsedVal 6687 6688 } 6689 *v = mv 6690 return nil 6691} 6692 6693func awsRestjson1_deserializeDocumentUploadListElement(v **types.UploadListElement, value interface{}) error { 6694 if v == nil { 6695 return fmt.Errorf("unexpected nil of type %T", v) 6696 } 6697 if value == nil { 6698 return nil 6699 } 6700 6701 shape, ok := value.(map[string]interface{}) 6702 if !ok { 6703 return fmt.Errorf("unexpected JSON type %v", value) 6704 } 6705 6706 var sv *types.UploadListElement 6707 if *v == nil { 6708 sv = &types.UploadListElement{} 6709 } else { 6710 sv = *v 6711 } 6712 6713 for key, value := range shape { 6714 switch key { 6715 case "ArchiveDescription": 6716 if value != nil { 6717 jtv, ok := value.(string) 6718 if !ok { 6719 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6720 } 6721 sv.ArchiveDescription = ptr.String(jtv) 6722 } 6723 6724 case "CreationDate": 6725 if value != nil { 6726 jtv, ok := value.(string) 6727 if !ok { 6728 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6729 } 6730 sv.CreationDate = ptr.String(jtv) 6731 } 6732 6733 case "MultipartUploadId": 6734 if value != nil { 6735 jtv, ok := value.(string) 6736 if !ok { 6737 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6738 } 6739 sv.MultipartUploadId = ptr.String(jtv) 6740 } 6741 6742 case "PartSizeInBytes": 6743 if value != nil { 6744 jtv, ok := value.(json.Number) 6745 if !ok { 6746 return fmt.Errorf("expected long to be json.Number, got %T instead", value) 6747 } 6748 i64, err := jtv.Int64() 6749 if err != nil { 6750 return err 6751 } 6752 sv.PartSizeInBytes = i64 6753 } 6754 6755 case "VaultARN": 6756 if value != nil { 6757 jtv, ok := value.(string) 6758 if !ok { 6759 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6760 } 6761 sv.VaultARN = ptr.String(jtv) 6762 } 6763 6764 default: 6765 _, _ = key, value 6766 6767 } 6768 } 6769 *v = sv 6770 return nil 6771} 6772 6773func awsRestjson1_deserializeDocumentUploadsList(v *[]types.UploadListElement, value interface{}) error { 6774 if v == nil { 6775 return fmt.Errorf("unexpected nil of type %T", v) 6776 } 6777 if value == nil { 6778 return nil 6779 } 6780 6781 shape, ok := value.([]interface{}) 6782 if !ok { 6783 return fmt.Errorf("unexpected JSON type %v", value) 6784 } 6785 6786 var cv []types.UploadListElement 6787 if *v == nil { 6788 cv = []types.UploadListElement{} 6789 } else { 6790 cv = *v 6791 } 6792 6793 for _, value := range shape { 6794 var col types.UploadListElement 6795 destAddr := &col 6796 if err := awsRestjson1_deserializeDocumentUploadListElement(&destAddr, value); err != nil { 6797 return err 6798 } 6799 col = *destAddr 6800 cv = append(cv, col) 6801 6802 } 6803 *v = cv 6804 return nil 6805} 6806 6807func awsRestjson1_deserializeDocumentVaultAccessPolicy(v **types.VaultAccessPolicy, value interface{}) error { 6808 if v == nil { 6809 return fmt.Errorf("unexpected nil of type %T", v) 6810 } 6811 if value == nil { 6812 return nil 6813 } 6814 6815 shape, ok := value.(map[string]interface{}) 6816 if !ok { 6817 return fmt.Errorf("unexpected JSON type %v", value) 6818 } 6819 6820 var sv *types.VaultAccessPolicy 6821 if *v == nil { 6822 sv = &types.VaultAccessPolicy{} 6823 } else { 6824 sv = *v 6825 } 6826 6827 for key, value := range shape { 6828 switch key { 6829 case "Policy": 6830 if value != nil { 6831 jtv, ok := value.(string) 6832 if !ok { 6833 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6834 } 6835 sv.Policy = ptr.String(jtv) 6836 } 6837 6838 default: 6839 _, _ = key, value 6840 6841 } 6842 } 6843 *v = sv 6844 return nil 6845} 6846 6847func awsRestjson1_deserializeDocumentVaultList(v *[]types.DescribeVaultOutput, value interface{}) error { 6848 if v == nil { 6849 return fmt.Errorf("unexpected nil of type %T", v) 6850 } 6851 if value == nil { 6852 return nil 6853 } 6854 6855 shape, ok := value.([]interface{}) 6856 if !ok { 6857 return fmt.Errorf("unexpected JSON type %v", value) 6858 } 6859 6860 var cv []types.DescribeVaultOutput 6861 if *v == nil { 6862 cv = []types.DescribeVaultOutput{} 6863 } else { 6864 cv = *v 6865 } 6866 6867 for _, value := range shape { 6868 var col types.DescribeVaultOutput 6869 destAddr := &col 6870 if err := awsRestjson1_deserializeDocumentDescribeVaultOutput(&destAddr, value); err != nil { 6871 return err 6872 } 6873 col = *destAddr 6874 cv = append(cv, col) 6875 6876 } 6877 *v = cv 6878 return nil 6879} 6880 6881func awsRestjson1_deserializeDocumentVaultNotificationConfig(v **types.VaultNotificationConfig, value interface{}) error { 6882 if v == nil { 6883 return fmt.Errorf("unexpected nil of type %T", v) 6884 } 6885 if value == nil { 6886 return nil 6887 } 6888 6889 shape, ok := value.(map[string]interface{}) 6890 if !ok { 6891 return fmt.Errorf("unexpected JSON type %v", value) 6892 } 6893 6894 var sv *types.VaultNotificationConfig 6895 if *v == nil { 6896 sv = &types.VaultNotificationConfig{} 6897 } else { 6898 sv = *v 6899 } 6900 6901 for key, value := range shape { 6902 switch key { 6903 case "Events": 6904 if err := awsRestjson1_deserializeDocumentNotificationEventList(&sv.Events, value); err != nil { 6905 return err 6906 } 6907 6908 case "SNSTopic": 6909 if value != nil { 6910 jtv, ok := value.(string) 6911 if !ok { 6912 return fmt.Errorf("expected string to be of type string, got %T instead", value) 6913 } 6914 sv.SNSTopic = ptr.String(jtv) 6915 } 6916 6917 default: 6918 _, _ = key, value 6919 6920 } 6921 } 6922 *v = sv 6923 return nil 6924} 6925