🚀 New! Kestra raises $3 million to grow Learn more

Trigger Trigger

yaml
type: "io.kestra.plugin.gcp.gcs.Trigger"

Wait for files on Google cloud storage

This trigger will poll every interval a GCS bucket. You can search for all files in a bucket or directory in from or you can filter the files with a regExp.The detection is atomic, internally we do a list and interact only with files listed. Once a file is detected, we download the file on internal storage and processed with declared action in order to move or delete the files from the bucket (to avoid double detection on new poll)

Examples

Wait for a list of file on a GCS bucket and iterate through the files

yaml
id: gcs-listen
namespace: io.kestra.tests

tasks:
  - id: each
    type: io.kestra.core.tasks.flows.EachSequential
    tasks:
      - id: return
        type: io.kestra.core.tasks.debugs.Return
        format: "{{taskrun.value}}"
    value: "{{ trigger.blobs | jq('.[].uri') }}"

triggers:
  - id: watch
    type: io.kestra.plugin.gcp.gcs.Trigger
    interval: "PT5M"
    from: gs://my-bucket/kestra/listen/
    action: MOVE
    moveDirectory: gs://my-bucket/kestra/archive/

Wait for a list of files on a GCS bucket and iterate through the files. Delete files manually after processing to prevent infinite triggering.

yaml
id: s3-listen
namespace: io.kestra.tests

tasks:
  - id: each
    type: io.kestra.core.tasks.flows.EachSequential
    tasks:
      - id: return
        type: io.kestra.core.tasks.debugs.Return
        format: "{{ taskrun.value }}"
      - id: delete
        type: io.kestra.plugin.gcp.gcs.Delete
        uri: "{{ taskrun.value }}"
    value: "{{ trigger.blobs | jq('.[].uri') }}"

triggers:
  - id: watch
    type: io.kestra.plugin.gcp.gcs.Trigger
    interval: "PT5M"
    from: gs://my-bucket/kestra/listen/
    action: NONE

Properties

action

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️
  • Possible Values:
    • MOVE
    • DELETE
    • NONE

The action to perform on the retrieved files. If using 'NONE' make sure to handle the files inside your flow to avoid infinite triggering.

from

  • Type: string
  • Dynamic: ✔️
  • Required: ✔️

The directory to list

conditions

List of conditions in order to limit the flow trigger.

interval

  • Type: string
  • Dynamic:
  • Required:
  • Default: 60.000000000
  • Format: duration

Interval between polling. The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.

listingType

  • Type: string
  • Dynamic:
  • Required:
  • Default: DIRECTORY
  • Possible Values:
    • RECURSIVE
    • DIRECTORY

The listing type you want (like directory or recursive) if DIRECTORY, will only list objects in the specified directory if RECURSIVE, will list objects in the specified directory recursively Default value is DIRECTORY When using RECURSIVE value, be carefull to move your files to a location not in the from scope

moveDirectory

  • Type: string
  • Dynamic: ✔️
  • Required:

The destination directory for MOVE action.

projectId

  • Type: string
  • Dynamic: ✔️
  • Required:

The GCP project ID.

regExp

  • Type: string
  • Dynamic: ✔️
  • Required:

A regexp to filter on full path ex: regExp: .* to match all files regExp: .*2020-01-0.\\.csv to match files between 01 and 09 of january ending with .csv

scopes

  • Type: array
  • SubType: string
  • Dynamic: ✔️
  • Required:
  • Default: [https://www.googleapis.com/auth/cloud-platform]

The GCP scopes to used.

serviceAccount

  • Type: string
  • Dynamic: ✔️
  • Required:

The GCP service account key.

stopAfter

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Outputs

blobs

The bucket of the downloaded file

Definitions

io.kestra.plugin.gcp.gcs.models.Blob

Properties

bucket
  • Type: string
  • Dynamic:
  • Required:
cacheControl
  • Type: string
  • Dynamic:
  • Required:
componentCount
  • Type: integer
  • Dynamic:
  • Required:
contentDisposition
  • Type: string
  • Dynamic:
  • Required:
contentEncoding
  • Type: string
  • Dynamic:
  • Required:
contentLanguage
  • Type: string
  • Dynamic:
  • Required:
contentType
  • Type: string
  • Dynamic:
  • Required:
crc32c
  • Type: string
  • Dynamic:
  • Required:
createTime
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time
customTime
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time
deleteTime
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time
etag
  • Type: string
  • Dynamic:
  • Required:
eventBasedHold
  • Type: boolean
  • Dynamic:
  • Required:
generatedId
  • Type: string
  • Dynamic:
  • Required:
isDirectory
  • Type: boolean
  • Dynamic:
  • Required:
kmsKeyName
  • Type: string
  • Dynamic:
  • Required:
md5
  • Type: string
  • Dynamic:
  • Required:
  • Type: string
  • Dynamic:
  • Required:
metaGeneration
  • Type: integer
  • Dynamic:
  • Required:
metadata
  • Type: object
  • SubType: string
  • Dynamic:
  • Required:
name
  • Type: string
  • Dynamic:
  • Required:
retentionExpirationTime
  • Type: integer
  • Dynamic:
  • Required:
  • Type: string
  • Dynamic:
  • Required:
size
  • Type: integer
  • Dynamic:
  • Required:
temporaryHold
  • Type: boolean
  • Dynamic:
  • Required:
timeStorageClassUpdated
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time
updateTime
  • Type: string
  • Dynamic:
  • Required:
  • Format: date-time
uri
  • Type: string
  • Dynamic:
  • Required:
  • Format: uri

io.kestra.core.models.conditions.Condition