-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
100 lines (93 loc) · 2.25 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
service: regenesis-scraper
configValidationMode: error
package:
patterns:
- '!**'
- dist.*
provider:
name: aws
runtime: nodejs18.x
stage: ${opt:stage, 'dev'}
memorySize: 128
environment:
GENESIS_URL: ${env:GENESIS_URL}
GENESIS_UNAME: ${env:GENESIS_UNAME}
GENESIS_PWORD: ${env:GENESIS_PWORD}
SERVICE: ${self:service}
STAGE: ${self:provider.stage}
REGION: ${aws:region}
iam:
role:
statements:
- Effect: "Allow"
Action:
- "dynamodb:Query"
- "dynamodb:GetItem"
- "dynamodb:PutItem"
Resource: "arn:aws:dynamodb:${aws:region}:*:table/${self:service}-${self:provider.stage}"
resources:
Resources:
DynamoDBTableGrades:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:service}-${self:provider.stage}
AttributeDefinitions:
- AttributeName: partition_key
AttributeType: S
- AttributeName: sort_key
AttributeType: S
KeySchema:
- AttributeName: partition_key
KeyType: HASH
- AttributeName: sort_key
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
plugins:
- serverless-offline
- serverless-prune-plugin
custom:
prune:
automatic: true
number: 2
functions:
filters_read:
handler: dist.filters_read
events:
- http:
method: GET
path: /filters/{studentid}
cors: true
- http:
method: GET
path: /filters/{studentid}/{schoolyear}
cors: true
grades_read:
handler: dist.grades_read
events:
- http:
method: GET
path: /read/{studentid}
cors: true
- http:
method: GET
path: /grades/{studentid}
cors: true
- http:
method: GET
path: /grades/{studentid}/{schoolyear}
cors: true
- http:
method: GET
path: /grades/{studentid}/{schoolyear}/{mp}
cors: true
grades_write:
handler: dist.grades_write
timeout: 16
events:
- schedule:
name: update-2501419
rate: rate(6 hours)
input:
studentid: 2501419