All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jclouds.ultradns.ws.features.RoundRobinPoolApi Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF 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.ParamParser;
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.ResourceRecordDetail;
import org.jclouds.ultradns.ws.domain.RoundRobinPool;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.internal.RoundRobinPoolRecordTypeToString;
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 
 * @see 
 */
@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.
    * 
    * @param name
    *           {@link RoundRobinPool#getName() name} of the RR pool
    * @param dname
    *           {@link RoundRobinPool#getDName() dname} of the RR pool {ex.
    *           www.jclouds.org.}
    * @param rrType
    *           the {@link RoundRobinPool.RecordType record type} supported.
    * @return the {@code guid} of the new pool
    * @throws ResourceAlreadyExistsException
    *            if a pool already exists with the same attrs
    */
   @Named("addRRLBPool")
   @POST
   @XMLResponseParser(ElementTextHandler.RRPoolID.class)
   @Payload("{zoneName}{hostName}{description}{poolRecordType}")
   String createForDNameAndType(@PayloadParam("description") String name, @PayloadParam("hostName") String dname,
         @PayloadParam("poolRecordType") @ParamParser(RoundRobinPoolRecordTypeToString.class) int rrType)
         throws ResourceAlreadyExistsException;

   /**
    * adds a new {@code A} record to the pool
    * 
    * @param lbPoolID
    *           the pool to add the record to.
    * @param ipv4Address
    *           the ipv4 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 addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
         @PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl)
         throws ResourceAlreadyExistsException;

   /**
    * updates an existing A or AAAA record in the pool.
    * 
    * @param lbPoolID
    *           the pool to add the record to.
    * @param guid
    *           the global unique identifier for the resource record {@see
    *           ResourceRecordMetadata#getGuid()}
    * @param address
    *           the ipv4 or ipv6 address
    * @param ttl
    *           the {@link ResourceRecord#getTTL ttl} of the record
    * 
    * @throws ResourceNotFoundException
    *            if the guid doesn't exist
    */
   @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
    * 
    * @param guid
    *           the global unique identifier for the resource record {@see
    *           ResourceRecordMetadata#getGuid()}
    */
   @Named("deleteRecordOfRRPool")
   @POST
   @Payload("{guid}")
   @Fallback(VoidOnNotFoundOr404.class)
   void deleteRecord(@PayloadParam("guid") String guid);

   /**
    * 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
    * 
    * @param id
    *           the {@link RoundRobinPool#getId() id}
    */
   @Named("deleteLBPool")
   @POST
   @Payload("{lbPoolID}Yes")
   @Fallback(VoidOnNotFoundOr404.class)
   void delete(@PayloadParam("lbPoolID") String id);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy