tlc.service.object_service#
The 3LC Object Service.
Module Contents#
Classes#
Class  | 
Description  | 
|---|---|
Constants for the Starlite state.  | 
|
In-flight representation of a TLCObject.  | 
|
In-flight representation of a patch request for a TLCObject.  | 
|
Controller for all object-related routes  | 
|
Controller for all external data-related routes  | 
|
Custom middleware to log object service requests and responses.  | 
|
Helper class to format output from NGrokHelper for the Object Service.  | 
Functions#
Function  | 
Description  | 
|---|---|
Catch-all for application errors.  | 
|
Setup HTTP client for connecting to 3LC Data Service  | 
|
Perform any required cleanup before terminating the application  | 
|
Root endpoint of the service  | 
|
Returns status of the service  | 
|
Data#
Data  | 
Description  | 
|---|---|
API#
- class tlc.service.object_service.StarliteStateConstants#
 Constants for the Starlite state.
- HOST_IP = HostIP#
 
- OBJECT_SERVICE_RUNNING_URLS = ObjectServiceRunningsURLs#
 
- NGROK_DASHBOARD_URL = NGrokDashboardURL#
 
- NGROK_OBJECT_SERVICE_URL = NGrokObjectServiceURL#
 
- DASHBOARD_URL = DashboardURL#
 
- tlc.service.object_service.internal_server_error_handler(request: starlite.Request, exception: Exception) starlite.Response#
 Catch-all for application errors.
- class tlc.service.object_service.TLCObject#
 Bases:
pydantic.BaseModelIn-flight representation of a TLCObject.
- class tlc.service.object_service.TLCPatchRequest#
 Bases:
pydantic.BaseModelIn-flight representation of a patch request for a TLCObject.
- patch_object: tlc.service.object_service.TLCObject = None#
 
- class tlc.service.object_service.DashboardManager(ngrok_helper_object_service: tlccli.subcommands.ngrok_helper.NGrokHelper | None)#
 
- async tlc.service.object_service.startup(state: starlite.State) None#
 Setup HTTP client for connecting to 3LC Data Service
- async tlc.service.object_service.shutdown() None#
 Perform any required cleanup before terminating the application
- async tlc.service.object_service.root() starlite.Response#
 Root endpoint of the service
- async tlc.service.object_service.status(request: starlite.Request) dict[str, Any]#
 Returns status of the service
- class tlc.service.object_service.ObjectRoutesController(owner: starlite.router.Router)#
 Bases:
starlite.controller.ControllerController for all object-related routes
Initialize a controller.
Should only be called by routers as part of controller registration.
Args: owner: An instance of ‘Router’
- path = /objects#
 
- parameters = None#
 
- async get_encoded_url(api_key: str, encoded_url: str) tlc.service.object_service.TLCObject#
 
- async get_encoded_url_rows(api_key: str, encoded_url: str, attribute: str, request: starlite.Request) starlite.Response[bytes]#
 
- async list_urls(api_key: str) list[str]#
 Return all the objects.
Returns: List[Any]: List of the URLs of all the objects.
- async new_object(api_key: str, data: tlc.service.object_service.TLCObject) starlite.Response#
 Create a new object.
- Parameters:
 data – Object to be created
- Returns:
 Empty response. URL of the created object will be in the ‘Location’ field of the response headers.
- async delete_object(api_key: str, encoded_url: str) None#
 Delete an object.
- Parameters:
 encoded_url – URL of the object to be deleted.
- Raises:
 HTTPException if no object can be found at the URL.
- async update_object(api_key: str, encoded_url: str, data: tlc.service.object_service.TLCPatchRequest) starlite.Response#
 Update the attributes of an object.
Raises: HTTPException: If the object type of
obj_indoes not match the type of the object atobject_url.
- class tlc.service.object_service.ExternalDataRoutesController(owner: starlite.router.Router)#
 Bases:
starlite.controller.ControllerController for all external data-related routes
Initialize a controller.
Should only be called by routers as part of controller registration.
Args: owner: An instance of ‘Router’
- path = /external_data#
 
- parameters = None#
 
- class tlc.service.object_service.TLCCustomLoggingMiddleware(app: starlite.types.asgi_types.ASGIApp, config: starlite.middleware.LoggingMiddlewareConfig)#
 Bases:
starlite.middleware.logging.LoggingMiddlewareCustom middleware to log object service requests and responses.
Logs request and response data to loglevel.INFO, together with the time it takes to complete the request.
Initialize
LoggingMiddleware.Args: app: The
nextASGI app to call. config: An instance of LoggingMiddlewareConfig.- async log_request(scope: starlite.types.asgi_types.Scope, receive: starlite.types.asgi_types.Receive) None#
 Record the start time and log the request data.
- class tlc.service.object_service.NGrokOutputAdaptor(role: str, ngrok_helper: tlccli.subcommands.ngrok_helper.NGrokHelper)#
 Helper class to format output from NGrokHelper for the Object Service.
- tlc.service.object_service.create_starlite_app(host: str, port: int, use_ngrok: bool, after_startup_handler: starlite.types.SingleOrList[starlite.types.LifeSpanHookHandler] | None = None, after_shutdown_handler: starlite.types.SingleOrList[starlite.types.LifeSpanHookHandler] | None = None) starlite.Starlite#