forked from p15670423/monkey
Island: Modify AgentConfiguration endpoint to use new pydantic model
This commit is contained in:
parent
c79b3c4497
commit
433e154cd1
|
@ -20,13 +20,13 @@ class AgentConfiguration(AbstractResource):
|
||||||
# Used by the agent. Can't secure
|
# Used by the agent. Can't secure
|
||||||
def get(self):
|
def get(self):
|
||||||
configuration = self._agent_configuration_repository.get_configuration()
|
configuration = self._agent_configuration_repository.get_configuration()
|
||||||
configuration_json = AgentConfigurationObject.to_json(configuration)
|
configuration_dict = configuration.dict()
|
||||||
return make_response(configuration_json, 200)
|
return make_response(configuration_dict, 200)
|
||||||
|
|
||||||
@jwt_required
|
@jwt_required
|
||||||
def put(self):
|
def put(self):
|
||||||
try:
|
try:
|
||||||
configuration_object = AgentConfigurationObject.from_mapping(request.json)
|
configuration_object = AgentConfigurationObject(**request.json)
|
||||||
self._agent_configuration_repository.store_configuration(configuration_object)
|
self._agent_configuration_repository.store_configuration(configuration_object)
|
||||||
# API Spec: Should return 204 (NO CONTENT)
|
# API Spec: Should return 204 (NO CONTENT)
|
||||||
return make_response({}, 200)
|
return make_response({}, 200)
|
||||||
|
|
Loading…
Reference in New Issue