infra/aws/cluster/lb.js
function (options, mCb) {
		const aws = options.infra.api;
		getElbMethod(options.params.elbType || 'classic', 'list', (elbResponse) => {
			const elb = getConnector({
				api: elbResponse.api,
				region: options.params.region,
				keyId: aws.keyId,
				secretAccessKey: aws.secretAccessKey
			});
			const ec2 = getConnector({
				api: 'ec2',
				region: options.params.region,
				keyId: aws.keyId,
				secretAccessKey: aws.secretAccessKey
			});
			elb[elbResponse.method]({}, function (err, response) {
				if (err) {
					return mCb(err);
				}
				async.map(response.LoadBalancerDescriptions, function (lb, callback) {
					async.parallel({
						subnets: function (callback) {
							if (lb && lb.Subnets && Array.isArray(lb.Subnets) && lb.Subnets.length > 0) {
								let sParams = {SubnetIds: lb.Subnets};
								ec2.describeSubnets(sParams, callback);
							}
							else {
								return callback(null, null);
							}
						},
						instances: function (callback) {
							let iParams = {LoadBalancerName: lb.LoadBalancerName};
							elb.describeInstanceHealth(iParams, callback);
						}
					}, function (err, results) {
						return callback(err, helper[elbResponse.helper]({
							lb,
							region: options.params.region,
							subnets: results.subnets ? results.subnets.Subnets : [],
							instances: results.instances ? results.instances.InstanceStates : []
						}));
					});
				}, mCb);
			});
		});
	}
function (options, mCb) {
		const aws = options.infra.api;
		getElbMethod(options.params.elbType || 'classic', 'list', (elbResponse) => {
			const elb = getConnector({
				api: elbResponse.api,
				region: options.params.region,
				keyId: aws.keyId,
				secretAccessKey: aws.secretAccessKey
			});
			const ec2 = getConnector({
				api: 'ec2',
				region: options.params.region,
				keyId: aws.keyId,
				secretAccessKey: aws.secretAccessKey
			});
			elb[elbResponse.method]({}, function (err, response) {
				if (err) {
					return mCb(err);
				}
				async.map(response.LoadBalancerDescriptions, function (lb, callback) {
					async.parallel({
						subnets: function (callback) {
							if (lb && lb.Subnets && Array.isArray(lb.Subnets) && lb.Subnets.length > 0) {
								let sParams = {SubnetIds: lb.Subnets};
								ec2.describeSubnets(sParams, callback);
							}
							else {
								return callback(null, null);
							}
						},
						instances: function (callback) {
							let iParams = {LoadBalancerName: lb.LoadBalancerName};
							elb.describeInstanceHealth(iParams, callback);
						}
					}, function (err, results) {
						return callback(err, helper[elbResponse.helper]({
							lb,
							region: options.params.region,
							subnets: results.subnets ? results.subnets.Subnets : [],
							instances: results.instances ? results.instances.InstanceStates : []
						}));
					});
				}, mCb);
			});
		});
	}
function ( options , mCb ) { const aws = options . infra . api ; getElbMethod ( options . params . elbType || 'classic' , 'list' , ( elbResponse ) => { const elb = getConnector ( { api : elbResponse . api , region : options . params . region , keyId : aws . keyId , secretAccessKey : aws . secretAccessKey } ) ; const ec2 = getConnector ( { api : 'ec2' , region : options . params . region , keyId : aws . keyId , secretAccessKey : aws . secretAccessKey } ) ; elb [ elbResponse . method ] ( { } , function ( err , response ) { if ( err ) { return mCb ( err ) ; } async . map ( response . LoadBalancerDescriptions , function ( lb , callback ) { async . parallel ( { subnets : function ( callback ) { if ( lb && lb . Subnets && Array . isArray ( lb . Subnets ) && lb . Subnets . length > 0 ) { let sParams = { SubnetIds : lb . Subnets } ; ec2 . describeSubnets ( sParams , callback ) ; } else { return callback ( null , null ) ; } } , instances : function ( callback ) { let iParams = { LoadBalancerName : lb . LoadBalancerName } ; elb . describeInstanceHealth ( iParams , callback ) ; } } , function ( err , results ) { return callback ( err , helper [ elbResponse . helper ] ( { lb , region : options . params . region , subnets : results . subnets ? results . subnets . Subnets : [ ] , instances : results . instances ? results . instances . InstanceStates : [ ] } ) ) ; } ) ; } , mCb ) ; } ) ; } ) ; }
This method return a list of Load Balancers
@param options
@param mCb
This method return a list of Load Balancers