Chelabase
ManagementFunctions

Enable, disable, roll back, or set the auth or run-as role on the branch

PATCH
/v1/databases/{id}/branches/{branch_id}/functions/{name}

Applies the named fields in this order: active_deployment_id, enabled, auth, run_as_role. The run-as role is checked first (as for a secret key: you must be able to use the role; BYPASSRLS needs Admin), before anything is written.

Authorization

bearer
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
branch_id*string

Branch id

Formatuuid
name*string

Function name

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

active_deployment_id?|

Makes one of the function's deployments the active one (a rollback, or a deploy made with activate: false).

Formatuuid
auth?|null
enabled?|

Turns the function on or off on the branch.

rotate_signing_secret?|

A service only: true makes a new signing secret (in this answer only; the old one stops working). Needs a tenant admin.

run_as_role?|

The role the function runs as: a function-managed secret key for it is made (and the previous one revoked); null clears both. A role with BYPASSRLS needs Admin.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/databases/497f6eca-6276-4993-bfeb-53cbbbba6f08/branches/497f6eca-6276-4993-bfeb-53cbbbba6f08/functions/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "auth": "key",  "created_at": "2019-08-24T14:15:22Z",  "deployment_id": "6ef0ac85-9892-4664-a2a5-58bf2af5a8a6",  "enabled": true,  "health": "healthy",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "kind": "function",  "last_error": "string",  "name": "string",  "rollout": {    "deployment_id": "6ef0ac85-9892-4664-a2a5-58bf2af5a8a6",    "error": "string",    "started_at": "2019-08-24T14:15:22Z",    "state": "pending"  },  "run_as_active": true,  "run_as_role": "string",  "signing_secret": "string",  "updated_at": "2019-08-24T14:15:22Z"}