-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserverless.yml
149 lines (148 loc) · 4.82 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
service: slack-send-app
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
memorySize: 128
versionFunctions: false
cfLogs: true
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:*"
Resource: "*"
environment:
DDB_TOKENS: slack-send-server-${opt:stage, self:provider.stage}-v0.0-tokens
DDB_MESSAGES: ${self:service}-${opt:stage, self:provider.stage}-v0.0-messages
package:
exclude:
- .npmignore
- fixtures/**
- .git/**
functions:
schedule:
handler: handler.scheduled_event
description: Handle scheduled event
timeout: 30
events:
- schedule:
name: ${self:service}-${opt:stage, self:provider.stage}-every-5-mins
description: Every 5 minutes
rate: rate(5 minutes)
enabled: true
- http:
path: slack/send/run
method: get
private: false
command:
handler: handler.slack_command
description: Handle slash commands from Slack
timeout: 30
events:
- http:
path: slack/send/command
method: post
private: false
- schedule:
rate: rate(5 minutes)
description: keeps lambda warm
enabled: true
input:
inputpath: "/slack/send/command"
actions:
handler: handler.slack_actions
description: Handle interactive message actions from Slack
timeout: 30
events:
- http:
path: slack/send/actions
method: post
private: false
- schedule:
rate: rate(5 minutes)
description: keeps lambda warm
enabled: true
input:
inputpath: "/slack/send/actions"
options:
handler: handler.slack_options
description: Handle interactive message options from Slack
timeout: 30
events:
- http:
path: slack/send/options
method: post
private: false
events:
handler: handler.slack_events
description: Handle events from Slack
timeout: 30
events:
- http:
path: slack/send/events
method: post
private: false
resources:
Resources:
TableScheduledMessages:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.environment.DDB_MESSAGES}
AttributeDefinitions:
- AttributeName: ymd
AttributeType: S
- AttributeName: id
AttributeType: S
- AttributeName: date_id
AttributeType: S
- AttributeName: team_id
AttributeType: S
- AttributeName: user_id
AttributeType: S
KeySchema:
- AttributeName: ymd
KeyType: HASH
- AttributeName: date_id
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 20
WriteCapacityUnits: 5
GlobalSecondaryIndexes:
- IndexName: team_user_index
KeySchema:
- AttributeName: team_id
KeyType: HASH
- AttributeName: user_id
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 20
WriteCapacityUnits: 0
- IndexName: team_id_index
KeySchema:
- AttributeName: team_id
KeyType: HASH
- AttributeName: id
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 20
WriteCapacityUnits: 0
ScheduleLogGroup:
Properties:
RetentionInDays: "7"
CommandLogGroup:
Properties:
RetentionInDays: "7"
ActionsLogGroup:
Properties:
RetentionInDays: "7"
OptionsLogGroup:
Properties:
RetentionInDays: "7"
EventsLogGroup:
Properties:
RetentionInDays: "7"