func buildPolicy()

in iot-onboarding-service/src/cloudrack-lambda-core/iot/iot.go [227:251]


func buildPolicy(topic string, region string, account string) string {
	return `{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:Connect"
            ],
            "Resource": [
                "arn:aws:iot:` + region + `:` + account + `:client/${iot:Connection.Thing.ThingName}"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "iot:Publish"
            ],
            "Resource": [
                "arn:aws:iot:` + region + `:` + account + `:topic/` + topic + `/*"
            ]
        }
    ]
}`
}