From 61d474d5d66f498c07f08846c308081c0cab2536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serhat=20=C5=9Eevki=20Din=C3=A7er?= Date: Sat, 11 Mar 2023 04:34:44 +1100 Subject: [PATCH] Fix staticcheck linter warnings (#2044) --- .github/ISSUE_TEMPLATE.md | 2 - .github/ISSUE_TEMPLATE/bug-report.yml | 6 +-- .github/PULL_REQUEST_TEMPLATE.md | 4 +- .github/workflows/closed-issue-message.yml | 6 +-- CHANGELOG.md | 17 ++----- CODE_OF_CONDUCT.md | 4 +- CONTRIBUTING.md | 35 +++++++-------- DESIGN.md | 2 +- Makefile | 2 - NOTICE.txt | 2 +- README.md | 13 +++--- aws/protocol/xml/error_utils.go | 16 ++----- aws/ratelimit/token_rate_limit.go | 4 -- aws/retry/example_test.go | 2 +- aws/retry/middleware.go | 5 +-- codegen/gradlew | 1 - codegen/gradlew.bat | 1 - .../aws/go/codegen/AddAwsConfigFields.java | 10 ++--- .../aws/go/codegen/AwsEventStreamUtils.java | 45 +++++++++---------- .../AwsHttpPresignURLClientGenerator.java | 4 -- .../codegen/AwsSignatureVersion4aUtils.java | 8 ++-- .../codegen/ClientResolvedDefaultsMode.java | 8 ++-- .../codegen/EndpointDiscoveryGenerator.java | 2 - .../aws/go/codegen/EndpointGenerator.java | 20 ++++----- .../go/codegen/JsonRpcProtocolGenerator.java | 2 - .../go/codegen/RestJsonProtocolGenerator.java | 1 - .../go/codegen/RestXmlProtocolGenerator.java | 2 - .../aws/go/codegen/XmlProtocolUtils.java | 1 - .../customization/APIGatewayAcceptHeader.java | 1 - .../customization/PresignURLAutoFill.java | 2 - .../customization/Route53Customizations.java | 1 - .../customization/S3AcceptEncodingGzip.java | 1 - .../S3AddPutObjectUnseekableBodyDoc.java | 1 - .../customization/S3ContentSHA256Header.java | 1 - .../customization/S3ErrorWith200Status.java | 1 - .../customization/S3ResponseErrorWrapper.java | 1 - .../customization/S3UpdateEndpoint.java | 4 +- config/testdata/load_credentials | 1 - config/testdata/shared_config | 3 +- example/service/s3/usingPrivateLink/README.md | 14 +++--- ...api_op_GetInstanceIdentityDocument_test.go | 2 +- internal/awstesting/assert.go | 2 +- internal/awsutil/path_value.go | 2 +- internal/codegen/cmd/defaultsconfig/v1.go | 2 +- internal/endpoints/endpoints_test.go | 6 +-- .../dynamodb/testdata/scan_response.json | 2 +- service/s3/internal/customizations/doc.go | 1 - 47 files changed, 107 insertions(+), 166 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 1ecb636bf23..4a3094f75eb 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -2,10 +2,8 @@ Please fill out the sections below to help us address your issue. ### Version of AWS SDK for Go? - ### Version of Go (`go version`)? - ### What issue did you see? ### Steps to reproduce diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 6e888118447..e8f55a731e2 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -26,7 +26,7 @@ body: label: Current Behavior description: | What actually happened? - + Please include full errors, uncaught exceptions, stack traces, and relevant logs. If service responses are relevant, please include wire logs. validations: @@ -38,7 +38,7 @@ body: description: | Provide a self-contained, concise snippet of code that can be used to reproduce the issue. For more complex issues provide a repo with the smallest sample that reproduces the bug. - + Avoid including business logic or unrelated code, it makes diagnosis more difficult. The code sample should be an SSCCE. See http://sscce.org/ for details. In short, please provide a code sample that we can copy/paste, run and reproduce. validations: @@ -82,4 +82,4 @@ body: attributes: label: Operating System and version validations: - required: true + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 966c0573978..3f818468b2f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,5 @@ 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. -If there is an existing bug or feature this PR is answers please reference it here. +If the PR addresses an existing bug or feature, please reference it here. -To help speed up the process and reduce the time to merge please ensure that `Allow edits and access to secrets by maintainers` is checked before submitting your PR. This will allow the project maintainers to make minor adjustments or improvements to the submitted PR, allow us to reduce the roundtrip time for merging your request. +To help speed up the process and reduce the time to merge please ensure that `Allow edits by maintainers` is checked before submitting your PR. This will allow the project maintainers to make minor adjustments or improvements to the submitted PR, allow us to reduce the roundtrip time for merging your request. diff --git a/.github/workflows/closed-issue-message.yml b/.github/workflows/closed-issue-message.yml index 3340afb1f3b..09873e57ff6 100644 --- a/.github/workflows/closed-issue-message.yml +++ b/.github/workflows/closed-issue-message.yml @@ -11,7 +11,7 @@ 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. + ### ⚠️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. diff --git a/CHANGELOG.md b/CHANGELOG.md index 913e4fd37ad..7e06303d433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8627,7 +8627,7 @@ * Fixes [issue#1191](https://github.com/aws/aws-sdk-go-v2/issues/1191) * Refactored internal endpoints model for accessors * Feature: updated to latest models -* New services +* New services * `service/location` - v1.0.0 * `service/lookoutmetrics` - v1.0.0 ## Core SDK Highlights @@ -8711,7 +8711,7 @@ of the AWS SDK for Go v2. Version 2 incorporates customer feedback from version ## Breaking Changes * `aws`: Updated Config.Retryer member to be a func that returns aws.Retryer ([#1033](https://github.com/aws/aws-sdk-go-v2/pull/1033)) - * Updates the SDK's references to Config.Retryer to be a function that returns aws.Retryer value. This ensures that custom retry options specified in the `aws.Config` are scoped to individual client instances. + * Updates the SDK's references to Config.Retryer to be a function that returns aws.Retryer value. This ensures that custom retry options specified in the `aws.Config` are scoped to individual client instances. * All API clients created with the config will call the `Config.Retryer` function to get an aws.Retryer. * Removes duplicate `Retryer` interface from `retry` package. Single definition is `aws.Retryer` now. * `aws/middleware`: Updates `AddAttemptClockSkewMiddleware` to use appropriate `AddRecordResponseTiming` naming ([#1031](https://github.com/aws/aws-sdk-go-v2/pull/1031)) @@ -8719,7 +8719,7 @@ of the AWS SDK for Go v2. Version 2 incorporates customer feedback from version * `config`: Updated the `WithRetryer` helper to take a function that returns an aws.Retryer ([#1033](https://github.com/aws/aws-sdk-go-v2/pull/1033)) * All API clients created with the config will call the `Config.Retryer` function to get an aws.Retryer. * `API Clients`: Fix SDK's API client enum constant name generation to have expected casing ([#1020](https://github.com/aws/aws-sdk-go-v2/pull/1020)) - * This updates of the generated enum const value names in API client's `types` package to have the expected casing. Prior to this, enum names were being generated with lowercase names instead of camel case. + * This updates of the generated enum const value names in API client's `types` package to have the expected casing. Prior to this, enum names were being generated with lowercase names instead of camel case. * `API Clients`: Updates SDK's API client request middleware stack values to be scoped to individual operation call ([#1019](https://github.com/aws/aws-sdk-go-v2/pull/1019)) * The API client request middleware stack values were mistakenly allowed to escape to nested API operation calls. This broke the SDK's presigners. * Stack values that should not escape are not scoped to the individual operation call. @@ -8731,7 +8731,7 @@ of the AWS SDK for Go v2. Version 2 incorporates customer feedback from version * Adds a PresignClient to the `sts` API client module. Use PresignGetCallerIdentity to obtain presigned URLs for the create presigned URLs for the GetCallerIdentity operation. * Fixes [#1021](https://github.com/aws/aws-sdk-go-v2/issues/1021) * `aws/retry`: Add package documentation for retry package ([#1033](https://github.com/aws/aws-sdk-go-v2/pull/1033)) - * Adds documentation for the retry package + * Adds documentation for the retry package ## Bug Fixes * `Multiple API Clients`: Fix SDK's generated serde for unmodeled operation input/output ([#1050](https://github.com/aws/aws-sdk-go-v2/pull/1050)) @@ -8829,7 +8829,6 @@ feedback and to take advantage of modern Go language features. * Add support for reading `s3_use_arn_region` from shared config file ([#991](https://github.com/aws/aws-sdk-go-v2/pull/991)) * Add Utility for getting RequestID and HostID of response ([#983](https://github.com/aws/aws-sdk-go-v2/pull/983)) - ## Other changes * Updates branch `HEAD` points from `master` to `main`. * This should not impact your application, but if you have pull requests or forks of the SDK you may need to update the upstream branch your fork is based off of. @@ -8860,7 +8859,6 @@ The `config#LoadDefaultConfig` function has been updated to require a `context.C The v2 SDK corrects its behavior to be inline with the AWS CLI and other AWS SDKs. Refer to https://docs.aws.amazon.com/credref/latest/refdocs/overview.html for more information how to use the shared config and credentials files. - # Release 2020-11-30 ## Breaking Change @@ -9020,7 +9018,6 @@ The `config` module's exported types were trimmed down to add clarity and reduce * `credentials` module released at `v0.1.1` * `ec2imds` module released at `v0.1.1` - # Release 2020-09-28 ## Announcements We’re happy to share the updated clients for the v0.25.0 preview version of the AWS SDK for Go V2. @@ -9060,7 +9057,6 @@ As a part of the refactoring done to v2 preview SDK some components have not bee We expect additional breaking changes to the v2 preview SDK in the coming releases. We expect these changes to focus on organizational, naming, and hardening the SDK's design for future feature capabilities after it is released for general availability. - #### Relocated Packages In this release packages within the SDK were relocated, and in some cases those packages were converted to Go modules. The following is a list of packages have were relocated. @@ -9075,7 +9071,6 @@ The `github.com/aws/aws-sdk-go-v2/credentials` module contains refactored creden * `github.com/aws/aws-sdk-go-v2/processcreds` => `github.com/aws/aws-sdk-go-v2/credentials/processcreds` * `github.com/aws/aws-sdk-go-v2/stscreds` => `github.com/aws/aws-sdk-go-v2/credentials/stscreds` - #### Modularization New modules were added to the v2 preview SDK to allow the components to be versioned independently from each other. This allows your application to depend on specific versions of an API client module, and take discrete updates from the SDK core and other API client modules as desired. @@ -9084,7 +9079,6 @@ New modules were added to the v2 preview SDK to allow the components to be versi * [github.com/aws/aws-sdk-go-v2/credentials](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/credentials) * Module for each API client, e.g. [github.com/aws/aws-sdk-go-v2/service/s3](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/s3) - #### API Clients The following is a list of the major changes to the API client modules @@ -9104,14 +9098,12 @@ result, err := client.Scan(context.TODO(), &dynamodb.ScanInput{ }) ``` - #### Configuration In addition to the `github.com/aws/aws-sdk-go-v2/aws/external` package being made a module at `github.com/aws/aws-sdk-go-v2/config`, the `LoadDefaultAWSConfig` function was renamed to `LoadDefaultConfig`. The `github.com/aws/aws-sdk-go-v2/aws/defaults` package has been removed. Its components have been migrated to the `github.com/aws/aws-sdk-go-v2/aws` package, and `github.com/aws/aws-sdk-go-v2/config` module. - #### Error Handling The `github.com/aws/aws-sdk-go-v2/aws/awserr` package was removed as a part of the SDK error handling refactor. The SDK now uses typed errors built around [Go v1.13](https://golang.org/doc/go1.13#error_wrapping)'s [errors.As](https://pkg.go.dev/errors#As) and [errors.Unwrap](https://pkg.go.dev/errors#Unwrap) features. All SDK error types that wrap other errors implement the `Unwrap` method. Generic v2 preview SDK errors created with `fmt.Errorf` use `%w` to wrap the underlying error. @@ -9154,7 +9146,6 @@ Logging an error value will include information from each wrapped error. For exa > 2020/10/15 16:03:37 operation error DynamoDB: Scan, https response error StatusCode: 400, RequestID: ABCREQUESTID123, ResourceNotFoundException: Requested resource not found - #### Endpoints The `github.com/aws/aws-sdk-go-v2/aws/endpoints` has been removed from the SDK, along with all exported endpoint definitions and iteration behavior. Each generated API client now includes its own endpoint definition internally to the module. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3b64466870c..5b627cfa60b 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,4 @@ ## Code of Conduct -This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). -For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact +This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). +For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact opensource-codeofconduct@amazon.com with any additional questions or comments. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c2fc3b8f5b0..5e59bba7ba0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,29 +14,28 @@ Jump To: * [Feature Requests](#feature-requests) * [Code Contributions](#code-contributions) - ## How to contribute *Before you send us a pull request, please be sure that:* -1. You're working from the latest source on the master branch. -2. You check existing open, and recently closed, pull requests to be sure +1. You're working from the latest source on the `main` branch. +2. You check existing open, and recently closed, pull requests to be sure that someone else hasn't already addressed the problem. -3. You create an issue before working on a contribution that will take a +3. You create an issue before working on a contribution that will take a significant amount of your time. *Creating a Pull Request* 1. Fork the repository. -2. In your fork, make your change in a branch that's based on this repo's master branch. +2. In your fork, make your change in a branch that's based on this repo's `main` branch. 3. Commit the change to your fork, using a clear and descriptive commit message. 4. Create a pull request, answering any questions in the pull request form. -For contributions that will take a significant amount of time, open a new -issue to pitch your idea before you get started. Explain the problem and -describe the content you want to see added to the documentation. Let us know -if you'll write it yourself or if you'd like us to help. We'll discuss your -proposal with you and let you know whether we're likely to accept it. +For contributions that will take a significant amount of time, open a new +issue to pitch your idea before you get started. Explain the problem and +describe the content you want to see added to the documentation. Let us know +if you'll write it yourself or if you'd like us to help. We'll discuss your +proposal with you and let you know whether we're likely to accept it. ## Bug Reports @@ -74,9 +73,9 @@ guidelines prior to filing a bug report. Open an [issue][issues] with the following: -* A short, descriptive title. Ideally, other community members should be able +* A short, descriptive title. Ideally, other community members should be able to get a good idea of the feature just from reading the title. -* A detailed description of the the proposed feature. +* A detailed description of the the proposed feature. * Why it should be added to the SDK. * If possible, example code to illustrate how it should work. * Use Markdown to make the request easier to read; @@ -97,7 +96,7 @@ Please be aware of the following notes prior to opening a pull request: 3. Wherever possible, pull requests should contain tests as appropriate. Bugfixes should contain tests that exercise the corrected behavior (i.e., the - test should fail without the bugfix and pass with it), and new features + test should fail without the bugfix and pass with it), and new features should be accompanied by tests exercising the feature. 4. Pull requests that contain failing tests will not be merged until the test @@ -112,7 +111,7 @@ Please be aware of the following notes prior to opening a pull request: ### Testing -To run the tests locally, running the `make unit` command will `go get` the +To run the tests locally, running the `make unit` command will `go get` the SDK's testing dependencies, and run vet, link and unit tests for the SDK. ``` @@ -129,7 +128,7 @@ go test -tags codegen ./private/... See the `Makefile` for additional testing tags that can be used in testing. -To test on multiple platform the SDK includes several DockerFiles under the +To test on multiple platform the SDK includes several DockerFiles under the `awstesting/sandbox` folder, and associated make recipes to to execute unit testing within environments configured for specific Go versions. @@ -170,9 +169,9 @@ This will result in a patch version change. * `SDK Bugs` - For minor changes that resolve an issue. This will result in a patch version change. -[issues]: https://github.com/aws/aws-sdk-go/issues -[pr]: https://github.com/aws/aws-sdk-go/pulls +[issues]: https://github.com/aws/aws-sdk-go-v2/issues +[pr]: https://github.com/aws/aws-sdk-go-v2/pulls [license]: http://aws.amazon.com/apache2.0/ [cla]: http://en.wikipedia.org/wiki/Contributor_License_Agreement -[releasenotes]: https://github.com/aws/aws-sdk-go/releases +[releasenotes]: https://github.com/aws/aws-sdk-go-v2/releases diff --git a/DESIGN.md b/DESIGN.md index 8490c7d6736..4c9be94a2f8 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -12,4 +12,4 @@ Past Discussions --- The issues listed here are for documentation purposes, and is used to capture issues and their associated discussions. -[Code of Conduct]: https://github.com/aws/aws-sdk-go-v2/blob/master/CODE_OF_CONDUCT.md +[Code of Conduct]: https://github.com/aws/aws-sdk-go-v2/blob/main/CODE_OF_CONDUCT.md diff --git a/Makefile b/Makefile index b0f99b32bb6..4f74a265418 100644 --- a/Makefile +++ b/Makefile @@ -246,7 +246,6 @@ unit-race-modules-%: "go test ${BUILD_TAGS} ${RUN_NONE} ./..." \ "go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./..." - unit-modules-%: @# unit command that uses the pattern to define the root path that the @# module testing will start from. Strips off the "unit-modules-" and @@ -408,7 +407,6 @@ bench-modules-%: && go run . -p $(subst _,/,$(subst bench-modules-,,$@)) ${EACHMODULE_FLAGS} \ "go test -timeout=10m -bench . --benchmem ${BUILD_TAGS} ${RUN_NONE} ./..." - ##################### # Release Process # ##################### diff --git a/NOTICE.txt b/NOTICE.txt index 5f14d1162ed..899129ecc46 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,3 +1,3 @@ AWS SDK for Go -Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. +Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. Copyright 2014-2015 Stripe, Inc. diff --git a/README.md b/README.md index dac5c8bcb0a..54626706f17 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # AWS SDK for Go v2 -[![Go Build status](https://github.com/aws/aws-sdk-go-v2/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/aws/aws-sdk-go-v2/actions/workflows/go.yml)[![Codegen Build status](https://github.com/aws/aws-sdk-go-v2/actions/workflows/codegen.yml/badge.svg?branch=main)](https://github.com/aws/aws-sdk-go-v2/actions/workflows/codegen.yml) [![SDK Documentation](https://img.shields.io/badge/SDK-Documentation-blue)](https://aws.github.io/aws-sdk-go-v2/docs/) [![Migration Guide](https://img.shields.io/badge/Migration-Guide-blue)](https://aws.github.io/aws-sdk-go-v2/docs/migrating/) [![API Reference](https://img.shields.io/badge/api-reference-blue.svg)](https://pkg.go.dev/mod/github.com/aws/aws-sdk-go-v2) [![Apache V2 License](https://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt) - +[![Go Build status](https://github.com/aws/aws-sdk-go-v2/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/aws/aws-sdk-go-v2/actions/workflows/go.yml)[![Codegen Build status](https://github.com/aws/aws-sdk-go-v2/actions/workflows/codegen.yml/badge.svg?branch=main)](https://github.com/aws/aws-sdk-go-v2/actions/workflows/codegen.yml) [![SDK Documentation](https://img.shields.io/badge/SDK-Documentation-blue)](https://aws.github.io/aws-sdk-go-v2/docs/) [![Migration Guide](https://img.shields.io/badge/Migration-Guide-blue)](https://aws.github.io/aws-sdk-go-v2/docs/migrating/) [![API Reference](https://img.shields.io/badge/api-reference-blue.svg)](https://pkg.go.dev/mod/github.com/aws/aws-sdk-go-v2) [![Apache V2 License](https://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go-v2/blob/main/LICENSE.txt) `aws-sdk-go-v2` is the v2 AWS SDK for the Go programming language. @@ -118,7 +117,7 @@ Keeping the list of open issues lean will help us respond in a timely manner. ## Feedback and contributing -The v2 SDK will use GitHub [Issues] to track feature requests and issues with the SDK. In addition, we'll use GitHub [Projects] to track large tasks spanning multiple pull requests, such as refactoring the SDK's internal request lifecycle. You can provide feedback to us in several ways. +The v2 SDK will use GitHub [Issues] to track feature requests and issues with the SDK. In addition, we'll use GitHub [Projects] to track large tasks spanning multiple pull requests, such as refactoring the SDK's internal request lifecycle. You can provide feedback to us in several ways. **GitHub issues**. To provide feedback or report bugs, file GitHub [Issues] on the SDK. This is the preferred mechanism to give feedback so that other users can engage in the conversation, +1 issues, etc. Issues you open will be evaluated, and included in our roadmap for the GA launch. @@ -139,8 +138,8 @@ API operation require parameters. [Service Documentation](https://aws.amazon.com/documentation/) - Use this documentation to learn how to interface with AWS services. These guides are -great for getting started with a service, or when looking for more -information about a service. While this document is not required for coding, +great for getting started with a service, or when looking for more +information about a service. While this document is not required for coding, services may supply helpful samples to look out for. [Forum](https://forums.aws.amazon.com/forum.jspa?forumID=293) - Ask questions, get help, and give feedback @@ -151,7 +150,7 @@ services may supply helpful samples to look out for. [Dep]: https://github.com/golang/dep [Issues]: https://github.com/aws/aws-sdk-go-v2/issues [Projects]: https://github.com/aws/aws-sdk-go-v2/projects -[CHANGELOG]: https://github.com/aws/aws-sdk-go-v2/blob/master/CHANGELOG.md +[CHANGELOG]: https://github.com/aws/aws-sdk-go-v2/blob/main/CHANGELOG.md [Amazon DynamoDB]: https://aws.amazon.com/dynamodb/ -[design]: https://github.com/aws/aws-sdk-go-v2/blob/master/DESIGN.md +[design]: https://github.com/aws/aws-sdk-go-v2/blob/main/DESIGN.md [license]: http://aws.amazon.com/apache2.0/ diff --git a/aws/protocol/xml/error_utils.go b/aws/protocol/xml/error_utils.go index c228f7d8785..6975ce6524d 100644 --- a/aws/protocol/xml/error_utils.go +++ b/aws/protocol/xml/error_utils.go @@ -21,26 +21,18 @@ func GetErrorResponseComponents(r io.Reader, noErrorWrapping bool) (ErrorCompone if err := xml.NewDecoder(r).Decode(&errResponse); err != nil && err != io.EOF { return ErrorComponents{}, fmt.Errorf("error while deserializing xml error response: %w", err) } - return ErrorComponents{ - Code: errResponse.Code, - Message: errResponse.Message, - RequestID: errResponse.RequestID, - }, nil + return ErrorComponents(errResponse), nil } var errResponse wrappedErrorResponse if err := xml.NewDecoder(r).Decode(&errResponse); err != nil && err != io.EOF { return ErrorComponents{}, fmt.Errorf("error while deserializing xml error response: %w", err) } - return ErrorComponents{ - Code: errResponse.Code, - Message: errResponse.Message, - RequestID: errResponse.RequestID, - }, nil + return ErrorComponents(errResponse), nil } // noWrappedErrorResponse represents the error response body with -// no internal ... +// wrapped within Error type wrappedErrorResponse struct { Code string `xml:"Error>Code"` Message string `xml:"Error>Message"` diff --git a/aws/ratelimit/token_rate_limit.go b/aws/ratelimit/token_rate_limit.go index 12a3f0c4fbb..d89090ad38e 100644 --- a/aws/ratelimit/token_rate_limit.go +++ b/aws/ratelimit/token_rate_limit.go @@ -30,10 +30,6 @@ func NewTokenRateLimit(tokens uint) *TokenRateLimit { } } -func isTimeoutError(error) bool { - return false -} - type canceledError struct { Err error } diff --git a/aws/retry/example_test.go b/aws/retry/example_test.go index d135559c858..8e504296388 100644 --- a/aws/retry/example_test.go +++ b/aws/retry/example_test.go @@ -55,7 +55,7 @@ func Example_overrideSpecificOperation() { _, err = client.GetObject(context.Background(), &s3.GetObjectInput{ Bucket: aws.String("my-bucket"), Key: aws.String("my-key"), - }, func(options *types.Options) { + }, func(options *s3.Options) { options.Retryer = retry.AddWithErrorCodes(options.Retryer, (*types.NoSuchBucketException)(nil).ErrorCode()) }) if err != nil { diff --git a/aws/retry/middleware.go b/aws/retry/middleware.go index 3326289a151..822fc920a75 100644 --- a/aws/retry/middleware.go +++ b/aws/retry/middleware.go @@ -11,7 +11,6 @@ import ( awsmiddle "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/internal/sdk" "github.com/aws/smithy-go/logging" - "github.com/aws/smithy-go/middleware" smithymiddle "github.com/aws/smithy-go/middleware" "github.com/aws/smithy-go/transport/http" ) @@ -292,7 +291,7 @@ type retryMetadataKey struct{} // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues // to clear all stack values. func getRetryMetadata(ctx context.Context) (metadata retryMetadata, ok bool) { - metadata, ok = middleware.GetStackValue(ctx, retryMetadataKey{}).(retryMetadata) + metadata, ok = smithymiddle.GetStackValue(ctx, retryMetadataKey{}).(retryMetadata) return metadata, ok } @@ -301,7 +300,7 @@ func getRetryMetadata(ctx context.Context) (metadata retryMetadata, ok bool) { // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues // to clear all stack values. func setRetryMetadata(ctx context.Context, metadata retryMetadata) context.Context { - return middleware.WithStackValue(ctx, retryMetadataKey{}, metadata) + return smithymiddle.WithStackValue(ctx, retryMetadataKey{}, metadata) } // AddRetryMiddlewaresOptions is the set of options that can be passed to diff --git a/codegen/gradlew b/codegen/gradlew index 1b6c787337f..1b5985eb41a 100755 --- a/codegen/gradlew +++ b/codegen/gradlew @@ -116,7 +116,6 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then diff --git a/codegen/gradlew.bat b/codegen/gradlew.bat index ac1b06f9382..180c3727eaf 100644 --- a/codegen/gradlew.bat +++ b/codegen/gradlew.bat @@ -69,7 +69,6 @@ goto fail set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java index 7e3ad3d46f2..6cb56822d6f 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AddAwsConfigFields.java @@ -120,7 +120,7 @@ public class AddAwsConfigFields implements GoIntegration { When creating a new API Clients this member will only be used if the Retryer Options member is nil. This value will be ignored if Retryer is not nil. - + If specified in an operation call's functional options with a value that is different than the constructed client's Options, the Client's Retryer will be wrapped to use the operation's specific RetryMaxAttempts value. @@ -146,7 +146,7 @@ public class AddAwsConfigFields implements GoIntegration { When creating a new API Clients this member will only be used if the Retryer Options member is nil. This value will be ignored if Retryer is not nil. - + Currently does not support per operation call overrides, may in the future. """) .awsResolveFunction(SymbolUtils.createValueSymbolBuilder(RESOLVE_AWS_CONFIG_RETRY_MODE) @@ -372,7 +372,7 @@ private void writeRetryMaxAttemptsFinalizeResolver(GoWriter writer) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } - + o.Retryer = $withMaxAttempts:T(o.Retryer, o.RetryMaxAttempts) } """); @@ -411,7 +411,6 @@ private void writeRetryResolverTests(GoWriter writer) { writer.putContext("nopCloser", SymbolUtils.createValueSymbolBuilder("NopCloser", SmithyGoDependency.IOUTIL).build()); - writer.addUseImports(SmithyGoDependency.TESTING); writer.write(""" func Test$retryModeOptions:L(t *testing.T) { @@ -422,7 +421,7 @@ private void writeRetryResolverTests(GoWriter writer) { Body: $nopCloser:T($newStringReader:T("")), }, nil }) - + cases := map[string]struct{ defaultsMode $defaultsModeType:T retryer $retryerType:T @@ -637,7 +636,6 @@ private void writeAwsConfigConstructor(Model model, ServiceShape service, GoWrit } }); - List configFields = new ArrayList<>(AWS_CONFIG_FIELDS); // add client specific config fields for (AwsConfigField cfgField : ResolveClientConfigFromSources.AWS_CONFIG_FIELDS) { diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEventStreamUtils.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEventStreamUtils.java index 0821acbc86d..4bfcb062b5b 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEventStreamUtils.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsEventStreamUtils.java @@ -131,11 +131,11 @@ private static void generateInputMiddlewareHelper(GoSettings settings, GoWriter writer.write(""" type $keyType:T struct{} - + func $contextGetter:L(ctx $context:P) interface{} { return ctx.Value($keyType:T{}) } - + func $contextSetter:L(ctx $context:P, value interface{}) $context:T { return $withValue:T(ctx, $keyType:T{}, value) } @@ -162,7 +162,7 @@ private static void generateUnknownEventMessageError(GenerationContext context) Type string Message $P } - + // Error retruns the error message string. func (e $P) Error() string { return "unknown event stream message type, " + e.Type @@ -218,17 +218,17 @@ private static void generateToggleClientLogModeFinalizer(GenerationContext conte getToggleEventStreamClientLogModeSymbol(), () -> { writer.write(""" mode := o.ClientLogMode - + if request && mode.IsRequestWithBody() { mode.ClearRequestWithBody() mode |= $T } - + if response && mode.IsResponseWithBody() { mode.ClearResponseWithBody() mode |= $T } - + o.ClientLogMode = mode """, logRequest, logResponse ); @@ -285,7 +285,7 @@ defer func() { } m.closeResponseBody(out) }() - + logger := $T(ctx) """, getSymbol("GetLogger", SmithyGoDependency.SMITHY_MIDDLEWARE, false)); @@ -365,7 +365,7 @@ defer func() { if !ok || params == nil { return out, metadata, $T("unexpected nil type: %T", params) } - + reqSend := make(chan error, 1) go func() { defer close(reqSend) @@ -409,7 +409,7 @@ errorf, getWriterEventWrapperInitialRequestType(symbolProvider, return out, metadata, $T("unknown transport type: %T", out.RawResponse) } _ = deserializeOutput - + output, ok := out.Result.($P) if out.Result != nil && !ok { return out, metadata, $T("unexpected output result type: %T", out.Result) @@ -490,7 +490,7 @@ defer func() { var copy = getSymbol("Copy", SmithyGoDependency.IO); var discard = getSymbol("Discard", SmithyGoDependency.IOUTIL); writer.write(""" - + func ($P) closeResponseBody(out $T) { if resp, ok := out.RawResponse.($P); ok && resp != nil && resp.Body != nil { _, _ = $T($T, resp.Body) @@ -610,7 +610,7 @@ private static void generateEventStreamReader( writer.write(""" go w.readEventStream() - + return w"""); }).write(""); @@ -645,7 +645,7 @@ defer close(r.initialResponse) return } } - + event, err := r.deserializeEventMessage(&decodedMessage) if err != nil { r.err.SetError(err) @@ -715,7 +715,7 @@ defer close(r.initialResponse) if eventType == nil { return nil, $T("%s event header not present", $T) } - + if eventType.String() == "initial-response" { v, err := r.initialResponseDeserializer(msg) if err != nil { @@ -814,7 +814,7 @@ private static void generateEventStreamReaderMessageWrapper( type $T struct { Value $P } - + func ($P) $L() {} """, readerEventWrapperMessageType, eventUnionSymbol, readerEventWrapperMessageType, interfaceMethod); @@ -825,7 +825,7 @@ private static void generateEventStreamReaderMessageWrapper( type $T struct { Value interface{} } - + func ($P) $L() {} """, readerEventWrapperInitialResponseType, readerEventWrapperInitialResponseType, interfaceMethod); @@ -846,7 +846,6 @@ private static void generateEventStreamWriter( var asyncEventSymbol = getModuleSymbol(settings, getAsyncWriteReporterName(eventStream, service)); - var eventSymbol = withInitialMessages ? getWriterEventWrapperInterface(symbolProvider, eventStream, service) : eventUnionSymbol; @@ -919,7 +918,7 @@ private static void generateEventStreamWriter( }).write("") .write(""" go w.writeStream() - + return w """)).write(""); @@ -941,9 +940,9 @@ private static void generateEventStreamWriter( if err := w.err.Err(); err != nil { return err } - + resultCh := make(chan error) - + wrapped := $T{ Event: event, Result: resultCh, @@ -1052,7 +1051,7 @@ private static void generateEventStreamWriter( if err := w.encoder.Encode(w.serializationBuffer, eventMessage); err != nil { return nil, err } - + return w.serializationBuffer.Bytes(), nil"""); }).write(""); @@ -1128,7 +1127,7 @@ private static void generateEventStreamWriterMessageWrapper( type $T struct { Value $P } - + func ($P) $L() {} """, writerEventWrapperMessageType, eventUnionSymbol, writerEventWrapperMessageType, interfaceMethod); @@ -1139,7 +1138,7 @@ private static void generateEventStreamWriterMessageWrapper( type $T struct { Value interface{} } - + func ($P) $L() {} """, writerEventWrapperInitialRequestType, writerEventWrapperInitialRequestType, interfaceMethod); } @@ -1712,7 +1711,7 @@ public static void generateEventMessageRequestSerializer( if i == nil { return $T("event message serializer expects non-nil %T", ($P)(nil)) } - + v, ok := i.($P) if !ok { return $T("unexpected serialization of %T", i) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsHttpPresignURLClientGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsHttpPresignURLClientGenerator.java index 7d13ae09467..7f3cd527c0a 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsHttpPresignURLClientGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsHttpPresignURLClientGenerator.java @@ -78,7 +78,6 @@ public class AwsHttpPresignURLClientGenerator implements GoIntegration { "httpPresignerV4a" ).build(); - private static final Symbol v4NewPresignerSymbol = SymbolUtils.createPointableSymbolBuilder( "NewSigner", AwsGoDependency.AWS_SIGNER_V4 ).build(); @@ -451,7 +450,6 @@ private void writeConvertToPresignMiddleware( }).insertTrailingNewline(); } - /** * Writes the Presign client's type and methods. * @@ -558,7 +556,6 @@ public void writePresignInterface( writer.write(""); } - /** * Writes the presigner sigv4a interface used by the presign url client */ @@ -659,7 +656,6 @@ public void writePresignOptionType( writer.write("o.ClientOptions = append(o.ClientOptions, w...)"); }).insertTrailingNewline(); - // s3 specific helpers if (isS3ServiceShape(model, serviceShape)) { // generate WithPresignExpires Helper diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsSignatureVersion4aUtils.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsSignatureVersion4aUtils.java index 8f3fa0bf35b..dc9df6a4d36 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsSignatureVersion4aUtils.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsSignatureVersion4aUtils.java @@ -51,15 +51,15 @@ public static void writeCredentialProviderResolver(GoWriter writer) { if o.$fieldName:L == nil { return } - + if _, ok := o.$fieldName:L.($credType:T); ok { return } - + if $isProvider:T(o.$fieldName:L, ($anonType:P)(nil)) { return } - + o.$fieldName:L = &$adapType:T{SymmetricProvider: o.$fieldName:L} } """); @@ -165,7 +165,7 @@ public static void writeMiddlewareRegister( V4aSigner: o.$v4aSigner:L, LogSigning: o.$logMode:L.IsSigning(), }) - + return $registerMiddleware:T(stack, mw) } """); diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ClientResolvedDefaultsMode.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ClientResolvedDefaultsMode.java index 61131e7f43f..bf4689308a2 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ClientResolvedDefaultsMode.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/ClientResolvedDefaultsMode.java @@ -45,7 +45,7 @@ public class ClientResolvedDefaultsMode implements GoIntegration { The initial DefaultsMode used when the client options were constructed. If the DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved value was at that point in time. - + Currently does not support per operation call overrides, may in the future. """) .build(); @@ -73,14 +73,14 @@ private void writeSetResolvedDefaultsMode(GoWriter writer) { if len(o.$resolvedOption:L) > 0 { return } - + var mode $modeType:T mode.SetFromString(string(o.$modeOption:L)) - + if mode == $autoMode:T { mode = $autoResolve:T(o.$region:L, o.$envOption:L) } - + o.$resolvedOption:L = mode } """); diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointDiscoveryGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointDiscoveryGenerator.java index 628ed13736b..7d7dd4b95f5 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointDiscoveryGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointDiscoveryGenerator.java @@ -444,7 +444,6 @@ private static boolean operationRequiresEndpointDiscovery( return operation.expectTrait(ClientDiscoveredEndpointTrait.class).isRequired(); } - // ============================Trait info retriever/analyzer============== // Return operation shape id of the operation to use for making endpoint discovery call. @@ -494,7 +493,6 @@ public void processFinalizedModel(GoSettings settings, Model model) { .build()) .build()); - for (OperationShape operation : TopDownIndex.of(model).getContainedOperations(service)) { String helperFuncName = generateAddDiscoverEndpointMiddlewareName(service, operation); diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java index 0520034469f..269a988472d 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/EndpointGenerator.java @@ -108,7 +108,7 @@ public final class EndpointGenerator implements Runnable { EndpointOption.builder() .name(LOG_DEPRECATED_OPTION) .documentation(String.format(""" - %s indicates that deprecated endpoints should be logged to the + %s indicates that deprecated endpoints should be logged to the provided logger.""", LOG_DEPRECATED_OPTION)) .type(SymbolUtils.createValueSymbolBuilder("bool") .putProperty(SymbolUtils.GO_UNIVERSE_TYPE, true) @@ -291,12 +291,12 @@ private void generateFinalizeClientEndpointResolverOptions(GoWriter writer) { FINALIZE_CLIENT_ENDPOINT_RESOLVER_OPTIONS, () -> { writer.write(""" options.EndpointOptions.$logDepOption:L = options.ClientLogMode.IsDeprecatedUsage() - + if len(options.EndpointOptions.ResolvedRegion) == 0 { const fipsInfix = "-fips-" const fipsPrefix = "fips-" const fipsSuffix = "-fips" - + if ($contains:T(options.Region, fipsInfix) || $contains:T(options.Region, fipsPrefix) || $contains:T(options.Region, fipsSuffix)) { @@ -409,11 +409,11 @@ private void generateAwsEndpointResolverWrapper(GoWriter writer) { if err == nil { return endpoint, nil } - + if nf := (&$T{}); !errors.As(err, &nf) { return endpoint, err } - + fallback: if w.resolver == nil { return endpoint, $T("default endpoint resolver provided was nil") @@ -427,11 +427,11 @@ private void generateAwsEndpointResolverWrapper(GoWriter writer) { AwsGoDependency.AWS_CORE).build(); writer.write(""" type $L func(service, region string) ($T, error) - + func (a $L) ResolveEndpoint(service, region string, options ...interface{}) ($T, error) { return a(service, region) } - + var _ $T = $L(nil) """, AWS_ENDPOINT_RESOLVER_ADAPTOR, endpoint, AWS_ENDPOINT_RESOLVER_ADAPTOR, endpoint, endpointResolverWithOptions, AWS_ENDPOINT_RESOLVER_ADAPTOR); @@ -440,19 +440,19 @@ private void generateAwsEndpointResolverWrapper(GoWriter writer) { // with the clients EndpointResolver interface. writer.write(""" // $L returns an EndpointResolver that first delegates endpoint resolution to the awsResolver. - // If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided + // If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided // fallbackResolver for resolution. // // fallbackResolver must not be nil func $L(awsResolver $T, awsResolverWithOptions $T, fallbackResolver $T) $T { var resolver $T - + if awsResolverWithOptions != nil { resolver = awsResolverWithOptions } else if awsResolver != nil { resolver = $L(awsResolver.ResolveEndpoint) } - + return &$T{ awsResolver: resolver, resolver: fallbackResolver, diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java index 0b8a2a27eeb..af8bf9c971b 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/JsonRpcProtocolGenerator.java @@ -133,7 +133,6 @@ protected void deserializeOutputDocument(GenerationContext context, OperationSha handleDecodeError(writer, "out, metadata, "); } - @Override protected void generateDocumentBodyShapeDeserializers(GenerationContext context, Set shapes) { JsonShapeDeserVisitor visitor = JsonShapeDeserVisitor.builder() @@ -148,7 +147,6 @@ protected void generateDocumentBodyShapeDeserializers(GenerationContext context, }); } - @Override protected void deserializeError(GenerationContext context, StructureShape shape) { GoWriter writer = context.getWriter().get(); diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java index f999417efae..4318ece8be1 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestJsonProtocolGenerator.java @@ -293,7 +293,6 @@ private void writeMiddlewarePayloadBindingDeserializerDelegator( }); } - // Write middleware that delegates to deserializers for shapes that have implicit payload and deserializer private void writeMiddlewareDocumentBindingDeserializerDelegator( GenerationContext context, diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java index b5a3488bdcd..4364127455b 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/RestXmlProtocolGenerator.java @@ -1,6 +1,5 @@ package software.amazon.smithy.aws.go.codegen; - import static software.amazon.smithy.go.codegen.integration.HttpProtocolGeneratorUtils.isShapeWithResponseBindings; import static software.amazon.smithy.aws.go.codegen.XmlProtocolUtils.initializeXmlDecoder; import static software.amazon.smithy.aws.go.codegen.XmlProtocolUtils.handleDecodeError; @@ -71,7 +70,6 @@ protected TimestampFormatTrait.Format getDocumentTimestampFormat() { return TimestampFormatTrait.Format.DATE_TIME; } - @Override protected void generateOperationDocumentSerializer(GenerationContext context, OperationShape operation) { Model model = context.getModel(); diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/XmlProtocolUtils.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/XmlProtocolUtils.java index dca61e11c32..453ad076a58 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/XmlProtocolUtils.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/XmlProtocolUtils.java @@ -87,7 +87,6 @@ public static void generatePayloadAsDocumentXMLStartElement( }); } - /** * Generates XML Attributes as per xmlNamespace and xmlAttribute traits. * diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/APIGatewayAcceptHeader.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/APIGatewayAcceptHeader.java index 8054f3d995c..d6efad874a9 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/APIGatewayAcceptHeader.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/APIGatewayAcceptHeader.java @@ -86,7 +86,6 @@ public List getClientPlugins() { ); } - private static boolean isAPIGatewayService(Model model, ServiceShape service) { return service.expectTrait(ServiceTrait.class).getSdkId().equalsIgnoreCase("API Gateway"); } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/PresignURLAutoFill.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/PresignURLAutoFill.java index 16a0bef95bc..4675d9278e8 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/PresignURLAutoFill.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/PresignURLAutoFill.java @@ -365,7 +365,6 @@ private void writePresignClientCustomization( Symbol addMiddleware = SymbolUtils.createValueSymbolBuilder("AddMiddleware", AwsCustomGoDependency.PRESIGNEDURL_CUSTOMIZATION).build(); - // generate middleware mutator to wire up presign client with accessors and custom middleware. writer.openBlock("func $L(stack $P, options Options) error {", "}", addPresignMiddlewareFuncName(operationSymbol.getName()), @@ -389,7 +388,6 @@ private void writePresignClientCustomization( }); } - private void writeAutofillPresignClient( GoWriter writer, SymbolProvider symbolprovider, diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java index c0c671a6949..dcf52da3097 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/Route53Customizations.java @@ -53,7 +53,6 @@ public List getClientPlugins() { ); } - public void writeAdditionalFiles( GoSettings settings, Model model, diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AcceptEncodingGzip.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AcceptEncodingGzip.java index 112ff028ee8..f977c5f01b8 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AcceptEncodingGzip.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AcceptEncodingGzip.java @@ -82,5 +82,4 @@ public List getClientPlugins() { ); } - } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AddPutObjectUnseekableBodyDoc.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AddPutObjectUnseekableBodyDoc.java index db111d2d828..74effc3d35c 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AddPutObjectUnseekableBodyDoc.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3AddPutObjectUnseekableBodyDoc.java @@ -79,7 +79,6 @@ public Model preprocessModel( "https://aws.github.io/aws-sdk-go-v2/docs/sdk-utilities/s3/#unseekable-streaming-input")); }); - builder.addShape(parentBuilder.build()); } diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ContentSHA256Header.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ContentSHA256Header.java index 9978f631b05..ce37677ffa5 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ContentSHA256Header.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ContentSHA256Header.java @@ -15,7 +15,6 @@ import software.amazon.smithy.model.traits.StreamingTrait; import software.amazon.smithy.utils.ListUtils; - public class S3ContentSHA256Header implements GoIntegration { /** diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ErrorWith200Status.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ErrorWith200Status.java index 327d35be109..4522912e8e8 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ErrorWith200Status.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ErrorWith200Status.java @@ -22,7 +22,6 @@ public class S3ErrorWith200Status implements GoIntegration { private static Set customizedOperations = SetUtils.of( "CopyObject", "UploadPartCopy", "CompleteMultipartUpload"); - @Override public byte getOrder() { // The associated customization ordering is relative to operation deserializers diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ResponseErrorWrapper.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ResponseErrorWrapper.java index 5a1344e9dd0..3f0a71eeae3 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ResponseErrorWrapper.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3ResponseErrorWrapper.java @@ -13,7 +13,6 @@ import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.utils.ListUtils; - /** * wraps a smithy request error with an S3 Request error. */ diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java index 4bd7d2be436..03393633277 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/S3UpdateEndpoint.java @@ -168,7 +168,7 @@ public List getClientPlugins() { + "service.") .deprecated(""" Set dual-stack by setting UseDualStackEndpoint on - EndpointResolverOptions. When EndpointResolverOptions' + EndpointResolverOptions. When EndpointResolverOptions' UseDualStackEndpoint field is set it overrides this field value.""") .build(), ConfigField.builder() @@ -185,7 +185,6 @@ public List getClientPlugins() { return runtimeClientPlugins; } - /* * s3 class is the private class handling s3 goIntegration for endpoint mutations */ @@ -379,7 +378,6 @@ private void writeGetBucketMemberHelper( // add operation to set denoting operation supports bucket input member SUPPORT_BUCKET_AS_INPUT.add(operationName); - writer.writeDocs( String.format("%s returns a pointer to string denoting a provided bucket member value" + "and a boolean indicating if the input has a modeled bucket name,", funcName) diff --git a/config/testdata/load_credentials b/config/testdata/load_credentials index c5a7a5106d9..420c2a1cd88 100644 --- a/config/testdata/load_credentials +++ b/config/testdata/load_credentials @@ -32,4 +32,3 @@ region = us-west-2 [profile ignored-profile] region = ap-east-1 - diff --git a/config/testdata/shared_config b/config/testdata/shared_config index 27284b49573..7900a8969b0 100644 --- a/config/testdata/shared_config +++ b/config/testdata/shared_config @@ -1,5 +1,5 @@ [default] -s3 = +s3 = unsupported_key=123 other_unsupported=abc @@ -187,7 +187,6 @@ aws_access_key_id = donotnormalize_config_akid aws_secret_access_key = donotnormalize_config_secret aws_session_token = donotnormalize_config_session_token - [profile DONOTNORMALIZE] aws_access_key_id = DONOTNORMALIZE_config_akid aws_secret_access_key = DONOTNORMALIZE_config_secret diff --git a/example/service/s3/usingPrivateLink/README.md b/example/service/s3/usingPrivateLink/README.md index 04d5879a2fd..4fb511af04c 100644 --- a/example/service/s3/usingPrivateLink/README.md +++ b/example/service/s3/usingPrivateLink/README.md @@ -1,6 +1,6 @@ # Example -This example demonstrates how you can use the AWS SDK for Go V2's Amazon S3 client +This example demonstrates how you can use the AWS SDK for Go V2's Amazon S3 client to use AWS PrivateLink for Amazon S3. # Usage @@ -9,7 +9,7 @@ to use AWS PrivateLink for Amazon S3. To access S3 bucket data using the s3 interface endpoints, prefix the vpc endpoint with `bucket`. For eg, use endpoint url as `https://bucket.vpce-0xxxxxxx-xxx8xxg.s3.us-west-2.vpce.amazonaws.com` -to access S3 bucket data via the associated vpc endpoint. +to access S3 bucket data via the associated vpc endpoint. To access S3 access point data using the s3 interface endpoints, prefix the vpc endpoint with `accesspoint`. For eg, use endpoint url as `https://accesspoint.vpce-0xxxxxxx-xxxx8xxg.s3.us-west-2.vpce.amazonaws.com` @@ -17,19 +17,19 @@ to access S3 access point data via the associated vpc endpoint. To work with S3 control using the s3 interface endpoints, prefix the vpc endpoint with `control`. For eg, use endpoint url as `https://control.vpce-0xxxxxxx-xxx8xxg.s3.us-west-2.vpce.amazonaws.com` -to use S3 Control operations with the associated vpc endpoint. +to use S3 Control operations with the associated vpc endpoint. ## How to use the built vpc endpoint url -Provide the vpc endpoint url (built as per instructions above) to the SDK by providing a custom endpoint resolver on -client config or as a part of request options. The VPC endpoint url should be provided as a custom endpoint, -which means the Endpoint source should be set as EndpointSourceCustom. +Provide the vpc endpoint url (built as per instructions above) to the SDK by providing a custom endpoint resolver on +client config or as a part of request options. The VPC endpoint url should be provided as a custom endpoint, +which means the Endpoint source should be set as EndpointSourceCustom. You can use client's `EndpointResolverFromURL` utility which by default sets the Endpoint source as Custom source. Note that the SDK may mutate the vpc endpoint as per the input provided to work with ARNs, unless you explicitly set HostNameImmutable property for the endpoint. -The example will create s3 client's that use appropriate vpc endpoint url. The example +The example will create s3 client's that use appropriate vpc endpoint url. The example will then create a bucket of the name provided in code. Replace the value of the `accountID` const with the account ID for your AWS account. The `vpcBucketEndpointUrl`, `vpcAccesspointEndpoint`, `vpcControlEndpoint`, `bucket`, diff --git a/feature/ec2/imds/api_op_GetInstanceIdentityDocument_test.go b/feature/ec2/imds/api_op_GetInstanceIdentityDocument_test.go index 35e3f7a0b3e..ae3ef401d47 100644 --- a/feature/ec2/imds/api_op_GetInstanceIdentityDocument_test.go +++ b/feature/ec2/imds/api_op_GetInstanceIdentityDocument_test.go @@ -12,7 +12,7 @@ import ( const instanceIdentityDocument = `{ "devpayProductCodes" : ["abc","123"], - "marketplaceProductCodes" : [ "1a2bc3" ], + "marketplaceProductCodes" : [ "1a2bc3" ], "availabilityZone" : "us-east-1d", "privateIp" : "10.158.112.84", "version" : "2010-08-31", diff --git a/internal/awstesting/assert.go b/internal/awstesting/assert.go index e9e5bf34b20..9b884c3def4 100644 --- a/internal/awstesting/assert.go +++ b/internal/awstesting/assert.go @@ -44,7 +44,7 @@ func AssertURL(t *testing.T, expect, actual string, msgAndArgs ...interface{}) b return AssertQuery(t, expectURL.Query().Encode(), actualURL.Query().Encode(), msgAndArgs...) } -var queryMapKey = regexp.MustCompile("(.*?)\\.[0-9]+\\.key") +var queryMapKey = regexp.MustCompile(`(.*?)\.[0-9]+\.key`) // AssertQuery verifies the expect HTTP query string matches the actual. func AssertQuery(t *testing.T, expect, actual string, msgAndArgs ...interface{}) bool { diff --git a/internal/awsutil/path_value.go b/internal/awsutil/path_value.go index 7e69bd5eb75..58ef438a196 100644 --- a/internal/awsutil/path_value.go +++ b/internal/awsutil/path_value.go @@ -70,7 +70,7 @@ func rValuesAtPath(v interface{}, path string, createPath, caseSensitive, nilTer value = value.FieldByNameFunc(func(name string) bool { if c == name { return true - } else if !caseSensitive && strings.ToLower(name) == strings.ToLower(c) { + } else if !caseSensitive && strings.EqualFold(name, c) { return true } return false diff --git a/internal/codegen/cmd/defaultsconfig/v1.go b/internal/codegen/cmd/defaultsconfig/v1.go index a663a321b6c..903e827e6ac 100644 --- a/internal/codegen/cmd/defaultsconfig/v1.go +++ b/internal/codegen/cmd/defaultsconfig/v1.go @@ -248,7 +248,7 @@ var tmpl = template.Must(template. {{- define "header" -}} // Code generated by github.com/aws/aws-sdk-go-v2/internal/codegen/cmd/defaultsconfig. DO NOT EDIT. -package {{ $.PackageName }} +package {{ $.PackageName }} import ( {{- range $key, $_ := $.Imports }} diff --git a/internal/endpoints/endpoints_test.go b/internal/endpoints/endpoints_test.go index d9d31a57542..5a8d7ba1153 100644 --- a/internal/endpoints/endpoints_test.go +++ b/internal/endpoints/endpoints_test.go @@ -73,7 +73,7 @@ var testPartitions = Partitions{ { ID: "part-id-1", RegionRegex: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(us)\\-\\w+\\-\\d+$") + reg, _ := regexp.Compile(`^(us)\-\w+\-\d+$`) return reg }(), Defaults: Endpoint{ @@ -98,7 +98,7 @@ var testPartitions = Partitions{ { ID: "part-id-2", RegionRegex: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(cn)\\-\\w+\\-\\d+$") + reg, _ := regexp.Compile(`^(cn)\-\w+\-\d+$`) return reg }(), Defaults: Endpoint{ @@ -128,7 +128,7 @@ var testPartitions = Partitions{ { ID: "part-id-3", RegionRegex: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(eu)\\-\\w+\\-\\d+$") + reg, _ := regexp.Compile(`^(eu)\-\w+\-\d+$`) return reg }(), Defaults: Endpoint{ diff --git a/service/internal/benchmark/dynamodb/testdata/scan_response.json b/service/internal/benchmark/dynamodb/testdata/scan_response.json index 322585080eb..2e47f89b624 100644 --- a/service/internal/benchmark/dynamodb/testdata/scan_response.json +++ b/service/internal/benchmark/dynamodb/testdata/scan_response.json @@ -844,7 +844,7 @@ "First": { "S": "second" } - } + } ], "ScannedCount": 4370 } \ No newline at end of file diff --git a/service/s3/internal/customizations/doc.go b/service/s3/internal/customizations/doc.go index 9a392d120ee..e1d1cbefa4b 100644 --- a/service/s3/internal/customizations/doc.go +++ b/service/s3/internal/customizations/doc.go @@ -46,7 +46,6 @@ an request is serialized, and removes the serialized bucket name from request pa Middleware layering: - Initialize : HTTP Request -> ARN Lookup -> Input-Validation -> Serialize step Serialize : HTTP Request -> Process ARN -> operation serializer -> Update-Endpoint customization -> Remove-Bucket -> next middleware