Toggle Toggle

yaml
type: "io.kestra.core.tasks.trigger.Toggle"

Toggle a trigger: enable or disable it.

Examples

Toggle a trigger on flow input.

yaml
id: trigger-toggle
    namespace: myteam

    inputs:
      - id: toggle
        type: BOOLEAN
        defaults: true

    tasks:
      - id: if
        type: io.kestra.core.tasks.flows.If
        condition: "{{inputs.toggle}}"
        then:
        - id: enable
          type: io.kestra.core.tasks.trigger.Toggle
          trigger: schedule
          enabled: true
        else:
        - id: disable
          type: io.kestra.core.tasks.trigger.Toggle
          trigger: schedule
          enabled: false
      - id: log
        type: io.kestra.core.tasks.log.Log
        message: Hello World

    triggers:
      - id: schedule
        type: io.kestra.core.models.triggers.types.Schedule
        cron: "* * * * *"

Properties

enabled

  • Type: boolean
  • Dynamic:
  • Required: ✔️
  • Default: false

Whether to enable or disable the trigger.

trigger

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

The identifier of the trigger to toggle.

flowId

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

The flow identifier of the trigger to toggle.

If not set, the current flow identifier will be used.

namespace

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

The namespace of the flow of the trigger to toggle.

If not set, the current flow namespace will be used.