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

add delete api

parent f72fe8ed
No related branches found
No related tags found
2 merge requests!346Merge branch 'aws-integration' into 'master',!273Delete api
......@@ -38,8 +38,10 @@ import org.opengroup.osdu.indexer.service.IndexerService;
import org.opengroup.osdu.indexer.service.IndicesServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -64,6 +66,9 @@ public class CleanupIndiciesApi {
@Inject
private IndicesServiceImpl indicesService;
private static final String PRE_AUTH = "@authorizationFilter.hasPermission('"+ SearchServiceRole.ADMIN + "')" ;
@ApiIgnore
@PostMapping(path = "/index-cleanup", consumes = "application/json")
@PreAuthorize("@authorizationFilter.hasPermission('" + SearchServiceRole.ADMIN + "')")
......@@ -102,6 +107,8 @@ public class CleanupIndiciesApi {
}
}
@DeleteMapping(value = "/delete-index-for-kind", produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize(PRE_AUTH)
public ResponseEntity deleteIndex(@RequestParam("kind") @NotBlank @ValidKind String kind) {
try {
String index = elasticIndexNameResolver.getIndexNameFromKind(kind);
......
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