AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'gilt-public-api deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: ProductFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByProductId: Type: Api Properties: Path: '/products/{productId}/detail.json' Method: get Get: Type: Api Properties: Path: '/products/categories.json' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-product' Handler: src/main/js/handlers/product.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 ProductFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ ProductFunction}' RetentionInDays: 7 SaleDetailFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByStoreAndSale: Type: Api Properties: Path: '/sales/{store}/{saledetail.json}' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-sale-detail' Handler: src/main/js/handlers/sale_detail.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 SaleDetailFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ SaleDetailFunction}' RetentionInDays: 7 SaleListFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/sales/active.json' Method: get GetByStore: Type: Api Properties: Path: '/sales/{store}/active.json' Method: get Get: Type: Api Properties: Path: '/sales/upcoming.json' Method: get GetByStore: Type: Api Properties: Path: '/sales/{store}/upcoming.json' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-sale-list' Handler: src/main/js/handlers/sale_list.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 SaleListFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ SaleListFunction}' RetentionInDays: 7 Outputs: ProductFunction: Description: The name of the Lambda function for the Product model Value: !Ref ProductFunction Export: Name: !Sub '${AWS::StackName}-functions-Product' ProductFunctionRole: Description: The name of the Lambda function role for the Product model Value: !Ref ProductFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Product' SaleDetailFunction: Description: The name of the Lambda function for the SaleDetail model Value: !Ref SaleDetailFunction Export: Name: !Sub '${AWS::StackName}-functions-SaleDetail' SaleDetailFunctionRole: Description: The name of the Lambda function role for the SaleDetail model Value: !Ref SaleDetailFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-SaleDetail' SaleListFunction: Description: The name of the Lambda function for the SaleList model Value: !Ref SaleListFunction Export: Name: !Sub '${AWS::StackName}-functions-SaleList' SaleListFunctionRole: Description: The name of the Lambda function role for the SaleList model Value: !Ref SaleListFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-SaleList'