Skip to content

feat(aws-eventbridge-kinesisstrems, aws-events-rule-kinesisstreams, aws-eventbridge-kinesisfirehose-s3, aws-events-rule-kinesisfirehose-s3): support for custom EventBus #364

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

Merged
merged 6 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ _Parameters_

| **Name** | **Type** | **Description** |
|:-------------|:----------------|-----------------|
|existingEventBusInterface?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.IEventBus.html)| Optional user-provided custom EventBus for construct to use. Providing both this and `eventBusProps` results an error.|
|eventBusProps?|[`events.EventBusProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.EventBusProps.html)|Optional user-provided properties to override the default properties when creating a custom EventBus. Setting this value to `{}` will create a custom EventBus using all default properties. If neither this nor `existingEventBusInterface` is provided the construct will use the `default` EventBus. Providing both this and `existingEventBusInterface` results an error.|
|eventRuleProps|[`events.RuleProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.RuleProps.html)|User provided eventRuleProps to override the defaults.|
|kinesisFirehoseProps?|[`kinesisfirehose.CfnDeliveryStreamProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.CfnDeliveryStreamProps.html)|Optional user provided props to override the default props for Kinesis Firehose Delivery Stream|
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object. If this is provided, then also providing bucketProps is an error. |
Expand All @@ -66,6 +68,7 @@ _Parameters_

| **Name** | **Type** | **Description** |
|:-------------|:----------------|-----------------|
|eventBus?|[`events.IEventBus`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.IEventBus.html)|Returns the instance of events.IEventBus used by the construct|
|eventsRule|[`events.Rule`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.Rule.html)|Returns an instance of events.Rule created by the construct.|
|kinesisFirehose|[`kinesisfirehose.CfnDeliveryStream`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.CfnDeliveryStream.html)|Returns an instance of kinesisfirehose.CfnDeliveryStream created by the construct|
|s3Bucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,48 @@ import { KinesisFirehoseToS3 } from '@aws-solutions-constructs/aws-kinesisfireho
* @summary The properties for the EventbridgeToKinesisFirehoseToS3 Construct
*/
export interface EventbridgeToKinesisFirehoseToS3Props {
/**
* Existing instance of a custom EventBus.
*
* @default - None
*/
readonly existingEventBusInterface?: events.IEventBus;
/**
* A new custom EventBus is created with provided props.
*
* @default - None
*/
readonly eventBusProps?: events.EventBusProps;
/**
* User provided eventRuleProps to override the defaults
*
* @default - None
*/
readonly eventRuleProps: events.RuleProps
readonly eventRuleProps: events.RuleProps;
/**
* User provided props to override the default props for the Kinesis Firehose.
*
* @default - Default props are used
*/
readonly kinesisFirehoseProps?: kinesisfirehose.CfnDeliveryStreamProps | any
readonly kinesisFirehoseProps?: kinesisfirehose.CfnDeliveryStreamProps | any;
/**
* Existing instance of S3 Bucket object, providing both this and `bucketProps` will cause an error.
*
* @default - None
*/
readonly existingBucketObj?: s3.IBucket,
readonly existingBucketObj?: s3.IBucket;
/**
* User provided props to override the default props for the S3 Bucket.
*
* @default - Default props are used
*/
readonly bucketProps?: s3.BucketProps,
readonly bucketProps?: s3.BucketProps;
/**
* User provided props to override the default props for the CloudWatchLogs LogGroup.
*
* @default - Default props are used
*/
readonly logGroupProps?: logs.LogGroupProps
readonly logGroupProps?: logs.LogGroupProps;
}

export class EventbridgeToKinesisFirehoseToS3 extends Construct {
Expand All @@ -66,6 +78,7 @@ export class EventbridgeToKinesisFirehoseToS3 extends Construct {
public readonly kinesisFirehoseRole: iam.Role;
public readonly s3Bucket?: s3.Bucket;
public readonly s3LoggingBucket?: s3.Bucket;
public readonly eventBus?: events.IEventBus;

/**
* @summary Constructs a new instance of the EventbridgeToKinesisFirehoseToS3 class.
Expand Down Expand Up @@ -124,8 +137,14 @@ export class EventbridgeToKinesisFirehoseToS3 extends Construct {
})
};

// build an event bus if existingEventBus is provided or eventBusProps are provided
this.eventBus = defaults.buildEventBus(this, {
existingEventBusInterface: props.existingEventBusInterface,
eventBusProps: props.eventBusProps
});

// Set up the events rule props
const defaultEventsRuleProps = defaults.DefaultEventsRuleProps([KinesisFirehoseEventTarget]);
const defaultEventsRuleProps = defaults.DefaultEventsRuleProps([KinesisFirehoseEventTarget], this.eventBus);
const eventsRuleProps = overrideProps(defaultEventsRuleProps, props.eventRuleProps, true);

this.eventsRule = new events.Rule(this, 'EventsRule', eventsRuleProps);
Expand Down
Loading