-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathtemplate.yaml
95 lines (88 loc) · 2.43 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
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
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
MemorySize: 1024
Architectures: [arm64]
Runtime: dotnet8
Timeout: 30
Tracing: Active
Environment:
Variables:
PRODUCT_TABLE_NAME: !Ref Table
Resources:
GetProductsFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/ServerlessTestApi/
Handler: ServerlessTestApi::ServerlessTestApi.Function_GetProducts_Generated::GetProducts
Events:
Api:
Type: HttpApi
Properties:
Path: /
Method: GET
Policies:
- DynamoDBReadPolicy:
TableName: !Ref Table
GetProductFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/ServerlessTestApi/
Handler: ServerlessTestApi::ServerlessTestApi.Function_GetProduct_Generated::GetProduct
Events:
Api:
Type: HttpApi
Properties:
Path: /{id}
Method: GET
Policies:
- DynamoDBReadPolicy:
TableName: !Ref Table
DeleteProductFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/ServerlessTestApi/
Handler: ServerlessTestApi::ServerlessTestApi.Function_DeleteProduct_Generated::DeleteProduct
Events:
Api:
Type: HttpApi
Properties:
Path: /{id}
Method: DELETE
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref Table
PutProductFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src/ServerlessTestApi/
Handler: ServerlessTestApi::ServerlessTestApi.Function_CreateProduct_Generated::CreateProduct
Events:
Api:
Type: HttpApi
Properties:
Path: /{id}
Method: PUT
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref Table
Table:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: id
KeyType: HASH
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
Outputs:
ApiUrl:
Description: "API Gateway endpoint URL"
Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/"
TableName:
Description: "DynamoDB Table Name"
Value: !Ref Table