Fetching objects from Pre-defined location via SDK
I’m trying to retrieve Application objects from a predefined location.
The REST endpoint accepts a location query parameter, which can be set to shared, predefined, or device-group.
I’d like to fetch objects from the predefined location using the SDK, but I don't see any option to specify the location. By default, it only retrieves objects from the shared location.
import panos
fw = panos.firewall.Firewall(HOSTNAME, USERNAME, PASSWORD)
existing_objects = panos.objects.AddressObject.refreshall(fw, add=False)
# fetched objects from shared location.
Just grab them via the show predefined command:
all_apps = fw.op("<show><predefined><xpath>/predefined/application</xpath></predefined></show>", cmd_xml=False)
app_entries = all_apps.findall('.//application/entry')
Thank you @ngfw-automation , this is cool. but I found a way where we can fetch predefined application objects via SDK too.
pre_defined_objects = panorama.predefined.application_objects.values()
@saipratap99 yes, good find - indeed, you can pull the ApplicationObject instances from there. However, this will be somewhat incomplete in fact. If you use the op command I suggested you'll also be able to find some cool stuff, such as Base64-encoded applications icons, for example.
Thank you @ngfw-automation , I would try op command and see what I can get out of it for predefined app objects. 😃