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.functions.ReturnEmptySetOnNotFoundOr404;
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides access to EC2 Elastic Load Balancer via REST API.
* <p/>
*
* @see <a href="http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/APIReference/">ELB
* documentation</a>
* @author Lili Nader
*/
@Beta
@RequestFilters(FormSigner.class)
@FormParams(keys = VERSION, values = ELBAsyncClient.VERSION)
@VirtualHost
public interface ELBAsyncClient {
public static final String VERSION = "2010-07-01";
// TODO: there are a lot of missing methods
/**
* @see ELBClient#createLoadBalancerInRegion
*/
@ -68,6 +74,9 @@ public interface ELBAsyncClient {
@Path("/")
@XMLResponseParser(CreateLoadBalancerResponseHandler.class)
@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(
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
@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.elb.domain.LoadBalancer;
import com.google.common.annotations.Beta;
/**
* Provides access to EC2 Elastic Load Balancer via their REST API.
* <p/>
*
* @author Lili Nader
*/
@Beta
// see ELBAsyncClient
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
public interface ELBClient {
@ -50,8 +54,10 @@ public interface ELBClient {
* @return dns the DNS name for the load balancer
* @see <a href="http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/"
*/
String createLoadBalancerInRegion(@Nullable String region, String name, String protocol,
int loadBalancerPort, int instancePort, String... availabilityZones);
@Beta
// see ELBAsyncClient
String createLoadBalancerInRegion(@Nullable String region, String name, String protocol, int loadBalancerPort,
int instancePort, String... availabilityZones);
/**
* Delete load balancer
@ -76,8 +82,7 @@ public interface ELBClient {
* @see <a
* href="http://docs.amazonwebservices.com/ElasticLoadBalancing/2009-05-15/DeveloperGuide/"
*/
Set<String> registerInstancesWithLoadBalancerInRegion(@Nullable String region, String name,
String... instanceIds);
Set<String> registerInstancesWithLoadBalancerInRegion(@Nullable String region, String name, String... instanceIds);
/**
* Deregister instances with an existing load balancer
@ -91,13 +96,14 @@ public interface ELBClient {
* @see <a
* href="http://docs.amazonwebservices.com/ElasticLoadBalancing/2009-05-15/DeveloperGuide/"
*/
void deregisterInstancesWithLoadBalancerInRegion(@Nullable String region, String name,
String... instanceIds);
void deregisterInstancesWithLoadBalancerInRegion(@Nullable String region, String name, String... instanceIds);
/**
* Returns a set of elastic load balancers
*
* @param region
* @param loadbalancerNames names associated with the LoadBalancers at creation time.
* @param loadbalancerNames
* names associated with the LoadBalancers at creation time.
* @return
*/
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.Set;
import com.google.common.annotations.Beta;
/**
*
*
* @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> {
// Missing: createdTime, healthcheck
private String region;
private String name;
private Set<String> instanceIds;
private Set<String> availabilityZones;
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 LBCookieStickinessPolicy lBCookieStickinessPolicy;
private Set<LoadBalancerListener> loadBalancerListeners;
@ -127,9 +134,9 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
@Override
public String toString() {
return "[region=" + region + ", name=" + name + ", instanceIds=" + instanceIds + ", availabilityZones="
+ availabilityZones + ", dnsName=" + dnsName + ", appCookieStickinessPolicy=" + appCookieStickinessPolicy
+ ", lBCookieStickinessPolicy=" + lBCookieStickinessPolicy + ", loadBalancerListeners="
+ loadBalancerListeners + "]";
+ availabilityZones + ", dnsName=" + dnsName + ", appCookieStickinessPolicy="
+ appCookieStickinessPolicy + ", lBCookieStickinessPolicy=" + lBCookieStickinessPolicy
+ ", loadBalancerListeners=" + loadBalancerListeners + "]";
}
@Override
@ -336,6 +343,7 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
}
public static class LoadBalancerListener {
// TODO: missing SSLCertificateId
private Set<String> policyNames;
private Integer instancePort;
private Integer loadBalancerPort;