Dennis Dang
03/19/2021, 4:11 PMDennis Dang
03/19/2021, 4:12 PMDennis Dang
03/19/2021, 4:15 PMDennis Dang
03/19/2021, 4:18 PMFunction
and attach to it the Api
construct?
cc @Dmitry PavlukFrank
attachPermissionsToRoute
will do the trick. An example here https://docs.serverless-stack.com/constructs/Api#for-a-specific-routeDennis Dang
03/19/2021, 6:52 PMMike McCall
03/19/2021, 10:33 PMconst topic = new Topic(this, "Topic")
const meFn = new sst.Function(this, "MeFunction", {
handler: "src/me.handler",
})
meFn.addToRolePolicy(new iam.PolicyStatement({
actions: ["sns:Publish"],
effect: iam.Effect.ALLOW,
resources: [topic.snsTopic.topicArn]
}))
api.addRoute(this, 'GET /me', meFn)
Dmitry Pavluk
03/19/2021, 10:56 PMFrank
internal lambdas that act as ingress or egressdo you mean a lambda subscribed to a topic or a consumes a queue, like this?
new sst.Queue(this, "Queue", {
consumer: "src/consumer.main"
})
Dmitry Pavluk
03/19/2021, 11:58 PMFrank
routes
added to sst.Api
respond to API requests.Frank
subscribers
in a sst.Topic
will only get invoked when a message is sent to the SNS topic.Frank
Dmitry Pavluk
03/20/2021, 1:10 AM