Fledge
An open source edge computing platform for industrial users
ManagementApi Class Reference

Management API server for a C++ microservice. More...

#include <management_api.h>

Inheritance diagram for ManagementApi:
Collaboration diagram for ManagementApi:

Public Member Functions

 ManagementApi (const std::string &name, const unsigned short port)
 Construct a microservices management API manager class. More...
 
 ~ManagementApi ()
 Management API destructor.
 
void start ()
 
void startServer ()
 
void stop ()
 
void stopServer ()
 
void registerStats (JSONProvider *statsProvider)
 Register a statistics provider. More...
 
void registerProvider (JSONProvider *provider)
 Register a generic provider. More...
 
void registerService (ServiceHandler *serviceHandler)
 
unsigned short getListenerPort ()
 
void ping (std::shared_ptr< HttpServer::Response > response, std::shared_ptr< HttpServer::Request > request)
 Received a ping request, construct a reply and return to caller. More...
 
void shutdown (std::shared_ptr< HttpServer::Response > response, std::shared_ptr< HttpServer::Request > request)
 Received a shutdown request, construct a reply and return to caller. More...
 
void configChange (std::shared_ptr< HttpServer::Response > response, std::shared_ptr< HttpServer::Request > request)
 Received a config change request, construct a reply and return to caller. More...
 
void configChildCreate (std::shared_ptr< HttpServer::Response > response, std::shared_ptr< HttpServer::Request > request)
 Received a children creation request, construct a reply and return to caller. More...
 
void configChildDelete (std::shared_ptr< HttpServer::Response > response, std::shared_ptr< HttpServer::Request > request)
 Received a children deletion request, construct a reply and return to caller. More...
 
void securityChange (std::shared_ptr< HttpServer::Response > response, std::shared_ptr< HttpServer::Request > request)
 Received a security change request, construct a reply and return to caller. More...
 

Static Public Member Functions

static ManagementApigetInstance ()
 Return the signleton instance of the management interface. More...
 

Protected Attributes

std::string m_name
 
Loggerm_logger
 
time_t m_startTime
 
HttpServer * m_server
 
JSONProviderm_statsProvider
 
ServiceHandlerm_serviceHandler
 
std::thread * m_thread
 

Static Protected Attributes

static ManagementApim_instance = 0
 

Detailed Description

Management API server for a C++ microservice.

Constructor & Destructor Documentation

◆ ManagementApi()

ManagementApi::ManagementApi ( const std::string &  name,
const unsigned short  port 
)

Construct a microservices management API manager class.

Parameters
nameThe service name
portThe management API port

Member Function Documentation

◆ configChange()

void ManagementApi::configChange ( std::shared_ptr< HttpServer::Response >  response,
std::shared_ptr< HttpServer::Request >  request 
)

Received a config change request, construct a reply and return to caller.

Parameters
responseThe HTTP response
requestThe HTTP request

◆ configChildCreate()

void ManagementApi::configChildCreate ( std::shared_ptr< HttpServer::Response >  response,
std::shared_ptr< HttpServer::Request >  request 
)

Received a children creation request, construct a reply and return to caller.

Parameters
responseThe HTTP response
requestThe HTTP request

◆ configChildDelete()

void ManagementApi::configChildDelete ( std::shared_ptr< HttpServer::Response >  response,
std::shared_ptr< HttpServer::Request >  request 
)

Received a children deletion request, construct a reply and return to caller.

Parameters
responseThe HTTP response
requestThe HTTP request

◆ getInstance()

ManagementApi * ManagementApi::getInstance ( )
static

Return the signleton instance of the management interface.

Note if one has not been explicitly created then this will return 0.

◆ ping()

void ManagementApi::ping ( std::shared_ptr< HttpServer::Response >  response,
std::shared_ptr< HttpServer::Request >  request 
)

Received a ping request, construct a reply and return to caller.

Parameters
responseThe HTTP response
requestThe HTTP request

◆ registerProvider()

void ManagementApi::registerProvider ( JSONProvider provider)

Register a generic provider.

There can be multiple providers for a single service

Parameters
providerThe JSON status provider to add

◆ registerStats()

void ManagementApi::registerStats ( JSONProvider statsProvider)

Register a statistics provider.

Parameters
statsProviderThe statistics provider for the service

◆ securityChange()

void ManagementApi::securityChange ( std::shared_ptr< HttpServer::Response >  response,
std::shared_ptr< HttpServer::Request >  request 
)

Received a security change request, construct a reply and return to caller.

Parameters
responseThe HTTP response
requestThe HTTP request

◆ shutdown()

void ManagementApi::shutdown ( std::shared_ptr< HttpServer::Response >  response,
std::shared_ptr< HttpServer::Request >  request 
)

Received a shutdown request, construct a reply and return to caller.

Parameters
responseThe HTTP response
requestThe HTTP request

The documentation for this class was generated from the following files: