lib/ec2.js
function dataFormatter(data) {
	var instanceInfoArray = [];
	var instanceInfoObject = {};

	var reservations = data.Reservations;
	for (var reservation in reservations) {
		var instances = reservations[reservation].Instances;
		for (var instance in instances) {
			var tags = instances[instance].Tags;
			for (var tag in tags) {
				if (tags[tag].Key === 'Name') {
					instanceInfoObject = _.assign(instanceInfoObject,
					{Name: tags[tag].Value});
				}
			}
			instanceInfoObject = _.assign(instanceInfoObject,
				{State: instances[instance].State.Name},
				{id: instances[instance].InstanceId});
			instanceInfoArray.push(instanceInfoObject);
			instanceInfoObject = {};
		}
	}
	return Promise.resolve(instanceInfoArray);
}
function dataFormatter(data) {
	var instanceInfoArray = [];
	var instanceInfoObject = {};

	var reservations = data.Reservations;
	for (var reservation in reservations) {
		var instances = reservations[reservation].Instances;
		for (var instance in instances) {
			var tags = instances[instance].Tags;
			for (var tag in tags) {
				if (tags[tag].Key === 'Name') {
					instanceInfoObject = _.assign(instanceInfoObject,
					{Name: tags[tag].Value});
				}
			}
			instanceInfoObject = _.assign(instanceInfoObject,
				{State: instances[instance].State.Name},
				{id: instances[instance].InstanceId});
			instanceInfoArray.push(instanceInfoObject);
			instanceInfoObject = {};
		}
	}
	return Promise.resolve(instanceInfoArray);
}
function dataFormatter ( data ) { var instanceInfoArray = [ ] ; var instanceInfoObject = { } ; var reservations = data . Reservations ; for ( var reservation in reservations ) { var instances = reservations [ reservation ] . Instances ; for ( var instance in instances ) { var tags = instances [ instance ] . Tags ; for ( var tag in tags ) { if ( tags [ tag ] . Key === 'Name' ) { instanceInfoObject = _ . assign ( instanceInfoObject , { Name : tags [ tag ] . Value } ) ; } } instanceInfoObject = _ . assign ( instanceInfoObject , { State : instances [ instance ] . State . Name } , { id : instances [ instance ] . InstanceId } ) ; instanceInfoArray . push ( instanceInfoObject ) ; instanceInfoObject = { } ; } } return Promise . resolve ( instanceInfoArray ) ; }
Helper function to format data returned by AWS EC2 queries.
Helper function to format data returned by AWS EC2 queries .