예제 #1
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
    def _create_sub_resources(self, dev_mgr_uri, broker):
        resync_uri = uri_append_path(dev_mgr_uri, 'synchronize')
        self._resync_res = DeviceSynchronizeResource(resync_uri, broker)

        reconfigure_uri = uri_append_path(dev_mgr_uri, 'reconfigure')
        self._reconfigure_res = DeviceReconfigureResource(reconfigure_uri, broker)

        devices_uri = uri_append_path(dev_mgr_uri, 'devices')
        self._devices_res = DevicesResource(devices_uri, broker)
예제 #2
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
    def _create_sub_resources(self, pg_mgr_uri, broker):
        install_uri = uri_append_path(pg_mgr_uri, 'install')
        self._install_res = InstallServiceResource(install_uri, broker)

        plugins_uri = uri_append_path(pg_mgr_uri, 'plugins')
        self._plugins_res = PluginsResource(plugins_uri, broker)

        reload_uri = uri_append_path(pg_mgr_uri, 'reload')
        self._reload_res = PluginReloadResource(reload_uri, broker)
예제 #3
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
    def _create_sub_resources(self):
        dev_mgr_uri = uri_append_path(self._server_uri, 'dev_mgr')
        self._dev_mgr = DeviceManagerResource(dev_mgr_uri, self._broker)

        cfg_mgr_uri = uri_append_path(self._server_uri, 'cfg_mgr')
        self._cfg_mgr = ConfigManagerResource(cfg_mgr_uri, self._broker)

        pg_mgr_uri = uri_append_path(self._server_uri, 'pg_mgr')
        self._pg_mgr = PluginManagerResource(pg_mgr_uri, self._broker)

        config_uri = uri_append_path(self._server_uri, 'configure')
        self._config_res = ConfigureServiceResource(config_uri, self._broker)
예제 #4
0
 def render_GET(self, request):
     plugins = {}
     for pg_id in self._pg_mgr:
         href = uri_append_path(request.path, pg_id)
         links = [{u'rel': u'pg.plugin', 'href': href}]
         plugins[pg_id] = {u'links': links}
     content = {u'plugins': plugins}
     return json_dumps(content)
예제 #5
0
파일: server.py 프로젝트: Eyepea/xivo-skaro
 def render_GET(self, request):
     plugins = {}
     for pg_id in self._pg_mgr:
         href = uri_append_path(request.path, pg_id)
         links = [{u'rel': u'pg.plugin', 'href': href}]
         plugins[pg_id] = {u'links': links}
     content = {u'plugins': plugins}
     return json_dumps(content)
예제 #6
0
파일: server.py 프로젝트: Eyepea/xivo-skaro
 def _add_new_oip(self, oip, request):
     # add a new child to this resource, and return the location
     # of the child
     path = self._id_gen.next()
     def on_delete():
         try:
             del self.children[path]
         except KeyError:
             logger.warning('ID "%s" has already been removed' % path)
     op_in_progress_res = OperationInProgressResource(oip, on_delete)
     self.putChild(path, op_in_progress_res)
     return uri_append_path(request.path, path)
예제 #7
0
파일: server.py 프로젝트: Eyepea/xivo-skaro
 def render_GET(self, request):
     description_list = self._get_localized_description_list()
     params = []
     for id_, description in description_list:
         value = self._cfg_srv.get(id_)
         href = uri_append_path(request.path, id_)
         params.append({u'id': id_,
                        u'description': description,
                        u'value': value,
                        u'links': [{u'rel': REL_CONFIGURE_PARAM,
                                    u'href': href}]})
     content = {u'params': params}
     return json_dumps(content)
예제 #8
0
    def _add_new_oip(self, oip, request):
        # add a new child to this resource, and return the location
        # of the child
        path = next(self._id_gen)

        def on_delete():
            try:
                del self.children[path]
            except KeyError:
                logger.warning('ID "%s" has already been removed' % path)

        op_in_progress_res = OperationInProgressResource(oip, on_delete)
        self.putChild(path, op_in_progress_res)
        return uri_append_path(request.path, path)
예제 #9
0
 def render_GET(self, request):
     description_list = self._get_localized_description_list()
     params = []
     for id_, description in description_list:
         value = self._cfg_srv.get(id_)
         href = uri_append_path(request.path, id_)
         params.append({
             u'id':
             id_,
             u'description':
             description,
             u'value':
             value,
             u'links': [{
                 u'rel': REL_CONFIGURE_PARAM,
                 u'href': href
             }]
         })
     content = {u'params': params}
     return json_dumps(content)
예제 #10
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
    def _create_sub_resources(self, install_srv_uri, broker):
        install_uri = uri_append_path(install_srv_uri, 'install')
        self._install_res = InstallResource(install_uri, broker)

        uninstall_uri = uri_append_path(install_srv_uri, 'uninstall')
        self._uninstall_res = UninstallResource(uninstall_uri, broker)

        installed_uri = uri_append_path(install_srv_uri, 'installed')
        self._installed_res = InstalledResource(installed_uri, broker)

        installable_uri = uri_append_path(install_srv_uri, 'installable')
        self._installable_res = InstallableResource(installable_uri, broker)

        upgrade_uri = uri_append_path(install_srv_uri, 'upgrade')
        self._upgrade_res = UpgradeResource(upgrade_uri, broker)

        update_uri = uri_append_path(install_srv_uri, 'update')
        self._update_res = UpdateResource(update_uri, broker)
예제 #11
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
 def get(self, id):
     param_uri = uri_append_path(self._config_uri, id)
     return ConfigureParameterResource(param_uri, self._broker)
예제 #12
0
파일: server.py 프로젝트: Eyepea/xivo-skaro
 def on_callback(id):
     location = uri_append_path(request.path, str(id))
     request.setHeader('Location', location)
     data = json_dumps({u'id': id})
     deferred_respond_ok(request, data, http.CREATED)
예제 #13
0
파일: server.py 프로젝트: Eyepea/xivo-skaro
 def _build_links(self, base_uri):
     links = []
     for rel, path, _ in self._links:
         href = uri_append_path(base_uri, path)
         links.append({u'rel': rel, u'href': href})
     return links
예제 #14
0
 def on_callback(id):
     location = uri_append_path(request.path, str(id))
     request.setHeader('Location', location)
     data = json_dumps({u'id': id})
     deferred_respond_ok(request, data, http.CREATED)
예제 #15
0
 def _build_links(self, base_uri):
     links = []
     for rel, path, _ in self._links:
         href = uri_append_path(base_uri, path)
         links.append({u'rel': rel, u'href': href})
     return links
예제 #16
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
 def get(self, id):
     plugin_uri = uri_append_path(self._plugins_uri, id)
     return PluginResource(plugin_uri, self._broker)
예제 #17
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
 def device_res(self, id):
     device_uri = uri_append_path(self._devices_uri, id)
     return DeviceResource(device_uri, self._broker)
예제 #18
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
 def raw_config_res(self, id):
     raw_config_uri = uri_append_path(self._configs_uri, id, 'raw')
     return RawConfigResource(raw_config_uri, self._broker)
예제 #19
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
 def config_res(self, id):
     config_uri = uri_append_path(self._configs_uri, id)
     return ConfigResource(config_uri, self._broker)
예제 #20
0
파일: base.py 프로젝트: Eyepea/xivo-skaro
    def _create_sub_resources(self, cfg_mgr_uri, broker):
        configs_uri = uri_append_path(cfg_mgr_uri, 'configs')
        self._configs_res = ConfigsResource(configs_uri, broker)

        autocreate_uri = uri_append_path(cfg_mgr_uri, 'autocreate')
        self._autocreate_res = AutocreateConfigResource(autocreate_uri, broker)