AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: 'Github deployment' Parameters: Env: Description: The environment name. Type: String Default: dev Resources: BlobFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByOwnerAndRepoAndSha: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/blobs/{sha}' Method: get PostByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/blobs' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-blob' Handler: src/main/js/handlers/blob.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 BlobFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ BlobFunction}' RetentionInDays: 7 CommitFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByOwnerAndRepoAndSha: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/commits/{sha}' Method: get PostByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/commits' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-commit' Handler: src/main/js/handlers/commit.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 CommitFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ CommitFunction}' RetentionInDays: 7 ContentsFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/readme' Method: get GetByOwnerAndRepoAndPath: Type: Api Properties: Path: '/repos/{owner}/{repo}/contents/{path}' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-contents' Handler: src/main/js/handlers/contents.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 ContentsFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ ContentsFunction}' RetentionInDays: 7 HookFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: DeleteByOwnerAndRepoAndId: Type: Api Properties: Path: '/repos/{owner}/{repo}/hooks/{id}' Method: delete GetByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/hooks' Method: get GetByOwnerAndRepoAndId: Type: Api Properties: Path: '/repos/{owner}/{repo}/hooks/{id}' Method: get PostByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/hooks' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-hook' Handler: src/main/js/handlers/hook.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 HookFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ HookFunction}' RetentionInDays: 7 PullRequestFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/pulls' Method: get PostByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/pulls' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-pull-request' Handler: src/main/js/handlers/pull_request.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 PullRequestFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ PullRequestFunction}' RetentionInDays: 7 RefFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/refs' Method: get GetByOwnerAndRepoAndRef: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/refs/{ref}' Method: get PostByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/refs' Method: post PutByOwnerAndRepoAndRef: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/refs/{ref}' Method: put Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-ref' Handler: src/main/js/handlers/ref.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 RefFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ RefFunction}' RetentionInDays: 7 RepositoryFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/user/repos' Method: get GetByUsername: Type: Api Properties: Path: '/users/{username}/repos' Method: get GetByOrg: Type: Api Properties: Path: '/orgs/{org}/repos' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-repository' Handler: src/main/js/handlers/repository.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 RepositoryFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ RepositoryFunction}' RetentionInDays: 7 TagFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: GetByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/tags' Method: get GetByOwnerAndRepoAndSha: Type: Api Properties: Path: '/repos/{owner}/{repo}/tags/{sha}' Method: get PostByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/tags' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-tag' Handler: src/main/js/handlers/tag.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 TagFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ TagFunction}' RetentionInDays: 7 TreeFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: PostByOwnerAndRepo: Type: Api Properties: Path: '/repos/{owner}/{repo}/git/trees' Method: post Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-tree' Handler: src/main/js/handlers/tree.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 TreeFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ TreeFunction}' RetentionInDays: 7 UserFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/user' Method: get Get: Type: Api Properties: Path: '/user/orgs' Method: get 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 UserEmailFunction: Type: AWS::Serverless::Function Properties: CodeUri: ../../.. Environment: Variables: ENV: !Ref Env Events: Get: Type: Api Properties: Path: '/user/emails' Method: get Ping: Type: Schedule Properties: Schedule: rate(5 minutes) Input: '{"httpMethod": "PING"}' FunctionName: !Sub '${AWS::StackName}-user-email' Handler: src/main/js/handlers/user_email.handler Policies: - AWSLambdaBasicExecutionRole - Version: 2012-10-17 Statement: - Action: - secretsmanager:GetSecretValue Effect: Allow Resource: '*' - Action: - kms:Decrypt Effect: Allow Resource: '*' Runtime: nodejs8.10 UserEmailFunctionLogRetention: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${ UserEmailFunction}' RetentionInDays: 7 Outputs: BlobFunction: Description: The name of the Lambda function for the Blob model Value: !Ref BlobFunction Export: Name: !Sub '${AWS::StackName}-functions-Blob' BlobFunctionRole: Description: The name of the Lambda function role for the Blob model Value: !Ref BlobFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Blob' CommitFunction: Description: The name of the Lambda function for the Commit model Value: !Ref CommitFunction Export: Name: !Sub '${AWS::StackName}-functions-Commit' CommitFunctionRole: Description: The name of the Lambda function role for the Commit model Value: !Ref CommitFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Commit' ContentsFunction: Description: The name of the Lambda function for the Contents model Value: !Ref ContentsFunction Export: Name: !Sub '${AWS::StackName}-functions-Contents' ContentsFunctionRole: Description: The name of the Lambda function role for the Contents model Value: !Ref ContentsFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Contents' HookFunction: Description: The name of the Lambda function for the Hook model Value: !Ref HookFunction Export: Name: !Sub '${AWS::StackName}-functions-Hook' HookFunctionRole: Description: The name of the Lambda function role for the Hook model Value: !Ref HookFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Hook' PullRequestFunction: Description: The name of the Lambda function for the PullRequest model Value: !Ref PullRequestFunction Export: Name: !Sub '${AWS::StackName}-functions-PullRequest' PullRequestFunctionRole: Description: The name of the Lambda function role for the PullRequest model Value: !Ref PullRequestFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-PullRequest' RefFunction: Description: The name of the Lambda function for the Ref model Value: !Ref RefFunction Export: Name: !Sub '${AWS::StackName}-functions-Ref' RefFunctionRole: Description: The name of the Lambda function role for the Ref model Value: !Ref RefFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Ref' RepositoryFunction: Description: The name of the Lambda function for the Repository model Value: !Ref RepositoryFunction Export: Name: !Sub '${AWS::StackName}-functions-Repository' RepositoryFunctionRole: Description: The name of the Lambda function role for the Repository model Value: !Ref RepositoryFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Repository' TagFunction: Description: The name of the Lambda function for the Tag model Value: !Ref TagFunction Export: Name: !Sub '${AWS::StackName}-functions-Tag' TagFunctionRole: Description: The name of the Lambda function role for the Tag model Value: !Ref TagFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Tag' TreeFunction: Description: The name of the Lambda function for the Tree model Value: !Ref TreeFunction Export: Name: !Sub '${AWS::StackName}-functions-Tree' TreeFunctionRole: Description: The name of the Lambda function role for the Tree model Value: !Ref TreeFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-Tree' 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' UserEmailFunction: Description: The name of the Lambda function for the UserEmail model Value: !Ref UserEmailFunction Export: Name: !Sub '${AWS::StackName}-functions-UserEmail' UserEmailFunctionRole: Description: The name of the Lambda function role for the UserEmail model Value: !Ref UserEmailFunctionRole Export: Name: !Sub '${AWS::StackName}-roles-UserEmail'