Skip to content
Snippets Groups Projects
Commit df5bd776 authored by Smitha Manjunath's avatar Smitha Manjunath
Browse files

add delete api

parent 786d1cd6
No related branches found
No related tags found
2 merge requests!346Merge branch 'aws-integration' into 'master',!273Delete api
...@@ -31,6 +31,7 @@ import org.opengroup.osdu.core.common.model.indexer.RecordInfo; ...@@ -31,6 +31,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.RecordChangedMessages;
import org.opengroup.osdu.core.common.model.search.SearchServiceRole; import org.opengroup.osdu.core.common.model.search.SearchServiceRole;
import org.opengroup.osdu.core.common.model.storage.validation.ValidKind; import org.opengroup.osdu.core.common.model.storage.validation.ValidKind;
import org.opengroup.osdu.core.common.model.storage.validation.ValidKind;
import org.opengroup.osdu.core.common.search.ElasticIndexNameResolver; import org.opengroup.osdu.core.common.search.ElasticIndexNameResolver;
import org.opengroup.osdu.indexer.SwaggerDoc; import org.opengroup.osdu.indexer.SwaggerDoc;
import org.opengroup.osdu.indexer.logging.AuditLogger; import org.opengroup.osdu.indexer.logging.AuditLogger;
...@@ -67,7 +68,7 @@ public class CleanupIndiciesApi { ...@@ -67,7 +68,7 @@ public class CleanupIndiciesApi {
@Inject @Inject
private IndicesServiceImpl indicesService; private IndicesServiceImpl indicesService;
private static final String ENTITLEMENT_GROUP = "users.datalake.ops";
@ApiIgnore @ApiIgnore
@PostMapping(path = "/index-cleanup", consumes = "application/json") @PostMapping(path = "/index-cleanup", consumes = "application/json")
...@@ -108,7 +109,7 @@ public class CleanupIndiciesApi { ...@@ -108,7 +109,7 @@ public class CleanupIndiciesApi {
} }
@DeleteMapping(value = "/index", produces = MediaType.APPLICATION_JSON_VALUE) @DeleteMapping(value = "/index", produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("@authorizationFilter.hasPermission('" + SearchServiceRole.ADMIN + "')") @PreAuthorize("@authorizationFilter.hasPermission('" + ENTITLEMENT_GROUP + "')")
public ResponseEntity deleteIndex(@RequestParam("kind") @NotBlank @ValidKind String kind) { public ResponseEntity deleteIndex(@RequestParam("kind") @NotBlank @ValidKind String kind) {
String index = elasticIndexNameResolver.getIndexNameFromKind(kind); String index = elasticIndexNameResolver.getIndexNameFromKind(kind);
try { try {
...@@ -124,4 +125,4 @@ public class CleanupIndiciesApi { ...@@ -124,4 +125,4 @@ public class CleanupIndiciesApi {
throw new AppException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Unknown error", "An unknown error has occurred.", e); throw new AppException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Unknown error", "An unknown error has occurred.", e);
} }
} }
} }
\ No newline at end of file
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