Island: Publish RESET_AGENT_CONFIGURATION from endpoint

This commit is contained in:
Ilija Lazoroski 2022-09-12 13:19:59 +02:00
parent f9b1c5ebd2
commit b834bfe7f7
1 changed files with 4 additions and 4 deletions

View File

@ -2,22 +2,22 @@ from http import HTTPStatus
from flask import make_response
from monkey_island.cc.event_queue import IIslandEventQueue, IslandEventTopic
from monkey_island.cc.resources.AbstractResource import AbstractResource
from monkey_island.cc.resources.request_authentication import jwt_required
from monkey_island.cc.services import RepositoryService
class ResetAgentConfiguration(AbstractResource):
urls = ["/api/reset-agent-configuration"]
def __init__(self, repository_service: RepositoryService):
self._repository_service = repository_service
def __init__(self, event_queue: IIslandEventQueue):
self._event_queue = event_queue
@jwt_required
def post(self):
"""
Reset the agent configuration to its default values
"""
self._repository_service.reset_agent_configuration()
self._event_queue.publish(IslandEventTopic.RESET_AGENT_CONFIGURATION)
return make_response({}, HTTPStatus.OK)