zfs.resource.destroy
====================

Destroy a ZFS resource (filesystem, volume, or snapshot).

This method provides an interface for destroying ZFS resources with support         for recursive deletion, clone removal, hold removal, and batch snapshot deletion.

Args: data (dict): Dictionary containing destruction parameters: - path (str): Path of the ZFS resource to destroy. Must be in the form                     'pool/name', 'pool/name@snapshot', or 'pool/zvol'. Cannot be an absolute path or end with a forward slash. - recursive (bool, optional): If True, recursively destroy all descendants. For snapshots, destroys the snapshot across all descendant resources and                     also destroy clones and/or holds that may be present. Default: False. - all_snapshots (bool, optional): If True, destroy all snapshots of the                     specified resource (resource remains). Default: False.

Returns: None: On successful destruction.

Raises: ValidationError: Raised in the following cases: - Resource does not exist (ENOENT) - Resource has children and recursive=False (EBUSY) - Attempting to destroy root filesystem - Path is absolute (starts with /) - Path ends with forward slash - Path references protected internal resources

Examples: # Destroy a simple filesystem destroy({"path": "tank/temp"})

    # Recursively destroy filesystem, snapshots, clones, holds # and all children destroy({"path": "tank/parent", "recursive": True})

    # Destroy a specific snapshot destroy({"path": "tank/temp@snapshot1"})

    # Recursively destroy the snapshot across all descendant # resources including clone(s), and/or hold(s) destroy({"path": "tank/parent@snap", "recursive": True})

    # Destroy all snapshots of a resource (keeping "tank/temp") destroy({"path": "tank/temp", "all_snapshots": True})

Notes: - Root filesystem destruction is not allowed for safety - Protected system paths cannot be destroyed via API - When destroying snapshots recursively, only matching snapshots in descendant datasets are removed - The all_snapshots flag only removes snapshots, not the dataset itself - For volumes with snapshots, either use recursive=True or all_snapshots=True

.. raw:: html

    <div id="json-schema">
    <span class="badge badge-dark value-type">Type: object</span><br/>
    <div class="accordion" id="accordionCall_parameters">
    <div class="card">
    <div class="card-header" id="headingCall_parameters">
    <h2 class="mb-0">
    <button aria-controls="Call_parameters" aria-expanded="" class="btn btn-link property-name-button" data-target="#Call_parameters" data-toggle="collapse" onclick="setAnchor('#Call_parameters')" type="button"><span class="property-name">Call parameters</span></button>
    </h2>
    </div>
    <div aria-labelledby="headingCall_parameters" class="collapse property-definition-div" data-parent="#accordionCall_parameters" id="Call_parameters">
    <div class="card-body pl-5">
    <span class="badge badge-dark value-type">Type: array</span><br/>
    <span class="badge badge-info no-additional">No Additional Items</span><h4>Tuple Validation</h4>
    <h5>Parameter 1: zfs_resource_destroy_args</h5>
    <div class="card">
    <div class="card-body items-definition" id="Call_parameters_items_i0">
    <h4>zfs_resource_destroy_args</h4><span class="badge badge-dark value-type">Type: object</span><br/>
    <span class="description"><p>ZFSResourceDestroyArgs parameters.</p>
    </span> <span class="badge badge-info no-additional">No Additional Properties</span>
    <div class="accordion" id="accordionCall_parameters_items_i0_path">
    <div class="card">
    <div class="card-header" id="headingCall_parameters_items_i0_path">
    <h2 class="mb-0">
    <button aria-controls="Call_parameters_items_i0_path" aria-expanded="" class="btn btn-link property-name-button" data-target="#Call_parameters_items_i0_path" data-toggle="collapse" onclick="setAnchor('#Call_parameters_items_i0_path')" type="button"><span class="property-name">path</span> <span class="badge badge-warning required-property">Required</span></button>
    </h2>
    </div>
    <div aria-labelledby="headingCall_parameters_items_i0_path" class="collapse property-definition-div" data-parent="#accordionCall_parameters_items_i0_path" id="Call_parameters_items_i0_path">
    <div class="card-body pl-5">
    <h4>Path</h4><span class="badge badge-dark value-type">Type: string</span><br/>
    <span class="description"><p>Path of the zfs resource to be destroyed.</p>
    </span>
    <p><span class="badge badge-light restriction min-length-restriction" id="Call_parameters_items_i0_path_minLength">Must be at least <code>1</code> characters long</span></p>
    </div>
    </div>
    </div>
    </div>
    <div class="accordion" id="accordionCall_parameters_items_i0_recursive">
    <div class="card">
    <div class="card-header" id="headingCall_parameters_items_i0_recursive">
    <h2 class="mb-0">
    <button aria-controls="Call_parameters_items_i0_recursive" aria-expanded="" class="btn btn-link property-name-button" data-target="#Call_parameters_items_i0_recursive" data-toggle="collapse" onclick="setAnchor('#Call_parameters_items_i0_recursive')" type="button"><span class="property-name">recursive</span></button>
    </h2>
    </div>
    <div aria-labelledby="headingCall_parameters_items_i0_recursive" class="collapse property-definition-div" data-parent="#accordionCall_parameters_items_i0_recursive" id="Call_parameters_items_i0_recursive">
    <div class="card-body pl-5">
    <h4>Recursive</h4><span class="badge badge-dark value-type">Type: boolean</span> <span class="badge badge-success default-value">Default: false</span><br/>
    <span class="description"><p>Recursively destroy all descendants of the resource. This will also     release any holds and destroy any clones for any of the descendants of     the resource being deleted.</p>
    <p>If you want to recursively remove a particular snapshot     from all descendants. You must set the <code>path</code> string to a snapshot     (i.e. dozer/a@snap01) and set this to True. This will recursively     destroy all snapshots named <code>snap01</code> from any descendants of dozer/a.</p>
    <p>If you want to destroy all snapshots for a particular resource, then     you must pass the <code>path</code> string as "pool/name" and set the all_snapshots     flag to True. This will leave "pool/name" on disk but will remove all     snapshots (and clones/holds) recursively for that resource.</p>
    </span>
    </div>
    </div>
    </div>
    </div>
    <div class="accordion" id="accordionCall_parameters_items_i0_all_snapshots">
    <div class="card">
    <div class="card-header" id="headingCall_parameters_items_i0_all_snapshots">
    <h2 class="mb-0">
    <button aria-controls="Call_parameters_items_i0_all_snapshots" aria-expanded="" class="btn btn-link property-name-button" data-target="#Call_parameters_items_i0_all_snapshots" data-toggle="collapse" onclick="setAnchor('#Call_parameters_items_i0_all_snapshots')" type="button"><span class="property-name">all_snapshots</span></button>
    </h2>
    </div>
    <div aria-labelledby="headingCall_parameters_items_i0_all_snapshots" class="collapse property-definition-div" data-parent="#accordionCall_parameters_items_i0_all_snapshots" id="Call_parameters_items_i0_all_snapshots">
    <div class="card-body pl-5">
    <h4>All Snapshots</h4><span class="badge badge-dark value-type">Type: boolean</span> <span class="badge badge-success default-value">Default: false</span><br/>
    <span class="description"><p>Remove all snapshots for resource being destroyed.</p>
    </span>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    <div class="accordion" id="accordionReturn_value">
    <div class="card">
    <div class="card-header" id="headingReturn_value">
    <h2 class="mb-0">
    <button aria-controls="Return_value" aria-expanded="" class="btn btn-link property-name-button" data-target="#Return_value" data-toggle="collapse" onclick="setAnchor('#Return_value')" type="button"><span class="property-name">Return value</span></button>
    </h2>
    </div>
    <div aria-labelledby="headingReturn_value" class="collapse property-definition-div" data-parent="#accordionReturn_value" id="Return_value">
    <div class="card-body pl-5">
    <h4>Result</h4><span class="badge badge-dark value-type">Type: null</span><br/>
    </div>
    </div>
    </div>
    </div>
    </div><br><br>

*Required roles:* ZFS_RESOURCE_WRITE

