roaldnefs / python-transip

Python wrapper for the TransIP API. It allows you to create, read and update resources on TransIP with ease using Python.
https://python-transip.readthedocs.io
GNU Lesser General Public License v3.0
8 stars 6 forks source link

Allow API to delete objects #34

Closed sauloal closed 3 years ago

sauloal commented 3 years ago

Is your feature request related to a problem? Please describe. I want do delete a DNS key.

Describe the solution you'd like Implement the delete function dor DNS

Describe alternatives you've considered

Additional context no

roaldnefs commented 3 years ago

Thanks @sauloal for your feature request. I'll try to implement the DNS-record deletion this weekend.

Please let me know if your are missing more features, to allow me to prioritise the implementation of the (yet) missing endpoints.

sauloal commented 3 years ago

I've created another request to also allow for updating a DNS.

This in a effort to run certbot from let's encrypt automatically.

In the meantime I've managed to call the API directly using your client.request.

Regards

roaldnefs commented 3 years ago

I've just wrote a proof of concept in #37, this would allow you to delete a DNS entry by specifying all the required attributes, e.g.:

from transip import TransIP

client = TransIP(access_token="REDACTED")

domain = self.client.domains.get("example.com")
domain.dns.delete({
    "name": "www",
    "expire": 86400,
    "type": "A",
    "content": "127.0.0.1"
})

I'll also try to add the delete() method on a transip.v6.objects.DnsEntry instance tomorrow. This would allow you to delete the DNS entry from the returned object itself, e.g.:

from transip import TransIP

client = TransIP(access_token="REDACTED")

domain = self.client.domains.get("example.com")

for entry in domain.dns.list():
    entry.delete()
roaldnefs commented 3 years ago

Just merged the feature to delete DNS records of a domain, for more information see https://github.com/roaldnefs/python-transip#remove-a-dns-entry-from-a-domain.

This feature will be in the next release, I'll try to make a new release tomorrow.

sauloal commented 3 years ago

Fantastic! Thanks for the quick action!