Skip to content

Commit e6f5bc8

Browse files
authored
fix(scheduler-targets-alpha): rename KinesisDataFirehosePutRecord to FirehosePutRecord (#33758)
### Issue # (if applicable) Related to #33757 and #33798 ### Reason for this change Kinesis Data Firehose is now Amazon Data Firehose. Therefore the class `KinesisDataFirehosePutRecord` should not be called Kinesis. ### Description of changes - Renamed `KinesisDataFirehosePutRecord` to `FirehosePutRecord` - Updated related tests and documents. ### Describe any new or updated permissions being added Nothing changed. ### Description of how you validated changes Updated tests and integ tests. ### 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) BREAKING CHANGE: The class `KinesisDataFirehosePutRecord` has been renamed to `FirehosePutRecord`. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 73b9138 commit e6f5bc8

15 files changed

+29
-1090
lines changed

packages/@aws-cdk/aws-scheduler-targets-alpha/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The following targets are supported:
3131
6. `targets.EventBridgePutEvents`: [Put Events on EventBridge](#send-events-to-an-eventbridge-event-bus)
3232
7. `targets.InspectorStartAssessmentRun`: [Start an Amazon Inspector assessment run](#start-an-amazon-inspector-assessment-run)
3333
8. `targets.KinesisStreamPutRecord`: [Put a record to an Amazon Kinesis Data Stream](#put-a-record-to-an-amazon-kinesis-data-stream)
34-
9. `targets.KinesisDataFirehosePutRecord`: [Put a record to an Amazon Data Firehose](#put-a-record-to-an-amazon-data-firehose)
34+
9. `targets.FirehosePutRecord`: [Put a record to an Amazon Data Firehose](#put-a-record-to-an-amazon-data-firehose)
3535
10. `targets.CodePipelineStartPipelineExecution`: [Start a CodePipeline execution](#start-a-codepipeline-execution)
3636
11. `targets.SageMakerStartPipelineExecution`: [Start a SageMaker pipeline execution](#start-a-sagemaker-pipeline-execution)
3737
12. `targets.Universal`: [Invoke a wider set of AWS API](#invoke-a-wider-set-of-aws-api)
@@ -254,13 +254,13 @@ new Schedule(this, 'Schedule', {
254254

255255
## Put a record to an Amazon Data Firehose
256256

257-
Use the `KinesisDataFirehosePutRecord` target to put a record to an Amazon Data Firehose delivery stream.
257+
Use the `FirehosePutRecord` target to put a record to an Amazon Data Firehose delivery stream.
258258

259259
The code snippet below creates an event rule with a delivery stream as a target
260260
called every hour by EventBridge Scheduler with a custom payload.
261261

262262
```ts
263-
import * as firehose from '@aws-cdk/aws-kinesisfirehose-alpha';
263+
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
264264
declare const deliveryStream: firehose.IDeliveryStream;
265265

266266
const payload = {
@@ -269,7 +269,7 @@ const payload = {
269269

270270
new Schedule(this, 'Schedule', {
271271
schedule: ScheduleExpression.rate(Duration.minutes(60)),
272-
target: new targets.KinesisDataFirehosePutRecord(deliveryStream, {
272+
target: new targets.FirehosePutRecord(deliveryStream, {
273273
input: ScheduleTargetInput.fromObject(payload),
274274
}),
275275
});

packages/@aws-cdk/aws-scheduler-targets-alpha/lib/kinesis-data-firehose-put-record.ts renamed to packages/@aws-cdk/aws-scheduler-targets-alpha/lib/firehose-put-record.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ScheduleTargetBase, ScheduleTargetBaseProps } from './target';
66
/**
77
* Use an Amazon Data Firehose as a target for AWS EventBridge Scheduler.
88
*/
9-
export class KinesisDataFirehosePutRecord extends ScheduleTargetBase implements IScheduleTarget {
9+
export class FirehosePutRecord extends ScheduleTargetBase implements IScheduleTarget {
1010
constructor(
1111
private readonly deliveryStream: IDeliveryStream,
1212
props: ScheduleTargetBaseProps = {},

packages/@aws-cdk/aws-scheduler-targets-alpha/lib/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export * from './codebuild-start-build';
22
export * from './codepipeline-start-pipeline-execution';
33
export * from './event-bridge-put-events';
44
export * from './inspector-start-assessment-run';
5-
export * from './kinesis-data-firehose-put-record';
5+
export * from './firehose-put-record';
66
export * from './kinesis-stream-put-record';
77
export * from './lambda-invoke';
88
export * from './sage-maker-start-pipeline-execution';
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AccountRootPrincipal, Role } from 'aws-cdk-lib/aws-iam';
55
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
66
import * as sqs from 'aws-cdk-lib/aws-sqs';
77
import { Construct } from 'constructs';
8-
import { KinesisDataFirehosePutRecord } from '../lib';
8+
import { FirehosePutRecord } from '../lib';
99

1010
describe('schedule target', () => {
1111
let app: App;
@@ -46,8 +46,8 @@ describe('schedule target', () => {
4646
});
4747
});
4848

49-
test('creates IAM role and IAM policy for kinesis data firehose target in the same account', () => {
50-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream);
49+
test('creates IAM role and IAM policy for Amazon Data Firehose target in the same account', () => {
50+
const firehoseTarget = new FirehosePutRecord(firehoseStream);
5151

5252
new Schedule(stack, 'MyScheduleDummy', {
5353
schedule: expr,
@@ -119,7 +119,7 @@ describe('schedule target', () => {
119119
assumedBy: new AccountRootPrincipal(),
120120
});
121121

122-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
122+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
123123
role: targetExecutionRole,
124124
});
125125

@@ -157,7 +157,7 @@ describe('schedule target', () => {
157157
});
158158

159159
test('reuses IAM role and IAM policy for two schedules with the same target from the same account', () => {
160-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream);
160+
const firehoseTarget = new FirehosePutRecord(firehoseStream);
161161

162162
new Schedule(stack, 'MyScheduleDummy1', {
163163
schedule: expr,
@@ -218,7 +218,7 @@ describe('schedule target', () => {
218218
});
219219

220220
test('creates IAM role and IAM policy for two schedules with the same target but different groups', () => {
221-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream);
221+
const firehoseTarget = new FirehosePutRecord(firehoseStream);
222222
const group = new Group(stack, 'Group', {
223223
groupName: 'mygroup',
224224
});
@@ -311,7 +311,7 @@ describe('schedule target', () => {
311311
destination: mockS3Destination,
312312
});
313313

314-
const firehoseTarget = new KinesisDataFirehosePutRecord(anotherFirehose);
314+
const firehoseTarget = new FirehosePutRecord(anotherFirehose);
315315

316316
new Schedule(stack, 'MyScheduleDummy', {
317317
schedule: expr,
@@ -349,7 +349,7 @@ describe('schedule target', () => {
349349
test('creates IAM policy for imported role for firehose in the same account', () => {
350350
const importedRole = Role.fromRoleArn(stack, 'ImportedRole', 'arn:aws:iam::123456789012:role/someRole');
351351

352-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
352+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
353353
role: importedRole,
354354
});
355355

@@ -398,7 +398,7 @@ describe('schedule target', () => {
398398
});
399399
const importedRole = Role.fromRoleArn(stack, 'ImportedRole', 'arn:aws:iam::123456789012:role/someRole');
400400

401-
const firehoseTarget = new KinesisDataFirehosePutRecord(anotherFirehose, {
401+
const firehoseTarget = new FirehosePutRecord(anotherFirehose, {
402402
role: importedRole,
403403
});
404404

@@ -438,7 +438,7 @@ describe('schedule target', () => {
438438
test('adds permissions to execution role for sending messages to DLQ', () => {
439439
const dlq = new sqs.Queue(stack, 'DummyDeadLetterQueue');
440440

441-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
441+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
442442
deadLetterQueue: dlq,
443443
});
444444

@@ -473,7 +473,7 @@ describe('schedule target', () => {
473473
test('adds permission to execution role when imported DLQ is in same account', () => {
474474
const importedQueue = sqs.Queue.fromQueueArn(stack, 'ImportedQueue', 'arn:aws:sqs:us-east-1:123456789012:queue1');
475475

476-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
476+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
477477
deadLetterQueue: importedQueue,
478478
});
479479

@@ -504,7 +504,7 @@ describe('schedule target', () => {
504504
});
505505

506506
test('renders expected retry policy', () => {
507-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
507+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
508508
retryAttempts: 5,
509509
maxEventAge: Duration.hours(3),
510510
});
@@ -531,7 +531,7 @@ describe('schedule target', () => {
531531
});
532532

533533
test('throws when retry policy max age is more than 1 day', () => {
534-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
534+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
535535
maxEventAge: Duration.days(3),
536536
});
537537

@@ -543,7 +543,7 @@ describe('schedule target', () => {
543543
});
544544

545545
test('throws when retry policy max age is less than 1 minute', () => {
546-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
546+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
547547
maxEventAge: Duration.seconds(59),
548548
});
549549

@@ -555,7 +555,7 @@ describe('schedule target', () => {
555555
});
556556

557557
test('throws when retry policy max retry attempts is out of the allowed limits', () => {
558-
const firehoseTarget = new KinesisDataFirehosePutRecord(firehoseStream, {
558+
const firehoseTarget = new FirehosePutRecord(firehoseStream, {
559559
retryAttempts: 200,
560560
});
561561

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-scheduler-targets-alpha/test/integ.firehose-put-record.js.snapshot/tree.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { AwsApiCall, ExpectedResult, IntegTest } from '@aws-cdk/integ-tests-alph
33
import * as cdk from 'aws-cdk-lib';
44
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
55
import { Bucket } from 'aws-cdk-lib/aws-s3';
6-
import { KinesisDataFirehosePutRecord } from '../lib';
6+
import { FirehosePutRecord } from '../lib';
77

88
/*
99
* Stack verification steps:
10-
* A record is put to the kinesis data firehose stream by the scheduler
10+
* A record is put to the Amazon Data Firehose stream by the scheduler
1111
* The firehose deliveries the record to S3 bucket
1212
* The assertion checks there is an object in the S3 bucket
1313
*/
@@ -38,7 +38,7 @@ const firehoseStream = new firehose.DeliveryStream(stack, 'MyFirehoseStream', {
3838

3939
new scheduler.Schedule(stack, 'Schedule', {
4040
schedule: scheduler.ScheduleExpression.rate(cdk.Duration.minutes(1)),
41-
target: new KinesisDataFirehosePutRecord(firehoseStream, {
41+
target: new FirehosePutRecord(firehoseStream, {
4242
input: scheduler.ScheduleTargetInput.fromObject(payload),
4343
}),
4444
});

0 commit comments

Comments
 (0)