Repository: smithy-lang/smithy-rs (language: rust)

Issue:
`SigningSettings` doesn't implement `Clone`
[`https://docs.rs/aws-sigv4/latest/aws_sigv4/http_request/struct.SigningSettings.html`][docs] doesn't implement `Clone`, even though it should. This makes it cumbersome to cache settings for repeated request signing, since `signgin_params::Builder::settings` takes ownership of the settings type. These fields also don't implement clone/copy:

- `PercentEncodingMode`
- `PayloadChecksumKind`
- `UriPathNormalizationMode`
- `SessionTokenMode`

I think the only concern could be `excluded_headers`, which is an `Option<Vec<Cow<'_, str>>>`, though

Happy to open a PR for this later, looks like it should be as simple as adding `#[derive(Clone)]` unless there's codegen stuff I'm not seeing.

[docs]: https://docs.rs/aws-sigv4/latest/aws_sigv4/http_request/struct.SigningSettings.html


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml
index b254dcdc4a..fb5e110a9d 100644
--- a/CHANGELOG.next.toml
+++ b/CHANGELOG.next.toml
@@ -22,3 +22,9 @@ message = "Upgraded MSRV to Rust 1.75"
 references = ["smithy-rs#3553"]
 meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "all"}
 author = "jdisanti"
+
+[[aws-sdk-rust]]
+message = "Make `SigningSettings` and its fields implement `Clone` and `Copy`"
+references = ["smithy-rs#3533"]
+meta = { "breaking" = false, "tada" = false, "bug" = false }
+author = "avandesa"
diff --git a/aws/rust-runtime/aws-sigv4/Cargo.toml b/aws/rust-runtime/aws-sigv4/Cargo.toml
index 45f6e3a9fd..9a497c80e8 100644
--- a/aws/rust-runtime/aws-sigv4/Cargo.toml
+++ b/aws/rust-runtime/aws-sigv4/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "aws-sigv4"
-version = "1.2.0"
+version = "1.2.1"
 authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "David Barsky <me@davidbarsky.com>"]
 description = "SigV4 signer for HTTP requests and Event Stream messages."
 edition = "2021"
diff --git a/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs b/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
index 9b51345866..bc8409b807 100644
--- a/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
+++ b/aws/rust-runtime/aws-sigv4/src/http_request/settings.rs
@@ -10,7 +10,7 @@ use std::time::Duration;
 const HEADER_NAME_X_RAY_TRACE_ID: &str = "x-amzn-trace-id";
 
 /// HTTP-specific signing settings
-#[derive(Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq)]
 #[non_exhaustive]
 pub struct SigningSettings {
     /// Specifies how to encode the request URL when signing. Some services do not decode
@@ -45,7 +45,7 @@ pub struct SigningSettings {
 
 /// HTTP payload checksum type
 #[non_exhaustive]
-#[derive(Debug, Eq, PartialEq)]
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
 pub enum PayloadChecksumKind {
     /// Add x-amz-checksum-sha256 to the canonical request
     ///
@@ -64,7 +64,7 @@ pub enum PayloadChecksumKind {
 /// do not decode the path prior to checking the signature, requiring clients to actually
 /// _double-encode_ the URI in creating the canonical request in order to pass a signature check.
 #[non_exhaustive]
-#[derive(Debug, Eq, PartialEq)]
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
 pub enum PercentEncodingMode {
     /// Re-encode the resulting URL (e.g. %30 becomes `%2530)
     Double,
@@ -78,7 +78,7 @@ pub enum PercentEncodingMode {
 ///
 /// URI path normalization is performed based on <https://www.rfc-editor.org/rfc/rfc3986>.
 #[non_exhaustive]
-#[derive(Debug, Eq, PartialEq)]
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
 pub enum UriPathNormalizationMode {
     /// Normalize the URI path according to RFC3986
     Enabled,
@@ -100,7 +100,7 @@ impl From<bool> for UriPathNormalizationMode {
 /// Config value to specify whether X-Amz-Security-Token should be part of the canonical request.
 /// <http://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html#temporary-security-credentials>
 #[non_exhaustive]
-#[derive(Debug, Eq, PartialEq)]
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
 pub enum SessionTokenMode {
     /// Include in the canonical request before calculating the signature.
     Include,


Test patch: