Skip to content

Commit

Permalink
feat(appsync): Add Private API support when creating a GraphqlApi (#2…
Browse files Browse the repository at this point in the history
…5569)

Adds support for the GraphqlApi `Visibility` parameter that allows AppSync GraphQL APIs to be scoped as either `GLOBAL`, open to the internet, or `PRIVATE`, access is restricted to the VPC.
Visibility is an optional string property that can be set when creating an API. We pass it through if provided. 

Related blog post: https://aws.amazon.com/blogs/mobile/introducing-private-apis-on-aws-appsync/

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
jamedf committed May 16, 2023
1 parent a2e6324 commit d7e263d
Show file tree
Hide file tree
Showing 21 changed files with 1,116 additions and 0 deletions.
@@ -0,0 +1,19 @@
{
"version": "31.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": {}
}
@@ -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."
}
]
}
}
}
@@ -0,0 +1 @@
{"version":"31.0.0"}
@@ -0,0 +1,12 @@
{
"version": "31.0.0",
"testCases": {
"api/DefaultTest": {
"stacks": [
"stack"
],
"assertionStack": "api/DefaultTest/DeployAssert",
"assertionStackName": "apiDefaultTestDeployAssert018781F2"
}
}
}
@@ -0,0 +1,129 @@
{
"version": "31.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}/5c90e4423671419971d1b5546661e52e2331796971ad32053a46ff0cf4ef2dbe.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/GlobalApi/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "GlobalApiDF743291"
}
],
"/stack/GlobalApi/Schema": [
{
"type": "aws:cdk:logicalId",
"data": "GlobalApiSchema59B7A7F8"
}
],
"/stack/GlobalApi/DefaultApiKey": [
{
"type": "aws:cdk:logicalId",
"data": "GlobalApiDefaultApiKey407F28FF"
}
],
"/stack/GlobalApi/NoneDS/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "GlobalApiNoneDSA6A1C75B"
}
],
"/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"
}
}
}
}
@@ -0,0 +1,19 @@
{
"version": "31.0.0",
"files": {
"5c90e4423671419971d1b5546661e52e2331796971ad32053a46ff0cf4ef2dbe": {
"source": {
"path": "stack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "5c90e4423671419971d1b5546661e52e2331796971ad32053a46ff0cf4ef2dbe.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
@@ -0,0 +1,85 @@
{
"Resources": {
"GlobalApiDF743291": {
"Type": "AWS::AppSync::GraphQLApi",
"Properties": {
"AuthenticationType": "API_KEY",
"Name": "GlobalApi",
"Visibility": "GLOBAL"
}
},
"GlobalApiSchema59B7A7F8": {
"Type": "AWS::AppSync::GraphQLSchema",
"Properties": {
"ApiId": {
"Fn::GetAtt": [
"GlobalApiDF743291",
"ApiId"
]
},
"Definition": "type test {\n version: String!\n}\ntype Query {\n getTests: [test]!\n}\ntype Mutation {\n addTest(version: String!): test\n}\n"
}
},
"GlobalApiDefaultApiKey407F28FF": {
"Type": "AWS::AppSync::ApiKey",
"Properties": {
"ApiId": {
"Fn::GetAtt": [
"GlobalApiDF743291",
"ApiId"
]
}
},
"DependsOn": [
"GlobalApiSchema59B7A7F8"
]
},
"GlobalApiNoneDSA6A1C75B": {
"Type": "AWS::AppSync::DataSource",
"Properties": {
"ApiId": {
"Fn::GetAtt": [
"GlobalApiDF743291",
"ApiId"
]
},
"Name": "NoneDS",
"Type": "NONE"
}
}
},
"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."
}
]
}
}
}

0 comments on commit d7e263d

Please sign in to comment.