mirror of https://github.com/apache/jclouds.git
comments for elb implementation
This commit is contained in:
parent
64c83cb6a6
commit
609ac300be
|
@ -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,12 +74,15 @@ 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,
|
||||
@FormParam("Listeners.member.1.LoadBalancerPort") int loadBalancerPort,
|
||||
@FormParam("Listeners.member.1.InstancePort") int instancePort,
|
||||
@BinderParam(BindAvailabilityZonesToIndexedFormParams.class) String... availabilityZones);
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@FormParam("LoadBalancerName") String name, @FormParam("Listeners.member.1.Protocol") String protocol,
|
||||
@FormParam("Listeners.member.1.LoadBalancerPort") int loadBalancerPort,
|
||||
@FormParam("Listeners.member.1.InstancePort") int instancePort,
|
||||
@BinderParam(BindAvailabilityZonesToIndexedFormParams.class) String... availabilityZones);
|
||||
|
||||
/**
|
||||
* @see ELBClient#deleteLoadBalancerInRegion
|
||||
|
@ -82,8 +91,8 @@ public interface ELBAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DeleteLoadBalancer")
|
||||
ListenableFuture<Void> deleteLoadBalancerInRegion(
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@FormParam("LoadBalancerName") String name);
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@FormParam("LoadBalancerName") String name);
|
||||
|
||||
/**
|
||||
* @see ELBClient#registerInstancesWithLoadBalancerInRegion
|
||||
|
@ -93,9 +102,9 @@ public interface ELBAsyncClient {
|
|||
@XMLResponseParser(RegisterInstancesWithLoadBalancerResponseHandler.class)
|
||||
@FormParams(keys = ACTION, values = "RegisterInstancesWithLoadBalancer")
|
||||
ListenableFuture<Set<String>> registerInstancesWithLoadBalancerInRegion(
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@FormParam("LoadBalancerName") String name,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@FormParam("LoadBalancerName") String name,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
||||
/**
|
||||
* @see ELBClient#deregisterInstancesWithLoadBalancerInRegion
|
||||
|
@ -104,9 +113,9 @@ public interface ELBAsyncClient {
|
|||
@Path("/")
|
||||
@FormParams(keys = ACTION, values = "DeregisterInstancesFromLoadBalancer")
|
||||
ListenableFuture<Void> deregisterInstancesWithLoadBalancerInRegion(
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@FormParam("LoadBalancerName") String name,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@FormParam("LoadBalancerName") String name,
|
||||
@BinderParam(BindInstanceIdsToIndexedFormParams.class) String... instanceIds);
|
||||
|
||||
/**
|
||||
* @see ELBClient#describeLoadBalancersInRegion
|
||||
|
@ -117,7 +126,7 @@ public interface ELBAsyncClient {
|
|||
@FormParams(keys = ACTION, values = "DescribeLoadBalancers")
|
||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<Set<? extends LoadBalancer>> describeLoadBalancersInRegion(
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@BinderParam(BindLoadBalancerNamesToIndexedFormParams.class) String... loadbalancerNames);
|
||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||
@BinderParam(BindLoadBalancerNamesToIndexedFormParams.class) String... loadbalancerNames);
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -46,7 +53,7 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
|
|||
}
|
||||
|
||||
public LoadBalancer(String region, String name, Set<String> instanceIds, Set<String> availabilityZones,
|
||||
String dnsName) {
|
||||
String dnsName) {
|
||||
this.region = region;
|
||||
this.name = name;
|
||||
this.instanceIds = instanceIds;
|
||||
|
@ -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,13 +343,14 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
|
|||
}
|
||||
|
||||
public static class LoadBalancerListener {
|
||||
// TODO: missing SSLCertificateId
|
||||
private Set<String> policyNames;
|
||||
private Integer instancePort;
|
||||
private Integer loadBalancerPort;
|
||||
private String protocol;
|
||||
|
||||
public LoadBalancerListener(Set<String> policyNames, Integer instancePort, Integer loadBalancerPort,
|
||||
String protocol) {
|
||||
String protocol) {
|
||||
super();
|
||||
this.policyNames = policyNames;
|
||||
this.instancePort = instancePort;
|
||||
|
@ -432,7 +440,7 @@ public class LoadBalancer implements Comparable<LoadBalancer> {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[policyNames=" + policyNames + ", instancePort=" + instancePort + ", loadBalancerPort="
|
||||
+ loadBalancerPort + ", protocol=" + protocol + "]";
|
||||
+ loadBalancerPort + ", protocol=" + protocol + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue