From 66d5f99ab2c8a791cf56ccc96a052ee21b1ba58c Mon Sep 17 00:00:00 2001 From: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com> Date: Tue, 5 May 2026 13:53:50 +0200 Subject: [PATCH] fix gcp storage bucket binding docs Signed-off-by: MyMirelHub <15373565+MyMirelHub@users.noreply.github.com> --- .../supported-bindings/gcpbucket.md | 81 ++++++++++++++----- 1 file changed, 62 insertions(+), 19 deletions(-) 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 74c0716dee1..6e1df8e8716 100644 --- a/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md +++ b/daprdocs/content/en/reference/components-reference/supported-bindings/gcpbucket.md @@ -73,29 +73,28 @@ The above example uses secrets as plain strings. It is recommended to use a secr | `decodeBase64` | N | Output | Configuration to decode base64 file content before saving to bucket storage. (In case of saving a file with binary content). `true` is the only allowed positive value. Other positive variations like `"True", "1"` are not acceptable. Defaults to `false` | `true`, `false` | | `encodeBase64` | N | Output | Configuration to encode base64 file content before return the content. (In case of opening a file with binary content). `true` is the only allowed positive value. Other positive variations like `"True", "1"` are not acceptable. Defaults to `false` | `true`, `false` | | `contentType` | N | Output | The MIME type to set for objects created in the bucket. If not specified, GCP attempts to auto-detect the content type. | `"text/csv"`, `"application/json"`, `"image/png"` | +| `signTTL` | N | Output | Time-to-live for signed URLs generated by the `sign` operation. Accepts any Go duration string (e.g. `"15m"`, `"1h"`). Can be overridden per-request in metadata. | `"15m"`, `"1h"` | ## GCP Credentials Since the GCP Storage Bucket component uses the GCP Go Client Libraries, by default it authenticates using **Application Default Credentials**. This is explained further in the [Authenticate to GCP Cloud services using client libraries](https://cloud.google.com/docs/authentication/client-libraries) guide. Also, see how to [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc). -## GCP Credentials - -Since the GCP Storage Bucket component uses the GCP Go Client Libraries, by default it authenticates using **Application Default Credentials**. This is explained further in the [Authenticate to GCP Cloud services using client libraries](https://cloud.google.com/docs/authentication/client-libraries) guide. -Also, see how to [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc). +> **Note:** The `name` metadata key is supported for backward compatibility and is mapped to `key`. New applications should use `key`. ## Binding support This component supports **output binding** with the following operations: - `create` : [Create file](#create-file) -- `get` : [Get file](#get-file) +- `get` : [Get file](#get-object) - `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) +- `delete` : [Delete file](#delete-object) +- `list`: [List file](#list-objects) +- `copy`: [Copy file](#copy-objects) +- `move`: [Move file](#move-objects) +- `rename`: [Rename file](#rename-objects) +- `sign` : [Sign URL](#sign-url) ### Create file @@ -204,7 +203,7 @@ The response body will contain the following JSON: ```json { - "objectURL":"https://storage.googleapis.com//", + "objectURL":"https://storage.googleapis.com//" } ``` @@ -256,7 +255,7 @@ To perform a bulk get operation that retrieves all bucket files at once, invoke ```json { - "operation": "bulkGet", + "operation": "bulkGet" } ``` @@ -270,13 +269,13 @@ The metadata parameters are: {{% tab header="Windows" %}} ```bash - curl -d '{ \"operation\": \"bulkget\"}' http://localhost:/v1.0/bindings/ + curl -d '{ \"operation\": \"bulkGet\"}' http://localhost:/v1.0/bindings/ ``` {{% /tab %}} {{% tab header="Linux" %}} ```bash - curl -d '{ "operation": "bulkget"}' \ + curl -d '{ "operation": "bulkGet"}' \ http://localhost:/v1.0/bindings/ ``` {{% /tab %}} @@ -357,7 +356,7 @@ The metadata parameters are: {{< /tabpane >}} #### Response -An HTTP 204 (No Content) and empty body will be retuned if successful. +An HTTP 204 (No Content) and empty body will be returned if successful. ### List objects @@ -379,7 +378,7 @@ The data parameters are: - `maxResults` - (optional) sets the maximum number of keys returned in the response. By default the action returns up to 1,000 key names. The response might contain fewer keys but will never contain more. - `prefix` - (optional) it can be used to filter objects starting with prefix. -- `delimiter` - (optional) it can be used to restrict the results to only the kobjects in the given "directory". Without the delimiter, the entire tree under the prefix is returned +- `delimiter` - (optional) it can be used to restrict the results to only the objects in the given "directory". Without the delimiter, the entire tree under the prefix is returned #### Response @@ -430,7 +429,9 @@ To perform a copy object operation, invoke the GCP bucket binding with a `POST` { "operation": "copy", "metadata": { - "key": "source-file.txt", + "key": "source-file.txt" + }, + "data": { "destinationBucket": "destination-bucket-name" } } @@ -439,6 +440,9 @@ To perform a copy object operation, invoke the GCP bucket binding with a `POST` The metadata parameters are: - `key` - the name of the source object (required) + +The data parameters are: + - `destinationBucket` - the name of the destination bucket (required) ### Move objects @@ -449,7 +453,9 @@ To perform a move object operation, invoke the GCP bucket binding with a `POST` { "operation": "move", "metadata": { - "key": "source-file.txt", + "key": "source-file.txt" + }, + "data": { "destinationBucket": "destination-bucket-name" } } @@ -458,6 +464,9 @@ To perform a move object operation, invoke the GCP bucket binding with a `POST` The metadata parameters are: - `key` - the name of the source object (required) + +The data parameters are: + - `destinationBucket` - the name of the destination bucket (required) ### Rename objects @@ -468,7 +477,9 @@ To perform a rename object operation, invoke the GCP bucket binding with a `POST { "operation": "rename", "metadata": { - "key": "old-name.txt", + "key": "old-name.txt" + }, + "data": { "newName": "new-name.txt" } } @@ -477,8 +488,40 @@ To perform a rename object operation, invoke the GCP bucket binding with a `POST The metadata parameters are: - `key` - the current name of the object (required) + +The data parameters are: + - `newName` - the new name of the object (required) +### Sign URL + +To generate a v4 signed URL for an object, invoke the GCP bucket binding with a `POST` method and the following JSON body: + +```json +{ + "operation": "sign", + "metadata": { + "key": "my-test-file.txt", + "signTTL": "15m" + } +} +``` + +The metadata parameters are: + +- `key` - the name of the object (required) +- `signTTL` - (optional) time-to-live for the signed URL. Accepts any Go duration string (e.g. `"15m"`, `"1h"`). Defaults to the component's configured `signTTL` if not specified. + +#### Response + +The response body contains the signed URL: + +```json +{ + "signURL": "https://storage.googleapis.com/..." +} +``` + ## Related links - [Basic schema for a Dapr component]({{% ref component-schema %}})