Skip to content

Commit

Permalink
Add stub for /v1/actions/execute-command
Browse files Browse the repository at this point in the history
refs #8034
  • Loading branch information
Al2Klimov authored and N-o-X committed Nov 20, 2020
1 parent b413f34 commit f5b9905
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/icinga/apiactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ REGISTER_APIACTION(remove_downtime, "Service;Host;Downtime", &ApiActions::Remove
REGISTER_APIACTION(shutdown_process, "", &ApiActions::ShutdownProcess);
REGISTER_APIACTION(restart_process, "", &ApiActions::RestartProcess);
REGISTER_APIACTION(generate_ticket, "", &ApiActions::GenerateTicket);
REGISTER_APIACTION(execute_command, "Service;Host", &ApiActions::ExecuteCommand);

Dictionary::Ptr ApiActions::CreateResult(int code, const String& status,
const Dictionary::Ptr& additional)
Expand Down Expand Up @@ -520,3 +521,9 @@ Dictionary::Ptr ApiActions::GenerateTicket(const ConfigObject::Ptr&,
return ApiActions::CreateResult(200, "Generated PKI ticket '" + ticket + "' for common name '"
+ cn + "'.", additional);
}

Dictionary::Ptr ApiActions::ExecuteCommand(const ConfigObject::Ptr& object,
const Dictionary::Ptr& params)
{
return ApiActions::CreateResult(501, "Not implemented");
}
1 change: 1 addition & 0 deletions lib/icinga/apiactions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ApiActions
static Dictionary::Ptr ShutdownProcess(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
static Dictionary::Ptr RestartProcess(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
static Dictionary::Ptr GenerateTicket(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);
static Dictionary::Ptr ExecuteCommand(const ConfigObject::Ptr& object, const Dictionary::Ptr& params);

private:
static Dictionary::Ptr CreateResult(int code, const String& status, const Dictionary::Ptr& additional = nullptr);
Expand Down

0 comments on commit f5b9905

Please sign in to comment.