diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.assets.json index db2c8968290bb..872628ace4441 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.assets.json @@ -1,7 +1,7 @@ { "version": "36.0.0", "files": { - "c92b6489cd9a42747721409b6cf36d4fd60f282aec41408e311e49349c6c6149": { + "3bd472ac3fdbd7c291e3c4ef13df0429da6c1e0717dde5b304790b77637a72c3": { "source": { "path": "integtest-restapi-import-deployment-stage.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "c92b6489cd9a42747721409b6cf36d4fd60f282aec41408e311e49349c6c6149.json", + "objectKey": "3bd472ac3fdbd7c291e3c4ef13df0429da6c1e0717dde5b304790b77637a72c3.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.template.json index efbad12109245..8478cc7befcd1 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/integtest-restapi-import-deployment-stage.template.json @@ -6,30 +6,6 @@ "Name": "my-api" } }, - "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "Description": "Automatically created by the RestApi construct", - "RestApiId": { - "Ref": "myapi4C7BF186" - } - }, - "DependsOn": [ - "myapiGETF990CE3C" - ] - }, - "myapiDeploymentStagedevB1704B15": { - "Type": "AWS::ApiGateway::Stage", - "Properties": { - "DeploymentId": { - "Ref": "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a" - }, - "RestApiId": { - "Ref": "myapi4C7BF186" - }, - "StageName": "dev" - } - }, "myapiGETF990CE3C": { "Type": "AWS::ApiGateway::Method", "Properties": { @@ -49,46 +25,19 @@ } } }, - "MyDeployment74F2406B6f3141cef1e8fea8ab3b3b8bc90df36d": { + "MyManualDeployment92F2175C6f3141cef1e8fea8ab3b3b8bc90df36d": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": { "Ref": "myapi4C7BF186" - } + }, + "StageName": "myStage" }, "DependsOn": [ "myapiGETF990CE3C" ] } }, - "Outputs": { - "myapiEndpoint3628AFE3": { - "Value": { - "Fn::Join": [ - "", - [ - "https://", - { - "Ref": "myapi4C7BF186" - }, - ".execute-api.", - { - "Ref": "AWS::Region" - }, - ".", - { - "Ref": "AWS::URLSuffix" - }, - "/", - { - "Ref": "myapiDeploymentStagedevB1704B15" - }, - "/" - ] - ] - } - } - }, "Parameters": { "BootstrapVersion": { "Type": "AWS::SSM::Parameter::Value", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/manifest.json index 5606d4145ec7e..0a20a38e77133 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c92b6489cd9a42747721409b6cf36d4fd60f282aec41408e311e49349c6c6149.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3bd472ac3fdbd7c291e3c4ef13df0429da6c1e0717dde5b304790b77637a72c3.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -40,34 +40,16 @@ "data": "myapi4C7BF186" } ], - "/integtest-restapi-import-deployment-stage/my-api/Deployment/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a" - } - ], - "/integtest-restapi-import-deployment-stage/my-api/DeploymentStage.dev/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "myapiDeploymentStagedevB1704B15" - } - ], - "/integtest-restapi-import-deployment-stage/my-api/Endpoint": [ - { - "type": "aws:cdk:logicalId", - "data": "myapiEndpoint3628AFE3" - } - ], "/integtest-restapi-import-deployment-stage/my-api/Default/GET/Resource": [ { "type": "aws:cdk:logicalId", "data": "myapiGETF990CE3C" } ], - "/integtest-restapi-import-deployment-stage/MyDeployment/Resource": [ + "/integtest-restapi-import-deployment-stage/MyManualDeployment/Resource": [ { "type": "aws:cdk:logicalId", - "data": "MyDeployment74F2406B6f3141cef1e8fea8ab3b3b8bc90df36d" + "data": "MyManualDeployment92F2175C6f3141cef1e8fea8ab3b3b8bc90df36d" } ], "/integtest-restapi-import-deployment-stage/BootstrapVersion": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/tree.json index ae815a75f23eb..59fa3c93fb757 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.js.snapshot/tree.json @@ -26,71 +26,6 @@ "version": "0.0.0" } }, - "Deployment": { - "id": "Deployment", - "path": "integtest-restapi-import-deployment-stage/my-api/Deployment", - "children": { - "Resource": { - "id": "Resource", - "path": "integtest-restapi-import-deployment-stage/my-api/Deployment/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", - "aws:cdk:cloudformation:props": { - "description": "Automatically created by the RestApi construct", - "restApiId": { - "Ref": "myapi4C7BF186" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.CfnDeployment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.Deployment", - "version": "0.0.0" - } - }, - "DeploymentStage.dev": { - "id": "DeploymentStage.dev", - "path": "integtest-restapi-import-deployment-stage/my-api/DeploymentStage.dev", - "children": { - "Resource": { - "id": "Resource", - "path": "integtest-restapi-import-deployment-stage/my-api/DeploymentStage.dev/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", - "aws:cdk:cloudformation:props": { - "deploymentId": { - "Ref": "myapiDeployment92F2CB4972a890db5063ec679071ba7eefc76f2a" - }, - "restApiId": { - "Ref": "myapi4C7BF186" - }, - "stageName": "dev" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.CfnStage", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.Stage", - "version": "0.0.0" - } - }, - "Endpoint": { - "id": "Endpoint", - "path": "integtest-restapi-import-deployment-stage/my-api/Endpoint", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnOutput", - "version": "0.0.0" - } - }, "Default": { "id": "Default", "path": "integtest-restapi-import-deployment-stage/my-api/Default", @@ -144,19 +79,20 @@ "version": "0.0.0" } }, - "MyDeployment": { - "id": "MyDeployment", - "path": "integtest-restapi-import-deployment-stage/MyDeployment", + "MyManualDeployment": { + "id": "MyManualDeployment", + "path": "integtest-restapi-import-deployment-stage/MyManualDeployment", "children": { "Resource": { "id": "Resource", - "path": "integtest-restapi-import-deployment-stage/MyDeployment/Resource", + "path": "integtest-restapi-import-deployment-stage/MyManualDeployment/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", "aws:cdk:cloudformation:props": { "restApiId": { "Ref": "myapi4C7BF186" - } + }, + "stageName": "myStage" } }, "constructInfo": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.ts index 6902eb4f6bee7..94a819f1561bd 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.restapi.import-deploymentstage.ts @@ -6,16 +6,14 @@ const app = new cdk.App(); const stack = new cdk.Stack(app, 'integtest-restapi-import-deployment-stage'); const api = new apigateway.RestApi(stack, 'my-api', { - deployOptions: { - stageName: 'dev', - }, + deploy: false, }); api.root.addMethod('GET'); // Create a new deployment that uses existing stage -new apigateway.Deployment(stack, 'MyDeployment', { +new apigateway.Deployment(stack, 'MyManualDeployment', { api: api, - stageName: 'dev', + stageName: 'myStage', }); new integ.IntegTest(app, 'restapi-import-deployment-stage', { diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts b/packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts index 4451a878da496..42670161e340f 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/deployment.ts @@ -28,9 +28,9 @@ export interface DeploymentProps { readonly retainDeployments?: boolean; /** - * The stage of the API Gateway deployment. + * The name of the stage the API Gateway deployment deploys to. * - * @default - If `stageName` is not specified, a "prod" stage will be automatically created for the API Gateway deployment. + * @default - No stage name. */ readonly stageName?: string; }