-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from nationalarchives/Use-aws-proxy-event-for-i…
…nput Use APIGatewayProxyRequestEvent to get the input parameter
- Loading branch information
Showing
5 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 7 additions & 12 deletions
19
src/main/scala/uk/gov/nationalarchives/draftmetadatavalidator/LambdaRunner.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
package uk.gov.nationalarchives.draftmetadatavalidator | ||
|
||
import java.io.{ByteArrayInputStream, ByteArrayOutputStream} | ||
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent | ||
|
||
object LambdaRunner extends App { | ||
private val body = | ||
"""{ | ||
| "consignmentId": "f82af3bf-b742-454c-9771-bfd6c5eae749" | ||
|} | ||
|""".stripMargin | ||
import scala.jdk.CollectionConverters.MapHasAsJava | ||
|
||
private val baos = new ByteArrayInputStream(body.getBytes()) | ||
val output = new ByteArrayOutputStream() | ||
new Lambda().handleRequest(baos, output) | ||
val res = output.toByteArray.map(_.toChar).mkString | ||
println(res) | ||
object LambdaRunner extends App { | ||
val pathParams = Map("consignmentId" -> "f82af3bf-b742-454c-9771-bfd6c5eae749").asJava | ||
val event = new APIGatewayProxyRequestEvent() | ||
event.setPathParameters(pathParams) | ||
new Lambda().handleRequest(event, null) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters