Unverified Commit bb92aefc authored by Landon James's avatar Landon James Committed by GitHub
Browse files

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._
parent cae31148
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
---
applies_to: ["aws-sdk-rust"]
authors: ["landonxjames"]
references: ["smithy-rs#920"]
breaking: false
new_feature: false
bug_fix: true
---

Add missing `request_checksum_calculation` and `response_checksum_validation` setters to the `ConfigLoader`
+2 −2
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"

[[package]]
name = "aws-config"
version = "1.5.17"
version = "1.5.18"
dependencies = [
 "aws-credential-types",
 "aws-runtime",
@@ -174,7 +174,7 @@ dependencies = [

[[package]]
name = "aws-sigv4"
version = "1.2.9"
version = "1.2.8"
dependencies = [
 "aws-credential-types",
 "aws-smithy-http",
+1 −1
Original line number Diff line number Diff line
[package]
name = "aws-config"
version = "1.5.17"
version = "1.5.18"
authors = [
    "AWS Rust SDK Team <aws-sdk-rust@amazon.com>",
    "Russell Cohen <rcoh@amazon.com>",
+55 −0
Original line number Diff line number Diff line
@@ -732,6 +732,36 @@ mod loader {
            self
        }

        /// Set the checksum calculation strategy to use when making requests.
        /// # Examples
        /// ```
        /// use aws_types::SdkConfig;
        /// use aws_smithy_types::checksum_config::RequestChecksumCalculation;
        /// let config = SdkConfig::builder().request_checksum_calculation(RequestChecksumCalculation::WhenSupported).build();
        /// ```
        pub fn request_checksum_calculation(
            mut self,
            request_checksum_calculation: RequestChecksumCalculation,
        ) -> Self {
            self.request_checksum_calculation = Some(request_checksum_calculation);
            self
        }

        /// Set the checksum calculation strategy to use for responses.
        /// # Examples
        /// ```
        /// use aws_types::SdkConfig;
        /// use aws_smithy_types::checksum_config::ResponseChecksumValidation;
        /// let config = SdkConfig::builder().response_checksum_validation(ResponseChecksumValidation::WhenSupported).build();
        /// ```
        pub fn response_checksum_validation(
            mut self,
            response_checksum_validation: ResponseChecksumValidation,
        ) -> Self {
            self.response_checksum_validation = Some(response_checksum_validation);
            self
        }

        /// Load the default configuration chain
        ///
        /// If fields have been overridden during builder construction, the override values will be used.
@@ -980,6 +1010,7 @@ mod loader {
        use aws_types::app_name::AppName;
        use aws_types::origin::Origin;
        use aws_types::os_shim_internal::{Env, Fs};
        use aws_types::sdk_config::{RequestChecksumCalculation, ResponseChecksumValidation};
        use std::sync::atomic::{AtomicUsize, Ordering};
        use std::sync::Arc;

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

        #[tokio::test]
        async fn request_checksum_calculation() {
            let conf = base_conf()
                .request_checksum_calculation(RequestChecksumCalculation::WhenRequired)
                .load()
                .await;
            assert_eq!(
                Some(RequestChecksumCalculation::WhenRequired),
                conf.request_checksum_calculation()
            );
        }

        #[tokio::test]
        async fn response_checksum_validation() {
            let conf = base_conf()
                .response_checksum_validation(ResponseChecksumValidation::WhenRequired)
                .load()
                .await;
            assert_eq!(
                Some(ResponseChecksumValidation::WhenRequired),
                conf.response_checksum_validation()
            );
        }

        #[cfg(feature = "rustls")]
        #[tokio::test]
        async fn disable_default_credentials() {