Skip to content
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

Merged
merged 5 commits into from
Feb 9, 2024

Conversation

chenjane-dev
Copy link
Contributor

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

@github-actions github-actions bot added p2 admired-contributor [Pilot] contributed between 13-24 PRs to the CDK labels Feb 7, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team February 7, 2024 17:13
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 7, 2024
Copy link
Contributor

@kaizencc kaizencc left a 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

packages/@aws-cdk/aws-appconfig-alpha/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appconfig-alpha/README.md Outdated Show resolved Hide resolved
Comment on lines 94 to 95
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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,
    };
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated with suggested changes

packages/@aws-cdk/aws-appconfig-alpha/README.md Outdated Show resolved Hide resolved
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 8, 2024
@mergify mergify bot dismissed kaizencc’s stale review February 8, 2024 16:33

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 8, 2024
@@ -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'); }
Copy link
Contributor

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Updated

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 9, 2024
Copy link
Contributor

mergify bot commented Feb 9, 2024

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 339bf7c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 6333eb4 into aws:main Feb 9, 2024
9 checks passed
Copy link
Contributor

mergify bot commented Feb 9, 2024

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).

@chenjane-dev chenjane-dev deleted the review-feedback branch February 9, 2024 20:47
TheRealAmazonKendra pushed a commit that referenced this pull request Feb 9, 2024
### 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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants