in src/patterns/scheduled-lambda.ts [44:62]
constructor(scope: GuStack, id: string, props: GuScheduledLambdaProps) {
const lambdaProps: GuFunctionProps = {
...props,
errorPercentageMonitoring: props.monitoringConfiguration.noMonitoring ? undefined : props.monitoringConfiguration,
};
super(scope, id, lambdaProps);
props.rules.forEach((rule, index) => {
// If we have an alias, use this to ensure that all invocations are handled by a published Lambda version.
// Otherwise, use the latest unpublished version ($LATEST)
const resourceToInvoke = this.alias ?? this;
new Rule(this, `${id}-${rule.schedule.expressionString}-${index}`, {
schedule: rule.schedule,
targets: [new LambdaFunction(resourceToInvoke, { event: rule.input })],
...(rule.description && { description: rule.description }),
enabled: true,
});
});
}