forked from ModusCreateOrg/lambda-redirector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_spec.yml
72 lines (69 loc) · 1.82 KB
/
app_spec.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
---
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Api:
OpenApiVersion: '3.0.2'
Parameters:
HTTPResponse:
Type: Number
Default: 302
AllowedValues: [301, 302]
Description: "The HTTP response status code."
NewDomain:
Type: String
Description: "New domain to redirect to."
Resources:
GetFunction:
Type: AWS::Serverless::Function
Properties:
Description: "Handles GET requests."
Handler: get.handler
Runtime: nodejs10.x
CodeUri: ./lambda
Environment:
Variables:
NEW_DOMAIN: !Ref NewDomain
HTTP_RESPONSE: !Ref HTTPResponse
Events:
GetProxy:
Type: Api
Properties:
Path: /{proxy+}
Method: get
GetCustom:
Type: Api
Properties:
Path: /
Method: get
AnyFunction:
Type: AWS::Serverless::Function
Properties:
Description: "Handles everything except GET requests."
Handler: any.handler
Runtime: nodejs10.x
CodeUri: ./lambda
Environment:
Variables:
NEW_DOMAIN: !Ref NewDomain
HTTP_RESPONSE: !Ref HTTPResponse
Events:
AnyProxy:
Type: Api
Properties:
Path: /{proxy+}
Method: any
AnyCustom:
Type: Api
Properties:
Path: /
Method: any
Outputs:
apiGatewayConsoleDashboardUrl:
Value: !Sub " https://console.aws.amazon.com/apigateway/home?region=${AWS::Region}#/apis/${ServerlessRestApi}/dashboard"
redirectorInvokeUrl:
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/"
anyFunctionArn:
Value: !GetAtt "AnyFunction.Arn"
getFunctionArn:
Value: !GetAtt "GetFunction.Arn"