Base handler

Base handler

Module realize base class for all handlers.

class luna_backport4.app.handlers.base_handler.APIProxyBaseHandler(request)[source]

Class for proxy handlers to luna-api

static loadMarshmallowFromJson(data, schema)[source]

Deserialize an input dictionary to an application-level data structure.

Parameters:
  • data – input json
  • schema – marshmallow schema
Returns:

application-level data structure.

Raises:

VLException(Error.InvalidInputJson, 400, isCriticalError=False) – if validation is failed

Return type:

Any

serviceAddress

Get a image store service address :returns: a image store service address

Return type:ServiceAddressSettings
serviceTimeouts

Get a image store service timeouts :returns: a image store service timeouts

Return type:ServiceTimeoutsSettings
class luna_backport4.app.handlers.base_handler.BaseProxyHandler(request)[source]

Base proxy handler for other handlers.

convertIncomingUrls(response)[source]

Convert service URLs to output JSON and update Location in handler :returns: output JSON with converted service URLs

Return type:Dict[str, str]
prepareRequestCreation()[source]

Add account id to root json for creating some objects :returns: proxy request

Raises:VLException(Error.BadContentType) – if request has incorrect content type
Return type:ProxyRequest
class luna_backport4.app.handlers.base_handler.BaseRequestHandler(request)[source]

Base handler for other handlers.

lunaApiClient

luna3.client.Client – luna3 client

accountId

str – account id

app

Get running app :returns: app

Return type:BP4App
config

Get app config :returns: app config

Return type:SettingsBackport4
options(**kwargs)[source]

Default ‘options’ method

Return type:HTTPResponse
class luna_backport4.app.handlers.base_handler.EventProxyBaseHandler(request)[source]

Base handler for events’ response.

adoptEvent(event)[source]
Prepare provided event:
remove platform 5 special fields adopt renamed fields
Parameters:event – event to change
Return type:None
postProcessingDefault(response)[source]

Default post processing response from the service :param response: response

Returns:response in api format
Return type:HTTPResponse
postProcessingFailedRequest(response)[source]

Post processing failed response from the service :param response: response

Returns:response in api format
Return type:HTTPResponse
prepareQuery()[source]

Prepare queries for a proxy request

Returns:dict with queries
Return type:Dict[str, str]
prepareTargets()[source]

Prepare targets for the further request.

Returns:new “target” as str
Return type:str
targetsQueryParam

Load “target” query param.

Returns:targets
Return type:Union[None, List[str]]
class luna_backport4.app.handlers.base_handler.FacesProxyBaseHandler(request)[source]

Class for proxy handlers to faces

serviceAddress

Get a image store service address :returns: a image store service address

Return type:ServiceAddressSettings
serviceTimeouts

Get a image store service timeouts :returns: a image store service timeouts

Return type:ServiceTimeoutsSettings