10. Use or Regular Expressions to Select DataPower Objects

Many DPBuddy tasks/commands can be applied to multiple DataPower configuration objects. You can see a full list of the configuration objects available in your environment by expanding “Objects” in the DataPower WebGUI.

Each object has a “class” (type) and a name. Classes are defined in the DataPower XML Management schema. You can see the list of all classes under the definition of “AnyConfigElement” in “xml-mgmt.xsd”.

If you look at any DataPower configuration file created using export, child elements of the “configuration” element are class names.

DPBuddy allows for using regular expressions to match DataPower objects. For example, delConfig task supports nested object elements defining what configuration objects to delete. Similarly, the export task’s nested exportObject elements define what objects to export.

You can also use the classPattern and namePattern options/attributes to specify the regexps. These options should be used with DPBuddy CLI. Nested elements are not supported by DPBuddy CLI commands; they are only supported by Ant tasks.

DPBuddy selects objects based on matching class names and/or object names. Only one of the two is required; you can select configuration objects based on just the class name, based on just the object name, or based on both. In the case of export, all objects will be selected if both class and name attributes are omitted.

Note that your regular expression needs to match the entire name and not just a substring within a name, so use ”.*” where needed.

10.1. Examples

Match all HTTP front side handlers:

<object class="HTTPSourceProtocolHa.*" />

Match all objects (irrespective of the class) with the name starting with “Test”:

<object name="Test.*"/>

Match all HTTP front site handlers whose name starts with “Test”:

<object class="HTTPSourceProtocolHa.*" name="Test.*"/>

You can use “or” regular expressions if you need to select objects matching multiple classes and/or names. The example below selects all WS proxies and firewalls:

<exportObject class="(WSGatew.*|.*Firewall.*)" />