feat(apigatewayv2): expose disableExecuteApiEndpoint option in WebSocketApi configuration #35526
+92
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #35516
Closes #35516
Reason for this change
This change addresses a feature request to add the
disableExecuteApiEndpoint
property to the WebSocketApi construct. This property allows users to disable the default execute-api endpoint and enforce the use of a custom domain name. The underlyingCfnApi
construct already supports this property, and theHttpApi
construct in the same module already implements it, so this change provides consistency across API Gateway v2 constructs.Description of changes
I've made the following code changes to expose the disableExecuteApiEndpoint property in the WebSocketApi construct:
disableExecuteApiEndpoint?: boolean
property to the WebSocketApiProps interface.disableExecuteApiEndpoint?: boolean
property to the WebSocketApi class.disableExecuteApiEndpoint
property to the underlying CfnApi construct's properties.apiEndpoint
in the WebSocketApi class to be private._apiEndpoint
property that throws a ValidationError ifdisableExecuteApiEndpoint
is set to true. This prevents the use of a disabled endpoint.Describe any new or updated permissions being added
None
Description of how you validated changes
I validated these changes by adding two unit tests and one integration test. The unit tests confirm that the
disableExecuteApiEndpoint
property is correctly set on the CloudFormation template and that theapiEndpoint
getter throws an error as expected. The integration test successfully deploys a stack with the new property enabled. All tests pass.My steps to verify:
$ npx lerna run build --skip-nx-cache
.$ npx jest packages/aws-cdk-lib/aws-apigatewayv2/test/websocket/api.test.ts
.$ yarn integ test/aws-apigatewayv2-integrations/test/websocket/integ.disable-execute-api-endpoint.js --update-on-failed
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license