lib/elb/doesLoadBalancerExist.js
function doesLoadBalancerExist (elb, loadBalancerName) {
  function inspectError (err) {
    if (err.code === 'LoadBalancerNotFound') {
      return false
    }

    return Bluebird.reject(err)
  }

  return elb
    .describeLoadBalancersPromised({
      LoadBalancerNames: [ loadBalancerName ]
    })
    .then(_.constant(true))
    .error(inspectError)
}
function doesLoadBalancerExist (elb, loadBalancerName) {
  function inspectError (err) {
    if (err.code === 'LoadBalancerNotFound') {
      return false
    }

    return Bluebird.reject(err)
  }

  return elb
    .describeLoadBalancersPromised({
      LoadBalancerNames: [ loadBalancerName ]
    })
    .then(_.constant(true))
    .error(inspectError)
}
function doesLoadBalancerExist ( elb , loadBalancerName ) { function inspectError ( err ) { if ( err . code === 'LoadBalancerNotFound' ) { return false } return Bluebird . reject ( err ) } return elb . describeLoadBalancersPromised ( { LoadBalancerNames : [ loadBalancerName ] } ) . then ( _ . constant ( true ) ) . error ( inspectError ) }
Uses the ELB.describeLoadBalancers method to check the existence of a load
balancer. If the list of LoadBalancerDescriptions returned by the request
is empty, doesLoadBalancerExist is resolved as False, if it's not empty it
is resolved as True.

@param elb
@param loadBalancerName
@returns {Promise}
Uses the ELB . describeLoadBalancers method to check the existence of a load balancer . If the list of LoadBalancerDescriptions returned by the request is empty doesLoadBalancerExist is resolved as False if it s not empty it is resolved as True .