Search in sources :

Example 36 with JsonResponse

use of org.apache.zeppelin.server.JsonResponse in project SSM by Intel-bigdata.

the class CredentialRestApi method getCredentials.

/**
 * Get User Credentials list REST API
 * @param
 * @return JSON with status.OK
 * @throws IOException, IllegalArgumentException
 */
@GET
public Response getCredentials(String message) throws IOException, IllegalArgumentException {
    String user = SecurityUtils.getPrincipal();
    logger.info("getCredentials credentials for user {} ", user);
    UserCredentials uc = credentials.getUserCredentials(user);
    return new JsonResponse(Status.OK, uc).build();
}
Also used : UserCredentials(org.apache.zeppelin.user.UserCredentials) JsonResponse(org.apache.zeppelin.server.JsonResponse)

Example 37 with JsonResponse

use of org.apache.zeppelin.server.JsonResponse in project SSM by Intel-bigdata.

the class HeliumRestApi method suggest.

@GET
@Path("suggest/{noteId}/{paragraphId}")
public Response suggest(@PathParam("noteId") String noteId, @PathParam("paragraphId") String paragraphId) {
    Note note = notebook.getNote(noteId);
    if (note == null) {
        return new JsonResponse(Response.Status.NOT_FOUND, "Note " + noteId + " not found").build();
    }
    Paragraph paragraph = note.getParagraph(paragraphId);
    if (paragraph == null) {
        return new JsonResponse(Response.Status.NOT_FOUND, "Paragraph " + paragraphId + " not found").build();
    }
    return new JsonResponse(Response.Status.OK, "", helium.suggestApp(paragraph)).build();
}
Also used : Note(org.apache.zeppelin.notebook.Note) JsonResponse(org.apache.zeppelin.server.JsonResponse) Paragraph(org.apache.zeppelin.notebook.Paragraph)

Aggregations

JsonResponse (org.apache.zeppelin.server.JsonResponse)37 ZeppelinApi (org.apache.zeppelin.annotation.ZeppelinApi)22 Path (javax.ws.rs.Path)20 IOException (java.io.IOException)12 POST (javax.ws.rs.POST)12 UserCredentials (org.apache.zeppelin.user.UserCredentials)8 PUT (javax.ws.rs.PUT)6 Note (org.apache.zeppelin.notebook.Note)6 GET (javax.ws.rs.GET)5 Paragraph (org.apache.zeppelin.notebook.Paragraph)5 AuthenticationInfo (org.apache.zeppelin.user.AuthenticationInfo)5 HashMap (java.util.HashMap)4 Subject (org.apache.shiro.subject.Subject)4 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)4 InterpreterException (org.apache.zeppelin.interpreter.InterpreterException)4 Map (java.util.Map)3 DELETE (javax.ws.rs.DELETE)3 InterpreterSetting (org.apache.zeppelin.interpreter.InterpreterSetting)3 MetaStoreException (org.smartdata.metastore.MetaStoreException)3 UserInfo (org.smartdata.model.UserInfo)3