-
Notifications
You must be signed in to change notification settings - Fork 4k
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(scheduler-alpha): remove targetOverrides
prop from Schedule
#31799
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ import * as kms from 'aws-cdk-lib/aws-kms'; | |
import { CfnSchedule } from 'aws-cdk-lib/aws-scheduler'; | ||
import { Construct } from 'constructs'; | ||
import { IGroup } from './group'; | ||
import { ScheduleTargetInput } from './input'; | ||
import { ScheduleExpression } from './schedule-expression'; | ||
import { IScheduleTarget } from './target'; | ||
|
||
|
@@ -26,37 +25,6 @@ export interface ISchedule extends IResource { | |
* The arn of the schedule. | ||
*/ | ||
readonly scheduleArn: string; | ||
|
||
/** | ||
* The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data. | ||
*/ | ||
readonly key?: kms.IKey; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we mean to remove this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Removing it from the interface as it is not being used currently. I would like to start with minimal exposed APIs, then we can add more in the future if needed. |
||
} | ||
|
||
export interface ScheduleTargetProps { | ||
/** | ||
* The text, or well-formed JSON, passed to the target. | ||
* | ||
* If you are configuring a templated Lambda, AWS Step Functions, or Amazon EventBridge target, | ||
* the input must be a well-formed JSON. For all other target types, a JSON is not required. | ||
* | ||
* @default - The target's input is used. | ||
*/ | ||
readonly input?: ScheduleTargetInput; | ||
|
||
/** | ||
* The maximum amount of time, in seconds, to continue to make retry attempts. | ||
* | ||
* @default - The target's maximumEventAgeInSeconds is used. | ||
*/ | ||
readonly maxEventAge?: Duration; | ||
|
||
/** | ||
* The maximum number of retry attempts to make before the request fails. | ||
* | ||
* @default - The target's maximumRetryAttempts is used. | ||
*/ | ||
readonly retryAttempts?: number; | ||
} | ||
|
||
/** | ||
|
@@ -115,11 +83,6 @@ export interface ScheduleProps { | |
*/ | ||
readonly target: IScheduleTarget; | ||
|
||
/** | ||
* Allows to override target properties when creating a new schedule. | ||
*/ | ||
readonly targetOverrides?: ScheduleTargetProps; | ||
|
||
/** | ||
* The name of the schedule. | ||
* | ||
|
@@ -342,11 +305,9 @@ export class Schedule extends Resource implements ISchedule { | |
target: { | ||
arn: targetConfig.arn, | ||
roleArn: targetConfig.role.roleArn, | ||
input: props.targetOverrides?.input ? | ||
props.targetOverrides?.input?.bind(this) : | ||
targetConfig.input?.bind(this), | ||
input: targetConfig.input?.bind(this), | ||
deadLetterConfig: targetConfig.deadLetterConfig, | ||
retryPolicy: this.renderRetryPolicy(props.targetOverrides?.maxEventAge?.toSeconds(), props.targetOverrides?.retryAttempts), | ||
retryPolicy: this.renderRetryPolicy(), | ||
ecsParameters: targetConfig.ecsParameters, | ||
kinesisParameters: targetConfig.kinesisParameters, | ||
eventBridgeParameters: targetConfig.eventBridgeParameters, | ||
|
@@ -366,14 +327,9 @@ export class Schedule extends Resource implements ISchedule { | |
}); | ||
} | ||
|
||
private renderRetryPolicy( | ||
maximumEventAgeInSeconds?: number, | ||
maximumRetryAttempts?: number, | ||
): CfnSchedule.RetryPolicyProperty | undefined { | ||
private renderRetryPolicy(): CfnSchedule.RetryPolicyProperty | undefined { | ||
const policy = { | ||
...this.retryPolicy, | ||
maximumEventAgeInSeconds: maximumEventAgeInSeconds ?? this.retryPolicy?.maximumEventAgeInSeconds, | ||
maximumRetryAttempts: maximumRetryAttempts ?? this.retryPolicy?.maximumRetryAttempts, | ||
}; | ||
|
||
if (policy.maximumEventAgeInSeconds && (policy.maximumEventAgeInSeconds < 60 || policy.maximumEventAgeInSeconds > 86400)) { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know if this is a common use case? If so it may be worth keeping this README section with your updated suggestion for overriding target props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is common use case. If we see the need in the future, we can add.