Light, fluffy, and always free - The AWS Local Emulator alternative
fix(apigateway): implement GET deployment (#652)
Ricardo Limac77c469ff4e3
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 7fd58d8abb..414eec00c3 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@@ -442,6 +442,16 @@ public class ApiGatewayController {return Response.ok(root.toString()).type(MediaType.APPLICATION_JSON).build();}+ @GET+ @Path("/restapis/{apiId}/deployments/{deploymentId}")+ public Response getDeployment(@Context HttpHeaders headers,+ @PathParam("apiId") String apiId,+ @PathParam("deploymentId") String deploymentId) {+ String region = regionResolver.resolveRegion(headers);+ return Response.ok(toDeploymentNode(service.getDeployment(region, apiId, deploymentId)).toString())+ .type(MediaType.APPLICATION_JSON).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 99ff795257..9a35f19950 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@@ -218,9 +218,19 @@ class ApiGatewayIntegrationTest {.body("item.id", hasItem(deploymentId));}+ @Test @Order(18)+ void getDeployment() {+ given()+ .when().get("/restapis/" + apiId + "/deployments/" + deploymentId)+ .then()+ .statusCode(200)+ .body("id", equalTo(deploymentId))+ .body("description", equalTo("v1"));+ }+// ──────────────────────────── Stages ────────────────────────────- @Test @Order(18)+ @Test @Order(19)void createStage() {given().contentType(ContentType.JSON)@@ -232,7 +242,7 @@ class ApiGatewayIntegrationTest {.body("deploymentId", equalTo(deploymentId));}- @Test @Order(19)+ @Test @Order(20)void getStage() {given().when().get("/restapis/" + apiId + "/stages/prod")@@ -241,7 +251,7 @@ class ApiGatewayIntegrationTest {.body("stageName", equalTo("prod"));}- @Test @Order(20)+ @Test @Order(21)void listStages() {given().when().get("/restapis/" + apiId + "/stages")@@ -250,7 +260,7 @@ class ApiGatewayIntegrationTest {.body("item.stageName", hasItem("prod"));}- @Test @Order(21)+ @Test @Order(22)void updateStage() {String patch = """{"patchOperations":[{"op":"replace","path":"/description","value":"Production"}]}@@ -266,7 +276,7 @@ class ApiGatewayIntegrationTest {// ──────────────────────────── Tags ────────────────────────────- @Test @Order(22)+ @Test @Order(23)void tagResource() {String arn = "arn:aws:apigateway:us-east-1::/restapis/" + apiId;given()@@ -277,7 +287,7 @@ class ApiGatewayIntegrationTest {.statusCode(204);}- @Test @Order(23)+ @Test @Order(24)void getTags() {String arn = "arn:aws:apigateway:us-east-1::/restapis/" + apiId;given()@@ -287,7 +297,7 @@ class ApiGatewayIntegrationTest {.body("tags.env", equalTo("test"));}- @Test @Order(24)+ @Test @Order(25)void untagResource() {String arn = "arn:aws:apigateway:us-east-1::/restapis/" + apiId;given()@@ -305,7 +315,7 @@ class ApiGatewayIntegrationTest {// ──────────────────────────── Cleanup ────────────────────────────- @Test @Order(25)+ @Test @Order(26)void deleteStage() {given().when().delete("/restapis/" + apiId + "/stages/prod")@@ -313,7 +323,7 @@ class ApiGatewayIntegrationTest {.statusCode(202);}- @Test @Order(26)+ @Test @Order(27)void deleteResource() {given().when().delete("/restapis/" + apiId + "/resources/" + resourceId)@@ -321,7 +331,7 @@ class ApiGatewayIntegrationTest {.statusCode(204);}- @Test @Order(27)+ @Test @Order(28)void deleteRestApi() {given().when().delete("/restapis/" + apiId)@@ -329,7 +339,7 @@ class ApiGatewayIntegrationTest {.statusCode(202);}- @Test @Order(28)+ @Test @Order(29)void getDeletedRestApiReturns404() {given().when().get("/restapis/" + apiId)