From 2da06840e91d27dc1aa70f3f1332b034c0bbc9e2 Mon Sep 17 00:00:00 2001 From: iam-ssrivastav Date: Mon, 25 May 2026 00:42:53 +0530 Subject: [PATCH] fix(apigateway): implement V1 deleteDeployment endpoint and return correct JSON 404 error (#1019) --- .../apigateway/ApiGatewayController.java | 10 ++++++++++ .../apigateway/ApiGatewayIntegrationTest.java | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java b/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java index 9a95b222a7..95ac6bce29 100644 --- a/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java +++ b/src/main/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayController.java @@ -523,6 +523,16 @@ public class ApiGatewayController { .type(MediaType.APPLICATION_JSON).build(); } + @DELETE + @Path("/restapis/{apiId}/deployments/{deploymentId}") + public Response deleteDeployment(@Context HttpHeaders headers, + @PathParam("apiId") String apiId, + @PathParam("deploymentId") String deploymentId) { + String region = regionResolver.resolveRegion(headers); + service.deleteDeployment(region, apiId, deploymentId); + return Response.noContent().build(); + } + @POST @Path("/restapis/{apiId}/stages") public Response createStage(@Context HttpHeaders headers, diff --git a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTest.java index e993c7fa80..a6adcf3bfc 100644 --- a/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/apigateway/ApiGatewayIntegrationTest.java @@ -336,6 +336,20 @@ class ApiGatewayIntegrationTest { } @Test @Order(27) + void deleteDeployment() { + given() + .when().delete("/restapis/" + apiId + "/deployments/" + deploymentId) + .then() + .statusCode(204); + + given() + .when().get("/restapis/" + apiId + "/deployments/" + deploymentId) + .then() + .statusCode(404) + .body("message", notNullValue()); + } + + @Test @Order(28) void deleteResource() { given() .when().delete("/restapis/" + apiId + "/resources/" + resourceId) @@ -343,7 +357,7 @@ class ApiGatewayIntegrationTest { .statusCode(204); } - @Test @Order(28) + @Test @Order(29) void deleteRestApi() { given() .when().delete("/restapis/" + apiId) @@ -351,7 +365,7 @@ class ApiGatewayIntegrationTest { .statusCode(202); } - @Test @Order(29) + @Test @Order(30) void getDeletedRestApiReturns404() { given() .when().get("/restapis/" + apiId)