Brown Out
The brownout policy allows performing scheduled downtime on your API. This can be useful for helping notify clients of an impending deprecation or for scheduling maintenance.
This policy uses cron schedules to check if a request
should experience a brownout or not. When a request falls into a scheduled
brownout an error response will be return. The error response can be customized
by setting the problem
properties.
For more information using brownouts to alert clients on impending API changes/deprecations see our blog post How to version an API
Configuration
The configuration shows how to configure the policy in the 'policies.json' document.
config/policies.json
{
"name": "my-brownout-inbound-policy",
"policyType": "brownout-inbound",
"handler": {
"export": "BrownOutInbound",
"module": "$import(@zuplo/runtime)",
"options": {
"cronSchedule": "0 23 * * *",
"problem": {
"detail": "This endpoint is deprecated and will be removed in the next version"
}
}
}
}
Read more about how policies work