This repository was archived by the owner on Jul 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtemplate.yaml
153 lines (142 loc) · 3.76 KB
/
template.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
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
150
151
152
153
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
sam-app
Sample SAM Template for sam-app
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3
Resources:
DynamoDbFailedLoginsTable:
Type: "AWS::DynamoDB::Table"
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: ListId
AttributeType: S
- AttributeName: TodoId
AttributeType: S
KeySchema:
- AttributeName: ListId
KeyType: HASH
- AttributeName: TodoId
KeyType: RANGE
TableName: "SwiftLambdaTodos"
APIGateway:
Type: AWS::Serverless::Api
Properties:
StageName: test
Cors:
AllowMethods: "'OPTIONS,GET,POST,DELETE,PATCH'"
AllowHeaders: "'Content-Type'"
AllowOrigin : "'*'"
AllowCredentials: "'*'"
TodoAPIGatewayListFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda.zip
Handler: "list"
Runtime: provided
Layers:
- arn:aws:lambda:eu-central-1:426836788079:layer:Swift:11
Policies:
- DynamoDBReadPolicy:
TableName: "SwiftLambdaTodos"
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref APIGateway
Path: /todos
Method: GET
TodoAPIGatewayCreateFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda.zip
Handler: "create"
Runtime: provided
Layers:
- arn:aws:lambda:eu-central-1:426836788079:layer:Swift:11
Policies:
- DynamoDBCrudPolicy:
TableName: "SwiftLambdaTodos"
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref APIGateway
Path: /todos
Method: POST
TodoAPIGatewayDeleteAllFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda.zip
Handler: "deleteAll"
Runtime: provided
Layers:
- arn:aws:lambda:eu-central-1:426836788079:layer:Swift:11
Policies:
- DynamoDBCrudPolicy:
TableName: "SwiftLambdaTodos"
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref APIGateway
Path: /todos
Method: DELETE
TodoAPIGatewayGetTodo:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda.zip
Handler: "getTodo"
Runtime: provided
Layers:
- arn:aws:lambda:eu-central-1:426836788079:layer:Swift:11
Policies:
- DynamoDBReadPolicy:
TableName: "SwiftLambdaTodos"
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref APIGateway
Path: /todos/{id}
Method: GET
TodoAPIGatewayDeleteTodo:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda.zip
Handler: "deleteTodo"
Runtime: provided
Layers:
- arn:aws:lambda:eu-central-1:426836788079:layer:Swift:11
Policies:
- DynamoDBCrudPolicy:
TableName: "SwiftLambdaTodos"
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref APIGateway
Path: /todos/{id}
Method: DELETE
TodoAPIGatewayPatchTodo:
Type: AWS::Serverless::Function
Properties:
CodeUri: lambda.zip
Handler: "patchTodo"
Runtime: provided
Layers:
- arn:aws:lambda:eu-central-1:426836788079:layer:Swift:11
Policies:
- DynamoDBCrudPolicy:
TableName: "SwiftLambdaTodos"
Events:
Api:
Type: Api
Properties:
RestApiId: !Ref APIGateway
Path: /todos/{id}
Method: PATCH