Skip to content

Commit

Permalink
fix(iot): FirehoseStreamAction is now called `FirehosePutRecordActi…
Browse files Browse the repository at this point in the history
…on` (#18356)

By #18321 (comment)

BREAKING CHANGE: the class `FirehoseStreamAction` has been renamed to `FirehosePutRecordAction`

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
yamatatsu committed Jan 11, 2022
1 parent ee95905 commit c016a9f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-iot-actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ const stream = new firehose.DeliveryStream(this, 'MyStream', {
const topicRule = new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323("SELECT * FROM 'device/+/data'"),
actions: [
new actions.FirehoseStreamAction(stream, {
new actions.FirehosePutRecordAction(stream, {
batchMode: true,
recordSeparator: actions.FirehoseStreamRecordSeparator.NEWLINE,
recordSeparator: actions.FirehoseRecordSeparator.NEWLINE,
}),
],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { singletonActionRole } from './private/role';
/**
* Record Separator to be used to separate records.
*/
export enum FirehoseStreamRecordSeparator {
export enum FirehoseRecordSeparator {
/**
* Separate by a new line
*/
Expand All @@ -32,7 +32,7 @@ export enum FirehoseStreamRecordSeparator {
/**
* Configuration properties of an action for the Kinesis Data Firehose stream.
*/
export interface FirehoseStreamActionProps extends CommonActionProps {
export interface FirehosePutRecordActionProps extends CommonActionProps {
/**
* Whether to deliver the Kinesis Data Firehose stream as a batch by using `PutRecordBatch`.
* When batchMode is true and the rule's SQL statement evaluates to an Array, each Array
Expand All @@ -48,14 +48,14 @@ export interface FirehoseStreamActionProps extends CommonActionProps {
*
* @default - none -- the stream does not use a separator
*/
readonly recordSeparator?: FirehoseStreamRecordSeparator;
readonly recordSeparator?: FirehoseRecordSeparator;
}


/**
* The action to put the record from an MQTT message to the Kinesis Data Firehose stream.
*/
export class FirehoseStreamAction implements iot.IAction {
export class FirehosePutRecordAction implements iot.IAction {
private readonly batchMode?: boolean;
private readonly recordSeparator?: string;
private readonly role?: iam.IRole;
Expand All @@ -64,7 +64,7 @@ export class FirehoseStreamAction implements iot.IAction {
* @param stream The Kinesis Data Firehose stream to which to put records.
* @param props Optional properties to not use default
*/
constructor(private readonly stream: firehose.IDeliveryStream, props: FirehoseStreamActionProps = {}) {
constructor(private readonly stream: firehose.IDeliveryStream, props: FirehosePutRecordActionProps = {}) {
this.batchMode = props.batchMode;
this.recordSeparator = props.recordSeparator;
this.role = props.role;
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-iot-actions/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ export * from './cloudwatch-logs-action';
export * from './cloudwatch-put-metric-action';
export * from './cloudwatch-set-alarm-state-action';
export * from './common-action-props';
export * from './firehose-stream-action';
export * from './firehose-put-record-action';
export * from './lambda-function-action';
export * from './s3-put-object-action';
export * from './sqs-queue-action';

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('Default firehose stream action', () => {

// WHEN
topicRule.addAction(
new actions.FirehoseStreamAction(stream),
new actions.FirehosePutRecordAction(stream),
);

// THEN
Expand Down Expand Up @@ -77,7 +77,7 @@ test('can set batchMode', () => {

// WHEN
topicRule.addAction(
new actions.FirehoseStreamAction(stream, { batchMode: true }),
new actions.FirehosePutRecordAction(stream, { batchMode: true }),
);

// THEN
Expand All @@ -100,7 +100,7 @@ test('can set separotor', () => {

// WHEN
topicRule.addAction(
new actions.FirehoseStreamAction(stream, { recordSeparator: actions.FirehoseStreamRecordSeparator.NEWLINE }),
new actions.FirehosePutRecordAction(stream, { recordSeparator: actions.FirehoseRecordSeparator.NEWLINE }),
);

// THEN
Expand All @@ -124,7 +124,7 @@ test('can set role', () => {

// WHEN
topicRule.addAction(
new actions.FirehoseStreamAction(stream, { role }),
new actions.FirehosePutRecordAction(stream, { role }),
);

// THEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class TestStack extends cdk.Stack {
destinations: [new destinations.S3Bucket(bucket)],
});
topicRule.addAction(
new actions.FirehoseStreamAction(stream, {
new actions.FirehosePutRecordAction(stream, {
batchMode: true,
recordSeparator: actions.FirehoseStreamRecordSeparator.NEWLINE,
recordSeparator: actions.FirehoseRecordSeparator.NEWLINE,
}),
);
}
Expand Down

0 comments on commit c016a9f

Please sign in to comment.