ControlPlaneSession
Control plane tokens for one control plane, refreshed as they expire.
Functions
func__init__(self, api_url, store, timeout=30.0, retries=3, pool_size=20) -> NoneInitialize the session.
paramselfparamapi_urlstrControl plane API base URL.
paramstoreCredentialStoreCredential store holding the token and the API key that renews it.
paramtimeoutfloat= 30.0Request timeout in seconds.
paramretriesint= 3Retry count for failed requests.
parampool_sizeint= 20Connection pool size.
Returns
Nonefuncget_token(self) -> str | NoneReturn a usable control plane token, renewing an expiring one first.
paramselfReturns
str | NoneBearer token, or None when nothing stored can produce one.
funclogin_with_api_key(self, api_key) -> ApiTokenExchange a control plane API key for a control plane token.
paramselfparamapi_keystrControl plane API key.
Returns
kitaru.client.ApiTokenToken issued by the control plane.
funcdevice_login(self, open_browser=True, prompt=None, workspace_id=None) -> ApiTokenAuthorize this machine and return its cached control plane token.
paramselfparamopen_browserbool= TrueparampromptCallable[[ControlPlaneDeviceAuthorization], None] | None= Noneparamworkspace_idstr | None= NoneReturns
kitaru.client.ApiTokenfuncdevice_login_with_metadata(self, open_browser=True, prompt=None, workspace_id=None) -> ControlPlaneTokenAuthorize this machine against the control plane.
The call blocks until a signed-in account completes authorization in a browser, or until the authorization expires.
paramselfparamopen_browserbool= TrueWhether to open the verification page.
parampromptCallable[[ControlPlaneDeviceAuthorization], None] | None= NoneCalled with the authorization so the caller can show the verification URL. Defaults to logging it.
paramworkspace_idstr | None= NoneWorkspace ID preselected on the verification page.
Returns
kitaru.client.control_plane.ControlPlaneTokenControl plane token and workspace selection issued for the device.
funcget_workspace(self, workspace_id, access_token) -> ControlPlaneWorkspaceGet the managed workspace selected during device authorization.
paramselfparamworkspace_iduuid.UUIDSelected workspace ID.
paramaccess_tokenstrControl plane bearer token.
Returns
kitaru.client.control_plane.ControlPlaneWorkspaceManaged workspace connection details.
funcclose(self) -> NoneClose the underlying HTTP client.
paramselfReturns
None