Skip to content

Commit

Permalink
aws/all: Change the default for AWS URLs from V1 to V2.
Browse files Browse the repository at this point in the history
  • Loading branch information
vangent committed Aug 13, 2024
1 parent d245f10 commit 8bf667f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 4 additions & 5 deletions aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,14 @@ func NewSessionFromURLParams(q url.Values) (*session.Session, url.Values, error)
//
// "awssdk=v1" will force V1.
// "awssdk=v2" will force V2.
// No "awssdk" parameter (or any other value) will return the default, currently V1.
// Note that the default may change in the future.
// No "awssdk" parameter (or any other value) will return the default, currently V2.
func UseV2(q url.Values) bool {
if values, ok := q["awssdk"]; ok {
if values[0] == "v2" || values[0] == "V2" {
return true
if values[0] == "v1" || values[0] == "V1" {
return false
}
}
return false
return true
}

// NewDefaultV2Config returns a aws.Config for AWS SDK v2, using the default options.
Expand Down
3 changes: 3 additions & 0 deletions aws/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,17 @@ func TestUseV2(t *testing.T) {
{
name: "No overrides",
query: url.Values{},
want: true,
},
{
name: "unused param",
query: url.Values{"foo": {"bar"}},
want: true,
},
{
name: "force v1",
query: url.Values{"awssdk": {"v1"}},
want: false,
},
{
name: "force v1 cap",
Expand Down

0 comments on commit 8bf667f

Please sign in to comment.