Synadia Protect
Time
Evaluate connections or messages based on a cron schedule. All times are in UTC.
Type: connect, message
Variants:
| Action | Type | ID |
|---|---|---|
| allow | connect | com.synadia.protect.builtins.v1.allow.time.connect |
| allow | message | com.synadia.protect.builtins.v1.allow.time.message |
| deny | connect | com.synadia.protect.builtins.v1.deny.time.connect |
| deny | message | com.synadia.protect.builtins.v1.deny.time.message |
Cron format
minute hour day month weekday
- Ranges:
9-17(9am to 5pm) - Lists:
1,3,5(Monday, Wednesday, Friday) - Wildcards:
*(any value) - Steps:
*/15(every 15 minutes)
Connect configuration
A list of cron expressions:
activations:
com.synadia.protect.builtins.v1.allow.time.connect: true
configurations:
com.synadia.protect.builtins.v1.allow.time.connect:
- '* 9-17 * * 1-5' # 9am-5pm UTC, Monday-Friday
- '* 10-14 * * 0,6' # 10am-2pm UTC, weekends
Message configuration
A list of schedule/subject pairs. The subject pattern scopes which messages the schedule applies to:
activations:
com.synadia.protect.builtins.v1.allow.time.message: true
configurations:
com.synadia.protect.builtins.v1.allow.time.message:
- schedule: '* 9-17 * * 1-5'
subject: 'orders.>'
- schedule: '* 10-14 * * 0,6'
subject: 'weekend.>'
- schedule: '* * * * *' # anytime, all subjects
subject: '>'
Schema (connect)
{
"type": "array",
"items": {
"type": "string",
"format": "cron"
},
"minItems": 1
}
Schema (message)
{
"type": "array",
"items": {
"type": "object",
"properties": {
"schedule": { "type": "string", "format": "cron" },
"subject": { "type": "string", "format": "nats-subject" }
},
"required": ["schedule"]
},
"minItems": 1
}