diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/IndexProvisionApi.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/IndexProvisionApi.java deleted file mode 100644 index 6979e0d99c830f9693adb8fe551eea2b3f3a269a..0000000000000000000000000000000000000000 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/IndexProvisionApi.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © Schlumberger - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.opengroup.osdu.indexer.api; - -import org.opengroup.osdu.core.common.model.search.SearchServiceRole; -import org.opengroup.osdu.indexer.model.IndexAliasesResult; -import org.opengroup.osdu.indexer.service.IndexAliasService; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.context.annotation.RequestScope; - -import javax.inject.Inject; - -@RestController -@RequestScope -public class IndexProvisionApi { - @Inject - private IndexAliasService indexAliasService; - - @PreAuthorize("@authorizationFilter.hasPermission('" + SearchServiceRole.ADMIN + "')") - @PostMapping(path = "/aliases") - public ResponseEntity<IndexAliasesResult> createIndexAliases() { - IndexAliasesResult result = indexAliasService.createIndexAliasesForAll(); - return new ResponseEntity<>(result, HttpStatus.OK); - } -} diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/PartitionSetupApi.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/PartitionSetupApi.java index 26435bfa27a8f90ff6d66d4721088b916a216f4c..1cdaf7bff4b5e5ea85c892fcaa25e6a235babdce 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/PartitionSetupApi.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/PartitionSetupApi.java @@ -15,14 +15,14 @@ package org.opengroup.osdu.indexer.api; import org.opengroup.osdu.indexer.logging.AuditLogger; +import org.opengroup.osdu.indexer.model.IndexAliasesResult; import org.opengroup.osdu.indexer.service.IClusterConfigurationService; +import org.opengroup.osdu.indexer.service.IndexAliasService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.context.annotation.RequestScope; import java.io.IOException; @@ -37,6 +37,8 @@ public class PartitionSetupApi { private static final String OPS = "users.datalake.ops"; + @Autowired + private IndexAliasService indexAliasService; @Autowired private IClusterConfigurationService clusterConfigurationService; @Autowired @@ -49,4 +51,11 @@ public class PartitionSetupApi { this.auditLogger.getConfigurePartition(singletonList(dataPartitionId)); return new ResponseEntity<>(org.springframework.http.HttpStatus.OK); } + + @PreAuthorize("@authorizationFilter.hasPermission('" + OPS + "')") + @PostMapping(path = "/aliases") + public ResponseEntity<IndexAliasesResult> createIndexAliases() { + IndexAliasesResult result = indexAliasService.createIndexAliasesForAll(); + return new ResponseEntity<>(result, HttpStatus.OK); + } }