-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
52 lines (47 loc) · 1.29 KB
/
serverless.yml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
service: juryou-api
plugins:
- serverless-dotenv-plugin
provider:
name: aws
runtime: nodejs12.x
region: sa-east-1
iamRoleStatements:
- Effect: Allow
Action:
- SNS:Publish
Resource:
Fn::Join:
- ""
- - "arn:aws:sns:${self:provider.region}:"
- Ref: "AWS::AccountId"
- ":${self:custom.sendInvoiceTopic}"
httpApi:
cors: true
authorizers:
juryouApiAuthorizer:
identitySource: $request.header.Authorization
issuerUrl: https://cognito-idp.${self:custom.cognitoPoolRegion}.amazonaws.com/${self:custom.cognitoPoolId}
audience:
- ${self:custom.cognitoClientId}
custom:
stage: ${opt:stage}
cognitoPoolRegion: ${env:COGNITO_POOL_REGION}
cognitoPoolId: ${env:COGNITO_POOL_ID}
cognitoClientId: ${env:COGNITO_CLIENT_ID}
sendInvoiceTopic: "donaronline-send-invoice-${self:custom.stage}"
functions:
invoice:
handler: handler.handleInvoice
events:
- httpApi:
path: /invoice
method: post
authorizer:
name: juryouApiAuthorizer
environment:
SNS_ARN:
Fn::Join:
- ""
- - "arn:aws:sns:${self:provider.region}:"
- Ref : "AWS::AccountId"
- ":${self:custom.sendInvoiceTopic}"