Skip to content

Commit a5e9c6a

Browse files
committed
Making the iot policy documents an array of strings to match the documentation
1 parent 1405648 commit a5e9c6a

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

events/iot.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ type IoTCustomAuthorizerRequest struct {
77

88
// IoTCustomAuthorizerResponse represents the expected format of an IoT device gateway authorization response.
99
type IoTCustomAuthorizerResponse struct {
10-
IsAuthenticated bool `json:"isAuthenticated"`
11-
PrincipalID string `json:"principalId"`
12-
DisconnectAfterInSeconds int32 `json:"disconnectAfterInSeconds"`
13-
RefreshAfterInSeconds int32 `json:"refreshAfterInSeconds"`
14-
PolicyDocuments []IoTCustomAuthorizerPolicy `json:"policyDocuments"`
15-
Context map[string]interface{} `json:"context,omitempty"`
10+
IsAuthenticated bool `json:"isAuthenticated"`
11+
PrincipalID string `json:"principalId"`
12+
DisconnectAfterInSeconds int32 `json:"disconnectAfterInSeconds"`
13+
RefreshAfterInSeconds int32 `json:"refreshAfterInSeconds"`
14+
PolicyDocuments []string `json:"policyDocuments"`
15+
Context map[string]interface{} `json:"context,omitempty"`
1616
}
1717

18-
// IoTCustomAuthorizerPolicy represents an IAM policy
18+
// IoTCustomAuthorizerPolicy represents an IAM policy. PolicyDocuments is an array of IoTCustomAuthorizerPolicy JSON strings
1919
type IoTCustomAuthorizerPolicy struct {
2020
Version string
2121
Statement []IAMPolicyStatement
2222
}
23-

events/testdata/iot-custom-auth-response.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@
44
"disconnectAfterInSeconds": 86400,
55
"refreshAfterInSeconds": 300,
66
"policyDocuments": [
7-
{ "Version": "2012-10-17", "Statement": [
8-
{
9-
"Action": ["iot:Subscribe"],
10-
"Effect": "Allow",
11-
"Resource": ["*"]
12-
}
13-
]
14-
}
7+
"{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Action\": [\"iot:Subscribe\"], \"Effect\": \"Allow\", \"Resource\": [\"*\"] } ] }"
158
],
169
"context": {
1710
"username" : "johnDoe123",

0 commit comments

Comments
 (0)