diff template.yaml @ 5:2daf0dc08247

add get report endpoint
author Dennis C. M. <dennis@denniscm.com>
date Mon, 05 Jun 2023 12:48:47 +0100
parents 2e5f3664f3e4
children d15ccf5f1373
line wrap: on
line diff
--- a/template.yaml	Mon Jun 05 10:13:43 2023 +0100
+++ b/template.yaml	Mon Jun 05 12:48:47 2023 +0100
@@ -69,8 +69,6 @@
     Type: AWS::Serverless::Function
     Properties:
       CodeUri: analyze_document/
-      Handler: app.lambda_handler
-      Runtime: python3.7
       Policies:
         - Version: "2012-10-17"
           Statement:
@@ -91,8 +89,6 @@
     Type: AWS::Serverless::Function
     Properties:
       CodeUri: process_document/
-      Handler: app.lambda_handler
-      Runtime: python3.7
     Connectors:
       S3Connector:
         Properties:
@@ -106,8 +102,6 @@
     Type: AWS::Serverless::Function
     Properties:
       CodeUri: upload_document/
-      Handler: app.lambda_handler
-      Runtime: python3.7
     Connectors:
       DynamoConnector:
         Properties:
@@ -122,6 +116,40 @@
           Permissions:
             - Read
 
+  Api:
+    Type: AWS::Serverless::Api
+    Properties:
+      StageName: Prod
+      Models:
+        Empty:
+          type: object
+
+  GetReportFunction:
+    Type: AWS::Serverless::Function
+    Properties:
+      CodeUri: get_report/
+      Events:
+        GetProductEvent:
+          Type: Api
+          Properties:
+            RestApiId: !Ref Api
+            Path: /report
+            Method: get
+            RequestParameters:
+              - method.request.querystring.ticker:
+                  Required: true
+              - method.request.querystring.type:
+                  Required: true
+              - method.request.querystring.year:
+                  Required: true
+    Connectors:
+      DynamoConnector:
+        Properties:
+          Destination:
+            Id: DynamoTable
+          Permissions:
+            - Read
+
   DynamoTable:
     Type: AWS::DynamoDB::Table
     Properties: