AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'roadquality deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: MapRouteFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/mapRoutes/snap' Method: get GetByPoints: Type: Api Properties: Path: '/mapRoutes/{points}' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-map-route' Handler: src/main/js/handlers/map_route.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 MapRouteFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ MapRouteFunction}' RetentionInDays: 7 SegmentFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/segments' Method: get Get: Type: Api Properties: Path: '/segments/boundingbox' Method: get Post: Type: Api Properties: Path: '/segments' Method: post Put: Type: Api Properties: Path: '/segments' Method: put Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-segment' Handler: src/main/js/handlers/segment.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 SegmentFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ SegmentFunction}' RetentionInDays: 7 SegmentRatingFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Delete: Type: Api Properties: Path: '/segmentRatings' Method: delete Get: Type: Api Properties: Path: '/segmentRatings' Method: get Post: Type: Api Properties: Path: '/segmentRatings' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-segment-rating' Handler: src/main/js/handlers/segment_rating.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 SegmentRatingFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ SegmentRatingFunction}' RetentionInDays: 7 UserFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Delete: Type: Api Properties: Path: '/users' Method: delete Get: Type: Api Properties: Path: '/users' Method: get Put: Type: Api Properties: Path: '/users' Method: put Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-user' Handler: src/main/js/handlers/user.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 UserFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ UserFunction}' RetentionInDays: 7 VersionInfoFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/info' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-version-info' Handler: src/main/js/handlers/version_info.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 VersionInfoFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ VersionInfoFunction}' RetentionInDays: 7 Outputs: MapRouteFunction: Description: The name of the Lambda function for the MapRoute model Value: !Ref MapRouteFunction Export: Name: !Sub '${AWS::StackName}-functions-MapRoute' MapRouteFunctionRole: Description: The name of the Lambda function role for the MapRoute model Value: !Ref MapRouteFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-MapRoute' SegmentFunction: Description: The name of the Lambda function for the Segment model Value: !Ref SegmentFunction Export: Name: !Sub '${AWS::StackName}-functions-Segment' SegmentFunctionRole: Description: The name of the Lambda function role for the Segment model Value: !Ref SegmentFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Segment' SegmentRatingFunction: Description: The name of the Lambda function for the SegmentRating model Value: !Ref SegmentRatingFunction Export: Name: !Sub '${AWS::StackName}-functions-SegmentRating' SegmentRatingFunctionRole: Description: The name of the Lambda function role for the SegmentRating model Value: !Ref SegmentRatingFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-SegmentRating' UserFunction: Description: The name of the Lambda function for the User model Value: !Ref UserFunction Export: Name: !Sub '${AWS::StackName}-functions-User' UserFunctionRole: Description: The name of the Lambda function role for the User model Value: !Ref UserFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-User' VersionInfoFunction: Description: The name of the Lambda function for the VersionInfo model Value: !Ref VersionInfoFunction Export: Name: !Sub '${AWS::StackName}-functions-VersionInfo' VersionInfoFunctionRole: Description: The name of the Lambda function role for the VersionInfo model Value: !Ref VersionInfoFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-VersionInfo'