From 4a41e245f4b4873396c7d930c30f4d62ffa63641 Mon Sep 17 00:00:00 2001 From: adriancole Date: Tue, 9 Apr 2013 22:59:29 -0700 Subject: [PATCH] removed async api from ultradns-ws --- .../jclouds/ultradns/ws/UltraDNSWSApi.java | 16 +- .../ultradns/ws/UltraDNSWSApiMetadata.java | 21 ++- .../ultradns/ws/UltraDNSWSAsyncApi.java | 105 ----------- ...dule.java => UltraDNSWSHttpApiModule.java} | 34 +--- .../ws/features/ResourceRecordApi.java | 57 +++++- .../ws/features/ResourceRecordAsyncApi.java | 111 ------------ .../ws/features/RoundRobinPoolApi.java | 165 ++++++++++++------ .../ws/features/RoundRobinPoolAsyncApi.java | 141 --------------- .../jclouds/ultradns/ws/features/TaskApi.java | 45 ++++- .../ultradns/ws/features/TaskAsyncApi.java | 86 --------- .../ws/features/TrafficControllerPoolApi.java | 118 ++++++++++--- .../TrafficControllerPoolAsyncApi.java | 157 ----------------- .../jclouds/ultradns/ws/features/ZoneApi.java | 51 +++++- .../ultradns/ws/features/ZoneAsyncApi.java | 100 ----------- 14 files changed, 371 insertions(+), 836 deletions(-) delete mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java rename providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/config/{UltraDNSWSRestClientModule.java => UltraDNSWSHttpApiModule.java} (55%) delete mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java delete mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java delete mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java delete mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java delete mode 100644 providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneAsyncApi.java diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java index 4109cad821..827038d621 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java @@ -20,27 +20,41 @@ package org.jclouds.ultradns.ws; import java.io.Closeable; +import javax.inject.Named; +import javax.ws.rs.POST; + import org.jclouds.rest.annotations.Delegate; +import org.jclouds.rest.annotations.Payload; import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.VirtualHost; +import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.domain.Account; import org.jclouds.ultradns.ws.features.ResourceRecordApi; import org.jclouds.ultradns.ws.features.RoundRobinPoolApi; import org.jclouds.ultradns.ws.features.TaskApi; import org.jclouds.ultradns.ws.features.TrafficControllerPoolApi; import org.jclouds.ultradns.ws.features.ZoneApi; +import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; +import org.jclouds.ultradns.ws.xml.AccountHandler; /** * Provides access to Neustar UltraDNS via the SOAP API *

* - * @see UltraDNSWSAsyncApi * @see * @author Adrian Cole */ +@RequestFilters(SOAPWrapWithPasswordAuth.class) +@VirtualHost public interface UltraDNSWSApi extends Closeable { /** * Returns the account of the current user. */ + @Named("getAccountsListOfUser") + @POST + @XMLResponseParser(AccountHandler.class) + @Payload("") Account getCurrentAccount(); /** diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java index de7127e3a7..f0131fd819 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApiMetadata.java @@ -22,38 +22,37 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; -import org.jclouds.rest.internal.BaseRestApiMetadata; -import org.jclouds.ultradns.ws.config.UltraDNSWSRestClientModule; +import org.jclouds.rest.internal.BaseHttpApiMetadata; +import org.jclouds.ultradns.ws.config.UltraDNSWSHttpApiModule; /** * Implementation of {@link ApiMetadata} for Neustar's UltraDNSWS api. * * @author Adrian Cole */ -public class UltraDNSWSApiMetadata extends BaseRestApiMetadata { +public class UltraDNSWSApiMetadata extends BaseHttpApiMetadata { @Override public Builder toBuilder() { - return new Builder(getApi(), getAsyncApi()).fromApiMetadata(this); + return new Builder().fromApiMetadata(this); } public UltraDNSWSApiMetadata() { - this(new Builder(UltraDNSWSApi.class, UltraDNSWSAsyncApi.class)); + this(new Builder()); } protected UltraDNSWSApiMetadata(Builder builder) { - super(Builder.class.cast(builder)); + super(builder); } public static Properties defaultProperties() { - Properties properties = BaseRestApiMetadata.defaultProperties(); + Properties properties = BaseHttpApiMetadata.defaultProperties(); return properties; } - public static class Builder extends BaseRestApiMetadata.Builder { + public static class Builder extends BaseHttpApiMetadata.Builder { - protected Builder(Class api, Class asyncApi) { - super(api, asyncApi); + protected Builder() { id("ultradns-ws") .name("Neustar UltraDNS WS Api") .identityName("Username") @@ -62,7 +61,7 @@ public class UltraDNSWSApiMetadata extends BaseRestApiMetadata { .documentation(URI.create("https://portal.ultradns.com/static/docs/NUS_API_XML_SOAP.pdf")) .defaultEndpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01") .defaultProperties(UltraDNSWSApiMetadata.defaultProperties()) - .defaultModule(UltraDNSWSRestClientModule.class); + .defaultModule(UltraDNSWSHttpApiModule.class); } @Override diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java deleted file mode 100644 index fea3f8d684..0000000000 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSAsyncApi.java +++ /dev/null @@ -1,105 +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.ultradns.ws; - -import java.io.Closeable; - -import javax.inject.Named; -import javax.ws.rs.POST; - -import org.jclouds.rest.annotations.Delegate; -import org.jclouds.rest.annotations.Payload; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.ultradns.ws.domain.Account; -import org.jclouds.ultradns.ws.features.ResourceRecordAsyncApi; -import org.jclouds.ultradns.ws.features.RoundRobinPoolAsyncApi; -import org.jclouds.ultradns.ws.features.TaskAsyncApi; -import org.jclouds.ultradns.ws.features.TrafficControllerPoolAsyncApi; -import org.jclouds.ultradns.ws.features.ZoneAsyncApi; -import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.AccountHandler; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides access to Neustar UltraDNS via the SOAP API - *

- * - * @see - * @see - * @author Adrian Cole - * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(UltraDNSWSApi.class)} as - * {@link UltraDNSWSAsyncApi} interface will be removed in jclouds 1.7. - */ -@Deprecated -@RequestFilters(SOAPWrapWithPasswordAuth.class) -@VirtualHost -public interface UltraDNSWSAsyncApi extends Closeable { - - /** - * @see UltraDNSWSApi#getCurrentAccount() - */ - @Named("getAccountsListOfUser") - @POST - @XMLResponseParser(AccountHandler.class) - @Payload("") - ListenableFuture getCurrentAccount(); - - /** - * Provides asynchronous access to Zone features. - */ - @Delegate - ZoneAsyncApi getZoneApi(); - - /** - * Provides asynchronous access to Resource Record features. - * - * @param zoneName - * zoneName including a trailing dot - */ - @Delegate - ResourceRecordAsyncApi getResourceRecordApiForZone(@PayloadParam("zoneName") String zoneName); - - /** - * Provides asynchronous access to Round Robin Pool features. - * - * @param zoneName - * zoneName including a trailing dot - */ - @Delegate - RoundRobinPoolAsyncApi getRoundRobinPoolApiForZone(@PayloadParam("zoneName") String zoneName); - - /** - * Provides asynchronous access to Traffic Controller Pool features. - * - * @param zoneName - * zoneName including a trailing dot - */ - @Delegate - TrafficControllerPoolAsyncApi getTrafficControllerPoolApiForZone(@PayloadParam("zoneName") String zoneName); - - /** - * Provides asynchronous access to Task features. - */ - @Delegate - TaskAsyncApi getTaskApi(); -} diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/config/UltraDNSWSRestClientModule.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/config/UltraDNSWSHttpApiModule.java similarity index 55% rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/config/UltraDNSWSRestClientModule.java rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/config/UltraDNSWSHttpApiModule.java index a5aa13b662..9c23387cd1 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/config/UltraDNSWSRestClientModule.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/config/UltraDNSWSHttpApiModule.java @@ -18,48 +18,24 @@ */ package org.jclouds.ultradns.ws.config; -import java.util.Map; - import org.jclouds.http.HttpErrorHandler; import org.jclouds.http.HttpRetryHandler; import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.ServerError; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.config.RestClientModule; +import org.jclouds.rest.ConfiguresHttpApi; +import org.jclouds.rest.config.HttpApiModule; import org.jclouds.ultradns.ws.UltraDNSWSApi; -import org.jclouds.ultradns.ws.UltraDNSWSAsyncApi; -import org.jclouds.ultradns.ws.features.ResourceRecordApi; -import org.jclouds.ultradns.ws.features.ResourceRecordAsyncApi; -import org.jclouds.ultradns.ws.features.RoundRobinPoolApi; -import org.jclouds.ultradns.ws.features.RoundRobinPoolAsyncApi; -import org.jclouds.ultradns.ws.features.TaskApi; -import org.jclouds.ultradns.ws.features.TaskAsyncApi; -import org.jclouds.ultradns.ws.features.TrafficControllerPoolApi; -import org.jclouds.ultradns.ws.features.TrafficControllerPoolAsyncApi; -import org.jclouds.ultradns.ws.features.ZoneApi; -import org.jclouds.ultradns.ws.features.ZoneAsyncApi; import org.jclouds.ultradns.ws.handlers.UltraDNSWSErrorHandler; -import com.google.common.collect.ImmutableMap; - /** * Configures the UltraDNSWS connection. * * @author Adrian Cole */ -@ConfiguresRestClient -public class UltraDNSWSRestClientModule extends RestClientModule { - - public static final Map, Class> DELEGATE_MAP = ImmutableMap., Class> builder() - .put(ZoneApi.class, ZoneAsyncApi.class) - .put(ResourceRecordApi.class, ResourceRecordAsyncApi.class) - .put(RoundRobinPoolApi.class, RoundRobinPoolAsyncApi.class) - .put(TrafficControllerPoolApi.class, TrafficControllerPoolAsyncApi.class) - .put(TaskApi.class, TaskAsyncApi.class).build(); - - public UltraDNSWSRestClientModule() { - super(DELEGATE_MAP); +@ConfiguresHttpApi +public class UltraDNSWSHttpApiModule extends HttpApiModule { + public UltraDNSWSHttpApiModule() { } @Override diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java index f81ef402bb..77c309bca9 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordApi.java @@ -18,17 +18,35 @@ */ package org.jclouds.ultradns.ws.features; +import javax.inject.Named; +import javax.ws.rs.POST; + +import org.jclouds.Fallbacks.VoidOnNotFoundOr404; import org.jclouds.rest.ResourceNotFoundException; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.Payload; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.VirtualHost; +import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; +import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML; import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; +import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; +import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; import com.google.common.collect.FluentIterable; /** - * @see ResourceRecordAsyncApi + * @see + * @see * @author Adrian Cole */ +@RequestFilters(SOAPWrapWithPasswordAuth.class) +@VirtualHost public interface ResourceRecordApi { /** @@ -40,7 +58,12 @@ public interface ResourceRecordApi { * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs */ - String create(ResourceRecord toCreate) throws ResourceAlreadyExistsException; + @Named("createResourceRecord") + @POST + @XMLResponseParser(ElementTextHandler.Guid.class) + @MapBinder(ZoneAndResourceRecordToXML.class) + String create(@PayloadParam("resourceRecord") ResourceRecord toCreate) + throws ResourceAlreadyExistsException; /** * updates an existing resource record in the zone. @@ -53,7 +76,11 @@ public interface ResourceRecordApi { * @throws ResourceNotFoundException * if the guid doesn't exist */ - void update(String guid, ResourceRecord updated) throws ResourceNotFoundException; + @Named("updateResourceRecord") + @POST + @MapBinder(ZoneAndResourceRecordToXML.class) + void update(@PayloadParam("guid") String guid, + @PayloadParam("resourceRecord") ResourceRecord toCreate) throws ResourceNotFoundException; /** * Returns all the specified record types in the zone. @@ -61,6 +88,10 @@ public interface ResourceRecordApi { * @throws ResourceNotFoundException * if the zone doesn't exist */ + @Named("getResourceRecordsOfZone") + @POST + @XMLResponseParser(ResourceRecordListHandler.class) + @Payload("{zoneName}0") FluentIterable list() throws ResourceNotFoundException; /** @@ -72,7 +103,12 @@ public interface ResourceRecordApi { * @throws ResourceNotFoundException * if the zone doesn't exist */ - FluentIterable listByName(String hostName) throws ResourceNotFoundException; + @Named("getResourceRecordsOfDNameByType") + @POST + @XMLResponseParser(ResourceRecordListHandler.class) + @Payload("{zoneName}{hostName}0") + FluentIterable listByName(@PayloadParam("hostName") String hostName) + throws ResourceNotFoundException; /** * Returns all the specified record types in the zone with the fully @@ -86,7 +122,12 @@ public interface ResourceRecordApi { * @throws ResourceNotFoundException * if the zone doesn't exist */ - FluentIterable listByNameAndType(String hostName, int rrType) + @Named("getResourceRecordsOfDNameByType") + @POST + @XMLResponseParser(ResourceRecordListHandler.class) + @Payload("{zoneName}{hostName}{rrType}") + FluentIterable listByNameAndType( + @PayloadParam("hostName") String hostName, @PayloadParam("rrType") int rrType) throws ResourceNotFoundException; /** @@ -96,5 +137,9 @@ public interface ResourceRecordApi { * the global unique identifier for the resource record {@see * ResourceRecordMetadata#getGuid()} */ - void delete(String guid); + @Named("deleteResourceRecord") + @POST + @Payload("{guid}") + @Fallback(VoidOnNotFoundOr404.class) + void delete(@PayloadParam("guid") String guid); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java deleted file mode 100644 index bf720f96ba..0000000000 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ResourceRecordAsyncApi.java +++ /dev/null @@ -1,111 +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.ultradns.ws.features; - -import javax.inject.Named; -import javax.ws.rs.POST; - -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.rest.ResourceNotFoundException; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.Payload; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; -import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML; -import org.jclouds.ultradns.ws.domain.ResourceRecord; -import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; -import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.ElementTextHandler; -import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; - -import com.google.common.collect.FluentIterable; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see ResourceRecordApi - * @see - * @see - * @author Adrian Cole - */ -@RequestFilters(SOAPWrapWithPasswordAuth.class) -@VirtualHost -public interface ResourceRecordAsyncApi { - - /** - * @see ResourceRecordApi#create(ResourceRecordMetadata) - */ - @Named("createResourceRecord") - @POST - @XMLResponseParser(ElementTextHandler.Guid.class) - @MapBinder(ZoneAndResourceRecordToXML.class) - ListenableFuture create(@PayloadParam("resourceRecord") ResourceRecord toCreate) - throws ResourceAlreadyExistsException; - - /** - * @see ResourceRecordApi#update(String guid, BasicResourceRecord) - */ - @Named("updateResourceRecord") - @POST - @MapBinder(ZoneAndResourceRecordToXML.class) - ListenableFuture update(@PayloadParam("guid") String guid, - @PayloadParam("resourceRecord") ResourceRecord toCreate) throws ResourceNotFoundException; - - /** - * @see ResourceRecordApi#list() - */ - @Named("getResourceRecordsOfZone") - @POST - @XMLResponseParser(ResourceRecordListHandler.class) - @Payload("{zoneName}0") - ListenableFuture> list() throws ResourceNotFoundException; - - /** - * @see ResourceRecordApi#listByName(String) - */ - @Named("getResourceRecordsOfDNameByType") - @POST - @XMLResponseParser(ResourceRecordListHandler.class) - @Payload("{zoneName}{hostName}0") - ListenableFuture> listByName(@PayloadParam("hostName") String hostName) - throws ResourceNotFoundException; - - /** - * @see ResourceRecordApi#listByNameAndType(String, int) - */ - @Named("getResourceRecordsOfDNameByType") - @POST - @XMLResponseParser(ResourceRecordListHandler.class) - @Payload("{zoneName}{hostName}{rrType}") - ListenableFuture> listByNameAndType( - @PayloadParam("hostName") String hostName, @PayloadParam("rrType") int rrType) - throws ResourceNotFoundException; - - /** - * @see ResourceRecordApi#delete(String) - */ - @Named("deleteResourceRecord") - @POST - @Payload("{guid}") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture delete(@PayloadParam("guid") String guid); -} diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java index 9c4eb87f18..80c198499a 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java @@ -18,19 +18,62 @@ */ package org.jclouds.ultradns.ws.features; +import javax.inject.Named; +import javax.ws.rs.POST; + +import org.jclouds.Fallbacks.VoidOnNotFoundOr404; import org.jclouds.rest.ResourceNotFoundException; +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.VirtualHost; +import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.domain.ResourceRecord; import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata; import org.jclouds.ultradns.ws.domain.RoundRobinPool; +import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; +import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; +import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler; import com.google.common.collect.FluentIterable; /** - * @see RoundRobinPoolAsyncApi + * @see + * @see * @author Adrian Cole */ +@RequestFilters(SOAPWrapWithPasswordAuth.class) +@VirtualHost public interface RoundRobinPoolApi { + + /** + * Returns all round robin pools in the zone. + * + * @throws ResourceNotFoundException + * if the zone doesn't exist + */ + @Named("getLoadBalancingPoolsByZone") + @POST + @XMLResponseParser(RoundRobinPoolListHandler.class) + @Payload("{zoneName}RR") + FluentIterable list() throws ResourceNotFoundException; + + /** + * Returns all records in the round robin pool. + * + * @throws ResourceNotFoundException + * if the pool doesn't exist + */ + @Named("getRRPoolRecords") + @POST + @XMLResponseParser(ResourceRecordListHandler.class) + @Payload("{poolId}") + FluentIterable listRecords(@PayloadParam("poolId") String poolId) + throws ResourceNotFoundException; + /** * creates a round robin pool for {@code A} (ipv4) records * @@ -43,7 +86,12 @@ public interface RoundRobinPoolApi { * @throws ResourceAlreadyExistsException * if a pool already exists with the same attrs */ - String createAPoolForHostname(String name, String hostname) throws ResourceAlreadyExistsException; + @Named("addRRLBPool") + @POST + @XMLResponseParser(ElementTextHandler.RRPoolID.class) + @Payload("{zoneName}{hostName}{description}1") + String createAPoolForHostname(@PayloadParam("description") String name, + @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; /** * adds a new {@code A} record to the pool @@ -58,37 +106,12 @@ public interface RoundRobinPoolApi { * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs */ - String addARecordWithAddressAndTTL(String lbPoolID, String ipv4Address, int ttl) - throws ResourceAlreadyExistsException; - - /** - * creates a round robin pool for {@code AAAA} (ipv6) records - * - * @param name - * {@link RoundRobinPool#getName() name} of the RR pool - * @param hostname - * {@link RoundRobinPool#getDName() hostname} {ex. - * www.jclouds.org.} - * @return the {@code guid} of the new record - * @throws ResourceAlreadyExistsException - * if a pool already exists with the same attrs - */ - String createAAAAPoolForHostname(String name, String hostname) throws ResourceAlreadyExistsException; - - /** - * adds a new {@code AAAA} record to the pool - * - * @param lbPoolID - * the pool to add the record to. - * @param ipv6Address - * the ipv6 address - * @param ttl - * the {@link ResourceRecord#getTTL ttl} of the record - * @return the {@code guid} of the new record - * @throws ResourceAlreadyExistsException - * if a record already exists with the same attrs - */ - String addAAAARecordWithAddressAndTTL(String lbPoolID, String ipv6Address, int ttl) + @Named("addRecordToRRPool") + @POST + @XMLResponseParser(ElementTextHandler.Guid.class) + @Payload("") + String addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, + @PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; /** @@ -107,24 +130,12 @@ public interface RoundRobinPoolApi { * @throws ResourceNotFoundException * if the guid doesn't exist */ - void updateRecordWithAddressAndTTL(String lbPoolID, String guid, String address, int ttl) - throws ResourceNotFoundException; - - /** - * Returns all round robin pools in the zone. - * - * @throws ResourceNotFoundException - * if the zone doesn't exist - */ - FluentIterable list() throws ResourceNotFoundException; - - /** - * Returns all records in the round robin pool. - * - * @throws ResourceNotFoundException - * if the pool doesn't exist - */ - FluentIterable listRecords(String poolId) throws ResourceNotFoundException; + @Named("updateRecordOfRRPool") + @POST + @Payload("") + void updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, + @PayloadParam("guid") String guid, @PayloadParam("address") String ipv4Address, + @PayloadParam("ttl") int ttl) throws ResourceNotFoundException; /** * deletes a specific pooled resource record @@ -133,7 +144,51 @@ public interface RoundRobinPoolApi { * the global unique identifier for the resource record {@see * ResourceRecordMetadata#getGuid()} */ - void deleteRecord(String guid); + @Named("deleteRecordOfRRPool") + @POST + @Payload("{guid}") + @Fallback(VoidOnNotFoundOr404.class) + void deleteRecord(@PayloadParam("guid") String guid); + + /** + * creates a round robin pool for {@code AAAA} (ipv6) records + * + * @param name + * {@link RoundRobinPool#getName() name} of the RR pool + * @param hostname + * {@link RoundRobinPool#getDName() hostname} {ex. + * www.jclouds.org.} + * @return the {@code guid} of the new record + * @throws ResourceAlreadyExistsException + * if a pool already exists with the same attrs + */ + @Named("addRRLBPool") + @POST + @XMLResponseParser(ElementTextHandler.RRPoolID.class) + @Payload("{zoneName}{hostName}{description}28") + String createAAAAPoolForHostname(@PayloadParam("description") String name, + @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; + + /** + * adds a new {@code AAAA} record to the pool + * + * @param lbPoolID + * the pool to add the record to. + * @param ipv6Address + * the ipv6 address + * @param ttl + * the {@link ResourceRecord#getTTL ttl} of the record + * @return the {@code guid} of the new record + * @throws ResourceAlreadyExistsException + * if a record already exists with the same attrs + */ + @Named("addRecordToRRPool") + @POST + @XMLResponseParser(ElementTextHandler.Guid.class) + @Payload("") + String addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, + @PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl) + throws ResourceAlreadyExistsException; /** * removes a pool and all its records and probes @@ -141,5 +196,9 @@ public interface RoundRobinPoolApi { * @param id * the {@link RoundRobinPool#getId() id} */ - void delete(String id); + @Named("deleteLBPool") + @POST + @Payload("{lbPoolID}Yes") + @Fallback(VoidOnNotFoundOr404.class) + void delete(@PayloadParam("lbPoolID") String id); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java deleted file mode 100644 index c1981c4306..0000000000 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolAsyncApi.java +++ /dev/null @@ -1,141 +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.ultradns.ws.features; - -import javax.inject.Named; -import javax.ws.rs.POST; - -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.rest.ResourceNotFoundException; -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.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; -import org.jclouds.ultradns.ws.domain.ResourceRecord; -import org.jclouds.ultradns.ws.domain.RoundRobinPool; -import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.ElementTextHandler; -import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler; -import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler; - -import com.google.common.collect.FluentIterable; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see RoundRobinPoolApi - * @see - * @see - * @author Adrian Cole - */ -@RequestFilters(SOAPWrapWithPasswordAuth.class) -@VirtualHost -public interface RoundRobinPoolAsyncApi { - - /** - * @see RoundRobinPoolApi#list() - */ - @Named("getLoadBalancingPoolsByZone") - @POST - @XMLResponseParser(RoundRobinPoolListHandler.class) - @Payload("{zoneName}RR") - ListenableFuture> list() throws ResourceNotFoundException; - - /** - * @see RoundRobinPoolApi#listRecords(String) - */ - @Named("getRRPoolRecords") - @POST - @XMLResponseParser(ResourceRecordListHandler.class) - @Payload("{poolId}") - ListenableFuture> listRecords(@PayloadParam("poolId") String poolId) - throws ResourceNotFoundException; - - /** - * @see RoundRobinPoolApi#createAPoolForHostname - */ - @Named("addRRLBPool") - @POST - @XMLResponseParser(ElementTextHandler.RRPoolID.class) - @Payload("{zoneName}{hostName}{description}1") - ListenableFuture createAPoolForHostname(@PayloadParam("description") String name, - @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; - - /** - * @see RoundRobinPoolApi#addARecordWithAddressAndTTL - */ - @Named("addRecordToRRPool") - @POST - @XMLResponseParser(ElementTextHandler.Guid.class) - @Payload("") - ListenableFuture addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, - @PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl) - throws ResourceAlreadyExistsException; - - /** - * @see RoundRobinPoolApi#updateRecordWithAddressAndTTL - */ - @Named("updateRecordOfRRPool") - @POST - @Payload("") - ListenableFuture updateRecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, - @PayloadParam("guid") String guid, @PayloadParam("address") String ipv4Address, - @PayloadParam("ttl") int ttl) throws ResourceNotFoundException; - - /** - * @see RoundRobinPoolApi#deleteRecord(String) - */ - @Named("deleteRecordOfRRPool") - @POST - @Payload("{guid}") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture deleteRecord(@PayloadParam("guid") String guid); - - /** - * @see RoundRobinPoolApi#createAAAAPoolForHostname - */ - @Named("addRRLBPool") - @POST - @XMLResponseParser(ElementTextHandler.RRPoolID.class) - @Payload("{zoneName}{hostName}{description}28") - ListenableFuture createAAAAPoolForHostname(@PayloadParam("description") String name, - @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; - - /** - * @see RoundRobinPoolApi#addAAAARecordWithAddressAndTTL - */ - @Named("addRecordToRRPool") - @POST - @XMLResponseParser(ElementTextHandler.Guid.class) - @Payload("") - ListenableFuture addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID, - @PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl) - throws ResourceAlreadyExistsException; - - /** - * @see RoundRobinPoolApi#delete(String) - */ - @Named("deleteLBPool") - @POST - @Payload("{lbPoolID}Yes") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture delete(@PayloadParam("lbPoolID") String id); -} diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java index 910718818f..a378ba6eea 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskApi.java @@ -18,41 +18,76 @@ */ package org.jclouds.ultradns.ws.features; +import javax.inject.Named; +import javax.ws.rs.POST; + +import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.Fallbacks.VoidOnNotFoundOr404; import org.jclouds.javax.annotation.Nullable; +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.VirtualHost; +import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.domain.Task; +import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; +import org.jclouds.ultradns.ws.xml.TaskHandler; +import org.jclouds.ultradns.ws.xml.TaskListHandler; import com.google.common.collect.FluentIterable; /** - * @see TaskAsyncApi + * @see + * @see * @author Adrian Cole */ +@RequestFilters(SOAPWrapWithPasswordAuth.class) +@VirtualHost public interface TaskApi { /** * Runs a test task * * @return guid of the task created */ - String runTest(String value); + @Named("runTest") + @POST + @XMLResponseParser(ElementTextHandler.Guid.class) + @Payload("{value}") + String runTest(@PayloadParam("value") String value); /** * @param guid * guid of the task to get information about. * @return null if not found */ + @Named("getStatusForTask") + @POST + @XMLResponseParser(TaskHandler.class) + @Payload("{guid}") + @Fallback(NullOnNotFoundOr404.class) @Nullable - Task get(String guid); + Task get(@PayloadParam("guid") String name); /** * Lists all tasks. */ + @Named("getAllTasks") + @POST + @XMLResponseParser(TaskListHandler.class) + @Payload("") FluentIterable list(); - + /** * clears a background task in either a COMPLETE or ERROR state. * * @param guid * guid of the task to clear. */ - void clear(String guid); + @Named("clearTask") + @POST + @Payload("{guid}") + @Fallback(VoidOnNotFoundOr404.class) + void clear(@PayloadParam("guid") String name); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java deleted file mode 100644 index 6b35392fe1..0000000000 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TaskAsyncApi.java +++ /dev/null @@ -1,86 +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.ultradns.ws.features; - -import javax.inject.Named; -import javax.ws.rs.POST; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -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.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.ultradns.ws.domain.Task; -import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.ElementTextHandler; -import org.jclouds.ultradns.ws.xml.TaskHandler; -import org.jclouds.ultradns.ws.xml.TaskListHandler; - -import com.google.common.collect.FluentIterable; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see TaskApi - * @see - * @see - * @author Adrian Cole - */ -@RequestFilters(SOAPWrapWithPasswordAuth.class) -@VirtualHost -public interface TaskAsyncApi { - /** - * @see TaskApi#runTest(String) - */ - @Named("runTest") - @POST - @XMLResponseParser(ElementTextHandler.Guid.class) - @Payload("{value}") - ListenableFuture runTest(@PayloadParam("value") String value); - - /** - * @see TaskApi#get(String) - */ - @Named("getStatusForTask") - @POST - @XMLResponseParser(TaskHandler.class) - @Payload("{guid}") - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PayloadParam("guid") String name); - - /** - * @see TaskApi#list() - */ - @Named("getAllTasks") - @POST - @XMLResponseParser(TaskListHandler.class) - @Payload("") - ListenableFuture> list(); - - /** - * @see TaskApi#clear(String) - */ - @Named("clearTask") - @POST - @Payload("{guid}") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture clear(@PayloadParam("guid") String name); -} diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java index dbca7f0627..79759943eb 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolApi.java @@ -18,30 +18,44 @@ */ package org.jclouds.ultradns.ws.features; +import javax.inject.Named; +import javax.ws.rs.POST; + +import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.Fallbacks.VoidOnNotFoundOr404; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.ResourceNotFoundException; +import org.jclouds.rest.annotations.Fallback; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.Payload; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.annotations.VirtualHost; +import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; +import org.jclouds.ultradns.ws.binders.UpdatePoolRecordToXML; import org.jclouds.ultradns.ws.domain.PoolRecordSpec; import org.jclouds.ultradns.ws.domain.TrafficControllerPool; import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; import org.jclouds.ultradns.ws.domain.UpdatePoolRecord; +import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; +import org.jclouds.ultradns.ws.xml.AttributeHandler; +import org.jclouds.ultradns.ws.xml.ElementTextHandler; +import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler; +import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler; +import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler; import com.google.common.collect.FluentIterable; /** - * @see TrafficControllerPoolAsyncApi + * @see + * @see * @author Adrian Cole */ +@RequestFilters(SOAPWrapWithPasswordAuth.class) +@VirtualHost public interface TrafficControllerPoolApi { - /** - * Returns all traffic controller pools in the zone. - * - * @throws ResourceNotFoundException - * if the zone doesn't exist - */ - FluentIterable list() throws ResourceNotFoundException; - /** * creates a traffic controller pool. * @@ -54,7 +68,37 @@ public interface TrafficControllerPoolApi { * @throws ResourceAlreadyExistsException * if a pool already exists with the same attrs */ - String createPoolForHostname(String name, String hostname) throws ResourceAlreadyExistsException; + @Named("addTCLBPool") + @POST + @XMLResponseParser(ElementTextHandler.TCPoolID.class) + @Payload("{zoneName}{hostName}{description}1EnabledEnabled0") + String createPoolForHostname(@PayloadParam("description") String name, @PayloadParam("hostName") String hostname) + throws ResourceAlreadyExistsException; + + /** + * Returns all traffic controller pools in the zone. + * + * @throws ResourceNotFoundException + * if the zone doesn't exist + */ + @Named("getLoadBalancingPoolsByZone") + @POST + @XMLResponseParser(TrafficControllerPoolListHandler.class) + @Payload("{zoneName}TC") + FluentIterable list() throws ResourceNotFoundException; + + /** + * Returns all records in the traffic controller pool. + * + * @throws ResourceNotFoundException + * if the pool doesn't exist + */ + @Named("getPoolRecords") + @POST + @XMLResponseParser(TrafficControllerPoolRecordListHandler.class) + @Payload("{poolId}") + FluentIterable listRecords(@PayloadParam("poolId") String poolId) + throws ResourceNotFoundException; /** * Retrieves the name of the specified pool by dname. @@ -64,7 +108,12 @@ public interface TrafficControllerPoolApi { * @return null if not found */ @Nullable - String getNameByDName(String dname); + @Named("getPoolForPoolHostName>") + @POST + @Payload("{hostName}") + @XMLResponseParser(AttributeHandler.PoolName.class) + @Fallback(NullOnNotFoundOr404.class) + String getNameByDName(@PayloadParam("hostName") String dname); /** * removes a pool and all its records and probes @@ -72,15 +121,11 @@ public interface TrafficControllerPoolApi { * @param id * the {@link TrafficControllerPool#getId() id} */ - void delete(String id); - - /** - * Returns all records in the traffic controller pool. - * - * @throws ResourceNotFoundException - * if the pool doesn't exist - */ - FluentIterable listRecords(String poolId) throws ResourceNotFoundException; + @Named("deleteLBPool") + @POST + @Payload("{lbPoolID}Yes") + @Fallback(VoidOnNotFoundOr404.class) + void delete(@PayloadParam("lbPoolID") String id); /** * adds a new record to the pool with default weight. @@ -96,7 +141,12 @@ public interface TrafficControllerPoolApi { * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs */ - String addRecordToPoolWithTTL(String pointsTo, String lbPoolID, int ttl) throws ResourceAlreadyExistsException; + @Named("addPoolRecord") + @POST + @XMLResponseParser(ElementTextHandler.PoolRecordID.class) + @Payload("{poolID}{pointsTo}{ttl}") + String addRecordToPoolWithTTL(@PayloadParam("pointsTo") String pointsTo, @PayloadParam("poolID") String lbPoolID, + @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; /** * adds a new record to the pool with a specified weight. @@ -114,7 +164,12 @@ public interface TrafficControllerPoolApi { * @throws ResourceAlreadyExistsException * if a record already exists with the same attrs */ - String addRecordToPoolWithTTLAndWeight(String pointsTo, String lbPoolID, int ttl, int weight) + @Named("addPoolRecord") + @POST + @XMLResponseParser(ElementTextHandler.PoolRecordID.class) + @Payload("{poolID}{pointsTo}{ttl}{weight}") + String addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String pointsTo, + @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl, @PayloadParam("weight") int weight) throws ResourceAlreadyExistsException; /** @@ -122,8 +177,13 @@ public interface TrafficControllerPoolApi { * {@link TrafficControllerPoolRecord#getId()} * @return null if not found */ + @Named("getPoolRecordSpec>") + @POST + @Payload("{poolRecordId}") + @XMLResponseParser(PoolRecordSpecHandler.class) + @Fallback(NullOnNotFoundOr404.class) @Nullable - PoolRecordSpec getRecordSpec(String poolRecordID); + PoolRecordSpec getRecordSpec(@PayloadParam("poolRecordId") String poolRecordID); /** * This request updates an existing pool record. @@ -137,7 +197,11 @@ public interface TrafficControllerPoolApi { * @throws ResourceNotFoundException * if the record doesn't exist */ - void updateRecord(String poolRecordID, UpdatePoolRecord update) throws ResourceNotFoundException; + @Named("updatePoolRecord>") + @POST + @MapBinder(UpdatePoolRecordToXML.class) + void updateRecord(@PayloadParam("poolRecordID") String poolRecordID, @PayloadParam("update") UpdatePoolRecord update) + throws ResourceNotFoundException; /** * deletes a specific pooled resource record @@ -145,6 +209,10 @@ public interface TrafficControllerPoolApi { * @param poolRecordID * {@see TrafficControllerPoolRecord#getId()} */ - void deleteRecord(String poolRecordID); + @Named("deletePoolRecord") + @POST + @Payload("{poolRecordID}") + @Fallback(VoidOnNotFoundOr404.class) + void deleteRecord(@PayloadParam("poolRecordID") String poolRecordID); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java deleted file mode 100644 index 9c9a4a61ad..0000000000 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/TrafficControllerPoolAsyncApi.java +++ /dev/null @@ -1,157 +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.ultradns.ws.features; - -import javax.inject.Named; -import javax.ws.rs.POST; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.rest.ResourceNotFoundException; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.Payload; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; -import org.jclouds.ultradns.ws.binders.UpdatePoolRecordToXML; -import org.jclouds.ultradns.ws.domain.PoolRecordSpec; -import org.jclouds.ultradns.ws.domain.TrafficControllerPool; -import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord; -import org.jclouds.ultradns.ws.domain.UpdatePoolRecord; -import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.AttributeHandler; -import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler; -import org.jclouds.ultradns.ws.xml.ElementTextHandler; -import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler; -import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler; - -import com.google.common.collect.FluentIterable; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see TrafficControllerPoolApi - * @see - * @see - * @author Adrian Cole - */ -@RequestFilters(SOAPWrapWithPasswordAuth.class) -@VirtualHost -public interface TrafficControllerPoolAsyncApi { - - /** - * @see RoundRobinPoolApi#createPoolForHostname - */ - @Named("addTCLBPool") - @POST - @XMLResponseParser(ElementTextHandler.TCPoolID.class) - @Payload("{zoneName}{hostName}{description}1EnabledEnabled0") - ListenableFuture createPoolForHostname(@PayloadParam("description") String name, - @PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException; - - /** - * @see TrafficControllerPoolApi#list() - */ - @Named("getLoadBalancingPoolsByZone") - @POST - @XMLResponseParser(TrafficControllerPoolListHandler.class) - @Payload("{zoneName}TC") - ListenableFuture> list() throws ResourceNotFoundException; - - /** - * @see TrafficControllerPoolApi#listRecords(String) - */ - @Named("getPoolRecords") - @POST - @XMLResponseParser(TrafficControllerPoolRecordListHandler.class) - @Payload("{poolId}") - ListenableFuture> listRecords(@PayloadParam("poolId") String poolId) - throws ResourceNotFoundException; - - /** - * @see TrafficControllerPoolApi#getByDName(String) - */ - @Named("getPoolForPoolHostName>") - @POST - @Payload("{hostName}") - @XMLResponseParser(AttributeHandler.PoolName.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getNameByDName(@PayloadParam("hostName") String dname); - - /** - * @see TrafficControllerPoolApi#delete(String) - */ - @Named("deleteLBPool") - @POST - @Payload("{lbPoolID}Yes") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture delete(@PayloadParam("lbPoolID") String id); - - /** - * @see TrafficControllerPoolApi#addRecordToPoolWithTTL - */ - @Named("addPoolRecord") - @POST - @XMLResponseParser(ElementTextHandler.PoolRecordID.class) - @Payload("{poolID}{pointsTo}{ttl}") - ListenableFuture addRecordToPoolWithTTL(@PayloadParam("pointsTo") String pointsTo, - @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException; - - /** - * @see TrafficControllerPoolApi#addRecordToPoolWithTTLAndWeight - */ - @Named("addPoolRecord") - @POST - @XMLResponseParser(ElementTextHandler.PoolRecordID.class) - @Payload("{poolID}{pointsTo}{ttl}{weight}") - ListenableFuture addRecordToPoolWithTTLAndWeight(@PayloadParam("pointsTo") String pointsTo, - @PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl, @PayloadParam("weight") int weight) - throws ResourceAlreadyExistsException; - - /** - * @see TrafficControllerPoolApi#getRecordSpec(String) - */ - @Named("getPoolRecordSpec>") - @POST - @Payload("{poolRecordId}") - @XMLResponseParser(PoolRecordSpecHandler.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getRecordSpec(@PayloadParam("poolRecordId") String poolRecordID); - - /** - * @see TrafficControllerPoolApi#getRecordSpec(String) - */ - @Named("updatePoolRecord>") - @POST - @MapBinder(UpdatePoolRecordToXML.class) - ListenableFuture updateRecord(@PayloadParam("poolRecordID") String poolRecordID, - @PayloadParam("update") UpdatePoolRecord update) throws ResourceNotFoundException; - - /** - * @see TrafficControllerPoolApi#deleteRecord(String) - */ - @Named("deletePoolRecord") - @POST - @Payload("{poolRecordID}") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture deleteRecord(@PayloadParam("poolRecordID") String poolRecordID); - -} diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java index f2f9b36291..5466e434ee 100644 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java +++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneApi.java @@ -18,19 +18,36 @@ */ package org.jclouds.ultradns.ws.features; +import javax.inject.Named; +import javax.ws.rs.POST; + +import org.jclouds.Fallbacks.NullOnNotFoundOr404; +import org.jclouds.Fallbacks.VoidOnNotFoundOr404; import org.jclouds.javax.annotation.Nullable; import org.jclouds.rest.ResourceNotFoundException; +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.VirtualHost; +import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; import org.jclouds.ultradns.ws.domain.Zone; import org.jclouds.ultradns.ws.domain.Zone.Type; import org.jclouds.ultradns.ws.domain.ZoneProperties; +import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; +import org.jclouds.ultradns.ws.xml.ZoneListHandler; +import org.jclouds.ultradns.ws.xml.ZonePropertiesHandler; import com.google.common.collect.FluentIterable; /** - * @see ZoneAsyncApi + * @see + * @see * @author Adrian Cole */ +@RequestFilters(SOAPWrapWithPasswordAuth.class) +@VirtualHost public interface ZoneApi { /** @@ -42,7 +59,11 @@ public interface ZoneApi { * @param accountId * the account to create the zone in */ - void createInAccount(String name, String accountId) throws ResourceAlreadyExistsException; + @Named("createPrimaryZone") + @POST + @Payload("{accountId}{zoneName}false") + void createInAccount(@PayloadParam("zoneName") String name, @PayloadParam("accountId") String accountId) + throws ResourceAlreadyExistsException; /** * @param name @@ -50,15 +71,24 @@ public interface ZoneApi { * zone to get information about. * @return null if not found */ + @Named("getGeneralPropertiesForZone") + @POST + @XMLResponseParser(ZonePropertiesHandler.class) + @Payload("{zoneName}") + @Fallback(NullOnNotFoundOr404.class) @Nullable - ZoneProperties get(String name); + ZoneProperties get(@PayloadParam("zoneName") String name); /** * Lists all zones in the specified account. * * @returns empty if no zones, or account doesn't exist */ - FluentIterable listByAccount(String accountId); + @Named("getZonesOfAccount") + @POST + @XMLResponseParser(ZoneListHandler.class) + @Payload("{accountId}all") + FluentIterable listByAccount(@PayloadParam("accountId") String accountId); /** * Lists all zones in the specified account of type @@ -66,7 +96,12 @@ public interface ZoneApi { * @throws ResourceNotFoundException * if the account doesn't exist */ - FluentIterable listByAccountAndType(String accountId, Type type) throws ResourceNotFoundException; + @Named("getZonesOfAccount") + @POST + @XMLResponseParser(ZoneListHandler.class) + @Payload("{accountId}{zoneType}") + FluentIterable listByAccountAndType(@PayloadParam("accountId") String accountId, + @PayloadParam("zoneType") Type type) throws ResourceNotFoundException; /** * deletes a zone and all its resource records @@ -76,5 +111,9 @@ public interface ZoneApi { * zone you want to delete. * @return null if not found */ - void delete(String name); + @Named("deleteZone") + @POST + @Payload("{zoneName}") + @Fallback(VoidOnNotFoundOr404.class) + void delete(@PayloadParam("zoneName") String name); } diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneAsyncApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneAsyncApi.java deleted file mode 100644 index d8d955bd9c..0000000000 --- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/ZoneAsyncApi.java +++ /dev/null @@ -1,100 +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.ultradns.ws.features; - -import javax.inject.Named; -import javax.ws.rs.POST; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.Fallbacks.VoidOnNotFoundOr404; -import org.jclouds.rest.ResourceNotFoundException; -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.VirtualHost; -import org.jclouds.rest.annotations.XMLResponseParser; -import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsException; -import org.jclouds.ultradns.ws.domain.Zone; -import org.jclouds.ultradns.ws.domain.Zone.Type; -import org.jclouds.ultradns.ws.domain.ZoneProperties; -import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth; -import org.jclouds.ultradns.ws.xml.ZoneListHandler; -import org.jclouds.ultradns.ws.xml.ZonePropertiesHandler; - -import com.google.common.collect.FluentIterable; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see ZoneApi - * @see - * @see - * @author Adrian Cole - */ -@RequestFilters(SOAPWrapWithPasswordAuth.class) -@VirtualHost -public interface ZoneAsyncApi { - - /** - * @see ZoneApi#createInAccount(String, String - */ - @Named("createPrimaryZone") - @POST - @Payload("{accountId}{zoneName}false") - ListenableFuture createInAccount(@PayloadParam("zoneName") String name, - @PayloadParam("accountId") String accountId) throws ResourceAlreadyExistsException; - - /** - * @see ZoneApi#get(String) - */ - @Named("getGeneralPropertiesForZone") - @POST - @XMLResponseParser(ZonePropertiesHandler.class) - @Payload("{zoneName}") - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PayloadParam("zoneName") String name); - - /** - * @see ZoneApi#listByAccount(String) - */ - @Named("getZonesOfAccount") - @POST - @XMLResponseParser(ZoneListHandler.class) - @Payload("{accountId}all") - ListenableFuture> listByAccount(@PayloadParam("accountId") String accountId); - - /** - * @see ZoneApi#listByAccountAndType(String, Type) - */ - @Named("getZonesOfAccount") - @POST - @XMLResponseParser(ZoneListHandler.class) - @Payload("{accountId}{zoneType}") - ListenableFuture> listByAccountAndType(@PayloadParam("accountId") String accountId, - @PayloadParam("zoneType") Type type) throws ResourceNotFoundException; - - /** - * @see ZoneApi#delete(String) - */ - @Named("deleteZone") - @POST - @Payload("{zoneName}") - @Fallback(VoidOnNotFoundOr404.class) - ListenableFuture delete(@PayloadParam("zoneName") String name); -}