@@ -14,10 +14,12 @@ import (
1414 "sync"
1515
1616 "github.com/aws/aws-sdk-go-v2/config"
17+ "github.com/localstack/lambda-runtime-init/internal/aws/lambda"
1718 "github.com/localstack/lambda-runtime-init/internal/aws/xray"
1819 "github.com/localstack/lambda-runtime-init/internal/bootstrap"
1920 "github.com/localstack/lambda-runtime-init/internal/events"
2021 "github.com/localstack/lambda-runtime-init/internal/hotreloading"
22+ "github.com/localstack/lambda-runtime-init/internal/localstack"
2123 "github.com/localstack/lambda-runtime-init/internal/logging"
2224 "github.com/localstack/lambda-runtime-init/internal/server"
2325
@@ -31,8 +33,8 @@ import (
3133 supv "go.amzn.com/lambda/supervisor"
3234)
3335
34- func InitLsOpts () * server. LsOpts {
35- return & server. LsOpts {
36+ func InitLsOpts () * localstack. Config {
37+ return & localstack. Config {
3638 // required
3739 RuntimeEndpoint : utils .MustGetEnv ("LOCALSTACK_RUNTIME_ENDPOINT" ),
3840 RuntimeId : utils .MustGetEnv ("LOCALSTACK_RUNTIME_ID" ),
@@ -55,8 +57,8 @@ func InitLsOpts() *server.LsOpts {
5557 }
5658}
5759
58- func InitFunctionConfig () server .FunctionConfig {
59- return server .FunctionConfig {
60+ func InitFunctionConfig () lambda .FunctionConfig {
61+ return lambda .FunctionConfig {
6062 FunctionName : utils .GetEnvWithDefault ("AWS_LAMBDA_FUNCTION_NAME" , "test_function" ),
6163 FunctionVersion : utils .GetEnvWithDefault ("AWS_LAMBDA_FUNCTION_VERSION" , "$LATEST" ),
6264 FunctionTimeoutSec : utils .GetEnvWithDefault ("AWS_LAMBDA_FUNCTION_TIMEOUT" , "30" ),
@@ -189,14 +191,14 @@ func main() {
189191
190192 // Custom Interop Server
191193 defaultServer := rapidcore .NewServer ()
192- lsAdapter := server . NewLocalStackAdapter (lsOpts .RuntimeEndpoint , lsOpts .RuntimeId )
193- interopServer := server .NewInteropServer (defaultServer , lsAdapter )
194+ lsClient := localstack . NewLocalStackClient (lsOpts .RuntimeEndpoint , lsOpts .RuntimeId )
195+ interopServer := server .NewInteropServer (defaultServer , lsClient )
194196
195197 // Services required for Sandbox environment
196198 logCollector := logging .NewLogCollector ()
197199 localStackLogsEgressApi := logging .NewLocalStackLogsEgressAPI (logCollector )
198200 tracer := tracing .NewLocalStackTracer ()
199- eventsListener := events .NewEventsListener ( lsAdapter )
201+ eventsListener := events .NewLocalStackEventsAPI ( lsClient )
200202
201203 defaultSupv := supv .NewLocalSupervisor ()
202204 wrappedSupv := supervisor .NewLocalStackSupervisor (ctx , defaultSupv , eventsListener , interopServer .InternalState )
@@ -246,7 +248,7 @@ func main() {
246248 interopServer .SetSandboxContext (sandboxContext )
247249 interopServer .SetInternalStateGetter (internalStateFn )
248250
249- localStackService := server .NewLocalStackService (interopServer , logCollector , lsAdapter , xrayConfig .Endpoint , lsOpts , functionConf , awsEnvConf )
251+ localStackService := server .NewLocalStackService (interopServer , logCollector , lsClient , xrayConfig .Endpoint , lsOpts , functionConf , awsEnvConf )
250252
251253 // start runtime init. It is important to start `InitHandler` synchronously because we need to ensure the
252254 // notification channels and status fields are properly initialized before `AwaitInitialized`
@@ -285,7 +287,7 @@ func main() {
285287 // return
286288 } else {
287289 log .Debugln ("Completed initialization of runtime init. Sending status ready to LocalStack." )
288- if err := localStackService .SendStatus (server .Ready , []byte {}); err != nil {
290+ if err := localStackService .SendStatus (localstack .Ready , []byte {}); err != nil {
289291 log .Fatalln ("Failed to send status ready to LocalStack " + err .Error () + ". Exiting." )
290292 }
291293 }
0 commit comments