I have an existing API Gateway with resources and stages. I'm adding a new resource to it via aws cdk. The Gateway is configured with deploy:false, so I have to manually create a new deployment for it. I can import the gateway, but I can't find a similar method (fromLookup?) in the Stage class. I know I can create a new stage but it doesn't sound like a scalable solution.
The code is below:
const api = apigateway.RestApi.fromRestApiAttributes(this, 'RestApi', {
restApiId: 'XXX',
rootResourceId: 'YYYY',
});
const deployment = new apigateway.Deployment(this, 'APIGatewayDeployment', {
api,
});
// How to get an existing stage here instead of creating a new one?
const stage = new apigateway.Stage(this, 'test_stage', {
deployment,
stageName: 'dev',
});
api.deploymentStage = stage;