-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
109 lines (104 loc) · 3.85 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
service: microservice-mercadolibre-products-aws
frameworkVersion: "3"
provider:
name: aws
runtime: nodejs18.x
stage: dev
region: us-east-1
memorySize: 512
timeout: 20
environment: ${file(./serverless_ssm.yml)}
apiGateway:
apiKeys:
- name: xApiKey
value: ${file(./serverless_ssm.yml):X_API_KEY}
logs:
# Enable REST API logs
restApi:
accessLogging: true
format: "requestId: $context.requestId"
executionLogging: true
level: INFO
fullExecutionData: true
role: arn:aws:iam::xxxx:role
roleManagedExternally: false
plugins:
- serverless-esbuild
- serverless-s3-local
- serverless-offline-ssm
- serverless-offline
functions:
#DATABASE TEST
databaseTestConnection:
handler: src/controllers/db/connection.handler
description: Function in charge of checking the connection to the db
events:
- http:
path: /${file(./serverless_ssm.yml):API_VERSION}/${file(./serverless_ssm.yml):API_ENDPOINT_PRODUCTS_NAME}/db-connection
method: get
private: true
#PRODUCTS
addProduct:
handler: src/controllers/product/addProductController.handler
description: lambda function to add a product to the database
events:
- http:
path: /${file(./serverless_ssm.yml):API_VERSION}/${file(./serverless_ssm.yml):API_ENDPOINT_PRODUCTS_NAME}/add
method: POST
private: true
getByIdProduct:
handler: src/controllers/product/getByIdProductController.handler
description: lambda function to get a product from the database according to its id
events:
- http:
path: /${file(./serverless_ssm.yml):API_VERSION}/${file(./serverless_ssm.yml):API_ENDPOINT_PRODUCTS_NAME}/id/{id}
method: GET
private: true
getAllProduct:
handler: src/controllers/product/getAllProductController.handler
description: lambda function to get all paginated products from the database
events:
- http:
path: /${file(./serverless_ssm.yml):API_VERSION}/${file(./serverless_ssm.yml):API_ENDPOINT_PRODUCTS_NAME}/list
method: GET
private: true
#PRODUCT_SPECIFICATION
addProductSpecification:
handler: src/controllers/productSpecification/addProductSpecifController.handler
description: Function to store an product specification object inside the database for have a reference to s3 bucket
events:
- http:
method: POST
path: /${file(./serverless_ssm.yml):API_VERSION}/${file(./serverless_ssm.yml):API_ENDPOINT_PRODUCTS_SPECIFICATIONS_NAME}/add/{productId}
private: true
getAllProductSpecification:
handler: src/controllers/productSpecification/getAllProductSpecifController.handler
description: lambda function to get all paginated products specification from the database
events:
- http:
path: /${file(./serverless_ssm.yml):API_VERSION}/${file(./serverless_ssm.yml):API_ENDPOINT_PRODUCTS_SPECIFICATIONS_NAME}/list
method: GET
private: true
#PRODUCT_SPECIFICATION_S3
addProductSpecificationS3:
handler: src/controllers/productSpecificationS3/addProductSpecifS3Controller.handler
description: Function to store an product specification object inside the s3 bucket
events:
- http:
method: POST
path: /${file(./serverless_ssm.yml):API_VERSION}/${file(./serverless_ssm.yml):API_ENDPOINT_PRODUCTS_SPECIFICATIONS_S3_NAME}/add/{specificationUuid}
private: true
resources:
- ${file(src/resources/api-gateway.yml)}
- ${file(src/resources/bucket-s3.yml)}
custom:
s3:
host: ${file(./serverless_ssm.yml):S3_HOST}
directory: ${file(./serverless_ssm.yml):S3_DIRECTORY}
serverless-offline-ssm:
stages:
- dev
ssm: ${file(./serverless_ssm.yml)}
serverless-offline:
httpPort: 4000
lambdaPort: 4002