Skip to Content
kosemdocs
ReferenceAPIPolicies

Update policy in project

Changes a policy of an organization or a project. The body is a JSON merge patch (RFC 7396), sent as application/merge-patch+json: `spec` left out keeps the policy, null unsets it, and an object changes it, a field at a time. An organization's policy binds every one of its projects; a project's that is looser than its organization's is kept, and has no effect while the organization's is stricter. With If-Match, the update fails with failed_precondition, as 412, if the policy changed since it was read.

PATCH
/v1/projects/{project}/policies/{constraint}

Changes a policy of an organization or a project.

The body is a JSON merge patch (RFC 7396), sent as application/merge-patch+json: spec left out keeps the policy, null unsets it, and an object changes it, a field at a time. An organization's policy binds every one of its projects; a project's that is looser than its organization's is kept, and has no effect while the organization's is stricter. With If-Match, the update fails with failed_precondition, as 412, if the policy changed since it was read.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

project*string

The project's ID.

Match^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$
constraint*string

The constraint's ID, such as environments.maxDiskGib.

Match^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)+$

Header Parameters

If-Match?string

The ETag of the policy as it was read: the update fails with failed_precondition, as 412, if it changed since.

Request Body

application/merge-patch+json
  1. body
spec?|

Changes to what this level sets, which sets a policy if none is set, or null to unset it, so that what the level above makes apply applies. A spec left with nothing set, such as enforced set to false, unsets it too.

Response Body

OK

application/json
  1. response
constraint*string

The constraint's ID, such as environments.maxDiskGib.

effective*

What the level above makes apply: for a project, its organization's effective policy; for an organization, its plan limit when lower than kosem's limit, else kosem's default.

inherited*

What the level above makes apply: for a project, its organization's effective policy; for an organization, its plan limit when lower than kosem's limit, else kosem's default.

name*string

Resource name, organizations/{organization_id}/policies/{constraint_id} or projects/{project_id}/policies/{constraint_id}.

spec?

What this level sets; absent while unset, where what the level above makes apply applies.

updateTime?string

When this level's policy last changed; absent if it never did.

Formatdate-time
Example Request
curl -X PATCH 'https://api.kosem.ai/v1/projects/string/policies/string' \
  -H 'Content-Type: application/merge-patch+json' \
  -d '{}'
Example Response
{
  "constraint": "string",
  "effective": {
    "allowedValues": [
      "string"
    ],
    "enforced": true,
    "max": 0,
    "requiredPlan": "PRO",
    "source": "organization"
  },
  "inherited": {
    "allowedValues": [
      "string"
    ],
    "enforced": true,
    "max": 0,
    "requiredPlan": "PRO",
    "source": "organization"
  },
  "name": "string",
  "spec": {
    "allowedValues": [
      "string"
    ],
    "enforced": true,
    "max": 0
  },
  "updateTime": "2019-08-24T14:15:22Z"
}