Actifio/Actifio.py
def run_sarg_command(self, cmdSARG, cmdArgs={}):
    """
    Wrapper function to convert CLI commands to the rest API.

    Args:

      :cmdSARG: Command to use (eg. reportsnaps, reportapps... etc.)
      :cmdArgs: Dictionary with arguments to the command

    Return:

      return a dictionary of the SARG command, mapping to the same JSON response from the API.

    Example:

      reportapps -a 1234 -x

      self.run_sarg_command("reportapps", { 'a': 1234, 'x': None })

    """

    _URI = self._sargURI

    # append the command to URI
    _URI += cmdSARG + '?'

    # append the argument
    for key in cmdArgs:
      if type(cmdArgs[key]) == dict:
        # Actifio API expects this to be urlencoded
        _URI += key + '=' + urlencode_str('&'.join([filter_key + '=' + cmdArgs[key][filter_key] for filter_key in cmdArgs[key]])) + '&'
      elif cmdArgs[key] == None:
        _URI += urlencode_str(key) + '&'
      else:
        _URI += urlencode_str(key) + '=' + urlencode_str(str(cmdArgs[key])) + '&'

    _URI += 'sessionid=' + Actifio._sessionid[self.appliance][self.username]["sessionid"]
    try:
      sargout = self._httppool.request(
        'GET',
        _URI
      )
      if self._verbose:
        print(_URI)      
    except urllib3.exceptions.NewConnectionError:
      raise ActConnectError("Unable to make connection to the appliance")
    else:
      response = json.loads(sargout.data)
      if sargout.status != 200:
        self._lastout = ''
        raise ActAPIError(response['errormessage'], response['errorcode'])
      else:
        self._lastout = response
        return self._lastout

    Wrapper function to convert CLI commands to the rest API.

    Args:

      :cmdSARG: Command to use (eg. reportsnaps, reportapps... etc.)
      :cmdArgs: Dictionary with arguments to the command

    Return:

      return a dictionary of the SARG command, mapping to the same JSON response from the API.

    Example:

      reportapps -a 1234 -x

      self.run_sarg_command("reportapps", { 'a': 1234, 'x': None })

    
Wrapper function to convert CLI commands to the rest API.
Wrapper function to convert CLI commands to the rest API .
def run_sarg_command(self, cmdSARG, cmdArgs={}):
    _URI = self._sargURI
    _URI += cmdSARG + '?'
    for key in cmdArgs:
      if type(cmdArgs[key]) == dict:
        _URI += key + '=' + urlencode_str('&'.join([filter_key + '=' + cmdArgs[key][filter_key] for filter_key in cmdArgs[key]])) + '&'
      elif cmdArgs[key] == None:
        _URI += urlencode_str(key) + '&'
      else:
        _URI += urlencode_str(key) + '=' + urlencode_str(str(cmdArgs[key])) + '&'
    _URI += 'sessionid=' + Actifio._sessionid[self.appliance][self.username]["sessionid"]
    try:
      sargout = self._httppool.request(
        'GET',
        _URI
      )
      if self._verbose:
        print(_URI)      
    except urllib3.exceptions.NewConnectionError:
      raise ActConnectError("Unable to make connection to the appliance")
    else:
      response = json.loads(sargout.data)
      if sargout.status != 200:
        self._lastout = ''
        raise ActAPIError(response['errormessage'], response['errorcode'])
      else:
        self._lastout = response
        return self._lastout
def run_sarg_command ( self , cmdSARG , cmdArgs = { } ) : _URI = self . _sargURI _URI += cmdSARG + '?' for key in cmdArgs : if type ( cmdArgs [ key ] ) == dict : _URI += key + '=' + urlencode_str ( '&' . join ( [ filter_key + '=' + cmdArgs [ key ] [ filter_key ] for filter_key in cmdArgs [ key ] ] ) ) + '&' elif cmdArgs [ key ] == None : _URI += urlencode_str ( key ) + '&' else : _URI += urlencode_str ( key ) + '=' + urlencode_str ( str ( cmdArgs [ key ] ) ) + '&' _URI += 'sessionid=' + Actifio . _sessionid [ self . appliance ] [ self . username ] [ "sessionid" ] try : sargout = self . _httppool . request ( 'GET' , _URI ) if self . _verbose : print ( _URI ) except urllib3 . exceptions . NewConnectionError : raise ActConnectError ( "Unable to make connection to the appliance" ) else : response = json . loads ( sargout . data ) if sargout . status != 200 : self . _lastout = '' raise ActAPIError ( response [ 'errormessage' ] , response [ 'errorcode' ] ) else : self . _lastout = response return self . _lastout
Wrapper function to convert CLI commands to the rest API.
Wrapper function to convert CLI commands to the rest API .
"""
    Wrapper function to convert CLI commands to the rest API.

    Args:

      :cmdSARG: Command to use (eg. reportsnaps, reportapps... etc.)
      :cmdArgs: Dictionary with arguments to the command

    Return:

      return a dictionary of the SARG command, mapping to the same JSON response from the API.

    Example:

      reportapps -a 1234 -x

      self.run_sarg_command("reportapps", { 'a': 1234, 'x': None })

    """ # append the command to URI # append the argument # Actifio API expects this to be urlencoded
self
cmdSARG
cmdArgs
Dictionary with arguments to the command
Dictionary with arguments to the command
examples
None