class documentation

class HttpManagement: (source)

View In Hierarchy

Plugin class to add the Management functionality to the HTTP server.

The management endpoint is registered at "__mgmt__".

The plugin depends on the HttpServer.HttpServer plugin, which is injected into this plugin by the acmecse.runtime.PluginManager.PluginManager. The management endpoint will only be registered if the HttpServer.HttpServer plugin is loaded and the dependency can be resolved.

Method configure Configure the plugin based on the configuration settings.
Method handleManagement Handle a management request. This is used to control the CSE.
Method handleManagementDelete Handle a management request. This is used to delete internal management data in the CSE.
Method handleManagementPost Handle a management request. This is used to control the CSE.
Method handleManagementPut Handle a management request. This is used to update internal management data in the CSE.
Method startManagement Start the management plugin.
Class Variable httpServer The injected HttpServer.HttpServer plugin instance is injected by the acmecse.runtime.PluginManager.PluginManager based on the declared dependency. The plugin will only be loaded if the HttpServer.HttpServer...
Class Variable managementSupport Injected ManagementSupport instance.
Method _getConfig Handle the config command. This is used to provide the current configuration of the CSE.
Method _getCreds Handle the creds command. This is used to provide the current credentials of the CSE.
Method _getHelp Handle the help command. This is used to provide a list of available management commands.
Method _response Create a Flask Response object with the given response data, status code, and mimetype.
def configure(self, config: Configuration): (source)

Configure the plugin based on the configuration settings.

Parameters
config:ConfigurationThe configuration object.
def handleManagement(self, command: str | None = None, param: str | None = None, subparam: str | None = None) -> Response: (source)

Handle a management request. This is used to control the CSE.

Parameters
command:str | NoneThe management command to execute. If None, the request is rejected.
param:str | NoneAn optional parameter for the management command.
subparam:str | NoneAn optional sub-parameter for the management command.
Returns
ResponseA response object.
def handleManagementDelete(self, command: str | None = None, param: str | None = None, subparam: str | None = None) -> Response: (source)

Handle a management request. This is used to delete internal management data in the CSE.

Parameters
command:str | NoneThe management command to execute. If None, the request is rejected.
param:str | NoneAn optional parameter for the management command.
subparam:str | NoneAn optional sub-parameter for the management command.
Returns
ResponseA response object.
def handleManagementPost(self, command: str | None = None, param: str | None = None, subparam: str | None = None) -> Response: (source)

Handle a management request. This is used to control the CSE.

Parameters
command:str | NoneThe management command to execute. If None, the request is rejected.
param:str | NoneAn optional parameter for the management command.
subparam:str | NoneAn optional sub-parameter for the management command.
Returns
ResponseA response object.
def handleManagementPut(self, command: str | None = None, param: str | None = None, subparam: str | None = None) -> Response: (source)

Handle a management request. This is used to update internal management data in the CSE.

Parameters
command:str | NoneThe management command to execute. If None, the request is rejected.
param:str | NoneAn optional parameter for the management command.
subparam:str | NoneAn optional sub-parameter for the management command.
Returns
ResponseA response object.
def startManagement(self): (source)

Start the management plugin.

The injected HttpServer.HttpServer plugin instance is injected by the acmecse.runtime.PluginManager.PluginManager based on the declared dependency. The plugin will only be loaded if the HttpServer.HttpServer plugin is loaded.

managementSupport: ManagementSupport = (source)

Injected ManagementSupport instance.

def _getConfig(self) -> Response: (source)

Handle the config command. This is used to provide the current configuration of the CSE.

Returns
ResponseA response object with the current configuration.
def _getCreds(self, param: str | None = None, subparam: str | None = None) -> Response: (source)

Handle the creds command. This is used to provide the current credentials of the CSE.

Parameters
param:str | NoneAn optional parameter for the management command.
subparam:str | NoneAn optional sub-parameter for the management command.
Returns
ResponseA response object with the current credentials.
def _getHelp(self) -> Response: (source)

Handle the help command. This is used to provide a list of available management commands.

Returns
ResponseA response object with the help message.
def _response(self, response: Any, status: int = 200, mimetype: str = 'application/json') -> Response: (source)

Create a Flask Response object with the given response data, status code, and mimetype.

Parameters
response:AnyThe response data to include in the response.
status:intThe HTTP status code for the response. Default is 200 (OK).
mimetype:strThe MIME type of the response. Default is 'application/json'.
Returns
ResponseA Flask Response object.