From 3522b3a796c2bfe212d85c3fc6ad627a7836b8bd Mon Sep 17 00:00:00 2001 From: NetaNir Date: Thu, 15 Apr 2021 21:25:32 -0700 Subject: [PATCH 1/2] feat(apigatewayv2): introduce new interface for integration with sfn tasks and r53 targets --- .../lib/api-gatewayv2-domain-name.ts | 19 +++++++++++++++++-- .../@aws-cdk/aws-route53-targets/package.json | 3 +-- .../lib/apigateway/call-http-api.ts | 15 ++++++++++++--- .../aws-stepfunctions-tasks/package.json | 6 ++---- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts b/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts index b78078fca525a..c806f403f2417 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts +++ b/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts @@ -1,11 +1,10 @@ -import * as apigv2 from '@aws-cdk/aws-apigatewayv2'; import * as route53 from '@aws-cdk/aws-route53'; /** * Defines an API Gateway V2 domain name as the alias target. */ export class ApiGatewayv2Domain implements route53.IAliasRecordTarget { - constructor(private readonly domainName: apigv2.IDomainName) { } + constructor(private readonly domainName: ApiGateWayDomainName) { } public bind(_record: route53.IRecordSet): route53.AliasRecordTargetConfig { return { @@ -14,3 +13,19 @@ export class ApiGatewayv2Domain implements route53.IAliasRecordTarget { }; } } + +/** + * Represents an APIGatewayV2 DomainName + */ +export interface ApiGateWayDomainName { + /** + * The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint. + */ + readonly regionalHostedZoneId: string; + + /** + * The domain name associated with the regional endpoint for this custom domain name. + */ + readonly regionalDomainName: string; + +} diff --git a/packages/@aws-cdk/aws-route53-targets/package.json b/packages/@aws-cdk/aws-route53-targets/package.json index fcfda8916e586..2c68369fedd80 100644 --- a/packages/@aws-cdk/aws-route53-targets/package.json +++ b/packages/@aws-cdk/aws-route53-targets/package.json @@ -65,6 +65,7 @@ "devDependencies": { "@aws-cdk/assert": "0.0.0", "@aws-cdk/aws-certificatemanager": "0.0.0", + "@aws-cdk/aws-apigatewayv2": "0.0.0", "@aws-cdk/aws-lambda": "0.0.0", "cdk-build-tools": "0.0.0", "cdk-integ-tools": "0.0.0", @@ -74,7 +75,6 @@ }, "dependencies": { "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", "@aws-cdk/aws-cloudfront": "0.0.0", "@aws-cdk/aws-cognito": "0.0.0", "@aws-cdk/aws-ec2": "0.0.0", @@ -91,7 +91,6 @@ "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", "@aws-cdk/aws-cloudfront": "0.0.0", "@aws-cdk/aws-cognito": "0.0.0", "@aws-cdk/aws-ec2": "0.0.0", diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts index e06e46c2580b0..ebad2904e3e5b 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/apigateway/call-http-api.ts @@ -1,11 +1,20 @@ -import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2'; import * as iam from '@aws-cdk/aws-iam'; import * as sfn from '@aws-cdk/aws-stepfunctions'; import * as cdk from '@aws-cdk/core'; -import { Construct } from 'constructs'; +import { Construct, IConstruct } from 'constructs'; import { CallApiGatewayEndpointBase } from './base'; import { CallApiGatewayEndpointBaseProps } from './base-types'; +/** + * An APIGateWayV2 Http API resource representation + */ +export interface IApiGatewayV2HttpApi extends IConstruct { + /** + * The identifier of this API Gateway HTTP API. + */ + readonly apiId: string; +} + /** * Properties for calling an HTTP API Endpoint */ @@ -13,7 +22,7 @@ export interface CallApiGatewayHttpApiEndpointProps extends CallApiGatewayEndpoi /** * API to call */ - readonly api: apigatewayv2.IHttpApi; + readonly api: IApiGatewayV2HttpApi; /** * Name of the stage where the API is deployed to in API Gateway diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json index 4c9d09cf00d59..64fa3303a9c00 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json @@ -67,6 +67,8 @@ "@aws-cdk/assert": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", "@aws-cdk/aws-sns-subscriptions": "0.0.0", + "@aws-cdk/aws-apigatewayv2": "0.0.0", + "@aws-cdk/aws-apigatewayv2-integrations": "0.0.0", "cdk-build-tools": "0.0.0", "cdk-integ-tools": "0.0.0", "jest": "^26.6.3", @@ -74,8 +76,6 @@ }, "dependencies": { "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-apigatewayv2-integrations": "0.0.0", "@aws-cdk/aws-batch": "0.0.0", "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-codebuild": "0.0.0", @@ -100,8 +100,6 @@ "homepage": "https://github.com/aws/aws-cdk", "peerDependencies": { "@aws-cdk/aws-apigateway": "0.0.0", - "@aws-cdk/aws-apigatewayv2": "0.0.0", - "@aws-cdk/aws-apigatewayv2-integrations": "0.0.0", "@aws-cdk/aws-batch": "0.0.0", "@aws-cdk/aws-cloudwatch": "0.0.0", "@aws-cdk/aws-codebuild": "0.0.0", From c8e84ba9e88e83cdd47112ba796706224ff2ffac Mon Sep 17 00:00:00 2001 From: Neta Nir Date: Fri, 16 Apr 2021 12:52:04 -0700 Subject: [PATCH 2/2] Update packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts Co-authored-by: Niranjan Jayakar --- .../aws-route53-targets/lib/api-gatewayv2-domain-name.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts b/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts index c806f403f2417..bae896b7ed394 100644 --- a/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts +++ b/packages/@aws-cdk/aws-route53-targets/lib/api-gatewayv2-domain-name.ts @@ -17,7 +17,7 @@ export class ApiGatewayv2Domain implements route53.IAliasRecordTarget { /** * Represents an APIGatewayV2 DomainName */ -export interface ApiGateWayDomainName { +export interface ApiGatewayDomainName { /** * The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint. */