13.4. export
¶
The export
task exports configuration from a domain. The task supports all functions of the WebGUI “Export configuration” screen and provides some additional features.
Both XML/XCFG and ZIP file formats are supported. The format is determined automatically based on the provided file extension. “xml” and “xcfg” are treated as XML, all other extensions are treated as ZIP.
export
supports the nested transform
element containing the transformation actions described earlier. This can be used, for example, to replace actual values, such as port numbers with Ant/Groovy/Gradle variables. Later on, when the configuration is imported using import
, the variables will be automatically resolved. Note that transform
can only be used with the XML configuration format.
DataPower embeds base64-encoded files into the exported XML configuration, including several WebGUI-related files. This makes it difficult to edit the configuration file or track changes. The export
task removes all files from the exported configuration by default. It also removes the “interfaces” section of the exported configuration. Finally, export
formats the configuration using indentation. As with transform
, these changes are only performed to XML configuration; configuration in ZIP format is saved unchanged. This feature can be turned off using the defaultTransform
attribute.
Transforming and formatting XML configuration files makes it easier to store configuration under version control and to track the history of changes.
You can also provide a deployment policy as part of the export task. DataPower will add the policy to the resulting export configuration file. The policy will then be “activated” upon import.
Export and import can be used together to update configuration or to copy configuration between devices/domains. Simply run export first, save the configuration to a file and then run import using the same file.
13.4.1. Attributes/Options¶
Attribute | Description | Required |
---|---|---|
file | Name of the file to which the exported configuration should be saved. The task will create directories containing the file if they don’t exist. The file must have “zip” or “xml” or “xcfg” extension. |
Yes |
classPattern | Regular expression defining what classes (types) to export, e.g., “WSGateway”. If Specifying |
No |
namePattem | Only the objects whose name matched this regexp will be exported. If |
No |
namePattems | Comma-delimited list of regular expression patterns. Only DataPower objects that match at least one pattern will be exported. Objects will be exported irrespective of their class (type). This attribute is useful when you want to export all objects based on a naming convention. It can also be used to export a list of uniquely named objects without having to worry about what their classes are. Note: this attribute is deprecated. Use the |
No |
allFiles | If set to If not specified, only the referenced files will be exported. For export in XML format, this setting will be ignored unless Defaults to |
No |
persisted | If set to Defaults to |
No |
deploymentPolicyFile | Path to the deployment policy file on the local machine. The deployment policy is automatically uploaded/configured on the device before the request is executed. The deployment policy will be embedded with the export file. |
No |
deploymentPolicyName | Name of the deployment policy to include with the export/backup. The policy has to already be defined on the device. The deployment policy will be embedded with the export file. |
No |
defaultTransform | If set to Defaults to |
No |
13.4.2. exportObject
Nested Element¶
This nested element defines the objects that will be part of the export. Its two key attributes are class
and name
. Both attributes are optional, and both support regular expressions. This gives you a lot of flexibility; you can define regexps matching classes, objects, or both.
If you omit both class
and name
, all configuration objects of the domain will be exported. Likewise, if you do not provide any nested exportObject
, all objects will be exported.
exportObject
supports other attributes, such as includeDebug
. These attributes will be applied to all matched objects.
You can specify multiple exportObject
elements within the same task. Alternatively, you can use “|” (OR) in your regular expressions. For example, you can use the following expression in “class” to export all Web service gateways and XML firewalls: (WSGateway|XMLFirewall.*)
.
Attribute | Description | Required |
---|---|---|
class | Regular expression defining what classes (types) to export, e.g., “WSGateway”. If |
No |
name | Regular expression defining objects to be exported. Only the objects whose name matched this regexp will be exported. If |
No |
refObjects | If set to true, include all objects referenced/required by this object. Defaults to |
No |
refFiles | Include all files referenced by this object. Defaults to |
No |
includeDebug | Include debug information in the export. Defaults to |
No |
13.4.3. transform
Nested Element¶
transform
contains the transformation actions documented in Using DPBuddy to Transform DataPower Configuration and XML Files. This element is optional. It can only be specified if exporting a configuration in XML format.
13.4.4. namePattern
Nested Element¶
The namePattern
element provides an alternative to specifying object name patterns using the namePatterns
attribute. It is useful when a regular expression pattern contains a comma, which is used as a delimiter in the namePatterns
attribute.
You can specify multiple namePattern
elements within the same task.
Note: namePattern
element is deprecated. Use exportObject
nested element instead.
Attribute | Description | Required |
---|---|---|
pattern | Export object with names matching this regular expression. | Yes |
13.4.5. Examples¶
The following example exports all objects with the name starting with “testService” and of the classes with the names starting with “WSG” (which would match “WSGateway”).
dpbuddy export -file services.zip -classPattern="WSG.*" -namePattern="testService.*"
<dp:export file="${wsproxy.file}" allFiles="false" >
<exportObject class="WSG.*" name="testService.*"
</dp:export>
You can find more examples under samples
in your distribution or online.