eladkal commented on code in PR #30815:
URL: https://github.com/apache/airflow/pull/30815#discussion_r1174437720


##########
airflow/providers/google/cloud/hooks/gcs.py:
##########
@@ -738,6 +737,23 @@ def list(self, bucket_name, versions=None, 
max_results=None, prefix=None, delimi
                 break
         return ids
 
+    def list_by_prefix(self, prefix: str | List[str] | None, bucket_name: str, 
delimiter: str | None = None):
+        """
+        List all objects from the bucket with the given prefix or list of 
prefixes
+
+        :param bucket_name: bucket name
+        :param prefix: string or list of strings which filter objects whose 
name begin with it/them
+        :param delimiter: filters objects based on the delimiter (for e.g 
'.csv')
+        :return: a stream of object names matching the filtering criteria
+        """
+        objects = []
+        if isinstance(prefix, list):
+            for prefix_item in prefix:
+                objects.extend(self.list(bucket_name=bucket_name, 
prefix=prefix_item, delimiter=delimiter))
+        else:
+            objects.extend(self.list(bucket_name=bucket_name, prefix=prefix, 
delimiter=delimiter))
+        return objects

Review Comment:
   Do we need a new function for it?
   Can't we add `List[str]` support for `prefix` parameter in `list()` function?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to