Skip to content

Commit f0a05aa

Browse files
surukondabiffgaut
andauthored
updated architecture diagram & apigateway iot integration path for named shadows (#232)
Co-authored-by: surukonda <surukonda> Co-authored-by: biffgaut <[email protected]>
1 parent 0041118 commit f0a05aa

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed
Loading

source/patterns/@aws-solutions-constructs/aws-apigateway-iot/lib/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ export class ApiGatewayToIot extends Construct {
192192
shadowReqParams);
193193
const methodNamedShadowReqParams = Object.assign({
194194
'method.request.path.shadowName': true}, methodShadowReqParams);
195-
// For some reason path mapping to 'things/{thingName}/shadow/name/{shadowName}' results in 403 error, hence this shortcut
196-
this.addResourceMethod(namedShadowResource, props, 'topics/$aws/things/{thingName}/shadow/name/{shadowName}/update',
195+
this.addResourceMethod(namedShadowResource, props, 'things/{thingName}/shadow?name={shadowName}',
197196
namedShadowReqParams, methodNamedShadowReqParams);
198197
}
199198

source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/__snapshots__/test.apigateway-iot.test.js.snap

+12-12
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Object {
137137
},
138138
"Type": "AWS::ApiGateway::RestApi",
139139
},
140-
"testapigatewayiotdefaultsnapshotRestApiDeployment8CB27899537da871680d57f38fb52e034f331e99": Object {
140+
"testapigatewayiotdefaultsnapshotRestApiDeployment8CB27899b39b7c498e943e0a0f3f9dedcc29368d": Object {
141141
"DependsOn": Array [
142142
"testapigatewayiotdefaultsnapshotawsapigatewayiotreqval7E4DADB3",
143143
"testapigatewayiotdefaultsnapshotRestApimessagetopiclevel1topiclevel2topiclevel3topiclevel4topiclevel5topiclevel6topiclevel7POST12FA075B",
@@ -191,7 +191,7 @@ Object {
191191
"Format": "{\\"requestId\\":\\"$context.requestId\\",\\"ip\\":\\"$context.identity.sourceIp\\",\\"user\\":\\"$context.identity.user\\",\\"caller\\":\\"$context.identity.caller\\",\\"requestTime\\":\\"$context.requestTime\\",\\"httpMethod\\":\\"$context.httpMethod\\",\\"resourcePath\\":\\"$context.resourcePath\\",\\"status\\":\\"$context.status\\",\\"protocol\\":\\"$context.protocol\\",\\"responseLength\\":\\"$context.responseLength\\"}",
192192
},
193193
"DeploymentId": Object {
194-
"Ref": "testapigatewayiotdefaultsnapshotRestApiDeployment8CB27899537da871680d57f38fb52e034f331e99",
194+
"Ref": "testapigatewayiotdefaultsnapshotRestApiDeployment8CB27899b39b7c498e943e0a0f3f9dedcc29368d",
195195
},
196196
"MethodSettings": Array [
197197
Object {
@@ -1149,7 +1149,7 @@ Object {
11491149
Object {
11501150
"Ref": "AWS::Region",
11511151
},
1152-
":a1234567890123-ats.iotdata:path/topics/$aws/things/{thingName}/shadow/name/{shadowName}/update",
1152+
":a1234567890123-ats.iotdata:path/things/{thingName}/shadow?name={shadowName}",
11531153
],
11541154
],
11551155
},
@@ -1426,7 +1426,7 @@ Object {
14261426
},
14271427
"Type": "AWS::ApiGateway::RestApi",
14281428
},
1429-
"testapigatewayiotdefaultparams1RestApiDeploymentA41826E842fdfa87f4c5fd8d102b65b5d57315bf": Object {
1429+
"testapigatewayiotdefaultparams1RestApiDeploymentA41826E8e39ca7e089a812d3e472c9f3a4f54ab6": Object {
14301430
"DependsOn": Array [
14311431
"testapigatewayiotdefaultparams1awsapigatewayiotreqval77A8A6B3",
14321432
"testapigatewayiotdefaultparams1RestApimessagetopiclevel1topiclevel2topiclevel3topiclevel4topiclevel5topiclevel6topiclevel7POSTEA8D5DCC",
@@ -1480,7 +1480,7 @@ Object {
14801480
"Format": "{\\"requestId\\":\\"$context.requestId\\",\\"ip\\":\\"$context.identity.sourceIp\\",\\"user\\":\\"$context.identity.user\\",\\"caller\\":\\"$context.identity.caller\\",\\"requestTime\\":\\"$context.requestTime\\",\\"httpMethod\\":\\"$context.httpMethod\\",\\"resourcePath\\":\\"$context.resourcePath\\",\\"status\\":\\"$context.status\\",\\"protocol\\":\\"$context.protocol\\",\\"responseLength\\":\\"$context.responseLength\\"}",
14811481
},
14821482
"DeploymentId": Object {
1483-
"Ref": "testapigatewayiotdefaultparams1RestApiDeploymentA41826E842fdfa87f4c5fd8d102b65b5d57315bf",
1483+
"Ref": "testapigatewayiotdefaultparams1RestApiDeploymentA41826E8e39ca7e089a812d3e472c9f3a4f54ab6",
14841484
},
14851485
"MethodSettings": Array [
14861486
Object {
@@ -2438,7 +2438,7 @@ Object {
24382438
Object {
24392439
"Ref": "AWS::Region",
24402440
},
2441-
":a1234567890123-ats.iotdata:path/topics/$aws/things/{thingName}/shadow/name/{shadowName}/update",
2441+
":a1234567890123-ats.iotdata:path/things/{thingName}/shadow?name={shadowName}",
24422442
],
24432443
],
24442444
},
@@ -2654,7 +2654,7 @@ Object {
26542654
},
26552655
"Type": "AWS::ApiGateway::RestApi",
26562656
},
2657-
"testapigatewayiotdefaultparamsRestApiDeployment6F0A726491c3cebaebe16e6aef9f0e18c9bad829": Object {
2657+
"testapigatewayiotdefaultparamsRestApiDeployment6F0A72642be191b13419704d5b213ba9355d9e2c": Object {
26582658
"DependsOn": Array [
26592659
"testapigatewayiotdefaultparamsawsapigatewayiotreqval9B598042",
26602660
"testapigatewayiotdefaultparamsRestApimessagetopiclevel1topiclevel2topiclevel3topiclevel4topiclevel5topiclevel6topiclevel7POST9DC33B4A",
@@ -2708,7 +2708,7 @@ Object {
27082708
"Format": "{\\"requestId\\":\\"$context.requestId\\",\\"ip\\":\\"$context.identity.sourceIp\\",\\"user\\":\\"$context.identity.user\\",\\"caller\\":\\"$context.identity.caller\\",\\"requestTime\\":\\"$context.requestTime\\",\\"httpMethod\\":\\"$context.httpMethod\\",\\"resourcePath\\":\\"$context.resourcePath\\",\\"status\\":\\"$context.status\\",\\"protocol\\":\\"$context.protocol\\",\\"responseLength\\":\\"$context.responseLength\\"}",
27092709
},
27102710
"DeploymentId": Object {
2711-
"Ref": "testapigatewayiotdefaultparamsRestApiDeployment6F0A726491c3cebaebe16e6aef9f0e18c9bad829",
2711+
"Ref": "testapigatewayiotdefaultparamsRestApiDeployment6F0A72642be191b13419704d5b213ba9355d9e2c",
27122712
},
27132713
"MethodSettings": Array [
27142714
Object {
@@ -3666,7 +3666,7 @@ Object {
36663666
Object {
36673667
"Ref": "AWS::Region",
36683668
},
3669-
":a1234567890123-ats.iotdata:path/topics/$aws/things/{thingName}/shadow/name/{shadowName}/update",
3669+
":a1234567890123-ats.iotdata:path/things/{thingName}/shadow?name={shadowName}",
36703670
],
36713671
],
36723672
},
@@ -4003,7 +4003,7 @@ Object {
40034003
},
40044004
"Type": "AWS::ApiGateway::ApiKey",
40054005
},
4006-
"testapigatewayiotoverridenparamsRestApiDeployment447F79B713a23a348620407d37bb49f3e581de39": Object {
4006+
"testapigatewayiotoverridenparamsRestApiDeployment447F79B761c5af75443406b18218017d90499171": Object {
40074007
"DependsOn": Array [
40084008
"testapigatewayiotoverridenparamsawsapigatewayiotreqval6F651A38",
40094009
"testapigatewayiotoverridenparamsRestApimessagetopiclevel1topiclevel2topiclevel3topiclevel4topiclevel5topiclevel6topiclevel7POST78BF6C48",
@@ -4057,7 +4057,7 @@ Object {
40574057
"Format": "{\\"requestId\\":\\"$context.requestId\\",\\"ip\\":\\"$context.identity.sourceIp\\",\\"user\\":\\"$context.identity.user\\",\\"caller\\":\\"$context.identity.caller\\",\\"requestTime\\":\\"$context.requestTime\\",\\"httpMethod\\":\\"$context.httpMethod\\",\\"resourcePath\\":\\"$context.resourcePath\\",\\"status\\":\\"$context.status\\",\\"protocol\\":\\"$context.protocol\\",\\"responseLength\\":\\"$context.responseLength\\"}",
40584058
},
40594059
"DeploymentId": Object {
4060-
"Ref": "testapigatewayiotoverridenparamsRestApiDeployment447F79B713a23a348620407d37bb49f3e581de39",
4060+
"Ref": "testapigatewayiotoverridenparamsRestApiDeployment447F79B761c5af75443406b18218017d90499171",
40614061
},
40624062
"MethodSettings": Array [
40634063
Object {
@@ -5126,7 +5126,7 @@ Object {
51265126
Object {
51275127
"Ref": "AWS::Region",
51285128
},
5129-
":a1234567890123-ats.iotdata:path/topics/$aws/things/{thingName}/shadow/name/{shadowName}/update",
5129+
":a1234567890123-ats.iotdata:path/things/{thingName}/shadow?name={shadowName}",
51305130
],
51315131
],
51325132
},

source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.defaultParams.expected.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"Name": "RestApi"
103103
}
104104
},
105-
"testapigatewayiotRestApiDeploymentA8FCF505535c339e7b0d42f80425dcbceee2ad80": {
105+
"testapigatewayiotRestApiDeploymentA8FCF5057ffc77ee6fd9f35b0f1c353f67d36988": {
106106
"Type": "AWS::ApiGateway::Deployment",
107107
"Properties": {
108108
"RestApiId": {
@@ -160,7 +160,7 @@
160160
"Format": "{\"requestId\":\"$context.requestId\",\"ip\":\"$context.identity.sourceIp\",\"user\":\"$context.identity.user\",\"caller\":\"$context.identity.caller\",\"requestTime\":\"$context.requestTime\",\"httpMethod\":\"$context.httpMethod\",\"resourcePath\":\"$context.resourcePath\",\"status\":\"$context.status\",\"protocol\":\"$context.protocol\",\"responseLength\":\"$context.responseLength\"}"
161161
},
162162
"DeploymentId": {
163-
"Ref": "testapigatewayiotRestApiDeploymentA8FCF505535c339e7b0d42f80425dcbceee2ad80"
163+
"Ref": "testapigatewayiotRestApiDeploymentA8FCF5057ffc77ee6fd9f35b0f1c353f67d36988"
164164
},
165165
"MethodSettings": [
166166
{
@@ -1105,7 +1105,7 @@
11051105
{
11061106
"Ref": "AWS::Region"
11071107
},
1108-
":a1234567890123-ats.iotdata:path/topics/$aws/things/{thingName}/shadow/name/{shadowName}/update"
1108+
":a1234567890123-ats.iotdata:path/things/{thingName}/shadow?name={shadowName}"
11091109
]
11101110
]
11111111
}

source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.overrideParams.expected.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"Name": "RestApi-Regional"
105105
}
106106
},
107-
"testapigatewayiotRestApiDeploymentA8FCF505535480f8f4007e5a78b1daec359b8b7c": {
107+
"testapigatewayiotRestApiDeploymentA8FCF5050f1987d2a995276f2146de670d9fa976": {
108108
"Type": "AWS::ApiGateway::Deployment",
109109
"Properties": {
110110
"RestApiId": {
@@ -162,7 +162,7 @@
162162
"Format": "{\"requestId\":\"$context.requestId\",\"ip\":\"$context.identity.sourceIp\",\"user\":\"$context.identity.user\",\"caller\":\"$context.identity.caller\",\"requestTime\":\"$context.requestTime\",\"httpMethod\":\"$context.httpMethod\",\"resourcePath\":\"$context.resourcePath\",\"status\":\"$context.status\",\"protocol\":\"$context.protocol\",\"responseLength\":\"$context.responseLength\"}"
163163
},
164164
"DeploymentId": {
165-
"Ref": "testapigatewayiotRestApiDeploymentA8FCF505535480f8f4007e5a78b1daec359b8b7c"
165+
"Ref": "testapigatewayiotRestApiDeploymentA8FCF5050f1987d2a995276f2146de670d9fa976"
166166
},
167167
"MethodSettings": [
168168
{
@@ -1196,7 +1196,7 @@
11961196
{
11971197
"Ref": "AWS::Region"
11981198
},
1199-
":a1234567890123-ats.iotdata:path/topics/$aws/things/{thingName}/shadow/name/{shadowName}/update"
1199+
":a1234567890123-ats.iotdata:path/things/{thingName}/shadow?name={shadowName}"
12001200
]
12011201
]
12021202
}

source/patterns/@aws-solutions-constructs/aws-apigateway-iot/test/integ.override_auth_api_keys.expected.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"Name": "RestApi"
103103
}
104104
},
105-
"testapigatewayiotRestApiDeploymentA8FCF505fa743175b2c4b4b27f095f5b2cd7fe2c": {
105+
"testapigatewayiotRestApiDeploymentA8FCF50585c5ccbacf1bb79394cb3eea4f66a01a": {
106106
"Type": "AWS::ApiGateway::Deployment",
107107
"Properties": {
108108
"RestApiId": {
@@ -160,7 +160,7 @@
160160
"Format": "{\"requestId\":\"$context.requestId\",\"ip\":\"$context.identity.sourceIp\",\"user\":\"$context.identity.user\",\"caller\":\"$context.identity.caller\",\"requestTime\":\"$context.requestTime\",\"httpMethod\":\"$context.httpMethod\",\"resourcePath\":\"$context.resourcePath\",\"status\":\"$context.status\",\"protocol\":\"$context.protocol\",\"responseLength\":\"$context.responseLength\"}"
161161
},
162162
"DeploymentId": {
163-
"Ref": "testapigatewayiotRestApiDeploymentA8FCF505fa743175b2c4b4b27f095f5b2cd7fe2c"
163+
"Ref": "testapigatewayiotRestApiDeploymentA8FCF50585c5ccbacf1bb79394cb3eea4f66a01a"
164164
},
165165
"MethodSettings": [
166166
{
@@ -1194,7 +1194,7 @@
11941194
{
11951195
"Ref": "AWS::Region"
11961196
},
1197-
":a1234567890123-ats.iotdata:path/topics/$aws/things/{thingName}/shadow/name/{shadowName}/update"
1197+
":a1234567890123-ats.iotdata:path/things/{thingName}/shadow?name={shadowName}"
11981198
]
11991199
]
12001200
}

0 commit comments

Comments
 (0)