Skip to main content

Google Cloud Storage Component

Manage files in a Google Cloud Platform (GCP) Cloud Storage bucket

Component key: google-cloud-storage

Description#

Google Cloud Storage is Google's cloud file/blob storage system. This component allows you to create, download, modify, list, and delete files stored in a Google Cloud Storage bucket.

Documentation for the Node.js client used in this component can be found at https://googleapis.dev/nodejs/storage/latest.

A common integration pattern involves listing files in a file store, and performing a series of actions on the array of files that are returned. See our looping over files quickstart for information about how to create a loop over an array of files.

Authorization Methods#

Google Cloud Storage requires one of the following authorization methods:

Auth TypeKeyDescriptionFields
Private Keyprivate_keyPrivate Key authorization based on a username/private key combination

Username |  username

Private Key |  private_key

The Google Cloud Storage component requires a username / private key pair for authentication. To create a GCP service account, follow directions on https://cloud.google.com/docs/authentication/getting-started.

After creating a service account, you will have an option to create a key for the account. This will generate a .json file with type, project_id, and a dozen other fields. The client_email field will serve as your credential Username, and the private_key which starts with -----BEGIN PRIVATE KEY----- will serve as your credential Private Key.

Actions#

Copy Files#

Copy a file from one Google Cloud Storage bucket to another | key: copyFile

InputKeyNotesExample

Destination Bucket

string
/ Required
destinationBucketNameA Google Cloud Storage 'bucket' is a container where files are stored. The destination bucket indicates the bucket containing the file you want to copy. If you are copying files within a single bucket, list the same bucket as the source and destination bucket.my-destination-bucket

Destination File Name

string
/ Required
destinationFileNameThis represents the destination file's path. Do not include a leading /.path/to/destination/file.txt

GCP Project ID

string
/ Required
projectGoogle Cloud Storage Buckets are associated with GCP projects. This is the ID (letters, numbers, and dashes) of the GCP project.my-sample-project-123

Source Bucket

string
/ Required
sourceBucketNameA Google Cloud Storage 'bucket' is a container where files are stored. The source bucket indicates the bucket containing the file you want to copy. If you are copying files within a single bucket, list the same bucket as the source and destination bucket.my-source-bucket

Source File Name

string
/ Required
sourceFileNameThis represents the source file's path. Do not include a leading /.path/to/source/file.txt

Delete File#

Delete a file from a Google Cloud Storage bucket | key: deleteFile

InputKeyNotesExample

Bucket Name

string
/ Required
bucketNameBuckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.my-gcs-bucket

File Name

string
/ Required
fileNameA file is saved in a 'bucket'. This represents the file's path without a leading /path/to/file.txt

GCP Project ID

string
/ Required
projectGoogle Cloud Storage Buckets are associated with GCP projects. This is the ID (letters, numbers, and dashes) of the GCP project.my-sample-project-123

Download File#

Download a file from Google Cloud Storage | key: downloadFile

InputKeyNotesExample

Bucket Name

string
/ Required
bucketNameBuckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.my-gcs-bucket

File Name

string
/ Required
fileNameA file is saved in a 'bucket'. This represents the file's path without a leading /path/to/file.txt

GCP Project ID

string
/ Required
projectGoogle Cloud Storage Buckets are associated with GCP projects. This is the ID (letters, numbers, and dashes) of the GCP project.my-sample-project-123

Output Example Payload#

{  "data": {    "type": "Buffer",    "data": [      70,      105,      108,      101,      32,      67,      111,      110,      116,      101,      110,      116,      115    ]  },  "contentType": "text/plain"}

List Files#

List files in a Google Cloud Storage bucket | key: listFiles

InputKeyNotesExample

Bucket Name

string
/ Required
bucketNameBuckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.my-gcs-bucket

Prefix

string
prefixList only files prefixed with this string. For example, if you only want files in a directory called 'unprocessed', you can enter 'unprocessed/'. If this is left blank, all files in the selected bucket will be listed.path/to/directory/

GCP Project ID

string
/ Required
projectGoogle Cloud Storage Buckets are associated with GCP projects. This is the ID (letters, numbers, and dashes) of the GCP project.my-sample-project-123

Output Example Payload#

{  "data": [    "foo.yaml",    "bar.xml",    "dist/to/myfile.json"  ]}

Move File#

Move a file from one Google Cloud Storage bucket to another | key: moveFile

InputKeyNotesExample

Destination Bucket

string
/ Required
destinationBucketNameA Google Cloud Storage 'bucket' is a container where files are stored. The destination bucket indicates the bucket containing the file you want to copy. If you are copying files within a single bucket, list the same bucket as the source and destination bucket.my-destination-bucket

Destination File Name

string
/ Required
destinationFileNameThis represents the destination file's path. Do not include a leading /.path/to/destination/file.txt

GCP Project ID

string
/ Required
projectGoogle Cloud Storage Buckets are associated with GCP projects. This is the ID (letters, numbers, and dashes) of the GCP project.my-sample-project-123

Source Bucket

string
/ Required
sourceBucketNameA Google Cloud Storage 'bucket' is a container where files are stored. The source bucket indicates the bucket containing the file you want to copy. If you are copying files within a single bucket, list the same bucket as the source and destination bucket.my-source-bucket

Source File Name

string
/ Required
sourceFileNameThis represents the source file's path. Do not include a leading /.path/to/source/file.txt

Save File#

Save a file to Google Cloud Storage | key: saveFile

InputKeyNotesExample

Bucket Name

string
/ Required
bucketNameBuckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.my-gcs-bucket

File Contents

data
/ Required
fileContentsThe contents to write to a file. This can be a string of text, it can be binary data (like an image or PDF) that was generated in a previous step.My File Contents

File Name

string
/ Required
fileNameA file is saved in a 'bucket'. This represents the file's path without a leading /path/to/file.txt

GCP Project ID

string
/ Required
projectGoogle Cloud Storage Buckets are associated with GCP projects. This is the ID (letters, numbers, and dashes) of the GCP project.my-sample-project-123
note

File Contents can be a reference to a binary file (JavaScript Buffer) from a previous step. For example, if you have an HTTP Get action that pulls down a .png image, you can reference its step name to write the .png to Google Cloud Storage. Or, File Contents can be simple text, like 'Hello World'.