Skip to content

Commit bb92aef

Browse files
authored
Add missing setters to ConfigLoader (#4027)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> Customer reported that the `request_checksum_calculation` and `response_checksum_validation` setters were missing from the `ConfigLoader`, but were present on the `SdkConfig` builder. This PR adds those setters. ## Description <!--- Describe your changes in detail --> ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "aws-sdk-rust" in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent cae3114 commit bb92aef

File tree

4 files changed

+68
-3
lines changed

4 files changed

+68
-3
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
applies_to: ["aws-sdk-rust"]
3+
authors: ["landonxjames"]
4+
references: ["smithy-rs#920"]
5+
breaking: false
6+
new_feature: false
7+
bug_fix: true
8+
---
9+
10+
Add missing `request_checksum_calculation` and `response_checksum_validation` setters to the `ConfigLoader`

aws/rust-runtime/aws-config/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/rust-runtime/aws-config/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-config"
3-
version = "1.5.17"
3+
version = "1.5.18"
44
authors = [
55
"AWS Rust SDK Team <aws-sdk-rust@amazon.com>",
66
"Russell Cohen <rcoh@amazon.com>",

aws/rust-runtime/aws-config/src/lib.rs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,36 @@ mod loader {
732732
self
733733
}
734734

735+
/// Set the checksum calculation strategy to use when making requests.
736+
/// # Examples
737+
/// ```
738+
/// use aws_types::SdkConfig;
739+
/// use aws_smithy_types::checksum_config::RequestChecksumCalculation;
740+
/// let config = SdkConfig::builder().request_checksum_calculation(RequestChecksumCalculation::WhenSupported).build();
741+
/// ```
742+
pub fn request_checksum_calculation(
743+
mut self,
744+
request_checksum_calculation: RequestChecksumCalculation,
745+
) -> Self {
746+
self.request_checksum_calculation = Some(request_checksum_calculation);
747+
self
748+
}
749+
750+
/// Set the checksum calculation strategy to use for responses.
751+
/// # Examples
752+
/// ```
753+
/// use aws_types::SdkConfig;
754+
/// use aws_smithy_types::checksum_config::ResponseChecksumValidation;
755+
/// let config = SdkConfig::builder().response_checksum_validation(ResponseChecksumValidation::WhenSupported).build();
756+
/// ```
757+
pub fn response_checksum_validation(
758+
mut self,
759+
response_checksum_validation: ResponseChecksumValidation,
760+
) -> Self {
761+
self.response_checksum_validation = Some(response_checksum_validation);
762+
self
763+
}
764+
735765
/// Load the default configuration chain
736766
///
737767
/// If fields have been overridden during builder construction, the override values will be used.
@@ -980,6 +1010,7 @@ mod loader {
9801010
use aws_types::app_name::AppName;
9811011
use aws_types::origin::Origin;
9821012
use aws_types::os_shim_internal::{Env, Fs};
1013+
use aws_types::sdk_config::{RequestChecksumCalculation, ResponseChecksumValidation};
9831014
use std::sync::atomic::{AtomicUsize, Ordering};
9841015
use std::sync::Arc;
9851016

@@ -1160,6 +1191,30 @@ mod loader {
11601191
assert_eq!(Some(&app_name), conf.app_name());
11611192
}
11621193

1194+
#[tokio::test]
1195+
async fn request_checksum_calculation() {
1196+
let conf = base_conf()
1197+
.request_checksum_calculation(RequestChecksumCalculation::WhenRequired)
1198+
.load()
1199+
.await;
1200+
assert_eq!(
1201+
Some(RequestChecksumCalculation::WhenRequired),
1202+
conf.request_checksum_calculation()
1203+
);
1204+
}
1205+
1206+
#[tokio::test]
1207+
async fn response_checksum_validation() {
1208+
let conf = base_conf()
1209+
.response_checksum_validation(ResponseChecksumValidation::WhenRequired)
1210+
.load()
1211+
.await;
1212+
assert_eq!(
1213+
Some(ResponseChecksumValidation::WhenRequired),
1214+
conf.response_checksum_validation()
1215+
);
1216+
}
1217+
11631218
#[cfg(feature = "rustls")]
11641219
#[tokio::test]
11651220
async fn disable_default_credentials() {

0 commit comments

Comments
 (0)