This is an automated email from the ASF dual-hosted git repository. bhliva pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 0dca866f699a26191b097632b8d207b764b94bb4 Author: bhliva <bohdan_hl...@epam.com> AuthorDate: Tue Nov 5 16:43:02 2019 +0200 DLAB-000 remove swagger 1.x and replace it with openapi --- services/provisioning-service/provisioning.yml | 9 ++- services/self-service/pom.xml | 27 ++++++-- services/self-service/self-service.yml | 11 ---- .../dlab/backendapi/SelfServiceApplication.java | 4 +- .../conf/SelfServiceApplicationConfiguration.java | 8 --- .../resources/ApplicationSettingResource.java | 17 ++--- .../dlab/backendapi/resources/BackupResource.java | 20 ++---- .../dlab/backendapi/resources/EdgeResource.java | 12 +--- .../backendapi/resources/EnvironmentResource.java | 26 ++------ .../backendapi/resources/ExploratoryResource.java | 36 ++++------ .../backendapi/resources/GitCredsResource.java | 12 +--- .../resources/ImageExploratoryResource.java | 27 ++------ .../resources/InfrastructureInfoResource.java | 15 +---- .../resources/InfrastructureTemplateResource.java | 14 +--- .../backendapi/resources/KeyUploaderResource.java | 28 ++------ .../resources/LibExploratoryResource.java | 32 ++------- .../backendapi/resources/SchedulerJobResource.java | 46 ++----------- .../backendapi/resources/SecurityResource.java | 24 +------ .../backendapi/resources/SystemInfoResource.java | 8 +-- .../backendapi/resources/UserGroupResource.java | 77 +++++----------------- .../backendapi/resources/UserRoleResource.java | 12 +--- .../backendapi/resources/UserSettingsResource.java | 17 ++--- .../resources/aws/ComputationalResourceAws.java | 67 ++++--------------- .../azure/ComputationalResourceAzure.java | 51 ++------------ .../resources/gcp/ComputationalResourceGcp.java | 64 ++++-------------- .../resources/swagger/SwaggerSecurityInfo.java | 38 ----------- .../service/impl/EnvironmentServiceImpl.java | 3 - 27 files changed, 143 insertions(+), 562 deletions(-) diff --git a/services/provisioning-service/provisioning.yml b/services/provisioning-service/provisioning.yml index d96969b..3e34454 100644 --- a/services/provisioning-service/provisioning.yml +++ b/services/provisioning-service/provisioning.yml @@ -87,17 +87,16 @@ logging: archivedLogFilenamePattern: ${LOG_ROOT_DIR}/ssn/provisioning-%d{yyyy-MM-dd}.log.gz archivedFileCount: 10 - keycloakConfiguration: - realm: DLAB_bhliva + realm: KEYCLOAK_REALM_NAME bearer-only: true - auth-server-url: http://52.11.45.11:8080/auth + auth-server-url: KEYCLOAK_AUTH_SERVER_URL ssl-required: none register-node-at-startup: true register-node-period: 600 - resource: sss + resource: KEYCLOAK_CLIENT_NAME credentials: - secret: 37338cc5-77f9-47f9-9d95-5cb716b91118 + secret: KEYCLOAK_CLIENT_SECRET cloudProperties: os: CONF_OS diff --git a/services/self-service/pom.xml b/services/self-service/pom.xml index 2b446a4..5539d12 100644 --- a/services/self-service/pom.xml +++ b/services/self-service/pom.xml @@ -163,11 +163,6 @@ </dependency> <dependency> - <groupId>com.fashiontrade</groupId> - <artifactId>dropwizard-swagger-v3</artifactId> - <version>1.0.0</version> - </dependency> - <dependency> <groupId>org.glassfish.jersey.test-framework.providers</groupId> <artifactId>jersey-test-framework-provider-grizzly2</artifactId> <version>${org.glassfish.jersey.media.version}</version> @@ -249,6 +244,28 @@ </excludes> </configuration> </plugin> + <plugin> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-maven-plugin</artifactId> + <version>2.0.10</version> + <configuration> + <outputFileName>openapi</outputFileName> + <outputPath>${project.build.directory}/classes/webapp/dist</outputPath> + <outputFormat>JSONANDYAML</outputFormat> + <resourcePackages> + <package>com.epam.dlab.backendapi.resources</package> + </resourcePackages> + <prettyPrint>TRUE</prettyPrint> + </configuration> + <executions> + <execution> + <phase>compile</phase> + <goals> + <goal>resolve</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/services/self-service/self-service.yml b/services/self-service/self-service.yml index 181b517..ab6dfd9 100644 --- a/services/self-service/self-service.yml +++ b/services/self-service/self-service.yml @@ -119,17 +119,6 @@ logging: archivedLogFilenamePattern: ${LOG_ROOT_DIR}/ssn/selfservice-%d{yyyy-MM-dd}.log.gz archivedFileCount: 10 -swaggerConfiguration: - resourcePackage: com.epam.dlab.backendapi.resources - title: DLab API - description: Essential toolset for analytics. Deployed on ${CLOUD_TYPE} provider - schemes: [https, http] - version: 2.0 - contact: DLab - contactUrl: http://dlab.opensource.epam.com/ - license: Apache 2.0 - licenseUrl: https://www.apache.org/licenses/LICENSE-2.0 - mavenSearchService: protocol: http host: search.maven.org diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java index 3b4e21a..9d17eb0 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/SelfServiceApplication.java @@ -94,12 +94,12 @@ public class SelfServiceApplication extends Application<SelfServiceApplicationCo )); bootstrap.addBundle(new DlabKeycloakBundle()); - bootstrap.addBundle(new SwaggerBundle<SelfServiceApplicationConfiguration>() { + /*bootstrap.addBundle(new SwaggerBundle<SelfServiceApplicationConfiguration>() { @Override protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(SelfServiceApplicationConfiguration configuration) { return configuration.getSwaggerConfiguration(); } - }); + });*/ } @Override diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java index 4e3ea2e..48410d1 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/conf/SelfServiceApplicationConfiguration.java @@ -30,7 +30,6 @@ import com.epam.dlab.validation.GcpValidation; import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.client.JerseyClientConfiguration; import io.dropwizard.util.Duration; -import io.federecio.dropwizard.swagger.SwaggerBundleConfiguration; import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.group.GroupSequenceProvider; @@ -107,9 +106,6 @@ public class SelfServiceApplicationConfiguration extends ServiceConfiguration { private boolean mongoMigrationEnabled; @JsonProperty private int privateKeySize = 2048; - @JsonProperty - private SwaggerBundleConfiguration swaggerConfiguration; - @Valid @NotNull private Map<String, SchedulerConfigurationData> schedulers; @@ -158,10 +154,6 @@ public class SelfServiceApplicationConfiguration extends ServiceConfiguration { return schedulers; } - public SwaggerBundleConfiguration getSwaggerConfiguration() { - return swaggerConfiguration; - } - public boolean isGcpOuauth2AuthenticationEnabled() { return gcpOuauth2AuthenticationEnabled; } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ApplicationSettingResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ApplicationSettingResource.java index ab8041e..92f079d 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ApplicationSettingResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ApplicationSettingResource.java @@ -19,11 +19,9 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.ApplicationSettingService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.annotation.security.RolesAllowed; @@ -35,7 +33,6 @@ import javax.ws.rs.core.Response; @Slf4j @Path("/settings") @RolesAllowed("/api/settings") -@Api(value = "Application settings service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class ApplicationSettingResource { @@ -48,19 +45,15 @@ public class ApplicationSettingResource { @PUT @Path("budget/{maxBudgetAllowed}") - @ApiOperation("Updates max budget allowed application setting") - @ApiResponses(@ApiResponse(code = 204, message = "Setting is updated")) - public Response setMaxBudget(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam @PathParam("maxBudgetAllowed") @Min(1) Long maxBudget) { + public Response setMaxBudget(@Auth UserInfo userInfo, + @PathParam("maxBudgetAllowed") @Min(1) Long maxBudget) { settingService.setMaxBudget(maxBudget); return Response.noContent().build(); } @DELETE @Path("budget") - @ApiOperation("Removes max budget allowed application setting") - @ApiResponses(@ApiResponse(code = 204, message = "Setting is removed")) - public Response removeAllowedBudget(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response removeAllowedBudget(@Auth UserInfo userInfo) { log.debug("User {} is removing max budget application setting", userInfo.getName()); settingService.removeMaxBudget(); return Response.noContent().build(); @@ -68,9 +61,7 @@ public class ApplicationSettingResource { @GET @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Gets application settings") - @ApiResponses(@ApiResponse(code = 200, message = "Application settings value")) - public Response getSettings(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response getSettings(@Auth UserInfo userInfo) { return Response.ok(settingService.getSettings()).build(); } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/BackupResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/BackupResource.java index c0e0122..3f4125d 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/BackupResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/BackupResource.java @@ -22,13 +22,11 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.domain.RequestId; import com.epam.dlab.backendapi.resources.dto.BackupFormDTO; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.BackupService; import com.epam.dlab.backendapi.util.RequestBuilder; import com.epam.dlab.dto.backup.EnvBackupDTO; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.annotation.security.RolesAllowed; @@ -42,7 +40,6 @@ import java.util.UUID; @Slf4j @Path("/infrastructure/backup") @RolesAllowed("/api/infrastructure/backup") -@Api(value = "Backup service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class BackupResource { private final BackupService backupService; @@ -59,10 +56,7 @@ public class BackupResource { @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) - @ApiOperation("Creates backup") - @ApiResponses(@ApiResponse(code = 202, message = "Backup has been created")) - public Response createBackup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Backup form DTO", required = true) + public Response createBackup(@Auth UserInfo userInfo, @Valid BackupFormDTO backupFormDTO) { log.debug("Creating backup for user {} with parameters {}", userInfo.getName(), backupFormDTO); final EnvBackupDTO dto = requestBuilder.newBackupCreate(backupFormDTO, UUID.randomUUID().toString()); @@ -74,10 +68,7 @@ public class BackupResource { @GET @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Fetches all backups") - @ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid user's name"), - @ApiResponse(code = 200, message = "Backups were fetched successfully")}) - public Response getBackups(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response getBackups(@Auth UserInfo userInfo) { log.debug("Getting backups for user {}", userInfo.getName()); return Response.ok(backupService.getBackups(userInfo.getName())).build(); } @@ -85,11 +76,8 @@ public class BackupResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Fetches backup by ID") - @ApiResponses({@ApiResponse(code = 404, message = "Backup with ID not found"), - @ApiResponse(code = 200, message = "Backup with ID fetched successfully")}) - public Response getBackup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Backup's ID", required = true) @PathParam("id") String id) { + public Response getBackup(@Auth UserInfo userInfo, + @PathParam("id") String id) { log.debug("Getting backup with id {} for user {}", id, userInfo.getName()); return Response.ok(backupService.getBackup(userInfo.getName(), id)).build(); } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EdgeResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EdgeResource.java index 83f2b88..3ae31b3 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EdgeResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EdgeResource.java @@ -20,15 +20,10 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.EdgeService; import com.epam.dlab.rest.contracts.EdgeAPI; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.Authorization; import lombok.extern.slf4j.Slf4j; import javax.ws.rs.Consumes; @@ -43,7 +38,6 @@ import javax.ws.rs.core.MediaType; @Path("/infrastructure/edge") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "EDGE service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class EdgeResource implements EdgeAPI { @@ -62,8 +56,7 @@ public class EdgeResource implements EdgeAPI { */ @POST @Path("/start") - @ApiOperation("Starts EDGE") - public String start(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public String start(@Auth UserInfo userInfo) { return edgeService.start(userInfo); } @@ -75,8 +68,7 @@ public class EdgeResource implements EdgeAPI { */ @POST @Path("/stop") - @ApiOperation("Stops EDGE") - public String stop(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public String stop(@Auth UserInfo userInfo) { return edgeService.stop(userInfo); } } \ No newline at end of file diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java index 51af7a6..313947e 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/EnvironmentResource.java @@ -20,11 +20,9 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.EnvironmentService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.hibernate.validator.constraints.NotEmpty; @@ -36,7 +34,6 @@ import javax.ws.rs.core.Response; @Path("environment") @Slf4j @RolesAllowed("environment/*") -@Api(value = "Environment service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class EnvironmentResource { private EnvironmentService environmentService; @@ -49,10 +46,7 @@ public class EnvironmentResource { @GET @Path("user") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Fetches environment users") - @ApiResponses({@ApiResponse(code = 404, message = "Users not found"), - @ApiResponse(code = 200, message = "Users were fetched successfully")}) - public Response getUsersWithActiveEnv(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response getUsersWithActiveEnv(@Auth UserInfo userInfo) { log.debug("User {} requested information about active environments", userInfo.getName()); return Response.ok(environmentService.getUsers()).build(); } @@ -60,8 +54,7 @@ public class EnvironmentResource { @GET @Path("all") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Fetches user resources") - public Response getAllEnv(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response getAllEnv(@Auth UserInfo userInfo) { log.debug("Admin {} requested information about all user's environment", userInfo.getName()); return Response.ok(environmentService.getAllEnv()).build(); } @@ -70,10 +63,8 @@ public class EnvironmentResource { @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) @Path("terminate") - @ApiOperation("Terminates user's environment including EDGE, notebooks, clusters") - @ApiResponses(@ApiResponse(code = 200, message = "User's environment terminated successfully")) - public Response terminateEnv(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "User's name", required = true) @NotEmpty String user) { + public Response terminateEnv(@Auth UserInfo userInfo, + @NotEmpty String user) { log.info("User {} is terminating {} environment", userInfo.getName(), user); environmentService.terminateEnvironment(user); return Response.ok().build(); @@ -83,10 +74,8 @@ public class EnvironmentResource { @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) @Path("stop") - @ApiOperation("Stops user's environment including EDGE, notebooks, Spark clusters") - @ApiResponses(@ApiResponse(code = 200, message = "User's environment stopped successfully")) - public Response stopEnv(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "User's name", required = true) @NotEmpty String user) { + public Response stopEnv(@Auth UserInfo userInfo, + @NotEmpty String user) { log.info("User {} is stopping {} environment", userInfo.getName(), user); environmentService.stopEnvironment(user); return Response.ok().build(); @@ -96,8 +85,7 @@ public class EnvironmentResource { @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.APPLICATION_JSON) @Path("stop/edge") - @ApiOperation("Stops user's EDGE node") - public Response stopEdge(@ApiParam(hidden = true) @Auth UserInfo userInfo, @NotEmpty String user) { + public Response stopEdge(@Auth UserInfo userInfo, @NotEmpty String user) { log.info("Admin {} is stopping edge of user {}", userInfo.getName(), user); environmentService.stopEdge(user); return Response.ok().build(); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ExploratoryResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ExploratoryResource.java index da123a3..6fa0b51 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ExploratoryResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ExploratoryResource.java @@ -23,7 +23,6 @@ import com.epam.dlab.auth.UserInfo; import com.epam.dlab.auth.rest.UserSessionDurationAuthorizer; import com.epam.dlab.backendapi.resources.dto.ExploratoryActionFormDTO; import com.epam.dlab.backendapi.resources.dto.ExploratoryCreateFormDTO; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.roles.RoleType; import com.epam.dlab.backendapi.roles.UserRoles; import com.epam.dlab.backendapi.service.ExploratoryService; @@ -33,7 +32,6 @@ import com.epam.dlab.model.exploratory.Exploratory; import com.epam.dlab.rest.contracts.ExploratoryAPI; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.annotation.security.RolesAllowed; @@ -50,7 +48,6 @@ import java.util.List; @Path("/infrastructure_provision/exploratory_environment") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Notebook service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class ExploratoryResource implements ExploratoryAPI { @@ -70,12 +67,7 @@ public class ExploratoryResource implements ExploratoryAPI { * {@link Response.Status#FOUND} request for provisioning service has been duplicated. */ @PUT - //@RolesAllowed(UserSessionDurationAuthorizer.SHORT_USER_SESSION_DURATION) - @ApiOperation("Creates notebook") - @ApiResponses({@ApiResponse(code = 302, message = "Notebook with current parameters already exists"), - @ApiResponse(code = 200, message = "Notebook created successfully")}) - public Response create(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook create form DTO", required = true) + public Response create(@Auth UserInfo userInfo, @Valid @NotNull ExploratoryCreateFormDTO formDTO) { log.debug("Creating exploratory environment {} with name {} for user {}", formDTO.getImage(), formDTO.getName(), userInfo.getName()); @@ -98,9 +90,7 @@ public class ExploratoryResource implements ExploratoryAPI { */ @POST @RolesAllowed(UserSessionDurationAuthorizer.SHORT_USER_SESSION_DURATION) - @ApiOperation("Starts notebook by name") - public String start(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook action form DTO", required = true) + public String start(@Auth UserInfo userInfo, @Valid @NotNull ExploratoryActionFormDTO formDTO) { log.debug("Starting exploratory environment {} for user {}", formDTO.getNotebookInstanceName(), userInfo.getName()); @@ -116,9 +106,8 @@ public class ExploratoryResource implements ExploratoryAPI { */ @DELETE @Path("/{name}/stop") - @ApiOperation("Stops notebook by name") - public String stop(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) @PathParam("name") String name) { + public String stop(@Auth UserInfo userInfo, + @PathParam("name") String name) { log.debug("Stopping exploratory environment {} for user {}", name, userInfo.getName()); return exploratoryService.stop(userInfo, name); } @@ -132,19 +121,17 @@ public class ExploratoryResource implements ExploratoryAPI { */ @DELETE @Path("/{name}/terminate") - @ApiOperation("Terminates notebook by name") - public String terminate(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) @PathParam("name") String name) { + public String terminate(@Auth UserInfo userInfo, + @PathParam("name") String name) { log.debug("Terminating exploratory environment {} for user {}", name, userInfo.getName()); return exploratoryService.terminate(userInfo, name); } @PUT @Path("/{name}/reconfigure") - @ApiOperation("Reconfigure notebook spark cluster") - public Response reconfigureSpark(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) @PathParam("name") String name, - @ApiParam(value = "Notebook cluster configuration", required = true) List<ClusterConfig> config) { + public Response reconfigureSpark(@Auth UserInfo userInfo, + @PathParam("name") String name, + List<ClusterConfig> config) { log.debug("Updating exploratory {} spark cluster for user {}", name, userInfo.getName()); exploratoryService.updateClusterConfig(userInfo, name, config); return Response.ok().build(); @@ -152,9 +139,8 @@ public class ExploratoryResource implements ExploratoryAPI { @GET @Path("/{name}/cluster/config") - @ApiOperation("Gets notebook spark cluster config") - public Response getClusterConfig(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) @PathParam("name") String name) { + public Response getClusterConfig(@Auth UserInfo userInfo, + @PathParam("name") String name) { log.debug("Getting exploratory {} spark cluster configuration for user {}", name, userInfo.getName()); return Response.ok(exploratoryService.getClusterConfig(userInfo, name)).build(); } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/GitCredsResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/GitCredsResource.java index 9f6e78a..5628771 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/GitCredsResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/GitCredsResource.java @@ -20,13 +20,11 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.GitCredentialService; import com.epam.dlab.dto.exploratory.ExploratoryGitCredsDTO; import com.epam.dlab.rest.contracts.ExploratoryAPI; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.validation.Valid; @@ -41,8 +39,6 @@ import javax.ws.rs.core.Response; @Path("/user/git_creds") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Service for updating or retrieving GIT credentials", - authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class GitCredsResource implements ExploratoryAPI { @@ -61,10 +57,7 @@ public class GitCredsResource implements ExploratoryAPI { * @return {@link Response.Status#OK} request for provisioning service has been accepted.<br> */ @PUT - @ApiOperation("Updates GIT credentials") - @ApiResponses(@ApiResponse(code = 200, message = "GIT credentials updated successfully")) - public Response updateGitCreds(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook GIT credentials form DTO", required = true) + public Response updateGitCreds(@Auth UserInfo userInfo, @Valid @NotNull ExploratoryGitCredsDTO formDTO) { gitCredentialService.updateGitCredentials(userInfo, formDTO); return Response.ok().build(); @@ -76,8 +69,7 @@ public class GitCredsResource implements ExploratoryAPI { * @param userInfo user info. */ @GET - @ApiOperation("Fetches info about GIT credentials") - public ExploratoryGitCredsDTO getGitCreds(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public ExploratoryGitCredsDTO getGitCreds(@Auth UserInfo userInfo) { return gitCredentialService.getGitCredentials(userInfo.getName()); } } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ImageExploratoryResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ImageExploratoryResource.java index 1e19691..685d2ca 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ImageExploratoryResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ImageExploratoryResource.java @@ -23,11 +23,9 @@ import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.domain.RequestId; import com.epam.dlab.backendapi.resources.dto.ExploratoryImageCreateFormDTO; import com.epam.dlab.backendapi.resources.dto.ImageInfoRecord; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.ImageExploratoryService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.validation.Valid; @@ -43,7 +41,6 @@ import java.util.List; @Path("/infrastructure_provision/exploratory_environment/image") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Service for machine images", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class ImageExploratoryResource { @@ -57,12 +54,9 @@ public class ImageExploratoryResource { } @POST - @ApiOperation("Creates machine image from existing notebook") - @ApiResponses(@ApiResponse(code = 202, message = "Machine image has been created")) - public Response createImage(@ApiParam(hidden = true) @Auth UserInfo ui, - @ApiParam(value = "Notebook image create form DTO", required = true) + public Response createImage(@Auth UserInfo ui, @Valid @NotNull ExploratoryImageCreateFormDTO formDTO, - @ApiParam(hidden = true) @Context UriInfo uriInfo) { + @Context UriInfo uriInfo) { log.debug("Creating an image {} for user {}", formDTO, ui.getName()); String uuid = imageExploratoryService.createImage(ui, formDTO.getNotebookName(), formDTO.getName(), formDTO .getDescription()); @@ -76,27 +70,20 @@ public class ImageExploratoryResource { @GET - @ApiOperation("Fetches machine images created from specific Docker image") - @ApiResponses(@ApiResponse(code = 200, message = "Machine images were fetched successfully")) - public Response getImages(@ApiParam(hidden = true) @Auth UserInfo ui, - @ApiParam(value = "Docker image", required = true) + public Response getImages(@Auth UserInfo ui, @QueryParam("docker_image") String dockerImage, - @ApiParam(value = "Project's name", required = true) @QueryParam("project") String project, - @ApiParam(value = "Endpoint's name", required = true) @QueryParam("endpoint") String endpoint) { log.debug("Getting images for user {}, project {}", ui.getName(), project); - final List<ImageInfoRecord> images = imageExploratoryService.getNotFailedImages(ui.getName(), dockerImage, project, endpoint); + final List<ImageInfoRecord> images = imageExploratoryService.getNotFailedImages(ui.getName(), dockerImage, + project, endpoint); return Response.ok(images).build(); } @GET @Path("{name}") - @ApiOperation("Fetches machine image by name") - @ApiResponses({@ApiResponse(code = 400, message = "Invalid machine image's name"), - @ApiResponse(code = 200, message = "Machine image fetched successfully")}) - public Response getImage(@ApiParam(hidden = true) @Auth UserInfo ui, - @ApiParam(value = "Image's name", required = true) @PathParam("name") String name) { + public Response getImage(@Auth UserInfo ui, + @PathParam("name") String name) { log.debug("Getting image with name {} for user {}", name, ui.getName()); return Response.ok(imageExploratoryService.getImage(ui.getName(), name)).build(); } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureInfoResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureInfoResource.java index 6a7efc0..db8197f 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureInfoResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureInfoResource.java @@ -22,12 +22,10 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.resources.dto.HealthStatusPageDTO; import com.epam.dlab.backendapi.resources.dto.ProjectInfrastructureInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.roles.UserRoles; import com.epam.dlab.backendapi.service.InfrastructureInfoService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.ws.rs.*; @@ -41,7 +39,6 @@ import java.util.List; @Path("/infrastructure") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Infrastructure info service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class InfrastructureInfoResource { @@ -56,8 +53,6 @@ public class InfrastructureInfoResource { * Return status of self-service. */ @GET - @ApiOperation("Returns status of self-service") - @ApiResponses(@ApiResponse(code = 200, message = "Self-service's status fetched successfully")) public Response status() { return Response.status(Response.Status.OK).build(); } @@ -69,9 +64,7 @@ public class InfrastructureInfoResource { */ @GET @Path("/status") - @ApiOperation("Returns EDGE's status") - public HealthStatusPageDTO status(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Full version of report required", defaultValue = "0") + public HealthStatusPageDTO status(@Auth UserInfo userInfo, @QueryParam("full") @DefaultValue("0") int fullReport) { return infrastructureInfoService .getHeathStatus(userInfo, fullReport != 0, UserRoles.isAdmin(userInfo)); @@ -84,16 +77,14 @@ public class InfrastructureInfoResource { */ @GET @Path("/info") - @ApiOperation("Returns list of user's resources") - public List<ProjectInfrastructureInfo> getUserResources(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public List<ProjectInfrastructureInfo> getUserResources(@Auth UserInfo userInfo) { return infrastructureInfoService.getUserResources(userInfo.getName()); } @GET @Path("/meta") - @ApiOperation("Return metainfo regarding application version etc") - public Response getVersion(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response getVersion(@Auth UserInfo userInfo) { return Response.ok(infrastructureInfoService.getInfrastructureMetaInfo()) .build(); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureTemplateResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureTemplateResource.java index f58dbf6..df85ff3 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureTemplateResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/InfrastructureTemplateResource.java @@ -20,17 +20,12 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.InfrastructureTemplateService; import com.epam.dlab.dto.base.computational.FullComputationalTemplate; import com.epam.dlab.dto.imagemetadata.ExploratoryMetadataDTO; import com.epam.dlab.rest.contracts.DockerAPI; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.Authorization; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -41,8 +36,6 @@ import javax.ws.rs.core.MediaType; @Path("/infrastructure_templates") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Service for retrieving notebook and cluster templates", - authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class InfrastructureTemplateResource implements DockerAPI { private InfrastructureTemplateService infrastructureTemplateService; @@ -59,9 +52,7 @@ public class InfrastructureTemplateResource implements DockerAPI { */ @GET @Path("/{project}/{endpoint}/computational_templates") - @ApiOperation("Returns list of cluster's templates") - public Iterable<FullComputationalTemplate> getComputationalTemplates(@ApiParam(hidden = true) - @Auth UserInfo userInfo, + public Iterable<FullComputationalTemplate> getComputationalTemplates(@Auth UserInfo userInfo, @PathParam("project") String project, @PathParam("endpoint") String endpoint) { return infrastructureTemplateService.getComputationalTemplates(userInfo, project, endpoint); @@ -74,8 +65,7 @@ public class InfrastructureTemplateResource implements DockerAPI { */ @GET @Path("/{project}/{endpoint}/exploratory_templates") - @ApiOperation("Returns list of notebook's templates") - public Iterable<ExploratoryMetadataDTO> getExploratoryTemplates(@ApiParam(hidden = true) @Auth UserInfo userInfo, + public Iterable<ExploratoryMetadataDTO> getExploratoryTemplates(@Auth UserInfo userInfo, @PathParam("project") String project, @PathParam("endpoint") String endpoint) { return infrastructureTemplateService.getExploratoryTemplates(userInfo, project, endpoint); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeyUploaderResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeyUploaderResource.java index 27a9237..a58f8dc 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeyUploaderResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/KeyUploaderResource.java @@ -20,7 +20,6 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.AccessKeyService; import com.epam.dlab.dto.keyload.KeyLoadStatus; import com.epam.dlab.exceptions.DlabException; @@ -29,7 +28,6 @@ import com.epam.dlab.exceptions.ResourceNotFoundException; import com.epam.dlab.rest.contracts.EdgeAPI; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.glassfish.jersey.media.multipart.FormDataParam; @@ -45,8 +43,6 @@ import javax.ws.rs.core.Response.Status; @Path("/user/access_key") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Service for uploading or reuploading user's access keys", - authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class KeyUploaderResource implements EdgeAPI { @@ -70,12 +66,7 @@ public class KeyUploaderResource implements EdgeAPI { * </pre> */ @GET - @ApiOperation(value = "Checks the status of user's key") - @ApiResponses(value = {@ApiResponse(code = 404, message = "Key not found"), - @ApiResponse(code = 202, message = "Key is uploading now"), - @ApiResponse(code = 500, message = "Key's status is failed"), - @ApiResponse(code = 200, message = "Key is valid")}) - public Response checkKey(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response checkKey(@Auth UserInfo userInfo) { final KeyLoadStatus status = keyService.getUserKeyStatus(userInfo.getName()); if (KeyLoadStatus.NONE == status) { throw new ResourceNotFoundException("Key for user " + userInfo.getName() + " not found"); @@ -98,13 +89,8 @@ public class KeyUploaderResource implements EdgeAPI { */ @POST @Consumes(MediaType.MULTIPART_FORM_DATA) - @ApiOperation(value = "Uploads/reuploads user's key to server") - @ApiResponses(value = @ApiResponse(code = 200, message = "Key was uploaded/reuploaded successfully")) - public Response loadKey(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Key file's content", required = true) + public Response loadKey( @Auth UserInfo userInfo, @FormDataParam("file") String fileContent, - @ApiParam(value = "Primary uploading or secondary reuploading", allowableValues = - "true/false", defaultValue = "true") @QueryParam("is_primary_uploading") @DefaultValue("true") boolean isPrimaryUploading) { validate(fileContent); @@ -120,9 +106,7 @@ public class KeyUploaderResource implements EdgeAPI { */ @POST @Path("/recover") - @ApiOperation(value = "Creates EDGE node and uploads user's key to server") - @ApiResponses(value = @ApiResponse(code = 200, message = "EDGE node was created successfully")) - public Response recover(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response recover(@Auth UserInfo userInfo) { return Response.ok(keyService.recoverEdge(userInfo)).build(); } @@ -130,11 +114,7 @@ public class KeyUploaderResource implements EdgeAPI { @POST @Path("/generate") @Produces(MediaType.APPLICATION_OCTET_STREAM) - @ApiOperation("Generate user's key") - @ApiResponses(@ApiResponse(code = 200, message = "User's key was generated successfully")) - public Response generate(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Primary uploading or secondary reuploading", allowableValues = - "true/false", defaultValue = "true") + public Response generate(@Auth UserInfo userInfo, @QueryParam("is_primary_uploading") @DefaultValue("true") boolean isPrimaryUploading) { final Response.ResponseBuilder builder = Response.ok(keyService.generateKey(userInfo, isPrimaryUploading)); builder.header(HttpHeaders.CONTENT_DISPOSITION, String.format(FILE_ATTACHMENT_FORMAT, userInfo.getName())); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/LibExploratoryResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/LibExploratoryResource.java index aa68ffb..64ede19 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/LibExploratoryResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/LibExploratoryResource.java @@ -26,7 +26,6 @@ import com.epam.dlab.backendapi.resources.dto.LibInfoRecord; import com.epam.dlab.backendapi.resources.dto.LibInstallFormDTO; import com.epam.dlab.backendapi.resources.dto.LibraryDTO; import com.epam.dlab.backendapi.resources.dto.SearchLibsFormDTO; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.ExternalLibraryService; import com.epam.dlab.backendapi.service.LibraryService; import com.epam.dlab.backendapi.validation.annotation.LibNameValid; @@ -35,7 +34,6 @@ import com.epam.dlab.dto.exploratory.LibInstallDTO; import com.epam.dlab.exceptions.DlabException; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.bson.Document; @@ -55,7 +53,6 @@ import java.util.stream.Collectors; @Path("/infrastructure_provision/exploratory_environment") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Library service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class LibExploratoryResource { @@ -83,12 +80,8 @@ public class LibExploratoryResource { */ @GET @Path("/lib_groups") - @ApiOperation("Returns the list of library groups for notebook or cluster") - public Iterable<String> getLibGroupList(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Iterable<String> getLibGroupList(@Auth UserInfo userInfo, @QueryParam("exploratory_name") @NotBlank String exploratoryName, - @ApiParam(value = "Cluster's name", required = true, allowEmptyValue = - true) @QueryParam("computational_name") String computationalName) { log.trace("Loading list of lib groups for user {} and exploratory {}, computational {}", userInfo.getName(), @@ -126,11 +119,8 @@ public class LibExploratoryResource { */ @GET @Path("/lib_list") - @ApiOperation("Returns the list of installed/failed libraries for notebook or cluster") - public List<Document> getLibList(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public List<Document> getLibList(@Auth UserInfo userInfo, @QueryParam("exploratory_name") @NotBlank String exploratoryName, - @ApiParam(value = "Cluster's name", required = true, allowEmptyValue = true) @QueryParam("computational_name") String computationalName) { log.debug("Loading list of libraries for user {} and exploratory {} and computational {}", userInfo.getName(), @@ -157,9 +147,8 @@ public class LibExploratoryResource { */ @GET @Path("/lib_list/formatted") - @ApiOperation("Returns formatted representation of installed/failed libraries for notebook") - public List<LibInfoRecord> getLibListFormatted(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + + public List<LibInfoRecord> getLibListFormatted(@Auth UserInfo userInfo, @QueryParam("exploratory_name") @NotBlank String exploratoryName) { log.debug("Loading formatted list of libraries for user {} and exploratory {}", userInfo.getName(), @@ -183,10 +172,7 @@ public class LibExploratoryResource { */ @POST @Path("/lib_install") - @ApiOperation("Installs libraries on notebook or cluster") - @ApiResponses(@ApiResponse(code = 200, message = "Libraries were installed successfully")) - public Response libInstall(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Library install form DTO", required = true) + public Response libInstall(@Auth UserInfo userInfo, @Valid @NotNull LibInstallFormDTO formDTO) { log.debug("Installing libs to environment {} for user {}", formDTO, userInfo.getName()); final String exploratoryName = formDTO.getNotebookName(); @@ -208,9 +194,7 @@ public class LibExploratoryResource { */ @POST @Path("search/lib_list") - @ApiOperation("Returns the list of available libraries for notebook basing on search conditions") - public List<LibraryDTO> getLibList(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Search libraries form DTO", required = true) + public List<LibraryDTO> getLibList(@Auth UserInfo userInfo, @Valid @NotNull SearchLibsFormDTO formDTO) { log.trace("Search list of libs for user {} with condition {}", userInfo.getName(), formDTO); try { @@ -242,9 +226,7 @@ public class LibExploratoryResource { @GET @Path("search/lib_list/maven") - @ApiOperation("Return information about maven artifact") - public Response getMavenArtifactInfo(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(required = true, example = DROPWIZARD_ARTIFACT, value = "artifact") + public Response getMavenArtifactInfo(@Auth UserInfo userInfo, @LibNameValid @QueryParam("artifact") String artifact) { final String[] libNameParts = artifact.split(":"); return Response.ok(externalLibraryService.getLibrary(libNameParts[0], libNameParts[1], libNameParts[2])).build(); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SchedulerJobResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SchedulerJobResource.java index 7d5fb33..c4f9ee4 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SchedulerJobResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SchedulerJobResource.java @@ -21,13 +21,11 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.SchedulerJobService; import com.epam.dlab.backendapi.validation.annotation.SchedulerJobDTOValid; import com.epam.dlab.dto.SchedulerJobDTO; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.ws.rs.*; @@ -38,8 +36,6 @@ import javax.ws.rs.core.Response; * Manages scheduler jobs for exploratory environment */ @Path("/infrastructure_provision/exploratory_environment/scheduler") -@Api(value = "Service for scheduling operations with notebooks or clusters", - authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) @Slf4j public class SchedulerJobResource { @@ -61,13 +57,9 @@ public class SchedulerJobResource { */ @POST @Path("/{exploratoryName}") - @ApiOperation("Updates scheduler's data for notebook") - @ApiResponses(@ApiResponse(code = 200, message = "Scheduler's data for notebook was updated successfully")) @Consumes(MediaType.APPLICATION_JSON) - public Response updateExploratoryScheduler(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Response updateExploratoryScheduler(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Scheduler's data", required = true) @SchedulerJobDTOValid SchedulerJobDTO dto) { schedulerJobService.updateExploratorySchedulerData(userInfo.getName(), exploratoryName, dto); return Response.ok().build(); @@ -82,10 +74,7 @@ public class SchedulerJobResource { */ @DELETE @Path("/{exploratoryName}") - @ApiOperation("Removes scheduler for notebook") - @ApiResponses(@ApiResponse(code = 200, message = "Scheduler's data for notebook was updated successfully")) - public Response removeExploratoryScheduler(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Response removeExploratoryScheduler(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName) { log.debug("User {} is trying to remove scheduler for exploratory {}", userInfo.getName(), exploratoryName); schedulerJobService.removeScheduler(userInfo.getName(), exploratoryName); @@ -105,15 +94,9 @@ public class SchedulerJobResource { @POST @Path("/{exploratoryName}/{computationalName}") @Consumes(MediaType.APPLICATION_JSON) - @ApiOperation("Updates scheduler's data for cluster") - @ApiResponses(@ApiResponse(code = 200, message = "Scheduler's data for cluster was updated successfully")) - public Response updateComputationalScheduler(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Response updateComputationalScheduler(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Cluster's name affiliated with notebook", - required = true) @PathParam("computationalName") String computationalName, - @ApiParam(value = "Scheduler's data", required = true) @SchedulerJobDTOValid SchedulerJobDTO dto) { schedulerJobService.updateComputationalSchedulerData(userInfo.getName(), exploratoryName, computationalName, dto); @@ -131,13 +114,8 @@ public class SchedulerJobResource { */ @DELETE @Path("/{exploratoryName}/{computationalName}") - @ApiOperation("Removes scheduler's data for cluster") - @ApiResponses(@ApiResponse(code = 200, message = "Scheduler's data for cluster was removed successfully")) - public Response removeComputationalScheduler(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Response removeComputationalScheduler(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Cluster's name affiliated with notebook", - required = true) @PathParam("computationalName") String computationalName) { log.debug("User {} is trying to remove scheduler for computational {} connected with exploratory {}", userInfo.getName(), computationalName, exploratoryName); @@ -156,10 +134,7 @@ public class SchedulerJobResource { @GET @Path("/{exploratoryName}") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Returns scheduler's data for notebook") - @ApiResponses(@ApiResponse(code = 200, message = "Scheduler's data for notebook fetched successfully")) - public Response fetchSchedulerJobForUserAndExploratory(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Response fetchSchedulerJobForUserAndExploratory(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName) { log.debug("Loading scheduler job for user {} and exploratory {}...", userInfo.getName(), exploratoryName); final SchedulerJobDTO schedulerJob = @@ -179,12 +154,8 @@ public class SchedulerJobResource { @GET @Path("/{exploratoryName}/{computationalName}") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Returns scheduler's data for cluster") - @ApiResponses(@ApiResponse(code = 200, message = "Scheduler's data for cluster fetched successfully")) - public Response fetchSchedulerJobForComputationalResource(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Response fetchSchedulerJobForComputationalResource(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Cluster's name", required = true) @PathParam("computationalName") String computationalName) { log.debug("Loading scheduler job for user {}, exploratory {} and computational resource {}...", userInfo.getName(), exploratoryName, computationalName); @@ -196,10 +167,7 @@ public class SchedulerJobResource { @GET @Path("active") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation("Returns information about scheduler that will take place in defined time") - @ApiResponses(@ApiResponse(code = 200, message = "List of active schedulers")) - public Response getActiveSchedulers(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(name = "minuteOffset", value = "Number of offset minutes from current time") + public Response getActiveSchedulers(@Auth UserInfo userInfo, @QueryParam("minuteOffset") long minuteOffset) { log.trace("Getting active schedulers for user {} and offset {}", userInfo.getName(), minuteOffset); return Response.ok(schedulerJobService.getActiveSchedulers(userInfo.getName(), minuteOffset)).build(); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SecurityResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SecurityResource.java index 95ea9eb..031ffa7 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SecurityResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SecurityResource.java @@ -25,7 +25,6 @@ import com.epam.dlab.auth.dto.UserCredentialDTO; import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration; import com.epam.dlab.backendapi.dao.SecurityDAO; import com.epam.dlab.backendapi.domain.EnvStatusListener; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.roles.UserRoles; import com.epam.dlab.exceptions.DlabException; import com.epam.dlab.rest.client.RESTService; @@ -33,7 +32,6 @@ import com.epam.dlab.rest.dto.ErrorDTO; import com.epam.dlab.validation.AwsValidation; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.hibernate.validator.constraints.NotBlank; @@ -53,7 +51,6 @@ import javax.ws.rs.core.Response.Status; @Path("/user") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api("Authorization service") @Slf4j public class SecurityResource implements SecurityAPI { @@ -80,11 +77,7 @@ public class SecurityResource implements SecurityAPI { @POST @Produces(MediaType.TEXT_PLAIN) @Path("/login") - @ApiOperation("Login attempt for user") - @ApiResponses({@ApiResponse(code = 500, message = "Internal server error occurred"), - @ApiResponse(code = 200, message = "User logged in successfully")}) - public Response userLogin(@ApiParam(value = "User credential DTO", required = true) - @Valid @NotNull UserCredentialDTO credential) { + public Response userLogin(@Valid @NotNull UserCredentialDTO credential) { log.debug("Try login for user {}", credential.getUsername()); try { dao.writeLoginAttempt(credential); @@ -110,14 +103,7 @@ public class SecurityResource implements SecurityAPI { @POST @Consumes(MediaType.TEXT_PLAIN) @Path("/authorize") - @ApiOperation(value = "Authorize attempt for user", authorizations = - @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) - @ApiResponses({ - @ApiResponse(code = 500, message = "Access forbidden"), - @ApiResponse(code = 200, message = "User authorized successfully") - }) - public Response authorize(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "User's name", required = true) + public Response authorize(@Auth UserInfo userInfo, @Valid @NotBlank(groups = AwsValidation.class) String username) { log.debug("Try authorize accessToken {} for user info {}", userInfo.getAccessToken(), userInfo); try { @@ -144,11 +130,7 @@ public class SecurityResource implements SecurityAPI { */ @POST @Path("/logout") - @ApiOperation(value = "Logout attempt for user", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) - @ApiResponses({@ApiResponse(code = 500, message = "Internal server error occured"), - @ApiResponse(code = 403, message = "Logout failed"), - @ApiResponse(code = 200, message = "User logged out successfully")}) - public Response userLogout(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response userLogout(@Auth UserInfo userInfo) { log.debug("Try logout for accessToken {}", userInfo.getAccessToken()); try { envStatusListener.unregisterSession(userInfo); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SystemInfoResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SystemInfoResource.java index 9a5a439..9e646d0 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SystemInfoResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/SystemInfoResource.java @@ -20,11 +20,9 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.resources.dto.SystemInfoDto; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.SystemInfoService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.annotation.security.RolesAllowed; @@ -38,7 +36,6 @@ import javax.ws.rs.core.Response; @Path("sysinfo") @Produces(MediaType.APPLICATION_JSON) @RolesAllowed("sysinfo") -@Api(value = "System information resource", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class SystemInfoResource { private SystemInfoService systemInfoService; @@ -50,9 +47,8 @@ public class SystemInfoResource { @GET - @ApiOperation("Returns information about current system load") - @ApiResponses(@ApiResponse(code = 200, message = "System information (CPU, RAM etc. )")) - public Response getSystemInfo(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + + public Response getSystemInfo(@Auth UserInfo userInfo) { log.debug("Getting system info for user {}...", userInfo.getName()); final SystemInfoDto systemInfoDto = systemInfoService.getSystemInfo(); return Response.ok(systemInfoDto).build(); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserGroupResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserGroupResource.java index 1d82b31..154ddc2 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserGroupResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserGroupResource.java @@ -22,11 +22,9 @@ import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.resources.dto.GroupDTO; import com.epam.dlab.backendapi.resources.dto.UpdateRoleGroupDto; import com.epam.dlab.backendapi.resources.dto.UpdateUserGroupDto; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.UserGroupService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.hibernate.validator.constraints.NotEmpty; @@ -42,7 +40,6 @@ import java.util.Set; @RolesAllowed("/roleManagement") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "User's groups resource", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class UserGroupResource { private final UserGroupService userGroupService; @@ -54,49 +51,29 @@ public class UserGroupResource { @POST - @ApiOperation("Creates group with roles assigned to it") - @ApiResponses({ - @ApiResponse(code = 200, message = "Group successfully created"), - @ApiResponse(code = 404, message = "User role not found") - }) - public Response createGroup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @Valid @ApiParam GroupDTO dto) { + public Response createGroup(@Auth UserInfo userInfo, + @Valid GroupDTO dto) { log.debug("Creating new group {}", dto.getName()); userGroupService.createGroup(dto.getName(), dto.getRoleIds(), dto.getUsers()); return Response.ok().build(); } @PUT - @ApiOperation("Updates user group") - @ApiResponses({ - @ApiResponse(code = 200, message = "Group successfully updated"), - @ApiResponse(code = 404, message = "User role not found") - }) - public Response updateGroup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @Valid @ApiParam GroupDTO dto) { + public Response updateGroup(@Auth UserInfo userInfo, @Valid GroupDTO dto) { log.debug("Updating group {}", dto.getName()); userGroupService.updateGroup(dto.getName(), dto.getRoleIds(), dto.getUsers()); return Response.ok().build(); } @GET - @ApiOperation("List groups with roles assigned to it") - @ApiResponses(@ApiResponse(code = 200, message = "Groups present in application")) - public Response getGroups(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response getGroups(@Auth UserInfo userInfo) { log.debug("Getting all groups for admin {}...", userInfo.getName()); return Response.ok(userGroupService.getAggregatedRolesByGroup()).build(); } @PUT @Path("role") - @ApiOperation("Overrides roles for group") - @ApiResponses({ - @ApiResponse(code = 404, message = "User role not found"), - @ApiResponse(code = 400, message = "Validation exception occurred"), - @ApiResponse(code = 200, message = "Group is successfully added to role")} - ) - public Response updateRolesForGroup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @Valid @ApiParam UpdateRoleGroupDto updateRoleGroupDto) { + public Response updateRolesForGroup(@Auth UserInfo userInfo, @Valid UpdateRoleGroupDto updateRoleGroupDto) { log.info("Admin {} is trying to add new group {} to roles {}", userInfo.getName(), updateRoleGroupDto.getGroup(), updateRoleGroupDto.getRoleIds()); userGroupService.updateRolesForGroup(updateRoleGroupDto.getGroup(), updateRoleGroupDto.getRoleIds()); @@ -105,15 +82,9 @@ public class UserGroupResource { @DELETE @Path("role") - @ApiOperation("Removes user groups from existing roles") - @ApiResponses({ - @ApiResponse(code = 404, message = "User role not found"), - @ApiResponse(code = 400, message = "Validation exception occurred"), - @ApiResponse(code = 200, message = "Group successfully removed from role")} - ) - public Response deleteGroupFromRole(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(required = true) @QueryParam("group") @NotEmpty Set<String> groups, - @ApiParam(required = true) @QueryParam("roleId") @NotEmpty Set<String> roleIds) { + public Response deleteGroupFromRole(@Auth UserInfo userInfo, + @QueryParam("group") @NotEmpty Set<String> groups, + @QueryParam("roleId") @NotEmpty Set<String> roleIds) { log.info("Admin {} is trying to delete groups {} from roles {}", userInfo.getName(), groups, roleIds); userGroupService.removeGroupFromRole(groups, roleIds); return Response.ok().build(); @@ -121,14 +92,8 @@ public class UserGroupResource { @DELETE @Path("{id}") - @ApiOperation("Removes user group from roles that are assigned to it") - @ApiResponses({ - @ApiResponse(code = 409, message = "Group can not be removed"), - @ApiResponse(code = 400, message = "Validation exception occurred"), - @ApiResponse(code = 200, message = "Group successfully removed")} - ) - public Response deleteGroup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam @PathParam("id") String group) { + public Response deleteGroup(@Auth UserInfo userInfo, + @PathParam("id") String group) { log.info("Admin {} is trying to delete group {} from application", userInfo.getName(), group); userGroupService.removeGroup(group); return Response.ok().build(); @@ -136,14 +101,8 @@ public class UserGroupResource { @PUT @Path("user") - @ApiOperation("Adds new users to user group") - @ApiResponses({ - @ApiResponse(code = 404, message = "User role not found"), - @ApiResponse(code = 400, message = "Validation exception occurred"), - @ApiResponse(code = 200, message = "User successfully added to role")} - ) - public Response addUserToGroup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(required = true) @Valid UpdateUserGroupDto updateUserGroupDto) { + public Response addUserToGroup(@Auth UserInfo userInfo, + @Valid UpdateUserGroupDto updateUserGroupDto) { log.info("Admin {} is trying to add new users {} to group {}", userInfo.getName(), updateUserGroupDto.getUsers(), updateUserGroupDto.getGroup()); userGroupService.addUsersToGroup(updateUserGroupDto.getGroup(), updateUserGroupDto.getUsers()); @@ -152,15 +111,9 @@ public class UserGroupResource { @DELETE @Path("user") - @ApiOperation("Removes users from existing group") - @ApiResponses({ - @ApiResponse(code = 404, message = "Group not found"), - @ApiResponse(code = 400, message = "Validation exception occurred"), - @ApiResponse(code = 200, message = "User successfully removed from group")} - ) - public Response deleteUserFromGroup(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(required = true) @QueryParam("user") @NotEmpty String user, - @ApiParam(required = true) @QueryParam("group") @NotEmpty String group) { + public Response deleteUserFromGroup(@Auth UserInfo userInfo, + @QueryParam("user") @NotEmpty String user, + @QueryParam("group") @NotEmpty String group) { log.info("Admin {} is trying to delete user {} from group {}", userInfo.getName(), user, group); userGroupService.removeUserFromGroup(group, user); return Response.ok().build(); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserRoleResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserRoleResource.java index 2e3680a..b9d0619 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserRoleResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserRoleResource.java @@ -20,11 +20,9 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.resources.dto.UserRoleDto; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.UserRoleService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.annotation.security.RolesAllowed; @@ -37,7 +35,6 @@ import javax.ws.rs.core.Response; @RolesAllowed("/roleManagement") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "User's roles resource", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class UserRoleResource { private final UserRoleService userRoleService; @@ -48,19 +45,12 @@ public class UserRoleResource { } @GET - @ApiOperation("List user's roles present in application") - @ApiResponses(value = @ApiResponse(code = 200, message = "User roles present in application")) - public Response getRoles(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public Response getRoles(@Auth UserInfo userInfo) { log.debug("Getting all roles for admin {}...", userInfo.getName()); return Response.ok(userRoleService.getUserRoles()).build(); } @POST - @ApiOperation(value = "Creates new user role") - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Validation exception occurred"), - @ApiResponse(code = 200, message = "User role is successfully added")} - ) public Response createRole(@Auth UserInfo userInfo, UserRoleDto dto) { log.info("Creating new role {} on behalf of admin {}...", dto, userInfo.getName()); userRoleService.createRole(dto); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserSettingsResource.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserSettingsResource.java index 3f611a4..a32dad8 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserSettingsResource.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/UserSettingsResource.java @@ -21,11 +21,9 @@ package com.epam.dlab.backendapi.resources; import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.resources.dto.UserDTO; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.service.UserSettingService; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.NotEmpty; import org.slf4j.Logger; @@ -42,7 +40,6 @@ import java.util.List; @Path("/user/settings") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "User's settings service", authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH)) public class UserSettingsResource { private static final Logger LOGGER = LoggerFactory.getLogger(UserSettingsResource.class); @@ -54,18 +51,14 @@ public class UserSettingsResource { } @GET - @ApiOperation("Returns user's settings") - public String getSettings(@ApiParam(hidden = true) @Auth UserInfo userInfo) { + public String getSettings(@Auth UserInfo userInfo) { String settings = userSettingService.getUISettings(userInfo); LOGGER.debug("Returns settings for user {}, content is {}", userInfo.getName(), settings); return settings; } @POST - @ApiOperation("Saves user's settings to database") - @ApiResponses(@ApiResponse(code = 200, message = "User's settings were saved to database successfully")) - public Response saveSettings(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Settings data", required = true) + public Response saveSettings(@Auth UserInfo userInfo, @NotBlank String settings) { LOGGER.debug("Saves settings for user {}, content is {}", userInfo.getName(), settings); userSettingService.saveUISettings(userInfo, settings); @@ -74,11 +67,9 @@ public class UserSettingsResource { @PUT @Path("budget") - @ApiOperation("Updates allowed budget for users") - @ApiResponses(@ApiResponse(code = 200, message = "User's settings were updated successfully")) @RolesAllowed("/user/settings") - public Response updateUsersBudget(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @Valid @ApiParam @NotEmpty List<UserDTO> budgets) { + public Response updateUsersBudget(@Auth UserInfo userInfo, + @Valid @NotEmpty List<UserDTO> budgets) { LOGGER.debug("User {} is updating allowed budget for users: {}", userInfo.getName(), budgets); userSettingService.updateUsersBudget(budgets); return Response.ok().build(); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/aws/ComputationalResourceAws.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/aws/ComputationalResourceAws.java index 98c0fff..b5551be 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/aws/ComputationalResourceAws.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/aws/ComputationalResourceAws.java @@ -24,7 +24,6 @@ import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration; import com.epam.dlab.backendapi.resources.dto.SparkStandaloneClusterCreateForm; import com.epam.dlab.backendapi.resources.dto.aws.AwsComputationalCreateForm; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.roles.RoleType; import com.epam.dlab.backendapi.roles.UserRoles; import com.epam.dlab.backendapi.service.ComputationalService; @@ -35,7 +34,8 @@ import com.epam.dlab.exceptions.DlabException; import com.epam.dlab.rest.contracts.ComputationalAPI; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import lombok.extern.slf4j.Slf4j; import javax.validation.Valid; @@ -55,8 +55,6 @@ import static com.epam.dlab.dto.base.DataEngineType.SPARK_STANDALONE; @Path("/infrastructure_provision/computational_resources") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Service for computational resources on AWS (NOTE: available only on AWS platform)", - authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH), hidden = true) @Slf4j public class ComputationalResourceAws implements ComputationalAPI { @@ -76,14 +74,8 @@ public class ComputationalResourceAws implements ComputationalAPI { */ @PUT @Path("dataengine-service") - @ApiOperation("Creates EMR cluster on AWS") - @ApiResponses({ - @ApiResponse(code = 302, message = "EMR cluster on AWS with current parameters already exists"), - @ApiResponse(code = 200, message = "EMR cluster on AWS successfully created") - }) - public Response createDataEngineService(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "AWS form DTO for EMR creation", required = true) - @Valid @NotNull AwsComputationalCreateForm form) { + public Response createDataEngineService(@Auth @Parameter(hidden = true) UserInfo userInfo, + @Parameter @Valid @NotNull AwsComputationalCreateForm form) { log.debug("Create computational resources for {} | form is {}", userInfo.getName(), form); @@ -122,13 +114,7 @@ public class ComputationalResourceAws implements ComputationalAPI { @PUT @Path("dataengine") - @ApiOperation("Creates Spark cluster on AWS") - @ApiResponses({ - @ApiResponse(code = 302, message = "Spark cluster on AWS with current parameters already exists"), - @ApiResponse(code = 200, message = "Spark cluster on AWS successfully created") - }) - public Response createDataEngine(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Spark cluster create form DTO", required = true) + public Response createDataEngine(@Auth UserInfo userInfo, @Valid @NotNull SparkStandaloneClusterCreateForm form) { log.debug("Create computational resources for {} | form is {}", userInfo.getName(), form); @@ -148,12 +134,8 @@ public class ComputationalResourceAws implements ComputationalAPI { */ @DELETE @Path("/{exploratoryName}/{computationalName}/terminate") - @ApiOperation("Terminates computational resource (EMR/Spark cluster) on AWS") - @ApiResponses(@ApiResponse(code = 200, message = "EMR/Spark cluster on AWS successfully terminated")) - public Response terminate(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name", required = true) + public Response terminate(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Computational resource's name for terminating", required = true) @PathParam("computationalName") String computationalName) { log.debug("Terminating computational resource {} for user {}", computationalName, userInfo.getName()); @@ -172,12 +154,8 @@ public class ComputationalResourceAws implements ComputationalAPI { */ @DELETE @Path("/{project}/{exploratoryName}/{computationalName}/stop") - @ApiOperation("Stops Spark cluster on AWS") - @ApiResponses(@ApiResponse(code = 200, message = "Spark cluster on AWS successfully stopped")) - public Response stop(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", required = true) + public Response stop(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for stopping", required = true) @PathParam("computationalName") String computationalName) { log.debug("Stopping computational resource {} for user {}", computationalName, userInfo.getName()); @@ -196,14 +174,9 @@ public class ComputationalResourceAws implements ComputationalAPI { */ @PUT @Path("/{project}/{exploratoryName}/{computationalName}/start") - @ApiOperation("Starts Spark cluster on AWS") - @ApiResponses(@ApiResponse(code = 200, message = "Spark cluster on AWS successfully started")) - public Response start(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", required = true) + public Response start(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for starting", required = true) @PathParam("computationalName") String computationalName, - @ApiParam(value = "Project name", required = true) @PathParam("project") String project) { log.debug("Starting computational resource {} for user {}", computationalName, userInfo.getName()); @@ -214,17 +187,9 @@ public class ComputationalResourceAws implements ComputationalAPI { @PUT @Path("dataengine/{exploratoryName}/{computationalName}/config") - @ApiOperation("Updates Spark cluster configuration on AWS") - @ApiResponses( - @ApiResponse(code = 200, message = "Spark cluster configuration on AWS successfully updated") - ) - public Response updateDataEngineConfig(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", - required = true) + public Response updateDataEngineConfig(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for reconfiguring", required = true) @PathParam("computationalName") String computationalName, - @ApiParam(value = "Spark cluster config", required = true) @Valid @NotNull List<ClusterConfig> config) { computationalService.updateSparkClusterConfig(userInfo, exploratoryName, computationalName, config); @@ -233,15 +198,8 @@ public class ComputationalResourceAws implements ComputationalAPI { @GET @Path("{exploratoryName}/{computationalName}/config") - @ApiOperation("Returns Spark cluster configuration on AWS") - @ApiResponses( - @ApiResponse(code = 200, message = "Spark cluster configuration on AWS successfully returned") - ) - public Response getClusterConfig(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", - required = true) + public Response getClusterConfig(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for reconfiguring", required = true) @PathParam("computationalName") String computationalName) { return Response.ok(computationalService.getClusterConfig(userInfo, exploratoryName, computationalName)).build(); } @@ -279,11 +237,12 @@ public class ComputationalResourceAws implements ComputationalAPI { "."); } - if (formDTO.getSlaveInstanceSpotPctPrice() != null){ + if (formDTO.getSlaveInstanceSpotPctPrice() != null) { int slaveSpotInstanceBidPct = formDTO.getSlaveInstanceSpotPctPrice(); if (formDTO.getSlaveInstanceSpot() && (slaveSpotInstanceBidPct < configuration.getMinEmrSpotInstanceBidPct() || slaveSpotInstanceBidPct > configuration.getMaxEmrSpotInstanceBidPct())) { - log.debug("Creating computational resource {} for user {} fail: Spot instances bidding percentage value " + + log.debug("Creating computational resource {} for user {} fail: Spot instances bidding percentage " + + "value " + "out of the boundaries. Minimum is {}, maximum is {}", formDTO.getName(), userInfo.getName(), configuration.getMinEmrSpotInstanceBidPct(), configuration.getMaxEmrSpotInstanceBidPct()); diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/azure/ComputationalResourceAzure.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/azure/ComputationalResourceAzure.java index 5bb3fdc..6b56386 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/azure/ComputationalResourceAzure.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/azure/ComputationalResourceAzure.java @@ -25,7 +25,6 @@ import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration; import com.epam.dlab.backendapi.dao.ComputationalDAO; import com.epam.dlab.backendapi.dao.ExploratoryDAO; import com.epam.dlab.backendapi.resources.dto.SparkStandaloneClusterCreateForm; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.roles.RoleType; import com.epam.dlab.backendapi.roles.UserRoles; import com.epam.dlab.backendapi.service.ComputationalService; @@ -36,7 +35,6 @@ import com.epam.dlab.rest.client.RESTService; import com.google.inject.Inject; import com.google.inject.name.Named; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import javax.annotation.security.RolesAllowed; @@ -53,8 +51,6 @@ import java.util.List; @Path("/infrastructure_provision/computational_resources") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Service for computational resources on Azure. (NOTE: available only on AZURE platform)", - authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH), hidden = true) @Slf4j public class ComputationalResourceAzure { @@ -85,13 +81,7 @@ public class ComputationalResourceAzure { @PUT @Path("dataengine") @RolesAllowed(UserSessionDurationAuthorizer.SHORT_USER_SESSION_DURATION) - @ApiOperation("Creates Spark cluster on Azure") - @ApiResponses({ - @ApiResponse(code = 302, message = "Spark cluster on Azure with current parameters already exists"), - @ApiResponse(code = 200, message = "Spark cluster on Azure successfully created") - }) - public Response createDataEngine(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Spark cluster create form DTO", required = true) + public Response createDataEngine(@Auth UserInfo userInfo, @Valid @NotNull SparkStandaloneClusterCreateForm form) { log.debug("Create computational resources for {} | form is {}", userInfo.getName(), form); @@ -116,13 +106,8 @@ public class ComputationalResourceAzure { */ @DELETE @Path("/{exploratoryName}/{computationalName}/terminate") - @ApiOperation("Terminates computational Spark cluster on Azure") - @ApiResponses(@ApiResponse(code = 200, message = "Spark cluster on Azure successfully terminated")) - public Response terminate(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to computational resource", - required = true) + public Response terminate(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for terminating", required = true) @PathParam("computationalName") String computationalName) { log.debug("Terminating computational resource {} for user {}", computationalName, userInfo.getName()); @@ -142,12 +127,8 @@ public class ComputationalResourceAzure { */ @DELETE @Path("/{project}/{exploratoryName}/{computationalName}/stop") - @ApiOperation("Stops Spark cluster on Azure") - @ApiResponses(@ApiResponse(code = 200, message = "Spark cluster on Azure successfully stopped")) - public Response stop(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", required = true) + public Response stop( @Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for stopping", required = true) @PathParam("computationalName") String computationalName) { log.debug("Stopping computational resource {} for user {}", computationalName, userInfo.getName()); @@ -166,14 +147,9 @@ public class ComputationalResourceAzure { */ @PUT @Path("/{project}/{exploratoryName}/{computationalName}/start") - @ApiOperation("Starts Spark cluster on Azure") - @ApiResponses(@ApiResponse(code = 200, message = "Spark cluster on Azure successfully started")) - public Response start(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", required = true) + public Response start(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for starting", required = true) @PathParam("computationalName") String computationalName, - @ApiParam(value = "Project name", required = true) @PathParam("project") String project) { log.debug("Starting computational resource {} for user {}", computationalName, userInfo.getName()); @@ -184,17 +160,9 @@ public class ComputationalResourceAzure { @PUT @Path("dataengine/{exploratoryName}/{computationalName}/config") - @ApiOperation("Updates Spark cluster configuration on AWS") - @ApiResponses( - @ApiResponse(code = 200, message = "Spark cluster configuration on AWS successfully updated") - ) - public Response updateDataEngineConfig(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", - required = true) + public Response updateDataEngineConfig(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for reconfiguring", required = true) @PathParam("computationalName") String computationalName, - @ApiParam(value = "Spark cluster config", required = true) @Valid @NotNull List<ClusterConfig> config) { computationalService.updateSparkClusterConfig(userInfo, exploratoryName, computationalName, config); @@ -203,15 +171,8 @@ public class ComputationalResourceAzure { @GET @Path("{exploratoryName}/{computationalName}/config") - @ApiOperation("Returns Spark cluster configuration on AWS") - @ApiResponses( - @ApiResponse(code = 200, message = "Spark cluster configuration on AWS successfully returned") - ) - public Response getClusterConfig(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", - required = true) + public Response getClusterConfig(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for reconfiguring", required = true) @PathParam("computationalName") String computationalName) { return Response.ok(computationalService.getClusterConfig(userInfo, exploratoryName, computationalName)).build(); } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/gcp/ComputationalResourceGcp.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/gcp/ComputationalResourceGcp.java index ae2c444..ecacf84 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/gcp/ComputationalResourceGcp.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/gcp/ComputationalResourceGcp.java @@ -23,7 +23,6 @@ import com.epam.dlab.auth.UserInfo; import com.epam.dlab.backendapi.conf.SelfServiceApplicationConfiguration; import com.epam.dlab.backendapi.resources.dto.SparkStandaloneClusterCreateForm; import com.epam.dlab.backendapi.resources.dto.gcp.GcpComputationalCreateForm; -import com.epam.dlab.backendapi.resources.swagger.SwaggerSecurityInfo; import com.epam.dlab.backendapi.roles.RoleType; import com.epam.dlab.backendapi.roles.UserRoles; import com.epam.dlab.backendapi.service.ComputationalService; @@ -34,7 +33,8 @@ import com.epam.dlab.exceptions.DlabException; import com.epam.dlab.rest.contracts.ComputationalAPI; import com.google.inject.Inject; import io.dropwizard.auth.Auth; -import io.swagger.annotations.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import lombok.extern.slf4j.Slf4j; import javax.validation.Valid; @@ -53,8 +53,6 @@ import static com.epam.dlab.dto.UserInstanceStatus.CREATING; @Path("/infrastructure_provision/computational_resources") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) -@Api(value = "Service for computational resources on GCP. (NOTE: available only on GCP platform)", - authorizations = @Authorization(SwaggerSecurityInfo.TOKEN_AUTH), hidden = true) @Slf4j public class ComputationalResourceGcp implements ComputationalAPI { @@ -74,14 +72,9 @@ public class ComputationalResourceGcp implements ComputationalAPI { */ @PUT @Path("dataengine-service") - @ApiOperation("Creates Dataproc cluster on GCP") - @ApiResponses({ - @ApiResponse(code = 302, message = "Dataproc cluster on GCP with current parameters already exists"), - @ApiResponse(code = 200, message = "Dataproc cluster on GCP created successfully") - }) - public Response createDataEngineService(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "GCP form DTO for Dataproc creation", required = true) - @Valid @NotNull GcpComputationalCreateForm formDTO) { + @Operation(tags = "computational", summary = "Create dataproc cluster") + public Response createDataEngineService(@Auth @Parameter(hidden = true) UserInfo userInfo, + @Valid @NotNull @Parameter GcpComputationalCreateForm formDTO) { log.debug("Create computational resources for {} | form is {}", userInfo.getName(), formDTO); @@ -117,13 +110,7 @@ public class ComputationalResourceGcp implements ComputationalAPI { */ @PUT @Path("dataengine") - @ApiOperation("Creates Spark cluster on GCP") - @ApiResponses({ - @ApiResponse(code = 302, message = "Spark cluster on GCP with current parameters already exists"), - @ApiResponse(code = 200, message = "Spark cluster on GCP successfully created") - }) - public Response createDataEngine(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Spark cluster create form DTO", required = true) + public Response createDataEngine(@Auth UserInfo userInfo, @Valid @NotNull SparkStandaloneClusterCreateForm form) { log.debug("Create computational resources for {} | form is {}", userInfo.getName(), form); @@ -148,13 +135,8 @@ public class ComputationalResourceGcp implements ComputationalAPI { */ @DELETE @Path("/{exploratoryName}/{computationalName}/terminate") - @ApiOperation("Terminates computational resource (Dataproc/Spark cluster) on GCP") - @ApiResponses(@ApiResponse(code = 200, message = "Dataproc/Spark cluster on GCP successfully terminated")) - public Response terminate(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to computational resource", - required = true) + public Response terminate(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Computational resource's name for terminating", required = true) @PathParam("computationalName") String computationalName) { log.debug("Terminating computational resource {} for user {}", computationalName, userInfo.getName()); @@ -173,12 +155,8 @@ public class ComputationalResourceGcp implements ComputationalAPI { */ @DELETE @Path("/{project}/{exploratoryName}/{computationalName}/stop") - @ApiOperation("Stops Spark cluster on GCP") - @ApiResponses(@ApiResponse(code = 200, message = "Spark cluster on GCP successfully stopped")) - public Response stop(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", required = true) + public Response stop(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for stopping", required = true) @PathParam("computationalName") String computationalName) { log.debug("Stopping computational resource {} for user {}", computationalName, userInfo.getName()); @@ -197,14 +175,9 @@ public class ComputationalResourceGcp implements ComputationalAPI { */ @PUT @Path("/{project}/{exploratoryName}/{computationalName}/start") - @ApiOperation("Starts Spark cluster on GCP") - @ApiResponses(@ApiResponse(code = 200, message = "Spark cluster on GCP successfully started")) - public Response start(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", required = true) + public Response start(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for starting", required = true) @PathParam("computationalName") String computationalName, - @ApiParam(value = "Project name", required = true) @PathParam("project") String project) { log.debug("Starting computational resource {} for user {}", computationalName, userInfo.getName()); @@ -215,17 +188,9 @@ public class ComputationalResourceGcp implements ComputationalAPI { @PUT @Path("dataengine/{exploratoryName}/{computationalName}/config") - @ApiOperation("Updates Spark cluster configuration on AWS") - @ApiResponses( - @ApiResponse(code = 200, message = "Spark cluster configuration on AWS successfully updated") - ) - public Response updateDataEngineConfig(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", - required = true) + public Response updateDataEngineConfig(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for reconfiguring", required = true) @PathParam("computationalName") String computationalName, - @ApiParam(value = "Spark cluster config", required = true) @Valid @NotNull List<ClusterConfig> config) { computationalService.updateSparkClusterConfig(userInfo, exploratoryName, computationalName, config); @@ -234,15 +199,8 @@ public class ComputationalResourceGcp implements ComputationalAPI { @GET @Path("{exploratoryName}/{computationalName}/config") - @ApiOperation("Returns Spark cluster configuration on AWS") - @ApiResponses( - @ApiResponse(code = 200, message = "Spark cluster configuration on AWS successfully returned") - ) - public Response getClusterConfig(@ApiParam(hidden = true) @Auth UserInfo userInfo, - @ApiParam(value = "Notebook's name corresponding to Spark cluster", - required = true) + public Response getClusterConfig(@Auth UserInfo userInfo, @PathParam("exploratoryName") String exploratoryName, - @ApiParam(value = "Spark cluster's name for reconfiguring", required = true) @PathParam("computationalName") String computationalName) { return Response.ok(computationalService.getClusterConfig(userInfo, exploratoryName, computationalName)).build(); } diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/swagger/SwaggerSecurityInfo.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/swagger/SwaggerSecurityInfo.java deleted file mode 100644 index 0066df2..0000000 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/swagger/SwaggerSecurityInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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 - * - * http://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 com.epam.dlab.backendapi.resources.swagger; - -import io.swagger.annotations.ApiKeyAuthDefinition; -import io.swagger.annotations.SecurityDefinition; -import io.swagger.annotations.SwaggerDefinition; - -import javax.ws.rs.core.HttpHeaders; - -@SwaggerDefinition( - securityDefinition = - @SecurityDefinition(apiKeyAuthDefinitions = - @ApiKeyAuthDefinition( - key = SwaggerSecurityInfo.TOKEN_AUTH, - in = ApiKeyAuthDefinition.ApiKeyLocation.HEADER, - name = HttpHeaders.AUTHORIZATION)) -) -public interface SwaggerSecurityInfo { - String TOKEN_AUTH = "Token authorization"; -} diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java index 2125398..6537add 100644 --- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java +++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/EnvironmentServiceImpl.java @@ -127,9 +127,6 @@ public class EnvironmentServiceImpl implements EnvironmentService { checkProjectResourceConditions(project, "stop"); exploratoryDAO.fetchRunningExploratoryFieldsForProject(project) .forEach(this::stopNotebook); - /*if (projectService.get(project).getStatus() == ProjectDTO.Status.ACTIVE) { - projectService.stop(systemUserInfoService.create("admin"), project); - }*/ } @Override --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org