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

misc: Customize S3's Expires field #1287

Merged
merged 15 commits into from
Apr 19, 2024
Merged

misc: Customize S3's Expires field #1287

merged 15 commits into from
Apr 19, 2024

Conversation

lauzadis
Copy link
Member

@lauzadis lauzadis commented Apr 18, 2024

This PR customizes S3's Expires field to improve the user experience in preparation for upstream model changes.

  • Ensures Expires fields are always timestamps, even if the model changes in the future
  • Updates the value of Expires to null if parsing fails

For output shapes only:

  • Adds a new ExpiresString member which contains the raw string value of Expires
  • Deprecates Expires in favor of ExpiresString

Issue #

Description of changes

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lauzadis lauzadis requested a review from a team as a code owner April 18, 2024 19:50
@lauzadis lauzadis changed the title misc: Special-case S3's Expires field misc: Customize S3's Expires field Apr 18, 2024
Copy link

A new generated diff is ready to view.

Copy link

A new generated diff is ready to view.

Copy link

A new generated diff is ready to view.

@lauzadis
Copy link
Member Author

note: e2e tests expected to fail until smithy-kotlin is merged and released, they pass locally.

Copy link

A new generated diff is ready to view.

Copy link

A new generated diff is ready to view.

.asSequence()
.mapNotNull { shape ->
shape.members()
.singleOrNull { member -> member.memberName.lowercase() == "expires" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Prefer .equals("expires", ignoreCase = true) here and elsewhere

Instant.fromRfc5322(response.headers["Expires"]!!)
} catch (e: Exception) {
coroutineContext.logger<ExpiresFieldInterceptor>().warn {
"Failed to parse `expires`=${response.headers["Expires"]} as a timestamp, setting it to `null`. The unparsed value is available in `expiresString`."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Include quotes around the value which failed to parse. This makes values which are empty or contain multiple spaces easier to understand.

Copy link

A new generated diff is ready to view.

Copy link

A new generated diff is ready to view.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
12.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link

A new generated diff is ready to view.

@lauzadis lauzadis merged commit f065291 into main Apr 19, 2024
15 of 16 checks passed
@lauzadis lauzadis deleted the feat-s3-expires branch April 19, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants