-
Notifications
You must be signed in to change notification settings - Fork 4k
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
chore(appconfig): refactor README and integ tests #29017
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is lovely! I like the new storyline. Just have a few things here and there
Environment monitors also support L1 CfnEnvironment.MonitorsProperty constructs. However, this is not the recommended approach | ||
for CloudWatch alarms because a role will not be auto-generated if not provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment monitors also support L1 CfnEnvironment.MonitorsProperty constructs. However, this is not the recommended approach | |
for CloudWatch alarms because a role will not be auto-generated if not provided. | |
Environment monitors also support L1 `CfnEnvironment.MonitorsProperty` constructs. However, this is not the recommended approach | |
for CloudWatch alarms because a role will not be auto-generated if not provided. |
I actually have a few issues with this section:
- the sentence should mention how, i.e. by using the
fromCfnMonitorsProperty
method. - however, I am not a fan of this approach at all. am I missing some context about why this method was added in the first place? CDK doesn't typically encourage this type of L1 method on L2 so I want to dig a bit deeper on why its necessary at all
- finally, looking at the code, it seems like the issue with
fromCfnMonitorsProperty
is that it will fail entirely if a role is not provided, likely in a confusing manner (because errors due to!
don't tend to be very descriptive). Looking at this code below:
public static fromCfnMonitorsProperty(monitorsProperty: CfnEnvironment.MonitorsProperty): Monitor {
return {
alarmArn: monitorsProperty.alarmArn!,
alarmRoleArn: monitorsProperty.alarmRoleArn,
monitorType: MonitorType.CFN_MONITORS_PROPERTY,
};
}
I think, if we have a reason to keep this method, it should be updated to (to avoid !
entirely):
public static fromCfnMonitorsProperty(monitorsProperty: CfnEnvironment.MonitorsProperty): Monitor {
if (monitorsProperty.alarmArn === undefined) { throw new Error('need this prop'); }
return {
alarmArn: monitorsProperty.alarmArn,
alarmRoleArn: monitorsProperty.alarmRoleArn,
monitorType: MonitorType.CFN_MONITORS_PROPERTY,
};
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated with suggested changes
Pull request has been modified.
@@ -348,8 +348,9 @@ export abstract class Monitor { | |||
* @param monitorsProperty The monitors property. | |||
*/ | |||
public static fromCfnMonitorsProperty(monitorsProperty: CfnEnvironment.MonitorsProperty): Monitor { | |||
if (monitorsProperty.alarmArn === undefined) { throw new Error('need this prop'); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry! we need a better error message than this. This was a placeholder :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Updated
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). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
### Reason for this change Making changes after API review. ### Description of changes Refactor README and integ tests. ### Description of how you validated changes ### Checklist - [ ] 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*
Reason for this change
Making changes after API review.
Description of changes
Refactor README and integ tests.
Description of how you validated changes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license