-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Smithy generator for paginator #3690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kai-ion
wants to merge
39
commits into
main
Choose a base branch
from
paginatorModel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,588
−681
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
bd04a63
Smithy code gen for pagination
kai-ion 153df50
Smithy code gen for pagination
kai-ion 1461605
updated parser to use c2j mapping names
kai-ion 262eae8
updated writer to use c2j mapping names and deleted space in map.json
kai-ion b647665
fix file location
kai-ion 03c06ef
added a compilation test
kai-ion d58423e
updated cppwriter to use smithy library
kai-ion 7c55bf5
changed parsers to be more generic
kai-ion 6b29534
added service name util
kai-ion 6084c35
filter out deprecated service
kai-ion 6ef01e7
edgecases for backwards compatibility
kai-ion 1eb974f
edgecases for backwards compatibility
kai-ion aabd2e6
temporary fix for AccessAnalyzer which uses service-level pagination …
kai-ion 0ebc50f
temporary fix for amp
kai-ion 14d1c8b
temporary fix for B2BI
kai-ion 619c29a
harded for missing abbreviation trait
kai-ion e742bc6
added new detection logic for conflicting service name and add sdk su…
kai-ion 08cd208
added new new detection logic for conflicting service name and add sd…
kai-ion 927dee5
added new new new detection logic (next/Next token) for conflicting s…
kai-ion 9884429
added a patch for Chatbotclient paginator. CamelCase
kai-ion 26a722d
added a patch for cloudfront. uses a new suffix 2020_05_31
kai-ion 5f6fc4a
added a patch to remove the unnessary version suffix strip
kai-ion 56e7beb
added a patch to refactor duplication logic to shapeutil, and changed…
kai-ion 72b6e3d
added a patch to add codestar and hard coded maps
kai-ion c19e79c
added a patch to add deadline
kai-ion 9c79e49
added a patch to add transfer to abbreivation list and fix the servic…
kai-ion dbf14aa
added a patch to ecr to fix GetLifecyclePolicyPreviewSdkResult.h. cha…
kai-ion 06c822c
added a patch for elasticache
kai-ion b5d891f
added a patch for lexv2-models.
kai-ion 7d607b6
added a patch for medialive
kai-ion ede47af
added a patch for s3 list parts where
kai-ion 23c1e92
added integration tests for s3,ec2,dynamodb
kai-ion afbb203
added a patch to fix std string usage
kai-ion 9ca4179
changed variable naming from c2j to smithy and moved paginationCodege…
kai-ion 689d008
refactor code to shapeutil
kai-ion bb186b3
WaitUntilActive method parameter tableName was shadowing the class me…
kai-ion 661e748
literally copy bucket integration test
kai-ion d188f54
combined the two gradle build files
kai-ion 771d9b2
combined the two gradle build files
kai-ion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...ted/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/pagination/ScanPaginationTraits.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/dynamodb/DynamoDBClient.h> | ||
| #include <aws/dynamodb/DynamoDB_EXPORTS.h> | ||
| #include <aws/dynamodb/model/ScanRequest.h> | ||
| #include <aws/dynamodb/model/ScanResult.h> | ||
|
|
||
| namespace Aws { | ||
| namespace DynamoDB { | ||
| namespace Pagination { | ||
|
|
||
| struct ScanPaginationTraits { | ||
| using RequestType = Model::ScanRequest; | ||
| using ResultType = Model::ScanResult; | ||
| using OutcomeType = Model::ScanOutcome; | ||
| using ClientType = DynamoDBClient; | ||
|
|
||
| static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.Scan(request); } | ||
|
|
||
| static bool HasMoreResults(const ResultType& result) { return !result.GetLastEvaluatedKey().empty(); } | ||
|
|
||
| static void SetNextRequest(const ResultType& result, RequestType& request) { request.SetExclusiveStartKey(result.GetLastEvaluatedKey()); } | ||
| }; | ||
|
|
||
| } // namespace Pagination | ||
| } // namespace DynamoDB | ||
| } // namespace Aws |
31 changes: 31 additions & 0 deletions
31
...s-cpp-sdk-ec2/include/aws/ec2/model/pagination/DescribeSpotPriceHistoryPaginationTraits.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/ec2/EC2Client.h> | ||
| #include <aws/ec2/EC2_EXPORTS.h> | ||
| #include <aws/ec2/model/DescribeSpotPriceHistoryRequest.h> | ||
| #include <aws/ec2/model/DescribeSpotPriceHistoryResponse.h> | ||
|
|
||
| namespace Aws { | ||
| namespace EC2 { | ||
| namespace Pagination { | ||
|
|
||
| struct DescribeSpotPriceHistoryPaginationTraits { | ||
| using RequestType = Model::DescribeSpotPriceHistoryRequest; | ||
| using ResultType = Model::DescribeSpotPriceHistoryResponse; | ||
| using OutcomeType = Model::DescribeSpotPriceHistoryOutcome; | ||
| using ClientType = EC2Client; | ||
|
|
||
| static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.DescribeSpotPriceHistory(request); } | ||
|
|
||
| static bool HasMoreResults(const ResultType& result) { return !result.GetNextToken().empty(); } | ||
|
|
||
| static void SetNextRequest(const ResultType& result, RequestType& request) { request.SetNextToken(result.GetNextToken()); } | ||
| }; | ||
|
|
||
| } // namespace Pagination | ||
| } // namespace EC2 | ||
| } // namespace Aws |
26 changes: 26 additions & 0 deletions
26
generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ClientPagination.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/core/utils/pagination/Paginator.h> | ||
| #include <aws/s3/S3Client.h> | ||
| #include <aws/s3/model/pagination/ListBucketsPaginationTraits.h> | ||
| #include <aws/s3/model/pagination/ListDirectoryBucketsPaginationTraits.h> | ||
| #include <aws/s3/model/pagination/ListObjectsV2PaginationTraits.h> | ||
| #include <aws/s3/model/pagination/ListPartsPaginationTraits.h> | ||
|
|
||
| namespace Aws { | ||
| namespace S3 { | ||
|
|
||
| using ListBucketsPaginator = | ||
| Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListBucketsRequest, Pagination::ListBucketsPaginationTraits>; | ||
| using ListDirectoryBucketsPaginator = | ||
| Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListDirectoryBucketsRequest, Pagination::ListDirectoryBucketsPaginationTraits>; | ||
| using ListObjectsV2Paginator = | ||
| Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListObjectsV2Request, Pagination::ListObjectsV2PaginationTraits>; | ||
| using ListPartsPaginator = Aws::Utils::Pagination::PagePaginator<S3Client, Model::ListPartsRequest, Pagination::ListPartsPaginationTraits>; | ||
|
|
||
| } // namespace S3 | ||
| } // namespace Aws | ||
33 changes: 33 additions & 0 deletions
33
generated/src/aws-cpp-sdk-s3/include/aws/s3/model/pagination/ListBucketsPaginationTraits.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/s3/S3Client.h> | ||
| #include <aws/s3/S3_EXPORTS.h> | ||
| #include <aws/s3/model/ListBucketsRequest.h> | ||
| #include <aws/s3/model/ListBucketsResult.h> | ||
|
|
||
| namespace Aws { | ||
| namespace S3 { | ||
| namespace Pagination { | ||
|
|
||
| struct ListBucketsPaginationTraits { | ||
| using RequestType = Model::ListBucketsRequest; | ||
| using ResultType = Model::ListBucketsResult; | ||
| using OutcomeType = Model::ListBucketsOutcome; | ||
| using ClientType = S3Client; | ||
|
|
||
| static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListBuckets(request); } | ||
|
|
||
| static bool HasMoreResults(const ResultType& result) { return !result.GetContinuationToken().empty(); } | ||
|
|
||
| static void SetNextRequest(const ResultType& result, RequestType& request) { | ||
| request.SetContinuationToken(result.GetContinuationToken()); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace Pagination | ||
| } // namespace S3 | ||
| } // namespace Aws |
33 changes: 33 additions & 0 deletions
33
...src/aws-cpp-sdk-s3/include/aws/s3/model/pagination/ListDirectoryBucketsPaginationTraits.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/s3/S3Client.h> | ||
| #include <aws/s3/S3_EXPORTS.h> | ||
| #include <aws/s3/model/ListDirectoryBucketsRequest.h> | ||
| #include <aws/s3/model/ListDirectoryBucketsResult.h> | ||
|
|
||
| namespace Aws { | ||
| namespace S3 { | ||
| namespace Pagination { | ||
|
|
||
| struct ListDirectoryBucketsPaginationTraits { | ||
| using RequestType = Model::ListDirectoryBucketsRequest; | ||
| using ResultType = Model::ListDirectoryBucketsResult; | ||
| using OutcomeType = Model::ListDirectoryBucketsOutcome; | ||
| using ClientType = S3Client; | ||
|
|
||
| static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListDirectoryBuckets(request); } | ||
|
|
||
| static bool HasMoreResults(const ResultType& result) { return !result.GetContinuationToken().empty(); } | ||
|
|
||
| static void SetNextRequest(const ResultType& result, RequestType& request) { | ||
| request.SetContinuationToken(result.GetContinuationToken()); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace Pagination | ||
| } // namespace S3 | ||
| } // namespace Aws |
33 changes: 33 additions & 0 deletions
33
generated/src/aws-cpp-sdk-s3/include/aws/s3/model/pagination/ListObjectsV2PaginationTraits.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/s3/S3Client.h> | ||
| #include <aws/s3/S3_EXPORTS.h> | ||
| #include <aws/s3/model/ListObjectsV2Request.h> | ||
| #include <aws/s3/model/ListObjectsV2Result.h> | ||
|
|
||
| namespace Aws { | ||
| namespace S3 { | ||
| namespace Pagination { | ||
|
|
||
| struct ListObjectsV2PaginationTraits { | ||
| using RequestType = Model::ListObjectsV2Request; | ||
| using ResultType = Model::ListObjectsV2Result; | ||
| using OutcomeType = Model::ListObjectsV2Outcome; | ||
| using ClientType = S3Client; | ||
|
|
||
| static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListObjectsV2(request); } | ||
|
|
||
| static bool HasMoreResults(const ResultType& result) { return !result.GetNextContinuationToken().empty(); } | ||
|
|
||
| static void SetNextRequest(const ResultType& result, RequestType& request) { | ||
| request.SetContinuationToken(result.GetNextContinuationToken()); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace Pagination | ||
| } // namespace S3 | ||
| } // namespace Aws |
33 changes: 33 additions & 0 deletions
33
generated/src/aws-cpp-sdk-s3/include/aws/s3/model/pagination/ListPartsPaginationTraits.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/s3/S3Client.h> | ||
| #include <aws/s3/S3_EXPORTS.h> | ||
| #include <aws/s3/model/ListPartsRequest.h> | ||
| #include <aws/s3/model/ListPartsResult.h> | ||
|
|
||
| namespace Aws { | ||
| namespace S3 { | ||
| namespace Pagination { | ||
|
|
||
| struct ListPartsPaginationTraits { | ||
| using RequestType = Model::ListPartsRequest; | ||
| using ResultType = Model::ListPartsResult; | ||
| using OutcomeType = Model::ListPartsOutcome; | ||
| using ClientType = S3Client; | ||
|
|
||
| static OutcomeType Invoke(ClientType& client, const RequestType& request) { return client.ListParts(request); } | ||
|
|
||
| static bool HasMoreResults(const ResultType& result) { return result.GetNextPartNumberMarker() != 0; } | ||
|
|
||
| static void SetNextRequest(const ResultType& result, RequestType& request) { | ||
| request.SetPartNumberMarker(result.GetNextPartNumberMarker()); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace Pagination | ||
| } // namespace S3 | ||
| } // namespace Aws |
27 changes: 27 additions & 0 deletions
27
generated/tests/dynamodb-gen-tests/DynamoDBPaginationCompilationTests.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| // Header compilation test for DynamoDB pagination headers | ||
| // This test ensures all generated pagination headers compile successfully | ||
|
|
||
| #include <aws/dynamodb/DynamoDBClientPagination.h> | ||
| #include <aws/dynamodb/model/pagination/ScanPaginationTraits.h> | ||
| #include <aws/dynamodb/model/pagination/ListContributorInsightsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/pagination/ListExportsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/pagination/QueryPaginationTraits.h> | ||
| #include <aws/dynamodb/model/pagination/ListTablesPaginationTraits.h> | ||
| #include <aws/dynamodb/model/pagination/ListImportsPaginationTraits.h> | ||
|
|
||
| #include <aws/testing/AwsCppSdkGTestSuite.h> | ||
|
|
||
| class DynamoDBPaginationCompilationTest : public Aws::Testing::AwsCppSdkGTestSuite | ||
| { | ||
| }; | ||
|
|
||
| TEST_F(DynamoDBPaginationCompilationTest, DynamoDBPaginationHeadersCompile) | ||
| { | ||
| // Test passes if compilation succeeds | ||
| SUCCEED(); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so lets talk about how we would use this Paginator then. i assume a code example would look something like
when I look at the java documentation i see that paginator construction is a method on the client. i.e.
so my question here is why are we doing it differently than java? one of the most common complaints we get is that SDKs have different ergonmics when you switch bettween them.
so why are we creating paginators different than java and not a as a member? what is preventing us from making it a member function?
shouldnt it look something like this?:
S3Client s3_client{}; for (const auto& page: s3_client.ListBucketsPaginator{listReq}) { //... }