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

org.jclouds.abiquo.features.PricingAsyncApi Maven / Gradle / Ivy

There is a newer version: 1.6.0
Show newest version
/**
 * 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.abiquo.features;

import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.abiquo.binders.BindToPath;
import org.jclouds.abiquo.binders.BindToXMLPayloadAndPath;
import org.jclouds.abiquo.http.filters.AbiquoAuthentication;
import org.jclouds.abiquo.http.filters.AppendApiVersionToMediaType;
import org.jclouds.abiquo.rest.annotations.EndpointLink;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.JAXBResponseParser;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.binders.BindToXMLPayload;

import com.abiquo.server.core.pricing.CostCodeCurrenciesDto;
import com.abiquo.server.core.pricing.CostCodeDto;
import com.abiquo.server.core.pricing.CostCodesDto;
import com.abiquo.server.core.pricing.CurrenciesDto;
import com.abiquo.server.core.pricing.CurrencyDto;
import com.abiquo.server.core.pricing.PricingCostCodeDto;
import com.abiquo.server.core.pricing.PricingCostCodesDto;
import com.abiquo.server.core.pricing.PricingTemplateDto;
import com.abiquo.server.core.pricing.PricingTemplatesDto;
import com.abiquo.server.core.pricing.PricingTierDto;
import com.abiquo.server.core.pricing.PricingTiersDto;
import com.google.common.util.concurrent.ListenableFuture;

/**
 * Provides synchronous access to Abiquo Pricing API.
 * 
 * @see API: 
 *      http://community.abiquo.com/display/ABI20/APIReference
 * @see PricingAsyncApi
 * @author Ignasi Barrera
 * @author Susana Acedo
 */
@RequestFilters({ AbiquoAuthentication.class, AppendApiVersionToMediaType.class })
@Path("/config")
public interface PricingAsyncApi {
   /*********************** Currency ********************** */

   /**
    * @see ConfigApi#listCurrencies()
    */
   @Named("currency:list")
   @GET
   @Path("/currencies")
   @Consumes(CurrenciesDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture listCurrencies();

   /**
    * @see ConfigApi#getCurrency(Integer)
    */
   @Named("currency:get")
   @GET
   @Path("/currencies/{currency}")
   @Consumes(CurrencyDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getCurrency(@PathParam("currency") Integer currencyId);

   /**
    * @see ConfigApi#createCurrency(CurrencyDto)
    */
   @Named("currency:create")
   @POST
   @Path("/currencies")
   @Produces(CurrencyDto.BASE_MEDIA_TYPE)
   @Consumes(CurrencyDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture createCurrency(@BinderParam(BindToXMLPayload.class) CurrencyDto currency);

   /**
    * @see ConfigApi#updateCurrency(CurrencyDto)
    */
   @Named("currency:update")
   @PUT
   @Produces(CurrencyDto.BASE_MEDIA_TYPE)
   @Consumes(CurrencyDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture updateCurrency(
         @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) CurrencyDto currency);

   /**
    * @see ConfigApi#deleteCurrency(CurrencyDto)
    */
   @Named("currency:delete")
   @DELETE
   ListenableFuture deleteCurrency(@EndpointLink("edit") @BinderParam(BindToPath.class) CurrencyDto currency);

   /*********************** CostCode ********************** */

   /**
    * @see PricingApi#listCostCodes()
    */
   @Named("costcode:list")
   @GET
   @Path("/costcodes")
   @Consumes(CostCodesDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture listCostCodes();

   /**
    * @see PricingApi#getCostCode(Integer)
    */
   @Named("costcode:get")
   @GET
   @Path("/costcodes/{costcode}")
   @Consumes(CostCodeDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getCostCode(@PathParam("costcode") Integer costcodeId);

   /**
    * @see PricingApi#createCostCode(CostCodeDto)
    */
   @Named("costcode:create")
   @POST
   @Path("/costcodes")
   @Produces(CostCodeDto.BASE_MEDIA_TYPE)
   @Consumes(CostCodeDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture createCostCode(@BinderParam(BindToXMLPayload.class) CostCodeDto costcode);

   /**
    * @see PricingApi#updateCostCode(CostCodeDto)
    */
   @Named("costcode:update")
   @PUT
   @Produces(CostCodeDto.BASE_MEDIA_TYPE)
   @Consumes(CostCodeDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture updateCostCode(
         @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) CostCodeDto costcode);

   /**
    * @see PricingApi#deleteCostCode(CostCodeDto)
    */
   @Named("costcode:delete")
   @DELETE
   ListenableFuture deleteCostCode(@EndpointLink("edit") @BinderParam(BindToPath.class) CostCodeDto costcode);

   /*********************** PricingTemplate ********************** */

   /**
    * @see PricingApi#listPricingTemplates()
    */
   @Named("pricingtemplate:list")
   @GET
   @Path("/pricingtemplates")
   @Consumes(PricingTemplatesDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture listPricingTemplates();

   /**
    * @see PricingApi#getPricingTemplate(Integer)
    */
   @Named("pricingtemplate:get")
   @GET
   @Path("/pricingtemplates/{pricingtemplate}")
   @Consumes(PricingTemplateDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getPricingTemplate(@PathParam("pricingtemplate") Integer pricingTemplateId);

   /**
    * @see PricingApi#createPricingTemplate(PricingTemplateDto)
    */
   @Named("pricingtemplate:create")
   @POST
   @Path("/pricingtemplates")
   @Produces(PricingTemplateDto.BASE_MEDIA_TYPE)
   @Consumes(PricingTemplateDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture createPricingTemplate(
         @BinderParam(BindToXMLPayload.class) PricingTemplateDto pricingtemplate);

   /**
    * @see PricingApi#updatePricingTemplate(PricingTemplateDto)
    */
   @Named("pricingtemplate:update")
   @PUT
   @Produces(PricingTemplateDto.BASE_MEDIA_TYPE)
   @Consumes(PricingTemplateDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture updatePricingTemplate(
         @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) PricingTemplateDto pricingtemplate);

   /**
    * @see PricingApi#deletePricingTemplate(PricingTemplateDto)
    */
   @Named("pricingtemplate:delete")
   @DELETE
   ListenableFuture deletePricingTemplate(
         @EndpointLink("edit") @BinderParam(BindToPath.class) PricingTemplateDto pricingtemplate);

   /*********************** CostCodeCurrency ********************** */

   /**
    * @see PricingApi#getCostCodeCurrency(Integer)
    */
   @Named("costcodecurrency:get")
   @GET
   @Path("/costcodes/{costcode}/currencies")
   @Consumes(CostCodeCurrenciesDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getCostCodeCurrencies(@PathParam("costcode") Integer costcodeId,
         @QueryParam("idCurrency") Integer currencyId);

   /**
    * @see PricingApi#updateCostCodeCurrencies(CostCodeCurrenciesDto)
    */
   @Named("costcodecurrency:update")
   @PUT
   @Path("/costcodes/{costcode}/currencies")
   @Produces(CostCodeCurrenciesDto.BASE_MEDIA_TYPE)
   @Consumes(CostCodeCurrenciesDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture updateCostCodeCurrencies(@PathParam("costcode") Integer costcodeId,
         @BinderParam(BindToXMLPayload.class) CostCodeCurrenciesDto costcodecurrencies);

   /*********************** PricingCostCode ********************** */

   /**
    * @see PricingApi#getPricingCostCodes(Integer)
    */
   @Named("pricingcostcode:get")
   @GET
   @Path("/pricingtemplates/{pricingtemplate}/costcodes")
   @Consumes(PricingCostCodesDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getPricingCostCodes(@PathParam("pricingtemplate") Integer pricingTemplateId);

   /**
    * @see PricingApi#getPricingCostCode(Integer)
    */
   @Named("pricingcostcode:get")
   @GET
   @Path("/pricingtemplates/{pricingtemplate}/costcodes/{costcode}")
   @Consumes(PricingCostCodeDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getPricingCostCode(@PathParam("pricingtemplate") Integer pricingTemplateId,
         @PathParam("costcode") Integer pricingCostcodeId);

   /**
    * @see PricingApi#updatePricingCostCode(PricingCostCodeDto)
    */
   @Named("pricingcostcode:update")
   @PUT
   @Path("/pricingtemplates/{pricingtemplate}/costcodes/{costcode}")
   @Produces(PricingCostCodeDto.BASE_MEDIA_TYPE)
   @Consumes(PricingCostCodeDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture updatePricingCostCode(
         @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) PricingCostCodeDto pricingcostcode,
         @PathParam("pricingtemplate") Integer pricingTemplateId, @PathParam("costcode") Integer pricingCostcodeId);

   /*********************** PricingTier ********************** */

   /**
    * @see PricingApi#getPricingTiers(Integer)
    */
   @Named("pricingtier:get")
   @GET
   @Path("/pricingtemplates/{pricingtemplate}/tiers")
   @Consumes(PricingTiersDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getPricingTiers(@PathParam("pricingtemplate") Integer pricingTemplateId);

   /**
    * @see PricingApi#getPricingTier(Integer)
    */
   @Named("pricingtier:get")
   @GET
   @Path("/pricingtemplates/{pricingtemplate}/tiers/{tier}")
   @Consumes(PricingTierDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   @Fallback(NullOnNotFoundOr404.class)
   ListenableFuture getPricingTier(@PathParam("pricingtemplate") Integer pricingTemplateId,
         @PathParam("tier") Integer pricingTierId);

   /**
    * @see PricingApi#updatePricingTier(PricingTierDto)
    */
   @Named("pricingtier:update")
   @PUT
   @Path("/pricingtemplates/{pricingtemplate}/tiers/{tier}")
   @Produces(PricingTierDto.BASE_MEDIA_TYPE)
   @Consumes(PricingTierDto.BASE_MEDIA_TYPE)
   @JAXBResponseParser
   ListenableFuture updatePricingTier(
         @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) PricingTierDto pricingtier,
         @PathParam("pricingtemplate") Integer pricingTemplateId, @PathParam("tier") Integer pricingTierId);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy