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 …
Authentication
First, we must enter our Google Cloud Storage credentials.
Note: We recommend that you create a service account key specifically for use in WEGnology workflows that has appropriate access to relevant storage buckets.
- Account Key Method: This may be supplied as either a Service Credential, a JSON template, or a payload path.
The next configuration field will depend on the Account Key Method selected.
- If you selected
Service Credential
as your Account Key Method, Credential Name Template can either be a string template that references your Service Credential name or you can select a Service Credential you have created for your application. - If you selected
Direct Input (JSON Template)
as your Account Key Method, Account Key JSON Template can either be a string template that references your Google Service Account JSON Key or you may enter it in directly. - If you selected
Direct Input (Payload Path)
as your Account Key Method, Account Key Payload Path is a payload path that references a Google Service Account Key that has access to the bucket containing the requested file.
The third configuration field appears for all Account Key Methods.
- Project ID Template: Can either be a string template that references your project ID or it can be left blank to use the default project ID associated with your credential. This option is available for all Account Key Methods. In Edge workflows, this option can only be defined for Gateway Edge Agent version v1.42.0 or above.
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, including the extension. If the file is in a subdirectory within the bucket, the path to the file should be included in this field. (e.g. “path/to/my/file.ext”)
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 UTF-8).
- 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\"" } }
Note: Download links retrieved this way will expire after 7 days.
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 WEGnology Forums or submit your question there.