http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d7bc430c/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java deleted file mode 100644 index 908197e..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VmAsyncApi.java +++ /dev/null @@ -1,974 +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.vcloud.director.v1_5.features; - -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY_IMAGE; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA_PARAMS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEM; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PRODUCT_SECTION_LIST; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RELOCATE_VM_PARAMS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VM; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VM_PENDING_ANSWER; - -import java.net.URI; - -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.Produces; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.JAXBResponseParser; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.binders.BindToXMLPayload; -import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; -import org.jclouds.vcloud.director.v1_5.domain.RasdItemsList; -import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket; -import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.Vm; -import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion; -import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer; -import org.jclouds.vcloud.director.v1_5.domain.dmtf.RasdItem; -import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams; -import org.jclouds.vcloud.director.v1_5.domain.params.MediaInsertOrEjectParams; -import org.jclouds.vcloud.director.v1_5.domain.params.RelocateParams; -import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams; -import org.jclouds.vcloud.director.v1_5.domain.section.GuestCustomizationSection; -import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConnectionSection; -import org.jclouds.vcloud.director.v1_5.domain.section.OperatingSystemSection; -import org.jclouds.vcloud.director.v1_5.domain.section.RuntimeInfoSection; -import org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.director.v1_5.functions.ReturnPayloadBytes; -import org.jclouds.vcloud.director.v1_5.functions.URNToHref; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see VmApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface VmAsyncApi { - - /** - * @see VmApi#get(String) - */ - @GET - @Consumes(VM) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Vm> get(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#edit(String, Vm) - */ - @PUT - @Produces(VM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) Vm vApp); - - /** - * @see VmApi#remove(String) - */ - @DELETE - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> remove(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#consolidate(String) - */ - @POST - @Path("/action/consolidate") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> consolidate(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#deploy(String, DeployVAppParams) - */ - @POST - @Path("/action/deploy") - @Produces(DEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> deploy(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) DeployVAppParams params); - - /** - * @see VmApi#discardSuspendedState(String) - */ - @POST - @Path("/action/discardSuspendedState") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#installVMwareTools(String) - */ - @POST - @Path("/action/installVMwareTools") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> installVMwareTools(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#relocate(String, RelocateParams) - */ - @POST - @Path("/action/relocate") - @Produces(RELOCATE_VM_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> relocate(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) RelocateParams params); - - /** - * @see VmApi#undeploy(String, UndeployVAppParams) - */ - @POST - @Path("/action/undeploy") - @Produces(UNDEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> undeploy(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); - - /** - * @see VmApi#upgradeHardwareVersion(String) - */ - @POST - @Path("/action/upgradeHardwareVersion") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#powerOff(String) - */ - @POST - @Path("/power/action/powerOff") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOff(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#powerOn(String) - */ - @POST - @Path("/power/action/powerOn") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOn(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#reboot(String) - */ - @POST - @Path("/power/action/reboot") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reboot(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#reset(String) - */ - @POST - @Path("/power/action/reset") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reset(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#shutdown(String) - */ - @POST - @Path("/power/action/shutdown") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> shutdown(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#suspend(String) - */ - @POST - @Path("/power/action/suspend") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> suspend(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#getGuestCustomizationSection(String) - */ - @GET - @Path("/guestCustomizationSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editGuestCustomizationSection(String, GuestCustomizationSection) - */ - @PUT - @Path("/guestCustomizationSection") - @Produces(GUEST_CUSTOMIZATION_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); - - /** - * @see VmApi#ejectMedia(String, MediaInsertOrEjectParams) - */ - @POST - @Path("/media/action/ejectMedia") - @Produces(MEDIA_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> ejectMedia(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); - - /** - * @see VmApi#insertMedia(String, MediaInsertOrEjectParams) - */ - @POST - @Path("/media/action/insertMedia") - @Produces(MEDIA_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> insertMedia(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); - - /** - * @see VmApi#getNetworkConnectionSection(String) - */ - @GET - @Path("/networkConnectionSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editNetworkConnectionSection(String, NetworkConnectionSection) - */ - @PUT - @Path("/networkConnectionSection") - @Produces(NETWORK_CONNECTION_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); - - /** - * @see VmApi#getOperatingSystemSection(String) - */ - @GET - @Path("/operatingSystemSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OperatingSystemSection> getOperatingSystemSection( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editOperatingSystemSection(String, OperatingSystemSection) - */ - @PUT - @Path("/operatingSystemSection") - @Produces(OPERATING_SYSTEM_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editOperatingSystemSection(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) OperatingSystemSection section); - - /** - * @see VmApi#getProductSections(String) - */ - @GET - @Path("/productSections") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editProductSections(String, ProductSectionList) - */ - @PUT - @Path("/productSections") - @Produces(PRODUCT_SECTION_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editProductSections(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); - - /** - * @see VmApi#getPendingQuestion(String) - */ - @GET - @Path("/question") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#answerQuestion(String, VmQuestionAnswer) - */ - @POST - @Path("/question/action/answer") - @Produces(VM_PENDING_ANSWER) - @Consumes - @JAXBResponseParser - ListenableFuture<Void> answerQuestion(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer); - - /** - * @see VmApi#getRuntimeInfoSection(String) - */ - @GET - @Path("/runtimeInfoSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#getScreenImage(String) - */ - @GET - @Path("/screen") - @Consumes(ANY_IMAGE) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ReturnPayloadBytes.class) - ListenableFuture<byte[]> getScreenImage(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#getScreenTicket(String) - */ - @POST - @Path("/screen/action/acquireTicket") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#getVirtualHardwareSection(String) - */ - @GET - @Path("/virtualHardwareSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editVirtualHardwareSection(String, VirtualHardwareSection) - */ - @PUT - @Path("/virtualHardwareSection") - @Produces(VIRTUAL_HARDWARE_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) VirtualHardwareSection section); - - /** - * @see VmApi#getVirtualHardwareSectionCpu(String) - */ - @GET - @Path("/virtualHardwareSection/cpu") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editVirtualHardwareSectionCpu(String, ResourceAllocationSettingData) - */ - @PUT - @Path("/virtualHardwareSection/cpu") - @Produces(OVF_RASD_ITEM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) RasdItem rasd); - - /** - * @see VmApi#getVirtualHardwareSectionDisks(String) - */ - @GET - @Path("/virtualHardwareSection/disks") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editVirtualHardwareSectionDisks(String, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/disks") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @see VmApi#getVirtualHardwareSectionMedia(String) - */ - @GET - @Path("/virtualHardwareSection/media") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#getVirtualHardwareSectionMemory(String) - */ - @GET - @Path("/virtualHardwareSection/memory") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editVirtualHardwareSectionMemory(String, ResourceAllocationSettingData) - */ - @PUT - @Path("/virtualHardwareSection/memory") - @Produces(OVF_RASD_ITEM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) RasdItem rasd); - - /** - * @see VmApi#getVirtualHardwareSectionNetworkCards(String) - */ - @GET - @Path("/virtualHardwareSection/networkCards") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editVirtualHardwareSectionNetworkCards(String, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/networkCards") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionNetworkCards( - @EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @see VmApi#getVirtualHardwareSectionSerialPorts(String) - */ - @GET - @Path("/virtualHardwareSection/serialPorts") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts( - @EndpointParam(parser = URNToHref.class) String vmUrn); - - /** - * @see VmApi#editVirtualHardwareSectionSerialPorts(String, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/serialPorts") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionSerialPorts( - @EndpointParam(parser = URNToHref.class) String vmUrn, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @see VmApi#get(URI) - */ - @GET - @Consumes(VM) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Vm> get(@EndpointParam URI vmHref); - - /** - * @see VmApi#edit(URI, Vm) - */ - @PUT - @Produces(VM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> edit(@EndpointParam URI vmHref, @BinderParam(BindToXMLPayload.class) Vm vApp); - - /** - * @see VmApi#remove(URI) - */ - @DELETE - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> remove(@EndpointParam URI vmHref); - - /** - * @see VmApi#consolidate(URI) - */ - @POST - @Path("/action/consolidate") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> consolidate(@EndpointParam URI vmHref); - - /** - * @see VmApi#deploy(URI, DeployVAppParams) - */ - @POST - @Path("/action/deploy") - @Produces(DEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> deploy(@EndpointParam URI vmHref, @BinderParam(BindToXMLPayload.class) DeployVAppParams params); - - /** - * @see VmApi#discardSuspendedState(URI) - */ - @POST - @Path("/action/discardSuspendedState") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vmHref); - - /** - * @see VmApi#installVMwareTools(URI) - */ - @POST - @Path("/action/installVMwareTools") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> installVMwareTools(@EndpointParam URI vmHref); - - /** - * @see VmApi#relocate(URI, RelocateParams) - */ - @POST - @Path("/action/relocate") - @Produces(RELOCATE_VM_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> relocate(@EndpointParam URI vmHref, @BinderParam(BindToXMLPayload.class) RelocateParams params); - - /** - * @see VmApi#undeploy(URI, UndeployVAppParams) - */ - @POST - @Path("/action/undeploy") - @Produces(UNDEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> undeploy(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); - - /** - * @see VmApi#upgradeHardwareVersion(URI) - */ - @POST - @Path("/action/upgradeHardwareVersion") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> upgradeHardwareVersion(@EndpointParam URI vmHref); - - /** - * @see VmApi#powerOff(URI) - */ - @POST - @Path("/power/action/powerOff") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOff(@EndpointParam URI vmHref); - - /** - * @see VmApi#powerOn(URI) - */ - @POST - @Path("/power/action/powerOn") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOn(@EndpointParam URI vmHref); - - /** - * @see VmApi#reboot(URI) - */ - @POST - @Path("/power/action/reboot") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reboot(@EndpointParam URI vmHref); - - /** - * @see VmApi#reset(URI) - */ - @POST - @Path("/power/action/reset") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reset(@EndpointParam URI vmHref); - - /** - * @see VmApi#shutdown(URI) - */ - @POST - @Path("/power/action/shutdown") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> shutdown(@EndpointParam URI vmHref); - - /** - * @see VmApi#suspend(URI) - */ - @POST - @Path("/power/action/suspend") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> suspend(@EndpointParam URI vmHref); - - /** - * @see VmApi#getGuestCustomizationSection(URI) - */ - @GET - @Path("/guestCustomizationSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmHref); - - /** - * @see VmApi#editGuestCustomizationSection(URI, GuestCustomizationSection) - */ - @PUT - @Path("/guestCustomizationSection") - @Produces(GUEST_CUSTOMIZATION_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editGuestCustomizationSection(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) GuestCustomizationSection section); - - /** - * @see VmApi#ejectMedia(URI, MediaInsertOrEjectParams) - */ - @POST - @Path("/media/action/ejectMedia") - @Produces(MEDIA_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> ejectMedia(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); - - /** - * @see VmApi#insertMedia(URI, MediaInsertOrEjectParams) - */ - @POST - @Path("/media/action/insertMedia") - @Produces(MEDIA_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> insertMedia(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams); - - /** - * @see VmApi#getNetworkConnectionSection(URI) - */ - @GET - @Path("/networkConnectionSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmHref); - - /** - * @see VmApi#editNetworkConnectionSection(URI, NetworkConnectionSection) - */ - @PUT - @Path("/networkConnectionSection") - @Produces(NETWORK_CONNECTION_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editNetworkConnectionSection(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) NetworkConnectionSection section); - - /** - * @see VmApi#getOperatingSystemSection(URI) - */ - @GET - @Path("/operatingSystemSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmHref); - - /** - * @see VmApi#editOperatingSystemSection(URI, OperatingSystemSection) - */ - @PUT - @Path("/operatingSystemSection") - @Produces(OPERATING_SYSTEM_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editOperatingSystemSection(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) OperatingSystemSection section); - - /** - * @see VmApi#getProductSections(URI) - */ - @GET - @Path("/productSections") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vmHref); - - /** - * @see VmApi#editProductSections(URI, ProductSectionList) - */ - @PUT - @Path("/productSections") - @Produces(PRODUCT_SECTION_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editProductSections(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); - - /** - * @see VmApi#getPendingQuestion(URI) - */ - @GET - @Path("/question") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<VmPendingQuestion> getPendingQuestion(@EndpointParam URI vmHref); - - /** - * @see VmApi#answerQuestion(URI, VmQuestionAnswer) - */ - @POST - @Path("/question/action/answer") - @Produces(VM_PENDING_ANSWER) - @Consumes - @JAXBResponseParser - ListenableFuture<Void> answerQuestion(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) VmQuestionAnswer answer); - - /** - * @see VmApi#getRuntimeInfoSection(URI) - */ - @GET - @Path("/runtimeInfoSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmHref); - - /** - * @see VmApi#getScreenImage(URI) - */ - @GET - @Path("/screen") - @Consumes(ANY_IMAGE) - @Fallback(NullOnNotFoundOr404.class) - @ResponseParser(ReturnPayloadBytes.class) - ListenableFuture<byte[]> getScreenImage(@EndpointParam URI vmHref); - - /** - * @see VmApi#getScreenTicket(URI) - */ - @POST - @Path("/screen/action/acquireTicket") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ScreenTicket> getScreenTicket(@EndpointParam URI vmHref); - - /** - * @see VmApi#getVirtualHardwareSection(URI) - */ - @GET - @Path("/virtualHardwareSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmHref); - - /** - * @see VmApi#editVirtualHardwareSection(URI, VirtualHardwareSection) - */ - @PUT - @Path("/virtualHardwareSection") - @Produces(VIRTUAL_HARDWARE_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSection(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) VirtualHardwareSection section); - - /** - * @see VmApi#getVirtualHardwareSectionCpu(URI) - */ - @GET - @Path("/virtualHardwareSection/cpu") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItem> getVirtualHardwareSectionCpu(@EndpointParam URI vmHref); - - /** - * @see VmApi#editVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData) - */ - @PUT - @Path("/virtualHardwareSection/cpu") - @Produces(OVF_RASD_ITEM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionCpu(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) RasdItem rasd); - - /** - * @see VmApi#getVirtualHardwareSectionDisks(URI) - */ - @GET - @Path("/virtualHardwareSection/disks") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionDisks(@EndpointParam URI vmHref); - - /** - * @see VmApi#editVirtualHardwareSectionDisks(URI, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/disks") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionDisks(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @see VmApi#getVirtualHardwareSectionMedia(URI) - */ - @GET - @Path("/virtualHardwareSection/media") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionMedia(@EndpointParam URI vmHref); - - /** - * @see VmApi#getVirtualHardwareSectionMemory(URI) - */ - @GET - @Path("/virtualHardwareSection/memory") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItem> getVirtualHardwareSectionMemory(@EndpointParam URI vmHref); - - /** - * @see VmApi#editVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData) - */ - @PUT - @Path("/virtualHardwareSection/memory") - @Produces(OVF_RASD_ITEM) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionMemory(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) RasdItem rasd); - - /** - * @see VmApi#getVirtualHardwareSectionNetworkCards(URI) - */ - @GET - @Path("/virtualHardwareSection/networkCards") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionNetworkCards(@EndpointParam URI vmHref); - - /** - * @see VmApi#editVirtualHardwareSectionNetworkCards(URI, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/networkCards") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionNetworkCards(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); - - /** - * @see VmApi#getVirtualHardwareSectionSerialPorts(URI) - */ - @GET - @Path("/virtualHardwareSection/serialPorts") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<RasdItemsList> getVirtualHardwareSectionSerialPorts(@EndpointParam URI vmHref); - - /** - * @see VmApi#editVirtualHardwareSectionSerialPorts(URI, RasdItemsList) - */ - @PUT - @Path("/virtualHardwareSection/serialPorts") - @Produces(OVF_RASD_ITEMS_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editVirtualHardwareSectionSerialPorts(@EndpointParam URI vmHref, - @BinderParam(BindToXMLPayload.class) RasdItemsList rasdItemsList); -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d7bc430c/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java index 72d9839..275a5b0 100644 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java +++ b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogApi.java @@ -16,19 +16,37 @@ */ package org.jclouds.vcloud.director.v1_5.features.admin; +import static org.jclouds.Fallbacks.NullOnNotFoundOr404; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ADMIN_CATALOG; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CONTROL_ACCESS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS; + import java.net.URI; +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.Produces; + +import org.jclouds.rest.annotations.BinderParam; +import org.jclouds.rest.annotations.EndpointParam; +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 org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams; import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.features.CatalogApi; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; -/** - * Provides synchronous access to {@link AdminCatalog} objects. - * - * @see AdminCatalogAsyncApi - */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface AdminCatalogApi extends CatalogApi { /** @@ -42,9 +60,21 @@ public interface AdminCatalogApi extends CatalogApi { * the urn for the org * @return contains a , which will point to the running asynchronous creation operation. */ - AdminCatalog addCatalogToOrg(AdminCatalog catalog, String orgUrn); + @POST + @Path("/catalogs") + @Consumes(ADMIN_CATALOG) + @Produces(ADMIN_CATALOG) + @JAXBResponseParser + AdminCatalog addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); - AdminCatalog addCatalogToOrg(AdminCatalog catalog, URI catalogAdminHref); + @POST + @Path("/catalogs") + @Consumes(ADMIN_CATALOG) + @Produces(ADMIN_CATALOG) + @JAXBResponseParser + AdminCatalog addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, + @EndpointParam URI orgHref); /** * Retrieves a catalog. @@ -58,10 +88,18 @@ public interface AdminCatalogApi extends CatalogApi { * @return a catalog */ @Override - AdminCatalog get(String catalogUrn); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + AdminCatalog get(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); @Override - AdminCatalog get(URI catalogAdminHref); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + AdminCatalog get(@EndpointParam URI orgHref); /** * Modifies a catalog. A catalog could be published or unpublished. The IsPublished property is @@ -74,9 +112,19 @@ public interface AdminCatalogApi extends CatalogApi { * * @return the edited catalog */ - AdminCatalog edit(String catalogUrn, AdminCatalog catalog); + @PUT + @Consumes(ADMIN_CATALOG) + @Produces(ADMIN_CATALOG) + @JAXBResponseParser + AdminCatalog edit(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, + @BinderParam(BindToXMLPayload.class) AdminCatalog catalog); - AdminCatalog edit(URI catalogAdminHref, AdminCatalog catalog); + @PUT + @Consumes(ADMIN_CATALOG) + @Produces(ADMIN_CATALOG) + @JAXBResponseParser + AdminCatalog edit(@EndpointParam URI catalogAdminHref, + @BinderParam(BindToXMLPayload.class) AdminCatalog catalog); /** * Deletes a catalog. The catalog could be removed if it is either published or unpublished. @@ -85,9 +133,15 @@ public interface AdminCatalogApi extends CatalogApi { * DELETE /admin/catalog/{id} * </pre> */ - void remove(String catalogUrn); + @DELETE + @Consumes + @JAXBResponseParser + void remove(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); - void remove(URI catalogAdminHref); + @DELETE + @Consumes + @JAXBResponseParser + void remove(@EndpointParam URI catalogAdminHref); /** * Retrieves the owner of a catalog. @@ -98,9 +152,19 @@ public interface AdminCatalogApi extends CatalogApi { * * @return the owner or null if not found */ - Owner getOwner(String catalogUrn); + @GET + @Path("/owner") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Owner getOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); - Owner getOwner(URI catalogAdminHref); + @GET + @Path("/owner") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Owner getOwner(@EndpointParam URI catalogAdminHref); /** * Changes owner for catalog. @@ -109,22 +173,40 @@ public interface AdminCatalogApi extends CatalogApi { * PUT /admin/catalog/{id}/owner * </pre> */ - void setOwner(String catalogUrn, Owner newOwner); - - void setOwner(URI catalogAdminHref, Owner newOwner); + @PUT + @Path("/owner") + @Consumes + @Produces(VCloudDirectorMediaType.OWNER) + @JAXBResponseParser + void setOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, + @BinderParam(BindToXMLPayload.class) Owner newOwner); - // TODO: lot of work to pass in a single boolean, would like to polymorphically include something - // like: - // void publishCatalog(String catalogUrn) + @PUT + @Path("/owner") + @Consumes + @Produces(VCloudDirectorMediaType.OWNER) + @JAXBResponseParser + void setOwner(@EndpointParam URI catalogAdminHref, + @BinderParam(BindToXMLPayload.class) Owner newOwner); /** * Publish a catalog. Publishing a catalog makes the catalog visible to all organizations in a * vCloud. - * @param orgUrn */ - void publish(String catalogUrn, PublishCatalogParams params); + @POST + @Path("/action/publish") + @Consumes + @Produces(PUBLISH_CATALOG_PARAMS) + @JAXBResponseParser + void publish(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, + @BinderParam(BindToXMLPayload.class) PublishCatalogParams params); - void publish(URI catalogAdminHref, PublishCatalogParams params); + @POST + @Path("/action/publish") + @Consumes + @Produces(PUBLISH_CATALOG_PARAMS) + @JAXBResponseParser + void publish(@EndpointParam URI catalogAdminHref, @BinderParam(BindToXMLPayload.class) PublishCatalogParams params); /** * Modifies a catalog control access. @@ -135,9 +217,21 @@ public interface AdminCatalogApi extends CatalogApi { * * @return the control access information */ - ControlAccessParams editAccessControl(String catalogUrn, ControlAccessParams params); + @POST + @Path("/action/controlAccess") + @Produces(CONTROL_ACCESS) + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + ControlAccessParams editAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, + @BinderParam(BindToXMLPayload.class) ControlAccessParams params); - ControlAccessParams editAccessControl(URI catalogAdminHref, ControlAccessParams params); + @POST + @Path("/action/controlAccess") + @Produces(CONTROL_ACCESS) + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + ControlAccessParams editAccessControl(@EndpointParam URI catalogAdminHref, + @BinderParam(BindToXMLPayload.class) ControlAccessParams params); /** * Retrieves the catalog control access information. @@ -148,7 +242,17 @@ public interface AdminCatalogApi extends CatalogApi { * * @return the control access information */ - ControlAccessParams getAccessControl(String catalogUrn); - - ControlAccessParams getAccessControl(URI catalogAdminHref); + @GET + @Path("/controlAccess") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ControlAccessParams getAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); + + @GET + @Path("/controlAccess") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ControlAccessParams getAccessControl(@EndpointParam URI catalogAdminHref); } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d7bc430c/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java deleted file mode 100644 index 8344902..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncApi.java +++ /dev/null @@ -1,238 +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.vcloud.director.v1_5.features.admin; - -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CONTROL_ACCESS; - -import java.net.URI; - -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.Produces; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -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 org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; -import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; -import org.jclouds.vcloud.director.v1_5.domain.Owner; -import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams; -import org.jclouds.vcloud.director.v1_5.domain.params.PublishCatalogParams; -import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncApi; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see AdminCatalogApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface AdminCatalogAsyncApi extends CatalogAsyncApi { - - /** - * @see AdminCatalogApi#addCatalogToOrg(AdminCatalog, String) - */ - @POST - @Path("/catalogs") - @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) - @Produces(VCloudDirectorMediaType.ADMIN_CATALOG) - @JAXBResponseParser - ListenableFuture<AdminCatalog> addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, - @EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminCatalogApi#addCatalogToOrg(AdminCatalog, URI) - */ - @POST - @Path("/catalogs") - @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) - @Produces(VCloudDirectorMediaType.ADMIN_CATALOG) - @JAXBResponseParser - ListenableFuture<AdminCatalog> addCatalogToOrg(@BinderParam(BindToXMLPayload.class) AdminCatalog catalog, - @EndpointParam URI orgHref); - - /** - * @see AdminCatalogApi#get(String) - */ - @Override - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<AdminCatalog> get(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); - - /** - * @see AdminCatalogApi#get(URI) - */ - @Override - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<AdminCatalog> get(@EndpointParam URI orgHref); - - /** - * @see AdminCatalogApi#edit(String, AdminCatalog) - */ - @PUT - @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) - @Produces(VCloudDirectorMediaType.ADMIN_CATALOG) - @JAXBResponseParser - ListenableFuture<AdminCatalog> edit(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, - @BinderParam(BindToXMLPayload.class) AdminCatalog catalog); - - /** - * @see AdminCatalogApi#edit(URI, AdminCatalog) - */ - @PUT - @Consumes(VCloudDirectorMediaType.ADMIN_CATALOG) - @Produces(VCloudDirectorMediaType.ADMIN_CATALOG) - @JAXBResponseParser - ListenableFuture<AdminCatalog> edit(@EndpointParam URI catalogAdminHref, - @BinderParam(BindToXMLPayload.class) AdminCatalog catalog); - - /** - * @see AdminCatalogApi#remove(String) - */ - @DELETE - @Consumes - @JAXBResponseParser - ListenableFuture<Void> remove(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); - - /** - * @see AdminCatalogApi#remove(URI) - */ - @DELETE - @Consumes - @JAXBResponseParser - ListenableFuture<Void> remove(@EndpointParam URI catalogAdminHref); - - /** - * @see AdminCatalogApi#getOwner(String) - */ - @GET - @Path("/owner") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); - - /** - * @see AdminCatalogApi#getOwner(URI) - */ - @GET - @Path("/owner") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Owner> getOwner(@EndpointParam URI catalogAdminHref); - - /** - * @see AdminCatalogApi#setOwner(String, Owner) - */ - @PUT - @Path("/owner") - @Consumes - @Produces(VCloudDirectorMediaType.OWNER) - @JAXBResponseParser - ListenableFuture<Void> setOwner(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, - @BinderParam(BindToXMLPayload.class) Owner newOwner); - - /** - * @see AdminCatalogApi#setOwner(URI, Owner) - */ - @PUT - @Path("/owner") - @Consumes - @Produces(VCloudDirectorMediaType.OWNER) - @JAXBResponseParser - ListenableFuture<Void> setOwner(@EndpointParam URI catalogAdminHref, - @BinderParam(BindToXMLPayload.class) Owner newOwner); - - /** - * @see AdminCatalogApi#publish(String, PublishCatalogParams) - */ - @POST - @Path("/action/publish") - @Consumes - @Produces(VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS) - @JAXBResponseParser - ListenableFuture<Void> publish(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, - @BinderParam(BindToXMLPayload.class) PublishCatalogParams params); - - /** - * @see AdminCatalogApi#publish(URI, PublishCatalogParams) - */ - @POST - @Path("/action/publish") - @Consumes - @Produces(VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS) - @JAXBResponseParser - ListenableFuture<Void> publish(@EndpointParam URI catalogAdminHref, - @BinderParam(BindToXMLPayload.class) PublishCatalogParams params); - - /** - * @see AdminCatalogApi#editAccessControl(String, ControlAccessParams) - */ - @POST - @Path("/action/controlAccess") - @Produces(CONTROL_ACCESS) - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - ListenableFuture<ControlAccessParams> editAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn, - @BinderParam(BindToXMLPayload.class) ControlAccessParams params); - - /** - * @see AdminCatalogApi#editAccessControl(URI, ControlAccessParams) - */ - @POST - @Path("/action/controlAccess") - @Produces(CONTROL_ACCESS) - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - ListenableFuture<ControlAccessParams> editAccessControl(@EndpointParam URI catalogAdminHref, - @BinderParam(BindToXMLPayload.class) ControlAccessParams params); - - /** - * @see AdminCatalogApi#getAccessControl(String) - */ - @GET - @Path("/controlAccess") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam(parser = URNToAdminHref.class) String catalogUrn); - - /** - * @see AdminCatalogApi#getAccessControl(URI) - */ - @GET - @Path("/controlAccess") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam URI catalogAdminHref); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d7bc430c/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java index 4a1903d..67b9024 100644 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java +++ b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkApi.java @@ -16,18 +16,33 @@ */ package org.jclouds.vcloud.director.v1_5.features.admin; +import static org.jclouds.Fallbacks.NullOnNotFoundOr404; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ADMIN_ORG_NETWORK; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK; + import java.net.URI; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.jclouds.rest.annotations.BinderParam; +import org.jclouds.rest.annotations.EndpointParam; +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 org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.network.Network; import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork; import org.jclouds.vcloud.director.v1_5.features.NetworkApi; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; -/** - * Provides synchronous access to admin {@link Network} objects. - * - * @see AdminNetworkAsyncApi - */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface AdminNetworkApi extends NetworkApi { /** @@ -43,10 +58,18 @@ public interface AdminNetworkApi extends NetworkApi { * @return the network */ @Override - Network get(String networkUrn); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Network get(@EndpointParam(parser = URNToAdminHref.class) String networkUrn); @Override - Network get(URI networkAdminHref); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Network get(@EndpointParam URI networkAdminHref); /** * Modifies an org network @@ -62,9 +85,19 @@ public interface AdminNetworkApi extends NetworkApi { * @return a task. This operation is asynchronous and the user should monitor the returned task * status in order to check when it is completed. */ - Task edit(String networkUrn, OrgNetwork network); + @PUT + @Consumes(TASK) + @Produces(ADMIN_ORG_NETWORK) + @JAXBResponseParser + Task edit(@EndpointParam(parser = URNToAdminHref.class) String networkUrn, + @BinderParam(BindToXMLPayload.class) OrgNetwork network); - Task edit(URI networkAdminHref, OrgNetwork network); + @PUT + @Consumes(TASK) + @Produces(ADMIN_ORG_NETWORK) + @JAXBResponseParser + Task edit(@EndpointParam URI networkAdminHref, + @BinderParam(BindToXMLPayload.class) OrgNetwork network); /** * Reset(undeploy & redeploy) networking services on a logical network. The reset operation can @@ -80,7 +113,15 @@ public interface AdminNetworkApi extends NetworkApi { * @return a task. This operation is asynchronous and the user should monitor the returned task * status in order to check when it is completed. */ - Task reset(String networkUrn); - - Task reset(URI networkAdminHref); + @POST + @Path("/action/reset") + @Consumes + @JAXBResponseParser + Task reset(@EndpointParam(parser = URNToAdminHref.class) String networkUrn); + + @POST + @Path("/action/reset") + @Consumes + @JAXBResponseParser + Task reset(@EndpointParam URI networkAdminHref); } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d7bc430c/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java deleted file mode 100644 index 573050b..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncApi.java +++ /dev/null @@ -1,108 +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.vcloud.director.v1_5.features.admin; - -import java.net.URI; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -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 org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; -import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.network.Network; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgNetwork; -import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncApi; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see AdminNetworkApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface AdminNetworkAsyncApi extends NetworkAsyncApi { - - /** - * @see AdminNetworkApi#get(String) - */ - @Override - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<? extends Network> get(@EndpointParam(parser = URNToAdminHref.class) String networkUrn); - - /** - * @see AdminNetworkApi#get(URI) - */ - @Override - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<? extends Network> get(@EndpointParam URI networkAdminHref); - - /** - * @see AdminNetworkApi#edit(String, OrgNetwork) - */ - @PUT - @Consumes(VCloudDirectorMediaType.TASK) - @Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK) - @JAXBResponseParser - ListenableFuture<Task> edit(@EndpointParam(parser = URNToAdminHref.class) String networkUrn, - @BinderParam(BindToXMLPayload.class) OrgNetwork network); - - /** - * @see AdminNetworkApi#edit(URI, OrgNetwork) - */ - @PUT - @Consumes(VCloudDirectorMediaType.TASK) - @Produces(VCloudDirectorMediaType.ADMIN_ORG_NETWORK) - @JAXBResponseParser - ListenableFuture<Task> edit(@EndpointParam URI networkAdminHref, - @BinderParam(BindToXMLPayload.class) OrgNetwork network); - - /** - * @see AdminNetworkApi#reset(String) - */ - @POST - @Path("/action/reset") - @Consumes - @JAXBResponseParser - ListenableFuture<Task> reset(@EndpointParam(parser = URNToAdminHref.class) String networkUrn); - - /** - * @see AdminNetworkApi#reset(URI) - */ - @POST - @Path("/action/reset") - @Consumes - @JAXBResponseParser - ListenableFuture<Task> reset(@EndpointParam URI networkAdminHref); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d7bc430c/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java index 3fc7739..f8831f4 100644 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java +++ b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgApi.java @@ -16,8 +16,28 @@ */ package org.jclouds.vcloud.director.v1_5.features.admin; +import static org.jclouds.Fallbacks.NullOnNotFoundOr404; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_EMAIL_SETTINGS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_GENERAL_SETTINGS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_LEASE_SETTINGS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_SETTINGS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS; + import java.net.URI; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.jclouds.rest.annotations.BinderParam; +import org.jclouds.rest.annotations.EndpointParam; +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 org.jclouds.vcloud.director.v1_5.domain.org.AdminOrg; import org.jclouds.vcloud.director.v1_5.domain.org.OrgEmailSettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgGeneralSettings; @@ -27,12 +47,10 @@ import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings; import org.jclouds.vcloud.director.v1_5.features.OrgApi; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; -/** - * Provides synchronous access to {@link Org} objects. - * - * @see AdminOrgAsyncApi - */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface AdminOrgApi extends OrgApi { /** @@ -48,10 +66,18 @@ public interface AdminOrgApi extends OrgApi { * @return the admin org */ @Override - AdminOrg get(String orgUrn); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + AdminOrg get(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); @Override - AdminOrg get(URI orgAdminHref); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + AdminOrg get(@EndpointParam URI adminOrgHref); /** * Gets organizational settings for this organization. @@ -64,9 +90,19 @@ public interface AdminOrgApi extends OrgApi { * the reference for the admin org * @return the settings */ - OrgSettings getSettings(String orgUrn); + @GET + @Path("/settings") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgSettings getSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - OrgSettings getSettings(URI orgAdminHref); + @GET + @Path("/settings") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgSettings getSettings(@EndpointParam URI adminOrgHref); /** * Updates organizational settings for this organization. @@ -77,13 +113,25 @@ public interface AdminOrgApi extends OrgApi { * * @param orgUrn * the reference for the admin org - * @param newSettings + * @param settings * the requested edited settings * @return the resultant settings */ - OrgSettings editSettings(String orgUrn, OrgSettings newSettings); + @PUT + @Path("/settings") + @Consumes(ORG_SETTINGS) + @Produces(ORG_SETTINGS) + @JAXBResponseParser + OrgSettings editSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, + @BinderParam(BindToXMLPayload.class) OrgSettings settings); - OrgSettings editSettings(URI orgAdminHref, OrgSettings newSettings); + @PUT + @Path("/settings") + @Consumes(ORG_SETTINGS) + @Produces(ORG_SETTINGS) + @JAXBResponseParser + OrgSettings editSettings(@EndpointParam URI adminOrgHref, + @BinderParam(BindToXMLPayload.class) OrgSettings settings); /** * Retrieves email settings for an organization. @@ -96,9 +144,19 @@ public interface AdminOrgApi extends OrgApi { * the reference for the admin org * @return the email settings */ - OrgEmailSettings getEmailSettings(String orgUrn); + @GET + @Path("/settings/email") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgEmailSettings getEmailSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - OrgEmailSettings getEmailSettings(URI orgAdminHref); + @GET + @Path("/settings/email") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgEmailSettings getEmailSettings(@EndpointParam URI adminOrgHref); /** * Updates email policy settings for organization. @@ -109,13 +167,25 @@ public interface AdminOrgApi extends OrgApi { * * @param orgUrn * the reference for the admin org - * @param newSettings + * @param settings * the requested edited settings * @return the resultant settings */ - OrgEmailSettings editEmailSettings(String orgUrn, OrgEmailSettings newSettings); + @PUT + @Path("/settings/email") + @Consumes(ORG_EMAIL_SETTINGS) + @Produces(ORG_EMAIL_SETTINGS) + @JAXBResponseParser + OrgEmailSettings editEmailSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, + @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); - OrgEmailSettings editEmailSettings(URI orgAdminHref, OrgEmailSettings newSettings); + @PUT + @Path("/settings/email") + @Consumes(ORG_EMAIL_SETTINGS) + @Produces(ORG_EMAIL_SETTINGS) + @JAXBResponseParser + OrgEmailSettings editEmailSettings(@EndpointParam URI adminOrgHref, + @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); /** * Gets general organization settings. @@ -128,9 +198,19 @@ public interface AdminOrgApi extends OrgApi { * the reference for the admin org * @return the lease settings */ - OrgGeneralSettings getGeneralSettings(String orgUrn); + @GET + @Path("/settings/general") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgGeneralSettings getGeneralSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - OrgGeneralSettings getGeneralSettings(URI orgAdminHref); + @GET + @Path("/settings/general") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgGeneralSettings getGeneralSettings(@EndpointParam URI adminOrgHref); /** * Updates general organization settings. @@ -141,13 +221,25 @@ public interface AdminOrgApi extends OrgApi { * * @param orgUrn * the reference for the admin org - * @param newSettings + * @param settings * the requested edited settings * @return the resultant settings */ - OrgGeneralSettings editGeneralSettings(String orgUrn, OrgGeneralSettings newSettings); + @PUT + @Path("/settings/general") + @Consumes(ORG_GENERAL_SETTINGS) + @Produces(ORG_GENERAL_SETTINGS) + @JAXBResponseParser + OrgGeneralSettings editGeneralSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, + @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); - OrgGeneralSettings editGeneralSettings(URI orgAdminHref, OrgGeneralSettings newSettings); + @PUT + @Path("/settings/general") + @Consumes(ORG_GENERAL_SETTINGS) + @Produces(ORG_GENERAL_SETTINGS) + @JAXBResponseParser + OrgGeneralSettings editGeneralSettings(@EndpointParam URI adminOrgHref, + @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); /** * Retrieves LDAP settings for an organization. @@ -160,9 +252,19 @@ public interface AdminOrgApi extends OrgApi { * the reference for the admin org * @return the ldap settings */ - OrgLdapSettings getLdapSettings(String orgUrn); + @GET + @Path("/settings/ldap") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgLdapSettings getLdapSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - OrgLdapSettings getLdapSettings(URI orgAdminHref); + @GET + @Path("/settings/ldap") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgLdapSettings getLdapSettings(@EndpointParam URI adminOrgHref); /** * Retrieves password policy settings for an organization. @@ -175,9 +277,20 @@ public interface AdminOrgApi extends OrgApi { * the reference for the admin org * @return the lease settings */ - OrgPasswordPolicySettings getPasswordPolicy(String orgUrn); + @GET + @Path("/settings/passwordPolicy") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgPasswordPolicySettings getPasswordPolicy( + @EndpointParam(parser = URNToAdminHref.class) String orgUrn); - OrgPasswordPolicySettings getPasswordPolicy(URI orgAdminHref); + @GET + @Path("/settings/passwordPolicy") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgPasswordPolicySettings getPasswordPolicy(@EndpointParam URI adminOrgHref); /** * Updates password policy settings for organization. @@ -188,13 +301,25 @@ public interface AdminOrgApi extends OrgApi { * * @param orgUrn * the reference for the admin org - * @param newSettings + * @param settings * the requested edited settings * @return the resultant settings */ - OrgPasswordPolicySettings editPasswordPolicy(String orgUrn, OrgPasswordPolicySettings newSettings); + @PUT + @Path("/settings/passwordPolicy") + @Consumes(ORG_PASSWORD_POLICY_SETTINGS) + @Produces(ORG_PASSWORD_POLICY_SETTINGS) + @JAXBResponseParser + OrgPasswordPolicySettings editPasswordPolicy(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, + @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); - OrgPasswordPolicySettings editPasswordPolicy(URI orgAdminHref, OrgPasswordPolicySettings newSettings); + @PUT + @Path("/settings/passwordPolicy") + @Consumes(ORG_PASSWORD_POLICY_SETTINGS) + @Produces(ORG_PASSWORD_POLICY_SETTINGS) + @JAXBResponseParser + OrgPasswordPolicySettings editPasswordPolicy(@EndpointParam URI adminOrgHref, + @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); /** * Gets organization resource cleanup settings on the level of vApp. @@ -207,9 +332,19 @@ public interface AdminOrgApi extends OrgApi { * the reference for the admin org * @return the lease settings */ - OrgLeaseSettings getVAppLeaseSettings(String orgUrn); + @GET + @Path("/settings/vAppLeaseSettings") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgLeaseSettings getVAppLeaseSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - OrgLeaseSettings getVAppLeaseSettings(URI orgAdminHref); + @GET + @Path("/settings/vAppLeaseSettings") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgLeaseSettings getVAppLeaseSettings(@EndpointParam URI adminOrgHref); /** * Updates organization resource cleanup settings on the level of vApp. @@ -220,13 +355,25 @@ public interface AdminOrgApi extends OrgApi { * * @param orgUrn * the reference for the admin org - * @param newSettings + * @param settings * the requested edited settings * @return the resultant settings */ - OrgLeaseSettings editVAppLeaseSettings(String orgUrn, OrgLeaseSettings newSettings); + @PUT + @Path("/settings/vAppLeaseSettings") + @Consumes(ORG_LEASE_SETTINGS) + @Produces(ORG_LEASE_SETTINGS) + @JAXBResponseParser + OrgLeaseSettings editVAppLeaseSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, + @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); - OrgLeaseSettings editVAppLeaseSettings(URI orgAdminHref, OrgLeaseSettings newSettings); + @PUT + @Path("/settings/vAppLeaseSettings") + @Consumes(ORG_LEASE_SETTINGS) + @Produces(ORG_LEASE_SETTINGS) + @JAXBResponseParser + OrgLeaseSettings editVAppLeaseSettings(@EndpointParam URI adminOrgHref, + @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); /** * Retrieves expiration and storage policy for vApp templates in an organization. @@ -239,9 +386,19 @@ public interface AdminOrgApi extends OrgApi { * the reference for the admin org * @return the lease settings */ - OrgVAppTemplateLeaseSettings getVAppTemplateLeaseSettings(String orgUrn); + @GET + @Path("/settings/vAppTemplateLeaseSettings") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgVAppTemplateLeaseSettings getVAppTemplateLeaseSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - OrgVAppTemplateLeaseSettings getVAppTemplateLeaseSettings(URI orgAdminHref); + @GET + @Path("/settings/vAppTemplateLeaseSettings") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + OrgVAppTemplateLeaseSettings getVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref); /** * Updates vApp template policy settings for organization. @@ -252,11 +409,23 @@ public interface AdminOrgApi extends OrgApi { * * @param orgUrn * the reference for the admin org - * @param newSettings + * @param settings * the requested edited settings * @return the resultant settings */ - OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(String orgUrn, OrgVAppTemplateLeaseSettings newSettings); + @PUT + @Path("/settings/vAppTemplateLeaseSettings") + @Consumes(ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + @Produces(ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + @JAXBResponseParser + OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, + @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); - OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(URI orgAdminHref, OrgVAppTemplateLeaseSettings newSettings); + @PUT + @Path("/settings/vAppTemplateLeaseSettings") + @Consumes(ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + @Produces(ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + @JAXBResponseParser + OrgVAppTemplateLeaseSettings editVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref, + @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/d7bc430c/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java deleted file mode 100644 index a0ee52c..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncApi.java +++ /dev/null @@ -1,355 +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.vcloud.director.v1_5.features.admin; - -import java.net.URI; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.EndpointParam; -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 org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; -import org.jclouds.vcloud.director.v1_5.domain.org.AdminOrg; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgEmailSettings; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgGeneralSettings; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgLdapSettings; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgLeaseSettings; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgPasswordPolicySettings; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgSettings; -import org.jclouds.vcloud.director.v1_5.domain.org.OrgVAppTemplateLeaseSettings; -import org.jclouds.vcloud.director.v1_5.features.OrgAsyncApi; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.director.v1_5.functions.URNToAdminHref; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see AdminOrgApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface AdminOrgAsyncApi extends OrgAsyncApi { - - /** - * @see AdminOrgApi#get(String) - */ - @Override - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<AdminOrg> get(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#get(URI) - */ - @Override - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<AdminOrg> get(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#getSettings(String) - */ - @GET - @Path("/settings") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgSettings> getSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#getSettings(URI) - */ - @GET - @Path("/settings") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgSettings> getSettings(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#editSettings(String, OrgSettings) - */ - @PUT - @Path("/settings") - @Consumes(VCloudDirectorMediaType.ORG_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgSettings> editSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn, - @BinderParam(BindToXMLPayload.class) OrgSettings settings); - - /** - * @see AdminOrgApi#editSettings(URI, OrgSettings) - */ - @PUT - @Path("/settings") - @Consumes(VCloudDirectorMediaType.ORG_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgSettings> editSettings(@EndpointParam URI adminOrgHref, - @BinderParam(BindToXMLPayload.class) OrgSettings settings); - - /** - * @see AdminOrgApi#getEmailSettings(String) - */ - @GET - @Path("/settings/email") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#getEmailSettings(URI) - */ - @GET - @Path("/settings/email") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgEmailSettings> getEmailSettings(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#editEmailSettings(String, OrgEmailSettings) - */ - @PUT - @Path("/settings/email") - @Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgEmailSettings> editEmailSettings( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn, - @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); - - /** - * @see AdminOrgApi#editEmailSettings(URI, OrgEmailSettings) - */ - @PUT - @Path("/settings/email") - @Consumes(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgEmailSettings> editEmailSettings(@EndpointParam URI adminOrgHref, - @BinderParam(BindToXMLPayload.class) OrgEmailSettings settings); - - /** - * @see AdminOrgApi#getGeneralSettings(String) - */ - @GET - @Path("/settings/general") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgGeneralSettings> getGeneralSettings( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#getGeneralSettings(URI) - */ - @GET - @Path("/settings/general") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgGeneralSettings> getGeneralSettings(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#editGeneralSettings(String, OrgGeneralSettings) - */ - @PUT - @Path("/settings/general") - @Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgGeneralSettings> editGeneralSettings( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn, - @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); - - /** - * @see AdminOrgApi#editGeneralSettings(URI, OrgGeneralSettings) - */ - @PUT - @Path("/settings/general") - @Consumes(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgGeneralSettings> editGeneralSettings(@EndpointParam URI adminOrgHref, - @BinderParam(BindToXMLPayload.class) OrgGeneralSettings settings); - - /** - * @see AdminOrgApi#getPasswordPolicy(String) - */ - @GET - @Path("/settings/ldap") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgLdapSettings> getLdapSettings(@EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#getPasswordPolicy(URI) - */ - @GET - @Path("/settings/ldap") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgLdapSettings> getLdapSettings(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#getPasswordPolicy(String) - */ - @GET - @Path("/settings/passwordPolicy") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#getPasswordPolicy(URI) - */ - @GET - @Path("/settings/passwordPolicy") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgPasswordPolicySettings> getPasswordPolicy(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#editPasswordPolicy(String, OrgPasswordPolicySettings) - */ - @PUT - @Path("/settings/passwordPolicy") - @Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn, - @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); - - /** - * @see AdminOrgApi#editPasswordPolicy(URI, OrgPasswordPolicySettings) - */ - @PUT - @Path("/settings/passwordPolicy") - @Consumes(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgPasswordPolicySettings> editPasswordPolicy(@EndpointParam URI adminOrgHref, - @BinderParam(BindToXMLPayload.class) OrgPasswordPolicySettings settings); - - /** - * @see AdminOrgApi#getVAppLeaseSettings(String) - */ - @GET - @Path("/settings/vAppLeaseSettings") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#getVAppLeaseSettings(URI) - */ - @GET - @Path("/settings/vAppLeaseSettings") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgLeaseSettings> getVAppLeaseSettings(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#editVAppLeaseSettings(String, OrgVAppLeaseSettings) - */ - @PUT - @Path("/settings/vAppLeaseSettings") - @Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn, - @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); - - /** - * @see AdminOrgApi#editVAppLeaseSettings(URI, OrgVAppLeaseSettings) - */ - @PUT - @Path("/settings/vAppLeaseSettings") - @Consumes(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgLeaseSettings> editVAppLeaseSettings(@EndpointParam URI adminOrgHref, - @BinderParam(BindToXMLPayload.class) OrgLeaseSettings settings); - - /** - * @see AdminOrgApi#getVAppTemplateLeaseSettings(String) - */ - @GET - @Path("/settings/vAppTemplateLeaseSettings") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn); - - /** - * @see AdminOrgApi#getVAppTemplateLeaseSettings(URI) - */ - @GET - @Path("/settings/vAppTemplateLeaseSettings") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<OrgVAppTemplateLeaseSettings> getVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref); - - /** - * @see AdminOrgApi#editVAppTemplateLeaseSettings(String, OrgVAppTemplateLeaseSettings) - */ - @PUT - @Path("/settings/vAppTemplateLeaseSettings") - @Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings( - @EndpointParam(parser = URNToAdminHref.class) String orgUrn, - @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); - - /** - * @see AdminOrgApi#editVAppTemplateLeaseSettings(URI, OrgVAppTemplateLeaseSettings) - */ - @PUT - @Path("/settings/vAppTemplateLeaseSettings") - @Consumes(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - @Produces(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - @JAXBResponseParser - ListenableFuture<OrgVAppTemplateLeaseSettings> editVAppTemplateLeaseSettings(@EndpointParam URI adminOrgHref, - @BinderParam(BindToXMLPayload.class) OrgVAppTemplateLeaseSettings settings); -}
