diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-08-03 10:44:36 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-08-03 10:44:36 +0300 |
commit | a2bd5bca4c60499b3f9a2b99ec0dd0645bc718fe (patch) | |
tree | d2f385b16355b5f3efe3dc6c2e9699cc1bba59b2 /qvisqve | |
parent | 9353d90a656acc45451956b4048f7a5befcf22cd (diff) | |
download | qvisqve-a2bd5bca4c60499b3f9a2b99ec0dd0645bc718fe.tar.gz |
Add: PUT /applications/id
Diffstat (limited to 'qvisqve')
-rw-r--r-- | qvisqve/management_router.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/qvisqve/management_router.py b/qvisqve/management_router.py index 6095d41..5592677 100644 --- a/qvisqve/management_router.py +++ b/qvisqve/management_router.py @@ -69,6 +69,11 @@ class ManagementEndpoint: }, { 'method': 'PUT', + 'path': '{}/<id>'.format(self._path), + 'callback': self._update, + }, + { + 'method': 'PUT', 'path': '{}/<id>/secret'.format(self._path), 'callback': self._set_secret, }, @@ -93,6 +98,20 @@ class ManagementEndpoint: location = '{}{}/{}'.format(self._baseurl, self._path, entity_id) return qvisqve.created_response(entity, location) + def _update(self, content_type, body, **kwargs): + qvisqve.log.log('info', msg_text='Updating', path=self._path) + + entity_id = kwargs['id'] + try: + entity = self._entities.get(entity_id) + except qvisqve.ResourceDoesNotExist as e: + return qvisqve.not_found_response() + + self._entities.create(entity_id, body) + + entity = self._entities.get(entity_id) + return qvisqve.ok_response(entity) + def _list(self, content_type, body, **kwargs): qvisqve.log.log('info', msg_text='Listing', path=self._path) entity_ids = list(self._entities.list()) |