Skip to content
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

feat: Implement pagination for listing clusters in AskCluster function #7

Merged
merged 1 commit into from
Apr 13, 2023

Conversation

HaRuKa-1231
Copy link
Contributor

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, the ListClusters 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

  • Updated the AskCluster function to handle pagination properly by iterating through all pages of the ListClusters API call using a for loop and the NextToken field.

Notes

  • This PR addresses the issue with the cluster listing in the AskCluster function only. Other similar API calls in the codebase might still need to be updated to handle pagination properly.
  • Since the ListClustersPages function was not available in the AWS SDK for Go version used in this project, the pagination handling was implemented using a for loop to iterate through all pages of results. It is possible that a different version of the SDK might have this function available.
  • The behavior of the 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ループで反復処理することで、ページネーションを適切に処理するようにしました。

注意点

  • このPRは、AskCluster関数のクラスタ一覧表示の問題にのみ対処します。コードベース内の他の同様のAPI呼び出しは、ページネーションを適切に処理するために更新が必要かもしれません。
  • このプロジェクトで使用しているAWS SDK for GoのバージョンではListClustersPages関数が利用できなかったため、forループを使用してページネーション処理を実装しました。異なるバージョンのSDKでは、この関数が利用可能である可能性があります。
  • ここでの変更は、ローカルでのAskCluster関数の挙動のみを確認できており、アプリケーションの他の部分の挙動については保証できません。

お手数ですが、変更内容をご確認いただき、必要に応じて調整をお知らせください。どうぞよろしくお願い申し上げます。

Copy link
Owner

@yukiarrr yukiarrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! LGTM!

@yukiarrr yukiarrr merged commit 6518015 into yukiarrr:main Apr 13, 2023
@HaRuKa-1231 HaRuKa-1231 deleted the feature/ecs_cluster_pagination branch April 13, 2023 13:06
@yukiarrr
Copy link
Owner

@HaRuKa-1231 Including this PR, v0.9.0 has been released.

@yukiarrr yukiarrr mentioned this pull request Apr 13, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants