AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'joglog api deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: TimeFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: DeleteById: Type: Api Properties: Path: '/times/{id}' Method: delete Get: Type: Api Properties: Path: '/times' Method: get GetById: Type: Api Properties: Path: '/times/{id}' Method: get Patch: Type: Api Properties: Path: '/times' Method: patch Post: Type: Api Properties: Path: '/times' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-time' Handler: src/main/js/handlers/time.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 TimeFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ TimeFunction}' RetentionInDays: 7 UserFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: DeleteById: Type: Api Properties: Path: '/users/{id}' Method: delete Get: Type: Api Properties: Path: '/users' Method: get GetById: Type: Api Properties: Path: '/users/{id}' Method: get Patch: Type: Api Properties: Path: '/users' Method: patch Post: Type: Api Properties: Path: '/users/authenticate' Method: post Post: Type: Api Properties: Path: '/users' Method: post 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 Outputs: TimeFunction: Description: The name of the Lambda function for the Time model Value: !Ref TimeFunction Export: Name: !Sub '${AWS::StackName}-functions-Time' TimeFunctionRole: Description: The name of the Lambda function role for the Time model Value: !Ref TimeFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Time' 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'