aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.68k stars 3.93k forks source link

aws-events: Enable schema discovery for Event Bus #26480

Open iRoachie opened 1 year ago

iRoachie commented 1 year ago

Describe the feature

The current EventBus construct doesn't allow enabling schema discovery.

Use Case

Need to enable schema discovery for an event bus without using L1 constructs.

Proposed Solution

This behaviour is supported in Cloudformation through AWS::EventSchemas::Discoverer.

This should be easily implemented on the EventBus.

e.g

const eventBus = new EventBus(this, 'poll-events', {
  schemaDiscovery: true
});

or to enable tagging we can do:

const eventBus = new EventBus(this, 'poll-events')

const discoverer = eventBus.addDiscoverer()

cdk.Tags.of(discoverer).add('my-tag', 'yup')

Other Information

No response

Acknowledgements

CDK version used

2.88.0

Environment details (OS name and version, etc.)

Mac OS 13.4.1

pahud commented 1 year ago

Sounds like we'll need to create a new L2 for AWS::EventSchemas::Discoverer or just create CfnDiscoverer L1 in EventBus L2?

iRoachie commented 1 year ago

I'm thinking the latter