use of org.apache.zeppelin.rest.message.NewInterpreterSettingRequest in project zeppelin by apache.
the class InterpreterRestApi method newSettings.
/**
* Add new interpreter setting
*
* @param message NewInterpreterSettingRequest
*/
@POST
@Path("setting")
@ZeppelinApi
public Response newSettings(String message) {
try {
NewInterpreterSettingRequest request = gson.fromJson(message, NewInterpreterSettingRequest.class);
if (request == null) {
return new JsonResponse<>(Status.BAD_REQUEST).build();
}
Properties p = new Properties();
p.putAll(request.getProperties());
InterpreterSetting interpreterSetting = interpreterSettingManager.createNewSetting(request.getName(), request.getGroup(), request.getDependencies(), request.getOption(), p);
logger.info("new setting created with {}", interpreterSetting.getId());
return new JsonResponse<>(Status.OK, "", interpreterSetting).build();
} catch (InterpreterException | IOException e) {
logger.error("Exception in InterpreterRestApi while creating ", e);
return new JsonResponse<>(Status.NOT_FOUND, e.getMessage(), ExceptionUtils.getStackTrace(e)).build();
}
}
Aggregations