Selecting DataPower Objects in DPBuddy Commands¶
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
classPattern options defining what configuration objects to delete. Similarly, the export command’s
objects option defines what objects to export.
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.
assertState, quiesce and unquiesce, export commands support providing a list of class/name patterns to include (
object option) or exclude (
exclude option). The list is a comma-delimited list of regexp patterns in the format “class:name, class:name”. Class and name could be optional, e.g., “class, class” or “:name”.
You can also use regular expression to exclude objects. This can be achieved using “negative lookahead” syntax, e.g.,
Match all HTTP front side handlers:
<object class="HTTPSourceProtocolHa.*" />
Match all objects (irrespective of the class) with the name starting with “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.*)" />
Exclude certain classes from export, e.g., exclude all Crypto objects:
dpbuddy export -file all-objects.xml -objects ".*" -exclude "Crypto.*"