|
|
|
|
package kr.re.etri.autoflow.controllers;
|
|
|
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import kr.re.etri.autoflow.entity.KubeflowRunEntity;
|
|
|
|
|
import kr.re.etri.autoflow.payload.request.KubeflowRunSearchRequest;
|
|
|
|
|
import kr.re.etri.autoflow.repository.KubeflowRunRepository;
|
|
|
|
|
import kr.re.etri.autoflow.service.KubeflowRunService;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springdoc.core.annotations.ParameterObject;
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Tag(name = "Kubeflow Run", description = "Kubeflow Run 조회 API")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/api/kubeflow/runs")
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class KubeflowRunsController {
|
|
|
|
|
|
|
|
|
|
private final KubeflowRunRepository runRepository;
|
|
|
|
|
|
|
|
|
|
private final KubeflowRunService kubeflowRunService;
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "모든 Kubeflow Run 조회")
|
|
|
|
|
@GetMapping
|
|
|
|
|
public ResponseEntity<List<KubeflowRunEntity>> getAllRuns() {
|
|
|
|
|
List<KubeflowRunEntity> runs = runRepository.findAll();
|
|
|
|
|
return ResponseEntity.ok(runs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "Kubeflow Run 단건 조회")
|
|
|
|
|
@GetMapping("/{runId}")
|
|
|
|
|
public ResponseEntity<KubeflowRunEntity> getRun(
|
|
|
|
|
@Parameter(description = "Kubeflow Run ID", example = "ad980d7f-050a-4c59-a775-94394befad40")
|
|
|
|
|
@PathVariable("runId") String runId) {
|
|
|
|
|
|
|
|
|
|
return runRepository.findByRunId(runId)
|
|
|
|
|
.map(ResponseEntity::ok)
|
|
|
|
|
.orElse(ResponseEntity.notFound().build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "Kubeflow Run 검색 및 페이지네이션 조회")
|
|
|
|
|
@GetMapping("/search")
|
|
|
|
|
public ResponseEntity<Page<KubeflowRunEntity>> searchRuns(
|
|
|
|
|
@ParameterObject @ModelAttribute KubeflowRunSearchRequest request) {
|
|
|
|
|
|
|
|
|
|
Page<KubeflowRunEntity> page = kubeflowRunService.search(request);
|
|
|
|
|
return ResponseEntity.ok(page);
|
|
|
|
|
}
|
|
|
|
|
}
|