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): add vpn metrics #1979

Merged
merged 3 commits into from
Mar 12, 2019
Merged

feat(ec2): add vpn metrics #1979

merged 3 commits into from
Mar 12, 2019

Conversation

jogold
Copy link
Contributor

@jogold jogold commented Mar 8, 2019

Add VPN metrics (TunnelState, TunnelDataIn, TunnelDataOut) across all tunnels
and per connection by adding a new augmentation.

Adapt AugmentationGenerator to convert resource name to Kebab case class file
and to support options to specify class file, class and interface when these cannot
be directly derived from the CloudFormation resource name: no base class or
resource name not really Pascal case (e.g. VPNConnection).


Pull Request Checklist

  • Testing
    • Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change)
    • CLI change?: coordinate update of integration tests with team
    • cdk-init template change?: coordinated update of integration tests with team
  • Docs
    • jsdocs: All public APIs documented
    • README: README and/or documentation topic updated
  • Title and Description
    • Change type: title prefixed with fix, feat will appear in changelog
    • Title: use lower-case and doesn't end with a period
    • Breaking?: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>"
    • Issues: Indicate issues fixed via: "Fixes #xxx" or "Closes #xxx"
  • Sensitive Modules (requires 2 PR approvers)
    • IAM Policy Document (in @aws-cdk/aws-iam)
    • EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2)
    • Grant APIs (only if not based on official documentation with a reference)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

@jogold jogold requested a review from a team as a code owner March 8, 2019 18:14
Add VPN metrics (TunnelState, TunnelDataIn, TunnelDataOut) across all tunnels
and per connection by adding a new augmentation.

Adapt AugmentationGenerator to convert resource name to Kebab case module
name and to support name overrides for class, interface and module when these
cannot be directly derived from the CloudFormation resource name: no base
class or resource name not really Pascal case (e.g. VPNConnection).
@@ -341,3 +341,5 @@ vpc.addVpnConnection('Dynamic', {
```

Routes will be propagated on the route tables associated with the private subnets.

VPN connections expose metric across all tunnels and per connection.
Copy link
Contributor

Choose a reason for hiding this comment

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

example/snippet on how to use?

@@ -98,6 +99,44 @@ export enum VpnConnectionType {
}

export class VpnConnection extends cdk.Construct implements IVpnConnection {
/**
* Return the given named metric for all VPN connections.
Copy link
Contributor

Choose a reason for hiding this comment

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

"all VPC connections in the account/region"

@@ -0,0 +1,27 @@
{
"overrides": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't call these "overrides". We should think about them simply as configuration of the augmentation system that has some default values, so you don't have to supply them but you can, and I would avoid attaching any heuristics to them (i.e. "Base" suffix).

So, maybe:

{
  "baseClass": "VpnConnectionBase",
  "baseClassFile": "vpn",
  "interface": "IVpnConnection"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will rename these. The current implementation doesn't attach anything to these overrides.

Copy link
Contributor

Choose a reason for hiding this comment

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

It does:

  • baseClass is the resource name + "Base" suffix
  • baseClassFile is the l2-base
  • interface is I + resource name

Copy link
Contributor Author

@jogold jogold Mar 11, 2019

Choose a reason for hiding this comment

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

Not sure I'm following here.

const baseClassName = (overrides && overrides.class) || l2ClassName + 'Base';
const interfaceName = (overrides && overrides.interface) || 'I' + l2ClassName;
const baseClassModule = `./${(overrides && overrides.module) || `${kebabL2ClassName}-base`}`;

From above, if there's an override it's taken as is, no?

Regarding the names in the JSON file:

  • baseClass or class? for the VpnConnection it's not a base class because there's no VpnConnectionBase in this case
  • ...file or ...module?

Copy link
Contributor

@eladb eladb Mar 11, 2019

Choose a reason for hiding this comment

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

Oh, yes, you are right. I guess class makes sense (and the doc should say that by default it uses the "Base" class). I would go with file and not module because we mostly (in our project) "module" is interchangeable with "package" (or "npm module").

overrides?: ResourceOverrides;
}

export interface ResourceOverrides {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to AugmentationOptions and line up with the schema above, specify the @defaults

@eladb eladb merged commit 9319e13 into aws:master Mar 12, 2019
@jogold jogold deleted the vpn-metrics branch March 12, 2019 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants