lambda/src/index.js
// 2) perform an action on that coordinator 
2) perform an action on that coordinator
2 ) perform an action on that coordinator
function actOnCoordinator(options, actionPath, room, onCompleteFun) {
    options.path = '/zones';
    console.log("getting zones...");
    var handleZonesResponse = function (error, responseJson) {
        if (!error) { 
            responseJson = JSON.parse(responseJson);
            var coordinatorRoomName = findCoordinatorForRoom(responseJson, room);
            options.path = '/' + encodeURIComponent(coordinatorRoomName) + actionPath;
            console.log(options.path);
            httpreq(options, onCompleteFun);
        }    
        else { 
            onCompleteFun(error);
        }
    }
    httpreq(options, handleZonesResponse);
}
function actOnCoordinator ( options , actionPath , room , onCompleteFun ) { options . path = '/zones' ; console . log ( "getting zones..." ) ; var handleZonesResponse = function ( error , responseJson ) { if ( ! error ) { responseJson = JSON . parse ( responseJson ) ; var coordinatorRoomName = findCoordinatorForRoom ( responseJson , room ) ; options . path = '/' + encodeURIComponent ( coordinatorRoomName ) + actionPath ; console . log ( options . path ) ; httpreq ( options , onCompleteFun ) ; } else { onCompleteFun ( error ) ; } } httpreq ( options , handleZonesResponse ) ; }
2) perform an action on that coordinator
2 ) perform an action on that coordinator