Skip to content

Commit 15df3c7

Browse files
Elad Ben-Israelmergify[bot]
authored andcommitted
feat(apigateway): support imported roles for integrations (#3369)
* feat(apigateway): support imported roles for intgrations Change type of `IntegrationOptions.credentialsRole` to `IRole` to enable using an imported role. Fixes #2860 * make `Integration.props` internal Since this is read only by `Method`. This is technically a breaking change, but props is not part of the expected API.
1 parent 3a96c27 commit 15df3c7

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

allowed-breaking-changes.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ incompatible-argument:@aws-cdk/aws-ecs.TaskDefinition.addVolume
77
change-return-type:@aws-cdk/core.Fn.getAtt
88
new-argument:@aws-cdk/aws-iam.ManagedPolicy.<initializer>
99
new-argument:@aws-cdk/aws-iam.ManagedPolicy.<initializer>
10+
removed:@aws-cdk/aws-apigateway.AwsIntegration.props
11+
removed:@aws-cdk/aws-apigateway.HttpIntegration.props
12+
removed:@aws-cdk/aws-apigateway.Integration.props
13+
removed:@aws-cdk/aws-apigateway.LambdaIntegration.props
14+
removed:@aws-cdk/aws-apigateway.MockIntegration.props

packages/@aws-cdk/aws-apigateway/lib/integration.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface IntegrationOptions {
3131
*
3232
* @default A role is not assumed
3333
*/
34-
readonly credentialsRole?: iam.Role;
34+
readonly credentialsRole?: iam.IRole;
3535

3636
/**
3737
* Requires that the caller's identity be passed through from the request.
@@ -139,7 +139,16 @@ export interface IntegrationProps {
139139
* or implement on your own by specifying the set of props.
140140
*/
141141
export class Integration {
142-
constructor(readonly props: IntegrationProps) { }
142+
constructor(private readonly props: IntegrationProps) { }
143+
144+
/**
145+
* Allows `Method` to access the integration props.
146+
*
147+
* @internal
148+
*/
149+
public get _props() {
150+
return this.props;
151+
}
143152

144153
/**
145154
* Can be overridden by subclasses to allow the integration to interact with the method

packages/@aws-cdk/aws-apigateway/lib/method.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export class Method extends Resource {
188188

189189
integration.bind(this);
190190

191-
const options = integration.props.options || { };
191+
const options = integration._props.options || { };
192192

193193
let credentials;
194194
if (options.credentialsPassthrough !== undefined && options.credentialsRole !== undefined) {
@@ -212,12 +212,12 @@ export class Method extends Resource {
212212
}
213213

214214
return {
215-
type: integration.props.type,
216-
uri: integration.props.uri,
215+
type: integration._props.type,
216+
uri: integration._props.uri,
217217
cacheKeyParameters: options.cacheKeyParameters,
218218
cacheNamespace: options.cacheNamespace,
219219
contentHandling: options.contentHandling,
220-
integrationHttpMethod: integration.props.integrationHttpMethod,
220+
integrationHttpMethod: integration._props.integrationHttpMethod,
221221
requestParameters: options.requestParameters,
222222
requestTemplates: options.requestTemplates,
223223
passthroughBehavior: options.passthroughBehavior,

0 commit comments

Comments
 (0)