Skip to content

Commit

Permalink
fix(scheduler): the value of the description property is not reflecte…
Browse files Browse the repository at this point in the history
…d to the resource. (#31276)

### Issue # (if applicable)

Closes #31269 .

### Reason for this change
The `description` property is not used in the `Schedule` class.
As a result, the value of the `description` property is not reflected to the resource.



### Description of changes
Modify to set the value of props to the `description` property.



### Description of how you validated changes
Add a unit test and an integ test.


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mazyu36 authored Sep 1, 2024
1 parent 6907f1e commit a3332b6
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export class Schedule extends Resource implements ISchedule {
},
startDate: props.start?.toISOString(),
endDate: props.end?.toISOString(),
description: props.description,
});

this.scheduleName = this.getResourceNameAttribute(resource.ref);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,37 @@
}
}
}
},
"UseDescription170B07AB": {
"Type": "AWS::Scheduler::Schedule",
"Properties": {
"Description": "test description",
"FlexibleTimeWindow": {
"Mode": "OFF"
},
"ScheduleExpression": "rate(12 hours)",
"ScheduleExpressionTimezone": "Etc/UTC",
"State": "ENABLED",
"Target": {
"Arn": {
"Fn::GetAtt": [
"Function76856677",
"Arn"
]
},
"Input": "\"Input Text\"",
"RetryPolicy": {
"MaximumEventAgeInSeconds": 180,
"MaximumRetryAttempts": 3
},
"RoleArn": {
"Fn::GetAtt": [
"Role1ABCC5F0",
"Arn"
]
}
}
}
}
},
"Parameters": {
Expand Down

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.

6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ new scheduler.Schedule(stack, 'ScheduleWithTimeFrame', {
end: new Date(`${currentYear + 2}-10-01T00:00:00.000Z`),
});

new scheduler.Schedule(stack, 'UseDescription', {
schedule: expression,
target: target,
description: 'test description',
});

new IntegTest(app, 'integtest-schedule', {
testCases: [stack],
});
Expand Down
14 changes: 14 additions & 0 deletions packages/@aws-cdk/aws-scheduler-alpha/test/schedule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,19 @@ describe('Schedule', () => {
});
}).toThrow('The provided duration must be between 1 minute and 1440 minutes, got 0');
});

test('schedule with description', () => {
// WHEN
new Schedule(stack, 'TestSchedule', {
schedule: expr,
target: new SomeLambdaTarget(func, role),
description: 'test description',
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Scheduler::Schedule', {
Description: 'test description',
});
});
});
});

0 comments on commit a3332b6

Please # to comment.