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

feat(scheduler-targets): SqsSendMessage Target #27774

Merged
merged 24 commits into from
Nov 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
269b0bd
wip
go-to-k Oct 31, 2023
e397c2c
test: change unit tests
go-to-k Oct 31, 2023
41fbf8b
feat: add bindBaseTargetConfig
go-to-k Oct 31, 2023
48dca93
docs: props comments
go-to-k Oct 31, 2023
32452a6
test: change an unit test
go-to-k Oct 31, 2023
ec9a162
test: wip
go-to-k Oct 31, 2023
e1b18f3
test: add integ tests
go-to-k Oct 31, 2023
d1ab879
add validations and the unit tests
go-to-k Oct 31, 2023
38c443f
docs: WIP in README
go-to-k Oct 31, 2023
173f2ed
chore: change validations and unit tests
go-to-k Nov 1, 2023
13489af
docs: wip in README
go-to-k Nov 1, 2023
4fc9c97
docs: change README and jsdocs
go-to-k Nov 1, 2023
5b2ed77
docs: fix for rosetta in README
go-to-k Nov 1, 2023
97acac6
docs: add default for messageGroupId
go-to-k Nov 1, 2023
736e359
Merge branch 'main' into feat/scheduler-targets-sqs
go-to-k Nov 4, 2023
3bf56da
covered for the review
go-to-k Nov 4, 2023
c585d6c
add a new line in README
go-to-k Nov 4, 2023
276298a
Merge branch 'main' of https://github.com/go-to-k/aws-cdk into feat/s…
go-to-k Nov 12, 2023
3060470
improve unit tests by using fromQueueArn in the same stack
go-to-k Nov 12, 2023
bc9bddc
Merge branch 'main' into feat/scheduler-targets-sqs
vinayak-kukreja Nov 20, 2023
84e77f6
Merge branch 'main' into feat/scheduler-targets-sqs
sumupitchayan Nov 20, 2023
c5bb455
Merge branch 'main' into feat/scheduler-targets-sqs
sumupitchayan Nov 21, 2023
6ad3e0c
Merge branch 'main' into feat/scheduler-targets-sqs
mergify[bot] Nov 21, 2023
84951af
Merge branch 'main' into feat/scheduler-targets-sqs
mergify[bot] Nov 21, 2023
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
Prev Previous commit
Next Next commit
feat: add bindBaseTargetConfig
  • Loading branch information
go-to-k committed Oct 31, 2023
commit 41fbf8bdf953ecbbf605479135647112f87b3e49
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
import { ISchedule, IScheduleTarget } from '@aws-cdk/aws-scheduler-alpha';
import { ISchedule, IScheduleTarget, ScheduleTargetConfig } from '@aws-cdk/aws-scheduler-alpha';
import { Names } from 'aws-cdk-lib';
import { IRole } from 'aws-cdk-lib/aws-iam';
import * as sqs from 'aws-cdk-lib/aws-sqs';
import { ScheduleTargetBase, ScheduleTargetBaseProps } from './target';
import { sameEnvDimension } from './util';

/**
* Base properties for a Schedule Target
*/
export interface SqsSendMessageProps extends ScheduleTargetBaseProps {
/**
* The FIFO message group ID to use as the target.
*
* @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-scheduler-schedule-sqsparameters.html#cfn-scheduler-schedule-sqsparameters-messagegroupid
*/
readonly messageGroupId?: string;
}

/**
* Use an Amazon SQS Queue as a target for AWS EventBridge Scheduler.
*/
export class SqsSendMessage extends ScheduleTargetBase implements IScheduleTarget {
constructor(
private readonly queue: sqs.IQueue,
private readonly props: ScheduleTargetBaseProps,
private readonly props: SqsSendMessageProps,
) {
super(props, queue.queueArn);
}
Expand All @@ -32,22 +44,12 @@ export class SqsSendMessage extends ScheduleTargetBase implements IScheduleTarge
this.queue.grantSendMessages(role);
}

// protected bindBaseTargetConfig(_schedule: ISchedule): ScheduleTargetConfig {
// const role: iam.IRole = this.baseProps.role ?? this.singletonScheduleRole(_schedule, this.targetArn);
// this.addTargetActionToRole(_schedule, role);

// if (this.baseProps.deadLetterQueue) {
// this.addToDeadLetterQueueResourcePolicy(_schedule, this.baseProps.deadLetterQueue);
// }

// return {
// arn: this.targetArn,
// role: role,
// deadLetterConfig: this.baseProps.deadLetterQueue ? {
// arn: this.baseProps.deadLetterQueue.queueArn,
// } : undefined,
// retryPolicy: this.renderRetryPolicy(this.baseProps.maxEventAge, this.baseProps.retryAttempts),
// input: this.baseProps.input,
// };
// }
protected bindBaseTargetConfig(_schedule: ISchedule): ScheduleTargetConfig {
return {
...super.bindBaseTargetConfig(_schedule),
sqsParameters: {
messageGroupId: this.props.messageGroupId,
},
};
}
}