Skip to content

Commit

Permalink
resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianyi Wang committed Nov 20, 2024
2 parents 3b801c2 + c527ee8 commit 606d1ad
Show file tree
Hide file tree
Showing 4,568 changed files with 512,782 additions and 105,941 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 15 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
For changes to files under the `/codegen/aws-models` folder, and manual edits to autogenerated code (e.g. `/service/s3/api.go`) please create an Issue instead of a PR for those type of changes.
# **PLEASE READ BEFORE CONTINUING**

Do not submit pull requests that directly modify generated source files, e.g. `/service/s3/api_client.go`. Generated source files will always include an identifying header:

```
// Code generated by smithy-go-codegen DO NOT EDIT.
```

Manual changes to these files will be overwritten by code generation that occurs as part of the daily SDK release process.

Do not submit pull requests that directly modify files in the `/codegen/sdk-codegen/aws-models` folder. These are API model files, owned by each AWS service team, that are updated automatically as part of the daily SDK release process. Local changes to these files will not persist.

If you believe the contents of any of these files need to be changed, please [open an issue](https://github.com/aws/aws-sdk-go-v2/issues/new/choose).

#

If the PR addresses an existing bug or feature, please reference it here.

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Integration Tests

# these are expensive, limit how often they're running
#
# functionally, all we need to do is vet the code going into main
on:
pull_request:
branches:
- main

permissions:
id-token: write

# again, expensive, only one per PR can run and they self-cancel
concurrency:
group: ci-codebuild-${{ github.ref }}
cancel-in-progress: true

jobs:
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
aws-region: us-west-2
- name: Run tests
id: integration-tests
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: aws-sdk-go-v2-integrationtests
- name: Cancel tests
if: ${{ cancelled() }}
env:
BUILD_ID: ${{ steps.integration-tests.outputs.aws-build-id }}
run: |
if [ ! -z "$BUILD_ID" ]; then
echo "aws codebuild stop-build --id $BUILD_ID"
aws codebuild stop-build --id $BUILD_ID
fi
27 changes: 22 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
dist
# Project-specific ignore
/doc
/doc-staging
.yardoc
Gemfile.lock
/internal/awstesting/integration/smoke/**/importmarker__.go
/internal/awstesting/integration/smoke/_test/
/vendor
/private/model/cli/gen-api/gen-api
.gradle/
build/
.idea/
bin/

# Mac
.DS_Store/

# Intellij
.idea/
*.iml
*.ipr
*.iws

# Node
dist

# Java
.gradle/

# vscode
.vscode/

# Ruby
.yardoc
Gemfile.lock
1,341 changes: 1,340 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ sync-api-models:

copy-attributevalue-feature:
cd ./feature/dynamodbstreams/attributevalue && \
find . -name "*.go" | grep -v "doc.go" | xargs -I % rm % && \
find ../../dynamodb/attributevalue -name "*.go" | grep -v "doc.go" | xargs -I % cp % . && \
ls *.go | grep -v "convert.go" | grep -v "doc.go" | \
find . -name "*.go" | grep -v "doc.go" | grep -v "go_module_metadata.go" | xargs -I % rm % && \
find ../../dynamodb/attributevalue -name "*.go" | grep -v "doc.go" | grep -v "go_module_metadata.go" | xargs -I % cp % . && \
ls *.go | grep -v "convert.go" | grep -v "doc.go" | grep -v "go_module_metadata.go" | \
xargs -I % sed -i.bk -E 's:github.com/aws/aws-sdk-go-v2/(service|feature)/dynamodb:github.com/aws/aws-sdk-go-v2/\1/dynamodbstreams:g' % && \
ls *.go | grep -v "convert.go" | grep -v "doc.go" | \
ls *.go | grep -v "convert.go" | grep -v "doc.go" | grep -v "go_module_metadata.go" | \
xargs -I % sed -i.bk 's:DynamoDB:DynamoDBStreams:g' % && \
ls *.go | grep -v "doc.go" | \
ls *.go | grep -v "doc.go" | grep -v "go_module_metadata.go" | \
xargs -I % sed -i.bk 's:dynamodb\.:dynamodbstreams.:g' % && \
sed -i.bk 's:streams\.:ddbtypes.:g' "convert.go" && \
sed -i.bk 's:ddb\.:streams.:g' "convert.go" && \
Expand Down Expand Up @@ -410,7 +410,7 @@ ci-lint-install:
#######################
.PHONY: integration integ-modules-% cleanup-integ-buckets

integration: integ-modules-service
integration: integ-modules-service integ-modules-feature

integ-modules-%:
@# integration command that uses the pattern to define the root path that
Expand Down
1 change: 1 addition & 0 deletions SMITHY_GO_CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
253cd261adbd51728215b44a4ce34583c663d6d7
2 changes: 1 addition & 1 deletion aws/go_module_metadata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions aws/middleware/user_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const (
UserAgentFeatureS3ExpressBucket = "J"
UserAgentFeatureS3AccessGrants = "K" // not yet implemented
UserAgentFeatureGZIPRequestCompression = "L"
UserAgentFeatureProtocolRPCV2CBOR = "M"
)

// RequestUserAgent is a build middleware that set the User-Agent for the request.
Expand Down
20 changes: 12 additions & 8 deletions aws/middleware/user_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import (
smithyhttp "github.com/aws/smithy-go/transport/http"
)

var expectedAgent = aws.SDKName + "/" + aws.SDKVersion + " os/" + getNormalizedOSName() + " lang/go#" + languageVersion + " md/GOOS#" + runtime.GOOS + " md/GOARCH#" + runtime.GOARCH
var expectedAgent = aws.SDKName + "/" + aws.SDKVersion +
" os/" + getNormalizedOSName() +
" lang/go#" + strings.Map(rules, languageVersion) + // normalize as the user-agent builder will
" md/GOOS#" + runtime.GOOS +
" md/GOARCH#" + runtime.GOARCH

func TestRequestUserAgent_HandleBuild(t *testing.T) {
cases := map[string]struct {
Expand Down Expand Up @@ -172,7 +176,7 @@ func TestAddUserAgentKey(t *testing.T) {
t.Fatalf("expect User-Agent to be present")
}
if ua[0] != c.Expect {
t.Error("User-Agent did not match expected")
t.Errorf("User-Agent: %q != %q", c.Expect, ua[0])
}
})
}
Expand Down Expand Up @@ -225,7 +229,7 @@ func TestAddUserAgentKeyValue(t *testing.T) {
t.Fatalf("expect User-Agent to be present")
}
if ua[0] != c.Expect {
t.Error("User-Agent did not match expected")
t.Errorf("User-Agent: %q != %q", c.Expect, ua[0])
}
})
}
Expand Down Expand Up @@ -290,7 +294,7 @@ func TestAddUserAgentFeature(t *testing.T) {
t.Fatalf("expect User-Agent to be present")
}
if ua[0] != c.Expect {
t.Errorf("User-Agent did not match expected, %v != %v", c.Expect, ua[0])
t.Errorf("User-Agent: %q != %q", c.Expect, ua[0])
}
})
}
Expand Down Expand Up @@ -343,7 +347,7 @@ func TestAddSDKAgentKey(t *testing.T) {
t.Fatalf("expect User-Agent to be present")
}
if ua[0] != c.Expect {
t.Error("User-Agent did not match expected")
t.Errorf("User-Agent: %q != %q", c.Expect, ua[0])
}
})
}
Expand Down Expand Up @@ -399,7 +403,7 @@ func TestAddSDKAgentKeyValue(t *testing.T) {
t.Fatalf("expect User-Agent to be present")
}
if ua[0] != c.Expect {
t.Error("User-Agent did not match expected")
t.Errorf("User-Agent: %q != %q", c.Expect, ua[0])
}
})
}
Expand Down Expand Up @@ -446,7 +450,7 @@ func TestAddUserAgentKey_AddToStack(t *testing.T) {
t.Fatalf("expect User-Agent to be present")
}
if ua[0] != c.Expect {
t.Error("User-Agent did not match expected")
t.Errorf("User-Agent: %q != %q", c.Expect, ua[0])
}
})
}
Expand Down Expand Up @@ -496,7 +500,7 @@ func TestAddUserAgentKeyValue_AddToStack(t *testing.T) {
t.Fatalf("expect User-Agent to be present")
}
if ua[0] != c.Expect {
t.Error("User-Agent did not match expected")
t.Errorf("User-Agent: %q != %q", c.Expect, ua[0])
}
})
}
Expand Down
4 changes: 4 additions & 0 deletions aws/protocol/eventstream/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.6.7 (2024-11-18)

* **Dependency Update**: Update to smithy-go v1.22.1.

# v1.6.6 (2024-10-04)

* No change notes available for this release.
Expand Down
2 changes: 1 addition & 1 deletion aws/protocol/eventstream/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream

go 1.21

require github.com/aws/smithy-go v1.22.0
require github.com/aws/smithy-go v1.22.1

replace github.com/aws/aws-sdk-go-v2 => ../../../
4 changes: 2 additions & 2 deletions aws/protocol/eventstream/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM=
github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro=
github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
2 changes: 1 addition & 1 deletion aws/protocol/eventstream/go_module_metadata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion aws/signer/v4/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,9 @@ func GetSignedRequestSignature(r *http.Request) ([]byte, error) {
const authHeaderSignatureElem = "Signature="

if auth := r.Header.Get(authorizationHeader); len(auth) != 0 {
ps := strings.Split(auth, ", ")
ps := strings.Split(auth, ",")
for _, p := range ps {
p = strings.TrimSpace(p)
if idx := strings.Index(p, authHeaderSignatureElem); idx >= 0 {
sig := p[len(authHeaderSignatureElem):]
if len(sig) == 0 {
Expand Down
57 changes: 57 additions & 0 deletions aws/signer/v4/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v4
import (
"bytes"
"context"
"encoding/hex"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -372,6 +373,62 @@ func TestUseDynamicPayloadSigningMiddleware(t *testing.T) {
}
}

func TestGetSignedRequestSignature(t *testing.T) {
testCases := map[string]struct {
authHeader string
expectedSig string
expectedErrMsg string
}{
"Valid signature": {
authHeader: "AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024",
expectedSig: "fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024",
},
"Whitespace after Signature": {
authHeader: "AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024 ",
expectedSig: "fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024",
},
"Whitespaces before Signature": {
authHeader: "AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024 ",
expectedSig: "fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024",
},
"Empty signature": {
authHeader: "AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date, Signature=",
expectedErrMsg: "invalid request signature authorization header",
},
"Missing signature": {
authHeader: "AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=host;x-amz-date",
expectedErrMsg: "request not signed",
},
}

for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
r, err := http.NewRequest("GET", "/", nil)
if err != nil {
t.Fatalf("Failed to create request: %v", err)
}
r.Header.Set("Authorization", tc.authHeader)

sig, err := GetSignedRequestSignature(r)

if tc.expectedErrMsg != "" {
if err == nil {
t.Errorf("Expected error with message '%s', but got no error", tc.expectedErrMsg)
} else if err.Error() != tc.expectedErrMsg {
t.Errorf("Expected error message '%s', but got '%s'", tc.expectedErrMsg, err.Error())
}
} else {
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
if hex.EncodeToString(sig) != tc.expectedSig {
t.Errorf("Expected signature '%s', but got '%s'", tc.expectedSig, hex.EncodeToString(sig))
}
}
})
}
}

type nonSeeker struct{}

func (nonSeeker) Read(p []byte) (n int, err error) {
Expand Down
2 changes: 1 addition & 1 deletion codegen/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
smithyVersion=1.50.0
smithyVersion=1.52.1
smithyGradleVersion=0.7.0
Loading

0 comments on commit 606d1ad

Please sign in to comment.