The route-management listener (routes.admin.port, default 4003): the route
table the edge enforces, plus the global IP rules and a dry run that replays
the guard's decision.
The listener performs no authentication of its own — :headers is for
whatever a deployer's boundary (a service mesh, an API gateway) expects in
front of it.
Route ids are percent-encoded as one path segment, so /, ?, # and % in
an id cannot reshape the URL; an id that isn't a string, is empty, or is
./.. is refused with Ankusa.SDK.InvalidRouteIdError before any request is
sent.
Failures carry retryable, so a caller needs one bit to decide whether to try
again or surface the rejection:
| Error | retryable | Cause |
|---|---|---|
Ankusa.SDK.InvalidRouteIdError | false | unusable id, caught before the request |
Ankusa.SDK.RouteNotFoundError | false | 404 |
Ankusa.SDK.RoutesRejectedError | false | any other 4xx |
Ankusa.SDK.RoutesUnavailableError | true | 5xx, a redirect, a non-JSON body, or unreachable |
routes = Ankusa.SDK.Routes.new("http://localhost:4003")
{:ok, page} = Ankusa.SDK.Routes.list_routes(routes, enabled: true, limit: 10)
Summary
Functions
Store a route: POST /admin/routes → the route, timestamps included.
Delete a route: DELETE /admin/routes/{id}.
The global IP rules: GET /admin/ip-rules.
Fetch one route: GET /admin/routes/{id}.
Liveness probe: GET /health → {"status", "routes"}.
A page of route definitions: GET /admin/routes.
Build a client for base_url.
Replace the global IP rules: PUT /admin/ip-rules.
Replace a route: PUT /admin/routes/{id}.
The dry-run decision for one request: POST /admin/routes/test.
Patch a route: PATCH /admin/routes/{id}.
Types
@type t() :: %Ankusa.SDK.Routes{http: term()}
Functions
@spec create_route(t(), map()) :: {:ok, term()} | {:error, Exception.t()}
Store a route: POST /admin/routes → the route, timestamps included.
@spec delete_route(t(), term()) :: :ok | {:error, Exception.t()}
Delete a route: DELETE /admin/routes/{id}.
Returns :ok on 2xx; the body is not parsed (204 carries none).
@spec get_ip_rules(t()) :: {:ok, term()} | {:error, Exception.t()}
The global IP rules: GET /admin/ip-rules.
@spec get_route(t(), term()) :: {:ok, term()} | {:error, Exception.t()}
Fetch one route: GET /admin/routes/{id}.
@spec health(t()) :: {:ok, term()} | {:error, Exception.t()}
Liveness probe: GET /health → {"status", "routes"}.
@spec list_routes(t(), term()) :: {:ok, term()} | {:error, Exception.t()}
A page of route definitions: GET /admin/routes.
params may carry enabled, limit and cursor; nil values are left out
of the query string rather than sent as =.
Build a client for base_url.
Options are :headers (a map or {name, value} list sent on every request),
:timeout_ms (default 10_000, applied to connect and receive — to receive
only with a :finch pool, which owns its connect options), and
:req_options (transport tuning: :finch, :connect_options,
:pool_timeout, :plug; :finch and :connect_options are exclusive).
@spec put_ip_rules(t(), map()) :: {:ok, term()} | {:error, Exception.t()}
Replace the global IP rules: PUT /admin/ip-rules.
@spec replace_route(t(), term(), map()) :: {:ok, term()} | {:error, Exception.t()}
Replace a route: PUT /admin/routes/{id}.
@spec test_route(t(), map()) :: {:ok, term()} | {:error, Exception.t()}
The dry-run decision for one request: POST /admin/routes/test.
Nothing is captured; the response replays what the guard would have decided.
@spec update_route(t(), term(), map()) :: {:ok, term()} | {:error, Exception.t()}
Patch a route: PATCH /admin/routes/{id}.