]> granicus.if.org Git - pdns/commitdiff
webserver: add DELETE /../zones/<id>
authorChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 28 Jan 2014 20:27:51 +0000 (21:27 +0100)
committerChristian Hofstaedtler <christian@hofstaedtler.name>
Tue, 28 Jan 2014 20:27:51 +0000 (21:27 +0100)
pdns/ws.cc

index 3edd78c74a60db29445eb82729646307a83de3e7..4b54eaf423667774513d4d8787d8368918108e02 100644 (file)
@@ -580,6 +580,20 @@ static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp) {
     resp->body = getZone(zonename);
     return;
   }
+  else if(req->method == "DELETE") {
+    // delete domain
+    UeberBackend B;
+    DomainInfo di;
+    if(!B.getDomainInfo(zonename, di))
+      throw ApiException("Could not find domain '"+zonename+"'");
+
+    if(!di.backend->deleteDomain(zonename))
+      throw ApiException("Deleting domain '"+zonename+"' failed: backend delete failed/unsupported");
+
+    // empty body on success
+    resp->body = "";
+    return;
+  }
 
   if(req->method != "GET")
     throw HttpMethodNotAllowedException();