comments for elb implementation

This commit is contained in:
Adrian Cole 2011-01-06 17:27:26 -08:00
parent 64c83cb6a6
commit 609ac300be
3 changed files with 51 additions and 28 deletions

View File

@ -47,20 +47,26 @@ import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.rest.annotations.XMLResponseParser;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
/** /**
* Provides access to EC2 Elastic Load Balancer via REST API. * Provides access to EC2 Elastic Load Balancer via REST API.
* <p/> * <p/>
* *
* @see <a href="http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/APIReference/">ELB
* documentation</a>
* @author Lili Nader * @author Lili Nader
*/ */
@Beta
@RequestFilters(FormSigner.class) @RequestFilters(FormSigner.class)
@FormParams(keys = VERSION, values = ELBAsyncClient.VERSION) @FormParams(keys = VERSION, values = ELBAsyncClient.VERSION)
@VirtualHost @VirtualHost
public interface ELBAsyncClient { public interface ELBAsyncClient {
public static final String VERSION = "2010-07-01"; public static final String VERSION = "2010-07-01";
// TODO: there are a lot of missing methods
/** /**
* @see ELBClient#createLoadBalancerInRegion * @see ELBClient#createLoadBalancerInRegion
*/ */
@ -68,6 +74,9 @@ public interface ELBAsyncClient {
@Path("/") @Path("/")
@XMLResponseParser(CreateLoadBalancerResponseHandler.class) @XMLResponseParser(CreateLoadBalancerResponseHandler.class)
@FormParams(keys = ACTION, values = "CreateLoadBalancer") @FormParams(keys = ACTION, values = "CreateLoadBalancer")
@Beta
// TODO:The way this handles arguments needs to be refactored. it needs to deal with collections
// of listeners.
ListenableFuture<String> createLoadBalancerInRegion( ListenableFuture<String> createLoadBalancerInRegion(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region, @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@FormParam("LoadBalancerName") String name, @FormParam("Listeners.member.1.Protocol") String protocol, @FormParam("LoadBalancerName") String name, @FormParam("Listeners.member.1.Protocol") String protocol,

View File

@ -27,12 +27,16 @@ import javax.annotation.Nullable;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.elb.domain.LoadBalancer; import org.jclouds.elb.domain.LoadBalancer;
import com.google.common.annotations.Beta;
/** /**
* Provides access to EC2 Elastic Load Balancer via their REST API. * Provides access to EC2 Elastic Load Balancer via their REST API.
* <p/> * <p/>
* *
* @author Lili Nader * @author Lili Nader
*/ */
@Beta
// see ELBAsyncClient
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
public interface ELBClient { public interface ELBClient {
@ -50,8 +54,10 @@ public interface ELBClient {
* @return dns the DNS name for the load balancer * @return dns the DNS name for the load balancer
* @see <a href="http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/" * @see <a href="http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/"
*/ */
String createLoadBalancerInRegion(@Nullable String region, String name, String protocol, @Beta
int loadBalancerPort, int instancePort, String... availabilityZones); // see ELBAsyncClient
String createLoadBalancerInRegion(@Nullable String region, String name, String protocol, int loadBalancerPort,
int instancePort, String... availabilityZones);
/** /**
* Delete load balancer * Delete load balancer
@ -76,8 +82,7 @@ public interface ELBClient {
* @see <a * @see <a
* href="http://docs.amazonwebservices.com/ElasticLoadBalancing/2009-05-15/DeveloperGuide/" * href="http://docs.amazonwebservices.com/ElasticLoadBalancing/2009-05-15/DeveloperGuide/"
*/ */
Set<String> registerInstancesWithLoadBalancerInRegion(@Nullable String region, String name, Set<String> registerInstancesWithLoadBalancerInRegion(@Nullable String region, String name, String... instanceIds);
String... instanceIds);
/** /**
* Deregister instances with an existing load balancer * Deregister instances with an existing load balancer
@ -91,13 +96,14 @@ public interface ELBClient {
* @see <a * @see <a
* href="http://docs.amazonwebservices.com/ElasticLoadBalancing/2009-05-15/DeveloperGuide/" * href="http://docs.amazonwebservices.com/ElasticLoadBalancing/2009-05-15/DeveloperGuide/"
*/ */
void deregisterInstancesWithLoadBalancerInRegion(@Nullable String region, String name, void deregisterInstancesWithLoadBalancerInRegion(@Nullable String region, String name, String... instanceIds);
String... instanceIds);
/** /**
* Returns a set of elastic load balancers * Returns a set of elastic load balancers
*
* @param region * @param region
* @param loadbalancerNames names associated with the LoadBalancers at creation time. * @param loadbalancerNames
* names associated with the LoadBalancers at creation time.
* @return * @return
*/ */
Set<? extends LoadBalancer> describeLoadBalancersInRegion(@Nullable String region, String... loadbalancerNames); Set<? extends LoadBalancer> describeLoadBalancersInRegion(@Nullable String region, String... loadbalancerNames);

View File

@ -22,18 +22,25 @@ package org.jclouds.elb.domain;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import com.google.common.annotations.Beta;
/** /**
* *
* *
* @author Lili Nader * @author Lili Nader
*/ */
@Beta
// Missing fields, this class is too big, please cut out inner classes into top-level
public class LoadBalancer implements Comparable<LoadBalancer> { public class LoadBalancer implements Comparable<LoadBalancer> {
// Missing: createdTime, healthcheck
private String region; private String region;
private String name; private String name;
private Set<String> instanceIds; private Set<String> instanceIds;
private Set<String> availabilityZones; private Set<String> availabilityZones;
private String dnsName; private String dnsName;
// TODO: this could be cleaned up to be a policy collection of subclasses of Policy. note that
// docs suggest there could be many
private AppCookieStickinessPolicy appCookieStickinessPolicy; private AppCookieStickinessPolicy appCookieStickinessPolicy;
private LBCookieStickinessPolicy lBCookieStickinessPolicy; private LBCookieStickinessPolicy lBCookieStickinessPolicy;
private Set<LoadBalancerListener> loadBalancerListeners; private Set<LoadBalancerListener> loadBalancerListeners;
@ -127,9 +134,9 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
@Override @Override
public String toString() { public String toString() {
return "[region=" + region + ", name=" + name + ", instanceIds=" + instanceIds + ", availabilityZones=" return "[region=" + region + ", name=" + name + ", instanceIds=" + instanceIds + ", availabilityZones="
+ availabilityZones + ", dnsName=" + dnsName + ", appCookieStickinessPolicy=" + appCookieStickinessPolicy + availabilityZones + ", dnsName=" + dnsName + ", appCookieStickinessPolicy="
+ ", lBCookieStickinessPolicy=" + lBCookieStickinessPolicy + ", loadBalancerListeners=" + appCookieStickinessPolicy + ", lBCookieStickinessPolicy=" + lBCookieStickinessPolicy
+ loadBalancerListeners + "]"; + ", loadBalancerListeners=" + loadBalancerListeners + "]";
} }
@Override @Override
@ -336,6 +343,7 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
} }
public static class LoadBalancerListener { public static class LoadBalancerListener {
// TODO: missing SSLCertificateId
private Set<String> policyNames; private Set<String> policyNames;
private Integer instancePort; private Integer instancePort;
private Integer loadBalancerPort; private Integer loadBalancerPort;