Exemple #1
0
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
Exemple #2
0
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()
Exemple #3
0
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
Exemple #4
0
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
Exemple #5
0
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
Exemple #6
0
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