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

(aws-scheduler-alpha): Override target properties in schedule #27545

Closed
1 of 2 tasks
filletofish opened this issue Oct 14, 2023 · 1 comment · Fixed by #27603
Closed
1 of 2 tasks

(aws-scheduler-alpha): Override target properties in schedule #27545

filletofish opened this issue Oct 14, 2023 · 1 comment · Fixed by #27603
Labels
@aws-cdk/aws-scheduler Related to the AWS Scheduler service effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@filletofish
Copy link
Contributor

Describe the feature

If customers wish to reuse the same target in multiple schedules, they should be able to override target properties like input, maximumRetryAttempts and maximumEventAge when creating a Schedule:

const target = new targets.LambdaInvoke(props.func, {
    input: ScheduleTargetInput.fromObject({
        "payload": "useful"
    }),
});

const schedule1 = new Schedule(this, 'Schedule', {
    scheduleExpression: ScheduleExpression.cron({ day: '20' }),
    target,
});

const schedule2 = new Schedule(this, 'Schedule2', {
    scheduleExpression: ScheduleExpression.cron({ day: '5' })
    target,
    targetOverrides: {
        input: ScheduleTargetInput.fromText("Overriding Target Input")
    }
});

See https://github.com/aws/aws-cdk-rfcs/blob/main/text/0474-event-bridge-scheduler-l2.md#overriding-target-properties

Use Case

It will be useful for customers who wish to reuse the same target in multiple schedules.

Proposed Solution

Add property targetOverrides to ScheduleProps that is being used during creation of CfnSchedule.

export interface TargetOverrideProps {
  readonly input?: ScheduleTargetInput;
  readonly maximumEventAge?: Duration;
  readonly maximumRetryAttempts?: number;
}

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.99.1

Environment details (OS name and version, etc.)

MacOS

@filletofish filletofish added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 14, 2023
@github-actions github-actions bot added the @aws-cdk/aws-scheduler Related to the AWS Scheduler service label Oct 14, 2023
@kaizencc kaizencc added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Oct 16, 2023
lpizzinidev added a commit to lpizzinidev/aws-cdk that referenced this issue Oct 19, 2023
lpizzinidev added a commit to lpizzinidev/aws-cdk that referenced this issue Oct 23, 2023
lpizzinidev added a commit to lpizzinidev/aws-cdk that referenced this issue Oct 24, 2023
kaizencc added a commit to lpizzinidev/aws-cdk that referenced this issue Oct 26, 2023
mergify bot added a commit to lpizzinidev/aws-cdk that referenced this issue Oct 26, 2023
@mergify mergify bot closed this as completed in #27603 Oct 26, 2023
mergify bot pushed a commit that referenced this issue Oct 26, 2023
Allows to override a `Schedule` target's properties.
Supported properties: `input`, `maxEventAge`, and `retryAttempts`.

Example:
```ts
declare const target: targets.LambdaInvoke;

const oneTimeSchedule = new Schedule(this, 'Schedule', {
    schedule: ScheduleExpression.rate(cdk.Duration.hours(12)),
    target,
    targetOverrides: {
        input: ScheduleTargetInput.fromText("Overriding Target Input"),
        maxEventAge: Duration.seconds(180),
        retryAttempts: 5,
    },
});
```

Closes #27545.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mrgrain pushed a commit that referenced this issue Nov 1, 2023
Allows to override a `Schedule` target's properties.
Supported properties: `input`, `maxEventAge`, and `retryAttempts`.

Example:
```ts
declare const target: targets.LambdaInvoke;

const oneTimeSchedule = new Schedule(this, 'Schedule', {
    schedule: ScheduleExpression.rate(cdk.Duration.hours(12)),
    target,
    targetOverrides: {
        input: ScheduleTargetInput.fromText("Overriding Target Input"),
        maxEventAge: Duration.seconds(180),
        retryAttempts: 5,
    },
});
```

Closes #27545.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-scheduler Related to the AWS Scheduler service effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants