-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
93 additions
and
52 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
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](https://crontab.guru/) 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](https://zuplo.com/blog/2022/05/17/how-to-version-an-api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft-07/schema", | ||
"$id": "http://zuplo.com/schemas/policies/brown-out-inbound.json", | ||
"type": "object", | ||
"title": "Brown Out", | ||
"description": "Set periods of downtime based on cron schedules. Useful for alerting users of impending deprecations.", | ||
"required": ["handler"], | ||
"properties": { | ||
"handler": { | ||
"type": "object", | ||
"default": {}, | ||
"required": ["export", "module", "options"], | ||
"properties": { | ||
"export": { | ||
"const": "BrownOutInbound", | ||
"description": "The name of the exported type" | ||
}, | ||
"module": { | ||
"const": "$import(@zuplo/runtime)", | ||
"description": "The module containing the policy" | ||
}, | ||
"options": { | ||
"type": "object", | ||
"description": "The options for this policy", | ||
"required": ["cronSchedule"], | ||
"properties": { | ||
"cronSchedule": { | ||
"oneOf": [ | ||
{ "type": "string" }, | ||
{ "type": "array", "item": { "type": "string" } } | ||
], | ||
"description": "The cron schedule for when this policy is enabled. This can be a single cron string or an array of multiple cron strings" | ||
}, | ||
"problem": { | ||
"type": "object", | ||
"description": "The problem that is returned in the response body when this policy is enabled", | ||
"additionalProperties": true, | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"description": "The type of problem" | ||
}, | ||
"title": { | ||
"type": "string", | ||
"description": "The title of problem" | ||
}, | ||
"detail": { | ||
"type": "string", | ||
"description": "The detail of problem" | ||
}, | ||
"status": { | ||
"type": "number", | ||
"description": "Http status code of the problem" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"examples": [ | ||
{ | ||
"export": "BrownOutInbound", | ||
"module": "$import(@zuplo/runtime)", | ||
"options": { | ||
"cronSchedule": "0 23 * * *", | ||
"problem": { | ||
"detail": "This endpoint is deprecated and will be removed in the next version" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d23f832
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./
docs.zuplo.site
docs.zuplopreview.net
docs-git-main.zuplopreview.net