/** * Inserts a new Arpa record in an existing Arpa zone. * * The record will be inserted in the most specific Arpa zone available. If no zone is * available, an error is returned. If a record already exists, an error is returned. * * ### Request: ### * * ~~~ * { * "reverse_dns": <string>, * } * ~~~ * * ### Response: ### * * ~~~ * true * ~~~ * * ### Errors: ### * * * 508 - Invalid request, missing required parameters or input validation failed. * * 500 - Failed to connect to database or query execution error. * * 409 - Record already exists, or tried to insert a record in a SALVE Arpa zone. * * 404 - Could not find suitable zone. * * @access public * @param mixed $request Request parameters * @param string $identifier IP address * @return Response True if request was successful, error message otherwise. */ public function put($request, $identifier = null) { $response = new FormattedResponse($request); $data = $request->parseData(); if ($data == null) { $response->code = Response::BADREQUEST; $response->error = "Request body was malformed. Ensure the body is in valid format."; $response->error_detail = "BODY_MALFORMED"; return $response; } if (empty($identifier) || !isset($data->reverse_dns)) { $response->code = Response::BADREQUEST; $response->error = "Identifier and/or reverse_dns were missing or invalid. Ensure that the body is in valid format and all required parameters are present."; $response->error_detail = "MISSING_REQUIRED_PARAMETERS"; return $response; } $validator = new ArpaValidator($data); $validator->identifier = $identifier; if (!$validator->validates()) { $response->code = Response::BADREQUEST; $response->error = $validator->getFormattedErrors(); $response->error_detail = $validator->getErrorDetails(); return $response; } return ArpaFunctions::create_arpa($response, $identifier, $data->reverse_dns); }