-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command management endpoints #72
Conversation
I added validation inspired by the I'm currently getting an error when indexing: $ curl -XPOST "http://127.0.0.1:9200/_plugins/_commandmanager/1234" -H 'Content-Type: application/json' -d'
{
"command_order_id": "value",
"command_request_id": "value",
"command_source": "value",
"command_target": "value",
"command_timeout": "value",
"command_type": "value",
"command_user": "value",
"command_action": {"field":"value"},
"command_result": {"field":"value"}
}'
{"response":"failed"} The engine logs are showing the following error:
|
I removed the document update functionality off the plugin after discussion with Alex, with this change, the endpoint now works as expected: $ curl -XPOST "http://127.0.0.1:9200/command-manager/_search?pretty" -H 'Content-Type: application/json' -d'
{
"size": 1,
"query": {
"match_all": {}
}
}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "command-manager",
"_id" : "JEChD5IBPt7qjCU0RVfs",
"_score" : 1.0,
"_source" : {
"command_order_id" : "value",
"command_request_id" : "value",
"command_source" : "value",
"command_target" : "value",
"command_timeout" : "value",
"command_type" : "value",
"command_user" : "value",
"command_action" : {
"field" : "value"
},
"command_result" : {
"field" : "value"
}
}
}
]
}
} |
The order and request IDs are generated randomly (for tests purposes) and the document ID is a concatenation of both: $
curl -XPOST "http://127.0.0.1:9200/_plugins/_commandmanager" -H 'Content-Type: application/json' -d'
{
"command_order_id": "value",
"command_request_id": "value",
"command_source": "value",
"command_target": "value",
"command_timeout": "value",
"command_type": "value",
"command_user": "value",
"command_action": {"field":"value"},
"command_result": {"field":"value"}
}'
{"response":"success","document_id":"pBjePGfvgm"}
fede@tyner:~
$ curl -XPOST "http://127.0.0.1:9200/command-manager/_search?pretty" -H 'Content-Type: application/json' -d'
{
"size": 1,
"query": {
"match_all": {}
}
}'
{
"took" : 40,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "command-manager",
"_id" : "pBjePGfvgm",
"_score" : 1.0,
"_source" : {
"command_order_id" : "pBjeP",
"command_request_id" : "Gfvgm",
"command_source" : "value",
"command_target" : "value",
"command_timeout" : "value",
"command_type" : "value",
"command_user" : "value",
"command_action" : {
"field" : "value"
},
"command_result" : {
"field" : "value"
}
}
}
]
}
}
|
…/wazuh-indexer-plugins into 69-create-command-manager-endpoint
Improve endpoint response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This PR adds HTTP endpoints to the Command Manager plugin that will be used to queue/schedule tasks.
Issues Resolved
Resolves #69