http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/main/java/org/jclouds/abiquo/features/CloudApi.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/features/CloudApi.java b/abiquo/src/main/java/org/jclouds/abiquo/features/CloudApi.java deleted file mode 100644 index 9b78992..0000000 --- a/abiquo/src/main/java/org/jclouds/abiquo/features/CloudApi.java +++ /dev/null @@ -1,1253 +0,0 @@ -/* - * 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.abiquo.features; - -import java.io.Closeable; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.abiquo.binders.AppendToPath; -import org.jclouds.abiquo.binders.BindToPath; -import org.jclouds.abiquo.binders.BindToXMLPayloadAndPath; -import org.jclouds.abiquo.binders.cloud.BindHardDiskRefsToPayload; -import org.jclouds.abiquo.binders.cloud.BindMoveVolumeToPath; -import org.jclouds.abiquo.binders.cloud.BindNetworkConfigurationRefToPayload; -import org.jclouds.abiquo.binders.cloud.BindNetworkRefToPayload; -import org.jclouds.abiquo.binders.cloud.BindVirtualDatacenterRefToPayload; -import org.jclouds.abiquo.binders.cloud.BindVolumeRefsToPayload; -import org.jclouds.abiquo.domain.PaginatedCollection; -import org.jclouds.abiquo.domain.cloud.options.VirtualApplianceOptions; -import org.jclouds.abiquo.domain.cloud.options.VirtualDatacenterOptions; -import org.jclouds.abiquo.domain.cloud.options.VirtualMachineOptions; -import org.jclouds.abiquo.domain.cloud.options.VirtualMachineTemplateOptions; -import org.jclouds.abiquo.domain.cloud.options.VolumeOptions; -import org.jclouds.abiquo.domain.network.options.IpOptions; -import org.jclouds.abiquo.fallbacks.MovedVolume; -import org.jclouds.abiquo.functions.ReturnTaskReferenceOrNull; -import org.jclouds.abiquo.functions.enterprise.ParseEnterpriseId; -import org.jclouds.abiquo.functions.infrastructure.ParseDatacenterId; -import org.jclouds.abiquo.functions.pagination.ParsePrivateIps; -import org.jclouds.abiquo.functions.pagination.ParsePublicIps; -import org.jclouds.abiquo.functions.pagination.ParseVirtualMachineTemplates; -import org.jclouds.abiquo.functions.pagination.ParseVirtualMachines; -import org.jclouds.abiquo.functions.pagination.ParseVolumes; -import org.jclouds.abiquo.http.filters.AbiquoAuthentication; -import org.jclouds.abiquo.http.filters.AppendApiVersionToMediaType; -import org.jclouds.abiquo.rest.annotations.EndpointLink; -import org.jclouds.collect.PagedIterable; -import org.jclouds.http.functions.ReturnStringIf2xx; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.JAXBResponseParser; -import org.jclouds.rest.annotations.ParamParser; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SinceApiVersion; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.binders.BindToXMLPayload; - -import com.abiquo.model.transport.AcceptedRequestDto; -import com.abiquo.model.transport.LinksDto; -import com.abiquo.server.core.appslibrary.VirtualMachineTemplateDto; -import com.abiquo.server.core.appslibrary.VirtualMachineTemplatesDto; -import com.abiquo.server.core.cloud.VirtualApplianceDto; -import com.abiquo.server.core.cloud.VirtualApplianceStateDto; -import com.abiquo.server.core.cloud.VirtualAppliancesDto; -import com.abiquo.server.core.cloud.VirtualDatacenterDto; -import com.abiquo.server.core.cloud.VirtualDatacentersDto; -import com.abiquo.server.core.cloud.VirtualMachineDto; -import com.abiquo.server.core.cloud.VirtualMachineInstanceDto; -import com.abiquo.server.core.cloud.VirtualMachineStateDto; -import com.abiquo.server.core.cloud.VirtualMachineTaskDto; -import com.abiquo.server.core.cloud.VirtualMachineWithNodeExtendedDto; -import com.abiquo.server.core.cloud.VirtualMachinesWithNodeExtendedDto; -import com.abiquo.server.core.enterprise.EnterpriseDto; -import com.abiquo.server.core.infrastructure.DatacenterDto; -import com.abiquo.server.core.infrastructure.network.PrivateIpDto; -import com.abiquo.server.core.infrastructure.network.PrivateIpsDto; -import com.abiquo.server.core.infrastructure.network.PublicIpDto; -import com.abiquo.server.core.infrastructure.network.PublicIpsDto; -import com.abiquo.server.core.infrastructure.network.VLANNetworkDto; -import com.abiquo.server.core.infrastructure.network.VLANNetworksDto; -import com.abiquo.server.core.infrastructure.network.VMNetworkConfigurationsDto; -import com.abiquo.server.core.infrastructure.storage.DiskManagementDto; -import com.abiquo.server.core.infrastructure.storage.DisksManagementDto; -import com.abiquo.server.core.infrastructure.storage.MovedVolumeDto; -import com.abiquo.server.core.infrastructure.storage.TierDto; -import com.abiquo.server.core.infrastructure.storage.TiersDto; -import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto; -import com.abiquo.server.core.infrastructure.storage.VolumesManagementDto; - -/** - * Provides synchronous access to Abiquo Cloud API. - * - * @see API: <a href="http://community.abiquo.com/display/ABI20/API+Reference"> - * http://community.abiquo.com/display/ABI20/API+Reference</a> - */ -@RequestFilters({ AbiquoAuthentication.class, AppendApiVersionToMediaType.class }) -@Path("/cloud") -public interface CloudApi extends Closeable { - /*********************** Virtual Datacenter ***********************/ - - /** - * List all virtual datacenters. - * - * @param options - * Optional query params. - * @return The list of Datacenters. - */ - @Named("vdc:list") - @GET - @Path("/virtualdatacenters") - @Consumes(VirtualDatacentersDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualDatacentersDto listVirtualDatacenters(VirtualDatacenterOptions options); - - /** - * Get the given virtual datacenter. - * - * @param virtualDatacenterId - * The id of the virtual datacenter. - * @return The virtual datacenter or <code>null</code> if it does not exist. - */ - @Named("vdc:get") - @GET - @Path("/virtualdatacenters/{virtualdatacenter}") - @Fallback(NullOnNotFoundOr404.class) - @Consumes(VirtualDatacenterDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualDatacenterDto getVirtualDatacenter(@PathParam("virtualdatacenter") Integer virtualDatacenterId); - - /** - * Create a new virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter to be created. - * @param datacenter - * Datacenter where the virtualdatacenter will be deployed. - * @param enterprise - * Enterprise of the virtual datacenter. - * @return The created virtual datacenter. - */ - @Named("vdc:create") - @POST - @Path("/virtualdatacenters") - @Consumes(VirtualDatacenterDto.BASE_MEDIA_TYPE) - @Produces(VirtualDatacenterDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualDatacenterDto createVirtualDatacenter( - @BinderParam(BindToXMLPayload.class) final VirtualDatacenterDto virtualDatacenter, - @QueryParam("datacenter") @ParamParser(ParseDatacenterId.class) final DatacenterDto datacenter, - @QueryParam("enterprise") @ParamParser(ParseEnterpriseId.class) final EnterpriseDto enterprise); - - /** - * Updates an existing virtual datacenter. - * - * @param virtualDatacenter - * The new attributes for the virtual datacenter. - * @return The updated virtual datacenter. - */ - @Named("vdc:update") - @PUT - @Consumes(VirtualDatacenterDto.BASE_MEDIA_TYPE) - @Produces(VirtualDatacenterDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualDatacenterDto updateVirtualDatacenter( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * Deletes an existing virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter to delete. - */ - @Named("vdc:delete") - @DELETE - void deleteVirtualDatacenter( - @EndpointLink("edit") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * List all available templates for the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @return The list of available templates. - */ - @Named("vdc:listtemplates") - @GET - @Consumes(VirtualMachineTemplatesDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVirtualMachineTemplates.class) - @Transform(ParseVirtualMachineTemplates.ToPagedIterable.class) - PagedIterable<VirtualMachineTemplateDto> listAvailableTemplates( - @EndpointLink("templates") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * List all available templates for the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param options - * Filtering options. - * @return The list of available templates. - */ - @Named("vdc:listtemplates") - @GET - @Consumes(VirtualMachineTemplatesDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVirtualMachineTemplates.class) - PaginatedCollection<VirtualMachineTemplateDto, VirtualMachineTemplatesDto> listAvailableTemplates( - @EndpointLink("templates") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - VirtualMachineTemplateOptions options); - - /** - * List all available ips to purchase in the datacenter by the virtual - * datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param options - * Filtering options. - * @return The list of available ips. - */ - @Named("vdc:listavailablepublicips") - @GET - @Consumes(PublicIpsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParsePublicIps.class) - @Transform(ParsePublicIps.ToPagedIterable.class) - PagedIterable<PublicIpDto> listAvailablePublicIps( - @EndpointLink("topurchase") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * List all available ips to purchase in the datacenter by the virtual - * datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param options - * Filtering options. - * @return The list of available ips. - */ - @Named("vdc:listavailablepublicips") - @GET - @Consumes(PublicIpsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParsePublicIps.class) - PaginatedCollection<PublicIpDto, PublicIpsDto> listAvailablePublicIps( - @EndpointLink("topurchase") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - IpOptions options); - - /** - * List all purchased public ip addresses in the virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param options - * Filtering options. - * @return The list of purchased ips. - */ - @Named("vdc:listpurchasedpublicips") - @GET - @Consumes(PublicIpsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParsePublicIps.class) - @Transform(ParsePublicIps.ToPagedIterable.class) - PagedIterable<PublicIpDto> listPurchasedPublicIps( - @EndpointLink("purchased") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * List all purchased public ip addresses in the virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param options - * Filtering options. - * @return The list of purchased ips. - */ - @Named("vdc:listpurchasedpublicips") - @GET - @Consumes(PublicIpsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParsePublicIps.class) - PaginatedCollection<PublicIpDto, PublicIpsDto> listPurchasedPublicIps( - @EndpointLink("purchased") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - IpOptions options); - - /** - * Purchase a public IP. - * - * @param ip - * The public ip address to purchase. - * @return The purchased public ip. - */ - @Named("vdc:purchasepublicip") - @PUT - @Consumes(PublicIpDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - PublicIpDto purchasePublicIp(@EndpointLink("purchase") @BinderParam(BindToPath.class) PublicIpDto publicIp); - - /** - * Release a public IP. - * - * @param ip - * The public ip address to purchase. - * @return The release public ip. - */ - @Named("vdc:releasepublicip") - @PUT - @Consumes(PublicIpDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - PublicIpDto releasePublicIp(@EndpointLink("release") @BinderParam(BindToPath.class) PublicIpDto publicIp); - - /** - * List the storage tiers available for the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @return The storage tiers available to the given virtual datacenter. - */ - @Named("vdc:listtiers") - @GET - @Consumes(TiersDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - TiersDto listStorageTiers( - @EndpointLink("tiers") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * Get the storage tier from the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param The - * id of the storage tier. - * @return The storage tiers available to the given virtual datacenter. - */ - @Named("vdc:gettier") - @GET - @Fallback(NullOnNotFoundOr404.class) - @Consumes(TierDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - TierDto getStorageTier(@EndpointLink("tiers") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(AppendToPath.class) Integer tierId); - - /*********************** Private Network ***********************/ - - /** - * Get the default network of the virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @return The default network of the virtual datacenter. - */ - @Named("vdc:getdefaultnetwork") - @GET - @Consumes(VLANNetworkDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VLANNetworkDto getDefaultNetwork( - @EndpointLink("defaultnetwork") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * Set the default network of the virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param network - * The default network. - */ - @Named("vdc:setdefaultnetwork") - @PUT - @Produces(LinksDto.BASE_MEDIA_TYPE) - void setDefaultNetwork( - @EndpointLink("defaultvlan") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(BindNetworkRefToPayload.class) VLANNetworkDto network); - - /** - * List all private networks for a virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @return The list of private networks for the virtual datacenter. - */ - @Named("privatenetwork:list") - @GET - @Consumes(VLANNetworksDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VLANNetworksDto listPrivateNetworks( - @EndpointLink("privatenetworks") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * Get the given private network from the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param virtualApplianceId - * The id of the private network. - * @return The private network or <code>null</code> if it does not exist. - */ - @Named("privatenetwork:get") - @GET - @Fallback(NullOnNotFoundOr404.class) - @Consumes(VLANNetworkDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VLANNetworkDto getPrivateNetwork( - @EndpointLink("privatenetworks") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(AppendToPath.class) Integer privateNetworkId); - - /** - * Create a new private network in a virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param privateNetwork - * The private network to be created. - * @return The created private network. - */ - @Named("privatenetwork:create") - @POST - @Consumes(VLANNetworkDto.BASE_MEDIA_TYPE) - @Produces(VLANNetworkDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VLANNetworkDto createPrivateNetwork( - @EndpointLink("privatenetworks") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(BindToXMLPayload.class) VLANNetworkDto privateNetwork); - - /** - * Updates an existing private network from the given virtual datacenter. - * - * @param privateNetwork - * The new attributes for the private network. - * @return The updated private network. - */ - @Named("privatenetwork:update") - @PUT - @Consumes(VLANNetworkDto.BASE_MEDIA_TYPE) - @Produces(VLANNetworkDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VLANNetworkDto updatePrivateNetwork( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) VLANNetworkDto privateNetwork); - - /** - * Deletes an existing private network. - * - * @param privateNetwork - * The private network to delete. - */ - @Named("privatenetwork:delete") - @DELETE - void deletePrivateNetwork(@EndpointLink("edit") @BinderParam(BindToPath.class) VLANNetworkDto privateNetwork); - - /*********************** Private Network IPs ***********************/ - - /** - * List all ips for a private network. - * - * @param network - * The private network. - * @return The list of ips for the private network. - */ - @Named("privatenetwork:listips") - @GET - @Consumes(PrivateIpsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParsePrivateIps.class) - @Transform(ParsePrivateIps.ToPagedIterable.class) - PagedIterable<PrivateIpDto> listPrivateNetworkIps( - @EndpointLink("ips") @BinderParam(BindToPath.class) VLANNetworkDto network); - - /** - * List all ips for a private network with options. - * - * @param network - * The private network. - * @param options - * Filtering options. - * @return The list of ips for the private network. - */ - @Named("privatenetwork:listips") - @GET - @Consumes(PrivateIpsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParsePrivateIps.class) - PaginatedCollection<PrivateIpDto, PrivateIpsDto> listPrivateNetworkIps( - @EndpointLink("ips") @BinderParam(BindToPath.class) VLANNetworkDto network, IpOptions options); - - /** - * Get the requested ip from the given private network. - * - * @param network - * The private network. - * @param ipId - * The id of the ip to get. - * @return The requested ip. - */ - @Named("privatenetwork:getip") - @GET - @Consumes(PrivateIpDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - PrivateIpDto getPrivateNetworkIp(@EndpointLink("ips") @BinderParam(BindToPath.class) VLANNetworkDto network, - @BinderParam(AppendToPath.class) Integer ipId); - - /*********************** Virtual Appliance ***********************/ - - /** - * List all virtual appliance for a virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @return The list of virtual appliances for the virtual datacenter. - */ - @Named("vapp:list") - @GET - @Consumes(VirtualAppliancesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualAppliancesDto listVirtualAppliances( - @EndpointLink("virtualappliances") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * Get the given virtual appliance from the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param virtualApplianceId - * The id of the virtual appliance. - * @return The virtual appliance or <code>null</code> if it does not exist. - */ - @Named("vapp:get") - @GET - @Fallback(NullOnNotFoundOr404.class) - @Consumes(VirtualApplianceDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualApplianceDto getVirtualAppliance( - @EndpointLink("virtualappliances") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(AppendToPath.class) Integer virtualApplianceId); - - /** - * Create a new virtual appliance in a virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param virtualAppliance - * The virtual appliance to be created. - * @return The created virtual appliance. - */ - @Named("vapp:create") - @POST - @Consumes(VirtualApplianceDto.BASE_MEDIA_TYPE) - @Produces(VirtualApplianceDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualApplianceDto createVirtualAppliance( - @EndpointLink("virtualappliances") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(BindToXMLPayload.class) VirtualApplianceDto virtualAppliance); - - /** - * Updates an existing virtual appliance from the given virtual datacenter. - * - * @param virtualAppliance - * The new attributes for the virtual appliance. - * @return The updated virtual appliance. - */ - @Named("vapp:update") - @PUT - @Consumes(VirtualApplianceDto.BASE_MEDIA_TYPE) - @Produces(VirtualApplianceDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualApplianceDto updateVirtualAppliance( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) VirtualApplianceDto virtualAppliance); - - /** - * Deletes an existing virtual appliance. - * - * @param virtualAppliance - * The virtual appliance to delete. - */ - @Named("vapp:delete") - @DELETE - void deleteVirtualAppliance(@EndpointLink("edit") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance); - - /** - * Deletes an existing virtual appliance. - * - * @param virtualAppliance - * The virtual appliance to delete. - * @param options - * The options to customize the delete operation (e.g. Force - * delete). - */ - @Named("vapp:delete") - @DELETE - void deleteVirtualAppliance( - @EndpointLink("edit") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance, - VirtualApplianceOptions options); - - /** - * Deploy a virtual appliance. - * - * @param virtualAppliance - * The virtual appliance to deploy - * @param options - * the extra options for the deploy process. - * @return Response message to the deploy request. - */ - @Named("vapp:deploy") - @POST - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineTaskDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - AcceptedRequestDto<String> deployVirtualAppliance( - @EndpointLink("deploy") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance, - @BinderParam(BindToXMLPayload.class) VirtualMachineTaskDto task); - - /** - * Undeploy a virtual appliance. - * - * @param virtualAppliance - * The virtual appliance to undeploy - * @param options - * the extra options for the undeploy process. - * @return Response message to the undeploy request. - */ - @Named("vapp:undeploy") - @POST - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineTaskDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - AcceptedRequestDto<String> undeployVirtualAppliance( - @EndpointLink("undeploy") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance, - @BinderParam(BindToXMLPayload.class) VirtualMachineTaskDto task); - - /** - * Get the state of the given virtual appliance. - * - * @param virtualAppliance - * The given virtual appliance. - * @return The state of the given virtual appliance. - */ - @Named("vapp:getstate") - @GET - @Consumes(VirtualApplianceStateDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualApplianceStateDto getVirtualApplianceState( - @EndpointLink("state") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance); - - /** - * Gets the price of the given virtual appliance. - * - * @param virtualAppliance - * The virtual appliance to get the price of. - * @return A <code>String</code> representation of the price of the virtual - * appliance. - */ - @Named("vapp:getprice") - @GET - @Consumes(MediaType.TEXT_PLAIN) - @ResponseParser(ReturnStringIf2xx.class) - String getVirtualAppliancePrice( - @EndpointLink("price") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance); - - /*********************** Virtual Machine ***********************/ - - /** - * List all virtual machines available to the current user. - * - * @return The list of all virtual machines available to the current user. - */ - @SinceApiVersion("2.4") - @Named("vm:listall") - @GET - @Path("/virtualmachines") - @Consumes(VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVirtualMachines.class) - @Transform(ParseVirtualMachines.ToPagedIterable.class) - PagedIterable<VirtualMachineWithNodeExtendedDto> listAllVirtualMachines(); - - /** - * List all virtual machines available to the current user. - * - * @param options - * The filter options. - * @return The list of all virtual machines available to the current user. - */ - @SinceApiVersion("2.4") - @Named("vm:listall") - @GET - @Path("/virtualmachines") - @Consumes(VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVirtualMachines.class) - PaginatedCollection<VirtualMachineWithNodeExtendedDto, VirtualMachinesWithNodeExtendedDto> listAllVirtualMachines( - VirtualMachineOptions options); - - /** - * List all virtual machines for a virtual appliance. - * - * @param virtualAppliance - * The virtual appliance. - * @return The list of virtual machines for the virtual appliance. - */ - @Named("vm:list") - @GET - @Consumes(VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVirtualMachines.class) - @Transform(ParseVirtualMachines.ToPagedIterable.class) - PagedIterable<VirtualMachineWithNodeExtendedDto> listVirtualMachines( - @EndpointLink("virtualmachines") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance); - - /** - * List all virtual machines for a virtual appliance. - * - * @param virtualAppliance - * The virtual appliance. - * @param options - * The options to filter the list of virtual machines. - * @return The list of virtual machines for the virtual appliance. - */ - @Named("vm:list") - @GET - @Consumes(VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVirtualMachines.class) - PaginatedCollection<VirtualMachineWithNodeExtendedDto, VirtualMachinesWithNodeExtendedDto> listVirtualMachines( - @EndpointLink("virtualmachines") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance, - VirtualMachineOptions options); - - /** - * Get the given virtual machine from the given virtual machine. - * - * @param virtualAppliance - * The virtual appliance. - * @param virtualMachineId - * The id of the virtual machine. - * @return The virtual machine or <code>null</code> if it does not exist. - */ - @Named("vm:get") - @GET - @Fallback(NullOnNotFoundOr404.class) - @Consumes(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualMachineWithNodeExtendedDto getVirtualMachine( - @EndpointLink("virtualmachines") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance, - @BinderParam(AppendToPath.class) Integer virtualMachineId); - - /** - * Create a new virtual machine in a virtual appliance. - * - * @param virtualAppliance - * The virtual appliance. - * @param virtualMachine - * The virtual machine to be created. - * @return The created virtual machine. - */ - @Named("vm:create") - @POST - @Consumes(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualMachineWithNodeExtendedDto createVirtualMachine( - @EndpointLink("virtualmachines") @BinderParam(BindToPath.class) VirtualApplianceDto virtualAppliance, - @BinderParam(BindToXMLPayload.class) VirtualMachineWithNodeExtendedDto virtualMachine); - - /** - * Deletes an existing virtual machine. - * - * @param virtualMachine - * The virtual machine to delete. - */ - @Named("vm:delete") - @DELETE - void deleteVirtualMachine(@EndpointLink("edit") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Updates an existing virtual machine from the given virtual appliance. - * - * @param virtualMachine - * The new attributes for the virtual machine. - * @return The task reference or <code>null</code> if the operation completed - * synchronously. - */ - @Named("vm:update") - @PUT - @ResponseParser(ReturnTaskReferenceOrNull.class) - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE) - AcceptedRequestDto<String> updateVirtualMachine( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) VirtualMachineWithNodeExtendedDto virtualMachine); - - /** - * Updates an existing virtual machine from the given virtual appliance. - * - * @param virtualMachine - * The new attributes for the virtual machine. - * @param options - * The update options. - * @return The task reference or <code>null</code> if the operation completed - * synchronously. - */ - @Named("vm:update") - @PUT - @ResponseParser(ReturnTaskReferenceOrNull.class) - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE) - AcceptedRequestDto<String> updateVirtualMachine( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) VirtualMachineWithNodeExtendedDto virtualMachine, - VirtualMachineOptions options); - - /** - * Changes the state an existing virtual machine. - * - * @param virtualMachine - * The given virtual machine. - * @param state - * The new state. - * @return The task reference. - */ - @Named("vm:changestate") - @PUT - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineStateDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - AcceptedRequestDto<String> changeVirtualMachineState( - @EndpointLink("state") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine, - @BinderParam(BindToXMLPayload.class) VirtualMachineStateDto state); - - /** - * Get the state of the given virtual machine. - * - * @param virtualMachine - * The given virtual machine. - * @return The state of the given virtual machine. - */ - @Named("vm:getstate") - @GET - @Consumes(VirtualMachineStateDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualMachineStateDto getVirtualMachineState( - @EndpointLink("state") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Deploy a virtual machine with task options. - * - * @param virtualMachine - * The virtual machine to deploy. - * @param options - * extra deploy options. - * @return Response message to the deploy request. - */ - @Named("vm:deploy") - @POST - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineTaskDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - AcceptedRequestDto<String> deployVirtualMachine( - @EndpointLink("deploy") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine, - @BinderParam(BindToXMLPayload.class) VirtualMachineTaskDto options); - - /** - * Undeploy a virtual machine with task options. - * - * @param virtualMachine - * The virtual machine to undeploy. - * @param options - * extra undeploy options. - * @return Response message to the undeploy request. - */ - @Named("vm:undeploy") - @POST - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineTaskDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - AcceptedRequestDto<String> undeployVirtualMachine( - @EndpointLink("undeploy") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine, - @BinderParam(BindToXMLPayload.class) VirtualMachineTaskDto options); - - /** - * List all available network configurations for a virtual machine. - * - * @param virtualMachine - * The virtual machine. - * @return The list of network configurations. - */ - @Named("vm:listnetworkconfigurations") - @GET - @Consumes(VMNetworkConfigurationsDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VMNetworkConfigurationsDto listNetworkConfigurations( - @EndpointLink("configurations") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Sets the gateway network to be used by this virtual machine. - * - * @param virtualMachine - * The virtual machine. - * @param network - * The gateway network to use. - */ - @Named("vm:setgateway") - @PUT - @Produces(LinksDto.BASE_MEDIA_TYPE) - void setGatewayNetwork( - @EndpointLink("configurations") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine, - @BinderParam(BindNetworkConfigurationRefToPayload.class) VLANNetworkDto network); - - /** - * Reboot a virtual machine. - * - * @param virtualMachine - * The virtual machine to reboot. - * @return Response message to the reset request. - */ - @Named("vm:reboot") - @POST - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - AcceptedRequestDto<String> rebootVirtualMachine( - @EndpointLink("reset") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Take a snapshot of the given virtual machine. - * <p> - * This will create a new virtual machine template in the appliance library - * based on the given virtual machine. - * - * @param virtualMachine - * The virtual machine to snapshot. - * @param snapshotConfig - * The configuration of the snapshot. - * @return The task reference to the snapshot process. - */ - @Named("vm:snapshot") - @POST - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VirtualMachineInstanceDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - AcceptedRequestDto<String> snapshotVirtualMachine( - @EndpointLink("instance") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine, - @BinderParam(BindToXMLPayload.class) VirtualMachineInstanceDto snapshotConfig); - - /******************* Virtual Machine Template ***********************/ - - /** - * Get the template of a virtual machine. - * - * @param virtualMachine - * The given virtual machine. - * @return The template of the given virtual machine. - */ - @Named("vm:gettemplate") - @GET - @Consumes(VirtualMachineTemplateDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualMachineTemplateDto getVirtualMachineTemplate( - @EndpointLink("virtualmachinetemplate") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Get the volumes attached to the given virtual machine. - * - * @param virtualMachine - * The virtual machine. - * @return The volumes attached to the given virtual machine. - */ - @Named("vm:listvolumes") - @GET - @Consumes(VolumesManagementDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VolumesManagementDto listAttachedVolumes( - @EndpointLink("volumes") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Detach all volumes from the given virtual machine. - * <p> - * If the virtual machine is deployed, the operation will be executed - * asynchronously. - * - * @param virtualMachine - * The virtual machine. - * @return The task reference or <code>null</code> if the operation completed - * synchronously. - */ - @Named("vm:detachvolumes") - @DELETE - @ResponseParser(ReturnTaskReferenceOrNull.class) - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - AcceptedRequestDto<String> detachAllVolumes( - @EndpointLink("volumes") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Replaces the current volumes attached to the virtual machine with the - * given ones. - * <p> - * If the virtual machine is deployed, the operation will be executed - * asynchronously. - * - * @param virtualMachine - * The virtual machine. - * @param options - * virtual machine parameters - * @param volumes - * The new volumes for the virtual machine. - * @return The task reference or <code>null</code> if the operation completed - * synchronously. - */ - @Named("vm:changevolumes") - @PUT - @ResponseParser(ReturnTaskReferenceOrNull.class) - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(LinksDto.BASE_MEDIA_TYPE) - AcceptedRequestDto<String> replaceVolumes( - @EndpointLink("volumes") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine, - VirtualMachineOptions options, @BinderParam(BindVolumeRefsToPayload.class) VolumeManagementDto... volumes); - - /** - * List all hard disks attached to the given virtual machine. - * - * @param virtualMachine - * The virtual machine. - * @return The hard disks attached to the virtual machine. - */ - @Named("vm:listharddisks") - @GET - @Consumes(DisksManagementDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DisksManagementDto listAttachedHardDisks( - @EndpointLink("disks") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Detach all hard disks from the given virtual machine. - * <p> - * If the virtual machine is deployed, the operation will be executed - * asynchronously. - * - * @param virtualMachine - * The virtual machine. - * @return The task reference or <code>null</code> if the operation completed - * synchronously. - */ - @Named("vm:detachharddisks") - @DELETE - @ResponseParser(ReturnTaskReferenceOrNull.class) - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - AcceptedRequestDto<String> detachAllHardDisks( - @EndpointLink("disks") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine); - - /** - * Replaces the current hard disks attached to the virtual machine with the - * given ones. - * <p> - * If the virtual machine is deployed, the operation will be executed - * asynchronously. - * - * @param virtualMachine - * The virtual machine. - * @param hardDisks - * The new hard disks for the virtual machine. - * @return The task reference or <code>null</code> if the operation completed - * synchronously. - */ - @Named("vm:changeharddisks") - @PUT - @ResponseParser(ReturnTaskReferenceOrNull.class) - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(LinksDto.BASE_MEDIA_TYPE) - AcceptedRequestDto<String> replaceHardDisks( - @EndpointLink("disks") @BinderParam(BindToPath.class) VirtualMachineDto virtualMachine, - @BinderParam(BindHardDiskRefsToPayload.class) DiskManagementDto... hardDisks); - - /*********************** Hard disks ***********************/ - - /** - * List all hard disks in the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @return The hard disks in the virtual datacenter. - */ - @Named("harddisk:list") - @GET - @Consumes(DisksManagementDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DisksManagementDto listHardDisks( - @EndpointLink("disks") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * Get the hard disk with the given id in the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param diskId - * The id of the hard disk to get. - * @return The requested hard disk or <code>null</code> if it does not exist. - */ - @Named("harddisk:get") - @GET - @Fallback(NullOnNotFoundOr404.class) - @Consumes(DiskManagementDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DiskManagementDto getHardDisk( - @EndpointLink("disks") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(AppendToPath.class) Integer diskId); - - /** - * Creates a new hard disk in the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter where the hard disk will be created. - * @param hardDisk - * The hard disk to create. - * @return The created hard disk. - */ - @Named("harddisk:create") - @POST - @Consumes(DiskManagementDto.BASE_MEDIA_TYPE) - @Produces(DiskManagementDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DiskManagementDto createHardDisk( - @EndpointLink("disks") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(BindToXMLPayload.class) DiskManagementDto hardDisk); - - /** - * Deletes the given hard disk. - * - * @param hardDisk - * The hard disk to delete. - */ - @Named("harddisk:delete") - @DELETE - void deleteHardDisk(@EndpointLink("edit") @BinderParam(BindToPath.class) DiskManagementDto hardDisk); - - /*********************** Volumes ***********************/ - - /** - * List all volumes in the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @return The volumes in the virtual datacenter. - */ - @Named("volume:list") - @GET - @Consumes(VolumesManagementDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVolumes.class) - @Transform(ParseVolumes.ToPagedIterable.class) - PagedIterable<VolumeManagementDto> listVolumes( - @EndpointLink("volumes") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter); - - /** - * List all volumes in the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param options - * Optional parameters to filter the volume list. - * @return The volumes in the virtual datacenter. - */ - @Named("volume:list") - @GET - @Consumes(VolumesManagementDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseVolumes.class) - PaginatedCollection<VolumeManagementDto, VolumesManagementDto> listVolumes( - @EndpointLink("volumes") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - VolumeOptions options); - - /** - * Get a volume from the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter. - * @param volumeId - * The id of the volume to get. - * @return The volume or <code>null</code> if it does not exist. - */ - @Named("volume:get") - @GET - @Fallback(NullOnNotFoundOr404.class) - @Consumes(VolumeManagementDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VolumeManagementDto getVolume( - @EndpointLink("volumes") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(AppendToPath.class) Integer volumeId); - - /** - * Creates a volume in the given virtual datacenter. - * - * @param virtualDatacenter - * The virtual datacenter where the volume will be created. - * @param volume - * The volume to create. This volume dto must contain a link to the - * tier where the volume should be created. - * @return The created volume. - */ - @Named("volume:create") - @POST - @Consumes(VolumeManagementDto.BASE_MEDIA_TYPE) - @Produces(VolumeManagementDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VolumeManagementDto createVolume( - @EndpointLink("volumes") @BinderParam(BindToPath.class) VirtualDatacenterDto virtualDatacenter, - @BinderParam(BindToXMLPayload.class) VolumeManagementDto volume); - - /** - * Modifies the given volume. - * <p> - * If the virtual machine is deployed and the size of the volume is changed, - * then an asynchronous task will be generated to refresh the resources of - * the virtual machine in the hypervisor. - * - * @param volume - * The volume to modify. - * @return The task reference or <code>null</code> if no task was generated. - */ - @Named("volume:update") - @PUT - @ResponseParser(ReturnTaskReferenceOrNull.class) - @Consumes(AcceptedRequestDto.BASE_MEDIA_TYPE) - @Produces(VolumeManagementDto.BASE_MEDIA_TYPE) - AcceptedRequestDto<String> updateVolume( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) VolumeManagementDto volume); - - /** - * Delete the given volume. - * - * @param volume - * The volume to delete. - */ - @Named("volume:delete") - @DELETE - void deleteVolume(@EndpointLink("edit") @BinderParam(BindToPath.class) VolumeManagementDto volume); - - /** - * Moves the given volume to a new virtual datacenter. - * <p> - * The Abiquo API will return a 301 (Moved Permanently), so redirects must be - * enabled to make this method succeed. - * - * @param volume - * The volume to move. - * @param newVirtualDatacenter - * The destination virtual datacenter. - * @return The reference to the volume in the new virtual datacenter. - */ - @Named("volume:move") - @POST - @Fallback(MovedVolume.class) - @Consumes(MovedVolumeDto.BASE_MEDIA_TYPE) - @Produces(LinksDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VolumeManagementDto moveVolume(@BinderParam(BindMoveVolumeToPath.class) VolumeManagementDto volume, - @BinderParam(BindVirtualDatacenterRefToPayload.class) VirtualDatacenterDto newVirtualDatacenter); - -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/main/java/org/jclouds/abiquo/features/ConfigApi.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/features/ConfigApi.java b/abiquo/src/main/java/org/jclouds/abiquo/features/ConfigApi.java deleted file mode 100644 index 6e5ec80..0000000 --- a/abiquo/src/main/java/org/jclouds/abiquo/features/ConfigApi.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * 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.abiquo.features; - -import java.io.Closeable; - -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 org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.abiquo.binders.BindToPath; -import org.jclouds.abiquo.binders.BindToXMLPayloadAndPath; -import org.jclouds.abiquo.domain.config.options.LicenseOptions; -import org.jclouds.abiquo.domain.config.options.PropertyOptions; -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.appslibrary.CategoriesDto; -import com.abiquo.server.core.appslibrary.CategoryDto; -import com.abiquo.server.core.config.LicenseDto; -import com.abiquo.server.core.config.LicensesDto; -import com.abiquo.server.core.config.SystemPropertiesDto; -import com.abiquo.server.core.config.SystemPropertyDto; -import com.abiquo.server.core.enterprise.PrivilegeDto; -import com.abiquo.server.core.enterprise.PrivilegesDto; - -/** - * Provides synchronous access to Abiquo Admin API. - * - * @see API: <a href="http://community.abiquo.com/display/ABI20/API+Reference"> - * http://community.abiquo.com/display/ABI20/API+Reference</a> - */ -@RequestFilters({ AbiquoAuthentication.class, AppendApiVersionToMediaType.class }) -@Path("/config") -public interface ConfigApi extends Closeable { - /*********************** License ***********************/ - - /** - * List all licenses. - * - * @return The list of licenses. - */ - @Named("license:list") - @GET - @Path("/licenses") - @Consumes(LicensesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - LicensesDto listLicenses(); - - /** - * List all active/inactive licenses. - * - * @param options - * Optional query params. - * @return The list of licenses. - */ - @Named("license:list") - @GET - @Path("/licenses") - @Consumes(LicensesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - LicensesDto listLicenses(LicenseOptions options); - - /** - * Add a new license. - * - * @param license - * The license to add. - * @return The added license. - */ - @Named("license:add") - @POST - @Produces(LicenseDto.BASE_MEDIA_TYPE) - @Consumes(LicenseDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Path("/licenses") - LicenseDto addLicense(@BinderParam(BindToXMLPayload.class) LicenseDto license); - - /** - * Removes an existing license. - * - * @param license - * The license to delete. - */ - @Named("license:remove") - @DELETE - void removeLicense(@EndpointLink("edit") @BinderParam(BindToPath.class) LicenseDto license); - - /*********************** Privilege ***********************/ - - /** - * List all privileges in the system. - * - * @return The list of privileges. - */ - @Named("privilege:list") - @GET - @Path("/privileges") - @Consumes(PrivilegesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - PrivilegesDto listPrivileges(); - - /** - * Get the given privilege. - * - * @param privilegeId - * The id of the privilege. - * @return The privilege or <code>null</code> if it does not exist. - */ - @Named("privilege:get") - @GET - @Path("/privileges/{privilege}") - @Consumes(PrivilegeDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - PrivilegeDto getPrivilege(@PathParam("privilege") Integer privilegeId); - - /*********************** System Properties ***********************/ - - /** - * List all system properties. - * - * @return The list of properties. - */ - @Named("property:list") - @GET - @Path("/properties") - @Consumes(SystemPropertiesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - SystemPropertiesDto listSystemProperties(); - - /** - * List properties with options. - * - * @param options - * Optional query params. - * @return The list of system properties. - */ - @Named("property:list") - @GET - @Path("/properties") - @Consumes(SystemPropertiesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - SystemPropertiesDto listSystemProperties(PropertyOptions options); - - /** - * Updates a system property. - * - * @param property - * The new attributes for the system property. - * @return The updated system property. - */ - @Named("property:update") - @PUT - @Produces(SystemPropertyDto.BASE_MEDIA_TYPE) - @Consumes(SystemPropertyDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - SystemPropertyDto updateSystemProperty( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) SystemPropertyDto property); - - /*********************** Category ***********************/ - - /** - * List all categories. - * - * @return The list of categories. - */ - @Named("category:list") - @GET - @Path("/categories") - @Consumes(CategoriesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - CategoriesDto listCategories(); - - /** - * Get the given category. - * - * @param categoryId - * The id of the category. - * @return The category or <code>null</code> if it does not exist. - */ - @Named("category:get") - @GET - @Path("/categories/{category}") - @Consumes(CategoryDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - CategoryDto getCategory(@PathParam("category") Integer categoryId); - - /** - * Create a new category. - * - * @param icon - * The category to be created. - * @return The created category. - */ - @Named("category:create") - @POST - @Path("/categories") - @Produces(CategoryDto.BASE_MEDIA_TYPE) - @Consumes(CategoryDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - CategoryDto createCategory(@BinderParam(BindToXMLPayload.class) CategoryDto category); - - /** - * Updates an existing category. - * - * @param category - * The new attributes for the category. - * @return The updated category. - */ - @Named("category:update") - @PUT - @Produces(CategoryDto.BASE_MEDIA_TYPE) - @Consumes(CategoryDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - CategoryDto updateCategory(@EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) CategoryDto category); - - /** - * Deletes an existing category. - * - * @param icon - * The category to delete. - */ - @Named("category:delete") - @DELETE - void deleteCategory(@EndpointLink("edit") @BinderParam(BindToPath.class) CategoryDto category); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/main/java/org/jclouds/abiquo/features/EnterpriseApi.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/features/EnterpriseApi.java b/abiquo/src/main/java/org/jclouds/abiquo/features/EnterpriseApi.java deleted file mode 100644 index 295fcf7..0000000 --- a/abiquo/src/main/java/org/jclouds/abiquo/features/EnterpriseApi.java +++ /dev/null @@ -1,616 +0,0 @@ -/* - * 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.abiquo.features; - -import java.io.Closeable; - -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.AppendToPath; -import org.jclouds.abiquo.binders.BindToPath; -import org.jclouds.abiquo.binders.BindToXMLPayloadAndPath; -import org.jclouds.abiquo.domain.PaginatedCollection; -import org.jclouds.abiquo.domain.enterprise.options.EnterpriseOptions; -import org.jclouds.abiquo.domain.enterprise.options.UserOptions; -import org.jclouds.abiquo.functions.infrastructure.ParseDatacenterId; -import org.jclouds.abiquo.functions.pagination.ParseEnterprises; -import org.jclouds.abiquo.functions.pagination.ParseUsers; -import org.jclouds.abiquo.http.filters.AbiquoAuthentication; -import org.jclouds.abiquo.http.filters.AppendApiVersionToMediaType; -import org.jclouds.abiquo.rest.annotations.EndpointLink; -import org.jclouds.collect.PagedIterable; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.JAXBResponseParser; -import org.jclouds.rest.annotations.ParamParser; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.binders.BindToXMLPayload; - -import com.abiquo.am.model.TemplatesStateDto; -import com.abiquo.server.core.appslibrary.DatacenterRepositoryDto; -import com.abiquo.server.core.appslibrary.TemplateDefinitionListDto; -import com.abiquo.server.core.appslibrary.TemplateDefinitionListsDto; -import com.abiquo.server.core.cloud.VirtualAppliancesDto; -import com.abiquo.server.core.cloud.VirtualDatacentersDto; -import com.abiquo.server.core.cloud.VirtualMachinesWithNodeExtendedDto; -import com.abiquo.server.core.enterprise.DatacenterLimitsDto; -import com.abiquo.server.core.enterprise.DatacentersLimitsDto; -import com.abiquo.server.core.enterprise.EnterpriseDto; -import com.abiquo.server.core.enterprise.EnterprisePropertiesDto; -import com.abiquo.server.core.enterprise.EnterprisesDto; -import com.abiquo.server.core.enterprise.UserDto; -import com.abiquo.server.core.enterprise.UsersDto; -import com.abiquo.server.core.infrastructure.DatacenterDto; -import com.abiquo.server.core.infrastructure.DatacentersDto; -import com.abiquo.server.core.infrastructure.MachinesDto; -import com.abiquo.server.core.infrastructure.network.VLANNetworksDto; - -/** - * Provides synchronous access to Abiquo Enterprise API. - * - * @see API: <a href="http://community.abiquo.com/display/ABI20/API+Reference"> - * http://community.abiquo.com/display/ABI20/API+Reference</a> - */ -@RequestFilters({ AbiquoAuthentication.class, AppendApiVersionToMediaType.class }) -@Path("/admin") -public interface EnterpriseApi extends Closeable { - - /*********************** Enterprise ********************** */ - - /** - * List all enterprises. - * - * @return The list of Enterprises. - */ - @Named("enterprise:list") - @GET - @Path("/enterprises") - @Consumes(EnterprisesDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseEnterprises.class) - @Transform(ParseEnterprises.ToPagedIterable.class) - PagedIterable<EnterpriseDto> listEnterprises(); - - /** - * List enterprises with options. - * - * @param options - * Filtering options. - * @return The list of Enterprises. - */ - @Named("enterprise:list") - @GET - @Path("/enterprises") - @Consumes(EnterprisesDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseEnterprises.class) - PaginatedCollection<EnterpriseDto, EnterprisesDto> listEnterprises(EnterpriseOptions options); - - /** - * List filtered enterprises by datacenter. - * - * @param datacenter - * The given datacenter. - * @param options - * Filtering options. - * @return The list of Enterprises. - */ - @Named("enterprise:list") - @GET - @Consumes(EnterprisesDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseEnterprises.class) - PaginatedCollection<EnterpriseDto, EnterprisesDto> listEnterprises( - @EndpointLink("enterprises") @BinderParam(BindToPath.class) DatacenterDto datacenter, EnterpriseOptions options); - - /** - * Create a new enterprise. - * - * @param enterprise - * The enterprise to be created. - * @return The created enterprise. - */ - @Named("enterprise:create") - @POST - @Path("/enterprises") - @Produces(EnterpriseDto.BASE_MEDIA_TYPE) - @Consumes(EnterpriseDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - EnterpriseDto createEnterprise(@BinderParam(BindToXMLPayload.class) EnterpriseDto enterprise); - - /** - * Get the given enterprise. - * - * @param enterpriseId - * The id of the enterprise. - * @return The enterprise or <code>null</code> if it does not exist. - */ - @Named("enterprise:get") - @GET - @Path("/enterprises/{enterprise}") - @Consumes(EnterpriseDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - EnterpriseDto getEnterprise(@PathParam("enterprise") Integer enterpriseId); - - /** - * Updates an existing enterprise. - * - * @param enterprise - * The new attributes for the enterprise. - * @return The updated enterprise. - */ - @Named("enterprise:update") - @PUT - @Produces(EnterpriseDto.BASE_MEDIA_TYPE) - @Consumes(EnterpriseDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - EnterpriseDto updateEnterprise( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) EnterpriseDto enterprise); - - /** - * Deletes an existing enterprise. - * - * @param enterprise - * The enterprise to delete. - */ - @Named("enterprise:delete") - @DELETE - void deleteEnterprise(@EndpointLink("edit") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /** - * List the allowed datacenters to the given enterprise. - * - * @param enterpriseId - * The id of the enterprise. - * @return The allowed datacenters to the given enterprise. - */ - @Named("enterprise:listalloweddatacenters") - @GET - @Path("/datacenters") - @Consumes(DatacentersDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DatacentersDto listAllowedDatacenters(@QueryParam("idEnterprise") Integer enterpriseId); - - /** - * List all virtual datacenters of an enterprise. - * - * @param enterprise - * The given enterprise. - * @return The list of Datacenters. - */ - @Named("enterprise:listvirtualdatacenters") - @GET - @Consumes(VirtualDatacentersDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualDatacentersDto listVirtualDatacenters( - @EndpointLink("cloud/virtualdatacenters") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /*********************** Enterprise Properties ***********************/ - - /** - * Get defined properties of the given enterprise. - * - * @param enterpriseId - * The enterprise id. - * @return Set of enterprise properties. - */ - @Named("enterprise:getproperties") - @GET - @Consumes(EnterprisePropertiesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - EnterprisePropertiesDto getEnterpriseProperties( - @EndpointLink("properties") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /** - * Updates the given enterprise properties set. - * - * @param properties - * The properties set. - * @return The updated properties. - */ - @Named("enterprse:setproperties") - @PUT - @Produces(EnterprisePropertiesDto.BASE_MEDIA_TYPE) - @Consumes(EnterprisePropertiesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - EnterprisePropertiesDto updateEnterpriseProperties( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) EnterprisePropertiesDto properties); - - /*********************** Enterprise Limits ***********************/ - - /** - * Allows the given enterprise to use the given datacenter with the given - * limits. - * - * @param enterprise - * The enterprise. - * @param datacenter - * The datacenter to allow to the given enterprise. - * @param limits - * The usage limits for the enterprise in the given datacenter. - * @return The usage limits for the enterprise in the given datacenter. - */ - @Named("limit:create") - @POST - @Produces(DatacenterLimitsDto.BASE_MEDIA_TYPE) - @Consumes(DatacenterLimitsDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DatacenterLimitsDto createLimits( - @EndpointLink("limits") @BinderParam(BindToPath.class) final EnterpriseDto enterprise, - @QueryParam("datacenter") @ParamParser(ParseDatacenterId.class) final DatacenterDto datacenter, - @BinderParam(BindToXMLPayload.class) DatacenterLimitsDto limits); - - /** - * Retrieves the limits for the given enterprise and datacenter. - * - * @param enterprise - * The enterprise. - * @param datacenter - * The datacenter. - * @return The usage limits for the enterprise in the given datacenter. - */ - @Named("limit:get") - @GET - @Consumes(DatacentersLimitsDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - DatacentersLimitsDto getLimits( - @EndpointLink("limits") @BinderParam(BindToPath.class) final EnterpriseDto enterprise, - @QueryParam("datacenter") @ParamParser(ParseDatacenterId.class) final DatacenterDto datacenter); - - /** - * Retrieves limits for the given enterprise and any datacenter. - * - * @param enterprise - * The enterprise. - * @return The usage limits for the enterprise on any datacenter. - */ - @Named("limit:list") - @GET - @Consumes(DatacentersLimitsDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DatacentersLimitsDto listLimits(@EndpointLink("limits") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /** - * Updates an existing enterprise-datacenter limits. - * - * @param limits - * The new set of limits. - * @return The updated limits. - */ - @Named("limit:update") - @PUT - @Produces(DatacenterLimitsDto.BASE_MEDIA_TYPE) - @Consumes(DatacenterLimitsDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - DatacenterLimitsDto updateLimits( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) DatacenterLimitsDto limits); - - /** - * Deletes existing limits for a pair enterprise-datacenter. - * - * @param limits - * The limits to delete. - */ - @Named("limit:delete") - @DELETE - void deleteLimits(@EndpointLink("edit") @BinderParam(BindToPath.class) DatacenterLimitsDto limits); - - /*********************** User ********************** */ - - /** - * Retrieves users of the given enterprise. - * - * @param enterprise - * The enterprise. - * @return The users of the enterprise. - */ - @Named("user:list") - @GET - @Consumes(UsersDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseUsers.class) - @Transform(ParseUsers.ToPagedIterable.class) - PagedIterable<UserDto> listUsers(@EndpointLink("users") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /** - * List filtered users by enterprise. - * - * @param enterprise - * The given enterprise. - * @param options - * Filtering options. - * @return The list of Users. - */ - @Named("user:list") - @GET - @Consumes(UsersDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseUsers.class) - PaginatedCollection<UserDto, UsersDto> listUsers( - @EndpointLink("users") @BinderParam(BindToPath.class) EnterpriseDto enterprise, UserOptions options); - - /** - * Create a new user in the given enterprise. - * - * @param enterprise - * The enterprise. - * @param user - * The user to be created. - * @return The created user. - */ - @Named("user:create") - @POST - @Produces(UserDto.BASE_MEDIA_TYPE) - @Consumes(UserDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - UserDto createUser(@EndpointLink("users") @BinderParam(BindToPath.class) EnterpriseDto enterprise, - @BinderParam(BindToXMLPayload.class) UserDto user); - - /** - * Get the given user from the given enterprise. - * - * @param enterprise - * The enterprise. - * @param userId - * The id of the user. - * @return The user or <code>null</code> if it does not exist. - */ - @Named("user:get") - @GET - @Consumes(UserDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - UserDto getUser(@EndpointLink("users") @BinderParam(BindToPath.class) EnterpriseDto enterprise, - @BinderParam(AppendToPath.class) Integer userId); - - /** - * Updates an existing user. - * - * @param enterprise - * The new attributes for the user. - * @return The updated user. - */ - @Named("user:update") - @PUT - @Produces(UserDto.BASE_MEDIA_TYPE) - @Consumes(UserDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - UserDto updateUser(@EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) UserDto user); - - /** - * Deletes existing user. - * - * @param user - * The user to delete. - */ - @Named("user:delete") - @DELETE - void deleteUser(@EndpointLink("edit") @BinderParam(BindToPath.class) UserDto user); - - /** - * Retrieves list of virtual machines by user. - * - * @param user - * The user. - * @return The list of virtual machines of the user. - */ - @Named("user:listvms") - @GET - @Consumes(VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualMachinesWithNodeExtendedDto listVirtualMachines( - @EndpointLink("virtualmachines") @BinderParam(BindToPath.class) final UserDto user); - - /*********************** Datacenter Repository ***********************/ - - /** - * Get the given datacenter repository from the given enterprise. - * - * @param enterprise - * The enterprise. - * @param datacenterRepositoryId - * The id of the datacenter repository. - * @return The datacenter repository or <code>null</code> if it does not - * exist. - */ - @Named("repository:get") - @GET - @Consumes(DatacenterRepositoryDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - UserDto getDatacenterRepository( - @EndpointLink("datacenterrepositories") @BinderParam(BindToPath.class) EnterpriseDto enterprise, - @BinderParam(AppendToPath.class) Integer datacenterRepositoryId); - - /** - * Refreshes database with virtual machine templates existing in the - * repository filesystem. - * - * @param enterpriseId - * Id of the enterprise which information will be refreshed. - * @param datacenterRepositoryId - * Id of the datacenter repository containing the templates. - */ - @Named("repository:refresh") - @PUT - @Path("/enterprises/{enterprise}/datacenterrepositories/{datacenterrepository}/actions/refresh") - void refreshTemplateRepository(@PathParam("enterprise") Integer enterpriseId, - @PathParam("datacenterrepository") Integer datacenterRepositoryId); - - /*********************** Network ***********************/ - - /** - * List external networks of the enterprise - * - * @param enterprise - * The enterprise. - * @return The list of external networks created and assigned. - */ - @Named("enterprise:listexternalnetworks") - @GET - @Consumes(VLANNetworksDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VLANNetworksDto listExternalNetworks( - @EndpointLink("externalnetworks") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /*********************** Cloud ***********************/ - - /** - * Retrieves list of virtual appliances by the given enterprise. - * - * @param enterprise - * The enterprise. - * @return The list of virtual appliances of the enterprise. - */ - @Named("enterprise:listvapps") - @GET - @Consumes(VirtualAppliancesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualAppliancesDto listVirtualAppliances( - @EndpointLink("virtualappliances") @BinderParam(BindToPath.class) final EnterpriseDto enterprise); - - /** - * List virtual machines for the enterprise - * - * @param enterprise - * The enterprise. - * @return The list of virtual machines by the enterprise. - */ - @Named("enterprise:listvms") - @GET - @Consumes(VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - VirtualMachinesWithNodeExtendedDto listVirtualMachines( - @EndpointLink("virtualmachines") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /** - * List reserved machines for the enterprise - * - * @param enterprise - * The enterprise. - * @return The list of reserved machines by the enterprise. - */ - @Named("enterprise:listreservedmachines") - @GET - @Consumes(MachinesDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - MachinesDto listReservedMachines( - @EndpointLink("reservedmachines") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /** - * List all template definitions in apps library. - * - * @param enterprise - * The enterprise. - * @return The list of template definitions by the enterprise. - */ - @Named("templatedefinitionlist:list") - @GET - @Consumes(TemplateDefinitionListsDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - TemplateDefinitionListsDto listTemplateDefinitionLists( - @EndpointLink("appslib/templateDefinitionLists") @BinderParam(BindToPath.class) EnterpriseDto enterprise); - - /** - * Create a new template definition list in apps library in the given - * enterprise. - * - * @param enterprise - * The enterprise. - * @param template - * The template to be created. - * @return The created template. - */ - @Named("templatedefinitionlist:create") - @POST - @Produces(TemplateDefinitionListDto.BASE_MEDIA_TYPE) - @Consumes(TemplateDefinitionListDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - TemplateDefinitionListDto createTemplateDefinitionList( - @EndpointLink("appslib/templateDefinitionLists") @BinderParam(BindToPath.class) EnterpriseDto enterprise, - @BinderParam(BindToXMLPayload.class) TemplateDefinitionListDto templateList); - - /** - * Update an existing template definition list in apps library. - * - * @param template - * The template to be update. - * @return The updated template. - */ - @Named("templatedefinitionlist:update") - @PUT - @Produces(TemplateDefinitionListDto.BASE_MEDIA_TYPE) - @Consumes(TemplateDefinitionListDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - TemplateDefinitionListDto updateTemplateDefinitionList( - @EndpointLink("edit") @BinderParam(BindToXMLPayloadAndPath.class) TemplateDefinitionListDto templateList); - - /** - * Deletes existing user. - * - * @param user - * The user to delete. - */ - @Named("templatedefinitionlist:delete") - @DELETE - void deleteTemplateDefinitionList( - @EndpointLink("edit") @BinderParam(BindToPath.class) TemplateDefinitionListDto templateList); - - /** - * Get the given template definition list from the given enterprise. - * - * @param enterprise - * The enterprise. - * @param templateListId - * The id of the template definition list. - * @return The list or <code>null</code> if it does not exist. - */ - @Named("templatedefinitionlist:get") - @GET - @Consumes(TemplateDefinitionListDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - TemplateDefinitionListDto getTemplateDefinitionList( - @EndpointLink("appslib/templateDefinitionLists") @BinderParam(BindToPath.class) EnterpriseDto enterprise, - @BinderParam(AppendToPath.class) Integer templateListId); - - /** - * Get the list of status of a template definition list in a datacenter. - * - * @param templateList - * The template definition list. - * @param datacenter - * The given datacenter. - * @return The list of states. - */ - @Named("templatedefinitionlist:status") - @GET - @Consumes(TemplatesStateDto.BASE_MEDIA_TYPE) - @JAXBResponseParser - TemplatesStateDto listTemplateListStatus( - @EndpointLink("repositoryStatus") @BinderParam(BindToPath.class) TemplateDefinitionListDto templateList, - @QueryParam("datacenterId") @ParamParser(ParseDatacenterId.class) DatacenterDto datacenter); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1b689dc1/abiquo/src/main/java/org/jclouds/abiquo/features/EventApi.java ---------------------------------------------------------------------- diff --git a/abiquo/src/main/java/org/jclouds/abiquo/features/EventApi.java b/abiquo/src/main/java/org/jclouds/abiquo/features/EventApi.java deleted file mode 100644 index 5b4d6d0..0000000 --- a/abiquo/src/main/java/org/jclouds/abiquo/features/EventApi.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.abiquo.features; - -import java.io.Closeable; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; - -import org.jclouds.abiquo.domain.PaginatedCollection; -import org.jclouds.abiquo.domain.event.options.EventOptions; -import org.jclouds.abiquo.functions.pagination.ParseEvents; -import org.jclouds.abiquo.http.filters.AbiquoAuthentication; -import org.jclouds.abiquo.http.filters.AppendApiVersionToMediaType; -import org.jclouds.collect.PagedIterable; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.Transform; - -import com.abiquo.server.core.event.EventDto; -import com.abiquo.server.core.event.EventsDto; - -/** - * Provides synchronous access to Abiquo Event API. - * - * @see API: <a href="http://community.abiquo.com/display/ABI20/API+Reference"> - * http://community.abiquo.com/display/ABI20/API+Reference</a> - */ -@RequestFilters({ AbiquoAuthentication.class, AppendApiVersionToMediaType.class }) -@Path("/events") -public interface EventApi extends Closeable { - /** - * List events. - * - * @return The list of events. - */ - @Named("event:list") - @GET - @Consumes(EventsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseEvents.class) - @Transform(ParseEvents.ToPagedIterable.class) - PagedIterable<EventDto> listEvents(); - - /** - * List events using filters. - * - * @return The list of events using filters. - */ - @Named("event:list") - @GET - @Consumes(EventsDto.BASE_MEDIA_TYPE) - @ResponseParser(ParseEvents.class) - PaginatedCollection<EventDto, EventsDto> listEvents(EventOptions options); -}
