-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate copy.yaml
83 lines (81 loc) · 2.75 KB
/
template copy.yaml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: >
calSyncLambda
Sample SAM Template for calSyncLambda
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 30
Runtime: nodejs14.x
Environment:
Variables:
CLIENT_ID: your client id here
CLIENT_SECRET: your client secret here
WEBHOOK_URL: your webhook url here
SUBSCRIPTION_SECRET: your subscription secret here
TENANT_ID: your azure AD tenant ID here
CALENDAR_OWNER_UPN: your calendar anchor UPN here
CALENDAR_GROUP_NAME: your calendar group name here
GROUP_EMAIL_PREPEND: your random string here
Resources:
WebhookService:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: subscription-refresh/dist
Handler: dist/WebhookService.lambdaHandler
Environment:
Variables:
WEBHOOK_RESPONDER_NAME: !Ref WebhookResponder
Events:
Webhook:
Type: Api
Properties:
Path: /Webhooks/{webhookType}
Method: post
Policies:
- LambdaInvokePolicy:
FunctionName: !Ref WebhookResponder
SubscriptionRefreshService:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
Handler: dist/SubscriptionService.lambdaHandler
Events:
RefreshEvery12hrs:
Type: Schedule
Properties:
Schedule: rate(1 minute)
WebhookResponder:
Type: AWS::Serverless::Function
Properties:
Handler: dist/WebhookResponder.lambdaHandler
DynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
pollGraph:
Type: AWS::Serverless::Function
Properties:
Handler: dist/pollGraph.lambdaHandler
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref DynamoDBTable
Timeout: 300
Events:
runEveryMinute:
Type: Schedule
Properties:
Schedule: rate(1 minute)
Enabled: true
Outputs:
WebhookService:
Description: "API Gateway endpoint URL for Prod stage CalSync"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/Webhooks/"