Пример #1
0
    def getNetworkList(self):
        """
        Get network list.

            Returns:
                [networks]
            Throws:
                UserNotAuthorized
                TortugaException
        """

        url = 'v1/networks'

        try:
            _, responseDict = self.sendSessionRequest(url)

            return Network.getListFromDict(responseDict)
        except TortugaException:
            raise
        except Exception as ex:
            raise TortugaException(exception=ex)
Пример #2
0
    def getNetwork(self, address, netmask):
        """
        Get network information.

            Returns:
                network
            Throws:
                UserNotAuthorized
                NetworkNotFound
                TortugaException
        """

        url = 'networks/?address=%s&netmask=%s' % (address, netmask)

        try:
            responseDict = self.get(url)
            return Network.getListFromDict(responseDict)[0]

        except TortugaException:
            raise

        except Exception as ex:
            raise TortugaException(exception=ex)