Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Subscription criteria builder

glechev edited this page Jun 30, 2021 · 1 revision

Subscription criteria builder

For type safety, we don't want to be typing Subscription criteria manually where it's possible. Instead, we are generating it. For example

new Criteria.BlueprintNameCriteria("hello").and(new Criteria.ResourceActionNameCriteria(Subscription.ResourceAction.CHANGE_LEASE))

This will be expanded to the following Javascript in the Subscription:

(event.data.blueprintId == "hello") && (event.data.actionName == "ChangeLease") 

Common criteria have their own wrapper classes for convenience.

  • BlueprintNameCriteria
  • EventTypeCriteria
  • ResourceActionNameCriteria

Alternatively, you can create a new custom Criteria:

new Criteria("my script")