Skip to content

Commit d7e263d

Browse files
authored
feat(appsync): Add Private API support when creating a GraphqlApi (#25569)
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*
1 parent a2e6324 commit d7e263d

21 files changed

+1116
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "31.0.0",
3+
"files": {
4+
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
5+
"source": {
6+
"path": "apiDefaultTestDeployAssert018781F2.template.json",
7+
"packaging": "file"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
}
17+
},
18+
"dockerImages": {}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"Parameters": {
3+
"BootstrapVersion": {
4+
"Type": "AWS::SSM::Parameter::Value<String>",
5+
"Default": "/cdk-bootstrap/hnb659fds/version",
6+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
7+
}
8+
},
9+
"Rules": {
10+
"CheckBootstrapVersion": {
11+
"Assertions": [
12+
{
13+
"Assert": {
14+
"Fn::Not": [
15+
{
16+
"Fn::Contains": [
17+
[
18+
"1",
19+
"2",
20+
"3",
21+
"4",
22+
"5"
23+
],
24+
{
25+
"Ref": "BootstrapVersion"
26+
}
27+
]
28+
}
29+
]
30+
},
31+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
32+
}
33+
]
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"31.0.0"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "31.0.0",
3+
"testCases": {
4+
"api/DefaultTest": {
5+
"stacks": [
6+
"stack"
7+
],
8+
"assertionStack": "api/DefaultTest/DeployAssert",
9+
"assertionStackName": "apiDefaultTestDeployAssert018781F2"
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"version": "31.0.0",
3+
"artifacts": {
4+
"stack.assets": {
5+
"type": "cdk:asset-manifest",
6+
"properties": {
7+
"file": "stack.assets.json",
8+
"requiresBootstrapStackVersion": 6,
9+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
10+
}
11+
},
12+
"stack": {
13+
"type": "aws:cloudformation:stack",
14+
"environment": "aws://unknown-account/unknown-region",
15+
"properties": {
16+
"templateFile": "stack.template.json",
17+
"validateOnSynth": false,
18+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
19+
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5c90e4423671419971d1b5546661e52e2331796971ad32053a46ff0cf4ef2dbe.json",
21+
"requiresBootstrapStackVersion": 6,
22+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
23+
"additionalDependencies": [
24+
"stack.assets"
25+
],
26+
"lookupRole": {
27+
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
28+
"requiresBootstrapStackVersion": 8,
29+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
30+
}
31+
},
32+
"dependencies": [
33+
"stack.assets"
34+
],
35+
"metadata": {
36+
"/stack/GlobalApi/Resource": [
37+
{
38+
"type": "aws:cdk:logicalId",
39+
"data": "GlobalApiDF743291"
40+
}
41+
],
42+
"/stack/GlobalApi/Schema": [
43+
{
44+
"type": "aws:cdk:logicalId",
45+
"data": "GlobalApiSchema59B7A7F8"
46+
}
47+
],
48+
"/stack/GlobalApi/DefaultApiKey": [
49+
{
50+
"type": "aws:cdk:logicalId",
51+
"data": "GlobalApiDefaultApiKey407F28FF"
52+
}
53+
],
54+
"/stack/GlobalApi/NoneDS/Resource": [
55+
{
56+
"type": "aws:cdk:logicalId",
57+
"data": "GlobalApiNoneDSA6A1C75B"
58+
}
59+
],
60+
"/stack/BootstrapVersion": [
61+
{
62+
"type": "aws:cdk:logicalId",
63+
"data": "BootstrapVersion"
64+
}
65+
],
66+
"/stack/CheckBootstrapVersion": [
67+
{
68+
"type": "aws:cdk:logicalId",
69+
"data": "CheckBootstrapVersion"
70+
}
71+
]
72+
},
73+
"displayName": "stack"
74+
},
75+
"apiDefaultTestDeployAssert018781F2.assets": {
76+
"type": "cdk:asset-manifest",
77+
"properties": {
78+
"file": "apiDefaultTestDeployAssert018781F2.assets.json",
79+
"requiresBootstrapStackVersion": 6,
80+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
81+
}
82+
},
83+
"apiDefaultTestDeployAssert018781F2": {
84+
"type": "aws:cloudformation:stack",
85+
"environment": "aws://unknown-account/unknown-region",
86+
"properties": {
87+
"templateFile": "apiDefaultTestDeployAssert018781F2.template.json",
88+
"validateOnSynth": false,
89+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
90+
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
91+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
92+
"requiresBootstrapStackVersion": 6,
93+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
94+
"additionalDependencies": [
95+
"apiDefaultTestDeployAssert018781F2.assets"
96+
],
97+
"lookupRole": {
98+
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
99+
"requiresBootstrapStackVersion": 8,
100+
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
101+
}
102+
},
103+
"dependencies": [
104+
"apiDefaultTestDeployAssert018781F2.assets"
105+
],
106+
"metadata": {
107+
"/api/DefaultTest/DeployAssert/BootstrapVersion": [
108+
{
109+
"type": "aws:cdk:logicalId",
110+
"data": "BootstrapVersion"
111+
}
112+
],
113+
"/api/DefaultTest/DeployAssert/CheckBootstrapVersion": [
114+
{
115+
"type": "aws:cdk:logicalId",
116+
"data": "CheckBootstrapVersion"
117+
}
118+
]
119+
},
120+
"displayName": "api/DefaultTest/DeployAssert"
121+
},
122+
"Tree": {
123+
"type": "cdk:tree",
124+
"properties": {
125+
"file": "tree.json"
126+
}
127+
}
128+
}
129+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "31.0.0",
3+
"files": {
4+
"5c90e4423671419971d1b5546661e52e2331796971ad32053a46ff0cf4ef2dbe": {
5+
"source": {
6+
"path": "stack.template.json",
7+
"packaging": "file"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "5c90e4423671419971d1b5546661e52e2331796971ad32053a46ff0cf4ef2dbe.json",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
}
17+
},
18+
"dockerImages": {}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"Resources": {
3+
"GlobalApiDF743291": {
4+
"Type": "AWS::AppSync::GraphQLApi",
5+
"Properties": {
6+
"AuthenticationType": "API_KEY",
7+
"Name": "GlobalApi",
8+
"Visibility": "GLOBAL"
9+
}
10+
},
11+
"GlobalApiSchema59B7A7F8": {
12+
"Type": "AWS::AppSync::GraphQLSchema",
13+
"Properties": {
14+
"ApiId": {
15+
"Fn::GetAtt": [
16+
"GlobalApiDF743291",
17+
"ApiId"
18+
]
19+
},
20+
"Definition": "type test {\n version: String!\n}\ntype Query {\n getTests: [test]!\n}\ntype Mutation {\n addTest(version: String!): test\n}\n"
21+
}
22+
},
23+
"GlobalApiDefaultApiKey407F28FF": {
24+
"Type": "AWS::AppSync::ApiKey",
25+
"Properties": {
26+
"ApiId": {
27+
"Fn::GetAtt": [
28+
"GlobalApiDF743291",
29+
"ApiId"
30+
]
31+
}
32+
},
33+
"DependsOn": [
34+
"GlobalApiSchema59B7A7F8"
35+
]
36+
},
37+
"GlobalApiNoneDSA6A1C75B": {
38+
"Type": "AWS::AppSync::DataSource",
39+
"Properties": {
40+
"ApiId": {
41+
"Fn::GetAtt": [
42+
"GlobalApiDF743291",
43+
"ApiId"
44+
]
45+
},
46+
"Name": "NoneDS",
47+
"Type": "NONE"
48+
}
49+
}
50+
},
51+
"Parameters": {
52+
"BootstrapVersion": {
53+
"Type": "AWS::SSM::Parameter::Value<String>",
54+
"Default": "/cdk-bootstrap/hnb659fds/version",
55+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
56+
}
57+
},
58+
"Rules": {
59+
"CheckBootstrapVersion": {
60+
"Assertions": [
61+
{
62+
"Assert": {
63+
"Fn::Not": [
64+
{
65+
"Fn::Contains": [
66+
[
67+
"1",
68+
"2",
69+
"3",
70+
"4",
71+
"5"
72+
],
73+
{
74+
"Ref": "BootstrapVersion"
75+
}
76+
]
77+
}
78+
]
79+
},
80+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
81+
}
82+
]
83+
}
84+
}
85+
}

0 commit comments

Comments
 (0)