def getHardwareProfileList(self,
                               optionDict: Optional[Union[dict, None]] = None,
                               tags=None):         \
            # pylint: disable=unused-argument
        """
        Get list of hardware profiles by calling WS API
        """

        url = 'hardwareprofiles/'

        # TODO: add support for building query string with 'tags'
        try:
            responseDict = self.get(url)
            return HardwareProfile.getListFromDict(responseDict)

        except Exception as ex:
            raise TortugaException(exception=ex)
示例#2
0
    def getHardwareProfileList(self, optionDict=None, tags=None):
        """
        Get list of hardware profiles by calling WS API
        """

        url = 'v1/hardwareProfiles'

        # TODO: add support for building query string with 'tags'

        postdata = json.dumps(optionDict or {})

        try:
            (response, responseDict) = self.sendSessionRequest(url,
                                                               data=postdata)

            return HardwareProfile.getListFromDict(responseDict)
        except Exception as ex:
            raise TortugaException(exception=ex)
    def getHardwareProfile(self,
                           hardwareProfileName: str,
                           optionDict: Optional[Union[dict, None]] = None):
        """
        Get hardware profile by name
        """
        url = 'hardwareprofiles/?name=%s' % (hardwareProfileName)

        if optionDict:
            for key, value in optionDict.items():
                if not value:
                    continue
                url += '&include={}'.format(key)

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

        except TortugaException as ex:
            raise

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