fix(scheduler): scheduleName returns undefined when imported from ARN#36400
Conversation
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
||||||||||||||
|
||||||||||||||
|
Exemption Request: This change only fixes ARN parsing logic in a static import method and does not interact with AWS APIs. Unit tests fully cover the parsing logic and error handling. |
| */ | ||
| public static fromScheduleArn(scope: Construct, id: string, scheduleArn: string): ISchedule { | ||
| // Format: arn:aws:scheduler:region:account:schedule/SCHEDULE-GROUP/SCHEDULE-NAME | ||
| const arnComponents = Arn.split(scheduleArn, ArnFormat.NO_RESOURCE_NAME); |
There was a problem hiding this comment.
No reason to change the ArnFormat for splitting. We can use it to parse the resource path directly.
| const arnComponents = Arn.split(scheduleArn, ArnFormat.NO_RESOURCE_NAME); | |
| const arnComponents = Arn.split(scheduleArn, ArnFormat.SLASH_RESOURCE_NAME); |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Pull request has been modified.
|
@Abogical |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status✅ The pull request has been merged at 128ed05 This pull request spent 6 seconds in the queue, with no time running CI. Required conditions to merge
|
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #36361.
Reason for this change
When importing a schedule using
Schedule.fromScheduleArn(), thescheduleNameproperty returnsundefinedinstead of the actual schedule name.Description of changes
Fixed the ARN parsing logic in
Schedule.fromScheduleArn()to correctly extract the schedule name from the resource path. AWS Scheduler ARNs have the formatarn:aws:scheduler:region:account:schedule/GROUP/NAME, and the previous implementation only captured the group name.Describe any new or updated permissions being added
No new or updated permissions.
Description of how you validated changes
Added unit tests to verify correct parsing and error handling.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license