Forum Discussion
Jae_Hong_Kim_32
Nimbostratus
May 25, 2017how to use REST API using F5 SDK
The following REST API would pass the Request data for arguments.
I am trying to figure out how to the equivalent (pass arguments) the using using the F5 SDK
I tried using the update method but I get...
Joel_Breton
Nimbostratus
May 26, 2017Hi Jae,
I was able to modify the ASM policy using the modify method - I use Python 3.6 so my code is slightly different
Here's the code I used
from f5.bigip import ManagementRoot
bigip = ManagementRoot('ipaddress', 'admin', 'admin')
asm = bigip.tm.asm.policies_s
for policy in asm.get_collection():
print('Before policy description change: ' + policy.description)
print('Before policy description change: ' + policy.learningMode)
policy.modify(description='test')
policy.modify(learningMode='manual')
print('After policy description change: ' + policy.description)
print('After policy description change: ' + policy.learningMode)
Here's the output of the script the first time it is run
Before policy description change: myasmpolicy
Before policy description change: automatic
After policy description change: test
After policy description change: manual
Here's the output of the script the second time it is run - You can notice the values in the policy are now different
Before policy description change: test
Before policy description change: manual
After policy description change: test
After policy description change: manual
Hope this helps
Also I would advise not to post public IP Addresses on public forums
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects