[#324]Extension list_objects method

This commit is contained in:
Roman Chernykh 2024-11-18 13:01:26 +03:00 committed by Roman Chernykh
parent 0c9660fffc
commit 24e1dfef28
3 changed files with 23 additions and 5 deletions

View file

@ -398,10 +398,17 @@ class Boto3ClientWrapper(S3ClientWrapper):
return response if full_output else obj_list
@reporter.step("List objects S3")
def list_objects(self, bucket: str, full_output: bool = False) -> Union[dict, list[str]]:
def list_objects(
self, bucket: str, full_output: bool = False, page_size: Optional[int] = None, prefix: Optional[str] = None
) -> Union[dict, list[str]]:
params = {"Bucket": bucket}
if page_size:
params["MaxKeys"] = page_size
if prefix:
params["Prefix"] = prefix
response = self._exec_request(
self.boto3_client.list_objects,
params={"Bucket": bucket},
params,
endpoint=self.s3gate_endpoint,
profile=self.profile,
)