how 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 an error, shown at the bottom
https://{{big_ip_a_mgmt}}/mgmt/tm/asm/policies?ver=12.1.0 Request Data { "fullPath":"/Common/rest-api_12", "active":"true", "virtualServers":[], "enforcementMode": "transparent", "description":"none", "applicationLanguage":"utf-8", "policy-builder":"disabled", "learningMode":"manual", "stagingSettings": { "signatureStaging": true, "placeSignaturesInStaging": false, "enforcementReadinessPeriod": 7 } }
import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
from import ManagementRoot
mgmt = ManagementRoot("70.60.207.94", "admin", "admin")
p_collections = mgmt.tm.asm.policies_s.get_collection() for p_object in p_collections: policy=mgmt.tm.asm.policies_s.policy.load(id=p_object.id) policy.update(description="bar", learningMode="automatic")
UnsupportedOperation Traceback (most recent call last) /home/jaekim711/f5/test2.py in () 21 print p_object.allowedResponseCodes 22 policy=mgmt.tm.asm.policies_s.policy.load(id=p_object.id) ---> 23 policy.update(description="bar", learningMode="automatic") 24 25
/usr/lib/python2.7/site-packages/f5/bigip/resource.pyc in update(self, **kwargs) 1286 """ 1287 raise UnsupportedOperation( -> 1288 "%s does not support the update method" % self.__class__.__name__ 1289 ) 1290
UnsupportedOperation: Policy does not support the update method