def put(self, *args, **kwargs): """Update a component. Args: [0]: the component id Request: version: protocol version (1.0) params: dictionary of parametes supported by the component as reported by the GET request Example URLs: PUT /api/v1/components/empower.apps.mobilitymanager.mobilitymanager { "version" : 1.0, "params": { "every": 1000 } } """ components = RUNTIME.load_main_components() component = components[args[0]] for param in kwargs['params']: if "params" not in component or param not in component['params']: msg = "Cannot set %s on compoment %s" % (param, args[0]) raise ValueError(msg) setattr(component, param, kwargs['params'][param])
def get(self, *args, **kwargs): """Lists components. Args: [0]: the component id (optional) Example URLs: GET /api/v1/components GET /api/v1/components/empower.apps.mobilitymanager.mobilitymanager """ components = RUNTIME.load_main_components() return components.values() if not args else components[args[0]]
def get(self, *args, **kwargs): """Lists the components. Args: [0]: the id of a component Example URLs: GET /api/v1/components GET /api/v1/components/<component> """ components = RUNTIME.load_main_components() return components.values() if not args else components[args[0]]