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