Skip to content
PlatformMarkdown

Realms and sub-realms

Create a realm for a team, a partner or a customer beneath your own, with its own administrator, and suspend, reactivate or delete it.

AvailableAPI

A realm is one organization’s own: its users, groups, apps, keys, policies and settings, walled off from every other realm. Realms nest. Beneath your realm you can create realms for a business unit, a partner or a customer of yours, and beneath those, more. You administer every realm below your own, and none above or beside it.

You’d create a sub-realm when a group of users should have its own sign-in, its own apps and its own administrators, while you keep oversight. The new realm’s administrators run it, and can create realms of their own beneath it.

  • Privilege: RealmOwner in your realm, or any privilege that gives DELEGATE over it. Every call on this page is made from the parent: you create, suspend and delete a realm as an administrator of the realm above it.
  • Where: the API, https://foobar.cvyuh.com/api/v0/am/global/realms/v1.
  • First: a session in $CVYUH_SESSION (Call the API), and the name and host names you want for the new realm.

A new realm is made in the background: its signing and storage keys, its settings, its sign-in chains, its first administrator and its host names. It moves through these states:

statusWhat it means
creatingBeing set up. Usually seconds
failedSetup stopped partway; resume it to carry on where it left off
activeServing sign-ins and tokens
suspendedSwitched off, its host names kept. Nothing in it answers until you activate it again
deletedOut of service. Its host names are freed for other realms

Each realm has an id that never changes, and you address a realm by it on the realms API.

Its first administrator. Give a password when you create the realm, and it’s born with one administrator: the user admin@<name>, in the group <name>_admins, which holds the realm’s RealmOwner. For the realm engineering, that’s admin@engineering in engineering_admins. Without a password, the realm has no administrator of its own, and only you and the administrators above it can run it.

Create the realm, naming its parent by the path the realms list shows for it:

Terminal window
curl -i https://foobar.cvyuh.com/api/v0/am/global/realms/v1 \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "name": "engineering", "parentPath": "/foobar",
"hostnames": ["foobar-engineering.cvyuh.com"],
"password": "<a strong first password>", "mailId": "maya@example.com" }'

The realm answers 202 Accepted, with the new realm’s id, a Location to poll, and its revision in ETag. Poll it until status is active:

Terminal window
curl https://foobar.cvyuh.com/api/v0/am/global/realms/v1/<realm id> \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

If it shows failed, with a code and reason, resume it. Send the administrator’s password again if the realm hadn’t yet made its first administrator; otherwise send {}:

Terminal window
curl -X POST https://foobar.cvyuh.com/api/v0/am/global/realms/v1/<realm id>/resume \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "password": "<a strong first password>" }'

To suspend or reactivate a realm, send its new status:

Terminal window
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/global/realms/v1/<realm id> \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "status": "suspended" }'

To delete it, name the revision you expect. The realm answers 200 with { "status": "deleted", "path": … }:

Terminal window
curl -X DELETE https://foobar.cvyuh.com/api/v0/am/global/realms/v1/<realm id> \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H 'If-Match: "<rev>"'

A deleted realm answers nothing at once: no sign-in, no token, no admin call. Its host names are freed for other realms. The realms list still shows it, with status deleted, its deleteTime, and purged.

Its data, keys and audit trail are kept, unreadable to anyone, until the realm is purged. Nothing purges a realm on a timer: Cvyūh purges one only when you ask, through your Cvyūh support contact. A purge destroys the realm’s records and keys together. By default it keeps the realm’s audit trail, so you can still answer for what happened in it; ask for the audit trail to be purged too if you want nothing kept. A realm is purged only after every realm beneath it.

AnswerCauseWhat to do
403, “admin of the parent realm required”You don’t hold DELEGATE over the parentAct from a realm above, or ask for RealmOwner there
403, “sub-realms are not turned on for …”Your realm doesn’t include sub-realmsAsk Cvyūh to turn them on
400, naming a nesting limitThe parent has as many realms directly beneath it as it may, or the new realm would sit too deepCreate it elsewhere, or ask Cvyūh to raise the limit
400, “a realm holds at most 3 hostnames”More host names than the realm may holdSend fewer; see Host names
400 on suspend or deleteIt’s the realm you’re signed in toAct from a realm above
400 on createA products list, or a name that isn’t a DNS label, or the reserved name mtlsLeave products out; fix the name
409 on createA realm of that name already sits beneath this parent, or a host name is held by another realmChoose another name or host name
409 on suspend or deleteLive realms sit beneath itAdd ?subrealms=true to apply the change to all of them
400 on activate, “parent realm … is not active”Its parent is suspendedActivate the parent first
428 on deleteNo If-MatchSend If-Match: "<rev>", or If-Match: *
412 on deleteThe realm changed since you read its revRead it again and retry

A user of a suspended or deleted realm sees the realm’s host name stop answering: sign-in pages don’t load, and apps’ token requests fail. Their sessions stop working at once, and those of a suspended realm work again once it’s active.

WhatDefaultCan it change
Realms directly beneath a realmNo limitCvyūh can set a limit per realm, on request
Levels of realms beneath a realmNo limitCvyūh can set a limit per realm, on request
Host names per realm3Cvyūh raises it on request
A realm’s name1 to 63 characters, a–z, 0–9 and -No
A deleted realm’s dataKept until purgedPurged when you ask

Every limit is also in Limits.

  • The realm stays creating. Setup usually takes seconds. If it’s still creating after a minute, read it again: a failed status with a code and reason says which step stopped. Resume it; don’t create it again, which is refused while the first one holds its name.
  • Resume asks for a password. The realm stopped before it made its first administrator. Send the password again in the resume.
  • The new administrator can’t sign in. Use the new realm’s own host name, not yours, and the user name admin@<name>.
  • A realm you suspended still answers somewhere. A realm served from more than one site takes up to about a minute to stop at every site.

Each create, host-name change, suspension, reactivation and deletion is recorded on the realm’s audit trail, naming who made it and the realm’s state before: CREATED, UPDATED, SUSPENDED, ACTIVATED and DELETED. No API returns these records yet; ask Cvyūh support for them. The realms list shows when each deleted realm was deleted.

  • The list shows what’s yours. GET https://foobar.cvyuh.com/api/v0/am/global/realms/v1 lists your realm and every realm beneath it, deleted ones included, and nothing else. It pages, filters and sorts like any other list: see Call the API. Filter on status to leave deleted realms out.
  • Names are unique among siblings. The name mtls is reserved.
  • Suspending stops a realm at once. Its host names no longer answer, so no one can sign in or get a token, and its users’ sessions stop working. Nothing is deleted: activating it brings it all back.
  • Realms beneath come along only if you say so, with ?subrealms=true.
  • If-Match: * deletes whatever the current revision.
  • Every realm holds every product you have. Choosing products per realm is planned.
FieldWhat it is
nameRequired. A lowercase DNS label: a–z, 0–9 and -, 1 to 63 characters, not starting or ending with -
parentPathThe realm it goes beneath, by the path the realms list shows for it
hostnamesThe host names it answers on. Without any, it gets one of its own under cvyuh.com. See Host names
password, mailIdThe password and email address of its first administrator

The answer gives id, name, path, parentPath, status, hostnames, rev, createTime and products; while it’s being made or once it has failed, progress, code and reason; and for a deleted realm in the list, deleteTime and purged.