From 135cabf6b4376b82bc746cb942a03cdf88430ddd Mon Sep 17 00:00:00 2001 From: "nelson.parente" Date: Mon, 5 May 2025 16:17:09 +0100 Subject: [PATCH 1/2] doc: gcp copy, rename, move docs Signed-off-by: nelson.parente --- .../supported-bindings/gcpbucket.md | 54 ++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md b/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md index 4aff149d319..25fc6eb71c7 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md @@ -262,7 +262,7 @@ An HTTP 204 (No Content) and empty body will be retuned if successful. ### List objects -To perform a list object operation, invoke the S3 binding with a `POST` method and the following JSON body: +To perform a list object operation, invoke the GCP bucket binding with a `POST` method and the following JSON body: ```json { @@ -321,6 +321,58 @@ The list of objects will be returned as JSON array in the following form: } ] ``` + +### Copy objects + +To perform a copy object operation, invoke the GCP bucket binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "copy", + "metadata": { + "destinationBucket": "destination-bucket-name", + } +} +``` + +The metadata parameters are: + +- `destinationBucket` - the name of the destination bucket (required) + +### Move objects + +To perform a move object operation, invoke the GCP bucket binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "move", + "metadata": { + "destinationBucket": "destination-bucket-name", + } +} +``` + +The metadata parameters are: + +- `destinationBucket` - the name of the destination bucket (required) + +### Rename objects + +To perform a rename object operation, invoke the GCP bucket binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "rename", + "metadata": { + "newName": "object-new-name", + } +} +``` + +The metadata parameters are: + +- `newName` - the new name of the object (required) + ## Related links - [Basic schema for a Dapr component]({{< ref component-schema >}}) From 8bcca6d8e52b08d399cd805ae0e0b57bcf00194b Mon Sep 17 00:00:00 2001 From: "nelson.parente" Date: Thu, 22 May 2025 15:29:10 +0100 Subject: [PATCH 2/2] feat: add bulk get objects Signed-off-by: nelson.parente --- .../supported-bindings/gcpbucket.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md b/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md index 25fc6eb71c7..17d809537c7 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md @@ -82,8 +82,13 @@ This component supports **output binding** with the following operations: - `create` : [Create file](#create-file) - `get` : [Get file](#get-file) +- `bulkGet` : [Bulk get objects](#bulk-get-objects) - `delete` : [Delete file](#delete-file) - `list`: [List file](#list-files) +- `copy`: [Copy file](#copy-files) +- `move`: [Move file](#move-files) +- `rename`: [Rename file](#rename-files) + ### Create file @@ -216,6 +221,72 @@ The metadata parameters are: The response body contains the value stored in the object. +### Bulk get objects + +To perform a bulk get operation that retrieves all bucket files at once, invoke the GCP bucket binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "bulkGet", +} +``` + +The metadata parameters are: + +- `encodeBase64` - (optional) configuration to encode base64 file content before return the content for all files + +#### Example + +{{< tabs Windows Linux >}} + + {{% codetab %}} + ```bash + curl -d '{ \"operation\": \"bulkget\"}' http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + + {{% codetab %}} + ```bash + curl -d '{ "operation": "bulkget"}' \ + http://localhost:/v1.0/bindings/ + ``` + {{% /codetab %}} + +{{< /tabs >}} + +#### Response + +The response body contains an array of objects, where each object represents a file in the bucket with the following structure: + +```json +[ + { + "name": "file1.txt", + "data": "content of file1", + "attrs": { + "bucket": "mybucket", + "name": "file1.txt", + "size": 1234, + ... + } + }, + { + "name": "file2.txt", + "data": "content of file2", + "attrs": { + "bucket": "mybucket", + "name": "file2.txt", + "size": 5678, + ... + } + } +] +``` + +Each object in the array contains: +- `name`: The name of the file +- `data`: The content of the file +- `attrs`: Object attributes from GCP Storage including metadata like creation time, size, content type, etc. ### Delete object