feat: Implement pagination for listing clusters in AskCluster function #7
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.
Overview
This pull request aims to resolve an issue in the
AskCluster
function where not all clusters were displayed due to improper handling of pagination.Background
In the original implementation of the
AskCluster
function, theListClusters
API call was used without considering pagination. Consequently, when the number of clusters exceeded the default limit of items per page, some clusters were not displayed in the list.Changes
AskCluster
function to handle pagination properly by iterating through all pages of theListClusters
API call using afor
loop and theNextToken
field.Notes
AskCluster
function only. Other similar API calls in the codebase might still need to be updated to handle pagination properly.ListClustersPages
function was not available in the AWS SDK for Go version used in this project, the pagination handling was implemented using afor
loop to iterate through all pages of results. It is possible that a different version of the SDK might have this function available.AskCluster
function has been tested locally, but the behavior of other parts of the application cannot be guaranteed.I kindly ask you to review the changes and let me know if any adjustments are needed. Thank you for your consideration.
概要
このプルリクエストでは、ページネーションが適切に処理されていなかったため、
AskCluster
関数ですべてのクラスタが表示されない問題に対処することを目的としています。背景
AskCluster
関数の元の実装では、ListClusters
API呼び出しをページネーションを考慮せずに使用していました。その結果、クラスタの数がページごとのアイテムのデフォルトの制限を超えた場合、一部のクラスタがリストに表示されませんでした。変更内容
AskCluster
関数を更新し、ListClusters
API呼び出しのすべてのページをNextToken
フィールドを使ってfor
ループで反復処理することで、ページネーションを適切に処理するようにしました。注意点
AskCluster
関数のクラスタ一覧表示の問題にのみ対処します。コードベース内の他の同様のAPI呼び出しは、ページネーションを適切に処理するために更新が必要かもしれません。ListClustersPages
関数が利用できなかったため、for
ループを使用してページネーション処理を実装しました。異なるバージョンのSDKでは、この関数が利用可能である可能性があります。お手数ですが、変更内容をご確認いただき、必要に応じて調整をお知らせください。どうぞよろしくお願い申し上げます。