-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleLambda3.scala
More file actions
36 lines (26 loc) · 1.15 KB
/
ExampleLambda3.scala
File metadata and controls
36 lines (26 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.encalmo.lambda.example
import org.encalmo.aws.AwsClient
import org.encalmo.lambda.ApiGatewayRequestHandler
import org.encalmo.lambda.GenericEventHandler
import org.encalmo.lambda.LambdaEnvironment
import org.encalmo.lambda.LambdaRuntime
import org.encalmo.lambda.MultipleHandlersSupport
import org.encalmo.lambda.SqsEventHandler
import scala.annotation.static
object ExampleLambda3 {
@static def main(args: Array[String]): Unit = new ExampleLambda2().run()
}
class ExampleLambda3(maybeAwsClient: Option[AwsClient] = None) extends LambdaRuntime with MultipleHandlersSupport {
type ApplicationContext = AwsClient
override def initialize(using environment: LambdaEnvironment): AwsClient = {
maybeAwsClient.getOrElse(
AwsClient.initializeWithProperties(environment.maybeGetProperty)
)
}
override val apiGatewayRequestHandlers: Iterable[ApiGatewayRequestHandler[AwsClient]] =
Seq(ExampleApiGatewayRequestHandler)
override val sqsEventHandlers: Iterable[SqsEventHandler[AwsClient]] =
Seq(ExampleSqsEventHandler)
override val genericEventHandlers: Iterable[GenericEventHandler[AwsClient]] =
Seq(ExampleGenericEventHandler)
}