Commit e7f55878 authored by Spiros Koulouzis's avatar Spiros Koulouzis

changed base path

parent b7a54a71
package nl.uva.sne.drip;
import java.net.URI;
import nl.uva.sne.drip.dao.ToscaTemplateDAO;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.web.servlet.function.HandlerFunction;
import static org.springframework.web.servlet.function.RequestPredicates.GET;
import org.springframework.web.servlet.function.RouterFunction;
import static org.springframework.web.servlet.function.RouterFunctions.route;
import org.springframework.web.servlet.function.ServerRequest;
import org.springframework.web.servlet.function.ServerResponse;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
......@@ -33,6 +41,8 @@ public class Swagger2SpringBoot implements CommandLineRunner {
new SpringApplication(Swagger2SpringBoot.class).run(args);
}
class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L;
......
......@@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import javax.validation.Valid;
import java.util.List;
import nl.uva.sne.drip.model.tosca.Credential;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-06T13:31:49.386Z")
......@@ -37,7 +35,7 @@ public interface CredentialApi {
@ApiResponse(code = 404, message = "ToscaTemplate not found")
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/credential",
@RequestMapping(value = "/manager/credential",
produces = {"application/json"},
consumes = {"application/json"},
method = RequestMethod.POST)
......@@ -58,7 +56,7 @@ public interface CredentialApi {
@ApiResponse(code = 404, message = "ToscaTemplate not found")
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/credential/ids",
@RequestMapping(value = "/manager/credential/ids",
produces = {"application/json"},
method = RequestMethod.GET)
ResponseEntity<List<String>> getCredentialIDs();
......
......@@ -31,7 +31,7 @@ public interface DeployerApi {
@ApiResponse(code = 404, message = "ToscaTemplate not found")
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/deployer/deploy/{id}",
@RequestMapping(value = "/manager/deployer/deploy/{id}",
produces = {"text/plain"},
method = RequestMethod.GET)
ResponseEntity<String> deployProvisionToscaTemplateByID(@ApiParam(value = "ID of topolog template to deploy", required = true) @PathVariable("id") String id);
......
......@@ -35,13 +35,13 @@ public class DeployerApiController implements DeployerApi {
@Override
public ResponseEntity<String> deployProvisionToscaTemplateByID(
@ApiParam(value = "ID of topolog template to deploy", required = true)
@ApiParam(value = "ID of topolog template to deploy", required = true)
@PathVariable("id") String id) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("")) {
try {
String planedYemplateId = dripService.deploy(id,null);
String planedYemplateId = dripService.deploy(id, null);
return new ResponseEntity<>(planedYemplateId, HttpStatus.OK);
} catch (Exception ex) {
......
......@@ -26,7 +26,7 @@ public interface PlannerApi {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/planner/plan/{id}",
@RequestMapping(value = "/manager/planner/plan/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> planToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id);
......
......@@ -25,7 +25,6 @@ public class PlannerApiController implements PlannerApi {
private final HttpServletRequest request;
@Autowired
private DRIPService dripService;
......
......@@ -26,7 +26,7 @@ public interface ProvisionerApi {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "ToscaTemplate not found"),
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/provisioner/provision/{id}",
@RequestMapping(value = "/manager/provisioner/provision/{id}",
produces = { "text/plain" },
method = RequestMethod.GET)
ResponseEntity<String> provisionPlanToscaTemplateByID(@ApiParam(value = "ID of topolog template to plan",required=true) @PathVariable("id") String id);
......
......@@ -35,7 +35,7 @@ public interface ScalerApi {
@ApiResponse(code = 404, message = "ToscaTemplate not found")
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/scaler/{id}",
@RequestMapping(value = "/manager/scaler/{id}",
produces = {"text/plain"},
method = RequestMethod.GET)
ResponseEntity<String> scaleProvisionedToscaTemplateByID(
......
......@@ -2,7 +2,6 @@ package nl.uva.sne.drip.api;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.ApiParam;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
......
......@@ -35,7 +35,7 @@ public interface ToscaTemplateApi {
@ApiResponse(code = 400, message = "Invalid ID supplied")
,
@ApiResponse(code = 404, message = "ToscaTemplate not found")})
@RequestMapping(value = "/tosca_template/{id}",
@RequestMapping(value = "/manager/tosca_template/{id}",
method = RequestMethod.DELETE)
ResponseEntity<String> deleteToscaTemplateByID(@ApiParam(value = "ID of topology template to return", required = true) @PathVariable("id") String id, @ApiParam(value = "The node(s) to delete") @Valid @RequestParam(value = "node_name", required = false) List<String> nodeName);
......@@ -54,7 +54,7 @@ public interface ToscaTemplateApi {
@ApiResponse(code = 404, message = "ToscaTemplate not found")
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/tosca_template/{id}",
@RequestMapping(value = "/manager/tosca_template/{id}",
produces = {"text/plain"},
method = RequestMethod.GET)
ResponseEntity<String> getToscaTemplateByID(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("id") String id);
......@@ -74,7 +74,7 @@ public interface ToscaTemplateApi {
@ApiResponse(code = 404, message = "ToscaTemplate not found")
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/tosca_template/ids",
@RequestMapping(value = "/manager/tosca_template/ids",
produces = {"application/json"},
method = RequestMethod.GET)
ResponseEntity<List<String>> getToscaTemplateIDs();
......@@ -94,7 +94,7 @@ public interface ToscaTemplateApi {
@ApiResponse(code = 404, message = "ToscaTemplate not found")
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/tosca_template/{id}",
@RequestMapping(value = "/manager/tosca_template/{id}",
produces = {"text/plain"},
consumes = {"multipart/form-data"},
method = RequestMethod.PUT)
......@@ -111,7 +111,7 @@ public interface ToscaTemplateApi {
@ApiResponse(code = 200, message = "successful operation", response = String.class)
,
@ApiResponse(code = 405, message = "Invalid input")})
@RequestMapping(value = "/tosca_template",
@RequestMapping(value = "/manager/tosca_template",
consumes = {"multipart/form-data"},
method = RequestMethod.POST)
ResponseEntity<String> uploadToscaTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file);
......
......@@ -40,24 +40,20 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@Autowired
private DRIPService dripService;
@org.springframework.beans.factory.annotation.Autowired
public ToscaTemplateApiController(ObjectMapper objectMapper, HttpServletRequest request) {
this.request = request;
}
@Override
public ResponseEntity<String> deleteToscaTemplateByID(
@ApiParam(value = "ID of topology template to return",required=true)
@PathVariable("id") String id,@ApiParam(value = "The node(s) to delete")
@ApiParam(value = "ID of topology template to return", required = true)
@PathVariable("id") String id, @ApiParam(value = "The node(s) to delete")
@Valid @RequestParam(value = "node_names", required = false) List<String> nodeName) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("text/plain")) {
try {
dripService.delete(id,nodeName);
dripService.delete(id, nodeName);
return new ResponseEntity<>("", HttpStatus.OK);
} catch (IOException | ApiException | TypeExeption | TimeoutException | InterruptedException ex) {
java.util.logging.Logger.getLogger(ToscaTemplateApiController.class.getName()).log(Level.SEVERE, null, ex);
......@@ -69,7 +65,6 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
}
}
@Override
public ResponseEntity<String> getToscaTemplateByID(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("id") String id) {
......
......@@ -7,19 +7,14 @@ package nl.uva.sne.drip.api;
import io.swagger.annotations.*;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
import nl.uva.sne.drip.model.User;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-06T13:31:49.386Z")
......@@ -34,7 +29,7 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 409, message = "already exists") })
@RequestMapping(value = "/user",
@RequestMapping(value = "/manager/user",
produces = { "application/json" },
method = RequestMethod.POST)
ResponseEntity<String> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
......@@ -44,7 +39,7 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid username/password supplied") })
@RequestMapping(value = "/user/login",
@RequestMapping(value = "/manager/user/login",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<String> userLoginGet(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) String username,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) String password);
......@@ -53,7 +48,7 @@ public interface UserApi {
@ApiOperation(value = "Logs out current logged in user session", nickname = "userLogoutGet", notes = "", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/user/logout",
@RequestMapping(value = "/manager/user/logout",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<Void> userLogoutGet();
......@@ -67,7 +62,7 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@ApiResponse(code = 404, message = "User not found") })
@RequestMapping(value = "/user/{username}",
@RequestMapping(value = "/manager/user/{username}",
produces = { "application/json" },
method = RequestMethod.DELETE)
ResponseEntity<Void> userUsernameDelete(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username);
......@@ -82,7 +77,7 @@ public interface UserApi {
@ApiResponse(code = 200, message = "successful operation", response = User.class),
@ApiResponse(code = 400, message = "Invalid username supplied"),
@ApiResponse(code = 404, message = "User not found") })
@RequestMapping(value = "/user/{username}",
@RequestMapping(value = "/manager/user/{username}",
produces = { "application/json" },
method = RequestMethod.GET)
ResponseEntity<User> userUsernameGet(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathVariable("username") String username);
......@@ -96,7 +91,7 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid user supplied"),
@ApiResponse(code = 404, message = "User not found") })
@RequestMapping(value = "/user/{username}",
@RequestMapping(value = "/manager/user/{username}",
produces = { "application/json" },
method = RequestMethod.PUT)
ResponseEntity<Void> userUsernamePut(@ApiParam(value = "name that need to be updated",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
......
springfox.documentation.swagger.v2.path=/api-docs
server.contextPath=/conf-api/3.0
springfox.documentation.swagger.v2.path=/manager/docs-api/
server.contextPath=/manager/
springdoc.swagger-ui.path=/manager/swagger-ui.html
server.port=8080
spring.jackson.date-format=nl.uva.sne.drip.RFC3339DateFormat
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment