Repository: google/go-cloud
Pull request #3494 (2024-10-09 00:58:49)

aws: Add support for non-camelcased version of two URL parameters

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-cloud/pull/3494?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 73.22%. Comparing base [(`2cb18bb`)](https://app.codecov.io/gh/google/go-cloud/commit/2cb18bb5f40a47847a621d5e7d9dab50393d20d9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) to head [(`d84cd40`)](https://app.codecov.io/gh/google/go-cloud/commit/d84cd40be5c95460eefd8eec782263a0159fe70d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #3494      +/-   ##
==========================================
- Coverage   73.27%   73.22%   -0.05%     
==========================================
  Files         113      113              
  Lines       15019    15019              
==========================================
- Hits        11005    10998       -7     
- Misses       3255     3259       +4     
- Partials      759      762       +3     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/google/go-cloud/pull/3494?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).


Patch:
diff --git a/aws/aws.go b/aws/aws.go
index 2e4cbafd..f4a6dce4 100644
--- a/aws/aws.go
+++ b/aws/aws.go
@@ -80,8 +80,8 @@ func (co ConfigOverrider) ClientConfig(serviceName string, cfgs ...*aws.Config)
 // The following query options are supported:
 //   - region: The AWS region for requests; sets aws.Config.Region.
 //   - endpoint: The endpoint URL (hostname only or fully qualified URI); sets aws.Config.Endpoint.
-//   - disableSSL: A value of "true" disables SSL when sending requests; sets aws.Config.DisableSSL.
-//   - s3ForcePathStyle: A value of "true" forces the request to use path-style addressing; sets aws.Config.S3ForcePathStyle.
+//   - disable_ssl (or disableSSL): A value of "true" disables SSL when sending requests; sets aws.Config.DisableSSL.
+//   - s3_force_path_style (or s3ForcePathStyle): A value of "true" forces the request to use path-style addressing; sets aws.Config.S3ForcePathStyle.
 //   - dualstack: A value of "true" enables dual stack (IPv4 and IPv6) endpoints
 //   - fips: A value of "true" enables the use of FIPS endpoints
 func ConfigFromURLParams(q url.Values) (*aws.Config, error) {
@@ -93,13 +93,13 @@ func ConfigFromURLParams(q url.Values) (*aws.Config, error) {
 			cfg.Region = aws.String(value)
 		case "endpoint":
 			cfg.Endpoint = aws.String(value)
-		case "disableSSL":
+		case "disable_ssl", "disableSSL":
 			b, err := strconv.ParseBool(value)
 			if err != nil {
 				return nil, fmt.Errorf("invalid value for query parameter %q: %v", param, err)
 			}
 			cfg.DisableSSL = aws.Bool(b)
-		case "s3ForcePathStyle":
+		case "s3_force_path_style", "s3ForcePathStyle":
 			b, err := strconv.ParseBool(value)
 			if err != nil {
 				return nil, fmt.Errorf("invalid value for query parameter %q: %v", param, err)


Test patch:
diff --git a/aws/aws_test.go b/aws/aws_test.go
index 8ad2984e..471580a1 100644
--- a/aws/aws_test.go
+++ b/aws/aws_test.go
@@ -53,6 +53,11 @@ func TestConfigFromURLParams(t *testing.T) {
 			query:   url.Values{"endpoint": {"foo"}},
 			wantCfg: &aws.Config{Endpoint: aws.String("foo")},
 		},
+		{
+			name:    "disable_ssl true",
+			query:   url.Values{"disable_ssl": {"true"}},
+			wantCfg: &aws.Config{DisableSSL: aws.Bool(true)},
+		},
 		{
 			name:    "DisableSSL true",
 			query:   url.Values{"disableSSL": {"true"}},
@@ -68,6 +73,11 @@ func TestConfigFromURLParams(t *testing.T) {
 			query:   url.Values{"disableSSL": {"invalid"}},
 			wantErr: true,
 		},
+		{
+			name:    "s3_force_path_style true",
+			query:   url.Values{"s3_force_path_style": {"true"}},
+			wantCfg: &aws.Config{S3ForcePathStyle: aws.Bool(true)},
+		},
 		{
 			name:    "S3ForcePathStyle true",
 			query:   url.Values{"s3ForcePathStyle": {"true"}},