GCP Storage: Put Node

The GCP Storage: Put Node allows a workflow to upload a file into a Google Cloud Storage bucket.

GCP Storage: Put Node

Node Properties

There are several configuration parameters for the GCP Storage: Put 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 Losant workflows that has appropriate access to relevant storage buckets.

GCP Storage: Put Node Credentials

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 that will be receiving the upload.

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 uploading. All applicable fields are templatable.

GCP Storage: Put Node Config

  • Bucket Name: (Required) The name of the bucket that will receive the file upload.
  • File Name: (Required) The name of the file to upload, including the extension. If you wish to upload the file to a subdirectory within the bucket, the path to the file should be included in this field. (e.g. “path/to/my/file.ext”)
  • File Encoding: (Required) The encoding of the data being uploaded. Defaults to UTF-8.
  • Content Type: (Required) MIME type of the data being uploaded.

File Contents

There are two Input Modes available to enter the contents of your file. Both are templatable:

GCP Storage: Put Node File Content

  • File Content Template: The content of the file to upload. If left blank, your configured file will be uploaded without any content.

GCP Storage: Put Node File URL

  • File URL Template: The URL where the file you wish to upload can be found. This option is useful when using the Temporary URL Output option in a notebook. Note that this field is required if “File URL Template” is selected as the Input Mode.

Output

GCP Storage: Put Node Output

The success or failure of the operation can optionally be placed at the specified payload path. The result is an object with a success property of true or false. In the false case, the result object will also contain an error key, whose value is an object describing the nature of the error.

Node Example

The following is an example of a successful operation:

{
  "success": true
}

Node Errors

The following is an example of a failed operation:

{
  "success": false,
  "error": "Access Denied"
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.