-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch from inline string to inline object. upgraded testing.
- Loading branch information
Niranjan Jayakar
committed
May 7, 2020
1 parent
926f070
commit e936e99
Showing
9 changed files
with
403 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/@aws-cdk/aws-apigateway/test/integ.api-definition.asset.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as path from 'path'; | ||
import * as apigateway from '../lib'; | ||
|
||
/* | ||
* Stack verification steps: | ||
* * `curl -i <CFN output PetsURL>` should return HTTP code 200 | ||
*/ | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'integtest-restapi-fromdefinition-asset'); | ||
|
||
const api = new apigateway.SpecRestApi(stack, 'my-api', { | ||
apiDefinition: apigateway.ApiDefinition.fromAsset(path.join(__dirname, 'sample-definition.yaml')), | ||
}); | ||
|
||
new cdk.CfnOutput(stack, 'PetsURL', { | ||
value: api.urlForPath('/pets'), | ||
}); | ||
|
||
app.synth(); |
177 changes: 177 additions & 0 deletions
177
packages/@aws-cdk/aws-apigateway/test/integ.api-definition.inline.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
{ | ||
"Resources": { | ||
"myapi4C7BF186": { | ||
"Type": "AWS::ApiGateway::RestApi", | ||
"Properties": { | ||
"Body": { | ||
"openapi": "3.0.2", | ||
"info": { | ||
"version": "1.0.0", | ||
"title": "Test API for CDK" | ||
}, | ||
"paths": { | ||
"/pets": { | ||
"get": { | ||
"summary": "Test Method", | ||
"operationId": "testMethod", | ||
"responses": { | ||
"200": { | ||
"description": "A paged array of pets", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/Empty" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"x-amazon-apigateway-integration": { | ||
"responses": { | ||
"default": { | ||
"statusCode": "200" | ||
} | ||
}, | ||
"requestTemplates": { | ||
"application/json": "{\"statusCode\": 200}" | ||
}, | ||
"passthroughBehavior": "when_no_match", | ||
"type": "mock" | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Empty": { | ||
"title": "Empty Schema", | ||
"type": "object" | ||
} | ||
} | ||
} | ||
}, | ||
"Name": "my-api" | ||
} | ||
}, | ||
"myapiDeployment92F2CB49": { | ||
"Type": "AWS::ApiGateway::Deployment", | ||
"Properties": { | ||
"RestApiId": { | ||
"Ref": "myapi4C7BF186" | ||
}, | ||
"Description": "Automatically created by the RestApi construct" | ||
} | ||
}, | ||
"myapiDeploymentStageprod298F01AF": { | ||
"Type": "AWS::ApiGateway::Stage", | ||
"Properties": { | ||
"RestApiId": { | ||
"Ref": "myapi4C7BF186" | ||
}, | ||
"DeploymentId": { | ||
"Ref": "myapiDeployment92F2CB49" | ||
}, | ||
"StageName": "prod" | ||
} | ||
}, | ||
"myapiCloudWatchRole095452E5": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "apigateway.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"myapiAccountEC421A0A": { | ||
"Type": "AWS::ApiGateway::Account", | ||
"Properties": { | ||
"CloudWatchRoleArn": { | ||
"Fn::GetAtt": [ | ||
"myapiCloudWatchRole095452E5", | ||
"Arn" | ||
] | ||
} | ||
}, | ||
"DependsOn": [ | ||
"myapi4C7BF186" | ||
] | ||
} | ||
}, | ||
"Outputs": { | ||
"myapiEndpoint3628AFE3": { | ||
"Value": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"https://", | ||
{ | ||
"Ref": "myapi4C7BF186" | ||
}, | ||
".execute-api.", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
".", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
}, | ||
"/", | ||
{ | ||
"Ref": "myapiDeploymentStageprod298F01AF" | ||
}, | ||
"/" | ||
] | ||
] | ||
} | ||
}, | ||
"PetsURL": { | ||
"Value": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"https://", | ||
{ | ||
"Ref": "myapi4C7BF186" | ||
}, | ||
".execute-api.", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
".", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
}, | ||
"/", | ||
{ | ||
"Ref": "myapiDeploymentStageprod298F01AF" | ||
}, | ||
"/pets" | ||
] | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.