gabstopper / smc-python

Forcepoint Security Management Center python library:(Moved to official Forcepoint repo)
https://github.com/Forcepoint/fp-NGFW-SMC-python
Apache License 2.0
29 stars 13 forks source link

Non-standard kwargs in `Engine.vpn.vpn_client` #42

Open stdedos opened 6 years ago

stdedos commented 6 years ago

On a "properly configured" engine with VPN and 'VPN Client'-attaching enabled,

Engine('Name').vpn.vpn_client.update(windows_update=False, antivirus=False)

fails:

  File ".py", line 56, in main
    Engine('Name').vpn.vpn_client.update(windows_update=False, antivirus=False)
  File "/home/sntentos/Documents/Forcepoint/PycharmProjects/createMLConfiguration/venv/lib/python3.5/site-packages/smc/base/model.py", line 460, in update
    result = request.update()
  File "/home/sntentos/Documents/Forcepoint/PycharmProjects/createMLConfiguration/venv/lib/python3.5/site-packages/smc/api/common.py", line 72, in update
    return self._make_request(method='PUT')
  File "/home/sntentos/Documents/Forcepoint/PycharmProjects/createMLConfiguration/venv/lib/python3.5/site-packages/smc/api/common.py", line 101, in _make_request
    raise err
smc.api.exceptions.UpdateElementFailed: Invalid JSON format: At line 1 and column 1674, windows_update is not recognized as JSON attribute.

Key is windows-update, but you cannot set that like update(windows_update=False, antivirus=False)

Can we implement fuzzy key match for [_-], do something else from here, or talk to the SMC API team?


Workaround:

    kwargs = {'windows-update': False, 'antivirus': False}
    Engine('Name').vpn.vpn_client.update(**kwargs)

Remember to update: https://smc-python.readthedocs.io/en/latest/pages/reference.html?highlight=vpn%20client%20antivirus#smc.core.engine.InternalGateway