-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: support default checksums #1475
base: main
Are you sure you want to change the base?
Conversation
… jmespath-flatten
… flexible-checksums
A new generated diff is ready to view. |
A new generated diff is ready to view. |
import aws.smithy.kotlin.runtime.http.interceptors.FlexibleChecksumsResponseInterceptor | ||
|
||
/** | ||
* S3 variant of the flexible checksum interceptor where composite checksums are not validated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit/docs: ... of the [FlexibleChecksumsResponseInterceptor]...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correctness: This file should go in services/s3/common/src/aws/sdk/kotlin/services/s3/internal
with all the other S3-specific interceptors
/** | ||
* Determines if an operation is set up to send flexible request checksums | ||
*/ | ||
private fun requestChecksumsConfigured(ctx: ProtocolGenerator.GenerationContext, op: OperationShape): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming: "configured" implies that this is dependent on user behavior, but it's just based on the model. I suggest making this an extension function OperationShape.hasRequestAlgorithmMember(...)
val interceptor = if (ctx.model.expectShape<ServiceShape>(ctx.settings.service).isS3) { | ||
AwsRuntimeTypes.Http.Interceptors.S3FlexibleChecksumResponseInterceptor | ||
} else { | ||
RuntimeTypes.HttpClient.Interceptors.FlexibleChecksumsResponseInterceptor | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs: let's add a comment here about why S3 needs a custom interceptor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I look at this again, we could replace S3FlexibleChecksumResponseInterceptor
with something more generic that could be applied to other services. In case other services start sending composite checksums in the future. What does the team think?
private fun usingS3Express(executionContext: ExecutionContext): Boolean = | ||
executionContext.getOrNull(AttributeKey(S3_EXPRESS_ENDPOINT_PROPERTY_KEY)) != S3_EXPRESS_ENDPOINT_PROPERTY_VALUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Could be an extension function off ExecutionContext
internal class S3ExpressDefaultChecksumAlgorithm( | ||
private val isS3UploadPart: Boolean, | ||
) : HttpInterceptor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: This works but I think the previous implementation using two different interceptors was cleaner. It's not clear to me why this had to deviate so much from what we already had
- name: Save Test Reports | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-reports | ||
path: '**/build/reports' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these test reports used for?
A new generated diff is ready to view. |
A new generated diff is ready to view. |
This comment has been minimized.
This comment has been minimized.
A new generated diff is ready to view. |
This comment has been minimized.
This comment has been minimized.
A new generated diff is ready to view. |
This comment has been minimized.
This comment has been minimized.
buildSrc/build.gradle.kts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still a little concerned about this new buildSrc
and the fact that it's treated as an include-build by every module. This means every module will have the Kotlin JVM plugin applied to it which shouldn't be necessary everywhere.
https://docs.gradle.org/current/userguide/organizing_gradle_projects.html#sec:build_sources
Can we accomplish the same thing without using buildSrc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline and we're keeping buildSrc
for now
// FIXME: Enable test | ||
// Seeing: S3Exception: Checksum Type mismatch occurred, expected checksum Type: null, actual checksum Type: crc32 | ||
// ListParts has a strange pagination termination condition via [IsTerminated]. Verify it actually works correctly. | ||
@Ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When can this test be enabled? Is it still broken?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still broken, left a comment about why on slack
A new generated diff is ready to view. |
/** | ||
* Configures request checksum calculation | ||
*/ | ||
public val AwsRequestChecksumCalculation: EnvironmentSetting<String> = | ||
strEnvSetting("aws.requestChecksumCalculation", "AWS_REQUEST_CHECKSUM_CALCULATION") | ||
|
||
/** | ||
* Configures response checksum validation | ||
*/ | ||
public val AwsResponseChecksumValidation: EnvironmentSetting<String> = | ||
strEnvSetting("aws.responseChecksumValidation", "AWS_RESPONSE_CHECKSUM_VALIDATION") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Why use strEnvSetting
for these when they're enum based? Can't we just use enumEnvSetting
so you don't have to write custom parsing/matching code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that's handy. I guess I forgot/couldn't find this type. Let's start using it
This comment has been minimized.
This comment has been minimized.
Quality Gate passedIssues Measures |
A new generated diff is ready to view. |
Affected ArtifactsSignificantly increased in size
Changed in size
|
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.