You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(kinesisfirehose-alpha): refactor sourceStream property to support multiple types of sources (#31723)
### Reason for this change
The previous API for `source` was designed under the assumption that a Source would either be a `Stream` or `Direct Put` if not. Since the alpha module was written, support on the service side for MSK as a Source has been added so we should update the `source` property to accept an `ISource` which can then be implemented by different types of Sources.
### Description of changes
Replaced the `sourceStream` property with `source`.
Changed the `source` property from `IStream` to `ISource`.
Added an `ISource` interface which is implemented by classes which represent the different Source types. Currently implemented by the `KinesisStreamSource` class. The `MSKSource` class can be added in a separate PR.
Added a `SourceConfig` which contains the property configs for each respective source (as the fields within these property configs are different across each source). In `delivery-stream.ts` we call the `_bind` method which will populate and return the correct property config for the Source and that gets directly injected where the L1 `CFNDeliveryStream` is created. This pattern is also used for Destinations:
```ts
const destinationConfig = props.destination.bind(this, {});
const sourceConfig = props.source?._bind(this, this._role?.roleArn);
const resource = new CfnDeliveryStream(this, 'Resource', {
deliveryStreamEncryptionConfigurationInput: encryptionConfig,
deliveryStreamName: props.deliveryStreamName,
deliveryStreamType: props.source ? 'KinesisStreamAsSource' : 'DirectPut',
...sourceConfig,
...destinationConfig,
});
```
### Description of how you validated changes
no behavioural changes. the updated integ tests and unit tests still pass existing tests.
exempting integ tests because we don't want the generated CFN to change.
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
---
BREAKING CHANGE: Replaced the `sourceStream` property with `source`. Changed the `source` property type from `IStream` to `ISource`. Instead of passing in the source Stream directly, it will be passed in by calling the appropriate class like so: `source: new source.KinesisStreamSource(sourceStream)`.
Copy file name to clipboardExpand all lines: packages/@aws-cdk/aws-kinesisfirehose-alpha/README.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -54,23 +54,23 @@ The above example defines the following resources:
54
54
55
55
## Sources
56
56
57
-
There are two main methods of sourcing input data: Kinesis Data Streams and via a "direct
58
-
put".
57
+
A Kinesis Data Firehose delivery stream can accept data from three main sources: Kinesis Data Streams, Managed Streaming for Apache Kafka (MSK), or via a "direct put" (API calls).
59
58
60
59
See: [Sending Data to a Delivery Stream](https://docs.aws.amazon.com/firehose/latest/dev/basic-write.html)
61
60
in the *Kinesis Data Firehose Developer Guide*.
62
61
63
62
### Kinesis Data Stream
64
63
65
64
A delivery stream can read directly from a Kinesis data stream as a consumer of the data
66
-
stream. Configure this behaviour by providing a data stream in the `sourceStream`
67
-
property when constructing a delivery stream:
65
+
stream. Configure this behaviour by passing in a data stream in the `source`
66
+
property via the `KinesisStreamSource` class when constructing a delivery stream:
thrownewError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
@@ -353,27 +353,24 @@ export class DeliveryStream extends DeliveryStreamBase {
})).toThrowError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
})).toThrowError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
})).toThrowError('Requested server-side encryption but delivery stream source is a Kinesis data stream. Specify server-side encryption on the data stream instead.');
0 commit comments