-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: edit to block CI with linting errors * feat: creating eventStack * feat: adding events stack deployment to ci * feat: adding client-eventbridge * feat: WIP editing event class * feat: add event publishing * feat: adding eventbridge package * feat: adding iam package * feat: creating an event bus and outputting ARN * feat: importing EventBusARN and creating lambda policy * feat: updating Event publish function * feat: calling event.publish in producer handler * feat: creating handler test * feat: installing client-eventbridge * feat: returning output of publish in handler * fix: fixing eventBridge.send parameters * fix: updating types integration test * fix: updating handler test * feat: updating integration tests * feat: adding to docs * fix: removing unecessary packages * test: writing Event class tests * fix: updating events lockfile * fix: cr comment- clearer role naming * fix: removing unecessary vitest test file * fix: consistent naming convention on AWS resources * feat: adding AWSLambdaBasicExecutionRole to lambda * feat: adding error handling for publish * fix: fixing small error * fix: editing error handling * fix: fixing naming inconsistency * fix: extra error fix * fix: testing new error logic * fix: ci change to allow CfnOutput to work * fix: reordering ci --------- Co-authored-by: Luke Yianni <[email protected]>
- Loading branch information
1 parent
21e0273
commit 5136d87
Showing
18 changed files
with
2,896 additions
and
121 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
example-architecture/__tests__/importEvent.integration.test.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
import { type PutEventsResponse } from "@aws-sdk/client-eventbridge"; | ||
import { Lambda } from "@aws-sdk/client-lambda"; | ||
import { describe, expect, it } from "vitest"; | ||
|
||
const lambda = new Lambda({ region: "eu-west-2" }); | ||
|
||
describe("Given a producer lambda that returns a Contract", () => { | ||
const params = { | ||
FunctionName: "producerLambda", | ||
}; | ||
describe("When that lambda is invoked", async () => { | ||
const invokedLambda = await lambda.invoke(params); | ||
|
||
it("Response with an eventId is returned without an error", () => { | ||
const body: PutEventsResponse = JSON.parse( | ||
Buffer.from(invokedLambda.Payload ?? "").toString(), | ||
); | ||
expect(body.Entries).toEqual([ | ||
expect.objectContaining({ EventId: expect.any(String) }), | ||
]); | ||
expect(body.Entries).toEqual([ | ||
expect.not.objectContaining({ | ||
ErrorCode: expect.any(String), | ||
ErrorMessage: expect.any(String), | ||
}), | ||
]); | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { App } from "aws-cdk-lib"; | ||
|
||
import { EventsStack } from "../lib/eventsStack"; | ||
|
||
const app = new App(); | ||
new EventsStack(app, "EventsStack"); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"app": "npx ts-node --prefer-ts-exts bin/events.ts", | ||
"requireApproval": "never", | ||
"watch": { | ||
"include": ["**"], | ||
"exclude": [ | ||
"README.md", | ||
"cdk*.json", | ||
"tsconfig.json", | ||
"node_modules", | ||
"test" | ||
] | ||
}, | ||
"context": { | ||
"@aws-cdk/aws-lambda:recognizeLayerVersion": true, | ||
"@aws-cdk/core:checkSecretUsage": true, | ||
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"], | ||
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, | ||
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, | ||
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, | ||
"@aws-cdk/aws-iam:minimizePolicies": true, | ||
"@aws-cdk/core:validateSnapshotRemovalPolicy": true, | ||
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, | ||
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, | ||
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, | ||
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true, | ||
"@aws-cdk/core:enablePartitionLiterals": true, | ||
"@aws-cdk/aws-events:eventsTargetQueueSameAccount": true, | ||
"@aws-cdk/aws-iam:standardizedServicePrincipals": true, | ||
"@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": true, | ||
"@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": true, | ||
"@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": true, | ||
"@aws-cdk/aws-route53-patters:useCertificate": true, | ||
"@aws-cdk/customresources:installLatestAwsSdkDefault": false, | ||
"@aws-cdk/aws-rds:databaseProxyUniqueResourceName": true, | ||
"@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": true, | ||
"@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": true, | ||
"@aws-cdk/aws-ec2:launchTemplateDefaultUserData": true, | ||
"@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": true, | ||
"@aws-cdk/aws-redshift:columnId": true, | ||
"@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": true, | ||
"@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": true, | ||
"@aws-cdk/aws-apigateway:requestValidatorUniqueId": true, | ||
"@aws-cdk/aws-kms:aliasNameRef": true, | ||
"@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true, | ||
"@aws-cdk/core:includePrefixInUniqueNameGeneration": true, | ||
"@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": true | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { CfnOutput, Stack, StackProps } from "aws-cdk-lib"; | ||
import { EventBus } from "aws-cdk-lib/aws-events"; | ||
import { Construct } from "constructs"; | ||
|
||
export class EventsStack extends Stack { | ||
constructor(scope: Construct, id: string, props?: StackProps) { | ||
super(scope, id, props); | ||
const eventBus = new EventBus(this, "ExampleArchitectureEventBus", { | ||
eventBusName: "exampleArchitectureEventBus", | ||
}); | ||
|
||
new CfnOutput(this, "EventBusARN", { | ||
value: eventBus.eventBusArn, | ||
exportName: "EventBusARN", | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "events", | ||
"version": "0.1.0", | ||
"bin": { | ||
"events": "bin/events.js" | ||
}, | ||
"scripts": { | ||
"bootstrap": "cdk bootstrap", | ||
"cdk": "cdk", | ||
"deploy-dev": "cdk deploy --verbose --all", | ||
"lint-fix": "eslint . --ext=js,ts --fix" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.4.5", | ||
"aws-cdk": "2.89.0", | ||
"aws-cdk-lib": "2.89.0", | ||
"constructs": "^10.0.0", | ||
"esbuild": "^0.18.17", | ||
"ts-node": "^10.9.1", | ||
"typescript": "~5.1.6" | ||
}, | ||
"dependencies": { | ||
"@aws-sdk/client-eventbridge": "^3.387.0", | ||
"aws-sdk": "^2.1431.0" | ||
} | ||
} |
Oops, something went wrong.