-
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.
Add support for [AppSync Merged API](https://aws.amazon.com/blogs/mobile/introducing-merged-apis-on-aws-appsync/) feature. At the moment, a GraphQL schema can be passed using the `schema` property. I deprecated this property because it is not used for merged APIs. Depecreated syntax: ```ts const api = new appsync.GraphqlApi(this, 'Api', { name: 'demo', schema: appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphql')), }); ``` Instead, I introduced a new property `apiSource` that can be used to create a AppSync GraphQL API or Merged API. GraphQL API: ```ts const api = new appsync.GraphqlApi(this, 'Api', { name: 'demo', apiSource: appsync.ApiSource.fromSchema(appsync.SchemaFile.fromAsset(path.join(__dirname, 'schema.graphql'))), // short version apiSource: appsync.ApiSource.fromFile(path.join(__dirname, 'schema.graphql')), }); ``` Merged API: ```ts const api = new appsync.GraphqlApi(this, 'Api', { name: 'demo', apiSource: appsync.ApiSource.fromSourceApis({ sourceApis: [ { sourceApi: firstApi, mergeType: appsync.MergeType.MANUAL_MERGE, }, { sourceApi: secondApi, mergeType: appsync.MergeType.AUTO_MERGE, }, ], }), }); ``` Closes #25960. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
15 changed files
with
1,614 additions
and
24 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.merged-api-1.graphql
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,9 @@ | ||
type firstTest { | ||
version: String! | ||
} | ||
type Query { | ||
getFirstTests: [firstTest]! | ||
} | ||
type Mutation { | ||
addFirstTest(version: String!): firstTest | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/appsync.merged-api-2.graphql
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,9 @@ | ||
type secondTest { | ||
version: String! | ||
} | ||
type Query { | ||
getSecondTests: [secondTest]! | ||
} | ||
type Mutation { | ||
addSecondTest(version: String!): secondTest | ||
} |
19 changes: 19 additions & 0 deletions
19
.../test/integ.appsync-merged-api.js.snapshot/apiDefaultTestDeployAssert018781F2.assets.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,19 @@ | ||
{ | ||
"version": "33.0.0", | ||
"files": { | ||
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { | ||
"source": { | ||
"path": "apiDefaultTestDeployAssert018781F2.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
36 changes: 36 additions & 0 deletions
36
...est/integ.appsync-merged-api.js.snapshot/apiDefaultTestDeployAssert018781F2.template.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,36 @@ | ||
{ | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...esting/framework-integ/test/aws-appsync/test/integ.appsync-merged-api.js.snapshot/cdk.out
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 @@ | ||
{"version":"33.0.0"} |
12 changes: 12 additions & 0 deletions
12
...ing/framework-integ/test/aws-appsync/test/integ.appsync-merged-api.js.snapshot/integ.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,12 @@ | ||
{ | ||
"version": "33.0.0", | ||
"testCases": { | ||
"api/DefaultTest": { | ||
"stacks": [ | ||
"stack" | ||
], | ||
"assertionStack": "api/DefaultTest/DeployAssert", | ||
"assertionStackName": "apiDefaultTestDeployAssert018781F2" | ||
} | ||
} | ||
} |
189 changes: 189 additions & 0 deletions
189
.../framework-integ/test/aws-appsync/test/integ.appsync-merged-api.js.snapshot/manifest.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,189 @@ | ||
{ | ||
"version": "33.0.0", | ||
"artifacts": { | ||
"stack.assets": { | ||
"type": "cdk:asset-manifest", | ||
"properties": { | ||
"file": "stack.assets.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"stack": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "stack.template.json", | ||
"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}/227b4b7375fe3e7375a62383a2f862327ab90f469d554dcca064258ce7b2821b.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", | ||
"additionalDependencies": [ | ||
"stack.assets" | ||
], | ||
"lookupRole": { | ||
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", | ||
"requiresBootstrapStackVersion": 8, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"dependencies": [ | ||
"stack.assets" | ||
], | ||
"metadata": { | ||
"/stack/FirstSourceAPI/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "FirstSourceAPIB0DE8D5A" | ||
} | ||
], | ||
"/stack/FirstSourceAPI/Schema": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "FirstSourceAPISchemaF2FDB692" | ||
} | ||
], | ||
"/stack/FirstSourceAPI/DefaultApiKey": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "FirstSourceAPIDefaultApiKey9D9AE06D" | ||
} | ||
], | ||
"/stack/FirstSourceAPI/FirstSourceDS/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "FirstSourceAPIFirstSourceDS6AD299B7" | ||
} | ||
], | ||
"/stack/SecondSourceAPI/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "SecondSourceAPIE903371D" | ||
} | ||
], | ||
"/stack/SecondSourceAPI/Schema": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "SecondSourceAPISchema65B7401E" | ||
} | ||
], | ||
"/stack/SecondSourceAPI/DefaultApiKey": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "SecondSourceAPIDefaultApiKeyCE5A0A64" | ||
} | ||
], | ||
"/stack/SecondSourceAPI/SecondSourceDS/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "SecondSourceAPISecondSourceDSEA46EBA7" | ||
} | ||
], | ||
"/stack/MergedAPI/MergedApiExecutionRole/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MergedAPIMergedApiExecutionRole5F2BCCAD" | ||
} | ||
], | ||
"/stack/MergedAPI/MergedApiExecutionRole/DefaultPolicy/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MergedAPIMergedApiExecutionRoleDefaultPolicy31A96DBC" | ||
} | ||
], | ||
"/stack/MergedAPI/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MergedAPI08D3EAD1" | ||
} | ||
], | ||
"/stack/MergedAPI/FirstSourceAPIAssociation": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MergedAPIFirstSourceAPIAssociationEC781BA9" | ||
} | ||
], | ||
"/stack/MergedAPI/SecondSourceAPIAssociation": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MergedAPISecondSourceAPIAssociationBD1A08F4" | ||
} | ||
], | ||
"/stack/MergedAPI/DefaultApiKey": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MergedAPIDefaultApiKeyAF5EA13C" | ||
} | ||
], | ||
"/stack/BootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "BootstrapVersion" | ||
} | ||
], | ||
"/stack/CheckBootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CheckBootstrapVersion" | ||
} | ||
] | ||
}, | ||
"displayName": "stack" | ||
}, | ||
"apiDefaultTestDeployAssert018781F2.assets": { | ||
"type": "cdk:asset-manifest", | ||
"properties": { | ||
"file": "apiDefaultTestDeployAssert018781F2.assets.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"apiDefaultTestDeployAssert018781F2": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "apiDefaultTestDeployAssert018781F2.template.json", | ||
"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}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", | ||
"additionalDependencies": [ | ||
"apiDefaultTestDeployAssert018781F2.assets" | ||
], | ||
"lookupRole": { | ||
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", | ||
"requiresBootstrapStackVersion": 8, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"dependencies": [ | ||
"apiDefaultTestDeployAssert018781F2.assets" | ||
], | ||
"metadata": { | ||
"/api/DefaultTest/DeployAssert/BootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "BootstrapVersion" | ||
} | ||
], | ||
"/api/DefaultTest/DeployAssert/CheckBootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CheckBootstrapVersion" | ||
} | ||
] | ||
}, | ||
"displayName": "api/DefaultTest/DeployAssert" | ||
}, | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...mework-integ/test/aws-appsync/test/integ.appsync-merged-api.js.snapshot/stack.assets.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,19 @@ | ||
{ | ||
"version": "33.0.0", | ||
"files": { | ||
"227b4b7375fe3e7375a62383a2f862327ab90f469d554dcca064258ce7b2821b": { | ||
"source": { | ||
"path": "stack.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "227b4b7375fe3e7375a62383a2f862327ab90f469d554dcca064258ce7b2821b.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
Oops, something went wrong.