Package com.mxraven.admin
Class AdminClient
java.lang.Object
com.mxraven.admin.AdminClient
- All Implemented Interfaces:
AutoCloseable
Client for the mxRaven control-plane v2 REST API.
Construct one with the control-plane base URL and a ZITADEL-issued bearer access token, then reach resource families through the typed accessors:
AdminClient admin = new AdminClient("https://api.mxraven.com", token);
for (Domain domain : admin.workspace("my-workspace").domains().list()) {
System.out.println(domain.domainName() + " " + domain.status());
}
All response timestamps are returned as ISO-8601 strings. Pagination is
cursor-based: pass Page.nextPageToken() back into the same list call.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAdminClient(String token) Construct a client againstDEFAULT_BASE_URL.AdminClient(String token, RateLimitConfig rateLimitConfig) Construct a client againstDEFAULT_BASE_URLwith explicit rate-limit behaviour.AdminClient(String baseUrl, String token) Construct a client against an explicit control-plane base URL.AdminClient(String baseUrl, String token, RateLimitConfig rateLimitConfig) Construct a client with explicit rate-limit behaviour.AdminClient(String baseUrl, String token, RateLimitConfig rateLimitConfig, String apiVersion) Construct a client with explicit rate-limit behaviour and API version.AdminClient(String baseUrl, String token, String apiVersion) Construct a client targeting a specific control-plane API version.AdminClient(String baseUrl, String token, HttpClient http, com.fasterxml.jackson.databind.ObjectMapper json) Construct a client with a custom HTTP client and mapper against an explicit base URL.AdminClient(String token, HttpClient http, com.fasterxml.jackson.databind.ObjectMapper json) Construct a client againstDEFAULT_BASE_URLwith a custom HTTP client and mapper. -
Method Summary
Modifier and TypeMethodDescriptionThe control-plane API version prefix applied to every request path.auth()Public tenant login context; works with a blank token.baseUrl()Returns the control-plane base URL, without a trailing slash.voidclose()Issues a DELETE request.Issues a GET request.Issues a GET request with query parameters.com.fasterxml.jackson.databind.ObjectMapperjson()Returns the mapper used to encode request bodies and decode response bodies.<T> Paged<T>Issue a GET and wrap the response in a lazily auto-paginatingPaged.Issues a POST request with a JSON body.Issues a POST request with query parameters and a JSON body.Issues a PUT request with a JSON body.The client-wide rate-limit behaviour.Send a request to the control plane.Bind a tenant.
-
Field Details
-
DEFAULT_API_VERSION
Default control-plane API version. Every request path is prefixed with"/" + apiVersionin a single place, so clients never hardcode it.- See Also:
-
DEFAULT_BASE_URL
Default mxRaven control-plane base URL. Used by the constructors that omit a base URL; pass an explicit URL to target another environment.- See Also:
-
-
Constructor Details
-
AdminClient
Construct a client againstDEFAULT_BASE_URL.- Parameters:
token- ZITADEL-issued bearer access token
-
AdminClient
Construct a client againstDEFAULT_BASE_URLwith explicit rate-limit behaviour.- Parameters:
token- ZITADEL-issued bearer access tokenrateLimitConfig- client-wide rate-limit behaviour
-
AdminClient
Construct a client againstDEFAULT_BASE_URLwith a custom HTTP client and mapper.- Parameters:
token- ZITADEL-issued bearer access tokenhttp- HTTP client used to send requestsjson- mapper used to encode and decode JSON
-
AdminClient
Construct a client against an explicit control-plane base URL.- Parameters:
baseUrl- control-plane base URL; trailing slashes are strippedtoken- ZITADEL-issued bearer access token
-
AdminClient
Construct a client with explicit rate-limit behaviour.- Parameters:
baseUrl- control-plane base URL; trailing slashes are strippedtoken- ZITADEL-issued bearer access tokenrateLimitConfig- client-wide rate-limit behaviour
-
AdminClient
Construct a client targeting a specific control-plane API version. The version is prepended to every request path (for example"v2"yields/v2/...). PassDEFAULT_API_VERSIONfor the default.- Parameters:
baseUrl- control-plane base URL; trailing slashes are strippedtoken- ZITADEL-issued bearer access tokenapiVersion- API version prefix applied to every request path
-
AdminClient
public AdminClient(String baseUrl, String token, RateLimitConfig rateLimitConfig, String apiVersion) Construct a client with explicit rate-limit behaviour and API version.- Parameters:
baseUrl- control-plane base URL; trailing slashes are strippedtoken- ZITADEL-issued bearer access tokenrateLimitConfig- client-wide rate-limit behaviourapiVersion- API version prefix applied to every request path
-
AdminClient
public AdminClient(String baseUrl, String token, HttpClient http, com.fasterxml.jackson.databind.ObjectMapper json) Construct a client with a custom HTTP client and mapper against an explicit base URL.- Parameters:
baseUrl- control-plane base URL; trailing slashes are strippedtoken- ZITADEL-issued bearer access tokenhttp- HTTP client used to send requestsjson- mapper used to encode and decode JSON
-
-
Method Details
-
baseUrl
Returns the control-plane base URL, without a trailing slash.- Returns:
- the normalized base URL
-
apiVersion
The control-plane API version prefix applied to every request path.- Returns:
- the API version prefix, for example
"v2"
-
json
public com.fasterxml.jackson.databind.ObjectMapper json()Returns the mapper used to encode request bodies and decode response bodies.- Returns:
- the JSON mapper
-
rateLimitConfig
The client-wide rate-limit behaviour.- Returns:
- the rate-limit configuration
-
workspace
Bind a tenant. The returnedWorkspaceexposes every tenant-scoped resource family without repeating the slug.- Parameters:
tenantSlug- tenant slug to bind- Returns:
- a workspace bound to the given tenant
-
auth
Public tenant login context; works with a blank token.- Returns:
- a client for the public authentication family
-
get
Issues a GET request.- Parameters:
path- client-relative path; the configured API version is prepended- Returns:
- the decoded response
- Throws:
IOException- if the request fails or is interrupted
-
get
Issues a GET request with query parameters.- Parameters:
path- client-relative path; the configured API version is prependedquery- query parameters, ornullfor none- Returns:
- the decoded response
- Throws:
IOException- if the request fails or is interrupted
-
post
Issues a POST request with a JSON body.- Parameters:
path- client-relative path; the configured API version is prependedbody- object serialized as the JSON request body- Returns:
- the decoded response
- Throws:
IOException- if the request fails or is interrupted
-
post
Issues a POST request with query parameters and a JSON body.- Parameters:
path- client-relative path; the configured API version is prependedquery- query parameters, ornullfor nonebody- object serialized as the JSON request body- Returns:
- the decoded response
- Throws:
IOException- if the request fails or is interrupted
-
put
Issues a PUT request with a JSON body.- Parameters:
path- client-relative path; the configured API version is prependedbody- object serialized as the JSON request body- Returns:
- the decoded response
- Throws:
IOException- if the request fails or is interrupted
-
delete
Issues a DELETE request.- Parameters:
path- client-relative path; the configured API version is prepended- Returns:
- the decoded response
- Throws:
IOException- if the request fails or is interrupted
-
paged
public <T> Paged<T> paged(String path, Map<String, String> query, Class<T> elementType) throws IOExceptionIssue a GET and wrap the response in a lazily auto-paginatingPaged. Subsequent pages are fetched by re-issuing the same request with the nextpage_token, only as the returned iterator advances.- Type Parameters:
T- element type- Parameters:
path- client-relative path; the configured API version is prependedquery- query parameters, ornullfor noneelementType- type of each item in the collection- Returns:
- a lazily paginating collection over the response items
- Throws:
IOException- if the first page request fails or is interrupted
-
request
public Response request(String method, String path, Map<String, String> query, Object body) throws IOExceptionSend a request to the control plane. A non-success status is decoded as an RFC 9457 problem and thrown asApiException.- Parameters:
method- HTTP method to usepath- client-relative path; the configured API version is prependedquery- query parameters, ornullfor nonebody- request body serialized as JSON, ornullfor no body- Returns:
- the decoded successful response
- Throws:
IOException- if the request fails or is interruptedApiException- if the control plane returns a non-success status
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-