@aws-cdk/aws-apigateway
Version:
The CDK Construct Library for AWS::ApiGateway
1 lines • 1.44 MB
JSON
{"version":"2","toolVersion":"1.84.0","snippets":{"4fd0399b4fd7c1099faf9e898ec1684c3175c16096b3531a6d5d7eb804e583e7":{"translations":{"python":{"source":"api = apigateway.RestApi(self, \"books-api\")\n\napi.root.add_method(\"ANY\")\n\nbooks = api.root.add_resource(\"books\")\nbooks.add_method(\"GET\")\nbooks.add_method(\"POST\")\n\nbook = books.add_resource(\"{book_id}\")\nbook.add_method(\"GET\")\nbook.add_method(\"DELETE\")","version":"2"},"csharp":{"source":"var api = new RestApi(this, \"books-api\");\n\napi.Root.AddMethod(\"ANY\");\n\nvar books = api.Root.AddResource(\"books\");\nbooks.AddMethod(\"GET\");\nbooks.AddMethod(\"POST\");\n\nvar book = books.AddResource(\"{book_id}\");\nbook.AddMethod(\"GET\");\nbook.AddMethod(\"DELETE\");","version":"1"},"java":{"source":"RestApi api = new RestApi(this, \"books-api\");\n\napi.root.addMethod(\"ANY\");\n\nResource books = api.root.addResource(\"books\");\nbooks.addMethod(\"GET\");\nbooks.addMethod(\"POST\");\n\nResource book = books.addResource(\"{book_id}\");\nbook.addMethod(\"GET\");\nbook.addMethod(\"DELETE\");","version":"1"},"go":{"source":"api := apigateway.NewRestApi(this, jsii.String(\"books-api\"))\n\napi.Root.AddMethod(jsii.String(\"ANY\"))\n\nbooks := api.Root.AddResource(jsii.String(\"books\"))\nbooks.AddMethod(jsii.String(\"GET\"))\nbooks.AddMethod(jsii.String(\"POST\"))\n\nbook := books.AddResource(jsii.String(\"{book_id}\"))\nbook.AddMethod(jsii.String(\"GET\"))\nbook.AddMethod(jsii.String(\"DELETE\"))","version":"1"},"$":{"source":"const api = new apigateway.RestApi(this, 'books-api');\n\napi.root.addMethod('ANY');\n\nconst books = api.root.addResource('books');\nbooks.addMethod('GET');\nbooks.addMethod('POST');\n\nconst book = books.addResource('{book_id}');\nbook.addMethod('GET');\nbook.addMethod('DELETE');","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@aws-cdk/aws-apigateway"},"field":{"field":"markdown","line":64}},"didCompile":true,"fqnsReferenced":["@aws-cdk/aws-apigateway.IResource#addMethod","@aws-cdk/aws-apigateway.IResource#addResource","@aws-cdk/aws-apigateway.Resource","@aws-cdk/aws-apigateway.ResourceBase#addMethod","@aws-cdk/aws-apigateway.ResourceBase#addResource","@aws-cdk/aws-apigateway.RestApi","@aws-cdk/aws-apigateway.RestApi#root","constructs.Construct"],"fullSource":"// Fixture with packages imported, but nothing else\nimport { Construct } from 'constructs';\nimport { Stack } from '@aws-cdk/core';\nimport apigateway = require('@aws-cdk/aws-apigateway');\nimport cognito = require('@aws-cdk/aws-cognito');\nimport lambda = require('@aws-cdk/aws-lambda');\nimport iam = require('@aws-cdk/aws-iam');\nimport s3 = require('@aws-cdk/aws-s3');\nimport ec2 = require('@aws-cdk/aws-ec2');\nimport logs = require('@aws-cdk/aws-logs');\nimport stepfunctions = require('@aws-cdk/aws-stepfunctions');\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nconst api = new apigateway.RestApi(this, 'books-api');\n\napi.root.addMethod('ANY');\n\nconst books = api.root.addResource('books');\nbooks.addMethod('GET');\nbooks.addMethod('POST');\n\nconst book = books.addResource('{book_id}');\nbook.addMethod('GET');\nbook.addMethod('DELETE');\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"10":8,"75":21,"104":1,"194":10,"196":7,"197":1,"225":3,"226":5,"242":3,"243":3},"fqnsFingerprint":"ba245893404071bcbe70f40121f6d8f2908e477c7dbccf7651b1c6a66e88f4c9"},"2eaba6a5e320a4862b6b0f9a08c4279904e44543ef0012f501a75271a1892897":{"translations":{"python":{"source":"# backend: lambda.Function\n\napigateway.LambdaRestApi(self, \"myapi\",\n handler=backend\n)","version":"2"},"csharp":{"source":"Function backend;\n\nnew LambdaRestApi(this, \"myapi\", new LambdaRestApiProps {\n Handler = backend\n});","version":"1"},"java":{"source":"Function backend;\n\nLambdaRestApi.Builder.create(this, \"myapi\")\n .handler(backend)\n .build();","version":"1"},"go":{"source":"var backend function\n\napigateway.NewLambdaRestApi(this, jsii.String(\"myapi\"), &LambdaRestApiProps{\n\tHandler: backend,\n})","version":"1"},"$":{"source":"declare const backend: lambda.Function;\nnew apigateway.LambdaRestApi(this, 'myapi', {\n handler: backend,\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@aws-cdk/aws-apigateway"},"field":{"field":"markdown","line":86}},"didCompile":true,"fqnsReferenced":["@aws-cdk/aws-apigateway.LambdaRestApi","@aws-cdk/aws-apigateway.LambdaRestApiProps","@aws-cdk/aws-lambda.IFunction","constructs.Construct"],"fullSource":"// Hoisted imports begin after !show marker below\n/// !show\ndeclare const backend: lambda.Function;\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture with packages imported, but nothing else\nimport { Construct } from 'constructs';\nimport { Stack } from '@aws-cdk/core';\nimport apigateway = require('@aws-cdk/aws-apigateway');\nimport cognito = require('@aws-cdk/aws-cognito');\nimport lambda = require('@aws-cdk/aws-lambda');\nimport iam = require('@aws-cdk/aws-iam');\nimport s3 = require('@aws-cdk/aws-s3');\nimport ec2 = require('@aws-cdk/aws-ec2');\nimport logs = require('@aws-cdk/aws-logs');\nimport stepfunctions = require('@aws-cdk/aws-stepfunctions');\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n\nnew apigateway.LambdaRestApi(this, 'myapi', {\n handler: backend,\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"10":1,"75":7,"104":1,"130":1,"153":1,"169":1,"193":1,"194":1,"197":1,"225":1,"226":1,"242":1,"243":1,"281":1,"290":1},"fqnsFingerprint":"3e27e46d5a122c4bd7d6fe02ff0e7df9aa00f40fe460c2b84e902fbb6ab75ed8"},"a30531d2bf118939ef7f53aa2d06e758bb6e20f346109b41e761c617da8b7fbd":{"translations":{"python":{"source":"# backend: lambda.Function\n\napi = apigateway.LambdaRestApi(self, \"myapi\",\n handler=backend,\n proxy=False\n)\n\nitems = api.root.add_resource(\"items\")\nitems.add_method(\"GET\") # GET /items\nitems.add_method(\"POST\") # POST /items\n\nitem = items.add_resource(\"{item}\")\nitem.add_method(\"GET\") # GET /items/{item}\n\n# the default integration for methods is \"handler\", but one can\n# customize this behavior per method or even a sub path.\nitem.add_method(\"DELETE\", apigateway.HttpIntegration(\"http://amazon.com\"))","version":"2"},"csharp":{"source":"Function backend;\n\nvar api = new LambdaRestApi(this, \"myapi\", new LambdaRestApiProps {\n Handler = backend,\n Proxy = false\n});\n\nvar items = api.Root.AddResource(\"items\");\nitems.AddMethod(\"GET\"); // GET /items\nitems.AddMethod(\"POST\"); // POST /items\n\nvar item = items.AddResource(\"{item}\");\nitem.AddMethod(\"GET\"); // GET /items/{item}\n\n// the default integration for methods is \"handler\", but one can\n// customize this behavior per method or even a sub path.\nitem.AddMethod(\"DELETE\", new HttpIntegration(\"http://amazon.com\"));","version":"1"},"java":{"source":"Function backend;\n\nLambdaRestApi api = LambdaRestApi.Builder.create(this, \"myapi\")\n .handler(backend)\n .proxy(false)\n .build();\n\nResource items = api.root.addResource(\"items\");\nitems.addMethod(\"GET\"); // GET /items\nitems.addMethod(\"POST\"); // POST /items\n\nResource item = items.addResource(\"{item}\");\nitem.addMethod(\"GET\"); // GET /items/{item}\n\n// the default integration for methods is \"handler\", but one can\n// customize this behavior per method or even a sub path.\nitem.addMethod(\"DELETE\", new HttpIntegration(\"http://amazon.com\"));","version":"1"},"go":{"source":"var backend function\n\napi := apigateway.NewLambdaRestApi(this, jsii.String(\"myapi\"), &LambdaRestApiProps{\n\tHandler: backend,\n\tProxy: jsii.Boolean(false),\n})\n\nitems := api.Root.AddResource(jsii.String(\"items\"))\nitems.AddMethod(jsii.String(\"GET\")) // GET /items\nitems.AddMethod(jsii.String(\"POST\")) // POST /items\n\nitem := items.AddResource(jsii.String(\"{item}\"))\nitem.AddMethod(jsii.String(\"GET\")) // GET /items/{item}\n\n// the default integration for methods is \"handler\", but one can\n// customize this behavior per method or even a sub path.\nitem.AddMethod(jsii.String(\"DELETE\"), apigateway.NewHttpIntegration(jsii.String(\"http://amazon.com\")))","version":"1"},"$":{"source":"declare const backend: lambda.Function;\nconst api = new apigateway.LambdaRestApi(this, 'myapi', {\n handler: backend,\n proxy: false\n});\n\nconst items = api.root.addResource('items');\nitems.addMethod('GET'); // GET /items\nitems.addMethod('POST'); // POST /items\n\nconst item = items.addResource('{item}');\nitem.addMethod('GET'); // GET /items/{item}\n\n// the default integration for methods is \"handler\", but one can\n// customize this behavior per method or even a sub path.\nitem.addMethod('DELETE', new apigateway.HttpIntegration('http://amazon.com'));","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@aws-cdk/aws-apigateway"},"field":{"field":"markdown","line":96}},"didCompile":true,"fqnsReferenced":["@aws-cdk/aws-apigateway.HttpIntegration","@aws-cdk/aws-apigateway.IResource#addResource","@aws-cdk/aws-apigateway.Integration","@aws-cdk/aws-apigateway.LambdaRestApi","@aws-cdk/aws-apigateway.LambdaRestApiProps","@aws-cdk/aws-apigateway.Resource","@aws-cdk/aws-apigateway.ResourceBase#addMethod","@aws-cdk/aws-apigateway.ResourceBase#addResource","@aws-cdk/aws-apigateway.RestApi#root","@aws-cdk/aws-lambda.IFunction","constructs.Construct"],"fullSource":"// Hoisted imports begin after !show marker below\n/// !show\ndeclare const backend: lambda.Function;\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture with packages imported, but nothing else\nimport { Construct } from 'constructs';\nimport { Stack } from '@aws-cdk/core';\nimport apigateway = require('@aws-cdk/aws-apigateway');\nimport cognito = require('@aws-cdk/aws-cognito');\nimport lambda = require('@aws-cdk/aws-lambda');\nimport iam = require('@aws-cdk/aws-iam');\nimport s3 = require('@aws-cdk/aws-s3');\nimport ec2 = require('@aws-cdk/aws-ec2');\nimport logs = require('@aws-cdk/aws-logs');\nimport stepfunctions = require('@aws-cdk/aws-stepfunctions');\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n\nconst api = new apigateway.LambdaRestApi(this, 'myapi', {\n handler: backend,\n proxy: false\n});\n\nconst items = api.root.addResource('items');\nitems.addMethod('GET'); // GET /items\nitems.addMethod('POST'); // POST /items\n\nconst item = items.addResource('{item}');\nitem.addMethod('GET'); // GET /items/{item}\n\n// the default integration for methods is \"handler\", but one can\n// customize this behavior per method or even a sub path.\nitem.addMethod('DELETE', new apigateway.HttpIntegration('http://amazon.com'));\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"10":8,"75":26,"91":1,"104":1,"130":1,"153":1,"169":1,"193":1,"194":9,"196":6,"197":2,"225":4,"226":4,"242":4,"243":4,"281":2,"290":1},"fqnsFingerprint":"1572ad9057c4e93fa763116070b3d2b930b613b2fb0275bdcad2854df4f1a049"},"d819d3b744072040d45e398edfd8f8b6c298adda9d8e9bce08ea2721f0f63117":{"translations":{"python":{"source":"state_machine_definition = stepfunctions.Pass(self, \"PassState\")\n\nstate_machine = stepfunctions.StateMachine(self, \"StateMachine\",\n definition=state_machine_definition,\n state_machine_type=stepfunctions.StateMachineType.EXPRESS\n)\n\napigateway.StepFunctionsRestApi(self, \"StepFunctionsRestApi\",\n deploy=True,\n state_machine=state_machine\n)","version":"2"},"csharp":{"source":"var stateMachineDefinition = new Pass(this, \"PassState\");\n\nvar stateMachine = new StateMachine(this, \"StateMachine\", new StateMachineProps {\n Definition = stateMachineDefinition,\n StateMachineType = StateMachineType.EXPRESS\n});\n\nnew StepFunctionsRestApi(this, \"StepFunctionsRestApi\", new StepFunctionsRestApiProps {\n Deploy = true,\n StateMachine = stateMachine\n});","version":"1"},"java":{"source":"Pass stateMachineDefinition = new Pass(this, \"PassState\");\n\nIStateMachine stateMachine = StateMachine.Builder.create(this, \"StateMachine\")\n .definition(stateMachineDefinition)\n .stateMachineType(StateMachineType.EXPRESS)\n .build();\n\nStepFunctionsRestApi.Builder.create(this, \"StepFunctionsRestApi\")\n .deploy(true)\n .stateMachine(stateMachine)\n .build();","version":"1"},"go":{"source":"stateMachineDefinition := stepfunctions.NewPass(this, jsii.String(\"PassState\"))\n\nstateMachine := stepfunctions.NewStateMachine(this, jsii.String(\"StateMachine\"), &StateMachineProps{\n\tDefinition: stateMachineDefinition,\n\tStateMachineType: stepfunctions.StateMachineType_EXPRESS,\n})\n\napigateway.NewStepFunctionsRestApi(this, jsii.String(\"StepFunctionsRestApi\"), &StepFunctionsRestApiProps{\n\tDeploy: jsii.Boolean(true),\n\tStateMachine: stateMachine,\n})","version":"1"},"$":{"source":"const stateMachineDefinition = new stepfunctions.Pass(this, 'PassState');\n\nconst stateMachine: stepfunctions.IStateMachine = new stepfunctions.StateMachine(this, 'StateMachine', {\n definition: stateMachineDefinition,\n stateMachineType: stepfunctions.StateMachineType.EXPRESS,\n});\n\nnew apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', {\n deploy: true,\n stateMachine: stateMachine,\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@aws-cdk/aws-apigateway"},"field":{"field":"markdown","line":140}},"didCompile":true,"fqnsReferenced":["@aws-cdk/aws-apigateway.StepFunctionsRestApi","@aws-cdk/aws-apigateway.StepFunctionsRestApiProps","@aws-cdk/aws-stepfunctions.IChainable","@aws-cdk/aws-stepfunctions.IStateMachine","@aws-cdk/aws-stepfunctions.Pass","@aws-cdk/aws-stepfunctions.StateMachine","@aws-cdk/aws-stepfunctions.StateMachineProps","@aws-cdk/aws-stepfunctions.StateMachineType","@aws-cdk/aws-stepfunctions.StateMachineType#EXPRESS","constructs.Construct"],"fullSource":"// Fixture with packages imported, but nothing else\nimport { Construct } from 'constructs';\nimport { Stack } from '@aws-cdk/core';\nimport apigateway = require('@aws-cdk/aws-apigateway');\nimport cognito = require('@aws-cdk/aws-cognito');\nimport lambda = require('@aws-cdk/aws-lambda');\nimport iam = require('@aws-cdk/aws-iam');\nimport s3 = require('@aws-cdk/aws-s3');\nimport ec2 = require('@aws-cdk/aws-ec2');\nimport logs = require('@aws-cdk/aws-logs');\nimport stepfunctions = require('@aws-cdk/aws-stepfunctions');\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nconst stateMachineDefinition = new stepfunctions.Pass(this, 'PassState');\n\nconst stateMachine: stepfunctions.IStateMachine = new stepfunctions.StateMachine(this, 'StateMachine', {\n definition: stateMachineDefinition,\n stateMachineType: stepfunctions.StateMachineType.EXPRESS,\n});\n\nnew apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', {\n deploy: true,\n stateMachine: stateMachine,\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"10":3,"75":19,"104":3,"106":1,"153":1,"169":1,"193":2,"194":5,"197":3,"225":2,"226":1,"242":2,"243":2,"281":4},"fqnsFingerprint":"ee5c8f5600946c6b561ea2869e1e3b205d70e8931131fc3fbee3a1fcb494fdfa"},"d631b1d0803a4eba2fdb11e61e7d2695d87052353c0ecd83aefbf946ef79ccf2":{"translations":{"python":{"source":"apigateway.StepFunctionsRestApi(self, \"StepFunctionsRestApi\",\n state_machine=machine,\n headers=True,\n path=False,\n querystring=False,\n authorizer=False,\n request_context=apigateway.RequestContext(\n caller=True,\n user=True\n )\n)","version":"2"},"csharp":{"source":"new StepFunctionsRestApi(this, \"StepFunctionsRestApi\", new StepFunctionsRestApiProps {\n StateMachine = machine,\n Headers = true,\n Path = false,\n Querystring = false,\n Authorizer = false,\n RequestContext = new RequestContext {\n Caller = true,\n User = true\n }\n});","version":"1"},"java":{"source":"StepFunctionsRestApi.Builder.create(this, \"StepFunctionsRestApi\")\n .stateMachine(machine)\n .headers(true)\n .path(false)\n .querystring(false)\n .authorizer(false)\n .requestContext(RequestContext.builder()\n .caller(true)\n .user(true)\n .build())\n .build();","version":"1"},"go":{"source":"apigateway.NewStepFunctionsRestApi(this, jsii.String(\"StepFunctionsRestApi\"), &StepFunctionsRestApiProps{\n\tStateMachine: machine,\n\tHeaders: jsii.Boolean(true),\n\tPath: jsii.Boolean(false),\n\tQuerystring: jsii.Boolean(false),\n\tAuthorizer: jsii.Boolean(false),\n\tRequestContext: &RequestContext{\n\t\tCaller: jsii.Boolean(true),\n\t\tUser: jsii.Boolean(true),\n\t},\n})","version":"1"},"$":{"source":"new apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', {\n stateMachine: machine,\n headers: true,\n path: false,\n querystring: false,\n authorizer: false,\n requestContext: {\n caller: true,\n user: true,\n },\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@aws-cdk/aws-apigateway"},"field":{"field":"markdown","line":195}},"didCompile":true,"fqnsReferenced":["@aws-cdk/aws-apigateway.RequestContext","@aws-cdk/aws-apigateway.StepFunctionsRestApi","@aws-cdk/aws-apigateway.StepFunctionsRestApiProps","@aws-cdk/aws-stepfunctions.IChainable","@aws-cdk/aws-stepfunctions.IStateMachine","@aws-cdk/aws-stepfunctions.StateMachineType","constructs.Construct"],"fullSource":"import { Construct } from 'constructs';\nimport { Stack } from '@aws-cdk/core';\nimport apigateway = require('@aws-cdk/aws-apigateway');\nimport stepfunctions = require('@aws-cdk/aws-stepfunctions');\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n const machine: stepfunctions.IStateMachine = new stepfunctions.StateMachine(this, 'StateMachine', {\n definition: new stepfunctions.Pass(this, 'PassState'),\n stateMachineType: stepfunctions.StateMachineType.EXPRESS,\n });\n\n // Code snippet begins after !show marker below\n/// !show\nnew apigateway.StepFunctionsRestApi(this, 'StepFunctionsRestApi', {\n stateMachine: machine,\n headers: true,\n path: false,\n querystring: false,\n authorizer: false,\n requestContext: {\n caller: true,\n user: true,\n },\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"10":1,"75":11,"91":3,"104":1,"106":3,"193":2,"194":1,"197":1,"226":1,"281":8},"fqnsFingerprint":"410f8fe83f7b51d26bad3c9599e15736e577ef2cdc75d207bc9053dc6a904101"},"70474cb3b94cee59d0d164f73644b0532c9db664a84020bf93b212f5ee48fdc8":{"translations":{"python":{"source":"from aws_cdk.aws_apigateway import IntegrationResponse, MethodResponse, IntegrationResponse, MethodResponse\nfrom aws_cdk.core import App, CfnOutput, NestedStack, NestedStackProps, Stack\nfrom constructs import Construct\nfrom aws_cdk.aws_apigateway import Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage\n\n#\n# This file showcases how to split up a RestApi's Resources and Methods across nested stacks.\n#\n# The root stack 'RootStack' first defines a RestApi.\n# Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.\n# They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.\n#\n# To verify this worked, go to the APIGateway\n#\n\nclass RootStack(Stack):\n def __init__(self, scope):\n super().__init__(scope, \"integ-restapi-import-RootStack\")\n\n rest_api = RestApi(self, \"RestApi\",\n deploy=False\n )\n rest_api.root.add_method(\"ANY\")\n\n pets_stack = PetsStack(self,\n rest_api_id=rest_api.rest_api_id,\n root_resource_id=rest_api.rest_api_root_resource_id\n )\n books_stack = BooksStack(self,\n rest_api_id=rest_api.rest_api_id,\n root_resource_id=rest_api.rest_api_root_resource_id\n )\n DeployStack(self,\n rest_api_id=rest_api.rest_api_id,\n methods=pets_stack.methods.concat(books_stack.methods)\n )\n\n CfnOutput(self, \"PetsURL\",\n value=f\"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/pets\"\n )\n\n CfnOutput(self, \"BooksURL\",\n value=f\"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/books\"\n )\n\nclass PetsStack(NestedStack):\n\n def __init__(self, scope, *, restApiId, rootResourceId, parameters=None, timeout=None, notificationArns=None, removalPolicy=None):\n super().__init__(scope, \"integ-restapi-import-PetsStack\", restApiId=restApiId, rootResourceId=rootResourceId, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy)\n\n api = RestApi.from_rest_api_attributes(self, \"RestApi\",\n rest_api_id=rest_api_id,\n root_resource_id=root_resource_id\n )\n\n method = api.root.add_resource(\"pets\").add_method(\"GET\", MockIntegration(\n integration_responses=[IntegrationResponse(\n status_code=\"200\"\n )],\n passthrough_behavior=PassthroughBehavior.NEVER,\n request_templates={\n \"application/json\": \"{ \\\"statusCode\\\": 200 }\"\n }\n ),\n method_responses=[MethodResponse(status_code=\"200\")]\n )\n\n self.methods.push(method)\n\nclass BooksStack(NestedStack):\n\n def __init__(self, scope, *, restApiId, rootResourceId, parameters=None, timeout=None, notificationArns=None, removalPolicy=None):\n super().__init__(scope, \"integ-restapi-import-BooksStack\", restApiId=restApiId, rootResourceId=rootResourceId, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy)\n\n api = RestApi.from_rest_api_attributes(self, \"RestApi\",\n rest_api_id=rest_api_id,\n root_resource_id=root_resource_id\n )\n\n method = api.root.add_resource(\"books\").add_method(\"GET\", MockIntegration(\n integration_responses=[IntegrationResponse(\n status_code=\"200\"\n )],\n passthrough_behavior=PassthroughBehavior.NEVER,\n request_templates={\n \"application/json\": \"{ \\\"statusCode\\\": 200 }\"\n }\n ),\n method_responses=[MethodResponse(status_code=\"200\")]\n )\n\n self.methods.push(method)\n\nclass DeployStack(NestedStack):\n def __init__(self, scope, *, restApiId, methods=None, parameters=None, timeout=None, notificationArns=None, removalPolicy=None):\n super().__init__(scope, \"integ-restapi-import-DeployStack\", restApiId=restApiId, methods=methods, parameters=parameters, timeout=timeout, notificationArns=notificationArns, removalPolicy=removalPolicy)\n\n deployment = Deployment(self, \"Deployment\",\n api=RestApi.from_rest_api_id(self, \"RestApi\", rest_api_id)\n )\n if methods:\n for method in methods:\n deployment.node.add_dependency(method)\n Stage(self, \"Stage\", deployment=deployment)\n\nRootStack(App())","version":"2"},"csharp":{"source":"using Amazon.CDK;\nusing Constructs;\nusing Amazon.CDK.AWS.APIGateway;\n\n/**\n * This file showcases how to split up a RestApi's Resources and Methods across nested stacks.\n *\n * The root stack 'RootStack' first defines a RestApi.\n * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.\n * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.\n *\n * To verify this worked, go to the APIGateway\n */\n\nclass RootStack : Stack\n{\n public RootStack(Construct scope) : base(scope, \"integ-restapi-import-RootStack\")\n {\n\n var restApi = new RestApi(this, \"RestApi\", new RestApiProps {\n Deploy = false\n });\n restApi.Root.AddMethod(\"ANY\");\n\n var petsStack = new PetsStack(this, new ResourceNestedStackProps {\n RestApiId = restApi.RestApiId,\n RootResourceId = restApi.RestApiRootResourceId\n });\n var booksStack = new BooksStack(this, new ResourceNestedStackProps {\n RestApiId = restApi.RestApiId,\n RootResourceId = restApi.RestApiRootResourceId\n });\n new DeployStack(this, new DeployStackProps {\n RestApiId = restApi.RestApiId,\n Methods = petsStack.Methods.Concat(booksStack.Methods)\n });\n\n new CfnOutput(this, \"PetsURL\", new CfnOutputProps {\n Value = $\"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/pets\"\n });\n\n new CfnOutput(this, \"BooksURL\", new CfnOutputProps {\n Value = $\"https://{restApi.restApiId}.execute-api.{this.region}.amazonaws.com/prod/books\"\n });\n }\n}\n\nclass ResourceNestedStackProps : NestedStackProps\n{\n public string RestApiId { get; set; }\n\n public string RootResourceId { get; set; }\n}\n\nclass PetsStack : NestedStack\n{\n public readonly Method[] Methods = new [] { };\n\n public PetsStack(Construct scope, ResourceNestedStackProps props) : base(scope, \"integ-restapi-import-PetsStack\", props)\n {\n\n var api = RestApi.FromRestApiAttributes(this, \"RestApi\", new RestApiAttributes {\n RestApiId = props.RestApiId,\n RootResourceId = props.RootResourceId\n });\n\n var method = api.Root.AddResource(\"pets\").AddMethod(\"GET\", new MockIntegration(new IntegrationOptions {\n IntegrationResponses = new [] { new IntegrationResponse {\n StatusCode = \"200\"\n } },\n PassthroughBehavior = PassthroughBehavior.NEVER,\n RequestTemplates = new Dictionary<string, string> {\n { \"application/json\", \"{ \\\"statusCode\\\": 200 }\" }\n }\n }), new MethodOptions {\n MethodResponses = new [] { new MethodResponse { StatusCode = \"200\" } }\n });\n\n Methods.Push(method);\n }\n}\n\nclass BooksStack : NestedStack\n{\n public readonly Method[] Methods = new [] { };\n\n public BooksStack(Construct scope, ResourceNestedStackProps props) : base(scope, \"integ-restapi-import-BooksStack\", props)\n {\n\n var api = RestApi.FromRestApiAttributes(this, \"RestApi\", new RestApiAttributes {\n RestApiId = props.RestApiId,\n RootResourceId = props.RootResourceId\n });\n\n var method = api.Root.AddResource(\"books\").AddMethod(\"GET\", new MockIntegration(new IntegrationOptions {\n IntegrationResponses = new [] { new IntegrationResponse {\n StatusCode = \"200\"\n } },\n PassthroughBehavior = PassthroughBehavior.NEVER,\n RequestTemplates = new Dictionary<string, string> {\n { \"application/json\", \"{ \\\"statusCode\\\": 200 }\" }\n }\n }), new MethodOptions {\n MethodResponses = new [] { new MethodResponse { StatusCode = \"200\" } }\n });\n\n Methods.Push(method);\n }\n}\n\nclass DeployStackProps : NestedStackProps\n{\n public string RestApiId { get; set; }\n\n public Method[]? Methods { get; set; }\n}\n\nclass DeployStack : NestedStack\n{\n public DeployStack(Construct scope, DeployStackProps props) : base(scope, \"integ-restapi-import-DeployStack\", props)\n {\n\n var deployment = new Deployment(this, \"Deployment\", new DeploymentProps {\n Api = RestApi.FromRestApiId(this, \"RestApi\", props.RestApiId)\n });\n if (props.Methods)\n {\n for (var method in props.Methods)\n {\n deployment.Node.AddDependency(method);\n }\n }\n new Stage(this, \"Stage\", new StageProps { Deployment = deployment });\n }\n}\n\nnew RootStack(new App());","version":"1"},"java":{"source":"import software.amazon.awscdk.core.App;\nimport software.amazon.awscdk.core.CfnOutput;\nimport software.amazon.awscdk.core.NestedStack;\nimport software.amazon.awscdk.core.NestedStackProps;\nimport software.amazon.awscdk.core.Stack;\nimport software.constructs.Construct;\nimport software.amazon.awscdk.services.apigateway.Deployment;\nimport software.amazon.awscdk.services.apigateway.Method;\nimport software.amazon.awscdk.services.apigateway.MockIntegration;\nimport software.amazon.awscdk.services.apigateway.PassthroughBehavior;\nimport software.amazon.awscdk.services.apigateway.RestApi;\nimport software.amazon.awscdk.services.apigateway.Stage;\n\n/**\n * This file showcases how to split up a RestApi's Resources and Methods across nested stacks.\n *\n * The root stack 'RootStack' first defines a RestApi.\n * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.\n * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.\n *\n * To verify this worked, go to the APIGateway\n */\n\npublic class RootStack extends Stack {\n public RootStack(Construct scope) {\n super(scope, \"integ-restapi-import-RootStack\");\n\n RestApi restApi = RestApi.Builder.create(this, \"RestApi\")\n .deploy(false)\n .build();\n restApi.root.addMethod(\"ANY\");\n\n PetsStack petsStack = new PetsStack(this, new ResourceNestedStackProps()\n .restApiId(restApi.getRestApiId())\n .rootResourceId(restApi.getRestApiRootResourceId())\n );\n BooksStack booksStack = new BooksStack(this, new ResourceNestedStackProps()\n .restApiId(restApi.getRestApiId())\n .rootResourceId(restApi.getRestApiRootResourceId())\n );\n new DeployStack(this, new DeployStackProps()\n .restApiId(restApi.getRestApiId())\n .methods(petsStack.methods.concat(booksStack.getMethods()))\n );\n\n CfnOutput.Builder.create(this, \"PetsURL\")\n .value(String.format(\"https://%s.execute-api.%s.amazonaws.com/prod/pets\", restApi.getRestApiId(), this.region))\n .build();\n\n CfnOutput.Builder.create(this, \"BooksURL\")\n .value(String.format(\"https://%s.execute-api.%s.amazonaws.com/prod/books\", restApi.getRestApiId(), this.region))\n .build();\n }\n}\n\npublic class ResourceNestedStackProps extends NestedStackProps {\n private String restApiId;\n public String getRestApiId() {\n return this.restApiId;\n }\n public ResourceNestedStackProps restApiId(String restApiId) {\n this.restApiId = restApiId;\n return this;\n }\n\n private String rootResourceId;\n public String getRootResourceId() {\n return this.rootResourceId;\n }\n public ResourceNestedStackProps rootResourceId(String rootResourceId) {\n this.rootResourceId = rootResourceId;\n return this;\n }\n}\n\npublic class PetsStack extends NestedStack {\n public final Method[] methods;\n\n public PetsStack(Construct scope, ResourceNestedStackProps props) {\n super(scope, \"integ-restapi-import-PetsStack\", props);\n\n IRestApi api = RestApi.fromRestApiAttributes(this, \"RestApi\", RestApiAttributes.builder()\n .restApiId(props.getRestApiId())\n .rootResourceId(props.getRootResourceId())\n .build());\n\n Method method = api.root.addResource(\"pets\").addMethod(\"GET\", MockIntegration.Builder.create()\n .integrationResponses(List.of(IntegrationResponse.builder()\n .statusCode(\"200\")\n .build()))\n .passthroughBehavior(PassthroughBehavior.NEVER)\n .requestTemplates(Map.of(\n \"application/json\", \"{ \\\"statusCode\\\": 200 }\"))\n .build(), MethodOptions.builder()\n .methodResponses(List.of(MethodResponse.builder().statusCode(\"200\").build()))\n .build());\n\n this.methods.push(method);\n }\n}\n\npublic class BooksStack extends NestedStack {\n public final Method[] methods;\n\n public BooksStack(Construct scope, ResourceNestedStackProps props) {\n super(scope, \"integ-restapi-import-BooksStack\", props);\n\n IRestApi api = RestApi.fromRestApiAttributes(this, \"RestApi\", RestApiAttributes.builder()\n .restApiId(props.getRestApiId())\n .rootResourceId(props.getRootResourceId())\n .build());\n\n Method method = api.root.addResource(\"books\").addMethod(\"GET\", MockIntegration.Builder.create()\n .integrationResponses(List.of(IntegrationResponse.builder()\n .statusCode(\"200\")\n .build()))\n .passthroughBehavior(PassthroughBehavior.NEVER)\n .requestTemplates(Map.of(\n \"application/json\", \"{ \\\"statusCode\\\": 200 }\"))\n .build(), MethodOptions.builder()\n .methodResponses(List.of(MethodResponse.builder().statusCode(\"200\").build()))\n .build());\n\n this.methods.push(method);\n }\n}\n\npublic class DeployStackProps extends NestedStackProps {\n private String restApiId;\n public String getRestApiId() {\n return this.restApiId;\n }\n public DeployStackProps restApiId(String restApiId) {\n this.restApiId = restApiId;\n return this;\n }\n\n private Method[] methods;\n public Method[] getMethods() {\n return this.methods;\n }\n public DeployStackProps methods(Method[] methods) {\n this.methods = methods;\n return this;\n }\n}\n\npublic class DeployStack extends NestedStack {\n public DeployStack(Construct scope, DeployStackProps props) {\n super(scope, \"integ-restapi-import-DeployStack\", props);\n\n Deployment deployment = Deployment.Builder.create(this, \"Deployment\")\n .api(RestApi.fromRestApiId(this, \"RestApi\", props.getRestApiId()))\n .build();\n if (props.getMethods()) {\n for (Object method : props.getMethods()) {\n deployment.node.addDependency(method);\n }\n }\n Stage.Builder.create(this, \"Stage\").deployment(deployment).build();\n }\n}\n\nnew RootStack(new App());","version":"1"},"go":{"source":"import \"github.com/aws-samples/dummy/awscdkcore\"\nimport \"github.com/aws/constructs-go/constructs\"\nimport \"github.com/aws-samples/dummy/lib\"\n\n/**\n * This file showcases how to split up a RestApi's Resources and Methods across nested stacks.\n *\n * The root stack 'RootStack' first defines a RestApi.\n * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.\n * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.\n *\n * To verify this worked, go to the APIGateway\n */\n\ntype rootStack struct {\n\tstack\n}\n\nfunc newRootStack(scope construct) *rootStack {\n\tthis := &rootStack{}\n\tnewStack_Override(this, scope, jsii.String(\"integ-restapi-import-RootStack\"))\n\n\trestApi := lib.NewRestApi(this, jsii.String(\"RestApi\"), &RestApiProps{\n\t\tDeploy: jsii.Boolean(false),\n\t})\n\trestApi.Root.AddMethod(jsii.String(\"ANY\"))\n\n\tpetsStack := NewPetsStack(this, &resourceNestedStackProps{\n\t\trestApiId: restApi.RestApiId,\n\t\trootResourceId: restApi.RestApiRootResourceId,\n\t})\n\tbooksStack := NewBooksStack(this, &resourceNestedStackProps{\n\t\trestApiId: restApi.*RestApiId,\n\t\trootResourceId: restApi.*RestApiRootResourceId,\n\t})\n\tNewDeployStack(this, &deployStackProps{\n\t\trestApiId: restApi.*RestApiId,\n\t\tmethods: petsStack.methods.concat(booksStack.methods),\n\t})\n\n\tawscdkcore.NewCfnOutput(this, jsii.String(\"PetsURL\"), &CfnOutputProps{\n\t\tValue: fmt.Sprintf(\"https://%v.execute-api.%v.amazonaws.com/prod/pets\", restApi.*RestApiId, this.Region),\n\t})\n\n\tawscdkcore.NewCfnOutput(this, jsii.String(\"BooksURL\"), &CfnOutputProps{\n\t\tValue: fmt.Sprintf(\"https://%v.execute-api.%v.amazonaws.com/prod/books\", restApi.*RestApiId, this.*Region),\n\t})\n\treturn this\n}\n\ntype resourceNestedStackProps struct {\n\tnestedStackProps\n\trestApiId *string\n\trootResourceId *string\n}\n\ntype petsStack struct {\n\tnestedStack\n\tmethods []method\n}\n\nfunc newPetsStack(scope construct, props resourceNestedStackProps) *petsStack {\n\tthis := &petsStack{}\n\tnewNestedStack_Override(this, scope, jsii.String(\"integ-restapi-import-PetsStack\"), props)\n\n\tapi := lib.RestApi_FromRestApiAttributes(this, jsii.String(\"RestApi\"), &RestApiAttributes{\n\t\tRestApiId: props.restApiId,\n\t\tRootResourceId: props.rootResourceId,\n\t})\n\n\tmethod := api.Root.AddResource(jsii.String(\"pets\")).AddMethod(jsii.String(\"GET\"), lib.NewMockIntegration(&IntegrationOptions{\n\t\tIntegrationResponses: []integrationResponse{\n\t\t\t&integrationResponse{\n\t\t\t\tStatusCode: jsii.String(\"200\"),\n\t\t\t},\n\t\t},\n\t\tPassthroughBehavior: *lib.PassthroughBehavior_NEVER,\n\t\tRequestTemplates: map[string]*string{\n\t\t\t\"application/json\": jsii.String(\"{ \\\"statusCode\\\": 200 }\"),\n\t\t},\n\t}), &MethodOptions{\n\t\tMethodResponses: []methodResponse{\n\t\t\t&methodResponse{\n\t\t\t\tStatusCode: jsii.String(\"200\"),\n\t\t\t},\n\t\t},\n\t})\n\n\tthis.methods.push(method)\n\treturn this\n}\n\ntype booksStack struct {\n\tnestedStack\n\tmethods []*method\n}\n\nfunc newBooksStack(scope construct, props resourceNestedStackProps) *booksStack {\n\tthis := &booksStack{}\n\tnewNestedStack_Override(this, scope, jsii.String(\"integ-restapi-import-BooksStack\"), props)\n\n\tapi := lib.RestApi_FromRestApiAttributes(this, jsii.String(\"RestApi\"), &RestApiAttributes{\n\t\tRestApiId: props.restApiId,\n\t\tRootResourceId: props.rootResourceId,\n\t})\n\n\tmethod := api.Root.AddResource(jsii.String(\"books\")).AddMethod(jsii.String(\"GET\"), lib.NewMockIntegration(&IntegrationOptions{\n\t\tIntegrationResponses: []*integrationResponse{\n\t\t\t&integrationResponse{\n\t\t\t\tStatusCode: jsii.String(\"200\"),\n\t\t\t},\n\t\t},\n\t\tPassthroughBehavior: *lib.PassthroughBehavior_NEVER,\n\t\tRequestTemplates: map[string]*string{\n\t\t\t\"application/json\": jsii.String(\"{ \\\"statusCode\\\": 200 }\"),\n\t\t},\n\t}), &MethodOptions{\n\t\tMethodResponses: []*methodResponse{\n\t\t\t&methodResponse{\n\t\t\t\tStatusCode: jsii.String(\"200\"),\n\t\t\t},\n\t\t},\n\t})\n\n\tthis.methods.push(method)\n\treturn this\n}\n\ntype deployStackProps struct {\n\tnestedStackProps\n\trestApiId *string\n\tmethods []*method\n}\n\ntype deployStack struct {\n\tnestedStack\n}\n\nfunc newDeployStack(scope construct, props deployStackProps) *deployStack {\n\tthis := &deployStack{}\n\tnewNestedStack_Override(this, scope, jsii.String(\"integ-restapi-import-DeployStack\"), props)\n\n\tdeployment := lib.NewDeployment(this, jsii.String(\"Deployment\"), &DeploymentProps{\n\t\tApi: *lib.RestApi_FromRestApiId(this, jsii.String(\"RestApi\"), props.restApiId),\n\t})\n\tif *props.methods {\n\t\tfor _, method := range *props.methods {\n\t\t\tdeployment.Node.AddDependency(method)\n\t\t}\n\t}\n\tlib.NewStage(this, jsii.String(\"Stage\"), &StageProps{\n\t\tDeployment: Deployment,\n\t})\n\treturn this\n}\n\nNewRootStack(awscdkcore.NewApp())","version":"1"},"$":{"source":"import { App, CfnOutput, NestedStack, NestedStackProps, Stack } from '@aws-cdk/core';\nimport { Construct } from 'constructs';\nimport { Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage } from '../lib';\n\n/**\n * This file showcases how to split up a RestApi's Resources and Methods across nested stacks.\n *\n * The root stack 'RootStack' first defines a RestApi.\n * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.\n * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.\n *\n * To verify this worked, go to the APIGateway\n */\n\nclass RootStack extends Stack {\n constructor(scope: Construct) {\n super(scope, 'integ-restapi-import-RootStack');\n\n const restApi = new RestApi(this, 'RestApi', {\n deploy: false,\n });\n restApi.root.addMethod('ANY');\n\n const petsStack = new PetsStack(this, {\n restApiId: restApi.restApiId,\n rootResourceId: restApi.restApiRootResourceId,\n });\n const booksStack = new BooksStack(this, {\n restApiId: restApi.restApiId,\n rootResourceId: restApi.restApiRootResourceId,\n });\n new DeployStack(this, {\n restApiId: restApi.restApiId,\n methods: petsStack.methods.concat(booksStack.methods),\n });\n\n new CfnOutput(this, 'PetsURL', {\n value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/pets`,\n });\n\n new CfnOutput(this, 'BooksURL', {\n value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/books`,\n });\n }\n}\n\ninterface ResourceNestedStackProps extends NestedStackProps {\n readonly restApiId: string;\n\n readonly rootResourceId: string;\n}\n\nclass PetsStack extends NestedStack {\n public readonly methods: Method[] = [];\n\n constructor(scope: Construct, props: ResourceNestedStackProps) {\n super(scope, 'integ-restapi-import-PetsStack', props);\n\n const api = RestApi.fromRestApiAttributes(this, 'RestApi', {\n restApiId: props.restApiId,\n rootResourceId: props.rootResourceId,\n });\n\n const method = api.root.addResource('pets').addMethod('GET', new MockIntegration({\n integrationResponses: [{\n statusCode: '200',\n }],\n passthroughBehavior: PassthroughBehavior.NEVER,\n requestTemplates: {\n 'application/json': '{ \"statusCode\": 200 }',\n },\n }), {\n methodResponses: [{ statusCode: '200' }],\n });\n\n this.methods.push(method);\n }\n}\n\nclass BooksStack extends NestedStack {\n public readonly methods: Method[] = [];\n\n constructor(scope: Construct, props: ResourceNestedStackProps) {\n super(scope, 'integ-restapi-import-BooksStack', props);\n\n const api = RestApi.fromRestApiAttributes(this, 'RestApi', {\n restApiId: props.restApiId,\n rootResourceId: props.rootResourceId,\n });\n\n const method = api.root.addResource('books').addMethod('GET', new MockIntegration({\n integrationResponses: [{\n statusCode: '200',\n }],\n passthroughBehavior: PassthroughBehavior.NEVER,\n requestTemplates: {\n 'application/json': '{ \"statusCode\": 200 }',\n },\n }), {\n methodResponses: [{ statusCode: '200' }],\n });\n\n this.methods.push(method);\n }\n}\n\ninterface DeployStackProps extends NestedStackProps {\n readonly restApiId: string;\n\n readonly methods?: Method[];\n}\n\nclass DeployStack extends NestedStack {\n constructor(scope: Construct, props: DeployStackProps) {\n super(scope, 'integ-restapi-import-DeployStack', props);\n\n const deployment = new Deployment(this, 'Deployment', {\n api: RestApi.fromRestApiId(this, 'RestApi', props.restApiId),\n });\n if (props.methods) {\n for (const method of props.methods) {\n deployment.node.addDependency(method);\n }\n }\n new Stage(this, 'Stage', { deployment });\n }\n}\n\nnew RootStack(new App());","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@aws-cdk/aws-apigateway"},"field":{"field":"markdown","line":241}},"didCompile":true,"fqnsReferenced":["@aws-cdk/aws-apigateway.Deployment","@aws-cdk/aws-apigateway.DeploymentProps","@aws-cdk/aws-apigateway.IResource#addMethod","@aws-cdk/aws-apigateway.IResource#addResource","@aws-cdk/aws-apigateway.IRestApi","@aws-cdk/aws-apigateway.IRestApi#root","@aws-cdk/aws-apigateway.Integration","@aws-cdk/aws-apigateway.IntegrationOptions","@aws-cdk/aws-apigateway.Method","@aws-cdk/aws-apigateway.MethodOptions","@aws-cdk/aws-apigateway.MockIntegration","@aws-cdk/aws-apigateway.PassthroughBehavior","@aws-cdk/aws-apigateway.PassthroughBehavior#NEVER","@aws-cdk/aws-apigateway.ResourceBase#addMethod","@aws-cdk/aws-apigateway.RestApi","@aws-cdk/aws-apigateway.RestApi#fromRestApiAttributes","@aws-cdk/aws-apigateway.RestApi#fromRestApiId","@aws-cdk/aws-apigateway.RestApi#restApiId","@aws-cdk/aws-apigateway.RestApi#restApiRootResourceId","@aws-cdk/aws-apigateway.RestApi#root","@aws-cdk/aws-apigateway.RestApiAttributes","@aws-cdk/aws-apigateway.RestApiProps","@aws-cdk/aws-apigateway.Stage","@aws-cdk/aws-apigateway.StageProps","@aws-cdk/core.App","@aws-cdk/core.CfnOutput","@aws-cdk/core.CfnOutputProps","@aws-cdk/core.Construct#node","@aws-cdk/core.ConstructNode#addDependency","@aws-cdk/core.IDependable","@aws-cdk/core.NestedStack","@aws-cdk/core.NestedStackProps","@aws-cdk/core.Stack","constructs.Construct"],"fullSource":"import { App, CfnOutput, NestedStack, NestedStackProps, Stack } from '@aws-cdk/core';\nimport { Construct } from 'constructs';\nimport { Deployment, Method, MockIntegration, PassthroughBehavior, RestApi, Stage } from '../lib';\n\n/**\n * This file showcases how to split up a RestApi's Resources and Methods across nested stacks.\n *\n * The root stack 'RootStack' first defines a RestApi.\n * Two nested stacks BooksStack and PetsStack, create corresponding Resources '/books' and '/pets'.\n * They are then deployed to a 'prod' Stage via a third nested stack - DeployStack.\n *\n * To verify this worked, go to the APIGateway\n */\n\nclass RootStack extends Stack {\n constructor(scope: Construct) {\n super(scope, 'integ-restapi-import-RootStack');\n\n const restApi = new RestApi(this, 'RestApi', {\n deploy: false,\n });\n restApi.root.addMethod('ANY');\n\n const petsStack = new PetsStack(this, {\n restApiId: restApi.restApiId,\n rootResourceId: restApi.restApiRootResourceId,\n });\n const booksStack = new BooksStack(this, {\n restApiId: restApi.restApiId,\n rootResourceId: restApi.restApiRootResourceId,\n });\n new DeployStack(this, {\n restApiId: restApi.restApiId,\n methods: petsStack.methods.concat(booksStack.methods),\n });\n\n new CfnOutput(this, 'PetsURL', {\n value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/pets`,\n });\n\n new CfnOutput(this, 'BooksURL', {\n value: `https://${restApi.restApiId}.execute-api.${this.region}.amazonaws.com/prod/books`,\n });\n }\n}\n\ninterface ResourceNestedStackProps extends NestedStackProps {\n readonly restApiId: string;\n\n readonly rootResourceId: string;\n}\n\nclass PetsStack extends NestedStack {\n public readonly methods: Method[] = [];\n\n constructor(scope: Construct, props: ResourceNestedStackProps) {\n super(scope, 'integ-restapi-import-PetsStack', props);\n\n const api = RestApi.fromRestApiAttributes(this, 'RestApi', {\n restApiId: props.restApiId,\n rootResourceId: props.rootResourceId,\n });\n\n const method = api.root.addResource('pets').addMethod('GET', new MockIntegration({\n integrationResponses: [{\n statusCode: '200',\n }],\n passthroughBehavior: PassthroughBehavior.NEVER,\n requestTemplates: {\n 'application/json': '{ \"statusCode\": 200 }',\n },\n }), {\n methodResponses: [{ statusCode: '200' }],\n });\n\n this.methods.push(method);\n }\n}\n\nclass BooksStack extends NestedStack {\n public readonly methods: Method[] = [];\n\n constructor(scope: Construct, props: ResourceNestedStackProps) {\n super(scope, 'integ-restapi-import-BooksStack', props);\n\n const api = RestApi.fromRestApiAttributes(this, 'RestApi', {\n restApiId: props.restApiId,\n rootResourceId: props.rootResourceId,\n });\n\n const method = api.root.addResource('books').addMethod('GET', new MockIntegration({\n integrationResponses: [{\n statusCode: '200',\n }],\n passthroughBehavior: PassthroughBehavior.NEVER,\n requestTemplates: {\n 'application/json': '{ \"statusCode\": 200 }',\n },\n }), {\n methodResponses: [{ statusCode: '200' }],\n });\n\n this.methods.push(method);\n }\n}\n\ninterface DeployStackProps extends NestedStackProps {\n readonly restApiId: string;\n\n readonly methods?: Method[];\n}\n\nclass DeployStack extends NestedStack {\n constructor(scope: Construct, props: DeployStackProps) {\n super(scope, 'integ-restapi-import-DeployStack', props);\n\n const deployment = new Deployment(this, 'Deployment', {\n api: RestApi.fromRestApiId(this, 'RestApi', props.restApiId),\n });\n if (props.methods) {\n for (const method of props.methods) {\n deployment.node.addDependency(method);\n }\n }\n new Stage(this, 'Stage', { deployment });\n }\n}\n\nnew RootStack(new App());","syntaxKindCounter":{"10":28,"15":2,"16":2,"17":2,"57":1,"75":168,"91":1,"102":4,"104":15,"119":2,"138":6,"143":3,"156":7,"158":4,"159":2,"162":4,"169":10,"174":3,"192":6,"193":20,"194":38,"196":16,"197":12,"211":2,"216":6,"221":4,"223":6,"225":8,"226":13,"227":1,"232":1,"242":9,"243":9,"245":4,"246":