def __init__(self, oip, on_delete=None): """ oip -- an operation in progress object on_delete -- either None or a callable taking no argument """ AuthResource.__init__(self) self._oip = oip self._on_delete = on_delete
def __init__(self, pg_mgr): AuthResource.__init__(self) self._pg_mgr = pg_mgr self._childs = dict((pg_id, PluginResource(pg)) for (pg_id, pg) in six.iteritems(self._pg_mgr)) # observe plugin loading/unloading and keep a reference to the weakly # referenced observer self._obs = BasePluginManagerObserver(self._on_plugin_load, self._on_plugin_unload) pg_mgr.attach(self._obs)
def __init__(self, links): """ links -- a list of tuple (rel, path, resource) For example: links = [(u'foo', 'foo_sub_uri', server.Data('text/plain', 'foo'), (u'bar', 'bar_sub_uri', server.Data('text/plain', 'bar')] IntermediaryResource(links) The difference between this resource and a plain Resource is that a GET request will yield something. """ AuthResource.__init__(self) self._links = links self._register_childs()
def startService(self): app = self._prov_service.app dhcp_request_processing_service = self._dhcp_process_service.dhcp_request_processing_service server_resource = new_authenticated_server_resource( app, dhcp_request_processing_service) logger.info('Authentication is required for REST API') # /{version} root_resource = AuthResource() root_resource.putChild(API_VERSION, server_resource) # /{version}/api/api.yml api_resource = UnsecuredResource() api_resource.putChild( 'api.yml', ResponseFile(sibpath(__file__, 'rest/api/api.yml'))) server_resource.putChild('api', api_resource) rest_site = Site(root_resource) port = self._config['rest_api']['port'] interface = self._config['rest_api']['ip'] if interface == '*': interface = '' logger.info('Binding HTTP REST API service to "%s:%s"', interface, port) if self._config['rest_api']['ssl']: logger.warning( 'Using service SSL configuration is deprecated. Please use NGINX instead.' ) context_factory = ssl.DefaultOpenSSLContextFactory( self._config['rest_api']['ssl_keyfile'], self._config['rest_api']['ssl_certfile']) self._tcp_server = internet.SSLServer(port, rest_site, context_factory, interface=interface) else: self._tcp_server = internet.TCPServer(port, rest_site, interface=interface) self._tcp_server.startService() Service.startService(self)
def __init__(self, app, id): AuthResource.__init__(self) self._app = app self.device_id = id
def __init__(self, app): AuthResource.__init__(self) self._app = app
def __init__(self, app, dhcp_request_processing_service): AuthResource.__init__(self) self._app = app self._dhcp_req_processing_srv = dhcp_request_processing_service
def __init__(self, install_srv, method_name): AuthResource.__init__(self) self._install_srv = install_srv self._method_name = method_name
def __init__(self, install_srv, plugin_id): AuthResource.__init__(self) self._install_srv = install_srv self.plugin_id = plugin_id
def __init__(self): AuthResource.__init__(self) self._id_gen = new_id_generator()
def __init__(self, cfg_srv, key): AuthResource.__init__(self) # key is not necessary to be valid self._cfg_srv = cfg_srv self.param_id = key
def __init__(self, cfg_srv): """ cfg_srv -- an object providing the IConfigureService interface """ AuthResource.__init__(self) self._cfg_srv = cfg_srv
def __init__(self, plugin): AuthResource.__init__(self) self._plugin = plugin self.plugin_id = plugin.id
def getChild(self, path, request): try: return self._childs[path] except KeyError: return AuthResource.getChild(self, path, request)
def getChild(self, path, request): if path == 'raw': return RawConfigResource(self._app, self.config_id) else: return AuthResource.getChild(self, path, request)
def __init__(self, app, id): AuthResource.__init__(self) self._app = app self.config_id = id