class NamespaceApp(object): def __init__(self): self._ns_manager = NamespaceManager() def list_namespaces(self): return self._ns_manager.get_all_namespaces() def get_namespace(self, namespace): return self._ns_manager.get_namespace(namespace) def list_namespaces_ips(self): return self._ns_manager.get_all_namespaces_ips() def discover_namespaces(self): self._ns_manager.discover_namespaces()
class NamespaceApp(StateLessBaseApp): NAME = "NAMESPACE" def __init__(self): self._ns_manager = NamespaceManager() @exposed def list_namespaces(self): return self._ns_manager.get_all_namespaces() @exposed def get_namespace(self, namespace): return self._ns_manager.get_namespace(namespace) @exposed def list_namespaces_ips(self): return self._ns_manager.get_all_namespaces_ips()
def _setup(self): if not self._ns_list or not self._ns_iterface_map: mngr = NamespaceManager() self._ns_list = mngr.get_all_namespaces() self._ns_iterface_map = mngr.get_namespace_interface_map()
def rediscover_namespaces(self): self._ns_list, self._ns_iterface_map = None, None mngr = NamespaceManager() mngr.discover_namespaces() self._ns_list = mngr.get_all_namespaces() self._ns_iterface_map = mngr.get_namespace_interface_map()