feat: 어댑터/인터페이스/클라이언트 버킷 상태 모니터링 API 추가

- InflowTargetBucketController: 버킷 상태 조회 REST API
  GET /manage/inflow/adapter/bucket-status
  GET /manage/inflow/adapter/{adapterId}/bucket-status
  GET /manage/inflow/interface/bucket-status
  GET /manage/inflow/interface/{interfaceId}/bucket-status
  GET /manage/inflow/client/bucket-status
  GET /manage/inflow/client/{clientId}/bucket-status
- InflowTargetBucketService: DualInflowControlManager 에서 버킷 상태 조회
- TargetBucketStatusDTO: 어댑터/인터페이스/클라이언트 공통 버킷 상태 DTO

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curry772
2026-04-29 14:59:26 +09:00
parent 4d479e4fd6
commit 5f24bacd48
3 changed files with 254 additions and 0 deletions
@@ -0,0 +1,106 @@
package com.eactive.eai.manage.inflow;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 어댑터/인터페이스/클라이언트 버킷 상태 모니터링 API.
*
* DualInflowControlManager 가 활성화된 환경에서만 정상 응답한다.
* 비활성화 환경에서는 success=false 또는 빈 목록을 반환한다.
*
* GET /manage/inflow/adapter/bucket-status → 전체 어댑터 버킷 상태
* GET /manage/inflow/adapter/{adapterId}/bucket-status → 특정 어댑터 버킷 상태
* GET /manage/inflow/interface/bucket-status → 전체 인터페이스 버킷 상태
* GET /manage/inflow/interface/{interfaceId}/bucket-status → 특정 인터페이스 버킷 상태
* GET /manage/inflow/client/bucket-status → 전체 클라이언트 버킷 상태
* GET /manage/inflow/client/{clientId}/bucket-status → 특정 클라이언트 버킷 상태
*/
@RestController
@RequestMapping("/manage/inflow")
public class InflowTargetBucketController {
@Autowired
private InflowTargetBucketService bucketService;
// =========================================================================
// 어댑터
// =========================================================================
@GetMapping("/adapter/bucket-status")
public ResponseEntity<?> getAllAdapterBucketStatus() {
List<TargetBucketStatusDTO> list = bucketService.getAllAdapterBucketStatus();
return ok(list);
}
@GetMapping("/adapter/{adapterId}/bucket-status")
public ResponseEntity<?> getAdapterBucketStatus(@PathVariable String adapterId) {
TargetBucketStatusDTO dto = bucketService.getAdapterBucketStatus(adapterId);
return single(dto, "어댑터를 찾을 수 없습니다: " + adapterId);
}
// =========================================================================
// 인터페이스
// =========================================================================
@GetMapping("/interface/bucket-status")
public ResponseEntity<?> getAllInterfaceBucketStatus() {
List<TargetBucketStatusDTO> list = bucketService.getAllInterfaceBucketStatus();
return ok(list);
}
@GetMapping("/interface/{interfaceId}/bucket-status")
public ResponseEntity<?> getInterfaceBucketStatus(@PathVariable String interfaceId) {
TargetBucketStatusDTO dto = bucketService.getInterfaceBucketStatus(interfaceId);
return single(dto, "인터페이스를 찾을 수 없습니다: " + interfaceId);
}
// =========================================================================
// 클라이언트
// =========================================================================
@GetMapping("/client/bucket-status")
public ResponseEntity<?> getAllClientBucketStatus() {
List<TargetBucketStatusDTO> list = bucketService.getAllClientBucketStatus();
return ok(list);
}
@GetMapping("/client/{clientId}/bucket-status")
public ResponseEntity<?> getClientBucketStatus(@PathVariable String clientId) {
TargetBucketStatusDTO dto = bucketService.getClientBucketStatus(clientId);
return single(dto, "클라이언트를 찾을 수 없습니다: " + clientId);
}
// =========================================================================
// Helpers
// =========================================================================
private ResponseEntity<?> ok(List<TargetBucketStatusDTO> list) {
Map<String, Object> result = new HashMap<>();
result.put("success", true);
result.put("data", list);
result.put("count", list.size());
return ResponseEntity.ok(result);
}
private ResponseEntity<?> single(TargetBucketStatusDTO dto, String notFoundMsg) {
if (dto == null) {
Map<String, Object> error = new HashMap<>();
error.put("success", false);
error.put("message", notFoundMsg);
return ResponseEntity.ok(error);
}
Map<String, Object> result = new HashMap<>();
result.put("success", true);
result.put("data", dto);
return ResponseEntity.ok(result);
}
}