Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -204,7 +203,7 @@ The response body will contain the following JSON:

```json
{
"objectURL":"https://storage.googleapis.com/<your bucket>/<key>",
"objectURL":"https://storage.googleapis.com/<your bucket>/<key>"
}
```

Expand Down Expand Up @@ -256,7 +255,7 @@ To perform a bulk get operation that retrieves all bucket files at once, invoke

```json
{
"operation": "bulkGet",
"operation": "bulkGet"
}
```

Expand All @@ -270,13 +269,13 @@ The metadata parameters are:

{{% tab header="Windows" %}}
```bash
curl -d '{ \"operation\": \"bulkget\"}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
curl -d '{ \"operation\": \"bulkGet\"}' http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
{{% /tab %}}

{{% tab header="Linux" %}}
```bash
curl -d '{ "operation": "bulkget"}' \
curl -d '{ "operation": "bulkGet"}' \
http://localhost:<dapr-port>/v1.0/bindings/<binding-name>
```
{{% /tab %}}
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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"
}
}
Expand All @@ -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
Expand All @@ -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"
}
}
Expand All @@ -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
Expand All @@ -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"
}
}
Expand All @@ -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 %}})
Expand Down
Loading