Skip to Content
Security and networkingPolicy

Create a Policy

POST
/apis/funcd.io/v1alpha1/namespaces/{namespace}/policies

Authorization

headerAuthorizationBearer <token>

A credential of funcd's config, sent as Authorization: Bearer followed by its token.

Path Parameters

namespace*string

The object's namespace.

Match^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$
Length1 <= length <= 63

Query Parameters

dryRun?boolean

Admit the write and store nothing.

Request Body

application/json
  1. body
apiVersion*string
kind*string
metadata*
spec*

Response Body

OK

application/json
  1. response
apiVersion*string
kind*string
metadata*
spec*
Example Request
curl -X POST 'https://example.com/apis/funcd.io/v1alpha1/namespaces/string/policies' \  -H 'Content-Type: application/json' \  -d '{  "apiVersion": "string",  "kind": "string",  "metadata": {},  "spec": {    "cedar": "string"  }}'
Example Response
{  "apiVersion": "string",  "kind": "string",  "metadata": {    "creationTimestamp": "2019-08-24T14:15:22Z",    "deletionTimestamp": "2019-08-24T14:15:22Z",    "finalizers": [      "string"    ],    "generateName": "string",    "generation": 0,    "name": "string",    "namespace": "string",    "ownerReferences": [      {        "blockOwnerDeletion": true,        "controller": true,        "kind": "string",        "name": "string",        "namespace": "string",        "uid": "string"      }    ],    "resourceGroup": "string",    "resourceVersion": "string",    "tags": {      "property1": "string",      "property2": "string"    },    "uid": "string"  },  "spec": {    "cedar": "string"  }}

Answers

StatusProblem typeWhenWhat to do
200OK
400urn:funcd:problem:invalidA field breaks a rule that the schema cannot hold, which the detail names.Correct the field that the detail names.
400urn:funcd:problem:invalidThe body's metadata.namespace is not the namespace of the path.Send the object to the path of its own namespace.
400about:blankThe body is missing or is not JSON.Send a JSON body.
400urn:funcd:problem:invalidThe text in spec.cedar does not parse as Cedar, or holds no statement.Correct the text where the detail says it breaks, and keep at least one permit or forbid statement.
400urn:funcd:problem:invalidA statement of spec.cedar does not name exactly one action that funcd knows, or names an entity of a type that funcd does not know.Name exactly one action that funcd knows, such as kv::read, and only entity types that it knows; when the detail names an unknown action or entity type, it lists the ones that funcd knows.
400urn:funcd:problem:invalidA statement of spec.cedar names an entity of another namespace: its id does not begin with the Policy's namespace and a slash.Name only entities of the Policy's namespace, or apply the Policy in the namespace of the entities it names.
401urn:funcd:problem:unauthorizedThe request carries no bearer token or API key, or one that funcd does not know.Send a credential of funcd's config as a bearer token in the Authorization header, or in X-Api-Key.
403urn:funcd:problem:forbiddenThe credential's role or namespaces do not allow it to create a Policy in the namespace.Use a credential whose role allows it, such as a developer of the namespace or an admin.
409urn:funcd:problem:conflictA Policy of that name already exists in the namespace.Choose another name, or replace the existing Policy.
413urn:funcd:problem:payload-too-largeThe body is larger than 1 MiB.Send a smaller body.
415about:blankThe Content-Type of the body is not JSON.Send the body as application/json.
422about:blankThe query holds a parameter that the operation does not take.Send only the parameters that the operation lists.
422about:blankThe dryRun parameter is neither true nor false.Send dryRun=true, or leave it out.
422about:blankThe namespace in the path is not a DNS-1123 label.Use at most 63 lowercase letters, digits and hyphens, starting and ending with a letter or a digit.
422about:blankThe body breaks the schema: a field that it does not know, of the wrong type or past its limits.Correct the field at the location that the detail gives.