-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add requestChecksumCalculation and responseChecksumValidation configs & AWSChecksumCalculationMode enum type for both config options. * Add value resolvers for requestChecksumCalculation and responseChecksumValidation config options. * Add requestChecksumCalculation and responseChecksumValidation configs to codegen side; add type info for AWSChecksumCalculationMode to codegen side. * Add context extension for getting and setting the new config options; use this in setter codegen. * Clean up flexchex request middleware conditionals into one logical flow and add in default algorithm selection logic. * Fix validation mode logic in flexchex response middleware; now it uses user input as it's supposed to. * Update flexchex request middleware codegen to pass in request checksum required flag to initializer. * Update runtime tests for flexchex middlewares + add a test for no request checksum calculation flow. * Update codegen tests. * Add CRC64NVME as one of the algorithms to check for in flexchex response middleware. * Add test case for no response validation when validation mode unset and responseChecksumValidation config is .whenRequired. * Address compile time errors in generated code. * Update codegen test * Skip checksum flow if body is empty + ignore checksum of checksums that end with -#. * Add edge case handling for a stream body with size below chunked threshold, hence checksum header must be sent in original request rather than in trailing header. * Add business metric feature ID tracking for flexible checksum v2. * Update initializer call in test. * Reflect context thread-safe changes upstream. * Fill impl gaps against SEP. * Update codegen test & fix optional chaining. * Fill unit test gap for flex checksum middlewares * Temporarily comment out manual fill for requestAlgorithmMember http header. * Add PRESIGN_URL flow to flexchex request middleware. * Update comments in FlexibleChecksumsRequestMiddleware, fix composite checksum ignore logic in FlexibleChecksumsResponseMiddleware, and add a new integration test for usig presignedURLs with S3::PutObject. * Add integration tests for default checksum flows with data and stream payloads. Fix checksum algorithm header insertion to only insert only when body is non-empty by adding early exit condition at beginning of middleware. * Address swiftlint warnings + misc. comment changes. * Response algorithms modeled for the operation via httpChecksum trait need to be respected. * Update codegen test * Bump minor version by 1; changes next release version from 1.0.79 to 1.1.0. --------- Co-authored-by: Sichan Yoo <[email protected]>
- Loading branch information
Showing
25 changed files
with
614 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.79 | ||
1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Config/AWSChecksumsConfig.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import enum AWSSDKChecksums.AWSChecksumCalculationMode | ||
@_spi(FileBasedConfig) import AWSSDKCommon | ||
|
||
public enum AWSChecksumsConfig { | ||
static func requestChecksumCalculation( | ||
configValue: AWSChecksumCalculationMode?, | ||
profileName: String?, | ||
fileBasedConfig: FileBasedConfiguration | ||
) -> AWSChecksumCalculationMode { | ||
return FieldResolver( | ||
configValue: configValue, | ||
envVarName: "AWS_REQUEST_CHECKSUM_CALCULATION", | ||
configFieldName: "request_checksum_calculation", | ||
fileBasedConfig: fileBasedConfig, | ||
profileName: profileName, | ||
converter: { AWSChecksumCalculationMode(caseInsensitiveRawValue: $0) } | ||
).value ?? .whenSupported | ||
} | ||
|
||
static func responseChecksumValidation( | ||
configValue: AWSChecksumCalculationMode?, | ||
profileName: String?, | ||
fileBasedConfig: FileBasedConfiguration | ||
) -> AWSChecksumCalculationMode { | ||
return FieldResolver( | ||
configValue: configValue, | ||
envVarName: "AWS_RESPONSE_CHECKSUM_VALIDATION", | ||
configFieldName: "response_checksum_validation", | ||
fileBasedConfig: fileBasedConfig, | ||
profileName: profileName, | ||
converter: { AWSChecksumCalculationMode(caseInsensitiveRawValue: $0) } | ||
).value ?? .whenSupported | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.