From 2a978195b427530edf447af1ce1b3fb17213533a Mon Sep 17 00:00:00 2001 From: content-bot <55035720+content-bot@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:52:58 +0200 Subject: [PATCH] Google Cloud Storage - Update gcs-list-bucket-objects to support prefix and delimiter arguments. (#31496) (#31537) * Update GoogleCloudStorage.py added arguments for prefix and delimiter to gcs_list_bucket_objects to support limiting results returned for blobs that are in "folders" * Update GoogleCloudStorage.yml added arguments to support updates for gcs-list-bucket-objects to include prefix and delimiter parameters * Create CONTRIBUTORS.json * Update GoogleCloudStorage.yml spelling * Update Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.yml * added arguments to README * fix arguments to README * updated arguments to README * fix argument descriptions in GoogleCloudStorage.yml * fix yml structure * update RN * update docker * doc review --------- Co-authored-by: zdrouse Co-authored-by: Adi Daud <46249224+adi88d@users.noreply.github.com> Co-authored-by: adi88d --- .../GoogleCloudStorage/GoogleCloudStorage.py | 4 +++- .../GoogleCloudStorage/GoogleCloudStorage.yml | 6 +++++- .../Integrations/GoogleCloudStorage/README.md | 12 +++++++++++- Packs/GoogleCloudStorage/ReleaseNotes/1_0_12.md | 9 +++++++++ Packs/GoogleCloudStorage/pack_metadata.json | 2 +- 5 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 Packs/GoogleCloudStorage/ReleaseNotes/1_0_12.md diff --git a/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.py b/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.py index 851f29b1ca2a..cb2bd27a3bb5 100644 --- a/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.py +++ b/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.py @@ -266,8 +266,10 @@ def upload_blob(client, file_path, bucket_name, object_name): def gcs_list_bucket_objects(client, default_bucket, args): bucket_name = get_bucket_name(args, default_bucket) + prefix = args.get('prefix', None) + delimiter = args.get('delimiter', None) - blobs = client.list_blobs(bucket_name) + blobs = client.list_blobs(bucket_name, prefix=prefix, delimiter=delimiter) result = [blob2dict(blob) for blob in blobs] return_outputs( diff --git a/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.yml b/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.yml index a24208c4a5a4..b9299aec79bd 100644 --- a/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.yml +++ b/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/GoogleCloudStorage.yml @@ -119,6 +119,10 @@ script: - default: true description: Name of the bucket in which to list objects. If not specified, operation will be performed on the default bucket parameter. name: bucket_name + - description: Specify to limit blobs within a "folder" i.e., "folder-1/" if blob is "folder-1/file.txt". + name: prefix + - description: Use a delimiter if you want to limit results within a specific "folder" and without any nested blobs i.e., "/". + name: delimiter description: Retrieves the list of objects in a bucket. name: gcs-list-bucket-objects outputs: @@ -384,7 +388,7 @@ script: required: true description: Removes an entity from an object's Access Control List. name: gcs-delete-bucket-object-policy - dockerimage: demisto/google-cloud-storage:1.0.0.68936 + dockerimage: demisto/google-cloud-storage:1.0.0.83364 runonce: false script: '-' type: python diff --git a/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/README.md b/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/README.md index 4b9dbda7c233..13a1ecaac7cd 100644 --- a/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/README.md +++ b/Packs/GoogleCloudStorage/Integrations/GoogleCloudStorage/README.md @@ -291,6 +291,16 @@ Name of the bucket in which to list objects. Required + +prefix +Specify to limit blobs within a "folder" i.e., "folder-1/" if blob is "folder-1/file.txt". +Optional + + +delimiter +Use a delimiter if you want to limit results within a specific "folder" and without any nested blobs i.e., "/". +Optional +

 

@@ -368,7 +378,7 @@

 

Command Example
-
gcs-list-bucket-objects bucket_name=my-bucket
+
gcs-list-bucket-objects bucket_name=my-bucket prefix=some/path/ delimiter=/
Human Readable Output

Objects in bucket my-bucket

diff --git a/Packs/GoogleCloudStorage/ReleaseNotes/1_0_12.md b/Packs/GoogleCloudStorage/ReleaseNotes/1_0_12.md new file mode 100644 index 000000000000..8678060cf23b --- /dev/null +++ b/Packs/GoogleCloudStorage/ReleaseNotes/1_0_12.md @@ -0,0 +1,9 @@ + +#### Integrations + +##### Google Cloud Storage + +- Added the following arguments to the ***gcs-list-bucket-objects*** command: + - *delimiter* + - *prefix* +- Updated the Docker image to: *demisto/google-cloud-storage:1.0.0.83364*. \ No newline at end of file diff --git a/Packs/GoogleCloudStorage/pack_metadata.json b/Packs/GoogleCloudStorage/pack_metadata.json index 890ef2b1fc75..52a908d5ec2d 100644 --- a/Packs/GoogleCloudStorage/pack_metadata.json +++ b/Packs/GoogleCloudStorage/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Google Cloud Storage", "description": "Google Cloud Storage is a RESTful online file storage web service for storing and accessing data on Google Cloud Platform infrastructure.", "support": "xsoar", - "currentVersion": "1.0.11", + "currentVersion": "1.0.12", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",