@GET
    @Path("{guid}/audit")
    @Produces(Servlets.JSON_MEDIA_TYPE)
    public Response getAuditEvents(@PathParam("guid") String guid, @QueryParam("startKey") String startKey,
                                   @QueryParam("count") @DefaultValue("100") short count) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("==> EntityResource.getAuditEvents({}, {}, {})", guid, startKey, count);
        }

        AtlasPerfTracer perf = null;

        if (LOG.isDebugEnabled()) {
            LOG.debug("Audit events request for entity {}, start key {}, number of results required {}", guid, startKey, count);
        }

        try {
            if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityResource.getAuditEvents(" + guid + ", " + startKey + ", " + count + ")");
            }

            List<EntityAuditEvent> events = metadataService.getAuditEvents(guid, startKey, count);

            JSONObject response = new JSONObject();
            response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
            response.put(AtlasClient.EVENTS, getJSONArray(events));
            return Response.ok(response).build();
        } catch (AtlasException | IllegalArgumentException e) {
            LOG.error("Unable to get audit events for entity guid={} startKey={}", guid, startKey, e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
        } catch (WebApplicationException e) {
            LOG.error("Unable to get audit events for entity guid={} startKey={}", guid, startKey, e);
            throw e;
        } catch (Throwable e) {
            LOG.error("Unable to get audit events for entity guid={} startKey={}", guid, startKey, e);
            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
        } finally {
            AtlasPerfTracer.log(perf);

            if (LOG.isDebugEnabled()) {
                LOG.debug("<== EntityResource.getAuditEvents({}, {}, {})", guid, startKey, count);
            }
        }
    }
@ GET @ Path ( "{guid}/audit" ) @ Produces ( Servlets . JSON_MEDIA_TYPE ) public Response getAuditEvents ( @ PathParam ( "guid" ) String guid , @ QueryParam ( "startKey" ) String startKey , @ QueryParam ( "count" ) @ DefaultValue ( "100" ) short count ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "==> EntityResource.getAuditEvents({}, {}, {})" , guid , startKey , count ) ; } AtlasPerfTracer perf = null ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Audit events request for entity {}, start key {}, number of results required {}" , guid , startKey , count ) ; } try { if ( AtlasPerfTracer . isPerfTraceEnabled ( PERF_LOG ) ) { perf = AtlasPerfTracer . getPerfTracer ( PERF_LOG , "EntityResource.getAuditEvents(" + guid + ", " + startKey + ", " + count + ")" ) ; } List < EntityAuditEvent > events = metadataService . getAuditEvents ( guid , startKey , count ) ; JSONObject response = new JSONObject ( ) ; response . put ( AtlasClient . REQUEST_ID , Servlets . getRequestId ( ) ) ; response . put ( AtlasClient . EVENTS , getJSONArray ( events ) ) ; return Response . ok ( response ) . build ( ) ; } catch ( AtlasException | IllegalArgumentException e ) { LOG . error ( "Unable to get audit events for entity guid={} startKey={}" , guid , startKey , e ) ; throw new WebApplicationException ( Servlets . getErrorResponse ( e , Response . Status . BAD_REQUEST ) ) ; } catch ( WebApplicationException e ) { LOG . error ( "Unable to get audit events for entity guid={} startKey={}" , guid , startKey , e ) ; throw e ; } catch ( Throwable e ) { LOG . error ( "Unable to get audit events for entity guid={} startKey={}" , guid , startKey , e ) ; throw new WebApplicationException ( Servlets . getErrorResponse ( e , Response . Status . INTERNAL_SERVER_ERROR ) ) ; } finally { AtlasPerfTracer . log ( perf ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "<== EntityResource.getAuditEvents({}, {}, {})" , guid , startKey , count ) ; } } }
Returns the entity audit events for a given entity id. The events are returned in the decreasing order of timestamp.
@param guid entity id
@param startKey used for pagination. Startkey is inclusive, the returned results contain the event with the given startkey.
First time getAuditEvents() is called for an entity, startKey should be null,
with count = (number of events required + 1). Next time getAuditEvents() is called for the same entity,
startKey should be equal to the entityKey of the last event returned in the previous call.
@param count number of events required
@return