Light, fluffy, and always free - The AWS Local Emulator alternative
fix(apigateway): implement V1 deleteDeployment endpoint and return correct JSON 404 error (#1019)
iam-ssrivastav2da06840e91d
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.javaindex 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.javaindex 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)