.. highlight:: xml
.. index:: delConfig
.. _delConfig:
``delConfig``
-------------
``delConfig`` deletes DataPower objects. Similar to :ref:`export`, it uses regular expression patterns, which match class names and object names, to determine what to delete.
It is often desirable to delete all objects related to a particular DataPower service, e.g., when deleting a Web services proxy, it may be necessary to delete the policy and the rules used by the proxy. You can accomplish this by deleting all objects prefixed with the name of the service (e.g., "testService.*", as this is the naming convention used by DataPower when creating services. In case there are dependencies between objects (e.g., a rule might be referenced by a policy and so the policy can be deleted only after the rule is deleted), ``delConfig`` will attempt to run the delete request multiple times until all matching objects are deleted.
It has been noticed that some versions of DataPower firmware have a bug causing DataPower to reference a non-existing parent object. This may prevent ``delConfig`` from deleting dependendent objects. To suppress the "object can't be deleted because it's referenced by another object" error, run ``delConfig`` with ``quiet`` set to "true".
Run this command in the "dry-run" mode first to see what objects will be deleted, to avoid deleting items by accident.
You can specify objects to delete using classPattern/namePattern attributes and/or using the nested ``object`` element.
Attributes/Options
^^^^^^^^^^^^^^^^^^
.. list-table::
:widths: 20 80 8
:header-rows: 1
* - Attribute
- Description
- Required
* - objects
- Comma-delimited list of regexp patterns to delete in the format "class:name, class:name". Class and name could be optional, e.g., "class, class" or ":name".
- No
* - exclude
- Comma-delimited list of regexp patterns to exclude from deletion in the format "class:name, class:name".
- No
* - classPattern
- Regular expression defining what classes (types) are to be deleted.
- No
* - namePattern
- Regular expression defining object names to be deleted.
- No
* - quiet
- If set to ``true``, do not fail in case of deletion errors, e.g., if no matching object is found.
Defaults to ``false``, meaning that if any of the nested ``object`` elements did not result in a match, an exception will be thrown.
- No
* - dryRun
- If set to ``true``, do not delete anything, just print the matched objects.
Defaults to ``false``.
- No
* - | domainPatterns
| CLI alias: domains
- Comma-delimited list of regular expression patterns defining what domains to apply the command to. Use '.*' for all domains except the default. Use '.*,default' to include the default domain.
Defaults to the current domain. The current domain is specified using the ``dpDomain`` property or ``domain`` attribute of the task.
- No
``object`` Nested Element
^^^^^^^^^^^^^^^^^^^^^^^^^
.. list-table::
:widths: 20 80 8
:header-rows: 1
* - Attribute
- Description
- Required
* - class
- Regular expression defining what classes (types) to be deleted.
- Yes, unless ``name`` was provided.
* - name
- Regular expression defining object names to be deleted.
- Yes, unless ``class`` was provided.
Examples
^^^^^^^^
This example deletes the Web services proxies with the name starting with "test". If no such proxy exists, the task will complete successfully because of the "quiet" setting.
.. code-block:: bat
dpbuddy delConfig -quiet -objects "WSGateway:test.*"
.. code-block:: xml
You can find more examples under ``samples`` in your distribution or `online `_.