Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eventbridge)!: new eventbridge api #122

Merged
merged 41 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c076325
feat: `bring eventbridge`
skorfmann Dec 22, 2023
456259d
Merge branch 'main' into eventbridge
skorfmann Dec 22, 2023
c316216
Merge branch 'main' into eventbridge
eladb Dec 30, 2023
52b9fe8
fix (#45)
MarkMcCulloh Dec 30, 2023
2cd6d10
fix(websockets): fix token usage in simulator (#46)
eladb Jan 1, 2024
aafd29b
chore(bedrock): replacing BEDROCK_DEV with isTestEnvironment (#47)
Jan 2, 2024
c65266b
feat: `bring github` (#39)
eladcon Jan 2, 2024
5c0d7b5
fix(github): mts to js files (#48)
Jan 2, 2024
2a18bad
fix(github): using interface for credentials instead of cloud.secret …
Jan 2, 2024
c18f81b
fix(github): can't compile to tf-aws, missing cloud.service (#50)
Jan 3, 2024
dfa0cb1
chore: set up GitHub releases (#51)
Chriscbr Jan 4, 2024
7ec95d7
chore: mergify fixes (#52)
Chriscbr Jan 4, 2024
ce2696d
chore: fix mergify conditions (#53)
Chriscbr Jan 4, 2024
9adcff4
chore: mergify fixing continued (#54)
Chriscbr Jan 4, 2024
6b9db75
chore: mergify fixes (#55)
Chriscbr Jan 4, 2024
0439bf9
chore: testing
Chriscbr Jan 4, 2024
e4e9ae2
fix: unit test regression (#56)
Chriscbr Jan 4, 2024
40c0f54
Merge branch 'main' into eventbridge
skorfmann Feb 29, 2024
0db1cc1
deployable version
skorfmann Feb 29, 2024
a97d641
remove accidental commit
skorfmann Feb 29, 2024
1d6e04c
Update eventbridge/platform/sim/bus.w
eladcon Mar 7, 2024
df57157
wip
eladcon Mar 7, 2024
7fbd3fa
wip
eladcon Mar 7, 2024
1861b0c
wip
eladcon Mar 7, 2024
e6b86c3
wip
eladcon Mar 7, 2024
9978071
wip
eladcon Mar 13, 2024
0a72274
wip
eladcon Mar 13, 2024
82df437
wip
eladcon Mar 13, 2024
261ce73
wip
eladcon Mar 13, 2024
7091031
Merge branch 'main' into eventbridge-readme
eladcon Mar 13, 2024
9cf9f8a
wip
eladcon Mar 13, 2024
74a678a
wip
eladcon Mar 13, 2024
40c07dc
Merge branch 'main' into eventbridge-optional-props
eladcon Mar 13, 2024
69aad72
wip
eladcon Mar 13, 2024
456312f
wip
eladcon Mar 13, 2024
35e84ee
wip
eladcon Mar 13, 2024
9befa33
generate workflows
eladcon Mar 14, 2024
0079291
Merge branch 'main' into eventbridge-optional-props
eladcon Mar 25, 2024
a8e2971
wip
eladcon Mar 25, 2024
5b2393d
wip
eladcon Mar 25, 2024
6468468
Merge branch 'main' into eventbridge-optional-props
eladcon Mar 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/eventbridge-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Install winglang
run: npm i -g winglang
Expand All @@ -29,9 +29,25 @@ jobs:
- name: Pack
run: wing pack
working-directory: eventbridge
- name: Get package version
eladcon marked this conversation as resolved.
Show resolved Hide resolved
run: echo WINGLIB_VERSION=$(node -p "require('./package.json').version") >>
"$GITHUB_ENV"
working-directory: eventbridge
- name: Publish
run: npm publish --access=public --registry https://registry.npmjs.org --tag
latest *.tgz
working-directory: eventbridge
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Tag commit
uses: tvdias/[email protected]
with:
repo-token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
tag: eventbridge-v${{ env.WINGLIB_VERSION }}
- name: GitHub release
uses: softprops/action-gh-release@v1
with:
name: eventbridge v${{ env.WINGLIB_VERSION }}
tag_name: eventbridge-v${{ env.WINGLIB_VERSION }}
files: "*.tgz"
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions eventbridge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ new cloud.Function(inflight () => {

* eventBridgeName - `str` - Optional. Name of an existing EventBridge to reference.

#### Usage

```sh
wing compile -t @winglang/platform-awscdk -v eventBridgeName="my-bus" main.w
```

## License

This library is licensed under the [MIT License](./LICENSE).
2 changes: 1 addition & 1 deletion eventbridge/lib.w
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bring "./platform/awscdk" as awscdk;
pub class Bus impl types.IBus {
inner: types.IBus;

new(props: types.BusProps) {
new(props: types.BusProps?) {
let target = util.env("WING_TARGET");
if target == "sim" {
this.inner = new sim.Bus(props) as "sim";
Expand Down
4 changes: 2 additions & 2 deletions eventbridge/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eventbridge/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@winglibs/eventbridge",
"description": "Amazon EventBridge library for Wing",
"version": "0.0.2",
"version": "0.0.3",
"repository": {
"type": "git",
"url": "https://github.com/winglang/winglibs.git",
Expand Down
4 changes: 2 additions & 2 deletions eventbridge/platform/awscdk/eventbridge.w
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ pub class Bus impl types.IBus {

eventBridge: cdk.aws_events.IEventBus;

new(props: types.BusProps) {
new(props: types.BusProps?) {
let app = nodeof(this).app;
// TODO: use typed properties when its available
if let eventBridgeName = unsafeCast(app)?.platformParameters?.getParameterValue("eventBridgeName") {
this.eventBridge = cdk.aws_events.EventBus.fromEventBusName(this, "EventBridge", eventBridgeName);
} else {
this.eventBridge = new cdk.aws_events.EventBus(eventBusName: props.name) as "EventBridge";
this.eventBridge = new cdk.aws_events.EventBus(eventBusName: props?.name ?? "eventbridge-{this.node.addr.substring(0, 8)}") as "EventBridge";
}
}

Expand Down
2 changes: 1 addition & 1 deletion eventbridge/platform/sim/bus.w
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub class EventBridgeBus {
topic: cloud.Topic;
var handlerCount: num;

new(props: types.BusProps) {
new(props: types.BusProps?) {
this.topic = new cloud.Topic() as "EventBridge";

this.handlerCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion eventbridge/platform/sim/eventbridge.w
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bring "./bus.w" as bus;
pub class Bus impl types.IBus {
bus: bus.EventBridgeBus;

new(props: types.BusProps) {
new(props: types.BusProps?) {
this.bus = new bus.EventBridgeBus(props);
}

Expand Down
4 changes: 2 additions & 2 deletions eventbridge/platform/tfaws/eventbridge.w
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub class Bus impl types.IBus {
busName: str;
busArn: str;

new(props: types.BusProps) {
new(props: types.BusProps?) {
let app = nodeof(this).app;
// TODO: use typed properties when its available
if let eventBridgeName = unsafeCast(app)?.platformParameters?.getParameterValue("eventBridgeName") {
Expand All @@ -19,7 +19,7 @@ pub class Bus impl types.IBus {
this.busName = bus.name;
this.busArn = bus.arn;
} else {
let bus = new tfAws.cloudwatchEventBus.CloudwatchEventBus(name: props.name) as "EventBridge";
let bus = new tfAws.cloudwatchEventBus.CloudwatchEventBus(name: props?.name ?? "eventbridge-{this.node.addr.substring(0, 8)}") as "EventBridge";
this.busName = bus.name;
this.busArn = bus.arn;
}
Expand Down
Loading