Repository navigation
Expand file tree
/
Copy pathtemplate.yaml
More file actions
87 lines (76 loc) · 2.39 KB
/
Copy pathtemplate.yaml
File metadata and controls
87 lines (76 loc) · 2.39 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
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: Event consumer service
Globals:
Function:
Runtime: python3.11
Parameters:
DiscordClientId:
Type: "AWS::SSM::Parameter::Value<String>"
Description: Honeycomb API Key
Default: "/discobot/discord_client_id"
DiscordPublicKey:
Type: "AWS::SSM::Parameter::Value<String>"
Description: Usage Plan API Key
Default: "/discobot/discord_public_key"
HoneycombApiKey:
Type: "AWS::SSM::Parameter::Value<String>"
Description: Honeycomb API Key
Default: "/discobot/honeycomb_api_key"
Resources:
SlashCommandsApi:
Type: AWS::Serverless::Api
Properties:
EndpointConfiguration: REGIONAL
StageName: Prod
OpenApiVersion: "2.0"
MethodSettings:
- HttpMethod: '*'
ResourcePath: '/*'
ThrottlingRateLimit: 10
ThrottlingBurstLimit: 10
DefinitionBody:
swagger: 2.0
x-amazon-apigateway-request-validators:
params:
validateRequestBody: false
validateRequestParameters: true
paths:
/discord:
post:
x-amazon-apigateway-request-validator: params
parameters:
- in: header
required: true
type: string
name: "X-Signature-Ed25519"
- in: header
required: true
type: integer
name: "X-Signature-Timestamp"
x-amazon-apigateway-integration:
httpMethod: post
type: aws_proxy
uri:
!Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${EventReceiver.Arn}/invocations
EventReceiver:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/slash_command
Handler: slash_command.lambda_handler
Timeout: 30
Environment:
Variables:
DISCORD_CLIENT_ID: !Ref DiscordClientId
DISCORD_PUBLIC_KEY: !Ref DiscordPublicKey
HONEYCOMB_API_KEY: !Ref HoneycombApiKey
Events:
Interaction:
Type: Api
Properties:
Path: /discord
Method: POST
RestApiId: !Ref SlashCommandsApi
Outputs:
ApiUrl:
Value: !Sub "${SlashCommandsApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}/${SlashCommandsApi.Stage}"