Skip to content

Commit

Permalink
enable cross zone load balancing on ELB creation
Browse files Browse the repository at this point in the history
  • Loading branch information
claymccoy committed Oct 1, 2014
1 parent 1304748 commit 4d527b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.amazonaws.services.elasticloadbalancing.model.AttachLoadBalancerToSub
import com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest
import com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerListenersRequest
import com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerRequest
import com.amazonaws.services.elasticloadbalancing.model.CrossZoneLoadBalancing
import com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerListenersRequest
import com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest
import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest
Expand All @@ -35,7 +36,9 @@ import com.amazonaws.services.elasticloadbalancing.model.EnableAvailabilityZones
import com.amazonaws.services.elasticloadbalancing.model.Instance
import com.amazonaws.services.elasticloadbalancing.model.InstanceState
import com.amazonaws.services.elasticloadbalancing.model.Listener
import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerAttributes
import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription
import com.amazonaws.services.elasticloadbalancing.model.ModifyLoadBalancerAttributesRequest
import com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest
import com.amazonaws.services.elasticloadbalancing.model.SourceSecurityGroup
import com.google.common.collect.ArrayListMultimap
Expand Down Expand Up @@ -233,7 +236,11 @@ class AwsLoadBalancerService implements CacheInitializer, InitializingBean {
} else {
request.withAvailabilityZones(zoneList)
}
awsClient.by(userContext.region).createLoadBalancer(request) // has result
def client = awsClient.by(userContext.region)
client.createLoadBalancer(request)
def modifyRequest = new ModifyLoadBalancerAttributesRequest(loadBalancerName: name, loadBalancerAttributes:
new LoadBalancerAttributes(crossZoneLoadBalancing: new CrossZoneLoadBalancing(enabled: true)))
client.modifyLoadBalancerAttributes(modifyRequest)
}, Link.to(EntityType.loadBalancer, name))
getLoadBalancer(userContext, name)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ import com.amazonaws.services.elasticloadbalancing.model.InstanceState
import com.amazonaws.services.elasticloadbalancing.model.Listener
import com.amazonaws.services.elasticloadbalancing.model.ListenerDescription
import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription
import com.amazonaws.services.elasticloadbalancing.model.ModifyLoadBalancerAttributesRequest
import com.amazonaws.services.elasticloadbalancing.model.ModifyLoadBalancerAttributesResult
import com.amazonaws.services.elasticloadbalancing.model.Policies
import com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest
import com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerResult
Expand Down Expand Up @@ -133,6 +135,10 @@ class MockAmazonElasticLoadBalancingClient extends AmazonElasticLoadBalancingCli

CreateLoadBalancerResult createLoadBalancer(CreateLoadBalancerRequest createLoadBalancerRequest) { null }

ModifyLoadBalancerAttributesResult modifyLoadBalancerAttributes(ModifyLoadBalancerAttributesRequest request) {
null
}

EnableAvailabilityZonesForLoadBalancerResult enableAvailabilityZonesForLoadBalancer(
EnableAvailabilityZonesForLoadBalancerRequest enableAvailabilityZonesForLoadBalancerRequest) { null }

Expand Down

0 comments on commit 4d527b5

Please sign in to comment.