diff --git a/.gradle/8.10.2/executionHistory/executionHistory.bin b/.gradle/8.10.2/executionHistory/executionHistory.bin index e0e0669..743aa2c 100644 Binary files a/.gradle/8.10.2/executionHistory/executionHistory.bin and b/.gradle/8.10.2/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.10.2/executionHistory/executionHistory.lock b/.gradle/8.10.2/executionHistory/executionHistory.lock index 096597e..92f4a2f 100644 Binary files a/.gradle/8.10.2/executionHistory/executionHistory.lock and b/.gradle/8.10.2/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.10.2/fileHashes/fileHashes.bin b/.gradle/8.10.2/fileHashes/fileHashes.bin index ad8e511..4c7044f 100644 Binary files a/.gradle/8.10.2/fileHashes/fileHashes.bin and b/.gradle/8.10.2/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.10.2/fileHashes/fileHashes.lock b/.gradle/8.10.2/fileHashes/fileHashes.lock index 866cfe6..6f8033d 100644 Binary files a/.gradle/8.10.2/fileHashes/fileHashes.lock and b/.gradle/8.10.2/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.10.2/fileHashes/resourceHashesCache.bin b/.gradle/8.10.2/fileHashes/resourceHashesCache.bin index 6da73c0..2730e79 100644 Binary files a/.gradle/8.10.2/fileHashes/resourceHashesCache.bin and b/.gradle/8.10.2/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 7f4c769..e391a0c 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe index a93fed3..09e5fa5 100644 Binary files a/.gradle/file-system.probe and b/.gradle/file-system.probe differ diff --git a/.idea/modules/McpBackend.test.iml b/.idea/modules/McpBackend.test.iml index cb07205..0d810aa 100644 --- a/.idea/modules/McpBackend.test.iml +++ b/.idea/modules/McpBackend.test.iml @@ -4,7 +4,6 @@ - diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/AwsResourceService$1.class.uniqueId11 b/build/tmp/compileJava/compileTransaction/stash-dir/AwsResourceService$1.class.uniqueId11 new file mode 100644 index 0000000..bbd262a Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/AwsResourceService$1.class.uniqueId11 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/AwsResourceService.class.uniqueId10 b/build/tmp/compileJava/compileTransaction/stash-dir/AwsResourceService.class.uniqueId10 index 90df812..70af8c7 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/AwsResourceService.class.uniqueId10 and b/build/tmp/compileJava/compileTransaction/stash-dir/AwsResourceService.class.uniqueId10 differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index 33922dc..46bf302 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/src/main/java/AIWA/McpBackend/controller/api/dto/routetable/RouteTableResponseDto.java b/src/main/java/AIWA/McpBackend/controller/api/dto/routetable/RouteTableResponseDto.java index 1475d08..cde9743 100644 --- a/src/main/java/AIWA/McpBackend/controller/api/dto/routetable/RouteTableResponseDto.java +++ b/src/main/java/AIWA/McpBackend/controller/api/dto/routetable/RouteTableResponseDto.java @@ -1,5 +1,6 @@ package AIWA.McpBackend.controller.api.dto.routetable; +import AIWA.McpBackend.controller.api.dto.subnet.SubnetResponseDto; import lombok.Getter; import java.util.List; @@ -11,12 +12,14 @@ public class RouteTableResponseDto { private String vpcId; private List routes; private Map tags; + private List associatedSubnets; - public RouteTableResponseDto(String routeTableId, String vpcId, List routes, Map tags) { + public RouteTableResponseDto(String routeTableId, String vpcId, List routes, Map tags, List associatedSubnets) { this.routeTableId = routeTableId; this.vpcId = vpcId; this.routes = routes; this.tags = tags; + this.associatedSubnets = associatedSubnets; } // Getters and Setters diff --git a/src/main/java/AIWA/McpBackend/service/aws/AwsResourceService.java b/src/main/java/AIWA/McpBackend/service/aws/AwsResourceService.java index 28a4089..048293e 100644 --- a/src/main/java/AIWA/McpBackend/service/aws/AwsResourceService.java +++ b/src/main/java/AIWA/McpBackend/service/aws/AwsResourceService.java @@ -116,16 +116,28 @@ public List fetchSubnets(String userId) { // Route Tables 가져오기 public List fetchRouteTables(String userId) { initializeClient(userId); + + // 서브넷 정보를 먼저 가져옵니다. + List allSubnets = fetchSubnets(userId); + DescribeRouteTablesRequest request = DescribeRouteTablesRequest.builder().build(); DescribeRouteTablesResponse response = ec2Client.describeRouteTables(request); + return response.routeTables().stream() .map(routeTable -> { Map tagsMap = routeTable.tags() == null ? Collections.emptyMap() : routeTable.tags().stream().collect(Collectors.toMap(Tag::key, Tag::value)); + List routes = routeTable.routes().stream() .map(route -> new RouteDTO(route.gatewayId(), route.destinationCidrBlock())) .collect(Collectors.toList()); - return new RouteTableResponseDto(routeTable.routeTableId(), routeTable.vpcId(), routes, tagsMap); + + // 각 라우팅 테이블과 연결된 서브넷을 필터링합니다. + List associatedSubnets = allSubnets.stream() + .filter(subnet -> subnet.getVpcId().equals(routeTable.vpcId())) + .collect(Collectors.toList()); + + return new RouteTableResponseDto(routeTable.routeTableId(), routeTable.vpcId(), routes, tagsMap, associatedSubnets); }) .collect(Collectors.toList()); }