Skip to content

Commit

Permalink
Fix gcs client pagination (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
derek-globus authored Jun 2, 2023
1 parent 67fe11c commit 2fbe989
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.d/20230602_150941_derek_fix_gcs_list_pagination.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

* Fix pagination on iterable gcs client routes (:pr:`NUMBER`)
22 changes: 22 additions & 0 deletions src/globus_sdk/services/gcs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ def get_storage_gateway_list(
self,
*,
include: None | str | t.Iterable[str] = None,
page_size: int | None = None,
marker: str | None = None,
query_params: dict[str, t.Any] | None = None,
) -> IterableGCSResponse:
"""
Expand All @@ -308,6 +310,11 @@ def get_storage_gateway_list(
policies in the attached storage_gateways document. This requires an
``administrator`` role on the Endpoint.
:type include: str or iterable of str, optional
:param page_size: Number of results to return per page
:type page_size: int, optional
:param marker: Pagination marker supplied by previous API calls in the event
a request returns more values than the page size
:type marker: str, optional
:param query_params: Additional passthrough query parameters
:type query_params: dict, optional
Expand All @@ -329,6 +336,10 @@ def get_storage_gateway_list(
query_params = {}
if include is not None:
query_params["include"] = ",".join(utils.safe_strseq_iter(include))
if page_size is not None:
query_params["page_size"] = page_size
if marker is not None:
query_params["marker"] = marker
return IterableGCSResponse(
self.get("/storage_gateways", query_params=query_params)
)
Expand Down Expand Up @@ -480,6 +491,8 @@ def get_role_list(
self,
collection_id: UUIDLike | None = None,
include: str | None = None,
page_size: int | None = None,
marker: str | None = None,
query_params: dict[str, t.Any] | None = None,
) -> IterableGCSResponse:
"""
Expand All @@ -492,6 +505,11 @@ def get_role_list(
:param include: Pass "all_roles" to request all roles all roles
relevant to the resource instead of only those the caller has on
the resource
:param page_size: Number of results to return per page
:type page_size: int, optional
:param marker: Pagination marker supplied by previous API calls in the event
a request returns more values than the page size
:type marker: str, optional
:type include: str, optional
:param query_params: Additional passthrough query parameters
:type query_params: dict, optional
Expand All @@ -510,6 +528,10 @@ def get_role_list(
query_params = {}
if include is not None:
query_params["include"] = include
if page_size is not None:
query_params["page_size"] = page_size
if marker is not None:
query_params["marker"] = marker
if collection_id is not None:
query_params["collection_id"] = collection_id

Expand Down

0 comments on commit 2fbe989

Please sign in to comment.