def getSyncApi(username=None, password=None): cm = ConfigManager() if username and password or not cm.isDbAvailable(): from tortuga.wsapi import syncWsApi api = syncWsApi.SyncWsApi(username, password) else: from tortuga.sync import syncApi api = syncApi.SyncApi() return api
def getNodeApi(username=None, password=None): """ Creates an object that derives from KitApiInterface """ cm = ConfigManager() if username and password or not cm.isDbAvailable(): from tortuga.wsapi import nodeWsApi return nodeWsApi.NodeWsApi(username, password) from tortuga.node import nodeApi return nodeApi.NodeApi()
def getParameterApi(username=None, password=None): """ Creates an object that derives from ParameterApiInterface """ cm = ConfigManager() if username and password or not cm.isDbAvailable(): from tortuga.wsapi import parameterWsApi api = parameterWsApi.ParameterWsApi(username, password) else: from tortuga.parameter import parameterApi api = parameterApi.ParameterApi() return api
def getAdminApi(username=None, password=None): """ Creates an object that derives from AdminApiInterface """ cm = ConfigManager() if username and password or not cm.isDbAvailable(): from tortuga.wsapi import adminWsApi api = adminWsApi.AdminWsApi(username, password) else: from tortuga.admin import adminApi api = adminApi.AdminApi() return api
def getNetworkApi(username=None, password=None): """ Creates an object that derives from NetworkApiInterface """ cm = ConfigManager() if username and password or not cm.isDbAvailable(): from tortuga.wsapi import networkWsApi api = networkWsApi.NetworkWsApi(username, password) else: from tortuga.network import networkApi api = networkApi.NetworkApi() return api
def getHardwareProfileApi(username=None, password=None): """ Creates an object that derives from KitApiInterface """ cm = ConfigManager() if username and password or not cm.isDbAvailable(): from tortuga.wsapi.hardwareProfileWsApi import HardwareProfileWsApi api = HardwareProfileWsApi(username, password) else: from tortuga.hardwareprofile.hardwareProfileApi \ import HardwareProfileApi api = HardwareProfileApi() return api