-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
85 lines (80 loc) · 2.09 KB
/
serverless.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
73
74
75
76
77
78
79
80
81
82
83
84
85
service: <<YOUR_SERVICE_NAME>>
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs12.x
lambdaHashingVersion: 20201221
stage: prod
region: eu-west-1
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:GetItem"
- "dynamodb:PutItem"
Resource: "arn:aws:dynamodb:*:*:table/<<YOUR_SPOTIFY_DYNAMODB_TABLE_NAME>>"
- Effect: "Allow"
Action:
- "ses:SendEmail"
- "ses:SendRawEmail"
Resource: "*"
httpApi:
cors:
allowedOrigins:
- <<DOMAIN_OF_YOUR_WEBSITE>>
allowedHeaders:
- Content-Type
- Authorization
allowedMethods:
- GET
- POST
- PUT
functions:
spotifyCurrentSong:
handler: src/spotify-current-song.handler
events:
- httpApi:
path: /spotify/current
method: GET
environment:
CLIENT_BASE_64: 'Basic <<YOUR_SPOTIFY_CLIENT_ID_BASE_64>>'
REFRESH_TOKEN: <<YOUR_SPOTIFY_REFRESH_TOKEN>>
spotifySearch:
handler: src/spotify-search.handler
events:
- httpApi:
path: /spotify/search
method: GET
environment:
CLIENT_BASE_64: 'Basic <<YOUR_SPOTIFY_CLIENT_ID_BASE_64>>'
REFRESH_TOKEN: <<YOUR_SPOTIFY_REFRESH_TOKEN>>
spotifyAdd:
handler: src/spotify-add-song.handler
events:
- httpApi:
path: /spotify/add
method: PUT
environment:
CLIENT_BASE_64: 'Basic <<YOUR_SPOTIFY_CLIENT_ID_BASE_64>>'
REFRESH_TOKEN: <<YOUR_SPOTIFY_REFRESH_TOKEN>>
contactMeForm:
handler: src/contact-me.handler
events:
- httpApi:
path: /contact
method: POST
environment:
SENDER: <<CONTACT_ME_FROM_EMAIL>>
RECEIVER: <<CONTACT_ME_TO_EMAIL>>
resources:
Resources:
SpotifyTokenState:
Type: AWS::DynamoDB::Table
Properties:
TableName: <<YOUR_SPOTIFY_DYNAMODB_TABLE_NAME>>
AttributeDefinitions:
- AttributeName: spotify_token
AttributeType: S
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: spotify_token
KeyType: HASH