Forum Discussion

Mudpuppy_182361's avatar
Mudpuppy_182361
Icon for Nimbostratus rankNimbostratus
Sep 12, 2015

Rest API call to delete all objects in a partition

Is there a API call that will allow me to delete a partition and all objects in it?

 

If not,

 

How can I list all objects in a partition and go about deleting them, then finally deleting the partition.

 

4 Replies

  • Never seen an API call that could delete all objects.

     

    But if you just want to do this once you can just replace the "/config/partitions/[partition name]/bigip.conf" with an empty file and run "tmsh load sys config". Then remove the partition in the UI.

     

    /Patrik

     

  • Hmm. Good idea. Not sure how I would automate it. Also It may leave dangling ssl certs / etc on the file system.

     

    Thank you for the information.

     

  • There should be a direct way to do this. Many of the function calls require you to filter out the objects of a partition you want to delete then do a bunch of non-sense to delete all of them.

     

    There should be a call that deletes all objects owned by a partition. Then deletes the partition itself.

     

  • On my phone now so can't verify this. Be careful and make sure you have good parameter validation when using it.

    $ curl -sk -u 'admin:admin' -H 'Content-Type: application/json' -X POST  \
        -d '{"command": "run", "utilCmdArgs": "-c \"rm /config/partitions/mypartition/bigip.conf\""}' \ https://$HOST/mgmt/tm/util/bash | jq        
    

    /Patrik