Create or replace a stored policy (`policy`).
PUT
/v1/policies/{name}
const url = 'https://ferritor.example.internal:7070/v1/policies/example';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"actions":["read"],"all_paths":true,"description":"example","expected_version":1,"identity":"example","paths":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://ferritor.example.internal:7070/v1/policies/example \ --header 'Content-Type: application/json' \ --data '{ "actions": [ "read" ], "all_paths": true, "description": "example", "expected_version": 1, "identity": "example", "paths": [ "example" ] }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”name
required
string
A stored policy’s name (secret-path rules, may contain /), or config:… for a config rule.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
A stored policy to create or replace; its name is the path’s.
object
actions
required
Array<string>
all_paths
boolean
description
What it’s for (printable ASCII, newlines and tabs; at most 1 KiB).
string
expected_version
Check-and-set: 0 only creates; N only replaces version N.
integer | null format: int32
identity
required
The <name> of a ferritor://<name> identity, or <prefix>/* for
every identity below the prefix.
string
paths
Path prefixes, whole segments; exactly one of paths and
all_paths.
Array<string>
Responses
Section titled “Responses”Stored.
Media typeapplication/json
object
created
required
False: it replaced an existing policy.
boolean
revision
required
The stored set’s revision now.
integer format: int64
version
required
integer format: int32
Example generated
{ "created": true, "revision": 1, "version": 1}default
Section titled “default”An error: see error.code.
Media typeapplication/json
Every error’s body.
object
error
required
object
code
required
Match on this, never on the message.
string
message
required
For people; may change.
string
Example
{ "error": { "code": "invalid_argument" }}