Asset TtlTrigger

Asset TtlTrigger

Certified

Trigger a Flow when the TTL of matching assets is about to expire, or has expired.

TTLs are checked periodically. The flow is started once per asset when the asset enters the expiresWithin window (on: EXPIRING), and once when its TTL is past (on: EXPIRED). Changing the TTL of an asset starts its windows over. To be warned at several points before the expiry, add one trigger per window.

Deployments are targeted by default; set assetType to target any other asset type with a TTL. Nothing is done to the asset itself: the corrective action is up to the flow.

yaml
type: io.kestra.plugin.ee.assets.TtlTrigger

Warn 7 days and 1 day before any deployment of the tenant expires.

yaml
id: ttl_warning
namespace: company.infra

triggers:
  - id: warn_7_days
    type: io.kestra.plugin.ee.assets.TtlTrigger
    on: EXPIRING
    expiresWithin: P7D
  - id: warn_1_day
    type: io.kestra.plugin.ee.assets.TtlTrigger
    on: EXPIRING
    expiresWithin: P1D

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ trigger.asset.id }} expires on {{ trigger.asset.ttl }}"

Act on one deployment once its TTL has expired.

yaml
id: retire_staging_cluster
namespace: company.infra

triggers:
  - id: expired
    type: io.kestra.plugin.ee.assets.TtlTrigger
    on: EXPIRED
    namespace: company.infra
    assetId: staging-cluster-eu

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ trigger.asset.id }} has expired"
Properties
Possible Values
EXPIRINGEXPIRED

Whether the flow is started when the TTL is about to expire, or once it has expired.

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

The asset ID to react to.

When set, only the asset with this exact ID can start an execution.

The asset type to react to.

Exact match on the full type string, for example io.kestra.plugin.ee.assets.Table. A shortened value such as TABLE only matches assets whose type is literally TABLE.

Formatduration

How long before the expiry the flow is started, with on: EXPIRING only.

See ISO_8601 Durations for more information of available values.

Conditions on the asset metadata, all of which must be met.

Each condition compares one top-level metadata key with a string value.

  • field: the metadata key, for example environment. Nested keys aren't supported.
  • type: EQUAL_TO or NOT_EQUAL_TO. No other operators exist.
  • value: the value to compare, as a string.

NOT_EQUAL_TO also matches assets that don't have the key.

Definitions
fieldstring
typestring
Possible Values
EQUAL_TONOT_EQUAL_TO
valuestring

The asset namespace to react to.

Exact match. Assets in child namespaces don't match, and Global assets (assets without a namespace) only match a trigger that doesn't set namespace.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

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

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

Asset whose TTL is expiring or has expired.

Definitions

Declares a dataset that a task writes outside of a database table, such as files in a data lake. system, location and format are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.

Example

Register the dataset a task has written.

yaml
id: export_trips
namespace: company.data

tasks:
  - id: export
    type: io.kestra.plugin.core.log.Log
    message: Exporting trips
    assets:
      outputs:
        - type: io.kestra.plugin.ee.assets.Dataset
          id: trips
          system: s3
          location: s3://company-lake/trips/
          format: parquet
assetActionsarray
Max items100

The day-2 actions offered on this asset, each backing onto a flow.

Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.

flowIdstring
Min length1

The id of the flow backing this action.

labelstring

The label displayed on this action.

namespacestring
Min length1

The namespace of the flow backing this action.

whenarray
Max items20

The conditions under which this action is offered.

All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.

fieldstring
Min length1

The field this condition reads.

operatorstring
Possible Values
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIX

How the field is compared to the value.

valuestringnumberbooleanarray

The value the field is compared to.

A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.

descriptionstring
displayNamestring
formatstring

The format of the data, for example parquet or csv.

idstring
Min length1
Max length150
locationstring

Where the dataset is stored, for example a bucket prefix.

metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

systemstring

The system storing the dataset, for example s3 or gcs.

typeobject

Declares a deployment that groups the resources a flow provisions together. Other assets join a deployment by naming it in their partOf. A TtlTrigger targets deployments when no assetType is set.

Example

Register a deployment and the virtual machine it is made of.

yaml
id: provision_environment
namespace: company.infra

tasks:
  - id: provision
    type: io.kestra.plugin.core.log.Log
    message: Provisioning staging-eu
    assets:
      outputs:
        - type: io.kestra.plugin.ee.assets.Deployment
          id: staging-eu
          displayName: Staging EU
        - type: io.kestra.plugin.ee.assets.VM
          id: staging-eu-web-01
          provider: aws
          region: eu-west-1
          partOf:
            id: staging-eu
assetActionsarray
Max items100

The day-2 actions offered on this asset, each backing onto a flow.

Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.

flowIdstring
Min length1

The id of the flow backing this action.

labelstring

The label displayed on this action.

namespacestring
Min length1

The namespace of the flow backing this action.

whenarray
Max items20

The conditions under which this action is offered.

All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.

fieldstring
Min length1

The field this condition reads.

operatorstring
Possible Values
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIX

How the field is compared to the value.

valuestringnumberbooleanarray

The value the field is compared to.

A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.

descriptionstring
displayNamestring
idstring
Min length1
Max length150
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

typeobject

Declares a single file that a task writes to a storage system. system and path are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.

Example

Register the file a task has uploaded.

yaml
id: upload_report
namespace: company.finance

tasks:
  - id: upload
    type: io.kestra.plugin.core.log.Log
    message: Uploading the monthly report
    assets:
      outputs:
        - type: io.kestra.plugin.ee.assets.File
          id: monthly-report
          system: s3
          path: s3://company-reports/monthly.pdf
assetActionsarray
Max items100

The day-2 actions offered on this asset, each backing onto a flow.

Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.

flowIdstring
Min length1

The id of the flow backing this action.

labelstring

The label displayed on this action.

namespacestring
Min length1

The namespace of the flow backing this action.

whenarray
Max items20

The conditions under which this action is offered.

All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.

fieldstring
Min length1

The field this condition reads.

operatorstring
Possible Values
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIX

How the field is compared to the value.

valuestringnumberbooleanarray

The value the field is compared to.

A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.

descriptionstring
displayNamestring
idstring
Min length1
Max length150
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

pathstring

The path or URI of the file.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

systemstring

The storage system holding the file, for example s3 or sftp.

typeobject

Declares a database table that a task creates or loads. system, database, schema and name are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.

Example

Register the table a task has created.

yaml
id: create_orders_table
namespace: company.data

tasks:
  - id: create
    type: io.kestra.plugin.core.log.Log
    message: Creating analytics.public.orders
    assets:
      outputs:
        - type: io.kestra.plugin.ee.assets.Table
          id: analytics.public.orders
          system: postgres
          database: analytics
          schema: public
          name: orders
assetActionsarray
Max items100

The day-2 actions offered on this asset, each backing onto a flow.

Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.

flowIdstring
Min length1

The id of the flow backing this action.

labelstring

The label displayed on this action.

namespacestring
Min length1

The namespace of the flow backing this action.

whenarray
Max items20

The conditions under which this action is offered.

All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.

fieldstring
Min length1

The field this condition reads.

operatorstring
Possible Values
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIX

How the field is compared to the value.

valuestringnumberbooleanarray

The value the field is compared to.

A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.

databasestring

The database the table belongs to.

descriptionstring
displayNamestring
idstring
Min length1
Max length150
metadataobject
Default{}
namestring

The name of the table.

namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

schemastring

The schema the table belongs to.

systemstring

The database system, for example postgres, snowflake or bigquery.

typeobject

Declares a virtual machine that a task provisions or manages. provider, region and state are stored in the metadata of the asset, so they can be matched with metadataQuery on an asset trigger.

Example

Register the virtual machine a task has provisioned.

yaml
id: provision_vm
namespace: company.infra

tasks:
  - id: provision
    type: io.kestra.plugin.core.log.Log
    message: Provisioning web-01
    assets:
      outputs:
        - type: io.kestra.plugin.ee.assets.VM
          id: web-01
          displayName: Web server 01
          provider: aws
          region: eu-west-1
          state: running
assetActionsarray
Max items100

The day-2 actions offered on this asset, each backing onto a flow.

Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.

flowIdstring
Min length1

The id of the flow backing this action.

labelstring

The label displayed on this action.

namespacestring
Min length1

The namespace of the flow backing this action.

whenarray
Max items20

The conditions under which this action is offered.

All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.

fieldstring
Min length1

The field this condition reads.

operatorstring
Possible Values
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIX

How the field is compared to the value.

valuestringnumberbooleanarray

The value the field is compared to.

A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.

descriptionstring
displayNamestring
idstring
Min length1
Max length150
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

providerstring

The cloud provider or hypervisor hosting the virtual machine, for example aws, gcp or vsphere.

regionstring

The region or zone the virtual machine runs in.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

statestring

The state of the virtual machine, for example running or stopped.

typeobject
assetActionsarray
Max items100

The day-2 actions offered on this asset, each backing onto a flow.

Assets and flows are decoupled, and actions edited from the UI or the API are not written back to the flow. When assetActions is declared in a flow, the actions stored on the asset are replaced by the declared ones on each execution, and edits made from the UI or the API are overwritten. When it is omitted, the stored actions are kept. It's up to you to manage the actions of an asset either as code in the flow or from the UI and the API.

flowIdstring
Min length1

The id of the flow backing this action.

labelstring

The label displayed on this action.

namespacestring
Min length1

The namespace of the flow backing this action.

whenarray
Max items20

The conditions under which this action is offered.

All conditions must hold, and an action without conditions is always offered. A field the resource does not have reads as null, so NOT_EQUAL_TO, NOT_IN and NOT_CONTAINS hold on it. A field is read as status, namespace or metadata.<key> on an asset.

fieldstring
Min length1

The field this condition reads.

operatorstring
Possible Values
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIX

How the field is compared to the value.

valuestringnumberbooleanarray

The value the field is compared to.

A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.

descriptionstring
displayNamestring
idstring
Min length1
Max length150
metadataobject
Default{}
namespacestring
Min length1
Max length150
partOf

The asset this one is part of.

At most one parent. Parent depth is limited by the service layer, not by this model.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

relatedarray
Max items50

Assets related to this one.

Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.

idstring
Validation RegExp^[a-zA-Z0-9][a-zA-Z0-9._:-]*
Min length1
Max length150

The id of the referenced asset.

namespacestring
Validation RegExp^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*
Min length1
Max length150

The namespace of the referenced asset, informational: asset ids are unique per tenant.

rolestring
Max length100

The role this asset plays in the relation, for example primary or backup.

typestring
Min length1

Custom asset type

Possible Values
EXPIRINGEXPIRED

Whether the TTL is expiring or has expired.