Skip to content
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

fix(iot): FirehoseStreamAction is now called FirehosePutRecordAction #18356

Merged
merged 3 commits into from
Jan 11, 2022
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
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