mirror of https://github.com/apache/jclouds.git
elb usage cleanup
This commit is contained in:
parent
0f0d65f471
commit
0d82a61142
|
@ -55,25 +55,25 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface InstanceAsyncClient {
|
||||
|
||||
/**
|
||||
* @see InstanceClient#listInstanceStatesOfLoadBalancer(String)
|
||||
* @see InstanceClient#getStateOfInstancesOfLoadBalancer(String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/")
|
||||
@XMLResponseParser(DescribeLoadBalancerPoliciesResultHandler.class)
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
@FormParams(keys = "Action", values = "DescribeInstanceHealth")
|
||||
ListenableFuture<Set<InstanceState>> listInstanceStatesOfLoadBalancer(
|
||||
ListenableFuture<Set<InstanceState>> getStateOfInstancesOfLoadBalancer(
|
||||
@FormParam("LoadBalancerName") String loadBalancerName);
|
||||
|
||||
/**
|
||||
* @see InstanceClient#listInstanceStatesOfLoadBalancer(Iterable<String>, String)
|
||||
* @see InstanceClient#getStateOfInstancesOfLoadBalancer(Iterable<String>, String)
|
||||
*/
|
||||
@POST
|
||||
@Path("/")
|
||||
@XMLResponseParser(DescribeLoadBalancerPoliciesResultHandler.class)
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
@FormParams(keys = "Action", values = "DescribeInstanceHealth")
|
||||
ListenableFuture<Set<InstanceState>> listInstanceStatesOfLoadBalancer(
|
||||
ListenableFuture<Set<InstanceState>> getStateOfInstancesOfLoadBalancer(
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) Iterable<String> instanceIds,
|
||||
@FormParam("LoadBalancerName") String loadBalancerName);
|
||||
|
||||
|
@ -88,6 +88,18 @@ public interface InstanceAsyncClient {
|
|||
ListenableFuture<Set<String>> registerInstancesWithLoadBalancer(
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) Iterable<String> instanceIds,
|
||||
@FormParam("LoadBalancerName") String loadBalancerName);
|
||||
|
||||
|
||||
/**
|
||||
* @see InstanceClient#registerInstanceWithLoadBalancer
|
||||
*/
|
||||
@POST
|
||||
@Path("/")
|
||||
@XMLResponseParser(InstancesResultHandler.class)
|
||||
@FormParams(keys = ACTION, values = "RegisterInstancesWithLoadBalancer")
|
||||
ListenableFuture<Set<String>> registerInstanceWithLoadBalancer(
|
||||
@FormParam("Instances.member.1.InstanceId") String instanceId,
|
||||
@FormParam("LoadBalancerName") String loadBalancerName);
|
||||
|
||||
/**
|
||||
* @see InstanceClient#deregisterInstancesFromLoadBalancer
|
||||
|
@ -100,5 +112,14 @@ public interface InstanceAsyncClient {
|
|||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) Iterable<String> instanceIds,
|
||||
@FormParam("LoadBalancerName") String loadBalancerName);
|
||||
|
||||
|
||||
/**
|
||||
* @see InstanceClient#deregisterInstanceFromLoadBalancer
|
||||
*/
|
||||
@POST
|
||||
@Path("/")
|
||||
@XMLResponseParser(InstancesResultHandler.class)
|
||||
@FormParams(keys = ACTION, values = "DeregisterInstancesFromLoadBalancer")
|
||||
ListenableFuture<Set<String>> deregisterInstanceFromLoadBalancer(
|
||||
@FormParam("Instances.member.1.InstanceId") String instanceId,
|
||||
@FormParam("LoadBalancerName") String loadBalancerName);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.jclouds.elb.domain.InstanceState;
|
|||
* <p/>
|
||||
*
|
||||
* @see <a href="http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/APIReference" />
|
||||
* @see InstanceAsyncClient
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
|
||||
|
@ -49,7 +50,7 @@ public interface InstanceClient {
|
|||
*
|
||||
* @return state of all instances of the load balancer
|
||||
*/
|
||||
Set<InstanceState> listInstanceStatesOfLoadBalancer(String loadBalancerName);
|
||||
Set<InstanceState> getStateOfInstancesOfLoadBalancer(String loadBalancerName);
|
||||
|
||||
/**
|
||||
* Returns the current state of the instances of the specified LoadBalancer.
|
||||
|
@ -68,7 +69,7 @@ public interface InstanceClient {
|
|||
*
|
||||
* @return state of all instances of the load balancer
|
||||
*/
|
||||
Set<InstanceState> listInstanceStatesOfLoadBalancer(Iterable<String> instanceIds, String loadBalancerName);
|
||||
Set<InstanceState> getStateOfInstancesOfLoadBalancer(Iterable<String> instanceIds, String loadBalancerName);
|
||||
|
||||
/**
|
||||
* Adds new instances to the LoadBalancer.
|
||||
|
@ -110,6 +111,8 @@ public interface InstanceClient {
|
|||
* @return instanceIds registered with load balancer
|
||||
*/
|
||||
Set<String> registerInstancesWithLoadBalancer(Iterable<String> instanceIds, String loadBalancerName);
|
||||
|
||||
Set<String> registerInstanceWithLoadBalancer(String instanceId, String loadBalancerName);
|
||||
|
||||
/**
|
||||
* Deregisters instances from the LoadBalancer. Once the instance is deregistered, it will stop
|
||||
|
@ -128,4 +131,7 @@ public interface InstanceClient {
|
|||
* @return instanceIds still registered with load balancer
|
||||
*/
|
||||
Set<String> deregisterInstancesFromLoadBalancer(Iterable<String> instanceIds, String loadBalancerName);
|
||||
|
||||
Set<String> deregisterInstanceFromLoadBalancer(String instanceId, String loadBalancerName);
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import static org.jclouds.util.SaxUtils.equalsOrSuffix;
|
|||
|
||||
import org.jclouds.elb.domain.ListenerWithPolicies;
|
||||
import org.jclouds.elb.domain.Protocol;
|
||||
import org.jclouds.elb.domain.SecurityGroupAndOwner;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
|
|
@ -47,7 +47,7 @@ public class InstanceClientLiveTest extends BaseELBClientLiveTest {
|
|||
@Test
|
||||
protected void testListInstanceStates() {
|
||||
for (LoadBalancer loadBalancer : context.getApi().getLoadBalancerClientForRegion(null).list()) {
|
||||
Set<InstanceState> response = client().listInstanceStatesOfLoadBalancer(loadBalancer.getName());
|
||||
Set<InstanceState> response = client().getStateOfInstancesOfLoadBalancer(loadBalancer.getName());
|
||||
|
||||
for (InstanceState instanceState : response) {
|
||||
checkInstanceState(instanceState);
|
||||
|
@ -56,7 +56,7 @@ public class InstanceClientLiveTest extends BaseELBClientLiveTest {
|
|||
if (response.size() > 0) {
|
||||
InstanceState instanceState = response.iterator().next();
|
||||
Assert.assertEquals(
|
||||
client().listInstanceStatesOfLoadBalancer(ImmutableSet.of(instanceState.getInstanceId()),
|
||||
client().getStateOfInstancesOfLoadBalancer(ImmutableSet.of(instanceState.getInstanceId()),
|
||||
loadBalancer.getName()), instanceState);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue