Changing access rules
Now that we can automatically retrieve first the access policy and then its access rules, you might be wondering how we can change the rules themselves. A common task when dealing with access rules is to enable or disable them. In this recipe, we will see how you can update the properties of an existing access rule. In our case, we will disable the policy itself.
Getting ready
Open your code editor and start by creating a file called change_access_rules.py
. Next, navigate in your terminal to the same directory in which you just created the change_access_rules.py
file.
How to do it…
Follow these steps to change an existing access rule and disable it:
- Import the required
requests
library as well as thejson
andsys
modules from the standard library:import requests import json import sys from requests.auth import HTTPBasicAuth
- Specify the required variables such as your username, password, domain ID, and the ID of the policy, as well...