Skip to content

Commit

Permalink
chore(apigatewayv2): remove usage of deprecated httpApiId (#13419)
Browse files Browse the repository at this point in the history
remove usage of deprecated httpApiId

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
ayush987goyal authored Mar 5, 2021
1 parent fe1c839 commit 80b10f8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class LambdaProxyIntegration implements IHttpRouteIntegration {
principal: new ServicePrincipal('apigateway.amazonaws.com'),
sourceArn: Stack.of(route).formatArn({
service: 'execute-api',
resource: route.httpApi.httpApiId,
resource: route.httpApi.apiId,
resourceName: `*/*${route.path ?? ''}`, // empty string in the case of the catch-all route $default
}),
});
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/http/authorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class HttpAuthorizer extends Resource implements IHttpAuthorizer {

const resource = new CfnAuthorizer(this, 'Resource', {
name: props.authorizerName ?? id,
apiId: props.httpApi.httpApiId,
apiId: props.httpApi.apiId,
authorizerType: props.type,
identitySource: props.identitySource,
jwtConfiguration: undefinedIfNoKeys({
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/http/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class HttpIntegration extends Resource implements IHttpIntegration {
constructor(scope: Construct, id: string, props: HttpIntegrationProps) {
super(scope, id);
const integ = new CfnIntegration(this, 'Resource', {
apiId: props.httpApi.httpApiId,
apiId: props.httpApi.apiId,
integrationType: props.integrationType,
integrationUri: props.integrationUri,
integrationMethod: props.method,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class HttpRoute extends Resource implements IHttpRoute {
}

const routeProps: CfnRouteProps = {
apiId: props.httpApi.httpApiId,
apiId: props.httpApi.apiId,
routeKey: props.routeKey.key,
target: `integrations/${integration.integrationId}`,
authorizerId: authBindResult?.authorizerId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('HttpAuthorizer', () => {
});

expect(stack).toHaveResource('AWS::ApiGatewayV2::Authorizer', {
ApiId: stack.resolve(httpApi.httpApiId),
ApiId: stack.resolve(httpApi.apiId),
Name: 'HttpAuthorizer',
AuthorizerType: 'JWT',
IdentitySource: ['identitysource.1', 'identitysource.2'],
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-apigatewayv2/test/http/route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('HttpRoute', () => {
});

expect(stack).toHaveResource('AWS::ApiGatewayV2::Route', {
ApiId: stack.resolve(httpApi.httpApiId),
ApiId: stack.resolve(httpApi.apiId),
RouteKey: 'GET /books',
Target: {
'Fn::Join': [
Expand All @@ -33,7 +33,7 @@ describe('HttpRoute', () => {
});

expect(stack).toHaveResource('AWS::ApiGatewayV2::Integration', {
ApiId: stack.resolve(httpApi.httpApiId),
ApiId: stack.resolve(httpApi.apiId),
});
});

Expand All @@ -48,7 +48,7 @@ describe('HttpRoute', () => {
});

expect(stack).toHaveResource('AWS::ApiGatewayV2::Integration', {
ApiId: stack.resolve(httpApi.httpApiId),
ApiId: stack.resolve(httpApi.apiId),
IntegrationType: 'HTTP_PROXY',
PayloadFormatVersion: '2.0',
IntegrationUri: 'some-uri',
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('HttpRoute', () => {
});

expect(stack).toHaveResource('AWS::ApiGatewayV2::Integration', {
ApiId: stack.resolve(httpApi.httpApiId),
ApiId: stack.resolve(httpApi.apiId),
IntegrationType: 'HTTP_PROXY',
PayloadFormatVersion: '2.0',
IntegrationUri: 'some-uri',
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigatewayv2/test/http/stage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('HttpStage', () => {
});

expect(stack).toHaveResource('AWS::ApiGatewayV2::Stage', {
ApiId: stack.resolve(api.httpApiId),
ApiId: stack.resolve(api.apiId),
StageName: '$default',
});
});
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('HttpStage', () => {
});
const metricName = '4xxError';
const statistic = 'Sum';
const apiId = api.httpApiId;
const apiId = api.apiId;

// WHEN
const countMetric = stage.metric(metricName, { statistic });
Expand All @@ -94,7 +94,7 @@ describe('HttpStage', () => {
httpApi: api,
});
const color = '#00ff00';
const apiId = api.httpApiId;
const apiId = api.apiId;

// WHEN
const metrics = new Array<Metric>();
Expand Down

0 comments on commit 80b10f8

Please sign in to comment.