-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
121 lines (115 loc) · 3.26 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
# Service Name
service: vws
provider:
name: aws
runtime: nodejs6.10
stage: v1
# profile: <PROFILE_NAME>
environment:
JCDECAUX_KEY: ${file(./config/secret.yml):JCDECAUX_KEY}
VELIB_TABLE: ${self:resources.Resources.velibTable.Properties.TableName}
VELIB_DETAILS_TABLE: ${self:resources.Resources.velibDetailsTable.Properties.TableName}
GOBEE_DETAILS_TABLE: ${self:resources.Resources.gobeeDetailsTable.Properties.TableName}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
Resource:
- "Fn::Join": ["", ["arn:aws:dynamodb:", {"Ref": "AWS::Region"}, ":", {"Ref": "AWS::AccountId"}, ":table/velibTable*"]]
- "Fn::Join": ["", ["arn:aws:dynamodb:", {"Ref": "AWS::Region"}, ":", {"Ref": "AWS::AccountId"}, ":table/velibDetailsTable*"]]
- "Fn::Join": ["", ["arn:aws:dynamodb:", {"Ref": "AWS::Region"}, ":", {"Ref": "AWS::AccountId"}, ":table/gobeeDetailsTable*"]]
package:
individually: true
exclude:
- test/**
- .git/**
functions:
velib:
handler: src/velib/src/index.handler
package:
exclude: ./src/**
include: ./src/velib/**
events:
- schedule:
rate: cron(0 * * * ? *)
- http:
path: /velib
method: GET
cors: true
velibStations:
handler: src/velib/src/stations.handler
package:
exclude: ./src/**
include: ./src/velib/**
events:
- schedule:
rate: cron(0 * * * ? *)
- http:
path: /velib/stations
method: GET
cors: true
gobeeParis:
handler: src/velib/src/gobeeParis.handler
package:
exclude: ./src/**
include: ./src/velib/**
events:
- schedule:
rate: cron(0 * * * ? *)
- http:
path: /gobee/bikes/paris
method: GET
cors: true
resources:
Resources:
velibTable: # Store global statistics on all stations
Type: AWS::DynamoDB::Table
Properties:
TableName: velibTable
AttributeDefinitions:
- AttributeName: date
AttributeType: S
KeySchema:
- AttributeName: date
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 2
WriteCapacityUnits: 2
velibDetailsTable: # Store statistics by stations
Type: AWS::DynamoDB::Table
Properties:
TableName: velibDetailsTable
AttributeDefinitions:
- AttributeName: date
AttributeType: S
KeySchema:
- AttributeName: date
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 2
WriteCapacityUnits: 2
gobeeDetailsTable: # Store statistics by stations
Type: AWS::DynamoDB::Table
Properties:
TableName: gobeeDetailsTable
AttributeDefinitions:
- AttributeName: date
AttributeType: S
KeySchema:
- AttributeName: date
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 2
WriteCapacityUnits: 2
custom:
dynamodb:
start:
migrate: true
plugins:
- serverless-mocha-plugin
- serverless-dynamodb-local
- serverless-offline