-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
66 lines (61 loc) · 1.86 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
A Hello World application for Rebilly App Store
Parameters:
SecretApiKey:
Description: "Your Rebilly Secret Key"
Type: "String"
NoEcho: true
Default: ""
Globals:
Function:
Timeout: 3
Environment:
Variables:
APPLICATION_ID: "hello-world"
COUPON_ID: "welcome-coupon"
Api:
Cors:
AllowMethods: "'GET,POST,OPTIONS'"
AllowHeaders: "'content-type'"
AllowOrigin: "'*'"
AllowCredentials: "'*'"
Resources:
# Handler of the `application-enabled` event that triggers each time the application installed
ApplicationEnabledFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src
Handler: application_enabled.handler
Runtime: python3.8
Events:
ApplicationEnabledEventHandler:
Type: Api
Properties:
# Configure Rebilly rules engine to trigger a webhook on `application-enabled` event to this path
Path: /application-enabled
Method: POST
Environment:
Variables:
SecretApiKey: !Ref SecretApiKey
# Handler of the `customer-created` event that triggers each time a customer created in an organization installed the application
CustomerCreatedFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: src
Handler: customer_created.handler
Runtime: python3.8
Events:
CustomerCreatedEventHandler:
Type: Api
Properties:
Path: /customer-created
Method: POST
Environment:
Variables:
SecretApiKey: !Ref SecretApiKey
Outputs:
HelloWorldApi:
Description: "API Gateway endpoint URL for Hello World function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"