GCP Storage: Get Node
The GCP Storage: Get Node allows a workflow to download or retrieve a link to a file in a GCP Storage bucket.
Node Properties
There are four main configuration sections for the GCP Storage: Get Node …
Google Cloud Configuration
First, we must enter our Google Cloud Storage credentials.
- Account Key Method: This may be supplied as either a JSON template or a payload path.
- Account Key: An account key that has access to the bucket containing the file you wish to retrieve.
Note: We recommend that you create a service account key specifically for use in Losant workflows that has appropriate access to relevant storage buckets.
File Configuration
Next, we enter the basic details of the file we will be retrieving. All applicable fields are templatable.
- Bucket Name: (Required) The name of the bucket containing the file to retrieve.
- File Name: (Required) The name of the file to retrieve.
Result Type
Now, determine how you would like the file returned:
- Get File Contents: Returns the actual content of the file and places it on the workflow payload. If your file is especially large, it is recommended to not select this option. When opting to return the file content, you must also specify the File Encoding (defaults to UTF8).
- Get Download Link: Selecting this option places a signed URL on the workflow payload to where the file can be downloaded.
Output
Finally, specify a payload path for the result of the operation. Depending on the selected result type, the shape of the response may vary.
When the operation successfully executes, the result will contain two keys: the value
retrieved from Google Cloud Storage, and some metadata
about the file. When the the operation encounters an error, the result will contain a single error
key.
Node Example
The GCP Storage: Get Node’s output varies with the selected result type:
-
When
Get File Contents
is selected, the result will look like the following:{ "value": "1, 2, 3, 4 12, 340, 360, 417 45, 318, 342, 391 56, 362, 406, 419", "metadata": { "fileSize": 1890, "contentType": "text/plain", "etag": "\"0x8DA4A2A98327BB1\"" } }
-
When
Get Download Link
is selected, the result will look like the following:{ "value": "http://storage.googleapis.com/<Bucket>/<File>", "metadata": { "fileSize": 12720, "contentType": "application/json", "etag": "\"0x8DA4A2A98327BA1\"" } }
Node Errors
In the case of an error, the resulting object will contain an error
key instead of the normal value
and metadata
keys.
{
"error": "Access Denied"
}
Related Nodes
Was this page helpful?
Still looking for help? You can also search the Losant Forums or submit your question there.