mitchos/pyZscaler

No argument for action change in zpa.policies.update_rule

Closed this issue · 3 comments

In zpa.policies.update_rule, there is not argument to change the action of the rule. For example, for access rule, the action is only allow or deny, if user creates a rule that he/she wants to change the action at a later time, there is no argument for this in the function.

Hi @EddyIskandar thanks for raising this.

I took a look and tried to replicate the issue but I don't seem to have any problems changing an access rule action.

Just to give you some context, I made a design decision to have a single method that covered updating access, timeout and client forwarding rules. I made the decision because if I had a separate method for each then they would essentially be a duplicate with some minor modifications for each rule type (access, timeout, client forwarding).

As a consequence, I admit in hindsight I have been a bit lazy documenting the zpa.policies.update_rule() method. In practicality, kwargs can contain any of the updateable params from either:

  • zpa.policies.add_access_rule(),
  • zpa.policies.add_timeout_rule()
  • zpa.policies.add_client_forwarding_rule()

In testing, I created an access rule and used the following code to update the action:

zpa.policies.update_rule("access", "<Rule ID>", action="DENY")

This worked without issue despite not being listed as a possible kwarg.

Can you please confirm that the functionality works and that the issue is around documentation? Or have I missed the point entirely here and you can you please provide more info? Thanks!

Great to hear we got you there in the end @EddyIskandar!

I'm going to keep this issue open until I've updated the documentation in the next release.

Please don't hesitate if you bump into any other issues, much appreciated.