Skip to content

@aws-cdk/aws-s3: enableEventBridgeNotification is not exposed on IBucket #20824

@mirgj

Description

@mirgj

Describe the bug

Currently, when importing an existing bucket, is possible to add EventNotifications to that bucket.

This is not possible for Eventbridge, indeed the existing enableEventBridgeNotification method is protected and not exposed in the IBucket interface either.

Expected Behavior

ability to enable Eventbridge notifications in existing buckets. eg

import * as s3 from 'aws-cdk-lib/aws-s3';

...

const bucket = s3.Bucket.fromBucketName(this, 'MyBucket', 'my-bucket-name');
bucket.enableEventBridgeNotification();

Current Behavior

the enableEventBridgeNotification is not exposed, thus not callable. The only way to enable Eventbridge notifications is by creating a new bucket and providing eventBridgeEnabled flag to true

eg.

import * as s3 from 'aws-cdk-lib/aws-s3';

...

new s3.Bucket(this, 'MyBucket', {
  eventBridgeEnabled: true,
})

Reproduction Steps

Try to import a bucket as explained in the Expected Behavior section to verify that the method is not listed in the allowed one

Possible Solution

make the enableEventBridgeNotification public and expose it through the IBucket interface

Additional Information/Context

N/A

CDK CLI Version

2.28.1

Framework Version

No response

Node.js Version

16.15.0

OS

macOS 12.4

Language

Typescript

Language Version

3.9.7

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions