Skip to main content

io.enterpriseai.resources.QuotasClient

Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/resources/QuotasClient.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 QuotasClient​

Quotas, reservations (reserve, commit, release) and usage.

Constructor QuotasClient​

QuotasClient(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.

QuotasClient.commit​

JsonNode commit(String id, Object body)

Commit a reservation. Replaces the reserved amount by the measured one on every quota window of the reservation and checks the alert thresholds. A closed reservation answers 409 reservation_closed; an unknown one 404 reservation_not_found. Audited. Requires finops, tenant_admin, agent or developer, and a tenant principal.

Route: /v1/quotas/{reservation_id}/commit (POST).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the reservation returned by POST /v1/quotas/reserve.
bodyObjectyesMeasured cost and tokens of the call.

Returns: JsonNode. Decoded JSON answer of the operation "Commit a reservation".

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

QuotasClient.commit​

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

Commit a reservation. Replaces the reserved amount by the measured one on every quota window of the reservation and checks the alert thresholds. A closed reservation answers 409 reservation_closed; an unknown one 404 reservation_not_found. Audited. Requires finops, tenant_admin, agent or developer, and a tenant principal.

Route: /v1/quotas/{reservation_id}/commit (POST).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the reservation returned by POST /v1/quotas/reserve.
bodyObjectyesMeasured cost and tokens of the call.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Commit a reservation".

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

QuotasClient.create​

JsonNode create(Object body)

Create a quota. Creates a quota of the tenant and answers 201. A cost or token limit is required, and scope_value is required unless scope_type is tenant (422 validation_error). Without currency, the tenant currency applies. Audited. Requires finops or tenant_admin, and a tenant principal.

Route: /v1/quotas (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesThe new quota.

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

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

QuotasClient.create​

JsonNode create(Object body, RequestOptions options)

Create a quota. Creates a quota of the tenant and answers 201. A cost or token limit is required, and scope_value is required unless scope_type is tenant (422 validation_error). Without currency, the tenant currency applies. Audited. Requires finops or tenant_admin, and a tenant principal.

Route: /v1/quotas (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesThe new quota.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

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

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

QuotasClient.delete​

void delete(String id)

Delete a quota. Deletes a quota of the tenant and answers 204. Unknown id: 404 quota_not_found. Audited (finops.quota.delete). Requires finops or tenant_admin.

Route: /v1/quotas/{quota_id} (DELETE).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the quota.

Returns: void.

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

QuotasClient.list​

Page<JsonNode> list()

List the quotas. Quotas of the tenant by name, including those mirrored from the LLM projects (llm-project:...). One page only. Requires a reader role and a tenant principal.

Route: /v1/quotas (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).

QuotasClient.release​

JsonNode release(String id)

Release a reservation. Gives the reserved amount back to every quota window of the reservation without consuming anything (the call failed or was not made). A closed reservation answers 409 reservation_closed; an unknown one 404 reservation_not_found. Audited. Requires finops, tenant_admin, agent or developer, and a tenant principal.

Route: /v1/quotas/{reservation_id}/release (POST).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the reservation.

Returns: JsonNode. Decoded JSON answer of the operation "Release a reservation".

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

QuotasClient.release​

JsonNode release(String id, RequestOptions options)

Release a reservation. Gives the reserved amount back to every quota window of the reservation without consuming anything (the call failed or was not made). A closed reservation answers 409 reservation_closed; an unknown one 404 reservation_not_found. Audited. Requires finops, tenant_admin, agent or developer, and a tenant principal.

Route: /v1/quotas/{reservation_id}/release (POST).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the reservation.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Release a reservation".

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

QuotasClient.replace​

JsonNode replace(String id, Object body)

Replace a quota. Replaces every field of a quota (same rules as on creation; without currency, the current one is kept). Unknown id: 404 quota_not_found. Audited. Requires finops or tenant_admin, and a tenant principal.

Route: /v1/quotas/{quota_id} (PUT).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the quota.
bodyObjectyesThe complete quota.

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

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

QuotasClient.replace​

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

Replace a quota. Replaces every field of a quota (same rules as on creation; without currency, the current one is kept). Unknown id: 404 quota_not_found. Audited. Requires finops or tenant_admin, and a tenant principal.

Route: /v1/quotas/{quota_id} (PUT).

NameTypeDefaultRequiredDescription
idStringyesIdentifier (UUID) of the quota.
bodyObjectyesThe complete quota.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

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

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

QuotasClient.reserve​

Reservation reserve(Object request)

Reserve cost and tokens. Reserves an amount on every enabled quota matching the scope (tenant quotas always match; a user principal adds its own user scope) and answers 201 with the reservation, its items per quota and window, the soft quotas exceeded and its expiry. A hard quota that would be exceeded answers 429 quota_exceeded with Retry-After: 60, and nothing is reserved. Expired reservations are released first. Audited. Requires finops, tenant_admin, agent or developer, and a tenant principal.

Route: /v1/quotas/reserve (POST).

NameTypeDefaultRequiredDescription
requestObjectyesAmount, scope and lifetime of the reservation.

Returns: Reservation. A Reservation: Quota reservation from POST /v1/quotas/reserve. Use it with try-with-resources:

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

QuotasClient.reserveRaw​

JsonNode reserveRaw(Object body)

Reserve cost and tokens. Reserves an amount on every enabled quota matching the scope (tenant quotas always match; a user principal adds its own user scope) and answers 201 with the reservation, its items per quota and window, the soft quotas exceeded and its expiry. A hard quota that would be exceeded answers 429 quota_exceeded with Retry-After: 60, and nothing is reserved. Expired reservations are released first. Audited. Requires finops, tenant_admin, agent or developer, and a tenant principal.

Route: /v1/quotas/reserve (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesAmount, scope and lifetime of the reservation.

Returns: JsonNode. Decoded JSON answer of the operation "Reserve cost and tokens".

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

QuotasClient.reserveRaw​

JsonNode reserveRaw(Object body, RequestOptions options)

Reserve cost and tokens. Reserves an amount on every enabled quota matching the scope (tenant quotas always match; a user principal adds its own user scope) and answers 201 with the reservation, its items per quota and window, the soft quotas exceeded and its expiry. A hard quota that would be exceeded answers 429 quota_exceeded with Retry-After: 60, and nothing is reserved. Expired reservations are released first. Audited. Requires finops, tenant_admin, agent or developer, and a tenant principal.

Route: /v1/quotas/reserve (POST).

NameTypeDefaultRequiredDescription
bodyObjectyesAmount, scope and lifetime of the reservation.
optionsRequestOptionsyesPer call options (idempotency key, traceparent, headers, abort signal).

Returns: JsonNode. Decoded JSON answer of the operation "Reserve cost and tokens".

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

QuotasClient.usage​

JsonNode usage()

Read the quota consumption. Each quota of the tenant with its current window and the cost and tokens used and reserved in it. Run quotas need run to find their window. Requires a reader role and a tenant principal.

Route: /v1/quotas/usage (GET).

This element takes no parameter.

Returns: JsonNode. Decoded JSON answer of the operation "Read the quota consumption".

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

QuotasClient.usage​

JsonNode usage(Map<String, ?> query)

Read the quota consumption. Each quota of the tenant with its current window and the cost and tokens used and reserved in it. Run quotas need run to find their window. Requires a reader role and a tenant principal.

Route: /v1/quotas/usage (GET).

NameTypeDefaultRequiredDescription
queryMap<String, ?>yesQuery string parameters of the route.

Returns: JsonNode. Decoded JSON answer of the operation "Read the quota consumption".

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