From c016a9fcf51f2415e6e0fcca2255da384c8abbc1 Mon Sep 17 00:00:00 2001 From: Tatsuya Yamamoto Date: Wed, 12 Jan 2022 04:45:17 +0900 Subject: [PATCH] fix(iot): `FirehoseStreamAction` is now called `FirehosePutRecordAction` (#18356) By https://github.com/aws/aws-cdk/pull/18321#discussion_r781620195 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* --- packages/@aws-cdk/aws-iot-actions/README.md | 4 ++-- ...-stream-action.ts => firehose-put-record-action.ts} | 10 +++++----- packages/@aws-cdk/aws-iot-actions/lib/index.ts | 3 +-- ...tion.test.ts => firehose-put-record-action.test.ts} | 8 ++++---- ... => integ.firehose-put-record-action.expected.json} | 0 ...m-action.ts => integ.firehose-put-record-action.ts} | 4 ++-- 6 files changed, 14 insertions(+), 15 deletions(-) rename packages/@aws-cdk/aws-iot-actions/lib/{firehose-stream-action.ts => firehose-put-record-action.ts} (88%) rename packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/{firehose-stream-action.test.ts => firehose-put-record-action.test.ts} (93%) rename packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/{integ.firehose-stream-action.expected.json => integ.firehose-put-record-action.expected.json} (100%) rename packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/{integ.firehose-stream-action.ts => integ.firehose-put-record-action.ts} (89%) diff --git a/packages/@aws-cdk/aws-iot-actions/README.md b/packages/@aws-cdk/aws-iot-actions/README.md index f2b38ca4f2cb8..b232878cec486 100644 --- a/packages/@aws-cdk/aws-iot-actions/README.md +++ b/packages/@aws-cdk/aws-iot-actions/README.md @@ -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, }), ], }); diff --git a/packages/@aws-cdk/aws-iot-actions/lib/firehose-stream-action.ts b/packages/@aws-cdk/aws-iot-actions/lib/firehose-put-record-action.ts similarity index 88% rename from packages/@aws-cdk/aws-iot-actions/lib/firehose-stream-action.ts rename to packages/@aws-cdk/aws-iot-actions/lib/firehose-put-record-action.ts index c694bef7cad38..e9583ce1c87e3 100644 --- a/packages/@aws-cdk/aws-iot-actions/lib/firehose-stream-action.ts +++ b/packages/@aws-cdk/aws-iot-actions/lib/firehose-put-record-action.ts @@ -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 */ @@ -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 @@ -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; @@ -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; diff --git a/packages/@aws-cdk/aws-iot-actions/lib/index.ts b/packages/@aws-cdk/aws-iot-actions/lib/index.ts index a817ccb0ca35a..77fb9fc4e0efe 100644 --- a/packages/@aws-cdk/aws-iot-actions/lib/index.ts +++ b/packages/@aws-cdk/aws-iot-actions/lib/index.ts @@ -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'; - diff --git a/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/firehose-stream-action.test.ts b/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/firehose-put-record-action.test.ts similarity index 93% rename from packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/firehose-stream-action.test.ts rename to packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/firehose-put-record-action.test.ts index 2941cc1db270c..55fd6cbbfe51c 100644 --- a/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/firehose-stream-action.test.ts +++ b/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/firehose-put-record-action.test.ts @@ -15,7 +15,7 @@ test('Default firehose stream action', () => { // WHEN topicRule.addAction( - new actions.FirehoseStreamAction(stream), + new actions.FirehosePutRecordAction(stream), ); // THEN @@ -77,7 +77,7 @@ test('can set batchMode', () => { // WHEN topicRule.addAction( - new actions.FirehoseStreamAction(stream, { batchMode: true }), + new actions.FirehosePutRecordAction(stream, { batchMode: true }), ); // THEN @@ -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 @@ -124,7 +124,7 @@ test('can set role', () => { // WHEN topicRule.addAction( - new actions.FirehoseStreamAction(stream, { role }), + new actions.FirehosePutRecordAction(stream, { role }), ); // THEN diff --git a/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-stream-action.expected.json b/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-put-record-action.expected.json similarity index 100% rename from packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-stream-action.expected.json rename to packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-put-record-action.expected.json diff --git a/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-stream-action.ts b/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-put-record-action.ts similarity index 89% rename from packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-stream-action.ts rename to packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-put-record-action.ts index 2c6c93cf0460f..d065723d6468e 100644 --- a/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-stream-action.ts +++ b/packages/@aws-cdk/aws-iot-actions/test/kinesis-firehose/integ.firehose-put-record-action.ts @@ -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, }), ); }