From 540561c1179deef282088a204016dffdbbbb1ba9 Mon Sep 17 00:00:00 2001 From: sakurai-ryo Date: Fri, 8 Dec 2023 22:36:57 +0900 Subject: [PATCH] feat(scheduler): fix build --- packages/@aws-cdk/aws-scheduler-alpha/README.md | 6 +++--- packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts | 8 ++++---- .../@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts | 2 +- .../@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/@aws-cdk/aws-scheduler-alpha/README.md b/packages/@aws-cdk/aws-scheduler-alpha/README.md index 4b0cfc6917f7f..feb6785372e01 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/README.md +++ b/packages/@aws-cdk/aws-scheduler-alpha/README.md @@ -227,10 +227,10 @@ const schedule = new Schedule(this, 'Schedule', { > Visit [Data protection in Amazon EventBridge Scheduler](https://docs.aws.amazon.com/scheduler/latest/UserGuide/data-protection.html) for more details. -## Configuring flexible time window +## Configuring flexible time windows You can configure flexible time windows by specifying the `flexibleTimeWindow` property. -By default, the mode of `flexibleTimeWindow` is set to `OFF` and this feature is disabled. +Flexible time windows is disabled by default. ```ts declare const target: targets.LambdaInvoke; @@ -238,7 +238,7 @@ declare const target: targets.LambdaInvoke; const schedule = new Schedule(this, 'Schedule', { schedule: ScheduleExpression.rate(Duration.hours(12)), target, - flexibleTimeWindow: FlexibleTimeWindowMode.Flexible(Duration.hours(10)), + flexibleTimeWindow: FlexibleTimeWindowMode.flexible(Duration.hours(10)), }); ``` diff --git a/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts b/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts index d514038a81564..a07ec73ab710a 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts @@ -66,14 +66,14 @@ export class FlexibleTimeWindowMode { /** * FlexibleTimeWindow is disabled. */ - public static Off(): FlexibleTimeWindowMode { + public static off(): FlexibleTimeWindowMode { return new FlexibleTimeWindowMode('OFF'); } /** * FlexibleTimeWindow is enabled. */ - public static Flexible(maximumWindowInMinutes: Duration): FlexibleTimeWindowMode { + public static flexible(maximumWindowInMinutes: Duration): FlexibleTimeWindowMode { if (maximumWindowInMinutes.toMinutes() < 1 || maximumWindowInMinutes.toMinutes() > 1440) { throw new Error(`maximumWindowInMinutes must be between 1 and 1440, got ${maximumWindowInMinutes.toMinutes()}`); } @@ -162,7 +162,7 @@ export interface ScheduleProps { * * @see https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-schedule-flexible-time-windows.html * - * @default FlexibleTimeWindowMode.Off() + * @default FlexibleTimeWindowMode.off() */ readonly flexibleTimeWindow?: FlexibleTimeWindowMode; } @@ -305,7 +305,7 @@ export class Schedule extends Resource implements ISchedule { this.retryPolicy = targetConfig.retryPolicy; - const flexibleTimeWindow = props.flexibleTimeWindow ?? FlexibleTimeWindowMode.Off(); + const flexibleTimeWindow = props.flexibleTimeWindow ?? FlexibleTimeWindowMode.off(); const resource = new CfnSchedule(this, 'Resource', { name: this.physicalName, diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts index 6d3ce3cc1df04..6dc0a69001e86 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts @@ -93,7 +93,7 @@ new scheduler.Schedule(stack, 'CustomerKmsSchedule', { new scheduler.Schedule(stack, 'UseFlexibleTimeWindow', { schedule: expression, target: target, - flexibleTimeWindow: scheduler.FlexibleTimeWindowMode.Flexible(cdk.Duration.minutes(10)), + flexibleTimeWindow: scheduler.FlexibleTimeWindowMode.flexible(cdk.Duration.minutes(10)), }); new IntegTest(app, 'integtest-schedule', { diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts b/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts index eb281917365ad..f286f80875030 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts @@ -150,7 +150,7 @@ describe('Schedule', () => { new Schedule(stack, 'TestSchedule', { schedule: expr, target: new SomeLambdaTarget(func, role), - flexibleTimeWindow: FlexibleTimeWindowMode.Flexible(Duration.minutes(1440)), + flexibleTimeWindow: FlexibleTimeWindowMode.flexible(Duration.minutes(1440)), }); // THEN @@ -167,7 +167,7 @@ describe('Schedule', () => { new Schedule(stack, 'TestSchedule', { schedule: expr, target: new SomeLambdaTarget(func, role), - flexibleTimeWindow: FlexibleTimeWindowMode.Flexible(Duration.minutes(1441)), + flexibleTimeWindow: FlexibleTimeWindowMode.flexible(Duration.minutes(1441)), }); }).toThrow('maximumWindowInMinutes must be between 1 and 1440, got 1441'); }); @@ -177,7 +177,7 @@ describe('Schedule', () => { new Schedule(stack, 'TestSchedule', { schedule: expr, target: new SomeLambdaTarget(func, role), - flexibleTimeWindow: FlexibleTimeWindowMode.Flexible(Duration.minutes(0)), + flexibleTimeWindow: FlexibleTimeWindowMode.flexible(Duration.minutes(0)), }); }).toThrow('maximumWindowInMinutes must be between 1 and 1440, got 0'); });