function initSNSSubscribe()

in browser/scripts/gov-cloud-import-browser.js [345:375]


function initSNSSubscribe(lambda, name){
    return new Promise((resolve, reject) => {
        let snsProtocol = document.getElementById("snsProtocol").value;
        let snsTopic = document.getElementById("snsTopic").value;
        let snsRegion = document.getElementById("snsRegion").value;
        let snsEndpoint = document.getElementById("snsEndpoint").value;

        //Params for Lambda invoke
        let params = {
            FunctionName : name,
            InvocationType : 'RequestResponse',
            LogType : 'Tail',
            Payload : JSON.stringify({
                "protocol": snsProtocol,
                "topic": snsTopic,
                "endpoint": snsEndpoint,
                "region": snsRegion
            })
        };
        // Call the Lambda function
        lambda.invoke(params, function(err, data) {
            if (err) {
                console.log(err.message);
                resolve(err.message)
            } else {
                document.getElementById("snsSubscribe").innerHTML += data.Payload+'<br>';
                resolve(data.Payload);
            }
        });
    });
}