Skip to content

Commit

Permalink
Merge upstream (#3)
Browse files Browse the repository at this point in the history
* feat: sra identity&auth refactor (aws#2364)

* Update API model

* Update endpoints model

* Update SDK's smithy-go dependency to v1.17.0

* Regenerated Clients

* Release 2023-11-15

* fix trailing comment parse in properties (aws#2371)

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-11-16

* Remove macie service

* Add changelog for last commit

* Merge customizations for service s3

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-11-17

* deprecate v4.SignHTTPRequestMiddleware (aws#2375)

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-11-20

* fix: don't send 0 max items for object version and multipart upload paginators (aws#2380)

* fix: don't expect response to be json in endpointcreds provider (aws#2381)

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-11-21

* breakfix: convert public access block config fields to nilable like s3 (aws#2385)

* Update API model

* Regenerated Clients

* Release 2023-11-22

* rebase to main branch

* Add changelog

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-11-27

* Update API model

* Regenerated Clients

* Release 2023-11-27.2

* fix: respect functional option modifications to RetryMaxAttempts (aws#2390)

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-11-28

* Change request compression codegen to operation level

* Merge customizations for service s3

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-11-28.2

* fix: correct wiring of disable s3express auth toggle (aws#2394)

* Change requestion compression comment

* Release 2023-11-28.3

* Update golang.org/x/net dependency (aws#2391)

* feat: add Options() getter to service clients (aws#2398)

* Update API model

* Update SDK's smithy-go dependency to v1.18.0

* Regenerated Clients

* Release 2023-11-29

* regenerate sdk

* Update API model

* Update endpoints model

* Update SDK's smithy-go dependency to v1.18.1

* Regenerated Clients

* Release 2023-11-30

* fix: use region overrides in endpoint discovery (aws#2393)

* Update API model

* Regenerated Clients

* Release 2023-11-30.2

* fix: correct wrapping of errors in authentication workflow (aws#2403)

* fix: correct recognition and zeroing of cache-wrapped AnonymousCredentials (aws#2404)

* Update API model

* Regenerated Clients

* Release 2023-12-01

* feat: add express integration test (aws#2402)

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-04

* Add request compression assertion to protocol unit tests

* Smithy upgrade (aws#2407)

* Update API model

* Regenerated Clients

* Release 2023-12-05

* Restore pre-SRA optionalAuth/no-auth behaviors (aws#2410)

* Update API model

* Regenerated Clients

* Release 2023-12-06

* Change config loading logic

* regenerate partitions (aws#2415)

* fix codegen ci (aws#2418)

* Update API model

* Update endpoints model

* Update SDK's smithy-go dependency to v1.19.0

* Regenerated Clients

* Release 2023-12-07

* fix: add non-vhostable buckets to path when using legacy endpoint resolver (aws#2417)

* update express cache key (aws#2414)

* fix: translation of ini service sections into shared config (aws#2416)

* fix: reinstate presence of retryer when functional opts run but still respect max attempts set therein (aws#2420)

* Update API model

* Regenerated Clients

* Release 2023-12-08

* Update API model

* Regenerated Clients

* Release 2023-12-11

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-12

* fix missing smithy-go checkout on main

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-13

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-14

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-15

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-18

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-19

* Update API model

* Update endpoints model

* Update partitions file

* Regenerated Clients

* Release 2023-12-20

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-21

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-22

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-26

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-27

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2023-12-28

* Update API model

* Regenerated Clients

* Release 2023-12-29

* removed incorrect description

* changelog added

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-03

* Fix SRA auth trailing checksum retry bug (aws#2438)

* Update API model

* Regenerated Clients

* Release 2024-01-04

* codegen: track upstream sigv4a trait changes (aws#2442)

* Update API model

* Regenerated Clients

* Release 2024-01-05

* Update API model

* Regenerated Clients

* Release 2024-01-08

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-10

* Add smoke test traits dep

Adds a dependency on smithy-smoke-test-traits in the sdk code gen
package so aws service models that use the smokeTests trait won't
fail to build because of unknown traits. Generated a client with
a smoke test and confirmed there was no diff.

Adding the dependency in the code gen package since it's the models
that need the dependency, not the code generator. When smoke tests
are implemented in the generator, we can add the dep there.

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-11

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-12

* Update API model

* Regenerated Clients

* Release 2024-01-14

* Fix signing bug in CFKVS service (aws#2452)

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-16

* Update API model

* Regenerated Clients

* Release 2024-01-17

* Remove invalid defaults from a few services (aws#2458)

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-18

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-19

* fix: remove invalid escaping of shared config values (aws#2461)

* Update API model

* Regenerated Clients

* Release 2024-01-22

* Update API model

* Regenerated Clients

* Release 2024-01-23

* codegen: normalize adding of sigv4a config based on trait presence (aws#2465)

* Update API model

* Regenerated Clients

* Release 2024-01-24

* Update API model

* Regenerated Clients

* Release 2024-01-25

* Minor GitHub workflow changes (aws#2466)

* chore: a more polite closed issue message

* chore: relax stale issue timing

* Update API model

* Regenerated Clients

* Release 2024-01-26

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-29

* Update API model

* Regenerated Clients

* Release 2024-01-30

* Update API model

* Update endpoints model

* Regenerated Clients

* Release 2024-01-31

---------

Co-authored-by: Luc Talatinian <102624213+lucix-aws@users.noreply.github.com>
Co-authored-by: AWS SDK for Go v2 automation user <aws-sdk-go-v2-github@amazon.com>
Co-authored-by: Tianyi Wang <wty@amazon.com>
Co-authored-by: Eren Yeager <92114074+wty-Bryant@users.noreply.github.com>
Co-authored-by: Isaiah Vita <82135527+isaiahvita@users.noreply.github.com>
Co-authored-by: Luc Talatinian <lucix@amazon.com>
Co-authored-by: Ran Vaknin <username@users.noreply.github.com>
Co-authored-by: Ran Vaknin <50976344+RanVaknin@users.noreply.github.com>
Co-authored-by: Miles Ziemer <mziemer@amazon.com>
Co-authored-by: Miles Ziemer <45497130+milesziemer@users.noreply.github.com>
Co-authored-by: Tom Keller <1083460+kellertk@users.noreply.github.com>
  • Loading branch information
12 people committed Feb 1, 2024
1 parent 3e7abd4 commit fe14af3
Show file tree
Hide file tree
Showing 20,829 changed files with 1,454,349 additions and 2,134,374 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 2 additions & 4 deletions .github/workflows/closed-issue-message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ jobs:
# These inputs are both required
repo-token: "${{ secrets.GITHUB_TOKEN }}"
message: |
### ⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
4 changes: 2 additions & 2 deletions .github/workflows/stale_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
closed-for-staleness-label: closed-for-staleness

# Issue timing
days-before-stale: 2
days-before-close: 5
days-before-stale: 10
days-before-close: 4
days-before-ancient: 36500

# If you don't want to mark a issue as being ancient based on a
Expand Down
1,228 changes: 1,228 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ LINT_IGNORE_S3MANAGER_INPUT='feature/s3/manager/upload.go:.+struct field SSEKMSK
# Names of these are tied to endpoint rules and they're internal so ignore them
LINT_IGNORE_AWSRULESFN_ARN='internal/endpoints/awsrulesfn/arn.go'
LINT_IGNORE_AWSRULESFN_PARTITION='internal/endpoints/awsrulesfn/partition.go'
LINT_IGNORE_PRIVATE_METRICS='aws/middleware/private/metrics'

UNIT_TEST_TAGS=
BUILD_TAGS=-tags "example,codegen,integration,ec2env,perftest"
Expand Down Expand Up @@ -254,7 +255,7 @@ unit-race-modules-%:
&& go run . -p $(subst _,/,$(subst unit-race-modules-,,$@)) ${EACHMODULE_FLAGS} \
"go vet ${BUILD_TAGS} --all ./..." \
"go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
"go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
"go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."

unit-modules-%:
@# unit command that uses the pattern to define the root path that the
Expand All @@ -266,7 +267,7 @@ unit-modules-%:
&& go run . -p $(subst _,/,$(subst unit-modules-,,$@)) ${EACHMODULE_FLAGS} \
"go vet ${BUILD_TAGS} --all ./..." \
"go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
"go test -timeout=1m ${UNIT_TEST_TAGS} ./..."
"go test -timeout=2m ${UNIT_TEST_TAGS} ./..."

build: build-modules-.

Expand Down Expand Up @@ -302,7 +303,7 @@ test-race-modules-%:
@# e.g. test-race-modules-internal_protocoltest
cd ./internal/repotools/cmd/eachmodule \
&& go run . -p $(subst _,/,$(subst test-race-modules-,,$@)) ${EACHMODULE_FLAGS} \
"go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
"go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."

test-modules-%:
@# Test command that uses the pattern to define the root path that the
Expand All @@ -312,7 +313,7 @@ test-modules-%:
@# e.g. test-modules-internal_protocoltest
cd ./internal/repotools/cmd/eachmodule \
&& go run . -p $(subst _,/,$(subst test-modules-,,$@)) ${EACHMODULE_FLAGS} \
"go test -timeout=1m ${UNIT_TEST_TAGS} ./..."
"go test -timeout=2m ${UNIT_TEST_TAGS} ./..."

cachedep: cachedep-modules-.

Expand Down Expand Up @@ -472,7 +473,8 @@ lint:
-e ${LINT_IGNORE_S3MANAGER_INPUT} \
-e ${LINTIGNORESINGLEFIGHT} \
-e ${LINT_IGNORE_AWSRULESFN_ARN} \
-e ${LINT_IGNORE_AWSRULESFN_PARTITION}`; \
-e ${LINT_IGNORE_AWSRULESFN_PARTITION} \
-e ${LINT_IGNORE_PRIVATE_METRICS}`; \
echo "$$dolint"; \
if [ "$$dolint" != "" ]; then exit 1; fi

Expand Down
15 changes: 13 additions & 2 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ type Config struct {
// BaseEndpoint is an intermediary transfer location to a service specific
// BaseEndpoint on a service's Options.
BaseEndpoint *string

// DisableRequestCompression toggles if an operation request could be
// compressed or not. Will be set to false by default. This variable is sourced from
// environment variable AWS_DISABLE_REQUEST_COMPRESSION or the shared config profile attribute
// disable_request_compression
DisableRequestCompression bool

// RequestMinCompressSizeBytes sets the inclusive min bytes of a request body that could be
// compressed. Will be set to 10240 by default and must be within 0 and 10485760 bytes inclusively.
// This variable is sourced from environment variable AWS_REQUEST_MIN_COMPRESSION_SIZE_BYTES or
// the shared config profile attribute request_min_compression_size_bytes
RequestMinCompressSizeBytes int64
}

// NewConfig returns a new Config pointer that can be chained with builder
Expand All @@ -158,8 +170,7 @@ func NewConfig() *Config {
return &Config{}
}

// Copy will return a shallow copy of the Config object. If any additional
// configurations are provided they will be merged into the new config returned.
// Copy will return a shallow copy of the Config object.
func (c Config) Copy() Config {
cp := c
return cp
Expand Down
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.

14 changes: 13 additions & 1 deletion aws/middleware/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ func GetServiceID(ctx context.Context) (v string) {
//
// Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues
// to clear all stack values.
//
// Deprecated: This value is unstable. The resolved signing name is available
// in the signer properties object passed to the signer.
func GetSigningName(ctx context.Context) (v string) {
v, _ = middleware.GetStackValue(ctx, signingNameKey{}).(string)
return v
Expand All @@ -74,6 +77,9 @@ func GetSigningName(ctx context.Context) (v string) {
//
// Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues
// to clear all stack values.
//
// Deprecated: This value is unstable. The resolved signing region is available
// in the signer properties object passed to the signer.
func GetSigningRegion(ctx context.Context) (v string) {
v, _ = middleware.GetStackValue(ctx, signingRegionKey{}).(string)
return v
Expand Down Expand Up @@ -125,10 +131,13 @@ func SetRequiresLegacyEndpoints(ctx context.Context, value bool) context.Context
return middleware.WithStackValue(ctx, requiresLegacyEndpointsKey{}, value)
}

// SetSigningName set or modifies the signing name on the context.
// SetSigningName set or modifies the sigv4 or sigv4a signing name on the context.
//
// Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues
// to clear all stack values.
//
// Deprecated: This value is unstable. Use WithSigV4SigningName client option
// funcs instead.
func SetSigningName(ctx context.Context, value string) context.Context {
return middleware.WithStackValue(ctx, signingNameKey{}, value)
}
Expand All @@ -137,6 +146,9 @@ func SetSigningName(ctx context.Context, value string) context.Context {
//
// Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues
// to clear all stack values.
//
// Deprecated: This value is unstable. Use WithSigV4SigningRegion client option
// funcs instead.
func SetSigningRegion(ctx context.Context, value string) context.Context {
return middleware.WithStackValue(ctx, signingRegionKey{}, value)
}
Expand Down
90 changes: 90 additions & 0 deletions aws/middleware/private/metrics/emf/emf.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Package emf implements an EMF metrics publisher.
//
// This package is designated as private and is intended for use only by the
// smithy client runtime. The exported API therein is not considered stable and
// is subject to breaking changes without notice.
package emf

import (
"github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics"

Check failure on line 9 in aws/middleware/private/metrics/emf/emf.go

View workflow job for this annotation

GitHub Actions / Unix SDK tests (ubuntu-latest, 1.21)

no required module provides package github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics; to add it:

Check failure on line 9 in aws/middleware/private/metrics/emf/emf.go

View workflow job for this annotation

GitHub Actions / Unix SDK tests (ubuntu-latest, 1.20)

no required module provides package github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics; to add it:

Check failure on line 9 in aws/middleware/private/metrics/emf/emf.go

View workflow job for this annotation

GitHub Actions / Windows SDK Tests (windows-latest, 1.19)

no required module provides package github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics; to add it:
"github.com/aws/aws-sdk-go-v2/internal/sdk"
)

const (
emfIdentifier = "_aws"
timestampKey = "Timestamp"
cloudWatchMetricsKey = "CloudWatchMetrics"
namespaceKey = "Namespace"
dimensionsKey = "Dimensions"
metricsKey = "Metrics"
)

// Entry represents a log entry in the EMF format.
type Entry struct {
namespace string
serializer metrics.Serializer
metrics []metric
dimensions [][]string
fields map[string]interface{}
}

type metric struct {
Name string
}

// NewEntry creates a new Entry with the specified namespace and serializer.
func NewEntry(namespace string, serializer metrics.Serializer) Entry {
return Entry{
namespace: namespace,
serializer: serializer,
metrics: []metric{},
dimensions: [][]string{{}},
fields: map[string]interface{}{},
}
}

// Build constructs the EMF log entry as a JSON string.
func (e *Entry) Build() (string, error) {

entry := map[string]interface{}{}

entry[emfIdentifier] = map[string]interface{}{
timestampKey: sdk.NowTime().UnixNano() / 1e6,
cloudWatchMetricsKey: []map[string]interface{}{
{
namespaceKey: e.namespace,
dimensionsKey: e.dimensions,
metricsKey: e.metrics,
},
},
}

for k, v := range e.fields {
entry[k] = v
}

jsonEntry, err := e.serializer.Serialize(entry)
if err != nil {
return "", err
}
return jsonEntry, nil
}

// AddDimension adds a CW Dimension to the EMF entry.
func (e *Entry) AddDimension(key string, value string) {
// Dimensions are a list of lists. We only support a single list.
e.dimensions[0] = append(e.dimensions[0], key)
e.fields[key] = value
}

// AddMetric adds a CW Metric to the EMF entry.
func (e *Entry) AddMetric(key string, value float64) {
e.metrics = append(e.metrics, metric{key})
e.fields[key] = value
}

// AddProperty adds a CW Property to the EMF entry.
// Properties are not published as metrics, but they are available in logs and in CW insights.
func (e *Entry) AddProperty(key string, value interface{}) {
e.fields[key] = value
}
145 changes: 145 additions & 0 deletions aws/middleware/private/metrics/emf/emf_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// This package is designated as private and is intended for use only by the
// smithy client runtime. The exported API therein is not considered stable and
// is subject to breaking changes without notice.

package emf

import (
"fmt"
"reflect"
"testing"
"time"

"github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics"
"github.com/aws/aws-sdk-go-v2/internal/sdk"
)

type TestSerializerWithError struct{}

func (TestSerializerWithError) Serialize(obj interface{}) (string, error) {
return "", fmt.Errorf("serialization error")
}

func TestCreateNewEntry(t *testing.T) {

sdk.NowTime = func() time.Time {
return time.Unix(1234, 0)
}

cases := map[string]struct {
Namespace string
ExpectedEntry Entry
}{
"success": {
Namespace: "testNamespace",
ExpectedEntry: Entry{
namespace: "testNamespace",
serializer: metrics.DefaultSerializer{},
metrics: []metric{},
dimensions: [][]string{{}},
fields: map[string]interface{}{},
},
},
}

for name, c := range cases {
t.Run(name, func(t *testing.T) {
actualEntry := NewEntry(c.Namespace, metrics.DefaultSerializer{})
if !reflect.DeepEqual(actualEntry, c.ExpectedEntry) {
t.Errorf("Entry contained unexpected values")
}
})
}
}

func TestBuild(t *testing.T) {

sdk.NowTime = func() time.Time {
return time.Unix(1234, 0)
}

cases := map[string]struct {
Namespace string
Configure func(entry *Entry)
Serializer metrics.Serializer
ExpectedError error
ExpectedResult string
}{
"completeEntry": {
Namespace: "testNamespace",
Serializer: metrics.DefaultSerializer{},
Configure: func(entry *Entry) {
entry.AddMetric("testMetric1", 1)
entry.AddMetric("testMetric2", 2)
entry.AddDimension("testDimension1", "dim1")
entry.AddDimension("testDimension2", "dim2")
entry.AddProperty("testProperty1", "prop1")
entry.AddProperty("testProperty2", "prop2")
},
ExpectedError: nil,
ExpectedResult: completeEntry,
},
"noMetrics": {
Namespace: "testNamespace",
Serializer: metrics.DefaultSerializer{},
Configure: func(entry *Entry) {
entry.AddDimension("testDimension1", "dim1")
entry.AddDimension("testDimension2", "dim2")
entry.AddProperty("testProperty1", "prop1")
entry.AddProperty("testProperty2", "prop2")
},
ExpectedError: nil,
ExpectedResult: noMetrics,
},
"noDimensions": {
Namespace: "testNamespace",
Serializer: metrics.DefaultSerializer{},
Configure: func(entry *Entry) {
entry.AddMetric("testMetric1", 1)
entry.AddMetric("testMetric2", 2)
entry.AddProperty("testProperty1", "prop1")
entry.AddProperty("testProperty2", "prop2")
},
ExpectedError: nil,
ExpectedResult: noDimensions,
},
"noProperties": {
Namespace: "testNamespace",
Serializer: metrics.DefaultSerializer{},
Configure: func(entry *Entry) {
entry.AddMetric("testMetric1", 1)
entry.AddMetric("testMetric2", 2)
entry.AddDimension("testDimension1", "dim1")
entry.AddDimension("testDimension2", "dim2")
},
ExpectedError: nil,
ExpectedResult: noProperties,
},
"serializationError": {
Namespace: "testNamespace",
Serializer: TestSerializerWithError{},
Configure: func(entry *Entry) {
},
ExpectedError: fmt.Errorf("serialization error"),
ExpectedResult: "",
},
}

for name, c := range cases {
t.Run(name, func(t *testing.T) {
entry := NewEntry(c.Namespace, c.Serializer)

c.Configure(&entry)

result, err := entry.Build()

if !reflect.DeepEqual(err, c.ExpectedError) {
t.Errorf("Unexpected error, should be '%s' but was '%s'", c.ExpectedError, err)
}

if !reflect.DeepEqual(result, c.ExpectedResult) {
t.Errorf("Unexpected result, should be '%s' but was '%s'", c.ExpectedResult, result)
}
})
}
}

0 comments on commit fe14af3

Please sign in to comment.