Asset TtlTrigger
Certified
Trigger a Flow when the TTL of matching assets is about to expire, or has expired.
Asset TtlTrigger
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.
type: io.kestra.plugin.ee.assets.TtlTriggerExamples
Warn 7 days and 1 day before any deployment of the tenant expires.
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.
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
on *string
EXPIRINGEXPIREDWhether the flow is started when the TTL is about to expire, or once it has expired.
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
assetId string
The asset ID to react to.
When set, only the asset with this exact ID can start an execution.
assetType string
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.
expiresWithin string
durationHow long before the expiry the flow is started, with on: EXPIRING only.
See ISO_8601 Durations for more information of available values.
metadataQuery array
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 exampleenvironment. Nested keys aren't supported.type:EQUAL_TOorNOT_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.
io.kestra.plugin.ee.assets.AbstractAssetTrigger-FieldQuery
EQUAL_TONOT_EQUAL_TOnamespace string
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.
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
when string
trueA 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.
Outputs
asset *
Asset whose TTL is expiring or has expired.
A dataset stored outside of a database table.
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.
Register the dataset a task has written.
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: parquet100The 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.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
The label displayed on this action.
1The namespace of the flow backing this action.
20The 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.
A condition on one field of a resource.
1The field this condition reads.
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIXHow the field is compared to the value.
The value the field is compared to.
A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.
The format of the data, for example parquet or csv.
1150Where the dataset is stored, for example a bucket prefix.
{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The system storing the dataset, for example s3 or gcs.
A deployment, grouping the resources provisioned together.
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.
Register a deployment and the virtual machine it is made of.
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-eu100The 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.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
The label displayed on this action.
1The namespace of the flow backing this action.
20The 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.
A condition on one field of a resource.
1The field this condition reads.
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIXHow the field is compared to the value.
The value the field is compared to.
A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.
1150{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
A file in a storage system.
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.
Register the file a task has uploaded.
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.pdf100The 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.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
The label displayed on this action.
1The namespace of the flow backing this action.
20The 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.
A condition on one field of a resource.
1The field this condition reads.
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIXHow the field is compared to the value.
The value the field is compared to.
A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.
1150{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The path or URI of the file.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The storage system holding the file, for example s3 or sftp.
A database table.
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.
Register the table a task has created.
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: orders100The 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.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
The label displayed on this action.
1The namespace of the flow backing this action.
20The 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.
A condition on one field of a resource.
1The field this condition reads.
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIXHow the field is compared to the value.
The value the field is compared to.
A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.
The database the table belongs to.
1150{}The name of the table.
1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The schema the table belongs to.
The database system, for example postgres, snowflake or bigquery.
A virtual machine.
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.
Register the virtual machine a task has provisioned.
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: running100The 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.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
The label displayed on this action.
1The namespace of the flow backing this action.
20The 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.
A condition on one field of a resource.
1The field this condition reads.
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIXHow the field is compared to the value.
The value the field is compared to.
A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.
1150{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The cloud provider or hypervisor hosting the virtual machine, for example aws, gcp or vsphere.
The region or zone the virtual machine runs in.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
The state of the virtual machine, for example running or stopped.
io.kestra.core.models.assets.Custom
100The 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.
io.kestra.core.models.flows.FlowAction
1The id of the flow backing this action.
The label displayed on this action.
1The namespace of the flow backing this action.
20The 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.
A condition on one field of a resource.
1The field this condition reads.
CONTAINSENDS_WITHEQUAL_TOGREATER_THANGREATER_THAN_OR_EQUAL_TOINIS_FALSEIS_NOT_NULLIS_NULLIS_TRUELESS_THANLESS_THAN_OR_EQUAL_TONOT_CONTAINSNOT_EQUAL_TONOT_INORREGEXSTARTS_WITHPREFIXHow the field is compared to the value.
The value the field is compared to.
A list for IN and NOT_IN, ignored by IS_NULL and IS_NOT_NULL.
1150{}1150The asset this one is part of.
At most one parent. Parent depth is limited by the service layer, not by this model.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
50Assets related to this one.
Declaration only: turned into RELATED relations when the asset is written, and not persisted on the asset by the platform.
A reference to another asset of the same tenant.
^[a-zA-Z0-9][a-zA-Z0-9._:-]*1150The id of the referenced asset.
^[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*1150The namespace of the referenced asset, informational: asset ids are unique per tenant.
100The role this asset plays in the relation, for example primary or backup.
1Custom asset type
on *string
EXPIRINGEXPIREDWhether the TTL is expiring or has expired.