Chelabase
ManagementBranches

Protect or unprotect a branch, or switch its login-role guard

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

Sets the branch's protected flag and its guard_logins switch (at least one of them). A protected branch can't be deleted or reset to its parent, and its database can't be deleted, until it is unprotected. Restore still works. Only normal branches can be protected, main included. Protecting runs the branch's review (getBranchReview) on its running compute: when the review lists anything, review_hash must be its current hash (else 409 review_changed with the current review), and the review is stored as acknowledged. On a protected branch with guard_logins on, login roles other than the owner, member logins and the branch's guard exemptions can't change the schema. Every change reconciles the branch's member roles and its guard.

Authorization

bearer
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Database id

Formatuuid
branch_id*string

Branch id

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

At least one of protected and guard_logins; review_hash only with protected: true.

guard_logins?|

The "guard login roles" switch (see the branch's guard_logins).

protected?|

true refuses deleting the branch, resetting it to its parent and deleting its database; restore still works. Protecting runs the branch's review (it needs a running compute) and needs review_hash when the review lists anything.

review_hash?|

The hash of the review (getBranchReview) the caller saw; stored as acknowledged.

Response Body

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" \  -H "Content-Type: application/json" \  -d '{}'
{  "branched_at_lsn": "string",  "branched_at_time": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "error": "string",  "guard_logins": true,  "history_start": "2019-08-24T14:15:22Z",  "host": "string",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "kind": "normal",  "main_database_missing": true,  "name": "string",  "parent_branch_id": "3db5a2a4-2ef3-448e-8466-d96ce9d42581",  "port": 0,  "protected": true,  "review_acknowledged_hash": "string",  "status": "pending"}