https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html перечисляет, что вы можете добавить FilterPolicy в атрибуты, но когда я это делаю, я получаю:
index.js:1 UnexpectedParameter: Unexpected key 'FilterPolicy' found in params
at ParamValidator.fail (http://localhost:3000/static/js/1.chunk.js:238942:37)
at ParamValidator.validateStructure (http://localhost:3000/static/js/1.chunk.js:238969:14)
at ParamValidator.validateMember (http://localhost:3000/static/js/1.chunk.js:238978:21)
at ParamValidator.validate (http://localhost:3000/static/js/1.chunk.js:238926:10)
at Request.VALIDATE_PARAMETERS (http://localhost:3000/static/js/1.chunk.js:237086:42)
at Request.callListeners (http://localhost:3000/static/js/1.chunk.js:242603:20)
at callNextListener (http://localhost:3000/static/js/1.chunk.js:242590:12)
at http://localhost:3000/static/js/1.chunk.js:237039:9
at finish (http://localhost:3000/static/js/1.chunk.js:232861:7)
at getStaticCredentials (http://localhost:3000/static/js/1.chunk.js:232890:7)
static async AddAlert(devEui, protocol, endpoint)
{
var params = {
Protocol: protocol, /* required */
TopicArn: 'arn:aws:sns:us-east-1:123456789:Alert', /* required */
FilterPolicy: {
"dev_eui": [
devEui
]
},
Endpoint: endpoint,
ReturnSubscriptionArn: true
};
var promise = new AWS.SNS({apiVersion: '2010-03-31'})
.subscribe(params).promise()
.catch(
function(err) {
console.error(err, err.stack);
throw err;
})
return promise;
}