def getNetworkList(self): """ Get network list. Returns: [networks] Throws: UserNotAuthorized TortugaException """ try: return NetworkManager().getNetworkList() except TortugaException as ex: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise TortugaException(exception=ex)
def getNetworkList(self, session: Session) -> TortugaObjectList: """ Get network list. Returns: [networks] Throws: UserNotAuthorized TortugaException """ try: return NetworkManager().getNetworkList(session) except TortugaException as ex: raise except Exception as ex: self._logger.exception(str(ex)) raise TortugaException(exception=ex)
def addNetwork(self, session: Session, network: Network) -> int: """ Add a new network to the system. Returns: new network id Throws: NetworkAlreadyExists UserNotAuthorized TortugaException """ try: return NetworkManager().addNetwork(session, network) except TortugaException as ex: raise except Exception as ex: self._logger.exception(str(ex)) raise TortugaException(exception=ex)
def getNetworkById(self, session: Session, id_: str): """ Get network information by id. Returns: network Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().getNetworkById(session, id_) except TortugaException as ex: raise except Exception as ex: self._logger.exception(str(ex)) raise TortugaException(exception=ex)
def updateNetwork(self, session: Session, network: Network) -> Network: """ Update a network in the DB. Returns: network Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().updateNetwork(session, network) except TortugaException as ex: raise except Exception as ex: self._logger.exception(str(ex)) raise TortugaException(exception=ex)
def deleteNetwork(self, session: Session, id_: str): """ Delete a network from the DB. Returns: None Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().deleteNetwork(session, id_) except TortugaException as ex: raise except Exception as ex: self._logger.exception(str(ex)) raise TortugaException(exception=ex)
def addNetwork(self, network): """ Add a new network to the system. Returns: new network id Throws: NetworkAlreadyExists UserNotAuthorized TortugaException """ try: return NetworkManager().addNetwork(network) except TortugaException as ex: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise TortugaException(exception=ex)
def getNetworkById(self, id_): """ Get network information by id. Returns: network Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().getNetworkById(id_) except TortugaException as ex: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise TortugaException(exception=ex)
def updateNetwork(self, network): """ Update a network in the DB. Returns: network Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().updateNetwork(network) except TortugaException as ex: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise TortugaException(exception=ex)
def deleteNetwork(self, id_): """ Delete a network from the DB. Returns: None Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().deleteNetwork(id_) except TortugaException as ex: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise TortugaException(exception=ex)
def getNetwork(self, networkAddress, networkSubnet): """ Get network information. Returns: network Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().\ getNetwork(networkAddress, networkSubnet) except TortugaException as ex: raise except Exception as ex: self.getLogger().exception('%s' % ex) raise TortugaException(exception=ex)
def getNetwork(self, session: Session, networkAddress: str, networkSubnet: str): """ Get network information. Returns: network Throws: UserNotAuthorized NetworkNotFound TortugaException """ try: return NetworkManager().getNetwork(session, networkAddress, networkSubnet) except TortugaException as ex: raise except Exception as ex: self._logger.exception(str(ex)) raise TortugaException(exception=ex)