Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECD 10/24] feat: Add support for requiresLength trait #1177

Closed
2 tasks
Tracked by #356
dayaffe opened this issue Oct 11, 2023 · 1 comment
Closed
2 tasks
Tracked by #356

[ECD 10/24] feat: Add support for requiresLength trait #1177

dayaffe opened this issue Oct 11, 2023 · 1 comment
Assignees
Labels
feature-request A feature should be added or improved.
Milestone

Comments

@dayaffe
Copy link
Contributor

dayaffe commented Oct 11, 2023

Describe the feature

This is the implementation task for #356
SEP: requires-length-trait.md

Use Case

We need to honor Smithy traits. The requiresLength trait further defines the behavior of the SDK when the stream trait is used on a request payload. At the time of writing this SEP, the list of AWS services that use the stream trait in input shapes included

  • Lambda InvokeAsync (content-length)
  • CloudSearchDomain UploadDocument (content-length)
  • S3 PutObject/UploadPart (requiresLength with content-length)
  • Glacier UploadArchive/UploadMultipart (requiresLength with content-length)
  • Lex PostContent ([Only HTTP/1.1] (transfer-encoding: chunked, content-length if length readily available))
  • MediaStore PutObject ([Only HTTP/1.1] (transfer-encoding: chunked, content-length if length readily available))

Proposed Solution

No response

Other Information

  • The requiresLength trait is a boolean trait that can only target blob shapes marked with the stream trait.
  • The shape should be denoted as a payload member.
  • The payload of the request must be signed by default unless the request's operation is explicitly marked as v4-unsigned-body [2] in its authType trait.
  • The v4-unsigned-body and requiresLength traits are not mutually exclusive. A given payload shape can be (correctly) marked with both stream and requiresLength, and the associated operation can have authType set to v4-unsigned-body.
  • The SDK implementation must fail the request if determined that the content-length header must be set but the length of the payload cannot be calculated.
  • If the length is readily available, set the content-length header. If the length is not readily available, requiresLength is not present, and v4-unsigned-body is present on the operation, set the transfer-encoding: chunked header if using HTTP/1.1. In all other cases, fail the request.

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change
@dayaffe dayaffe added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 11, 2023
@dayaffe dayaffe modified the milestone: GA Oct 11, 2023
@dayaffe dayaffe self-assigned this Oct 11, 2023
@sichanyoo sichanyoo removed the needs-triage This issue or PR still needs to be triaged. label Oct 16, 2023
@sichanyoo sichanyoo added this to the GA milestone Oct 16, 2023
@dayaffe dayaffe changed the title feat: Add support for requiresLength trait [ECD 10/24] feat: Add support for requiresLength trait Oct 18, 2023
@jbelkins
Copy link
Contributor

Released in AWS SDK for Swift 0.29.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants