Module: predefined

Inheritance diagram

Inheritance diagram of panos.predefined

Class Reference

Retrieving and parsing predefined objects from the firewall

class panos.predefined.Predefined(device=None, *args, **kwargs)[source]

Predefined Objects Subsystem of Firewall

A member of a base.PanDevice object that has special methods for interacting with the predefined objects of the firewall

This class is typically not instantiated by anything but the base.PanDevice class itself. There is an instance of this Predefined class inside every instantiated base.PanDevice class.

Parameters:device (base.PanDevice) – The firewall or Panorama this Predefined subsystem leverages
application(name, refresh_if_none=True, include_containers=True)[source]

Get a Predefined Application

Return the instance of the application from the given name.

Parameters:
  • name (str) – Name of the application
  • refresh_if_none (bool) – Refresh the application if it is not found
  • include_containers (bool) – also search application containers if no match found
Returns:

Either an ApplicationObject, ApplicationContainerObject, or None

applications(names, refresh_if_none=True, include_containers=True)[source]

Get a list of Predefined Applications

Return a list of the instances of the applications from the given names.

Parameters:
  • names (list) – Names of the applications
  • refresh_if_none (bool) – Refresh the application(s) if it is not found
  • include_containers (bool) – also search application containers if no match found
Returns:

A list of all found ApplicationObjects or ApplicationContainerObjects

object(name, classtype, refresh_if_none=True)[source]

Get object by classtype

For example, if you pass in panos.objects.ApplicationObject as the classtype, an application will be returned

Parameters:
  • name (str) – Name of the object
  • classtype – The class of the object (eg. panos.objects.ApplicationObject
  • refresh_if_none (bool) – Refresh the object if it is not found
objects(names, classtype, refresh_if_none=True)[source]

Get a list of objects by classtype

For example, if you pass in panos.objects.ApplicationObject as the classtype, a list of application will be returned

Parameters:
  • names (list) – List of names of the objects
  • classtype – The class of the object (eg. panos.objects.ApplicationObject
  • refresh_if_none (bool) – Refresh the object if it is not found
refresh_application(name)[source]

Refresh a Single Predefined Application

This method refreshes single predefined application or application container (predefined only object).

Parameters:name (str) – Name of the application to refresh
refresh_service(name)[source]

Refresh a Single Predefined Service

This method refreshes single predefined service (predefined only object).

Parameters:name (str) – Name of the service to refresh
refresh_tag(name)[source]

Refresh a Single Predefined Tag

This method refreshes single predefined tag (predefined only object).

Parameters:name (str) – Name of the tag to refresh
refreshall()[source]

Refresh all Predefined Objects

This method refreshes all predefined objects. This includes applications, application containers, services, and tags.

CAUTION: This method requires a lot of overhead on the device api to respond. Response time will vary by platform, but know that it will generally take longer than a normal api request.

refreshall_applications()[source]

Refresh all Predefined Applications

This method refreshes all predefined applications and application containers.

CAUTION: This method requires a lot of overhead on the device api to respond. Response time will vary by platform, but know that it will generally take longer than a normal api request.

refreshall_services()[source]

Refresh all Predefined Services

This method refreshes all predefined services.

refreshall_tags()[source]

Refresh all Predefined Tags

This method refreshes all predefined tag objects

service(name, refresh_if_none=True)[source]

Get a Predefined Service

Return the instance of the service from the given name.

Parameters:
  • name (str) – Name of the service
  • refresh_if_none (bool) – Refresh the service if it is not found
Returns:

Either a ServiceObject or None

services(names, refresh_if_none=True)[source]

Get a list of Predefined Services

Return a list of the instances of the services from the given names.

Parameters:
  • names (list) – Names of the services
  • refresh_if_none (bool) – Refresh the service(s) if it is not found
Returns:

A list of all found ServiceObjects

tag(name, refresh_if_none=True)[source]

Get a Predefined Tag

Return the instance of the tag from the given name.

Parameters:
  • name (str) – Name of the tag
  • refresh_if_none (bool) – Refresh the tag if it is not found
Returns:

Either a Tag or None

tags(names, refresh_if_none=True)[source]

Get a list of Predefined Tags

Return a list of the instances of the tags from the given names.

Parameters:
  • names (list) – Names of the tags
  • refresh_if_none (bool) – Refresh the tag(s) if it is not found
Returns:

A list of all found Tags