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

fix(apigateway): SpecRestApi ignores disableExecuteApiEndpoint property #21296

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ export class SpecRestApi extends RestApiBase {
bodyS3Location: apiDefConfig.inlineDefinition ? undefined : apiDefConfig.s3Location,
endpointConfiguration: this._configureEndpoints(props),
parameters: props.parameters,
disableExecuteApiEndpoint: props.disableExecuteApiEndpoint,
});

props.apiDefinition.bindAfterCreate(this, this);
Expand Down
17 changes: 17 additions & 0 deletions packages/@aws-cdk/aws-apigateway/test/restapi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1096,4 +1096,21 @@ describe('restapi', () => {
DisableExecuteApiEndpoint: true,
});
});

test('"disableExecuteApiEndpoint" can disable the default execute-api endpoint for SpecRestApi', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's also make sure that this properly sets this as false when it's false and that it's set as false when the property isn't set.

// GIVEN
const stack = new Stack();

// WHEN
const api = new apigw.SpecRestApi(stack, 'my-api', {
apiDefinition: apigw.ApiDefinition.fromInline({ foo: 'bar' }),
disableExecuteApiEndpoint: true,
});
api.root.addMethod('GET');

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::RestApi', {
DisableExecuteApiEndpoint: true,
});
});
});