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(apigateway): expose endpointconfiguration to include vpcEndpointIds #6078

Merged
merged 14 commits into from
Feb 19, 2020

Conversation

bulka777
Copy link
Contributor

@bulka777 bulka777 commented Feb 3, 2020

fixes #6038 by exposing endpointConfiguration to include vpcEndpointIds


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

fixes aws#6038
BREAKING CHANGE: the interface now accepts endpointconfiguration property instead of endpoint type as defined by cfn
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@bulka777
Copy link
Contributor Author

bulka777 commented Feb 4, 2020

It looks like the AWS CodeBuild is throwing an error around this:

@aws-cdk/aws-apigateway... CHANGES.
Original assembly: @aws-cdk/aws-apigateway@1.22.0
Updated assembly:  @aws-cdk/aws-apigateway@1.22.0
API elements with incompatible changes:
err  - PROP @aws-cdk/aws-apigateway.LambdaRestApiProps.endpointTypes: has been removed [removed:@aws-cdk/aws-apigateway.LambdaRestApiProps.endpointTypes]
err  - PROP @aws-cdk/aws-apigateway.RestApiProps.endpointTypes: has been removed [removed:@aws-cdk/aws-apigateway.RestApiProps.endpointTypes]

If that's correct, then I must be missing something? I expected there to be breaking changes with this. Any recommendations on how to proceed to resolve this?

@nija-at
Copy link
Contributor

nija-at commented Feb 5, 2020

apigateway is a stable module. By contract, breaking changes are not allowed in this package.

The closest you can do is mark methods and properties as @deprecated and add new ones. The changes must stay backwards compatible.

nija-at
nija-at previously requested changes Feb 5, 2020
Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Please add entries into the README describing your changes and code snippets.

Fix the PR title so it correctly describes the new feature being added. I would suggest "support private vpc endpoints"

@mergify mergify bot dismissed nija-at’s stale review February 5, 2020 18:03

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@bulka777
Copy link
Contributor Author

bulka777 commented Feb 7, 2020

Your suggestions have been implemented. Ready for review!

Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

It's mostly there. A few comments and suggestions below to polish it up -

Comment on lines 445 to 446
const vpcEndpointIds = (props.endpointConfiguration.vpcEndpoints) ?
props.endpointConfiguration.vpcEndpoints.map(vpcEndpoint => vpcEndpoint.vpcEndpointId) : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would optional chaining simplify this?

Suggested change
const vpcEndpointIds = (props.endpointConfiguration.vpcEndpoints) ?
props.endpointConfiguration.vpcEndpoints.map(vpcEndpoint => vpcEndpoint.vpcEndpointId) : undefined;
const vpcEndpointIds = props.endpointConfiguration.vpcEndpoints?.map(vpce => vpce.vpcEndpointId);

Comment on lines 596 to 613
You can also create an association between your Rest Api and a Vpc Endpoint. By doing so,
Api Gateway will generate a new Route53 Alias DNS record which you can use to invoke your private
APIs. Here is an example:

```ts
const someEndpoint: IVpcEndpoint = /* Get or Create endpoint here */
const api = new apigw.RestApi(stack, 'api', {
endpointConfiguration: {
types: [ apigw.EndpointType.PRIVATE ],
vpcEndpoints: [someEndpoint]
}
});
```

By performing this association, we can invoke the api gateway using the following format:
```
https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage}
```
Copy link
Contributor

Choose a reason for hiding this comment

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

How hard is it to add an integration test that sets up a simple VPC endpoint and associates it to the Rest API, such that it is invokable by running curl against https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage}?

This would be useful as described here as well as to link off from the documentation as a working example.

Copy link
Contributor Author

@bulka777 bulka777 Feb 10, 2020

Choose a reason for hiding this comment

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

Thanks for the feedback. No problem at all. I can go ahead and add the integration test, but you are not suggesting to add an automated way to curl right? Just create the integration test and add Stack verification steps: so that it could be tested manually?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the late reply. Yes, that's correct, Manual verification is fine.

@mergify mergify bot dismissed nija-at’s stale review February 10, 2020 17:24

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

proposed changes

Co-Authored-By: Niranjan Jayakar <16217941+nija-at@users.noreply.github.com>
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Copy link
Contributor

@nija-at nija-at left a comment

Choose a reason for hiding this comment

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

Could you add the suggested integration test please?

@mergify mergify bot dismissed nija-at’s stale review February 18, 2020 23:08

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 1bf0509
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 92de69b
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: f809617
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@bulka777
Copy link
Contributor Author

@nija-at Thanks for reviewing. I added the integration test - I think it's ready for another go.

@mergify
Copy link
Contributor

mergify bot commented Feb 19, 2020

Thank you for contributing! Your pull request is now being automatically merged.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 4f91e24
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Feb 19, 2020

Thank you for contributing! Your pull request is now being automatically merged.

@mergify mergify bot merged commit 99de6ca into aws:master Feb 19, 2020
@bulka777 bulka777 deleted the bulka777/add_vpcEndpointIds branch February 19, 2020 21:39
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.

Add vpcEndpointIds as an option on RestApi
3 participants