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.

Google Cloud Storage Connections#

Google Cloud Storage 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.

Be sure to assign the user you just created with the correct permissions. To access Google Cloud Storage resources, you will need to assign either a resource specific permission, or the Cloud Storage Admin role. After creating a service account, you will have an option to create a key for the account. If you are not greeted with this option, click on the service account you just created, and navigate to the 'keys' section. Here you can click 'Add Key' This will generate a .json file with type, project_id, and a dozen other fields. Use these fields along with your GCP Project Id to create a new connection.

InputNotesExample
Input
Client Email
string
/ Required
clientEmail
Notes
The email address of the client you would like to connect.
Example
someone@example.com
Input
Private Key
text
/ Required
privateKey
Notes
The private key of the client you would like to connect.
Example
 
Input
Project Id
string
/ Required
projectId
Notes
The ID of the project that hosts the storage bucket
Example
 

Actions#

Copy Files#

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

InputNotesExample
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
Destination Bucket
string
/ Required
destinationBucketName
Notes
A 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.
Example
my-destination-bucket
Input
Destination File Name
string
/ Required
destinationFileName
Notes
This represents the destination file's path. Do not include a leading /.
Example
path/to/destination/file.txt
Input
Source Bucket
string
/ Required
sourceBucketName
Notes
A 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.
Example
my-source-bucket
Input
Source File Name
string
/ Required
sourceFileName
Notes
This represents the source file's path. Do not include a leading /.
Example
path/to/source/file.txt

Create Bucket#

Create a new Bucket inside Google Cloud Storage | key: createBucket

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
Location
string
location
Notes
The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to 'US'. See Cloud Storage bucket locations for the authoritative list: https://cloud.google.com/storage/docs/locations
Example
US-EAST1
Input
Multi-Regional
boolean
multiRegional
Notes
This flag will determine if your bucket will be available from multiple regions.
Example
 
Input
StorageClass Type
string
/ Required
storageClass
Notes
This flag will determine the StorageClass your bucket will use.
Example
 
Input
User Project
string
userProject
Notes
Specify the project that the user creating the bucket belongs to.
Example
my-example-project

Delete Bucket#

Delete an existing Bucket from the Google Cloud Storage | key: deleteBucket

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 

Delete File#

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

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
File Name
string
/ Required
fileName
Notes
A file is saved in a 'bucket'. This represents the file's path without a leading /
Example
path/to/file.txt

Download File#

Download a file from Google Cloud Storage | key: downloadFile

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
File Name
string
/ Required
fileName
Notes
A file is saved in a 'bucket'. This represents the file's path without a leading /
Example
path/to/file.txt

Output Example Payload#

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

Get Bucket#

Get the information and metadata of an existing Bucket from the Google Cloud Storage | key: getBucket

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 

Get File#

Get the information and metadata of a file from Google Cloud Storage | key: getFile

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
File Name
string
/ Required
fileName
Notes
A file is saved in a 'bucket'. This represents the file's path without a leading /
Example
path/to/file.txt

Output Example Payload#

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

List Buckets#

List buckets in a Google Cloud Storage bucket | key: listBuckets

InputNotesExample
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
Max Results
string
maxResults
Notes
Provide an integer value for the maximum amount of results that will be returned. Provide a value from 1 to 50.
Example
20
Input
Page Token
string
pageToken
Notes
Specify the pagination token that's returned by a previous request to retrieve the next page of results
Example
lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E

List Files#

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

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
Max Results
string
maxResults
Notes
Provide an integer value for the maximum amount of results that will be returned. Provide a value from 1 to 50.
Example
20
Input
Page Token
string
pageToken
Notes
Specify the pagination token that's returned by a previous request to retrieve the next page of results
Example
lslTXFcbLQKkb0vP9Kgh5hy0Y0OnC7Z9ZPHPwPmMnxSk3eiDRMkct7D8E
Input
Prefix
string
prefix
Notes
List 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.
Example
path/to/directory/

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

InputNotesExample
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
Destination Bucket
string
/ Required
destinationBucketName
Notes
A 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.
Example
my-destination-bucket
Input
Destination File Name
string
/ Required
destinationFileName
Notes
This represents the destination file's path. Do not include a leading /.
Example
path/to/destination/file.txt
Input
Source Bucket
string
/ Required
sourceBucketName
Notes
A 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.
Example
my-source-bucket
Input
Source File Name
string
/ Required
sourceFileName
Notes
This represents the source file's path. Do not include a leading /.
Example
path/to/source/file.txt

Save File#

Save a file to Google Cloud Storage | key: saveFile

InputNotesExample
Input
Bucket Name
string
/ Required
bucketName
Notes
Buckets in Google Cloud Storage contain files, and can be configured in the GCP console. Bucket names contain only letters, numbers, and dashes.
Example
my-gcs-bucket
Input
Connection
connection
/ Required
connection
Notes
 
Example
 
Input
File Contents
data
/ Required
fileContents
Notes
The 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.
Example
My File Contents
Input
File Name
string
/ Required
fileName
Notes
A file is saved in a 'bucket'. This represents the file's path without a leading /
Example
path/to/file.txt
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'.