MCPcopy Create free account
hub / github.com/Icinga/icinga2 / ApiFunction

Class ApiFunction

lib/remote/apifunction.hpp:22–44  ·  view source on GitHub ↗

* A function available over the internal cluster API. * * @ingroup base */

Source from the content-addressed store, hash-verified

20 * @ingroup base
21 */
22class ApiFunction final : public Object
23{
24public:
25 DECLARE_PTR_TYPEDEFS(ApiFunction);
26
27 typedef std::function<Value(const MessageOrigin::Ptr& origin, const Dictionary::Ptr&)> Callback;
28
29 ApiFunction(const char* name, Callback function);
30
31 const char* GetName() const noexcept
32 {
33 return m_Name;
34 }
35
36 Value Invoke(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& arguments);
37
38 static ApiFunction::Ptr GetByName(const String& name);
39 static void Register(const String& name, const ApiFunction::Ptr& function);
40
41private:
42 const char* m_Name;
43 Callback m_Callback;
44};
45
46/**
47 * A registry for API functions.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected