Kea 2.7.5
|
Concrete implementation of the HTTP response creator used for processing API commands. More...
#include <cmd_response_creator.h>
Public Member Functions | |
CmdResponseCreator (bool emulate_agent_response=true) | |
Constructor. | |
virtual http::HttpRequestPtr | createNewHttpRequest () const |
Create a new request. | |
virtual http::HttpResponsePtr | createStockHttpResponse (const http::HttpRequestPtr &request, const http::HttpStatusCode &status_code) const |
Creates stock HTTP response. | |
bool | emulateAgentResponse () |
Indicates whether or not agent response emulation is enabled. | |
http::HttpResponseJsonPtr | filterCommand (const http::HttpRequestPtr &request, const data::ConstElementPtr &body, const std::unordered_set< std::string > &accept) |
Filter commands. | |
Public Member Functions inherited from isc::http::HttpResponseCreator | |
virtual | ~HttpResponseCreator () |
Destructor. | |
virtual HttpResponsePtr | createHttpResponse (HttpRequestPtr request) final |
Create HTTP response from HTTP request received. | |
Static Public Attributes | |
static std::unordered_set< std::string > | command_accept_list_ |
The server command accept list. | |
static http::HttpAuthConfigPtr | http_auth_config_ |
The server current authentication configuration. | |
Additional Inherited Members |
Concrete implementation of the HTTP response creator used for processing API commands.
See the documentation of the isc::http::HttpResponseCreator for the basic information how HTTP response creators are utilized by the libkea-http library to generate HTTP responses.
This creator expects that received requests are encapsulated in the isc::http::PostHttpRequestJson objects. The generated responses are encapsulated in the HttpResponseJson objects.
This class uses CommandMgr singleton to process commands conveyed in the HTTP body. The JSON responses returned by the manager are placed in the body of the generated HTTP responses.
Definition at line 32 of file cmd_response_creator.h.
|
inline |
Constructor.
emulate_agent_response | if true, responses for normal command outcomes are guaranteed to be wrapped in an Element::list. This emulates how kea-ctrl-agent forms responses. Defaults to true. |
Definition at line 40 of file cmd_response_creator.h.
|
virtual |
Create a new request.
This method creates a bare instance of the isc::http::PostHttpRequestJson.
Implements isc::http::HttpResponseCreator.
Definition at line 31 of file cmd_response_creator.cc.
|
virtual |
Creates stock HTTP response.
request | Pointer to an object representing HTTP request. |
status_code | Status code of the response. |
Implements isc::http::HttpResponseCreator.
Definition at line 36 of file cmd_response_creator.cc.
|
inline |
Indicates whether or not agent response emulation is enabled.
Definition at line 65 of file cmd_response_creator.h.
HttpResponseJsonPtr isc::config::CmdResponseCreator::filterCommand | ( | const http::HttpRequestPtr & | request, |
const data::ConstElementPtr & | body, | ||
const std::unordered_set< std::string > & | accept ) |
Filter commands.
From RBAC code: if the access list is empty or the command cannot be found just return.
request | The HTTP request (for the HTTP version). |
body | The request body. |
accept | The accept access list. |
Definition at line 130 of file cmd_response_creator.cc.
References isc::config::COMMAND_HTTP_LISTENER_COMMAND_REJECTED, isc::config::command_logger, isc::config::CONTROL_COMMAND, isc::config::CONTROL_RESULT, isc::config::CONTROL_TEXT, isc::data::Element::create(), isc::data::Element::createMap(), isc::config::DBG_COMMAND, LOG_DEBUG, isc::data::Element::map, isc::http::HttpResponse::statusCodeToNumber(), isc::http::HttpResponse::statusCodeToString(), and isc::data::Element::string.
|
static |
The server command accept list.
Default to the empty list which means to accept everything.
Definition at line 94 of file cmd_response_creator.h.
Referenced by isc::ha::HAService::HAService().
|
static |
The server current authentication configuration.
Default to the empty HttpAuthConfigPtr.
Definition at line 89 of file cmd_response_creator.h.