Skip to content
Snippets Groups Projects
Commit 2829a4f8 authored by Artem Dobrynin (EPAM)'s avatar Artem Dobrynin (EPAM)
Browse files

GONRG-1546: Audit. Implement some audit events for Indexer [publish]

parent 1754e60b
No related branches found
No related tags found
1 merge request!74Audit Logger Implementation (GONRG-1546)
......@@ -19,6 +19,7 @@ import com.google.gson.Gson;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import lombok.extern.java.Log;
......@@ -28,6 +29,7 @@ import org.opengroup.osdu.core.common.model.indexer.RecordInfo;
import org.opengroup.osdu.core.common.model.search.RecordChangedMessages;
import org.opengroup.osdu.core.common.model.search.SearchServiceRole;
import org.opengroup.osdu.indexer.SwaggerDoc;
import org.opengroup.osdu.indexer.logging.AuditLogger;
import org.opengroup.osdu.indexer.service.IndexerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
......@@ -46,6 +48,9 @@ public class CleanupIndiciesApi {
@Autowired
private IndexerService indexerService;
@Autowired
private AuditLogger auditLogger;
@PostMapping(path = "/index-cleanup", consumes = "application/json")
@PreAuthorize("@authorizationFilter.hasPermission('" + SearchServiceRole.ADMIN + "')")
public ResponseEntity cleanupIndices(@NotNull(message = SwaggerDoc.REQUEST_VALIDATION_NOT_NULL_BODY)
......@@ -69,6 +74,10 @@ public class CleanupIndiciesApi {
return new ResponseEntity(HttpStatus.OK);
}
indexerService.processSchemaMessages(recordInfos);
auditLogger.getIndexCleanUpJobRun(recordInfos.stream()
.map(RecordInfo::getKind)
.collect(Collectors.toList()));
return new ResponseEntity(HttpStatus.OK);
} catch (AppException e) {
throw e;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment