:param server_id: The name of the server
:param zone_id: The id number of the :json:object:`Zone`
+
+.. http:put:: /api/v1/servers/:server_id/zones/:zone_id/rectify
+
+ Rectify the zone data. This does not take into account the :ref:`metadata-api-rectify` metadata.
+
+ :param server_id: The name of the server
+ :param zone_id: The id number of the :json:object:`Zone`
+
+ Fails on slave zones and zones that do not have DNSSEC.
resp->setSuccessResult("Notification queued");
}
+static void apiServerZoneRectify(HttpRequest* req, HttpResponse* resp) {
+ DNSName zonename = apiZoneIdToName(req->parameters["id"]);
+
+ if(req->method != "PUT")
+ throw HttpMethodNotAllowedException();
+
+ UeberBackend B;
+ DomainInfo di;
+ if(!B.getDomainInfo(zonename, di))
+ throw ApiException("Could not find domain '"+zonename.toString()+"'");
+
+ DNSSECKeeper dk(&B);
+
+ if (!dk.isSecuredZone(zonename))
+ throw ApiException("Zone '" + zonename.toString() + "' is not DNSSEC signed, not rectifying.");
+
+ if (di.kind == DomainInfo::Slave)
+ throw ApiException("Zone '" + zonename.toString() + "' is a slave zone, not rectifying.");
+
+ string error_msg = "";
+ if (!dk.rectifyZone(zonename, error_msg))
+ throw ApiException("Failed to rectify '" + zonename.toString() + "' " + error_msg);
+
+ resp->setSuccessResult("Rectified");
+}
+
static void makePtr(const DNSResourceRecord& rr, DNSResourceRecord* ptr) {
if (rr.qtype.getCode() == QType::A) {
uint32_t ip;
d_ws->registerApiHandler("/api/v1/servers/localhost/zones/<id>/metadata/<kind>", &apiZoneMetadataKind);
d_ws->registerApiHandler("/api/v1/servers/localhost/zones/<id>/metadata", &apiZoneMetadata);
d_ws->registerApiHandler("/api/v1/servers/localhost/zones/<id>/notify", &apiServerZoneNotify);
+ d_ws->registerApiHandler("/api/v1/servers/localhost/zones/<id>/rectify", &apiServerZoneRectify);
d_ws->registerApiHandler("/api/v1/servers/localhost/zones/<id>", &apiServerZoneDetail);
d_ws->registerApiHandler("/api/v1/servers/localhost/zones", &apiServerZones);
d_ws->registerApiHandler("/api/v1/servers/localhost", &apiServerDetail);