-
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
5
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.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
209e3e0
Added pagination codegen to new Smithy codegen project with CRTP base…
kai-ion 11c6a37
added a new codegen project for cpp-codegen
kai-ion 75609a1
adding back removed dependencies and fixed integration test
kai-ion 36e8b9b
fixed some comments on PR. Resolved unused mehtods and classes and ad…
kai-ion 3616995
Refactor generateHasMoreResultsLogic
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
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
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
34 changes: 34 additions & 0 deletions
34
generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBClientPagination.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,34 @@ | ||
| /** | ||
| * 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/dynamodb/DynamoDBClient.h> | ||
| #include <aws/dynamodb/model/ListContributorInsightsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ListExportsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ListImportsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ListTablesPaginationTraits.h> | ||
| #include <aws/dynamodb/model/QueryPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ScanPaginationTraits.h> | ||
|
|
||
| namespace Aws { | ||
| namespace DynamoDB { | ||
|
|
||
| using ListContributorInsightsPaginator = | ||
| Aws::Utils::Pagination::Paginator<DynamoDBClient, Model::ListContributorInsightsRequest, | ||
| Pagination::ListContributorInsightsPaginationTraits<DynamoDBClient>>; | ||
| using ListExportsPaginator = | ||
| Aws::Utils::Pagination::Paginator<DynamoDBClient, Model::ListExportsRequest, Pagination::ListExportsPaginationTraits<DynamoDBClient>>; | ||
| using ListImportsPaginator = | ||
| Aws::Utils::Pagination::Paginator<DynamoDBClient, Model::ListImportsRequest, Pagination::ListImportsPaginationTraits<DynamoDBClient>>; | ||
| using ListTablesPaginator = | ||
| Aws::Utils::Pagination::Paginator<DynamoDBClient, Model::ListTablesRequest, Pagination::ListTablesPaginationTraits<DynamoDBClient>>; | ||
| using QueryPaginator = | ||
| Aws::Utils::Pagination::Paginator<DynamoDBClient, Model::QueryRequest, Pagination::QueryPaginationTraits<DynamoDBClient>>; | ||
| using ScanPaginator = | ||
| Aws::Utils::Pagination::Paginator<DynamoDBClient, Model::ScanRequest, Pagination::ScanPaginationTraits<DynamoDBClient>>; | ||
|
|
||
| } // namespace DynamoDB | ||
| } // namespace Aws |
86 changes: 86 additions & 0 deletions
86
generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/DynamoDBPaginationBase.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,86 @@ | ||
| /** | ||
| * 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/dynamodb/model/ListContributorInsightsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ListExportsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ListImportsPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ListTablesPaginationTraits.h> | ||
| #include <aws/dynamodb/model/QueryPaginationTraits.h> | ||
| #include <aws/dynamodb/model/ScanPaginationTraits.h> | ||
|
|
||
| #include <memory> | ||
|
|
||
| namespace Aws { | ||
| namespace DynamoDB { | ||
|
|
||
| class DynamoDBClient; | ||
|
|
||
| template <typename DerivedClient> | ||
| class DynamoDBPaginationBase { | ||
| public: | ||
| /** | ||
| * Create a paginator for ListContributorInsights operation | ||
| */ | ||
| Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListContributorInsightsRequest, | ||
| Pagination::ListContributorInsightsPaginationTraits<DerivedClient>> | ||
| ListContributorInsightsPaginator(const Model::ListContributorInsightsRequest& request) { | ||
| return Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListContributorInsightsRequest, | ||
| Pagination::ListContributorInsightsPaginationTraits<DerivedClient>>{ | ||
| *static_cast<DerivedClient*>(this), request}; | ||
| } | ||
|
|
||
| /** | ||
| * Create a paginator for ListExports operation | ||
| */ | ||
| Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListExportsRequest, Pagination::ListExportsPaginationTraits<DerivedClient>> | ||
| ListExportsPaginator(const Model::ListExportsRequest& request) { | ||
| return Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListExportsRequest, | ||
| Pagination::ListExportsPaginationTraits<DerivedClient>>{*static_cast<DerivedClient*>(this), | ||
| request}; | ||
| } | ||
|
|
||
| /** | ||
| * Create a paginator for ListImports operation | ||
| */ | ||
| Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListImportsRequest, Pagination::ListImportsPaginationTraits<DerivedClient>> | ||
| ListImportsPaginator(const Model::ListImportsRequest& request) { | ||
| return Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListImportsRequest, | ||
| Pagination::ListImportsPaginationTraits<DerivedClient>>{*static_cast<DerivedClient*>(this), | ||
| request}; | ||
| } | ||
|
|
||
| /** | ||
| * Create a paginator for ListTables operation | ||
| */ | ||
| Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListTablesRequest, Pagination::ListTablesPaginationTraits<DerivedClient>> | ||
| ListTablesPaginator(const Model::ListTablesRequest& request) { | ||
| return Aws::Utils::Pagination::Paginator<DerivedClient, Model::ListTablesRequest, | ||
| Pagination::ListTablesPaginationTraits<DerivedClient>>{*static_cast<DerivedClient*>(this), | ||
| request}; | ||
| } | ||
|
|
||
| /** | ||
| * Create a paginator for Query operation | ||
| */ | ||
| Aws::Utils::Pagination::Paginator<DerivedClient, Model::QueryRequest, Pagination::QueryPaginationTraits<DerivedClient>> QueryPaginator( | ||
| const Model::QueryRequest& request) { | ||
| return Aws::Utils::Pagination::Paginator<DerivedClient, Model::QueryRequest, Pagination::QueryPaginationTraits<DerivedClient>>{ | ||
| *static_cast<DerivedClient*>(this), request}; | ||
| } | ||
|
|
||
| /** | ||
| * Create a paginator for Scan operation | ||
| */ | ||
| Aws::Utils::Pagination::Paginator<DerivedClient, Model::ScanRequest, Pagination::ScanPaginationTraits<DerivedClient>> ScanPaginator( | ||
| const Model::ScanRequest& request) { | ||
| return Aws::Utils::Pagination::Paginator<DerivedClient, Model::ScanRequest, Pagination::ScanPaginationTraits<DerivedClient>>{ | ||
| *static_cast<DerivedClient*>(this), request}; | ||
| } | ||
| }; | ||
| } // namespace DynamoDB | ||
| } // namespace Aws |
32 changes: 32 additions & 0 deletions
32
generated/src/aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/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,32 @@ | ||
| /** | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #include <aws/dynamodb/DynamoDBServiceClientModel.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 { | ||
|
|
||
| template <typename Client = DynamoDBClient> | ||
| struct ScanPaginationTraits { | ||
| using RequestType = Model::ScanRequest; | ||
| using ResultType = Model::ScanResult; | ||
| using OutcomeType = Model::ScanOutcome; | ||
| using ClientType = Client; | ||
|
|
||
| static OutcomeType Invoke(Client& 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 |
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
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.