/
api_with_request_parameters_openapi.yaml
49 lines (47 loc) · 1.24 KB
/
api_with_request_parameters_openapi.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
Globals:
Api:
OpenApiVersion: 3.0.1
CacheClusterEnabled: true
CacheClusterSize: '0.5'
MethodSettings:
- ResourcePath: /one
HttpMethod: GET
CachingEnabled: true
CacheTtlInSeconds: 15
Resources:
ApiParameterFunction:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
exports.handler = function(event, context, callback) {
var returnVal = "undef";
if (event.queryStringParameters.type === "time") {
returnVal = "time" + Date.now();
}
if (event.queryStringParameters.type === "date") {
returnVal = "Random" + Math.random();
}
callback(null, {
"statusCode": 200,
"body": returnVal
});
}
Handler: index.handler
Runtime: nodejs18.x
Events:
GetHtml:
Type: Api
Properties:
Path: /one
Method: get
RequestParameters:
- method.request.querystring.type:
Required: true
Caching: true
AnotherGetHtml:
Type: Api
Properties:
Path: /two
Method: get
Metadata:
SamTransformTest: true