@Test public void getEnvironment() { Response getEnvResponse = environmentStoreApi.getEnvironment("foo"); Environment environment = getEnvironmentFromResponse(getEnvResponse); assertEquals("foo", environment.getEnvironmentSpec().getName()); assertEquals(kernelName, environment.getEnvironmentSpec().getKernelSpec().getName()); assertEquals(kernelChannels, environment.getEnvironmentSpec().getKernelSpec().getChannels()); assertEquals(kernelDependencies, environment.getEnvironmentSpec().getKernelSpec().getDependencies()); assertEquals("continuumio/miniconda", environment.getEnvironmentSpec().getDockerImage()); }
@GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) public Response getEnvironment( @PathParam(RestConstants.ENVIRONMENT_ID) String name) { try { Environment environment = environmentManager.getEnvironment(name); return new JsonResponse.Builder<Environment>(Response.Status.OK) .success(true).result(environment).build(); } catch (SubmarineRuntimeException e) { return parseEnvironmentServiceException(e); } }
EnvironmentRestApi { @GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) public Response getEnvironment( @PathParam(RestConstants.ENVIRONMENT_ID) String name) { try { Environment environment = environmentManager.getEnvironment(name); return new JsonResponse.Builder<Environment>(Response.Status.OK) .success(true).result(environment).build(); } catch (SubmarineRuntimeException e) { return parseEnvironmentServiceException(e); } } }
EnvironmentRestApi { @GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) public Response getEnvironment( @PathParam(RestConstants.ENVIRONMENT_ID) String name) { try { Environment environment = environmentManager.getEnvironment(name); return new JsonResponse.Builder<Environment>(Response.Status.OK) .success(true).result(environment).build(); } catch (SubmarineRuntimeException e) { return parseEnvironmentServiceException(e); } }  }
EnvironmentRestApi { @GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) public Response getEnvironment( @PathParam(RestConstants.ENVIRONMENT_ID) String name) { try { Environment environment = environmentManager.getEnvironment(name); return new JsonResponse.Builder<Environment>(Response.Status.OK) .success(true).result(environment).build(); } catch (SubmarineRuntimeException e) { return parseEnvironmentServiceException(e); } }  @POST @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Create a environment", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class)))}) Response createEnvironment(EnvironmentSpec spec); @PATCH @Path("/{id}") @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Update the environment with job spec", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response updateEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name,
      EnvironmentSpec spec); @DELETE @Path("/{id}") @Operation(summary = "Delete the environment", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response deleteEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name); @GET @Operation(summary = "List of Environments", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class)))}) Response listEnvironment(@QueryParam("status") String status); @GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response getEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name); }
EnvironmentRestApi { @GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) public Response getEnvironment( @PathParam(RestConstants.ENVIRONMENT_ID) String name) { try { Environment environment = environmentManager.getEnvironment(name); return new JsonResponse.Builder<Environment>(Response.Status.OK) .success(true).result(environment).build(); } catch (SubmarineRuntimeException e) { return parseEnvironmentServiceException(e); } }  @POST @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Create a environment", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class)))}) Response createEnvironment(EnvironmentSpec spec); @PATCH @Path("/{id}") @Consumes({RestConstants.MEDIA_TYPE_YAML, MediaType.APPLICATION_JSON}) @Operation(summary = "Update the environment with job spec", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response updateEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name,
      EnvironmentSpec spec); @DELETE @Path("/{id}") @Operation(summary = "Delete the environment", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response deleteEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name); @GET @Operation(summary = "List of Environments", tags = {"environments"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema( implementation = Environment.class)))}) Response listEnvironment(@QueryParam("status") String status); @GET @Path("/{id}") @Operation(summary = "Find environment by name", tags = {"environment"}, responses = { @ApiResponse(description = "successful operation", content = @Content( schema = @Schema(implementation = Environment.class))), @ApiResponse( responseCode = "404", description = "Environment not found")}) Response getEnvironment(
      @PathParam(RestConstants.ENVIRONMENT_ID) String name);  }