mirror of https://github.com/apache/jclouds.git
fixed delete on elb on 404
This commit is contained in:
parent
c9f49bd512
commit
df3f331286
|
@ -43,6 +43,7 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -137,6 +138,7 @@ public interface LoadBalancerAsyncClient {
|
|||
*/
|
||||
@POST
|
||||
@Path("/")
|
||||
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
|
||||
@FormParams(keys = ACTION, values = "DeleteLoadBalancer")
|
||||
ListenableFuture<Void> delete(@FormParam("LoadBalancerName") String name);
|
||||
}
|
||||
|
|
|
@ -157,4 +157,41 @@ public class LoadBalancerClientExpectTest extends BaseELBClientExpectTest {
|
|||
assertEquals(clientWhenWithOptionsExist.getLoadBalancerClient().list(afterMarker("MARKER")).toString(),
|
||||
new DescribeLoadBalancersResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
HttpRequest delete = HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint(URI.create("https://elasticloadbalancing.us-east-1.amazonaws.com/"))
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Host", "elasticloadbalancing.us-east-1.amazonaws.com")
|
||||
.build())
|
||||
.payload(
|
||||
payloadFromStringWithContentType(
|
||||
"Action=DeleteLoadBalancer" +
|
||||
"&LoadBalancerName=name" +
|
||||
"&Signature=LPfcRnIayHleMt9Z8QiGTMXoafF2ABKGeah3UO1eD0k%3D" +
|
||||
"&SignatureMethod=HmacSHA256" +
|
||||
"&SignatureVersion=2" +
|
||||
"&Timestamp=2009-11-08T15%3A54%3A08.897Z" +
|
||||
"&Version=2012-06-01" +
|
||||
"&AWSAccessKeyId=identity",
|
||||
"application/x-www-form-urlencoded"))
|
||||
.build();
|
||||
|
||||
public void testDeleteWhenResponseIs2xx() throws Exception {
|
||||
|
||||
HttpResponse deleteResponse = HttpResponse.builder().statusCode(200).build();
|
||||
|
||||
ELBClient clientWhenExist = requestSendsResponse(delete, deleteResponse);
|
||||
|
||||
clientWhenExist.getLoadBalancerClient().delete("name");
|
||||
}
|
||||
|
||||
public void testDeleteWhenResponseIs404() throws Exception {
|
||||
|
||||
HttpResponse deleteResponse = HttpResponse.builder().statusCode(404).build();
|
||||
|
||||
ELBClient clientWhenDontExist = requestSendsResponse(delete, deleteResponse);
|
||||
|
||||
clientWhenDontExist.getLoadBalancerClient().delete("name");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue