-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
198 lines (164 loc) · 7.51 KB
/
template.yaml
File metadata and controls
198 lines (164 loc) · 7.51 KB
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
com.networknt.petstore-1.0.1
Sample SAM Template for com.networknt.petstore-1.0.1
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 20
Parameters:
ParamStage:
Type: String
Description: Deployment stage.
Default: test
ParamServiceId:
Type: String
Description: Unique service id for your application
Default: com.networknt.petstore-1.0.1
Resources:
PetstoreFunctionRole:
Type: AWS::IAM::Role
Properties:
RoleName: petstore-function-role
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: lambda.amazonaws.com
Action:
- "sts:AssumeRole"
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Policies:
- PolicyName: DirectInvokePetstoreLambda
PolicyDocument:
Version: "2012-10-17"
Statement:
Action:
- lambda:InvokeFunction
- lambda:InvokeAsync
Effect: Allow
Resource: "*"
PetsGetFunction:
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: PetsGetFunction
Handler: com.networknt.petstore.handler.App::handleRequest
Runtime: provided.al2023
MemorySize: 512
FunctionName: PetsGetFunction
Role: !Sub ${PetstoreFunctionRole.Arn}
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
PetsPostFunction:
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: PetsPostFunction
Handler: com.networknt.petstore.handler.App::handleRequest
Runtime: provided.al2023
MemorySize: 512
FunctionName: PetsPostFunction
Role: !Sub ${PetstoreFunctionRole.Arn}
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
PetsPetIdGetFunction:
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: PetsPetIdGetFunction
Handler: com.networknt.petstore.handler.App::handleRequest
Runtime: provided.al2023
MemorySize: 512
FunctionName: PetsPetIdGetFunction
Role: !Sub ${PetstoreFunctionRole.Arn}
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
PetsPetIdDeleteFunction:
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: PetsPetIdDeleteFunction
Handler: com.networknt.petstore.handler.App::handleRequest
Runtime: provided.al2023
MemorySize: 512
FunctionName: PetsPetIdDeleteFunction
Role: !Sub ${PetstoreFunctionRole.Arn}
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
PARAM1: VALUE
PetstoreNativeLambdaProxyFunction:
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: s3://networknt-native-lambda-jar-for-deployment-reference/lambda-native-custom-runtime.zip
CodeUri: s3://networknt-native-lambda-jar-for-deployment-reference/lambda-native-2.1.34-SNAPSHOT.jar
Handler: com.networknt.aws.lambda.app.LambdaApp::handleRequest
Layers:
- !Ref PetstoreConfigLayer
# Runtime: provided.al2023
Runtime: java11
MemorySize: 512
FunctionName: PetstoreNativeLambdaProxyFunction
Role: !Sub ${PetstoreFunctionRole.Arn}
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
JAVA_TOOL_OPTIONS: -Dlight-4j-config-dir=/opt
Events:
PetstoreHealthGet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /health
Method: GET
PetstoreAdmHealthGet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /adm/health
Method: GET
PetstoreAdmServerInfoGet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /adm/server/info
Method: GET
PetstoreAdmLoggerGet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /adm/logger
Method: GET
PetstoreAdmLoggerPost:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /adm/logger
Method: POST
PetsGet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /v1/pets
Method: GET
PetsPost:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /v1/pets
Method: POST
PetsPetIdGet:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /v1/pets/{petId}
Method: GET
PetsPetIdDelete:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /v1/pets/{petId}
Method: DELETE
PetstoreConfigLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: sam-app-petstore-config-layer
Description: Configuration for the petstore
ContentUri: config/
CompatibleRuntimes:
- java11
- java17
LicenseInfo: 'MIT'
RetentionPolicy: Retain