policy_binding: The binding cannot change

Only organisation and team scopes are bound to a budget (a budget is governed by its own budget-scope policy without a binding), and only a scope that was bound at some point can be removed. Binding a scope that is already bound, or removing one already removed, is not an error: it returns 200 with the earlier record. Nothing changed.

What to do

On the wire

HTTP 409, error type state_error. Without Dynamo-Error-Detail: 1 every client receives {"error": "state", "reason": "policy_binding", "detail": "…"} with no errorDetail: the policy routes add it only when the request sends that header, on a single-tenant core and on the hosted tier alike.

With Dynamo-Error-Detail: 1:

{
  "error": "state",
  "reason": "policy_binding",
  "detail": "…",
  "errorDetail": {
    "type": "state_error",
    "code": "policy_binding",
    "message": "…",
    "param": "policy",
    "doc_url": "…/errors/policy_binding.md",
    "fix": "bind organisation or team scopes only, and remove only a binding that exists"
  }
}

See policies and all error codes.