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

feat(ec2): well-known port aliases #29793

Merged
merged 4 commits into from
Apr 12, 2024

Conversation

nmussy
Copy link
Contributor

@nmussy nmussy commented Apr 11, 2024

Issue # (if applicable)

None as far as I can tell

Reason for this change

The web console lists commonly used ports when adding a rule to a security group, this aims to reproduce this simple quality of life shortcut. It can also help with code readability, and might save people from a typo

Description of changes

Description of how you validated changes

Compared the AWS web console values to the IANA list, and added a unit test to make sure the alias behaved properly

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 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Apr 11, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team April 11, 2024 04:16
/** Well-known Microsoft Remote Desktop Protocol port (TCP 3389) */
public static readonly RDP = Port.tcp(3389);
/** Well-known PostgreSQL port (TCP 5432) */
public static readonly POSTGRES = Port.tcp(5432);
Copy link
Contributor Author

@nmussy nmussy Apr 11, 2024

Choose a reason for hiding this comment

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

Let me know if you would like to add more, but I think we should stick to the officially IANA assigned port, even if the AWS web console lists additional ones

Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@nmussy
Copy link
Contributor Author

nmussy commented Apr 11, 2024

Exemption Request: These are only aliases of existing methods, a new integration is not necessary

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Apr 11, 2024
@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 Apr 11, 2024
@@ -188,6 +188,41 @@ export interface PortProps {
* Interface for classes that provide the connection-specification parts of a security group rule
*/
export class Port {
/** Well-known SSH port (TCP 22) */
Copy link
Contributor

Choose a reason for hiding this comment

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

only a nit: do we need "Well-known" in all these? Cleaner to just have SSH port (TCP 22) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the explicit mention that this is not an arbitrary port and protocol assignment. It's not really needed but I don't feel like it's unwarranted. We could also mention that it comes from the IANA, either replacing or complementing the "well-known"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would have added these at the top of the class/enum JSDoc if they weren't declared alongside the rest of the Port class, but I don't think separating them is worth avoiding the repetition

Copy link
Contributor

@msambol msambol left a comment

Choose a reason for hiding this comment

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

Super helpful. Nice job 👍🏼

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Apr 12, 2024
@godwingrs22 godwingrs22 self-requested a review April 12, 2024 21:42
Copy link
Member

@godwingrs22 godwingrs22 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 great and helpful. Thanks @nmussy for your contribution and @msambol for the review.

@godwingrs22 godwingrs22 added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Apr 12, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 12, 2024 22:06

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Apr 12, 2024
Copy link
Contributor

mergify bot commented Apr 12, 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: 4cae18c
  • 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 f10494c into aws:main Apr 12, 2024
10 checks passed
Copy link
Contributor

mergify bot commented Apr 12, 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

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants