Last active
March 8, 2018 20:20
-
-
Save mkotsur/5b54906a56e26d7080f3aa5088fd1ffe to your computer and use it in GitHub Desktop.
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
package hello | |
import scala.beans.BeanProperty | |
case class ApiGatewayResponse(@BeanProperty statusCode: Integer, @BeanProperty body: String, | |
@BeanProperty headers: java.util.Map[String, Object], @BeanProperty base64Encoded: Boolean = false) |
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
package hello | |
import com.amazonaws.services.lambda.runtime.{Context, RequestHandler} | |
import scala.collection.JavaConverters | |
class Handler extends RequestHandler[Request, Response] { | |
def handleRequest(input: Request, context: Context): Response = { | |
Response("Go Serverless v1.0! Your function executed successfully!", input) | |
} | |
} | |
class ApiGatewayHandler extends RequestHandler[Request, ApiGatewayResponse] { | |
def handleRequest(input: Request, context: Context): ApiGatewayResponse = { | |
val headers = Map("x-custom-response-header" -> "my custom response header value") | |
ApiGatewayResponse(200, "Go Serverless v1.0! Your function executed successfully!", | |
JavaConverters.mapAsJavaMap[String, Object](headers), | |
true) | |
} | |
} |
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
package hello | |
import scala.beans.BeanProperty | |
class Request(@BeanProperty var key1: String, @BeanProperty var key2: String, @BeanProperty var key3: String) { | |
def this() = this("", "", "") | |
} |
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
package hello | |
import scala.beans.BeanProperty | |
case class Response(@BeanProperty message: String, @BeanProperty request: Request) |
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
package: | |
artifact: target/scala-2.12/hello.jar | |
functions: | |
hello: | |
handler: hello.Handler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment