Skip to content

Commit

Permalink
set default value for props
Browse files Browse the repository at this point in the history
  • Loading branch information
gracelu0 committed Nov 14, 2024
1 parent a7155fd commit 0288323
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-scheduler-targets-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<!--END STABILITY BANNER-->

[Amazon EventBridge Scheduler](https://aws.amazon.com/blogs/compute/introducing-amazon-eventbridge-scheduler/) is a feature from Amazon EventBridge
that allows you to create, run, and manage scheduled tasks at scale. With EventBridge Scheduler, you can schedule one-time or recurrently tens
that allows you to create, run, and manage scheduled tasks at scale. With EventBridge Scheduler, you can schedule one-time or recurrently tens
of millions of tasks across many AWS services without provisioning or managing underlying infrastructure.

This library contains integration classes for Amazon EventBridge Scheduler to call any
number of supported AWS Services.
number of supported AWS Services.

The following targets are supported:

Expand Down Expand Up @@ -208,7 +208,7 @@ const eventEntry: targets.EventBridgePutEventsEntry = {

new Schedule(this, 'Schedule', {
schedule: ScheduleExpression.rate(Duration.hours(1)),
target: new targets.EventBridgePutEvents(eventEntry, {}),
target: new targets.EventBridgePutEvents(eventEntry),
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface EventBridgePutEventsEntry {
export class EventBridgePutEvents extends ScheduleTargetBase implements IScheduleTarget {
constructor(
private readonly entry: EventBridgePutEventsEntry,
private readonly props: ScheduleTargetBaseProps,
private readonly props: ScheduleTargetBaseProps = {},
) {
super(props, entry.eventBus.eventBusArn);
if (this.props.input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface SqsSendMessageProps extends ScheduleTargetBaseProps {
export class SqsSendMessage extends ScheduleTargetBase implements IScheduleTarget {
constructor(
private readonly queue: sqs.IQueue,
private readonly props: SqsSendMessageProps,
private readonly props: SqsSendMessageProps = {},
) {
super(props, queue.queueArn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('codebuild start build', () => {
});

test('creates IAM role and IAM policy for codebuild target in the same account', () => {
const codeBuildTarget = new CodeBuildStartBuild(codebuildProject, {});
const codeBuildTarget = new CodeBuildStartBuild(codebuildProject);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down Expand Up @@ -131,7 +131,7 @@ describe('codebuild start build', () => {
});

test('reuses IAM role and IAM policy for two schedules with the same target from the same account', () => {
const codeBuildTarget = new CodeBuildStartBuild(codebuildProject, {});
const codeBuildTarget = new CodeBuildStartBuild(codebuildProject);

new Schedule(stack, 'MyScheduleDummy1', {
schedule: expr,
Expand Down Expand Up @@ -192,7 +192,7 @@ describe('codebuild start build', () => {
});

test('creates IAM role and IAM policy for two schedules with the same target but different groups', () => {
const codeBuildTarget = new CodeBuildStartBuild(codebuildProject, {});
const codeBuildTarget = new CodeBuildStartBuild(codebuildProject);
const group = new Group(stack, 'Group', {
groupName: 'mygroup',
});
Expand Down Expand Up @@ -278,7 +278,7 @@ describe('codebuild start build', () => {
const importedCodeBuildArn = 'arn:aws:codebuild:us-east-1:123456789012:project/myproject';
const importedCodeBuild = Project.fromProjectArn(stack, 'ImportedProject', importedCodeBuildArn);

const codeBuildTarget = new CodeBuildStartBuild(importedCodeBuild, {});
const codeBuildTarget = new CodeBuildStartBuild(importedCodeBuild);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('codepipeline start execution', () => {
});

test('creates IAM role and IAM policy for pipeline target in the same account', () => {
const codepipelineTarget = new CodePipelineStartPipelineExecution(codepipeline, {});
const codepipelineTarget = new CodePipelineStartPipelineExecution(codepipeline);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('codepipeline start execution', () => {
});

test('reuses IAM role and IAM policy for two schedules with the same target from the same account', () => {
const codepipelineTarget = new CodePipelineStartPipelineExecution(codepipeline, {});
const codepipelineTarget = new CodePipelineStartPipelineExecution(codepipeline);

new Schedule(stack, 'MyScheduleDummy1', {
schedule: expr,
Expand Down Expand Up @@ -202,7 +202,7 @@ describe('codepipeline start execution', () => {
});

test('creates IAM role and IAM policy for two schedules with the same target but different groups', () => {
const codepipelineTarget = new CodePipelineStartPipelineExecution(codepipeline, {});
const codepipelineTarget = new CodePipelineStartPipelineExecution(codepipeline);
const group = new Group(stack, 'Group', {
groupName: 'mygroup',
});
Expand Down Expand Up @@ -288,7 +288,7 @@ describe('codepipeline start execution', () => {
const importedPipelineArn = 'arn:aws:codepipeline:us-east-1:123456789012:MyPipeline';
const importedPipeline = Pipeline.fromPipelineArn(stack, 'ImportedPipeline', importedPipelineArn);

const codepipelineTarget = new CodePipelineStartPipelineExecution(importedPipeline, {});
const codepipelineTarget = new CodePipelineStartPipelineExecution(importedPipeline);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('eventBridge put events', () => {
});

test('creates IAM role and IAM policy for event bus put events target in the same account', () => {
const eventBusTarget = new EventBridgePutEvents(eventBusEventEntry, {});
const eventBusTarget = new EventBridgePutEvents(eventBusEventEntry);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('eventBridge put events', () => {
});

test('reuses IAM role and IAM policy for two schedules with the same target from the same account', () => {
const eventBusTarget = new EventBridgePutEvents(eventBusEventEntry, {});
const eventBusTarget = new EventBridgePutEvents(eventBusEventEntry);

new Schedule(stack, 'MyScheduleDummy1', {
schedule: expr,
Expand Down Expand Up @@ -228,7 +228,7 @@ describe('eventBridge put events', () => {
});

test('creates IAM role and IAM policy for two schedules with the same target but different groups', () => {
const eventBusTarget = new EventBridgePutEvents(eventBusEventEntry, {});
const eventBusTarget = new EventBridgePutEvents(eventBusEventEntry);
const group = new Group(stack, 'Group', {
groupName: 'mygroup',
});
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('eventBridge put events', () => {
eventBus: importedEventBus,
};

const eventBusTarget = new EventBridgePutEvents(entry, {});
const eventBusTarget = new EventBridgePutEvents(entry);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ describe('schedule target', () => {
});

test('reuses IAM role and IAM policy for two schedules with the same target from the same account', () => {
const lambdaTarget = new LambdaInvoke(func, {});
const lambdaTarget = new LambdaInvoke(func);

new Schedule(stack, 'MyScheduleDummy1', {
schedule: expr,
Expand Down Expand Up @@ -296,7 +296,7 @@ describe('schedule target', () => {
});

test('creates IAM role and IAM policy for two schedules with the same target but different groups', () => {
const lambdaTarget = new LambdaInvoke(func, {});
const lambdaTarget = new LambdaInvoke(func);
const group = new Group(stack, 'Group', {
groupName: 'mygroup',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('schedule target', () => {
});

test('creates IAM role and IAM policy for sqs target in the same account', () => {
const queueTarget = new SqsSendMessage(queue, {});
const queueTarget = new SqsSendMessage(queue);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down Expand Up @@ -129,7 +129,7 @@ describe('schedule target', () => {
});

test('reuses IAM role and IAM policy for two schedules with the same target from the same account', () => {
const queueTarget = new SqsSendMessage(queue, {});
const queueTarget = new SqsSendMessage(queue);

new Schedule(stack, 'MyScheduleDummy1', {
schedule: expr,
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('schedule target', () => {
});

test('creates IAM role and IAM policy for two schedules with the same target but different groups', () => {
const queueTarget = new SqsSendMessage(queue, {});
const queueTarget = new SqsSendMessage(queue);
const group = new Group(stack, 'Group', {
groupName: 'mygroup',
});
Expand Down Expand Up @@ -275,7 +275,7 @@ describe('schedule target', () => {
test('creates IAM policy for imported queue in the same account', () => {
const importedQueue = sqs.Queue.fromQueueArn(stack, 'ImportedQueue', 'arn:aws:sqs:us-east-1:123456789012:somequeue');

const queueTarget = new SqsSendMessage(importedQueue, {});
const queueTarget = new SqsSendMessage(importedQueue);

new Schedule(stack, 'MyScheduleDummy', {
schedule: expr,
Expand Down Expand Up @@ -593,6 +593,6 @@ describe('schedule target', () => {
contentBasedDeduplication: true,
});
expect(() =>
new SqsSendMessage(wrongQueue, {})).toThrow(/messageGroupId must be specified if the target is a FIFO queue/);
new SqsSendMessage(wrongQueue)).toThrow(/messageGroupId must be specified if the target is a FIFO queue/);
});
});

0 comments on commit 0288323

Please sign in to comment.