Skip to content

Commit 183e507

Browse files
authored
Merge branch 'master' into njlynch/edge-func-account
2 parents 2ed57a8 + 62195fe commit 183e507

File tree

10 files changed

+44
-23
lines changed

10 files changed

+44
-23
lines changed

packages/@aws-cdk/aws-apigateway/lib/access-log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ export class AccessLogField {
411411
* not from the backend Lambda function.
412412
*/
413413
public static contextIntegrationStatus() {
414-
return '$context.integrationStatus.';
414+
return '$context.integrationStatus';
415415
}
416416

417417
/**

packages/@aws-cdk/aws-apigatewayv2-authorizers/test/http/integ.user-pool.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@
7272
[
7373
"integrations/",
7474
{
75-
"Ref": "MyHttpApiHttpIntegration6f095b8469365f72e33fa33d9711b140C45F3B26"
75+
"Ref": "MyHttpApiGETHttpIntegration6f095b8469365f72e33fa33d9711b140516EBE31"
7676
}
7777
]
7878
]
7979
}
8080
}
8181
},
82-
"MyHttpApiHttpIntegration6f095b8469365f72e33fa33d9711b140C45F3B26": {
82+
"MyHttpApiGETHttpIntegration6f095b8469365f72e33fa33d9711b140516EBE31": {
8383
"Type": "AWS::ApiGatewayV2::Integration",
8484
"Properties": {
8585
"ApiId": {

packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.alb.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@
622622
[
623623
"integrations/",
624624
{
625-
"Ref": "HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0"
625+
"Ref": "HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B"
626626
}
627627
]
628628
]
@@ -647,7 +647,7 @@
647647
"SecurityGroupIds": []
648648
}
649649
},
650-
"HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0": {
650+
"HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B": {
651651
"Type": "AWS::ApiGatewayV2::Integration",
652652
"Properties": {
653653
"ApiId": {

packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.http-proxy.expected.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@
108108
[
109109
"integrations/",
110110
{
111-
"Ref": "LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4"
111+
"Ref": "LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA"
112112
}
113113
]
114114
]
115115
}
116116
}
117117
},
118-
"LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4": {
118+
"LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA": {
119119
"Type": "AWS::ApiGatewayV2::Integration",
120120
"Properties": {
121121
"ApiId": {
@@ -162,14 +162,14 @@
162162
[
163163
"integrations/",
164164
{
165-
"Ref": "HttpProxyApiHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a4F32A389A"
165+
"Ref": "HttpProxyApiDefaultRouteHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a41921AB82"
166166
}
167167
]
168168
]
169169
}
170170
}
171171
},
172-
"HttpProxyApiHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a4F32A389A": {
172+
"HttpProxyApiDefaultRouteHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a41921AB82": {
173173
"Type": "AWS::ApiGatewayV2::Integration",
174174
"Properties": {
175175
"ApiId": {

packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.lambda-proxy.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@
108108
[
109109
"integrations/",
110110
{
111-
"Ref": "LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4"
111+
"Ref": "LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA"
112112
}
113113
]
114114
]
115115
}
116116
}
117117
},
118-
"LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4": {
118+
"LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA": {
119119
"Type": "AWS::ApiGatewayV2::Integration",
120120
"Properties": {
121121
"ApiId": {

packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.nlb.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@
587587
[
588588
"integrations/",
589589
{
590-
"Ref": "HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0"
590+
"Ref": "HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B"
591591
}
592592
]
593593
]
@@ -612,7 +612,7 @@
612612
"SecurityGroupIds": []
613613
}
614614
},
615-
"HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0": {
615+
"HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B": {
616616
"Type": "AWS::ApiGatewayV2::Integration",
617617
"Properties": {
618618
"ApiId": {

packages/@aws-cdk/aws-apigatewayv2-integrations/test/http/integ.service-discovery.expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,14 +588,14 @@
588588
[
589589
"integrations/",
590590
{
591-
"Ref": "HttpProxyPrivateApiHttpIntegrationa5ec5390ca688d567e9449daf58afc6fB75CE02B"
591+
"Ref": "HttpProxyPrivateApiDefaultRouteHttpIntegrationa5ec5390ca688d567e9449daf58afc6f6DEAA8A8"
592592
}
593593
]
594594
]
595595
}
596596
}
597597
},
598-
"HttpProxyPrivateApiHttpIntegrationa5ec5390ca688d567e9449daf58afc6fB75CE02B": {
598+
"HttpProxyPrivateApiDefaultRouteHttpIntegrationa5ec5390ca688d567e9449daf58afc6f6DEAA8A8": {
599599
"Type": "AWS::ApiGatewayV2::Integration",
600600
"Properties": {
601601
"ApiId": {

packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface IHttpApi extends IResource {
9292
* Add a http integration
9393
* @internal
9494
*/
95-
_addIntegration(config: HttpRouteIntegrationConfig): HttpIntegration;
95+
_addIntegration(scope: Construct, config: HttpRouteIntegrationConfig): HttpIntegration;
9696
}
9797

9898
/**
@@ -274,15 +274,15 @@ abstract class HttpApiBase extends Resource implements IHttpApi { // note that t
274274
/**
275275
* @internal
276276
*/
277-
public _addIntegration(config: HttpRouteIntegrationConfig): HttpIntegration {
278-
const stringifiedConfig = JSON.stringify(Stack.of(this).resolve(config));
277+
public _addIntegration(scope: Construct, config: HttpRouteIntegrationConfig): HttpIntegration {
278+
const stringifiedConfig = JSON.stringify(Stack.of(scope).resolve(config));
279279
const configHash = crypto.createHash('md5').update(stringifiedConfig).digest('hex');
280280

281281
if (configHash in this.httpIntegrations) {
282282
return this.httpIntegrations[configHash];
283283
}
284284

285-
const integration = new HttpIntegration(this, `HttpIntegration-${configHash}`, {
285+
const integration = new HttpIntegration(scope, `HttpIntegration-${configHash}`, {
286286
httpApi: this,
287287
integrationType: config.type,
288288
integrationUri: config.uri,

packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class HttpRoute extends Resource implements IHttpRoute {
140140
scope: this,
141141
});
142142

143-
const integration = props.httpApi._addIntegration(config);
143+
const integration = props.httpApi._addIntegration(this, config);
144144

145145
const authBindResult = props.authorizer ? props.authorizer.bind({
146146
route: this,

packages/@aws-cdk/aws-apigatewayv2/test/http/route.test.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@aws-cdk/assert/jest';
2-
import { Stack } from '@aws-cdk/core';
2+
import { Stack, App } from '@aws-cdk/core';
33
import {
44
HttpApi, HttpAuthorizer, HttpAuthorizerType, HttpConnectionType, HttpIntegrationType, HttpMethod, HttpRoute, HttpRouteAuthorizerBindOptions,
55
HttpRouteAuthorizerConfig, HttpRouteIntegrationConfig, HttpRouteKey, IHttpRouteAuthorizer, IHttpRouteIntegration, PayloadFormatVersion,
@@ -25,7 +25,7 @@ describe('HttpRoute', () => {
2525
[
2626
'integrations/',
2727
{
28-
Ref: 'HttpApiHttpIntegrationcff2618c192d3bd8581dd2a4093464f6CDB667B8',
28+
Ref: 'HttpRouteHttpIntegrationcff2618c192d3bd8581dd2a4093464f6FB1097D0',
2929
},
3030
],
3131
],
@@ -115,6 +115,27 @@ describe('HttpRoute', () => {
115115
expect(stack2).toCountResources('AWS::ApiGatewayV2::Integration', 1);
116116
});
117117

118+
test('route defined in a separate stack does not create cycles', () => {
119+
// GIVEN
120+
const integration = new DummyIntegration();
121+
122+
// WHEN
123+
const app = new App();
124+
const stack1 = new Stack(app, 'ApiStack');
125+
const httpApi = new HttpApi(stack1, 'HttpApi');
126+
127+
const stack2 = new Stack(app, 'RouteStack');
128+
new HttpRoute(stack2, 'HttpRoute1', {
129+
httpApi,
130+
integration,
131+
routeKey: HttpRouteKey.with('/books', HttpMethod.GET),
132+
});
133+
134+
// THEN
135+
expect(stack1).toCountResources('AWS::ApiGatewayV2::Integration', 0);
136+
expect(stack2).toCountResources('AWS::ApiGatewayV2::Integration', 1);
137+
});
138+
118139
test('throws when path not start with /', () => {
119140
const stack = new Stack();
120141
const httpApi = new HttpApi(stack, 'HttpApi');
@@ -253,4 +274,4 @@ class DummyAuthorizer implements IHttpRouteAuthorizer {
253274
authorizationType: HttpAuthorizerType.JWT,
254275
};
255276
}
256-
}
277+
}

0 commit comments

Comments
 (0)