Skip to main content

io.enterpriseai.resources.RoutesClient

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/resources/RoutesClient.java. Back to the Java SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class RoutesClient​

Model Router rules and fallback chains.

Constructor RoutesClient​

RoutesClient(Transport transport)

Creates the client on the shared transport; EnterpriseAIClient builds it and exposes it through the accessor of the same name.

NameTypeDefaultRequiredDescription
transportTransportyesTransport shared by the sub-clients of one client.

RoutesClient.create​

JsonNode create(Object body)

Create a routing rule. Creates a routing rule of the tenant and answers 201. A platform principal without tenant answers 403 platform_only; an unknown strategy 422 parameter_invalid. Audited (route.create). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/routes (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesname (default default), match (request fields the rule applies to, a value or a list of values), strategy (priority by default, cost, latency, quality), candidates (model ids, or a single target_model), fallbacks, constraints, priority (default 100, lower first), enabled (default true).

Returns: JsonNode. Decoded JSON answer of the operation "Create a routing rule".

Raises: the typed errors of the transport (Errors).

RoutesClient.create​

JsonNode create(Object body, RequestOptions options)

Create a routing rule. Creates a routing rule of the tenant and answers 201. A platform principal without tenant answers 403 platform_only; an unknown strategy 422 parameter_invalid. Audited (route.create). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/routes (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesname (default default), match (request fields the rule applies to, a value or a list of values), strategy (priority by default, cost, latency, quality), candidates (model ids, or a single target_model), fallbacks, constraints, priority (default 100, lower first), enabled (default true).
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Create a routing rule".

Raises: the typed errors of the transport (Errors).

RoutesClient.delete​

void delete(String id)

Delete a routing rule. Deletes a routing rule of the tenant and answers 204. Unknown rule: 404 route_not_found. Audited (route.delete). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/routes/{rid} (DELETE).

NameTypeDefaultRequiredDescription
idStringyesIdentifier of the routing rule.

Returns: void.

Raises: the typed errors of the transport (Errors).

RoutesClient.list​

Page<JsonNode> list()

List the routing rules. Routing rules of the tenant by priority then name, each with its match, strategy, candidates, fallbacks, constraints and target_model (the first candidate). Requires a reader role.

Route: /v1/routes (GET).

This element takes no parameter.

Returns: Page<JsonNode>. A Page: One page of a cursor paginated collection ({"items": [...], "next_cursor": "..."|null}).

Raises: the typed errors of the transport (Errors).

RoutesClient.replace​

JsonNode replace(String id, Object body)

Replace a routing rule. Replaces the match, strategy, candidates, fallbacks, constraints, priority and enabled flag of a rule of the tenant (omitted fields take their default; the name is kept). Unknown rule: 404 route_not_found. Audited (route.update). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/routes/{rid} (PUT).

NameTypeDefaultRequiredDescription
idStringyesIdentifier of the routing rule.
bodyObjectyesThe complete rule: same fields as on creation except name.

Returns: JsonNode. Decoded JSON answer of the operation "Replace a routing rule".

Raises: the typed errors of the transport (Errors).

RoutesClient.replace​

JsonNode replace(String id, Object body, RequestOptions options)

Replace a routing rule. Replaces the match, strategy, candidates, fallbacks, constraints, priority and enabled flag of a rule of the tenant (omitted fields take their default; the name is kept). Unknown rule: 404 route_not_found. Audited (route.update). Requires tenant_admin, platform_admin or ai_platform_engineer.

Route: /v1/routes/{rid} (PUT).

NameTypeDefaultRequiredDescription
idStringyesIdentifier of the routing rule.
bodyObjectyesThe complete rule: same fields as on creation except name.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Replace a routing rule".

Raises: the typed errors of the transport (Errors).

RoutesClient.simulate​

JsonNode simulate(Object body)

Simulate the routing of a request. Shows which model a request would be routed to, without calling it: the rule given by route_id or the first enabled rule that matches, the tenant allow and deny lists (narrowed by the request), the classification and the fallback policy. Answers the selected model, fallbacks, rejected candidates with their reason and the rule used; no eligible model answers 422 no_eligible_model. Restricted models are only allowed for tenant_admin and security_officer with allow_restricted. Requires a reader role.

Route: /v1/routes/simulate (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesRequest to simulate: model, candidates, strategy, purpose, capabilities, data_classification (default internal), region_allow, provider_allow, model_allow, allow_restricted, fallback_policy (default allowed), optional route_id, and any field the rules match on.

Returns: JsonNode. Decoded JSON answer of the operation "Simulate the routing of a request".

Raises: the typed errors of the transport (Errors).

RoutesClient.simulate​

JsonNode simulate(Object body, RequestOptions options)

Simulate the routing of a request. Shows which model a request would be routed to, without calling it: the rule given by route_id or the first enabled rule that matches, the tenant allow and deny lists (narrowed by the request), the classification and the fallback policy. Answers the selected model, fallbacks, rejected candidates with their reason and the rule used; no eligible model answers 422 no_eligible_model. Restricted models are only allowed for tenant_admin and security_officer with allow_restricted. Requires a reader role.

Route: /v1/routes/simulate (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesRequest to simulate: model, candidates, strategy, purpose, capabilities, data_classification (default internal), region_allow, provider_allow, model_allow, allow_restricted, fallback_policy (default allowed), optional route_id, and any field the rules match on.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Simulate the routing of a request".

Raises: the typed errors of the transport (Errors).