The resource gateway¶
xratu get, xratu describe and xratu create are one command each, for many
kinds of resource. The resource gateway is what turns a kind and some names
into a specific endpoint call. This page is how that resolution works, so a
command that resolves somewhere unexpected can be read rather than guessed at.
The gateway¶
flowchart LR
subgraph CL["YOUR MACHINE, THE CLI"]
direction TB
CMD["xratu get project orders 1.2.0"]
CTX[("Active context<br/>workspace")]
GW{{"Resource gateway<br/>kind, arity, route plan"}}
CAT[("Endpoint catalog")]
CMD --> GW
CTX -->|"scope"| GW
GW -->|"endpoint key"| CAT
end
subgraph CP["CONTROL PLANE"]
direction TB
OAS[("OpenAPI document")]
RT["API server route"]
end
CAT -->|"call, UUIDs only"| RT
OAS -.->|"generated and validated in CI"| CAT
The gateway runs on your machine, and it reads two things there: the command you typed and the active context. A command that resolves somewhere unexpected is explained by one of those two inputs, because the catalog it looks up is generated from the server's own routes.
The gateway owns four operations: executing get, describe and create, and
summarising a get response for display.
Arity selects the endpoint¶
The number of names decides which endpoint a kind resolves to. For a versioned resource, two names mean one object and fewer means a listing:
xratu get project projects.list
xratu get project orders projects.list, filtered to orders
xratu get project orders 1.2.0 projects.get
Where a version is optional, the gateway resolves the latest by listing the
versions for that name and taking the highest. A name with no versions is
refused with no project versions found for <name> rather than falling back to
an unversioned read.
A kind that requires an argument says so when it is missing, naming what it needs:
Scope comes from context, not from the command¶
The workspace is taken from the active context and supplied as a path parameter. This is why the same command resolves differently on two machines: the kind and the names are identical, and the scope is not. See The name/UUID boundary across planes.
The canonical grammar is command-first¶
Some resources are reached through their own command rather than through the
generic verb, and the gateway refuses the generic form rather than accepting
both. Models and secrets are the two groups: the canonical forms are
xratu get model builds ... and xratu secret ....
One canonical path per resource keeps the endpoint catalog checkable against the CLI. A resource with two accepted spellings would need two paths kept in step, and one of them would drift.
The endpoint catalog is the shared surface¶
The gateway names an endpoint key rather than a URL. Keys resolve through the catalog, which is generated and validated from the API server's OpenAPI document in CI, so a key the gateway names is a route that exists.
That makes the three surfaces one: the route in the API server, the key in the catalog, and the command in the CLI. See The API server.