This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EventRule: | |
Type: AWS::Events::Rule | |
Properties: | |
Description: 'PayslipUploadedEventRule' | |
EventBusName: 'HREventBus' | |
EventPattern: | |
account: | |
- !Sub '${AWS::AccountId}' | |
source: | |
- 'payslip.uploaded' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { SNSEvent, EventBridgeEvent, Handler } from 'aws-lambda'; | |
export const handler: Handler<SNSEvent | EventBridgeEvent<any, any>> = (event) => { | |
console.log('Fulfilment handler'); | |
console.log('event = ' + JSON.stringify(event)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { APIGatewayProxyHandler, APIGatewayProxyResult, APIGatewayEvent } from 'aws-lambda'; | |
import * as AWS from 'aws-sdk'; | |
import { validate } from '../shared/validator'; | |
import { OrderCreated } from '../../schema/order_create/ordercreated/OrderCreated'; | |
import { OrderCreatedItem } from '../../schema/order_create/ordercreated/OrderCreatedItem'; | |
import * as schema from '../../schema/order_create/ordercreated/[email protected]'; | |
const eventBridge = new AWS.EventBridge({ region: 'eu-west-1' }); | |
export const handler: APIGatewayProxyHandler = async ({ body }: APIGatewayEvent): Promise<APIGatewayProxyResult> => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: serverless-event-bridge | |
variablesResolutionMode: 20210326 | |
provider: | |
name: aws | |
runtime: nodejs14.x | |
lambdaHashingVersion: 20201221 | |
memorySize: 128 | |
stage: ${opt:stage, 'dev'} | |
region: ${opt:region, 'eu-west-1'} | |
eventBridge: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const randomErrors = (): void | Error => { | |
if (Math.random() > 0.9) { | |
throw new Error('spurious error'); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
updates: | |
# Maintain dependencies for GitHub Actions | |
- package-ecosystem: "github-actions" | |
directory: "/" | |
schedule: | |
interval: "daily" | |
# Maintain dependencies for npm | |
- package-ecosystem: "npm" | |
directory: "/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
documentation: | |
version: '1' | |
title: ${self:custom.openapiTitle} | |
description: ${self:custom.openapiTitle} - example OpenAPI document | |
endpoints: | |
getImage: | |
summary: "Get Image by ID" | |
description: "Get a pre-signed temporary download URL for the image by ID" | |
requestBody: | |
description: "Get a pre-signed temporary download URL for the image by ID" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AWS from 'aws-sdk'; | |
import { APIGatewayProxyHandler, APIGatewayProxyResult, APIGatewayEvent } from 'aws-lambda'; | |
import { v4 as uuid } from 'uuid'; | |
import { schema } from './add-comment.schema'; | |
import { validate } from '../../shared/validator'; | |
const METHOD = 'add-comment.handler'; | |
const LANGUAGE_CODE = 'en'; | |
type DetectPiiEntitiesResponse = AWS.Comprehend.DetectPiiEntitiesResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AWS from 'aws-sdk'; | |
import { APIGatewayProxyHandler, APIGatewayProxyResult, APIGatewayEvent } from 'aws-lambda'; | |
import { v4 as uuid } from 'uuid'; | |
import config from '../../config'; | |
const METHOD = 'upload-file.handler'; | |
const s3 = new AWS.S3(); | |
export const handler: APIGatewayProxyHandler = async ({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AWS from 'aws-sdk'; | |
import { APIGatewayProxyHandler, APIGatewayProxyResult, APIGatewayEvent } from 'aws-lambda'; | |
import { v4 as uuid } from 'uuid'; | |
import config from '../../config'; | |
type HeadObjectRequest = AWS.S3.HeadObjectRequest; | |
type HeadObjectOutput = AWS.S3.HeadObjectOutput; | |
const METHOD = 'get-file.handler'; |