removed async api from cloudloadbalancers

This commit is contained in:
adriancole 2013-04-09 19:48:32 -07:00
parent 6afb0dc6b9
commit d1af582ed0
33 changed files with 763 additions and 1716 deletions

View File

@ -37,8 +37,8 @@
<test.rackspace-cloudloadbalancers.endpoint>https://identity.api.rackspacecloud.com/v2.0/</test.rackspace-cloudloadbalancers.endpoint>
<test.rackspace-cloudloadbalancers.api-version>1</test.rackspace-cloudloadbalancers.api-version>
<test.rackspace-cloudloadbalancers.build-version />
<test.rackspace-cloudloadbalancers.identity>${test.rackspace.identity}</test.rackspace-cloudloadbalancers.identity>
<test.rackspace-cloudloadbalancers.credential>${test.rackspace.credential}</test.rackspace-cloudloadbalancers.credential>
<test.rackspace-cloudloadbalancers.identity>${test.rackspace-us.identity}</test.rackspace-cloudloadbalancers.identity>
<test.rackspace-cloudloadbalancers.credential>${test.rackspace-us.credential}</test.rackspace-cloudloadbalancers.credential>
<jclouds.osgi.export>org.jclouds.rackspace.cloudloadbalancers*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>

View File

@ -43,11 +43,10 @@ import org.jclouds.rest.annotations.EndpointParam;
import com.google.inject.Provides;
/**
* Provides synchronous access to Rackspace Cloud Load Balancers.
* Provides access to Rackspace Cloud Load Balancers.
* <p/>
*
* @see CloudLoadBalancersAsyncApi
* @author Adrian Cole
* @author Everett Toews
*/
public interface CloudLoadBalancersApi extends Closeable {
/**
@ -58,14 +57,14 @@ public interface CloudLoadBalancersApi extends Closeable {
Set<String> getConfiguredZones();
/**
* Provides synchronous access to Load Balancer features.
* Provides access to Load Balancer features.
*/
@Delegate
LoadBalancerApi getLoadBalancerApiForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides synchronous access to Node features.
* Provides access to Node features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -73,7 +72,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Access Rule features.
* Provides access to Access Rule features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -81,7 +80,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Virtual IP features.
* Provides access to Virtual IP features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -89,7 +88,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Connection features.
* Provides access to Connection features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -97,7 +96,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Health Monitor features.
* Provides access to Health Monitor features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -105,7 +104,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Session Persistence features.
* Provides access to Session Persistence features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -113,7 +112,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Content Caching features.
* Provides access to Content Caching features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -121,7 +120,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to SSL Termination features.
* Provides access to SSL Termination features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -129,7 +128,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Error Page features.
* Provides access to Error Page features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
@ -137,7 +136,7 @@ public interface CloudLoadBalancersApi extends Closeable {
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides synchronous access to Report features.
* Provides access to Report features.
*/
@Delegate
ReportApi getReportApiForZone(

View File

@ -28,30 +28,21 @@ import org.jclouds.apis.ApiMetadata;
import org.jclouds.loadbalancer.LoadBalancerServiceContext;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.rackspace.cloudidentity.v2_0.ServiceType;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationApiModule;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
import org.jclouds.rackspace.cloudloadbalancers.v1.config.CloudLoadBalancersRestClientModule;
import org.jclouds.rackspace.cloudloadbalancers.v1.config.CloudLoadBalancersHttpApiModule;
import org.jclouds.rackspace.cloudloadbalancers.v1.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
import org.jclouds.rest.internal.BaseRestApiMetadata;
import org.jclouds.rest.internal.BaseHttpApiMetadata;
import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.TypeToken;
import com.google.inject.Module;
/**
* Implementation of {@link ApiMetadata} for CloudLoadBalancers 1.0 API
*
* @author Adrian Cole
*/
public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
/**
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudLoadBalancersApi.class)} as
* {@link CloudLoadBalancersAsyncApi} interface will be removed in jclouds 1.7.
*/
@Deprecated
public static final TypeToken<org.jclouds.rest.RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi>>() {
private static final long serialVersionUID = 1L;
};
public class CloudLoadBalancersApiMetadata extends BaseHttpApiMetadata<CloudLoadBalancersApi> {
@Override
public Builder toBuilder() {
@ -67,17 +58,15 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
}
public static Properties defaultProperties() {
Properties properties = BaseRestApiMetadata.defaultProperties();
Properties properties = BaseHttpApiMetadata.defaultProperties();
properties.setProperty(SERVICE_TYPE, ServiceType.LOAD_BALANCERS);
properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS);
return properties;
}
public static class Builder extends BaseRestApiMetadata.Builder<Builder> {
public static class Builder extends BaseHttpApiMetadata.Builder<CloudLoadBalancersApi, Builder> {
@SuppressWarnings("deprecation")
protected Builder() {
super(CloudLoadBalancersApi.class, CloudLoadBalancersAsyncApi.class);
id("rackspace-cloudloadbalancers")
.name("Rackspace Cloud Load Balancers API")
.identityName("Username")
@ -87,12 +76,12 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
.defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/")
.defaultProperties(CloudLoadBalancersApiMetadata.defaultProperties())
.view(typeToken(LoadBalancerServiceContext.class))
.defaultModules(
ImmutableSet.<Class<? extends Module>> of(
CloudIdentityAuthenticationModule.class,
ZoneModule.class,
CloudLoadBalancersRestClientModule.class,
CloudLoadBalancersLoadBalancerContextModule.class));
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationApiModule.class)
.add(CloudIdentityAuthenticationModule.class)
.add(ZoneModule.class)
.add(CloudLoadBalancersHttpApiModule.class)
.add(CloudLoadBalancersLoadBalancerContextModule.class).build());
}
@Override

View File

@ -1,149 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1;
import java.io.Closeable;
import java.util.Set;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.location.Zone;
import org.jclouds.location.functions.ZoneToEndpoint;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.AccessRuleAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ConnectionAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ContentCachingAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ErrorPageAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.HealthMonitorAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.LoadBalancerAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ReportAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.SSLTerminationAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.SessionPersistenceAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.VirtualIPAsyncApi;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import com.google.inject.Provides;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers.
* <p/>
*
* @see CloudLoadBalancersApi
* @author Adrian Cole
* @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(CloudLoadBalancersApi.class)} as
* {@link CloudLoadBalancersAsyncApi} interface will be removed in jclouds 1.7.
*/
@Deprecated
public interface CloudLoadBalancersAsyncApi extends Closeable {
/**
* @return the Zone codes configured
*/
@Provides
@Zone
Set<String> getConfiguredZones();
/**
* Provides asynchronous access to LoadBalancer features.
*/
@Delegate
LoadBalancerAsyncApi getLoadBalancerApiForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
/**
* Provides asynchronous access to Node features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
NodeAsyncApi getNodeApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Access Rule features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
AccessRuleAsyncApi getAccessRuleApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Virtual IP features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
VirtualIPAsyncApi getVirtualIPApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Connection features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
ConnectionAsyncApi getConnectionApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Health Monitor features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
HealthMonitorAsyncApi getHealthMonitorApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Session Persistence features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
SessionPersistenceAsyncApi getSessionPersistenceApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Content Caching features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
ContentCachingAsyncApi getContentCachingApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to SSL Termination features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
SSLTerminationAsyncApi getSSLTerminationApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Error Page features.
*/
@Delegate
@Path("/loadbalancers/{lbId}")
ErrorPageAsyncApi getErrorPageApiForZoneAndLoadBalancer(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone, @PathParam("lbId") int lbId);
/**
* Provides asynchronous access to Report features.
*/
@Delegate
ReportAsyncApi getReportApiForZone(
@EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
}

View File

@ -0,0 +1,59 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.config;
import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.json.config.GsonModule.DateAdapter;
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ConvertLB;
import org.jclouds.rackspace.cloudloadbalancers.v1.handlers.ParseCloudLoadBalancersErrorFromHttpResponse;
import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
/**
* Configures the Rackspace Cloud Load Balancers connection.
*
* @author Adrian Cole
*/
@ConfiguresHttpApi
public class CloudLoadBalancersHttpApiModule extends HttpApiModule<CloudLoadBalancersApi> {
@Override
protected void configure() {
bind(DateAdapter.class).to(Iso8601DateAdapter.class);
install(new FactoryModuleBuilder().build(ConvertLB.Factory.class));
super.configure();
}
@Override
protected void bindErrorHandlers() {
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(
ParseCloudLoadBalancersErrorFromHttpResponse.class);
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(
ParseCloudLoadBalancersErrorFromHttpResponse.class);
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(
ParseCloudLoadBalancersErrorFromHttpResponse.class);
}
}

View File

@ -1,104 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.config;
import java.util.Map;
import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.json.config.GsonModule.DateAdapter;
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.AccessRuleApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.AccessRuleAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ConnectionApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ConnectionAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ContentCachingApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ContentCachingAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ErrorPageApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ErrorPageAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.HealthMonitorApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.HealthMonitorAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.LoadBalancerApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.LoadBalancerAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.NodeAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ReportApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.ReportAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.SSLTerminationApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.SSLTerminationAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.SessionPersistenceApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.SessionPersistenceAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.VirtualIPApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.features.VirtualIPAsyncApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ConvertLB;
import org.jclouds.rackspace.cloudloadbalancers.v1.handlers.ParseCloudLoadBalancersErrorFromHttpResponse;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestClientModule;
import com.google.common.collect.ImmutableMap;
import com.google.inject.assistedinject.FactoryModuleBuilder;
/**
* Configures the Rackspace Cloud Load Balancers connection.
*
* @author Adrian Cole
*/
@ConfiguresRestClient
public class CloudLoadBalancersRestClientModule extends
RestClientModule<CloudLoadBalancersApi, CloudLoadBalancersAsyncApi> {
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
.put(LoadBalancerApi.class, LoadBalancerAsyncApi.class)
.put(NodeApi.class, NodeAsyncApi.class)
.put(AccessRuleApi.class, AccessRuleAsyncApi.class)
.put(VirtualIPApi.class, VirtualIPAsyncApi.class)
.put(ConnectionApi.class, ConnectionAsyncApi.class)
.put(HealthMonitorApi.class, HealthMonitorAsyncApi.class)
.put(SessionPersistenceApi.class, SessionPersistenceAsyncApi.class)
.put(ContentCachingApi.class, ContentCachingAsyncApi.class)
.put(SSLTerminationApi.class, SSLTerminationAsyncApi.class)
.put(ErrorPageApi.class, ErrorPageAsyncApi.class)
.put(ReportApi.class, ReportAsyncApi.class)
.build();
public CloudLoadBalancersRestClientModule() {
super(DELEGATE_MAP);
}
@Override
protected void configure() {
bind(DateAdapter.class).to(Iso8601DateAdapter.class);
install(new FactoryModuleBuilder().build(ConvertLB.Factory.class));
super.configure();
}
@Override
protected void bindErrorHandlers() {
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(
ParseCloudLoadBalancersErrorFromHttpResponse.class);
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(
ParseCloudLoadBalancersErrorFromHttpResponse.class);
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(
ParseCloudLoadBalancersErrorFromHttpResponse.class);
}
}

View File

@ -18,17 +18,35 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AccessRule;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AccessRuleWithId;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
/**
* The access list management feature allows fine-grained network access controls to be applied to the load balancer's
* virtual IP address.
* <p/>
*
* @see AccessRuleAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface AccessRuleApi {
/**
* Create new access rules or append to existing access rules.
@ -38,11 +56,22 @@ public interface AccessRuleApi {
* AccessRules. A single address or subnet definition is considered unique and cannot be duplicated between rules
* in an access list.
*/
void create(Iterable<AccessRule> accessRules);
@Named("accessrule:create")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/accesslist")
void create(@WrapWith("accessList") Iterable<AccessRule> accessRules);
/**
* List the AccessRules.
*/
@Named("accessrule:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
@SelectJson("accessList")
@Path("/accesslist")
Iterable<AccessRuleWithId> list();
/**
@ -50,19 +79,34 @@ public interface AccessRuleApi {
*
* @return true on a successful delete, false if the access rule was not found
*/
boolean delete(int id);
@Named("accessrule:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/accesslist/{id}")
@Consumes("*/*")
boolean delete(@PathParam("id") int id);
/**
* Batch delete the access rules given the specified ids.
*
* @return true on a successful delete, false if the access rule was not found
*/
boolean delete(Iterable<Integer> ids);
@Named("accessrule:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/accesslist")
@Consumes("*/*")
boolean delete(@QueryParam("id") Iterable<Integer> ids);
/**
* Delete the entire access list.
*
* @return true on a successful delete, false if the access rule was not found
*/
@Named("accessrule:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/accesslist")
@Consumes("*/*")
boolean deleteAll();
}

View File

@ -1,104 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AccessRule;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AccessRuleWithId;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see AccessRuleApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface AccessRuleAsyncApi {
/**
* @see AccessRuleApi#create(Iterable)
*/
@Named("accessrule:create")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/accesslist")
ListenableFuture<Void> create(@WrapWith("accessList") Iterable<AccessRule> accessRules);
/**
* @see AccessRuleApi#list()
*/
@Named("accessrule:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
@SelectJson("accessList")
@Path("/accesslist")
ListenableFuture<Iterable<AccessRuleWithId>> list();
/**
* @see AccessRuleApi#delete(int)
*/
@Named("accessrule:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/accesslist/{id}")
@Consumes("*/*")
ListenableFuture<Boolean> delete(@PathParam("id") int id);
/**
* @see AccessRuleApi#delete(Iterable)
*/
@Named("accessrule:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/accesslist")
@Consumes("*/*")
ListenableFuture<Boolean> delete(@QueryParam("id") Iterable<Integer> ids);
/**
* @see AccessRuleApi#deleteAll()
*/
@Named("accessrule:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/accesslist")
@Consumes("*/*")
ListenableFuture<Boolean> deleteAll();
}

View File

@ -18,25 +18,58 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr422;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.ConnectionThrottle;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNestedBoolean;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
/**
* Connection management features.
* <p/>
*
* @see ConnectionAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ConnectionApi {
/**
* The connection throttling feature imposes limits on the number of connections per IP address to help mitigate
* malicious or abusive traffic to your applications.
*/
void createOrUpdateConnectionThrottle(ConnectionThrottle connectionThrottle);
@Named("connectionthrottle:create")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/connectionthrottle")
void createOrUpdateConnectionThrottle(
@WrapWith("connectionThrottle") ConnectionThrottle connectionThrottle);
/**
* Get connection throttle.
*/
@Named("connectionthrottle:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("connectionThrottle")
@Fallback(NullOnNotFoundOr404.class)
@Path("/connectionthrottle")
ConnectionThrottle getConnectionThrottle();
/**
@ -44,20 +77,45 @@ public interface ConnectionApi {
*
* @return true on a successful delete, false if the connection throttle was not found.
*/
@Named("connectionthrottle:delete")
@DELETE
@Fallback(FalseOnNotFoundOr422.class)
@Path("/connectionthrottle")
@Consumes("*/*")
boolean deleteConnectionThrottle();
/**
* Determine if the load balancer is logging connections.
*/
@Named("connectionlogging:state")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNestedBoolean.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/connectionlogging")
boolean isConnectionLogging();
/**
* Enable logging connections.
*/
@Named("connectionlogging:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"connectionLogging\":{\"enabled\":true}}")
@Path("/connectionlogging")
void enableConnectionLogging();
/**
* Disable logging connections.
*/
@Named("connectionlogging:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"connectionLogging\":{\"enabled\":false}}")
@Path("/connectionlogging")
void disableConnectionLogging();
}

View File

@ -1,122 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr422;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.ConnectionThrottle;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNestedBoolean;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see ConnectionApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ConnectionAsyncApi {
/**
* @see ConnectionApi#createOrUpdateConnectionThrottle(ConnectionThrottle)
*/
@Named("connectionthrottle:create")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/connectionthrottle")
ListenableFuture<Void> createOrUpdateConnectionThrottle(
@WrapWith("connectionThrottle") ConnectionThrottle connectionThrottle);
/**
* @see ConnectionApi#getConnectionThrottle()
*/
@Named("connectionthrottle:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("connectionThrottle")
@Fallback(NullOnNotFoundOr404.class)
@Path("/connectionthrottle")
ListenableFuture<ConnectionThrottle> getConnectionThrottle();
/**
* @see ConnectionApi#deleteConnectionThrottle()
*/
@Named("connectionthrottle:delete")
@DELETE
@Fallback(FalseOnNotFoundOr422.class)
@Path("/connectionthrottle")
@Consumes("*/*")
ListenableFuture<Boolean> deleteConnectionThrottle();
/**
* @see ConnectionApi#isConnectionLogging()
*/
@Named("connectionlogging:state")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNestedBoolean.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/connectionlogging")
ListenableFuture<Boolean> isConnectionLogging();
/**
* @see ConnectionApi#enableConnectionLogging()
*/
@Named("connectionlogging:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"connectionLogging\":{\"enabled\":true}}")
@Path("/connectionlogging")
ListenableFuture<Void> enableConnectionLogging();
/**
* @see ConnectionApi#disableConnectionLogging()
*/
@Named("connectionlogging:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"connectionLogging\":{\"enabled\":false}}")
@Path("/connectionlogging")
ListenableFuture<Void> disableConnectionLogging();
}

View File

@ -18,6 +18,23 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNestedBoolean;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
/**
* When content caching is enabled, recently-accessed files are stored on the load balancer for easy retrieval by web
* clients. Content caching improves the performance of high traffic web sites by temporarily storing data that was
@ -26,22 +43,42 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.features;
* web server.
* <p/>
*
* @see ContentCachingAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ContentCachingApi {
/**
* Determine if the load balancer is content caching.
*/
@Named("contentcaching:state")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNestedBoolean.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/contentcaching")
boolean isContentCaching();
/**
* Enable content caching.
*/
@Named("contentcaching:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"contentCaching\":{\"enabled\":true}}")
@Path("/contentcaching")
void enable();
/**
* Disable content caching.
*/
@Named("contentcaching:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"contentCaching\":{\"enabled\":false}}")
@Path("/contentcaching")
void disable();
}

View File

@ -1,84 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNestedBoolean;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see ContentCachingApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ContentCachingAsyncApi {
/**
* @see ContentCachingApi#isContentCaching()
*/
@Named("contentcaching:state")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNestedBoolean.class)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/contentcaching")
ListenableFuture<Boolean> isContentCaching();
/**
* @see ContentCachingApi#enable()
*/
@Named("contentcaching:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"contentCaching\":{\"enabled\":true}}")
@Path("/contentcaching")
ListenableFuture<Void> enable();
/**
* @see ContentCachingApi#disableConnectionLogging()
*/
@Named("contentcaching:state")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("{\"contentCaching\":{\"enabled\":false}}")
@Path("/contentcaching")
ListenableFuture<Void> disable();
}

View File

@ -18,6 +18,25 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNestedString;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
/**
* An error page is the html file that is shown to an end user who is attempting to access a load balancer node that
* is offline/unavailable. During provisioning, every load balancer is configured with a default error page that gets
@ -25,23 +44,41 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.features;
* balancer with an HTTP-based protocol. Page updates will override existing content.
* <p/>
*
* @see ErrorPageAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ErrorPageApi {
/**
* Specify the HTML content for the custom error page. Must be 65536 characters or less.
*/
void create(String content);
@Named("errorpage:create")
@PUT
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("%7B\"errorpage\":%7B\"content\":\"{content}\"%7D%7D")
@Path("/errorpage")
void create(@PayloadParam("content") String content);
/**
* Get the error page HTML content.
*/
@Named("errorpage:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNestedString.class)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/errorpage")
String get();
/**
* If a custom error page is deleted, or the load balancer is changed to a non-HTTP protocol, the default error
* page will be restored.
*/
@Named("errorpage:delete")
@DELETE
@Consumes(MediaType.WILDCARD)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/errorpage")
boolean delete();
}

View File

@ -1,84 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNestedString;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see ErrorPageApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ErrorPageAsyncApi {
/**
* @see ErrorPageApi#create(String)
*/
@Named("errorpage:create")
@PUT
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("%7B\"errorpage\":%7B\"content\":\"{content}\"%7D%7D")
@Path("/errorpage")
ListenableFuture<Void> create(@PayloadParam("content") String content);
/**
* @see ErrorPageApi#get()
*/
@Named("errorpage:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNestedString.class)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/errorpage")
ListenableFuture<String> get();
/**
* @see ErrorPageApi#delete()
*/
@Named("errorpage:delete")
@DELETE
@Consumes(MediaType.WILDCARD)
@Fallback(FalseOnNotFoundOr404.class)
@Path("/errorpage")
ListenableFuture<Boolean> delete();
}

View File

@ -18,7 +18,23 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr422;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.HealthMonitor;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
/**
* The load balancing service includes a health monitoring operation which periodically checks your back-end nodes to
@ -31,18 +47,29 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.domain.HealthMonitor;
* failover for effectively routing traffic in case the primary node fails. This is an additional feature that will
* ensure you remain up in case your primary node fails.
* <p/>
* @see HealthMonitorAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface HealthMonitorApi {
/**
* Create or update a health monitor.
*/
void createOrUpdate(HealthMonitor healthMonitor);
@Named("healthmonitor:create")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/healthmonitor")
void createOrUpdate(@WrapWith("healthMonitor") HealthMonitor healthMonitor);
/**
* Get health monitor.
*/
@Named("healthmonitor:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("healthMonitor")
@Fallback(NullOnNotFoundOr404.class)
@Path("/healthmonitor")
HealthMonitor get();
/**
@ -50,5 +77,10 @@ public interface HealthMonitorApi {
*
* @return true on a successful delete, false if the health monitor was not found
*/
@Named("healthmonitor:delete")
@DELETE
@Fallback(FalseOnNotFoundOr422.class)
@Path("/healthmonitor")
@Consumes("*/*")
boolean delete();
}

View File

@ -1,81 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr422;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.HealthMonitor;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see HealthMonitorApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface HealthMonitorAsyncApi {
/**
* @see HealthMonitorApi#createOrUpdate(HealthMonitor)
*/
@Named("healthmonitor:create")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/healthmonitor")
ListenableFuture<Void> createOrUpdate(@WrapWith("healthMonitor") HealthMonitor healthMonitor);
/**
* @see HealthMonitorApi#get()
*/
@Named("healthmonitor:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("healthMonitor")
@Fallback(NullOnNotFoundOr404.class)
@Path("/healthmonitor")
ListenableFuture<HealthMonitor> get();
/**
* @see HealthMonitorApi#delete()
*/
@Named("healthmonitor:delete")
@DELETE
@Fallback(FalseOnNotFoundOr422.class)
@Path("/healthmonitor")
@Consumes("*/*")
ListenableFuture<Boolean> delete();
}

View File

@ -20,21 +20,52 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import java.util.Map;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.options.PaginationOptions;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateLoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.binders.BindMetadataToJsonPayload;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateLoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancers;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseMetadata;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.annotations.WrapWith;
/**
* Provides synchronous access to CloudLoadBalancers LoadBalancer features.
* Provides access to CloudLoadBalancers LoadBalancer features.
* <p/>
*
* @see LoadBalancerAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface LoadBalancerApi {
/**
* Create a new load balancer with the configuration defined by the request.
@ -43,7 +74,13 @@ public interface LoadBalancerApi {
* identifier, the caller can check on the progress of the operation by performing a
* {@link LoadBalancerApi#get}.
*/
LoadBalancer create(CreateLoadBalancer createLB);
@Named("lb:create")
@POST
@ResponseParser(ParseLoadBalancer.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers")
LoadBalancer create(@WrapWith("loadBalancer") CreateLoadBalancer createLB);
/**
* Update the properties of a load balancer.
@ -52,46 +89,97 @@ public interface LoadBalancerApi {
* identifier, the caller can check on the progress of the operation by performing a
* {@link LoadBalancerApi#get}.
*/
void update(int id, UpdateLoadBalancer updateLB);
@Named("lb:update")
@PUT
@ResponseParser(ParseLoadBalancer.class)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/loadbalancers/{id}")
void update(@PathParam("id") int id, @WrapWith("loadBalancer") UpdateLoadBalancer updateLB);
/**
* List the load balancers.
*/
@Named("lb:list")
@GET
@ResponseParser(ParseLoadBalancers.class)
@Transform(ParseLoadBalancers.ToPagedIterable.class)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/loadbalancers")
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
PagedIterable<LoadBalancer> list();
/**
* List the load balancers with full control of pagination.
*/
@Named("lb:list")
@GET
@ResponseParser(ParseLoadBalancers.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers")
IterableWithMarker<LoadBalancer> list(PaginationOptions options);
/**
* Get a load balancer.
*/
LoadBalancer get(int id);
@Named("lb:get")
@GET
@ResponseParser(ParseLoadBalancer.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}")
LoadBalancer get(@PathParam("id") int id);
/**
* Delete a load balancer.
*/
void delete(int id);
@Named("lb:delete")
@DELETE
@Fallback(VoidOnNotFoundOr404.class)
@Path("/loadbalancers/{id}")
@Consumes("*/*")
void delete(@PathParam("id") int id);
/**
* When a metadata item is added, it is assigned a unique identifier that can be used for mutating operations such
* as changing the value attribute or removing it. Key and value must be 256 characters or less.
* All UTF-8 characters are valid.
*/
Metadata createMetadata(int id, Map<String, String> metadata);
@Named("lb:createmetadata")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/metadata")
Metadata createMetadata(@PathParam("id") int id,
@BinderParam(BindMetadataToJsonPayload.class) Map<String, String> metadata);
/**
* List a load balancer's metadata.
*/
Metadata getMetadata(int id);
@Named("lb:getmetadata")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/metadata")
Metadata getMetadata(@PathParam("id") int id);
/**
* Update metadatum. Key and value must be 256 characters or less. All UTF-8 characters are valid.
*
* @return true on a successful update, false if the metadatum was not found
*/
boolean updateMetadatum(int id, int metadatumId, String value);
@Named("lb:updatemetadatum")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes("*/*")
@Fallback(FalseOnNotFoundOr404.class)
@Payload("%7B\"meta\":%7B\"value\":\"{value}\"%7D%7D")
@Path("/loadbalancers/{id}/metadata/{metadatumId}")
boolean updateMetadatum(@PathParam("id") int id,
@PathParam("metadatumId") int metadatumId,
@PayloadParam("value") String value);
/**
* Delete metadatum.
@ -100,7 +188,13 @@ public interface LoadBalancerApi {
*
* @return true on a successful removal, false if the metadatum was not found
*/
boolean deleteMetadatum(int id, int metadatumId);
@Named("lb:deletemetadatum")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/loadbalancers/{id}/metadata/{metadatumId}")
boolean deleteMetadatum(@PathParam("id") int id, @PathParam("metadatumId") int metadatumId);
/**
* Batch delete metadata given the specified ids.
@ -111,5 +205,11 @@ public interface LoadBalancerApi {
*
* @return true on a successful removal, false if the metadata was not found
*/
boolean deleteMetadata(int id, Iterable<Integer> metadataIds);
@Named("lb:deletemetadata")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/loadbalancers/{id}/metadata")
boolean deleteMetadata(@PathParam("id") int id,
@QueryParam("id") Iterable<Integer> metadataIds);
}

View File

@ -1,197 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import java.util.Map;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.options.PaginationOptions;
import org.jclouds.rackspace.cloudloadbalancers.v1.binders.BindMetadataToJsonPayload;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateLoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.CreateLoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancers;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseMetadata;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.annotations.WrapWith;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see LoadBalancerApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface LoadBalancerAsyncApi {
/**
* @see LoadBalancerApi#create(CreateLoadBalancer)
*/
@Named("lb:create")
@POST
@ResponseParser(ParseLoadBalancer.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers")
ListenableFuture<LoadBalancer> create(@WrapWith("loadBalancer") CreateLoadBalancer createLB);
/**
* @see LoadBalancerApi#update(int, UpdateLoadBalancer)
*/
@Named("lb:update")
@PUT
@ResponseParser(ParseLoadBalancer.class)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/loadbalancers/{id}")
ListenableFuture<Void> update(@PathParam("id") int id, @WrapWith("loadBalancer") UpdateLoadBalancer updateLB);
/**
* @see LoadBalancerApi#list()
*/
@Named("lb:list")
@GET
@ResponseParser(ParseLoadBalancers.class)
@Transform(ParseLoadBalancers.ToPagedIterable.class)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/loadbalancers")
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
ListenableFuture<PagedIterable<LoadBalancer>> list();
/**
* @see LoadBalancerApi#list(PaginationOptions)
*/
@Named("lb:list")
@GET
@ResponseParser(ParseLoadBalancers.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers")
ListenableFuture<IterableWithMarker<LoadBalancer>> list(PaginationOptions options);
/**
* @see LoadBalancerApi#get(int)
*/
@Named("lb:get")
@GET
@ResponseParser(ParseLoadBalancer.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}")
ListenableFuture<LoadBalancer> get(@PathParam("id") int id);
/**
* @see LoadBalancerApi#delete(int)
*/
@Named("lb:delete")
@DELETE
@Fallback(VoidOnNotFoundOr404.class)
@Path("/loadbalancers/{id}")
@Consumes("*/*")
ListenableFuture<Void> delete(@PathParam("id") int id);
/**
* @see LoadBalancerApi#createMetadata(int, Iterable)
*/
@Named("lb:createmetadata")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/metadata")
ListenableFuture<Metadata> createMetadata(
@PathParam("id") int id,
@BinderParam(BindMetadataToJsonPayload.class) Map<String, String> metadata);
/**
* @see LoadBalancerApi#getMetadata(int)
*/
@Named("lb:getmetadata")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/metadata")
ListenableFuture<Metadata> getMetadata(@PathParam("id") int lb);
/**
* @see LoadBalancerApi#updateMetadatum(int, int, String)
*/
@Named("lb:updatemetadatum")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes("*/*")
@Fallback(FalseOnNotFoundOr404.class)
@Payload("%7B\"meta\":%7B\"value\":\"{value}\"%7D%7D")
@Path("/loadbalancers/{id}/metadata/{metadatumId}")
ListenableFuture<Boolean> updateMetadatum(@PathParam("id") int id,
@PathParam("metadatumId") int metadatumId,
@PayloadParam("value") String value);
/**
* @see LoadBalancerApi#deleteMetadatum(int, int)
*/
@Named("lb:deletemetadatum")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/loadbalancers/{id}/metadata/{metadatumId}")
ListenableFuture<Boolean> deleteMetadatum(@PathParam("id") int id, @PathParam("metadatumId") int metadatumId);
/**
* @see LoadBalancerApi#deleteMetadata(int, Iterable)
*/
@Named("lb:deletemetadata")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/loadbalancers/{id}/metadata")
ListenableFuture<Boolean> deleteMetadata(@PathParam("id") int id,
@QueryParam("id") Iterable<Integer> metadataIds);
}

View File

@ -21,75 +21,168 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import java.util.Map;
import java.util.Set;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.options.PaginationOptions;
import org.jclouds.rackspace.cloudloadbalancers.v1.binders.BindMetadataToJsonPayload;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseMetadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNode;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNodes;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.annotations.WrapWith;
/**
* Provides synchronous access to CloudLoadBalancers Node features.
* Provides access to CloudLoadBalancers Node features.
* <p/>
*
* @see NodeAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface NodeApi {
/**
* Add a new node with the configuration defined by the request.
*/
Set<Node> add(Iterable<AddNode> addNodes);
@Named("node:add")
@POST
@SelectJson("nodes")
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/nodes")
Set<Node> add(@WrapWith("nodes") Iterable<AddNode> addNodes);
/**
* Update the attributes of a node.
*/
void update(int id, UpdateNode updateNode);
@Named("node:update")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Path("/nodes/{id}")
void update(@PathParam("id") int id, @WrapWith("node") UpdateNode updateNode);
/**
* List the nodes.
*/
@Named("node:list")
@GET
@ResponseParser(ParseNodes.class)
@Transform(ParseNodes.ToPagedIterable.class)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/nodes")
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
PagedIterable<Node> list();
/**
* List the nodes with full control of pagination.
*/
@Named("node:list")
@GET
@ResponseParser(ParseNodes.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/nodes")
IterableWithMarker<Node> list(PaginationOptions options);
/**
* Get a node.
*/
Node get(int id);
@Named("node:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNode.class)
@Path("/nodes/{id}")
@Fallback(NullOnNotFoundOr404.class)
Node get(@PathParam("id") int id);
/**
* Remove a node from the load balancer.
*/
void remove(int id);
@Named("node:remove")
@DELETE
@Path("/nodes/{id}")
@Fallback(VoidOnNotFoundOr404.class)
@Consumes("*/*")
void remove(@PathParam("id") int id);
/**
* Batch remove nodes from the load balancer.
*/
void remove(Iterable<Integer> ids);
@Named("node:remove")
@DELETE
@Path("/nodes")
@Fallback(VoidOnNotFoundOr404.class)
@Consumes("*/*")
void remove(@QueryParam("id") Iterable<Integer> ids);
/**
* When a metadata item is added, it is assigned a unique identifier that can be used for mutating operations such
* as changing the value attribute or removing it. Key and value must be 256 characters or less.
* All UTF-8 characters are valid.
*/
Metadata createMetadata(int id, Map<String, String> metadata);
@Named("node:createmetadata")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/nodes/{id}/metadata")
Metadata createMetadata(@PathParam("id") int id,
@BinderParam(BindMetadataToJsonPayload.class) Map<String, String> metadata);
/**
* List a load balancer's metadata.
*/
Metadata getMetadata(int id);
@Named("node:getmetadata")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/nodes/{id}/metadata")
Metadata getMetadata(@PathParam("id") int lb);
/**
* Update metadatum. Key and value must be 256 characters or less. All UTF-8 characters are valid.
*
* @return true on a successful update, false if the metadatum was not found
*/
boolean updateMetadatum(int id, int metadatumId, String value);
@Named("node:updatemetadatum")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes("*/*")
@Fallback(FalseOnNotFoundOr404.class)
@Payload("%7B\"meta\":%7B\"value\":\"{value}\"%7D%7D")
@Path("/nodes/{id}/metadata/{metadatumId}")
boolean updateMetadatum(@PathParam("id") int id,
@PathParam("metadatumId") int metadatumId,
@PayloadParam("value") String value);
/**
* Delete metadatum.
@ -98,7 +191,12 @@ public interface NodeApi {
*
* @return true on a successful removal, false if the metadatum was not found
*/
boolean deleteMetadatum(int id, int metadatumId);
@Named("node:deletemetadatum")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/nodes/{id}/metadata/{metadatumId}")
boolean deleteMetadatum(@PathParam("id") int id, @PathParam("metadatumId") int metadatumId);
/**
* Batch delete metadata given the specified ids.
@ -109,5 +207,11 @@ public interface NodeApi {
*
* @return true on a successful removal, false if the metadata was not found
*/
boolean deleteMetadata(int id, Iterable<Integer> metadataIds);
@Named("node:deletemetadata")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/nodes/{id}/metadata")
boolean deleteMetadata(@PathParam("id") int id,
@QueryParam("id") Iterable<Integer> metadataIds);
}

View File

@ -1,209 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import java.util.Map;
import java.util.Set;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyMapOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.options.PaginationOptions;
import org.jclouds.rackspace.cloudloadbalancers.v1.binders.BindMetadataToJsonPayload;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Metadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Node;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.UpdateNode;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.AddNode;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseMetadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNode;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNodes;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.annotations.WrapWith;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Cloud Load Balancers Node features.
* <p/>
*
* @see NodeAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface NodeAsyncApi {
/**
* @see NodeApi#add(Set)
*/
@Named("node:add")
@POST
@SelectJson("nodes")
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/nodes")
ListenableFuture<Set<Node>> add(@WrapWith("nodes") Iterable<AddNode> addNodes);
/**
* @see NodeApi#update(int, UpdateNode)
*/
@Named("node:update")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Path("/nodes/{id}")
ListenableFuture<Void> update(@PathParam("id") int id, @WrapWith("node") UpdateNode updateNode);
/**
* @see NodeApi#list()
*/
@Named("node:list")
@GET
@ResponseParser(ParseNodes.class)
@Transform(ParseNodes.ToPagedIterable.class)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/nodes")
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
ListenableFuture<PagedIterable<Node>> list();
/**
* @see NodeApi#list(PaginationOptions)
*/
@Named("node:list")
@GET
@ResponseParser(ParseNodes.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/nodes")
ListenableFuture<IterableWithMarker<LoadBalancer>> list(PaginationOptions options);
/**
* @see NodeApi#get(int)
*/
@Named("node:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseNode.class)
@Path("/nodes/{id}")
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Node> get(@PathParam("id") int id);
/**
* @see NodeApi#remove(int)
*/
@Named("node:remove")
@DELETE
@Path("/nodes/{id}")
@Fallback(VoidOnNotFoundOr404.class)
@Consumes("*/*")
ListenableFuture<Void> remove(@PathParam("id") int id);
/**
* @see NodeApi#remove(Set)
*/
@Named("node:remove")
@DELETE
@Path("/nodes")
@Fallback(VoidOnNotFoundOr404.class)
@Consumes("*/*")
ListenableFuture<Void> remove(@QueryParam("id") Iterable<Integer> ids);
/**
* @see NodeApi#createMetadata(int, Iterable)
*/
@Named("node:createmetadata")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/nodes/{id}/metadata")
ListenableFuture<Metadata> createMetadata(
@PathParam("id") int id,
@BinderParam(BindMetadataToJsonPayload.class) Map<String, String> metadata);
/**
* @see NodeApi#getMetadata(int)
*/
@Named("node:getmetadata")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseMetadata.class)
@Fallback(EmptyMapOnNotFoundOr404.class)
@Path("/nodes/{id}/metadata")
ListenableFuture<Metadata> getMetadata(@PathParam("id") int lb);
/**
* @see NodeApi#updateMetadatum(int, int, String)
*/
@Named("node:updatemetadatum")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes("*/*")
@Fallback(FalseOnNotFoundOr404.class)
@Payload("%7B\"meta\":%7B\"value\":\"{value}\"%7D%7D")
@Path("/nodes/{id}/metadata/{metadatumId}")
ListenableFuture<Boolean> updateMetadatum(@PathParam("id") int id,
@PathParam("metadatumId") int metadatumId,
@PayloadParam("value") String value);
/**
* @see NodeApi#deleteMetadatum(int, int)
*/
@Named("node:deletemetadatum")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/nodes/{id}/metadata/{metadatumId}")
ListenableFuture<Boolean> deleteMetadatum(@PathParam("id") int id, @PathParam("metadatumId") int metadatumId);
/**
* @see NodeApi#deleteMetadata(int, Iterable)
*/
@Named("node:deletemetadata")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Consumes("*/*")
@Path("/nodes/{id}/metadata")
ListenableFuture<Boolean> deleteMetadata(@PathParam("id") int id,
@QueryParam("id") Iterable<Integer> metadataIds);
}

View File

@ -20,63 +20,151 @@ package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import java.util.Date;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.options.PaginationOptions;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.HistoricalUsage;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerStats;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerUsage;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Protocol;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.DateParser;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseAlgorithms;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancerUsages;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancers;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Transform;
/**
* Reporting for load balancers.
* <p/>
* @see ReportAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ReportApi {
/**
* List billable load balancers for the given date range.
*/
PagedIterable<LoadBalancer> listBillableLoadBalancers(Date startTime, Date endTime);
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseLoadBalancers.class)
@Transform(ParseLoadBalancers.ToPagedIterable.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/billable")
PagedIterable<LoadBalancer> listBillableLoadBalancers(
@ParamParser(DateParser.class) @QueryParam("startTime") Date startTime,
@ParamParser(DateParser.class) @QueryParam("endTime") Date endTime);
@Named("report:list")
@GET
@ResponseParser(ParseLoadBalancers.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers/billable")
IterableWithMarker<LoadBalancer> listBillableLoadBalancers(PaginationOptions options);
/**
* View all transfer activity, average number of connections, and number of virtual IPs associated with the load
* balancing service. Historical usage data is available for up to 90 days of service activity.
*/
HistoricalUsage getHistoricalUsage(Date startTime, Date endTime);
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/usage")
HistoricalUsage getHistoricalUsage(
@ParamParser(DateParser.class) @QueryParam("startTime") Date startTime,
@ParamParser(DateParser.class) @QueryParam("endTime") Date endTime);
/**
* Historical usage data is available for up to 90 days of service activity.
*/
PagedIterable<LoadBalancerUsage> listLoadBalancerUsage(int loadBalancerId, Date startTime, Date endTime);
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseLoadBalancerUsages.class)
@Transform(ParseLoadBalancerUsages.ToPagedIterable.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage")
PagedIterable<LoadBalancerUsage> listLoadBalancerUsage(@PathParam("id") int loadBalancerId,
@ParamParser(DateParser.class) @QueryParam("startTime") Date startTime,
@ParamParser(DateParser.class) @QueryParam("endTime") Date endTime);
@Named("report:list")
@GET
@ResponseParser(ParseLoadBalancerUsages.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage")
IterableWithMarker<LoadBalancerUsage> listLoadBalancerUsage(PaginationOptions options);
/**
* Current usage represents all usage recorded within the preceding 24 hours.
*/
PagedIterable<LoadBalancerUsage> listCurrentLoadBalancerUsage(int loadBalancerId);
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseLoadBalancerUsages.class)
@Transform(ParseLoadBalancerUsages.ToPagedIterable.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage/current")
PagedIterable<LoadBalancerUsage> listCurrentLoadBalancerUsage(@PathParam("id") int loadBalancerId);
@Named("report:list")
@GET
@ResponseParser(ParseLoadBalancerUsages.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage/current")
IterableWithMarker<LoadBalancerUsage> listCurrentLoadBalancerUsage(PaginationOptions options);
/**
* Current usage represents all usage recorded within the preceding 24 hours.
*/
LoadBalancerStats getLoadBalancerStats(int loadBalancerId);
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/stats")
LoadBalancerStats getLoadBalancerStats(@PathParam("id") int loadBalancerId);
/**
* All load balancers must define the protocol of the service which is being load balanced. The protocol selection
* should be based on the protocol of the back-end nodes. When configuring a load balancer, the default port for
* the given protocol will be selected from this list unless otherwise specified.
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("protocols")
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/protocols")
Iterable<Protocol> listProtocols();
/**
* Get all of the possible algorthims usable by load balancers.
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseAlgorithms.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/algorithms")
Iterable<String> listAlgorithms();
}

View File

@ -1,183 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import java.util.Date;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.options.PaginationOptions;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.HistoricalUsage;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancer;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerStats;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.LoadBalancerUsage;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.Protocol;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.DateParser;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseAlgorithms;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancerUsages;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancers;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.ParamParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.Transform;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see ReportApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface ReportAsyncApi {
/**
* @see ReportApi#listBillableLoadBalancers(Date, Date)
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseLoadBalancers.class)
@Transform(ParseLoadBalancers.ToPagedIterable.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/billable")
ListenableFuture<PagedIterable<LoadBalancer>> listBillableLoadBalancers(
@ParamParser(DateParser.class) @QueryParam("startTime") Date startTime,
@ParamParser(DateParser.class) @QueryParam("endTime") Date endTime);
/**
* @see ReportApi#listBillableLoadBalancers(PaginationOptions)
*/
@Named("report:list")
@GET
@ResponseParser(ParseLoadBalancers.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers/billable")
ListenableFuture<IterableWithMarker<LoadBalancer>> listBillableLoadBalancers(PaginationOptions options);
/**
* @see ReportApi#getHistoricalUsage(Date, Date)
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/usage")
ListenableFuture<HistoricalUsage> getHistoricalUsage(
@ParamParser(DateParser.class) @QueryParam("startTime") Date startTime,
@ParamParser(DateParser.class) @QueryParam("endTime") Date endTime);
/**
* @see ReportApi#listLoadBalancerUsage(int, Date, Date)
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseLoadBalancerUsages.class)
@Transform(ParseLoadBalancerUsages.ToPagedIterable.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage")
ListenableFuture<PagedIterable<LoadBalancerUsage>> listLoadBalancerUsage(
@PathParam("id") int loadBalancerId,
@ParamParser(DateParser.class) @QueryParam("startTime") Date startTime,
@ParamParser(DateParser.class) @QueryParam("endTime") Date endTime);
/**
* @see ReportApi#listLoadBalancerUsage(PaginationOptions)
*/
@Named("report:list")
@GET
@ResponseParser(ParseLoadBalancerUsages.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage")
ListenableFuture<IterableWithMarker<LoadBalancerUsage>> listLoadBalancerUsage(PaginationOptions options);
/**
* @see ReportApi#listCurrentLoadBalancerUsage(int)
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseLoadBalancerUsages.class)
@Transform(ParseLoadBalancerUsages.ToPagedIterable.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage/current")
ListenableFuture<PagedIterable<LoadBalancerUsage>> listCurrentLoadBalancerUsage(
@PathParam("id") int loadBalancerId);
/**
* @see ReportApi#listCurrentLoadBalancerUsage(PaginationOptions)
*/
@Named("report:list")
@GET
@ResponseParser(ParseLoadBalancerUsages.class)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/usage/current")
ListenableFuture<IterableWithMarker<LoadBalancerUsage>> listCurrentLoadBalancerUsage(PaginationOptions options);
/**
* @see ReportApi#getLoadBalancerStats(int)
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/{id}/stats")
ListenableFuture<LoadBalancerStats> getLoadBalancerStats(
@PathParam("id") int loadBalancerId);
/**
* @see ReportApi#listProtocols()
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("protocols")
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/protocols")
ListenableFuture<Iterable<Protocol>> listProtocols();
/**
* @see ReportApi#listAlgorithms()
*/
@Named("report:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseAlgorithms.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/loadbalancers/algorithms")
ListenableFuture<Iterable<String>> listAlgorithms();
}

View File

@ -18,7 +18,23 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr422;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SSLTermination;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
/**
* The SSL Termination feature allows a load balancer user to terminate SSL traffic at the load balancer layer versus
@ -50,9 +66,9 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SSLTermination;
* be secure.</li>
* </ol>
*
* @see SSLTerminationAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface SSLTerminationApi {
/**
* Create or update SSL termination.
@ -71,11 +87,22 @@ public interface SSLTerminationApi {
* If a user wants to replace the existing SSL configuration, a new certificate, privatekey, and securePort
* combination must be provided instead of, or in addition to, the optional/editable attributes.
*/
void createOrUpdate(SSLTermination sslTermination);
@Named("ssltermination:create")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/ssltermination")
void createOrUpdate(@WrapWith("sslTermination") SSLTermination sslTermination);
/**
* Get SSL termination info.
*/
@Named("ssltermination:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("sslTermination")
@Fallback(NullOnNotFoundOr404.class)
@Path("/ssltermination")
SSLTermination get();
/**
@ -83,5 +110,10 @@ public interface SSLTerminationApi {
*
* @return true on a successful delete, false if the SSL termination was not found
*/
@Named("ssltermination:delete")
@DELETE
@Fallback(FalseOnNotFoundOr422.class)
@Path("/ssltermination")
@Consumes("*/*")
boolean delete();
}

View File

@ -1,81 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr422;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SSLTermination;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.annotations.WrapWith;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see SSLTerminationApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface SSLTerminationAsyncApi {
/**
* @see SSLTerminationApi#createOrUpdate(SSLTermination)
*/
@Named("ssltermination:create")
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/ssltermination")
ListenableFuture<Void> createOrUpdate(@WrapWith("sslTermination") SSLTermination sslTermination);
/**
* @see SSLTerminationApi#get()
*/
@Named("ssltermination:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@SelectJson("sslTermination")
@Fallback(NullOnNotFoundOr404.class)
@Path("/ssltermination")
ListenableFuture<SSLTermination> get();
/**
* @see SSLTerminationApi#delete()
*/
@Named("ssltermination:delete")
@DELETE
@Fallback(FalseOnNotFoundOr422.class)
@Path("/ssltermination")
@Consumes("*/*")
ListenableFuture<Boolean> delete();
}

View File

@ -18,7 +18,25 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SessionPersistence;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseSessionPersistence;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
/**
@ -26,15 +44,21 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SessionPersistence;
* directed to the same node. This is common with many web applications that do not inherently share application
* state between back-end servers. Two session persistence modes are available, HTTP Cookie and Source IP.
*
* @see SessionPersistenceAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface SessionPersistenceApi {
/**
* Get the current session persistence.
*
* @see SessionPersistence
*/
@Named("sessionpersistence:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseSessionPersistence.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/sessionpersistence")
SessionPersistence get();
/**
@ -42,12 +66,24 @@ public interface SessionPersistenceApi {
*
* @see SessionPersistence
*/
void create(SessionPersistence sessionPersistence);
@Named("sessionpersistence:create")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("%7B\"sessionPersistence\":%7B\"persistenceType\":\"{sessionPersistence}\"%7D%7D")
@Path("/sessionpersistence")
void create(@PayloadParam("sessionPersistence") SessionPersistence sessionPersistence);
/**
* Delete session persistence.
*
* @see SessionPersistence
*/
@Named("sessionpersistence:delete")
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/sessionpersistence")
void delete();
}

View File

@ -1,85 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.SessionPersistence;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseSessionPersistence;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.Payload;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.ResponseParser;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see SessionPersistenceApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface SessionPersistenceAsyncApi {
/**
* @see SessionPersistenceApi#get()
*/
@Named("sessionpersistence:get")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseSessionPersistence.class)
@Fallback(NullOnNotFoundOr404.class)
@Path("/sessionpersistence")
ListenableFuture<SessionPersistence> get();
/**
* @see SessionPersistenceApi#create(SessionPersistence)
*/
@Named("sessionpersistence:create")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Payload("%7B\"sessionPersistence\":%7B\"persistenceType\":\"{sessionPersistence}\"%7D%7D")
@Path("/sessionpersistence")
ListenableFuture<Void> create(@PayloadParam("sessionPersistence") SessionPersistence sessionPersistence);
/**
* @see SessionPersistenceApi#delete()
*/
@Named("sessionpersistence:delete")
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(VoidOnNotFoundOr404.class)
@Path("/sessionpersistence")
ListenableFuture<Void> delete();
}

View File

@ -18,8 +18,27 @@
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIPWithId;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.binders.BindToJsonPayload;
/**
* A virtual IP makes a load balancer accessible by clients. The load balancing service supports either a public VIP,
@ -27,18 +46,29 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIPWithId;
* resides.
* <p/>
*
* @see VirtualIPAsyncApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface VirtualIPApi {
/**
* Create a new virtual IP.
*/
VirtualIPWithId create(VirtualIP virtualIP);
@Named("virtualip:create")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/virtualips")
VirtualIPWithId create(@BinderParam(BindToJsonPayload.class) VirtualIP virtualIP);
/**
* List the virtual IPs.
*/
@Named("virtualip:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
@SelectJson("virtualIps")
@Path("/virtualips")
Iterable<VirtualIPWithId> list();
/**
@ -48,7 +78,12 @@ public interface VirtualIPApi {
*
* @return true on a successful delete, false if the virtual IP was not found
*/
boolean delete(int id);
@Named("virtualip:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/virtualips/{id}")
@Consumes("*/*")
boolean delete(@PathParam("id") int id);
/**
* Batch delete virtual IPs given the specified ids.
@ -61,5 +96,10 @@ public interface VirtualIPApi {
*
* @return true on a successful delete, false if the virtual IP was not found
*/
boolean delete(Iterable<Integer> ids);
@Named("virtualip:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/virtualips")
@Consumes("*/*")
boolean delete(@QueryParam("id") Iterable<Integer> ids);
}

View File

@ -1,95 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.rackspace.cloudloadbalancers.v1.features;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIP;
import org.jclouds.rackspace.cloudloadbalancers.v1.domain.VirtualIPWithId;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
import org.jclouds.rest.binders.BindToJsonPayload;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Provides asynchronous access to Rackspace Cloud Load Balancers via their REST API.
* <p/>
*
* @see VirtualIPApi
* @author Everett Toews
*/
@RequestFilters(AuthenticateRequest.class)
public interface VirtualIPAsyncApi {
/**
* @see VirtualIPApi#create(VirtualIP)
*/
@Named("virtualip:create")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
@Path("/virtualips")
ListenableFuture<VirtualIPWithId> create(@BinderParam(BindToJsonPayload.class) VirtualIP virtualIP);
/**
* @see VirtualIPApi#list()
*/
@Named("virtualip:list")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
@SelectJson("virtualIps")
@Path("/virtualips")
ListenableFuture<Iterable<VirtualIPWithId>> list();
/**
* @see VirtualIPApi#delete(int)
*/
@Named("virtualip:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/virtualips/{id}")
@Consumes("*/*")
ListenableFuture<Boolean> delete(@PathParam("id") int id);
/**
* @see VirtualIPApi#delete(Iterable)
*/
@Named("virtualip:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/virtualips")
@Consumes("*/*")
ListenableFuture<Boolean> delete(@QueryParam("id") Iterable<Integer> ids);
}

View File

@ -27,7 +27,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.internal.CallerArg0ToPagedIterable;
import org.jclouds.collect.internal.Arg0ToPagedIterable;
import org.jclouds.http.functions.ParseJson;
import org.jclouds.json.Json;
import org.jclouds.openstack.keystone.v2_0.domain.PaginatedCollection;
@ -38,6 +38,7 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.features.ReportApi;
import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseLoadBalancerUsages.LoadBalancerUsages;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.inject.TypeLiteral;
/**
@ -61,7 +62,7 @@ public class ParseLoadBalancerUsages extends ParseJson<LoadBalancerUsages> {
}
}
public static class ToPagedIterable extends CallerArg0ToPagedIterable<LoadBalancerUsage, ToPagedIterable> {
public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<LoadBalancerUsage, ToPagedIterable> {
private final CloudLoadBalancersApi api;
@ -71,7 +72,8 @@ public class ParseLoadBalancerUsages extends ParseJson<LoadBalancerUsages> {
}
@Override
protected Function<Object, IterableWithMarker<LoadBalancerUsage>> markerToNextForCallingArg0(final String zone) {
protected Function<Object, IterableWithMarker<LoadBalancerUsage>> markerToNextForArg0(Optional<Object> arg0) {
String zone = arg0.isPresent() ? arg0.get().toString() : null;
final ReportApi reportApi = api.getReportApiForZone(zone);
return new Function<Object, IterableWithMarker<LoadBalancerUsage>>() {

View File

@ -27,7 +27,7 @@ import javax.inject.Inject;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.IterableWithMarkers;
import org.jclouds.collect.internal.CallerArg0ToPagedIterable;
import org.jclouds.collect.internal.Arg0ToPagedIterable;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.http.functions.ParseJson;
@ -40,6 +40,7 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ConvertLB.Factory;
import org.jclouds.rest.InvocationContext;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
/**
@ -92,7 +93,7 @@ public class ParseLoadBalancers implements Function<HttpResponse, IterableWithMa
}
public static class ToPagedIterable extends CallerArg0ToPagedIterable<LoadBalancer, ToPagedIterable> {
public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<LoadBalancer, ToPagedIterable> {
private final CloudLoadBalancersApi api;
@ -102,7 +103,8 @@ public class ParseLoadBalancers implements Function<HttpResponse, IterableWithMa
}
@Override
protected Function<Object, IterableWithMarker<LoadBalancer>> markerToNextForCallingArg0(final String zone) {
protected Function<Object, IterableWithMarker<LoadBalancer>> markerToNextForArg0(Optional<Object> arg0) {
String zone = arg0.isPresent() ? arg0.get().toString() : null;
final LoadBalancerApi loadBalancerApi = api.getLoadBalancerApiForZone(zone);
return new Function<Object, IterableWithMarker<LoadBalancer>>() {

View File

@ -27,7 +27,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.internal.CallerArg0ToPagedIterable;
import org.jclouds.collect.internal.Arg0ToPagedIterable;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseJson;
import org.jclouds.json.Json;
@ -40,6 +40,7 @@ import org.jclouds.rackspace.cloudloadbalancers.v1.functions.ParseNodes.Nodes;
import com.google.common.annotations.Beta;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.inject.TypeLiteral;
/**
@ -64,7 +65,7 @@ public class ParseNodes extends ParseJson<Nodes> {
super(json, new TypeLiteral<Nodes>() { });
}
public static class ToPagedIterable extends CallerArg0ToPagedIterable<Node, ToPagedIterable> {
public static class ToPagedIterable extends Arg0ToPagedIterable.FromCaller<Node, ToPagedIterable> {
private final CloudLoadBalancersApi api;
private int lbId;
@ -86,7 +87,8 @@ public class ParseNodes extends ParseJson<Nodes> {
}
@Override
protected Function<Object, IterableWithMarker<Node>> markerToNextForCallingArg0(final String zone) {
protected Function<Object, IterableWithMarker<Node>> markerToNextForArg0(Optional<Object> arg0) {
String zone = arg0.isPresent() ? arg0.get().toString() : null;
final NodeApi nodeApi = api.getNodeApiForZoneAndLoadBalancer(zone, lbId);
return new Function<Object, IterableWithMarker<Node>>() {

View File

@ -25,16 +25,9 @@ import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
import java.net.URI;
import java.util.Properties;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApiMetadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.config.CloudLoadBalancersRestClientModule;
import org.jclouds.rackspace.cloudloadbalancers.v1.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Cloud LoadBalancers UK.
@ -72,18 +65,7 @@ public class CloudLoadBalancersUKProviderMetadata extends BaseProviderMetadata {
id("rackspace-cloudloadbalancers-uk")
.name("Rackspace Cloud Load Balancers UK")
.apiMetadata(new CloudLoadBalancersApiMetadata().toBuilder()
.identityName("${userName}")
.credentialName("${apiKey}")
.version("1.0")
.defaultEndpoint("https://lon.identity.api.rackspacecloud.com/v2.0/")
.endpointName("Identity service URL ending in /v2.0/")
.documentation(URI.create("http://docs.rackspace.com/loadbalancers/api/clb-devguide-latest/index.html"))
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationModule.class)
.add(ZoneModule.class)
.add(CloudLoadBalancersRestClientModule.class)
.add(CloudLoadBalancersLoadBalancerContextModule.class)
.build())
.build())
.homepage(URI.create("http://www.rackspace.co.uk/cloud-load-balancers/"))
.console(URI.create("https://mycloud.rackspace.co.uk"))

View File

@ -25,16 +25,9 @@ import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES;
import java.net.URI;
import java.util.Properties;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
import org.jclouds.rackspace.cloudloadbalancers.v1.CloudLoadBalancersApiMetadata;
import org.jclouds.rackspace.cloudloadbalancers.v1.config.CloudLoadBalancersRestClientModule;
import org.jclouds.rackspace.cloudloadbalancers.v1.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Cloud LoadBalancers US.
@ -74,18 +67,7 @@ public class CloudLoadBalancersUSProviderMetadata extends BaseProviderMetadata {
id("rackspace-cloudloadbalancers-us")
.name("Rackspace Cloud Load Balancers US")
.apiMetadata(new CloudLoadBalancersApiMetadata().toBuilder()
.identityName("${userName}")
.credentialName("${apiKey}")
.version("1.0")
.defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/")
.endpointName("Identity service URL ending in /v2.0/")
.documentation(URI.create("http://docs.rackspace.com/loadbalancers/api/clb-devguide-latest/index.html"))
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationModule.class)
.add(ZoneModule.class)
.add(CloudLoadBalancersRestClientModule.class)
.add(CloudLoadBalancersLoadBalancerContextModule.class)
.build())
.build())
.homepage(URI.create("http://www.rackspace.com/cloud/public/loadbalancers/"))
.console(URI.create("https://mycloud.rackspace.com"))