Esempio n. 1
0
 /**
  * Delete an existing Arpa record.
  *
  * ### Response: ###
  *
  * ~~~
  * true
  * ~~~
  *
  * ### Errors: ###
  *
  * * 508 - Invalid request, missing required parameters or input validation failed.
  * * 500 - Failed to connect to database or query execution error.
  * * 404 - Could not find Arpa zone.
  *
  * @access public
  * @param mixed $request Request parameters
  * @param string $identifier IP address
  * @return Response True if zone was deleted, error message otherwise.
  */
 public function delete($request, $identifier = null)
 {
     $response = new FormattedResponse($request);
     if (empty($identifier)) {
         $response->code = Response::BADREQUEST;
         $response->error = "Identifier was missing or invalid.";
         $response->error_detail = "BODY_MALFORMED";
         return $response;
     }
     $validator = new ArpaValidator();
     $validator->identifier = $identifier;
     if (!$validator->validates()) {
         $response->code = Response::BADREQUEST;
         $response->error = $validator->getFormattedErrors();
         $response->error_detail = $validator->getErrorDetails();
         return $response;
     }
     return ArpaFunctions::delete_arpa($response, $identifier);
 }
Esempio n. 2
0
 public function delete_arpa($response, $identifier, &$out = null)
 {
     ArpaFunctions::get_arpa($response, $identifier, $o, true);
     if (empty($o)) {
         $out = false;
         return $response;
     }
     $record = new stdClass();
     $record->name = $o['name'];
     $record->type = "PTR";
     $record->content = $o['reverse_dns'];
     $record->priority = $o['priority'];
     $req = new stdClass();
     $req->records = array($record);
     $response = ZoneFunctions::delete_records($response, $o['arpa_zone'], $req, $o);
     if (empty($o)) {
         $out = false;
         return $response;
     }
     $response->code = Response::OK;
     $response->body = true;
     $response->log_message = sprintf("Deleted Arpa record for IP %s", $identifier);
     $out = true;
     return $response;
 }