diff --git a/monkey/monkey_island/cc/resources/__init__.py b/monkey/monkey_island/cc/resources/__init__.py index e6c2db648..5802d35e6 100644 --- a/monkey/monkey_island/cc/resources/__init__.py +++ b/monkey/monkey_island/cc/resources/__init__.py @@ -12,3 +12,4 @@ from .agent_events import AgentEvents from .agents import Agents from .agent_signals import AgentSignals, TerminateAllAgents from .agent_logs import AgentLogs +from .machines import Machines diff --git a/monkey/monkey_island/cc/resources/machines.py b/monkey/monkey_island/cc/resources/machines.py new file mode 100644 index 000000000..3e1c1edb0 --- /dev/null +++ b/monkey/monkey_island/cc/resources/machines.py @@ -0,0 +1,16 @@ +from http import HTTPStatus + +from monkey_island.cc.repository import IMachineRepository +from monkey_island.cc.resources.AbstractResource import AbstractResource +from monkey_island.cc.resources.request_authentication import jwt_required + + +class Machines(AbstractResource): + urls = ["/api/machines"] + + def __init__(self, machine_repository: IMachineRepository): + self._machine_repository = machine_repository + + @jwt_required + def get(self): + return self._machine_repository.get_machines(), HTTPStatus.OK