code: private List<Bucket> listBucketsInternal() throws IOException {
      logger.atFine().log("listBucketsInternal()");
      checkNotNull(storageOptions.getProjectId(), "projectId must not be null");
      List<Bucket> allBuckets = new ArrayList<>();
      Storage.Buckets.List listBucket =
          configureRequest(gcs.buckets().list(storageOptions.getProjectId()), null);
  
      // Set number of items to retrieve per call.
      listBucket.setMaxResults(storageOptions.getMaxListItemsPerCall());
  
      // Loop till we fetch all items.
      String pageToken = null;
      do {
        if (pageToken != null) {
          logger.atFine().log("listBucketsInternal: next page %s", pageToken);
          listBucket.setPageToken(pageToken);
        }
  
        Buckets items = listBucket.execute();
  
        // Accumulate buckets (if any).
        List<Bucket> buckets = items.getItems();
        if (buckets != null) {
          logger.atFine().log("listed %s items", buckets.size());
          allBuckets.addAll(buckets);
        }
  
        pageToken = items.getNextPageToken();
      } while (pageToken != null);
  
      return allBuckets;
    }
docs: Shared helper for actually dispatching buckets().list() API calls and accumulating paginated
  results; these can then be used to either extract just their names, or to parse into full
  GoogleCloudStorageItemInfos.