Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 173
feat: add support for partial list buckets#1606
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
658664c
feat: Add support for partial list buckets
Pulkit0110 aeb7e0f
minor changes
Pulkit0110 7c201d6
resolving comments
Pulkit0110 4c7e308
minor change
Pulkit0110 fa65849
resolving comments
Pulkit0110 6528a1a
Merge branch 'main' into partial-list-buckets
Pulkit0110 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -64,6 +64,15 @@ | ||
| _marker = object() | ||
| def _buckets_page_start(iterator, page, response): | ||
| """Grab unreachable buckets after a :class:`~google.cloud.iterator.Page` started.""" | ||
| unreachable = response.get("unreachable", []) | ||
| if not isinstance(unreachable, list): | ||
| raise TypeError( | ||
| f"expected unreachable to be list, but obtained {type(unreachable)}" | ||
| ) | ||
| page.unreachable = unreachable | ||
| class Client(ClientWithProject): | ||
| """Client to bundle configuration needed for API requests. | ||
| @@ -1458,6 +1467,7 @@ def list_buckets( | ||
| retry=DEFAULT_RETRY, | ||
| *, | ||
| soft_deleted=None, | ||
| return_partial_success=None, | ||
Pulkit0110 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ): | ||
| """Get all buckets in the project associated to the client. | ||
| @@ -1516,6 +1526,13 @@ def list_buckets( | ||
| generation number. This parameter can only be used successfully if the bucket has a soft delete policy. | ||
| See: https://cloud.google.com/storage/docs/soft-delete | ||
| :type return_partial_success: bool | ||
| :param return_partial_success: | ||
| (Optional) If True, the response will also contain a list of | ||
| unreachable buckets if the buckets are unavailable. The | ||
| unreachable buckets will be available on the ``unreachable`` | ||
| attribute of the returned iterator. | ||
| :rtype: :class:`~google.api_core.page_iterator.Iterator` | ||
| :raises ValueError: if both ``project`` is ``None`` and the client's | ||
| project is also ``None``. | ||
| @@ -1551,7 +1568,10 @@ def list_buckets( | ||
| if soft_deleted is not None: | ||
| extra_params["softDeleted"] = soft_deleted | ||
| return self._list_resource( | ||
| if return_partial_success is not None: | ||
| extra_params["returnPartialSuccess"] = return_partial_success | ||
| iterator = self._list_resource( | ||
| "/b", | ||
| _item_to_bucket, | ||
| page_token=page_token, | ||
| @@ -1560,7 +1580,9 @@ def list_buckets( | ||
| page_size=page_size, | ||
| timeout=timeout, | ||
| retry=retry, | ||
| page_start=_buckets_page_start, | ||
| ) | ||
| return iterator | ||
Pulkit0110 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. Pulkit0110 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| def restore_bucket( | ||
| self, | ||
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
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.