public Response startContainer()

in karavan-web/karavan-app/src/main/java/org/apache/camel/karavan/api/InfrastructureResource.java [181:210]


    public Response startContainer(@PathParam("env") String env, @PathParam("type") String type, @PathParam("name") String name, JsonObject command) throws Exception {
        if (infinispanService.isReady()) {
            // set container statuses
            setContainerStatusTransit(name, type);
            // exec docker commands
            if (command.containsKey("command")) {
                if (command.getString("command").equalsIgnoreCase("run")) {
                    if (Objects.equals(type, ContainerStatus.ContainerType.devservice.name())) {
                        String code = projectService.getDevServiceCode();
                        DevService devService = dockerService.getDevService(code, name);
                        if (devService != null) {
                            dockerService.createDevserviceContainer(devService);
                            dockerService.runContainer(devService.getContainer_name());
                        }
                    } else if (Objects.equals(type, ContainerStatus.ContainerType.devmode.name())) {
                        dockerService.createDevmodeContainer(name, "");
                        dockerService.runContainer(name);
                    }
                    return Response.ok().build();
                } else if (command.getString("command").equalsIgnoreCase("stop")) {
                    dockerService.stopContainer(name);
                    return Response.ok().build();
                } else if (command.getString("command").equalsIgnoreCase("pause")) {
                    dockerService.pauseContainer(name);
                    return Response.ok().build();
                }
            }
        }
        return Response.notModified().build();
    }