Reference

Brown Out Policy

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

Paid Add On

This policy is only available as a paid add-on. If you would like to try this please reach out to us: sales@zuplo.com

Configuration

The configuration shows how to configure the policy in the 'policies.json' document.

{ "name": "my-brownout-inbound-policy", "policyType": "brownout-inbound", "handler": { "export": "BrownOutInboundPolicy", "module": "$import(@zuplo/runtime)", "options": { "problem": { "detail": "This is a temporary brownout to alert of an upcoming deprecation.", "status": "400", "title": "Deprecation Test", "type": "https://example.com/problems/deprecation-announcement" } } } }

Policy Configuration

  • name <string> - The name of your policy instance. This is used as a reference in your routes.
  • policyType <string> - The identifier of the policy. This is used by the Zuplo UI. Value should be brownout-inbound.
  • handler.export <string> - The name of the exported type. Value should be BrownOutInboundPolicy.
  • handler.module <string> - The module containing the policy. Value should be $import(@zuplo/runtime).
  • handler.options <object> - The options for this policy. See Policy Options below.

Policy Options

The options for this policy are specified below. All properties are optional unless specifically marked as required.

  • cronSchedule <string | array> (Required) -
    The cron schedule for when this policy is enabled. This can be a single cron string or an array of multiple cron strings.
  • problem <object> -
    The problem that is returned in the response body when this policy is enabled.
    • type <string> -
      The type of problem.
    • title <string> -
      The title of problem.
    • detail <string> -
      The detail of problem.
    • status <number> -
      Http status code of the problem.

Using the Policy

Read more about how policies work

Previous
Composite Inbound (Group Policies)