diff --git a/src/service/clmcservice/__init__.py b/src/service/clmcservice/__init__.py index 648e1d8cfe078907bf1cb8fd0063211e2445e9df..3f29bc471ffead52b38f17779ecfe0df97ed72ae 100644 --- a/src/service/clmcservice/__init__.py +++ b/src/service/clmcservice/__init__.py @@ -41,15 +41,8 @@ def main(global_config, **settings): config = Configurator(settings=settings) config.add_route('aggregator_config', '/aggregator/config') - config.add_view('clmcservice.aggregationapi.views.AggregatorConfig', attr='get', request_method='GET') - config.add_view('clmcservice.aggregationapi.views.AggregatorConfig', attr='put', request_method='PUT') - config.add_route('aggregator_controller', '/aggregator/control') - config.add_view('clmcservice.aggregationapi.views.AggregatorController', attr='get', request_method='GET') - config.add_view('clmcservice.aggregationapi.views.AggregatorController', attr='put', request_method='PUT') - config.add_route('round_trip_time_query', '/query/round-trip-time') - config.add_view('clmcservice.aggregationapi.views.RoundTripTimeQuery', attr='get', request_method='GET') - config.scan() + config.scan() # This method scans the packages and finds any views related to the routes added in the app configuration return config.make_wsgi_app() diff --git a/src/service/clmcservice/aggregationapi/views.py b/src/service/clmcservice/aggregationapi/views.py index 1e8c9dbe79af5ea07653b45162dd5219a4ed0d2d..9088eeddb9a4bb0e0c45eb98c0a819eb4b66096b 100644 --- a/src/service/clmcservice/aggregationapi/views.py +++ b/src/service/clmcservice/aggregationapi/views.py @@ -22,7 +22,7 @@ // Created for Project : FLAME """ -from pyramid.view import view_defaults +from pyramid.view import view_defaults, view_config from pyramid.httpexceptions import HTTPBadRequest, HTTPInternalServerError from influxdb import InfluxDBClient from urllib.parse import urlparse @@ -54,6 +54,7 @@ class AggregatorConfig(object): self.request = request + @view_config(request_method="GET") def get(self): """ A GET API call for the configuration of the aggregator. @@ -70,6 +71,7 @@ class AggregatorConfig(object): return config + @view_config(request_method="PUT") def put(self): """ A PUT API call for the status of the aggregator. @@ -141,6 +143,7 @@ class AggregatorController(object): self.request = request + @view_config(request_method="GET") def get(self): """ A GET API call for the status of the aggregator - running or not. @@ -160,6 +163,7 @@ class AggregatorController(object): return config + @view_config(request_method="PUT") def put(self): """ A PUT API call for the status of the aggregator. @@ -268,6 +272,7 @@ class RoundTripTimeQuery(object): self.request = request + @view_config(request_method="GET") def get(self): """ A GET API call for the averaged round trip time of a specific media service over a given time range.