AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'reporting-api deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: QueryResponseFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Post: Type: Api Properties: Path: '/query' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-query-response' Handler: src/main/js/handlers/query_response.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 QueryResponseFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ QueryResponseFunction}' RetentionInDays: 7 TopicFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/topics' Method: get GetByGuid: Type: Api Properties: Path: '/topics/{guid}' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-topic' Handler: src/main/js/handlers/topic.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 TopicFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ TopicFunction}' RetentionInDays: 7 ViewFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: DeleteByGuid: Type: Api Properties: Path: '/views/{guid}' Method: delete Get: Type: Api Properties: Path: '/views' Method: get GetByGuid: Type: Api Properties: Path: '/views/{guid}' Method: get Post: Type: Api Properties: Path: '/views' Method: post PutByGuid: Type: Api Properties: Path: '/views/{guid}' Method: put Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-view' Handler: src/main/js/handlers/view.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 ViewFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ ViewFunction}' RetentionInDays: 7 Outputs: QueryResponseFunction: Description: The name of the Lambda function for the QueryResponse model Value: !Ref QueryResponseFunction Export: Name: !Sub '${AWS::StackName}-functions-QueryResponse' QueryResponseFunctionRole: Description: The name of the Lambda function role for the QueryResponse model Value: !Ref QueryResponseFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-QueryResponse' TopicFunction: Description: The name of the Lambda function for the Topic model Value: !Ref TopicFunction Export: Name: !Sub '${AWS::StackName}-functions-Topic' TopicFunctionRole: Description: The name of the Lambda function role for the Topic model Value: !Ref TopicFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Topic' ViewFunction: Description: The name of the Lambda function for the View model Value: !Ref ViewFunction Export: Name: !Sub '${AWS::StackName}-functions-View' ViewFunctionRole: Description: The name of the Lambda function role for the View model Value: !Ref ViewFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-View'