Client Controller API client for kdb Insights Enterprise.¶
Use ClientController to enrol and remove clients from the kdb Insights Enterprise Client Controller service.
Example
from kxi.publish.client_controller import ClientController, Client, Topics
cc = ClientController(host="https://<host>")
# Define a client with custom topics
client = Client(
name="my-app",
topics=Topics(insert="my-insert-topic", subscribe="my-sub-topic"),
)
# Enrol the client
result = cc.enrol(client)
print(result["config_url"])
# List enrolled client names (requires the Administrator role)
print(cc.list_clients())
# Remove the client when done
cc.leave(client)
Classes:
- Client – Client registration payload for the Client Controller.
- ClientController – REST client for the kdb Insights Enterprise Client Controller.
- Topics – RT topic configuration for a client.
Client¶
Bases: BaseModel
Client registration payload for the Client Controller.
Attributes:
- name (
str) – Unique client name used to identify it in the controller. - topics (
Topics) – RT topic configuration for this client.
ClientController¶
Bases: ApiClient
REST client for the kdb Insights Enterprise Client Controller.
Manages client enrolment and removal via the /clientcontroller
service path.
Example
from kxi.publish.client_controller import ClientController, Client
cc = ClientController(host="https://<host>")
client = Client(name="my-app")
result = cc.enrol(client)
print(result["config_url"])
cc.leave(client)
See Connection Parameters for shared constructor arguments.
Functions:
- alive – Check whether the Client Controller service is alive.
- enrol – Enrol a client with the Client Controller.
- id_to_url – Build the Information Service URL for an enrolled client's config.
- leave – Remove an enrolled client from the Client Controller.
- list_clients – List the names of the enrolled clients.
alive¶
alive()
Check whether the Client Controller service is alive.
Returns:
enrol¶
enrol(client, force=False)
Enrol a client with the Client Controller.
Parameters:
- client (
Client) – Client definition to enrol. - force (
bool) – IfTrue, remove and re-enrol the client when it already exists. Default:False.
Returns:
dict[str, str]– Enrolment response dict containingconfig_urlwith the fulldict[str, str]– Information Service URL for the enrolled client.
Raises:
ConflictError– Client already enrolled andforceisFalse.ClientEnrolError– Enrolment request returned a non-success status.
id_to_url¶
id_to_url(config_id)
Build the Information Service URL for an enrolled client's config.
Parameters:
- config_id (
str) – Config ID from the enrolment responseurlfield.
Returns:
- – Full URL pointing to the Information Service details endpoint for
- – the given config ID.
leave¶
leave(client)
Remove an enrolled client from the Client Controller.
Parameters:
Returns:
dict– API response for the leave operation.
Raises:
NotExistError– The client is not currently enrolled.
list_clients¶
list_clients()
List the names of the enrolled clients.
Only client names are returned. Client IDs are secrets and are never exposed.
Requires the insights.client.list role, which is part of the Administrator
bundled role.
Returns:
Raises:
ForbiddenError– The caller lacks theinsights.client.listrole.
Topics¶
Bases: BaseModel
RT topic configuration for a client.
Attributes: