removed async api from ultradns-ws

This commit is contained in:
adriancole 2013-04-09 22:59:29 -07:00
parent 8c75a556db
commit 4a41e245f4
14 changed files with 371 additions and 836 deletions

View File

@ -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
* <p/>
*
* @see UltraDNSWSAsyncApi
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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("<v01:getAccountsListOfUser/>")
Account getCurrentAccount();
/**

View File

@ -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<UltraDNSWSApi> {
@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<Builder> {
public static class Builder extends BaseHttpApiMetadata.Builder<UltraDNSWSApi, 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

View File

@ -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
* <p/>
*
* @see <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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("<v01:getAccountsListOfUser/>")
ListenableFuture<Account> 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();
}

View File

@ -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<UltraDNSWSApi, UltraDNSWSAsyncApi> {
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, 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<UltraDNSWSApi> {
public UltraDNSWSHttpApiModule() {
}
@Override

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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("<v01:getResourceRecordsOfZone><zoneName>{zoneName}</zoneName><rrType>0</rrType></v01:getResourceRecordsOfZone>")
FluentIterable<ResourceRecordMetadata> list() throws ResourceNotFoundException;
/**
@ -72,7 +103,12 @@ public interface ResourceRecordApi {
* @throws ResourceNotFoundException
* if the zone doesn't exist
*/
FluentIterable<ResourceRecordMetadata> listByName(String hostName) throws ResourceNotFoundException;
@Named("getResourceRecordsOfDNameByType")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>0</rrType></v01:getResourceRecordsOfDNameByType>")
FluentIterable<ResourceRecordMetadata> 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<ResourceRecordMetadata> listByNameAndType(String hostName, int rrType)
@Named("getResourceRecordsOfDNameByType")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>{rrType}</rrType></v01:getResourceRecordsOfDNameByType>")
FluentIterable<ResourceRecordMetadata> 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("<v01:deleteResourceRecord><transactionID /><guid>{guid}</guid></v01:deleteResourceRecord>")
@Fallback(VoidOnNotFoundOr404.class)
void delete(@PayloadParam("guid") String guid);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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<String> create(@PayloadParam("resourceRecord") ResourceRecord toCreate)
throws ResourceAlreadyExistsException;
/**
* @see ResourceRecordApi#update(String guid, BasicResourceRecord)
*/
@Named("updateResourceRecord")
@POST
@MapBinder(ZoneAndResourceRecordToXML.class)
ListenableFuture<Void> update(@PayloadParam("guid") String guid,
@PayloadParam("resourceRecord") ResourceRecord toCreate) throws ResourceNotFoundException;
/**
* @see ResourceRecordApi#list()
*/
@Named("getResourceRecordsOfZone")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfZone><zoneName>{zoneName}</zoneName><rrType>0</rrType></v01:getResourceRecordsOfZone>")
ListenableFuture<FluentIterable<ResourceRecord>> list() throws ResourceNotFoundException;
/**
* @see ResourceRecordApi#listByName(String)
*/
@Named("getResourceRecordsOfDNameByType")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>0</rrType></v01:getResourceRecordsOfDNameByType>")
ListenableFuture<FluentIterable<ResourceRecordMetadata>> listByName(@PayloadParam("hostName") String hostName)
throws ResourceNotFoundException;
/**
* @see ResourceRecordApi#listByNameAndType(String, int)
*/
@Named("getResourceRecordsOfDNameByType")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getResourceRecordsOfDNameByType><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><rrType>{rrType}</rrType></v01:getResourceRecordsOfDNameByType>")
ListenableFuture<FluentIterable<ResourceRecordMetadata>> listByNameAndType(
@PayloadParam("hostName") String hostName, @PayloadParam("rrType") int rrType)
throws ResourceNotFoundException;
/**
* @see ResourceRecordApi#delete(String)
*/
@Named("deleteResourceRecord")
@POST
@Payload("<v01:deleteResourceRecord><transactionID /><guid>{guid}</guid></v01:deleteResourceRecord>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> delete(@PayloadParam("guid") String guid);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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("<v01:getLoadBalancingPoolsByZone><zoneName>{zoneName}</zoneName><lbPoolType>RR</lbPoolType></v01:getLoadBalancingPoolsByZone>")
FluentIterable<RoundRobinPool> 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("<v01:getRRPoolRecords><lbPoolId>{poolId}</lbPoolId></v01:getRRPoolRecords>")
FluentIterable<ResourceRecordMetadata> 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("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><rrGUID /></v01:addRRLBPool>")
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("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
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<RoundRobinPool> list() throws ResourceNotFoundException;
/**
* Returns all records in the round robin pool.
*
* @throws ResourceNotFoundException
* if the pool doesn't exist
*/
FluentIterable<ResourceRecordMetadata> listRecords(String poolId) throws ResourceNotFoundException;
@Named("updateRecordOfRRPool")
@POST
@Payload("<v01:updateRecordOfRRPool><transactionID /><resourceRecord rrGuid=\"{guid}\" lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" TTL=\"{ttl}\"/></v01:updateRecordOfRRPool>")
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("<v01:deleteRecordOfRRPool><transactionID /><guid>{guid}</guid></v01:deleteRecordOfRRPool>")
@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("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool>")
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("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
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("<v01:deleteLBPool><transactionID /><lbPoolID>{lbPoolID}</lbPoolID><DeleteAll>Yes</DeleteAll><retainRecordId /></v01:deleteLBPool>")
@Fallback(VoidOnNotFoundOr404.class)
void delete(@PayloadParam("lbPoolID") String id);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @author Adrian Cole
*/
@RequestFilters(SOAPWrapWithPasswordAuth.class)
@VirtualHost
public interface RoundRobinPoolAsyncApi {
/**
* @see RoundRobinPoolApi#list()
*/
@Named("getLoadBalancingPoolsByZone")
@POST
@XMLResponseParser(RoundRobinPoolListHandler.class)
@Payload("<v01:getLoadBalancingPoolsByZone><zoneName>{zoneName}</zoneName><lbPoolType>RR</lbPoolType></v01:getLoadBalancingPoolsByZone>")
ListenableFuture<FluentIterable<RoundRobinPool>> list() throws ResourceNotFoundException;
/**
* @see RoundRobinPoolApi#listRecords(String)
*/
@Named("getRRPoolRecords")
@POST
@XMLResponseParser(ResourceRecordListHandler.class)
@Payload("<v01:getRRPoolRecords><lbPoolId>{poolId}</lbPoolId></v01:getRRPoolRecords>")
ListenableFuture<FluentIterable<ResourceRecord>> listRecords(@PayloadParam("poolId") String poolId)
throws ResourceNotFoundException;
/**
* @see RoundRobinPoolApi#createAPoolForHostname
*/
@Named("addRRLBPool")
@POST
@XMLResponseParser(ElementTextHandler.RRPoolID.class)
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><rrGUID /></v01:addRRLBPool>")
ListenableFuture<String> createAPoolForHostname(@PayloadParam("description") String name,
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#addARecordWithAddressAndTTL
*/
@Named("addRecordToRRPool")
@POST
@XMLResponseParser(ElementTextHandler.Guid.class)
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
ListenableFuture<String> addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl)
throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#updateRecordWithAddressAndTTL
*/
@Named("updateRecordOfRRPool")
@POST
@Payload("<v01:updateRecordOfRRPool><transactionID /><resourceRecord rrGuid=\"{guid}\" lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" TTL=\"{ttl}\"/></v01:updateRecordOfRRPool>")
ListenableFuture<Void> 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("<v01:deleteRecordOfRRPool><transactionID /><guid>{guid}</guid></v01:deleteRecordOfRRPool>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteRecord(@PayloadParam("guid") String guid);
/**
* @see RoundRobinPoolApi#createAAAAPoolForHostname
*/
@Named("addRRLBPool")
@POST
@XMLResponseParser(ElementTextHandler.RRPoolID.class)
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool>")
ListenableFuture<String> createAAAAPoolForHostname(@PayloadParam("description") String name,
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#addAAAARecordWithAddressAndTTL
*/
@Named("addRecordToRRPool")
@POST
@XMLResponseParser(ElementTextHandler.Guid.class)
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
ListenableFuture<String> addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
@PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl)
throws ResourceAlreadyExistsException;
/**
* @see RoundRobinPoolApi#delete(String)
*/
@Named("deleteLBPool")
@POST
@Payload("<v01:deleteLBPool><transactionID /><lbPoolID>{lbPoolID}</lbPoolID><DeleteAll>Yes</DeleteAll><retainRecordId /></v01:deleteLBPool>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> delete(@PayloadParam("lbPoolID") String id);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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("<v01:runTest><value>{value}</value></v01:runTest>")
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("<v01:getStatusForTask><id><guid>{guid}</guid></id></v01:getStatusForTask>")
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Task get(String guid);
Task get(@PayloadParam("guid") String name);
/**
* Lists all tasks.
*/
@Named("getAllTasks")
@POST
@XMLResponseParser(TaskListHandler.class)
@Payload("<v01:getAllTasks/>")
FluentIterable<Task> 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("<v01:clearTask><id><guid>{guid}</guid></id></v01:clearTask>")
@Fallback(VoidOnNotFoundOr404.class)
void clear(@PayloadParam("guid") String name);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @author Adrian Cole
*/
@RequestFilters(SOAPWrapWithPasswordAuth.class)
@VirtualHost
public interface TaskAsyncApi {
/**
* @see TaskApi#runTest(String)
*/
@Named("runTest")
@POST
@XMLResponseParser(ElementTextHandler.Guid.class)
@Payload("<v01:runTest><value>{value}</value></v01:runTest>")
ListenableFuture<String> runTest(@PayloadParam("value") String value);
/**
* @see TaskApi#get(String)
*/
@Named("getStatusForTask")
@POST
@XMLResponseParser(TaskHandler.class)
@Payload("<v01:getStatusForTask><id><guid>{guid}</guid></id></v01:getStatusForTask>")
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<Task> get(@PayloadParam("guid") String name);
/**
* @see TaskApi#list()
*/
@Named("getAllTasks")
@POST
@XMLResponseParser(TaskListHandler.class)
@Payload("<v01:getAllTasks/>")
ListenableFuture<FluentIterable<Task>> list();
/**
* @see TaskApi#clear(String)
*/
@Named("clearTask")
@POST
@Payload("<v01:clearTask><id><guid>{guid}</guid></id></v01:clearTask>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> clear(@PayloadParam("guid") String name);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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<TrafficControllerPool> 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("<v01:addTCLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool>")
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("<v01:getLoadBalancingPoolsByZone><zoneName>{zoneName}</zoneName><lbPoolType>TC</lbPoolType></v01:getLoadBalancingPoolsByZone>")
FluentIterable<TrafficControllerPool> 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("<v01:getPoolRecords><poolId>{poolId}</poolId></v01:getPoolRecords>")
FluentIterable<TrafficControllerPoolRecord> 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("<v01:getPoolForPoolHostName><hostName>{hostName}</hostName></v01:getPoolForPoolHostName>")
@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<TrafficControllerPoolRecord> listRecords(String poolId) throws ResourceNotFoundException;
@Named("deleteLBPool")
@POST
@Payload("<v01:deleteLBPool><transactionID /><lbPoolID>{lbPoolID}</lbPoolID><DeleteAll>Yes</DeleteAll><retainRecordId /></v01:deleteLBPool>")
@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("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight /><mode /><threshold /></v01:addPoolRecord>")
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("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight>{weight}</weight><mode /><threshold /></v01:addPoolRecord>")
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("<v01:getPoolRecordSpec><poolRecordId>{poolRecordId}</poolRecordId></v01:getPoolRecordSpec>")
@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("<v01:deletePoolRecord><transactionID /><poolRecordID>{poolRecordID}</poolRecordID><parentPoolId /><childPoolId /></v01:deletePoolRecord>")
@Fallback(VoidOnNotFoundOr404.class)
void deleteRecord(@PayloadParam("poolRecordID") String poolRecordID);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @author Adrian Cole
*/
@RequestFilters(SOAPWrapWithPasswordAuth.class)
@VirtualHost
public interface TrafficControllerPoolAsyncApi {
/**
* @see RoundRobinPoolApi#createPoolForHostname
*/
@Named("addTCLBPool")
@POST
@XMLResponseParser(ElementTextHandler.TCPoolID.class)
@Payload("<v01:addTCLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool>")
ListenableFuture<String> createPoolForHostname(@PayloadParam("description") String name,
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
/**
* @see TrafficControllerPoolApi#list()
*/
@Named("getLoadBalancingPoolsByZone")
@POST
@XMLResponseParser(TrafficControllerPoolListHandler.class)
@Payload("<v01:getLoadBalancingPoolsByZone><zoneName>{zoneName}</zoneName><lbPoolType>TC</lbPoolType></v01:getLoadBalancingPoolsByZone>")
ListenableFuture<FluentIterable<TrafficControllerPool>> list() throws ResourceNotFoundException;
/**
* @see TrafficControllerPoolApi#listRecords(String)
*/
@Named("getPoolRecords")
@POST
@XMLResponseParser(TrafficControllerPoolRecordListHandler.class)
@Payload("<v01:getPoolRecords><poolId>{poolId}</poolId></v01:getPoolRecords>")
ListenableFuture<FluentIterable<TrafficControllerPoolRecord>> listRecords(@PayloadParam("poolId") String poolId)
throws ResourceNotFoundException;
/**
* @see TrafficControllerPoolApi#getByDName(String)
*/
@Named("getPoolForPoolHostName>")
@POST
@Payload("<v01:getPoolForPoolHostName><hostName>{hostName}</hostName></v01:getPoolForPoolHostName>")
@XMLResponseParser(AttributeHandler.PoolName.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<String> getNameByDName(@PayloadParam("hostName") String dname);
/**
* @see TrafficControllerPoolApi#delete(String)
*/
@Named("deleteLBPool")
@POST
@Payload("<v01:deleteLBPool><transactionID /><lbPoolID>{lbPoolID}</lbPoolID><DeleteAll>Yes</DeleteAll><retainRecordId /></v01:deleteLBPool>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> delete(@PayloadParam("lbPoolID") String id);
/**
* @see TrafficControllerPoolApi#addRecordToPoolWithTTL
*/
@Named("addPoolRecord")
@POST
@XMLResponseParser(ElementTextHandler.PoolRecordID.class)
@Payload("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight /><mode /><threshold /></v01:addPoolRecord>")
ListenableFuture<String> 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("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight>{weight}</weight><mode /><threshold /></v01:addPoolRecord>")
ListenableFuture<String> 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("<v01:getPoolRecordSpec><poolRecordId>{poolRecordId}</poolRecordId></v01:getPoolRecordSpec>")
@XMLResponseParser(PoolRecordSpecHandler.class)
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<PoolRecordSpec> getRecordSpec(@PayloadParam("poolRecordId") String poolRecordID);
/**
* @see TrafficControllerPoolApi#getRecordSpec(String)
*/
@Named("updatePoolRecord>")
@POST
@MapBinder(UpdatePoolRecordToXML.class)
ListenableFuture<Void> updateRecord(@PayloadParam("poolRecordID") String poolRecordID,
@PayloadParam("update") UpdatePoolRecord update) throws ResourceNotFoundException;
/**
* @see TrafficControllerPoolApi#deleteRecord(String)
*/
@Named("deletePoolRecord")
@POST
@Payload("<v01:deletePoolRecord><transactionID /><poolRecordID>{poolRecordID}</poolRecordID><parentPoolId /><childPoolId /></v01:deletePoolRecord>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> deleteRecord(@PayloadParam("poolRecordID") String poolRecordID);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @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("<v01:createPrimaryZone><transactionID /><accountId>{accountId}</accountId><zoneName>{zoneName}</zoneName><forceImport>false</forceImport></v01:createPrimaryZone>")
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("<v01:getGeneralPropertiesForZone><zoneName>{zoneName}</zoneName></v01:getGeneralPropertiesForZone>")
@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<Zone> listByAccount(String accountId);
@Named("getZonesOfAccount")
@POST
@XMLResponseParser(ZoneListHandler.class)
@Payload("<v01:getZonesOfAccount><accountId>{accountId}</accountId><zoneType>all</zoneType></v01:getZonesOfAccount>")
FluentIterable<Zone> 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<Zone> listByAccountAndType(String accountId, Type type) throws ResourceNotFoundException;
@Named("getZonesOfAccount")
@POST
@XMLResponseParser(ZoneListHandler.class)
@Payload("<v01:getZonesOfAccount><accountId>{accountId}</accountId><zoneType>{zoneType}</zoneType></v01:getZonesOfAccount>")
FluentIterable<Zone> 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("<v01:deleteZone><transactionID /><zoneName>{zoneName}</zoneName></v01:deleteZone>")
@Fallback(VoidOnNotFoundOr404.class)
void delete(@PayloadParam("zoneName") String name);
}

View File

@ -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 <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
* @author Adrian Cole
*/
@RequestFilters(SOAPWrapWithPasswordAuth.class)
@VirtualHost
public interface ZoneAsyncApi {
/**
* @see ZoneApi#createInAccount(String, String
*/
@Named("createPrimaryZone")
@POST
@Payload("<v01:createPrimaryZone><transactionID /><accountId>{accountId}</accountId><zoneName>{zoneName}</zoneName><forceImport>false</forceImport></v01:createPrimaryZone>")
ListenableFuture<Void> createInAccount(@PayloadParam("zoneName") String name,
@PayloadParam("accountId") String accountId) throws ResourceAlreadyExistsException;
/**
* @see ZoneApi#get(String)
*/
@Named("getGeneralPropertiesForZone")
@POST
@XMLResponseParser(ZonePropertiesHandler.class)
@Payload("<v01:getGeneralPropertiesForZone><zoneName>{zoneName}</zoneName></v01:getGeneralPropertiesForZone>")
@Fallback(NullOnNotFoundOr404.class)
ListenableFuture<ZoneProperties> get(@PayloadParam("zoneName") String name);
/**
* @see ZoneApi#listByAccount(String)
*/
@Named("getZonesOfAccount")
@POST
@XMLResponseParser(ZoneListHandler.class)
@Payload("<v01:getZonesOfAccount><accountId>{accountId}</accountId><zoneType>all</zoneType></v01:getZonesOfAccount>")
ListenableFuture<FluentIterable<Zone>> listByAccount(@PayloadParam("accountId") String accountId);
/**
* @see ZoneApi#listByAccountAndType(String, Type)
*/
@Named("getZonesOfAccount")
@POST
@XMLResponseParser(ZoneListHandler.class)
@Payload("<v01:getZonesOfAccount><accountId>{accountId}</accountId><zoneType>{zoneType}</zoneType></v01:getZonesOfAccount>")
ListenableFuture<FluentIterable<Zone>> listByAccountAndType(@PayloadParam("accountId") String accountId,
@PayloadParam("zoneType") Type type) throws ResourceNotFoundException;
/**
* @see ZoneApi#delete(String)
*/
@Named("deleteZone")
@POST
@Payload("<v01:deleteZone><transactionID /><zoneName>{zoneName}</zoneName></v01:deleteZone>")
@Fallback(VoidOnNotFoundOr404.class)
ListenableFuture<Void> delete(@PayloadParam("zoneName") String name);
}