http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncApi.java deleted file mode 100644 index 42193c2..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/QueryAsyncApi.java +++ /dev/null @@ -1,192 +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 javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; - -import org.jclouds.rest.annotations.JAXBResponseParser; -import org.jclouds.rest.annotations.QueryParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences; -import org.jclouds.vcloud.director.v1_5.domain.query.QueryList; -import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; -import org.jclouds.vcloud.director.v1_5.domain.query.VAppReferences; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see QueryApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface QueryAsyncApi { - - /** - * REST API General queries handler. - */ - @GET - @Path("/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryList> queryList(); - - @GET - @Path("/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> queryAll(@QueryParam("type") String type); - - @GET - @Path("/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> query(@QueryParam("type") String type, @QueryParam("filter") String filter); - - @GET - @Path("/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> query(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, - @QueryParam("format") String format, @QueryParam("type") String type, @QueryParam("filter") String filter); - - /** - * Retrieves a list of {@link Catalog}s by using REST API general QueryHandler. - */ - @GET - @Path("/catalogs/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> catalogsQueryAll(); - - @GET - @Path("/catalogs/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> catalogsQuery(@QueryParam("filter") String filter); - - @GET - @Path("/catalogs/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> catalogsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, - @QueryParam("filter") String filter); - - @GET - @Path("/catalogs/query") - @Consumes - @QueryParams(keys = { "format" }, values = { "references" }) - @JAXBResponseParser - ListenableFuture<CatalogReferences> catalogReferencesQueryAll(); - - @GET - @Path("/catalogs/query") - @Consumes - @QueryParams(keys = { "format" }, values = { "references" }) - @JAXBResponseParser - ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("filter") String filter); - - @GET - @Path("/catalogs/query") - @Consumes - @QueryParams(keys = { "format" }, values = { "references" }) - @JAXBResponseParser - ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, - @QueryParam("filter") String filter); - - @GET - @Path("/vAppTemplates/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> vAppTemplatesQueryAll(); - - @GET - @Path("/vAppTemplates/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> vAppTemplatesQuery(@QueryParam("filter") String filter); - - /** - * Retrieves a list of {@link VApp}s by using REST API general QueryHandler. - */ - @GET - @Path("/vApps/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> vAppsQueryAll(); - - @GET - @Path("/vApps/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> vAppsQuery(@QueryParam("filter") String filter); - - @GET - @Path("/vApps/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> vAppsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, - @QueryParam("filter") String filter); - - @GET - @Path("/vApps/query") - @Consumes - @QueryParams(keys = { "format" }, values = { "references" }) - @JAXBResponseParser - ListenableFuture<VAppReferences> vAppReferencesQueryAll(); - - @GET - @Path("/vApps/query") - @Consumes - @QueryParams(keys = { "format" }, values = { "references" }) - @JAXBResponseParser - ListenableFuture<VAppReferences> vAppReferencesQuery(@QueryParam("filter") String filter); - - @GET - @Path("/vApps/query") - @Consumes - @QueryParams(keys = { "format" }, values = { "references" }) - @JAXBResponseParser - ListenableFuture<VAppReferences> vAppReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize, - @QueryParam("filter") String filter); - - @GET - @Path("/vms/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> vmsQueryAll(); - - @GET - @Path("/vms/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> vmsQuery(@QueryParam("filter") String filter); - - @GET - @Path("/mediaList/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> mediaListQueryAll(); - - @GET - @Path("/mediaList/query") - @Consumes - @JAXBResponseParser - ListenableFuture<QueryResultRecords> mediaListQuery(@QueryParam("filter") String filter); -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskApi.java index 7c045f2..a5b98f2 100644 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskApi.java +++ b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskApi.java @@ -16,15 +16,25 @@ */ package org.jclouds.vcloud.director.v1_5.features; +import static org.jclouds.Fallbacks.NullOnNotFoundOr404; + import java.net.URI; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; + +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.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.TasksList; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; -/** - * Provides synchronous access to {@link Task} objects. - * - * @see TaskAsyncApi - */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface TaskApi { /** @@ -39,7 +49,11 @@ public interface TaskApi { * {@link VCloudDirectorMediaType#TASKS_LIST} * @return a list of tasks */ - TasksList getTasksList(URI tasksListHref); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + TasksList getTasksList(@EndpointParam URI tasksListHref); /** * Retrieves a task. @@ -50,18 +64,21 @@ public interface TaskApi { * * @return the task or null if not found */ - Task get(String taskUrn); - - Task get(URI taskHref); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Task get(@EndpointParam(parser = URNToHref.class) String taskUrn); - /** - * Cancels a task. - * - * <pre> - * POST /task/{id}/action/cancel - * </pre> - */ - void cancel(String taskUrn); + @GET + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Task get(@EndpointParam URI taskURI); - void cancel(URI taskHref); + @POST + @Path("/action/cancel") + @Consumes + @JAXBResponseParser + void cancel(@EndpointParam URI taskURI); } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java deleted file mode 100644 index 3401f0b..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncApi.java +++ /dev/null @@ -1,88 +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 java.net.URI; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -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.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.TasksList; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.director.v1_5.functions.URNToHref; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see TaskApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface TaskAsyncApi { - - /** - * @see TaskApi#getTasksList(URI) - */ - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<TasksList> getTasksList(@EndpointParam URI tasksListHref); - - /** - * @see TaskApi#get(String) - */ - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Task> get(@EndpointParam(parser = URNToHref.class) String taskUrn); - - /** - * @see TaskApi#get(URI) - */ - @GET - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Task> get(@EndpointParam URI taskURI); - - /** - * @see TaskApi#cancel(String) - */ - @POST - @Path("/action/cancel") - @Consumes - @JAXBResponseParser - ListenableFuture<Void> cancel(@EndpointParam(parser = URNToHref.class) String taskUrn); - - /** - * @see TaskApi#cancel(URI) - */ - @POST - @Path("/action/cancel") - @Consumes - @JAXBResponseParser - ListenableFuture<Void> cancel(@EndpointParam URI taskURI); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadApi.java index 0846c28..6b576ad 100644 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadApi.java +++ b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadApi.java @@ -17,18 +17,16 @@ package org.jclouds.vcloud.director.v1_5.features; import java.net.URI; + +import javax.ws.rs.PUT; + import org.jclouds.io.Payload; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -/** - * Provides synchronous access to upload. - * - * @see UploadAsyncApi - */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface UploadApi { - /** - * @return eTag - */ - void upload(URI location, Payload payload); - + @PUT void upload(@EndpointParam URI location, Payload payload); } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadAsyncApi.java deleted file mode 100644 index b436137..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UploadAsyncApi.java +++ /dev/null @@ -1,41 +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 java.net.URI; - -import javax.ws.rs.PUT; - -import org.jclouds.io.Payload; -import org.jclouds.rest.annotations.EndpointParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see UploadApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface UploadAsyncApi { - - /** - * @see UploadApi#put - */ - @PUT - ListenableFuture<Void> upload(@EndpointParam URI location, Payload payload); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java index 6d1b3d9..250b50a 100644 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java +++ b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppApi.java @@ -16,10 +16,37 @@ */ package org.jclouds.vcloud.director.v1_5.features; +import static org.jclouds.Fallbacks.NullOnNotFoundOr404; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CONTROL_ACCESS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.LEASE_SETTINGS_SECTION; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONFIG_SECTION; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OWNER; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PRODUCT_SECTION_LIST; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.STARTUP_SECTION; +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.VAPP; + 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.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.StartupSection; +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.Owner; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; import org.jclouds.vcloud.director.v1_5.domain.Task; @@ -30,457 +57,812 @@ import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams; import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams; import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; -/** - * Provides synchronous access to {@link VApp} objects. - * - * @see VAppAsyncApi - * @version 1.5 - */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface VAppApi { /** - * Retrieves a {@link VApp}. - * - * The {@link VApp} could be in one of these statuses: - * <ul> - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION - * FAILED_CREATION(-1)} - Transient entity state, e.g., model object is addd but the - * corresponding VC backing does not exist yet. This is further sub-categorized in the respective - * entities. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED - * UNRESOLVED(0)} - Entity is whole, e.g., VM creation is complete and all the required model - * objects and VC backings are created. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED - * RESOLVED(1)} - Entity is resolved. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#DEPLOYED - * DEPLOYED(2)} - Entity is deployed. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#SUSPENDED - * SUSPENDED(3)} - All VMs of the vApp are suspended. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_ON - * POWERED_ON(4)} - All VMs of the vApp are powered on. - * <li> - * {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#WAITING_FOR_INPUT - * WAITING_FOR_INPUT(5)} - VM is pending response on a question. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNKNOWN - * UNKNOWN(6)} - Entity state could not be retrieved from the inventory, e.g., VM power state is - * null. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRECOGNIZED - * UNRECOGNIZED(7)} - Entity state was retrieved from the inventory but could not be mapped to an - * internal state. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_OFF - * POWERED_OFF(8)} - All VMs of the vApp are powered off. - * <li> - * {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#INCONSISTENT_STATE - * INCONSISTENT_STATE(9)} - Apply to VM status, if a vm is {@code POWERED_ON}, or - * {@code WAITING_FOR_INPUT}, but is undeployed, it is in an inconsistent state. - * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#MIXED MIXED(10)} - * - vApp status is set to {@code MIXED} when the VMs in the vApp are in different power states - * </ul> - * - * <pre> - * GET /vApp/{id} - * </pre> - * - * @since 0.9 + * @see VAppApi#get(String) */ - VApp get(String vAppUrn); - - VApp get(URI vAppHref); + @GET + @Consumes(VAPP) + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + VApp get(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Modifies the name/description of a {@link VApp}. - * + * * <pre> * PUT /vApp/{id} * </pre> - * + * * @since 0.9 */ - Task edit(String vAppUrn, VApp vApp); - - Task edit(URI vAppHref, VApp vApp); + @PUT + @Produces(VAPP) + @Consumes(TASK) + @JAXBResponseParser + Task edit(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) VApp vApp); /** * Deletes a {@link VApp}. - * + * * <pre> * DELETE /vApp/{id} * </pre> - * + * * @since 0.9 */ - Task remove(String vAppUrn); - - Task remove(URI vAppHref); + @DELETE + @Consumes(TASK) + @JAXBResponseParser + Task remove(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Modifies the control access of a {@link VApp}. - * + * * <pre> * POST /vApp/{id}/action/controlAccess * </pre> - * + * * @since 0.9 */ - ControlAccessParams editControlAccess(String vAppUrn, ControlAccessParams params); - - ControlAccessParams editControlAccess(URI vAppHref, ControlAccessParams params); + @POST + @Path("/action/controlAccess") + @Produces(CONTROL_ACCESS) + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + ControlAccessParams editControlAccess(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) ControlAccessParams params); /** * Deploys a {@link VApp}. - * + * * Deployment means allocation of all resource for a vApp/VM like CPU and memory from a vDC * resource pool. Deploying a vApp automatically deploys all of the virtual machines it contains. * As of version 1.5 the operation supports force customization passed with * {@link DeployVAppParamsType#setForceCustomization(Boolean)} parameter. - * + * * <pre> * POST /vApp/{id}/action/deploy * </pre> - * + * * @since 0.9 */ - Task deploy(String vAppUrn, DeployVAppParams params); - - Task deploy(URI vAppHref, DeployVAppParams params); + @POST + @Path("/action/deploy") + @Produces(DEPLOY_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + Task deploy(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) DeployVAppParams params); /** * Discard suspended state of a {@link VApp}. - * + * * Discarding suspended state of a vApp automatically discarded suspended states of all of the * virtual machines it contains. - * + * * <pre> * POST /vApp/{id}/action/discardSuspendedState * </pre> - * + * * @since 0.9 */ - Task discardSuspendedState(String vAppUrn); - - Task discardSuspendedState(URI vAppHref); + @POST + @Path("/action/discardSuspendedState") + @Consumes(TASK) + @JAXBResponseParser + Task discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Place the {@link VApp} into maintenance mode. - * + * * While in maintenance mode, a system admin can operate on the vApp as usual, but end users are * restricted to read-only operations. Any user-initiated tasks running when the vApp enters * maintenance mode will continue. - * + * * <pre> * POST /vApp/{id}/action/enterMaintenanceMode * </pre> - * + * * @since 1.5 */ - void enterMaintenanceMode(String vAppUrn); - - void enterMaintenanceMode(URI vAppHref); + @POST + @Path("/action/enterMaintenanceMode") + @Consumes + @JAXBResponseParser + void enterMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Take the {@link VApp} out of maintenance mode. - * + * * <pre> * POST /vApp/{id}/action/exitMaintenanceMode * </pre> - * + * * @since 1.5 */ - void exitMaintenanceMode(String vAppUrn); - - void exitMaintenanceMode(URI vAppHref); + @POST + @Path("/action/exitMaintenanceMode") + @Consumes + @JAXBResponseParser + void exitMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Recompose a {@link VApp} by removing its own VMs and/or adding new ones from other vApps or * vApp templates. - * + * * To remove VMs you should put their references in elements. The way you add VMs is the same as * described in compose vApp operation * {@link VdcApi#composeVApp(String, org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams)}. * The status of vApp will be in * {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED} until the * recompose task is finished. - * + * * <pre> * POST /vApp/{id}/action/recomposeVApp * </pre> - * + * * @since 1.0 */ - Task recompose(String vAppUrn, RecomposeVAppParams params); - - Task recompose(URI vAppHref, RecomposeVAppParams params); + @POST + @Path("/action/recomposeVApp") + @Produces(RECOMPOSE_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + Task recompose(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); /** * Undeploy a {@link VApp}. - * + * * Undeployment means deallocation of all resources for a vApp/VM like CPU and memory from a vDC * resource pool. Undeploying a vApp automatically undeploys all of the virtual machines it * contains. - * + * * <pre> * POST /vApp/{id}/action/undeploy * </pre> - * + * * @since 0.9 */ - Task undeploy(String vAppUrn, UndeployVAppParams params); - - Task undeploy(URI vAppHref, UndeployVAppParams params); + @POST + @Path("/action/undeploy") + @Produces(UNDEPLOY_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + Task undeploy(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); /** * Retrieves the control access information for a {@link VApp}. - * + * * The vApp could be shared to everyone or could be shared to specific user, by editing the * control access values. - * + * * <pre> * GET /vApp/{id}/controlAccess * </pre> - * + * * @since 0.9 */ // TODO: revise - ControlAccessParams getAccessControl(String vAppUrn); - - ControlAccessParams getAccessControl(URI vAppHref); + @GET + @Path("/controlAccess") + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ControlAccessParams getAccessControl(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Powers off a {@link VApp}. - * + * * If the operation is used over a vApp then all VMs are powered off. This operation is allowed * only when the vApp/VM is powered on. - * + * * <pre> * POST /vApp/{id}/power/action/powerOff * </pre> - * + * * @since 0.9 */ - Task powerOff(String vAppUrn); - - Task powerOff(URI vAppHref); + @POST + @Path("/power/action/powerOff") + @Consumes(TASK) + @JAXBResponseParser + Task powerOff(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Powers on a {@link VApp}. - * + * * If the operation is used over a vApp then all VMs are powered on. This operation is allowed * only when the vApp/VM is powered off. - * + * * <pre> * POST /vApp/{id}/power/action/powerOn * </pre> - * + * * @since 0.9 */ - Task powerOn(String vAppUrn); - - Task powerOn(URI vAppHref); + @POST + @Path("/power/action/powerOn") + @Consumes(TASK) + @JAXBResponseParser + Task powerOn(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Reboots a {@link VApp}. - * + * * The vApp/VM should be started in order to reboot it. - * + * * <pre> * POST /vApp/{id}/power/action/reboot * </pre> - * + * * @since 0.9 */ - Task reboot(String vAppUrn); - - Task reboot(URI vAppHref); + @POST + @Path("/power/action/reboot") + @Consumes(TASK) + @JAXBResponseParser + Task reboot(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Resets a {@link VApp}. - * + * * If the operation is used over a vApp then all VMs are reset. This operation is allowed only * when the vApp/VM is powered on. - * + * * <pre> * POST /vApp/{id}/power/action/reset * </pre> - * + * * @since 0.9 */ - Task reset(String vAppUrn); - - Task reset(URI vAppHref); + @POST + @Path("/power/action/reset") + @Consumes(TASK) + @JAXBResponseParser + Task reset(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Shuts down a {@link VApp}. - * + * * If the operation is used over a vApp then all VMs are shutdown. This operation is allowed only * when the vApp/VM is powered on. - * + * * <pre> * POST /vApp/{id}/power/action/shutdown * </pre> - * + * * @since 0.9 */ - Task shutdown(String vAppUrn); - - Task shutdown(URI vAppHref); + @POST + @Path("/power/action/shutdown") + @Consumes(TASK) + @JAXBResponseParser + Task shutdown(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Suspends a {@link VApp}. - * + * * If the operation is used over a vApp then all VMs are suspended. This operation is allowed * only when the vApp/VM is powered on. - * + * * <pre> * POST /vApp/{id}/power/action/suspend * </pre> - * + * * @since 0.9 */ - Task suspend(String vAppUrn); - - Task suspend(URI vAppHref); + @POST + @Path("/power/action/suspend") + @Consumes(TASK) + @JAXBResponseParser + Task suspend(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Retrieves the lease settings section of a {@link VApp}. - * + * * <pre> * GET /vApp/{id}/leaseSettingsSection * </pre> - * + * * @since 0.9 */ - LeaseSettingsSection getLeaseSettingsSection(String vAppUrn); - - LeaseSettingsSection getLeaseSettingsSection(URI vAppHref); + @GET + @Path("/leaseSettingsSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + LeaseSettingsSection getLeaseSettingsSection( + @EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Modifies the lease settings section of a {@link VApp}. - * + * * <pre> * PUT /vApp/{id}/leaseSettingsSection * </pre> - * + * * @since 0.9 */ - Task editLeaseSettingsSection(String vAppUrn, LeaseSettingsSection section); - - Task editLeaseSettingsSection(URI vAppHref, LeaseSettingsSection section); + @PUT + @Path("/leaseSettingsSection") + @Produces(LEASE_SETTINGS_SECTION) + @Consumes(TASK) + @JAXBResponseParser + Task editLeaseSettingsSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); /** * Retrieves the network config section of a {@link VApp}. - * + * * <pre> * GET /vApp/{id}/networkConfigSection * </pre> - * + * * @since 0.9 */ - NetworkConfigSection getNetworkConfigSection(String vAppUrn); - - NetworkConfigSection getNetworkConfigSection(URI vAppHref); + @GET + @Path("/networkConfigSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkConfigSection getNetworkConfigSection( + @EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Modifies the network config section of a {@link VApp}. - * + * * <pre> * PUT /vApp/{id}/networkConfigSection * </pre> - * + * * @since 0.9 */ - Task editNetworkConfigSection(String vAppUrn, NetworkConfigSection section); - - Task editNetworkConfigSection(URI vAppHref, NetworkConfigSection section); + @PUT + @Path("/networkConfigSection") + @Produces(NETWORK_CONFIG_SECTION) + @Consumes(TASK) + @JAXBResponseParser + Task editNetworkConfigSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); /** * Retrieves the network section of a {@link VApp}. - * + * * <pre> * GET /vApp/{id}/networkSection * </pre> - * + * * @since 0.9 */ - NetworkSection getNetworkSection(String vAppUrn); - - NetworkSection getNetworkSection(URI vAppHref); + @GET + @Path("/networkSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkSection getNetworkSection(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Retrieves the owner of a {@link VApp}. - * + * * <pre> * GET /vApp/{id}/owner * </pre> - * + * * @since 1.5 */ - Owner getOwner(String vAppUrn); - - Owner getOwner(URI vAppHref); + @GET + @Path("/owner") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Owner getOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Changes {@link VApp} owner. - * + * * <pre> * PUT /vApp/{id}/owner * </pre> - * + * * @since 1.5 */ - void editOwner(String vAppUrn, Owner owner); - - void editOwner(URI vAppHref, Owner owner); + @PUT + @Path("/owner") + @Produces(OWNER) + @Consumes(TASK) + @JAXBResponseParser + void editOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) Owner owner); /** * Retrieves {@link VApp} product sections. - * + * * <pre> * GET /vApp/{id}/productSections * </pre> - * + * * @since 1.5 */ - ProductSectionList getProductSections(String vAppUrn); - - ProductSectionList getProductSections(URI vAppHref); + @GET + @Path("/productSections") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ProductSectionList getProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Modifies the product section information of a {@link VApp}. - * + * * <pre> * PUT /vApp/{id}/productSections * </pre> - * + * * @since 1.5 */ - Task editProductSections(String vAppUrn, ProductSectionList sectionList); - - Task editProductSections(URI vAppHref, ProductSectionList sectionList); + @PUT + @Path("/productSections") + @Produces(PRODUCT_SECTION_LIST) + @Consumes(TASK) + @JAXBResponseParser + Task editProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); /** * Retrieves the startup section of a {@link VApp}. - * + * * <pre> * GET /vApp/{id}/startupSection * </pre> - * + * * @since 0.9 */ - StartupSection getStartupSection(String vAppUrn); - - StartupSection getStartupSection(URI vAppHref); + @GET + @Path("/startupSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + StartupSection getStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn); /** * Modifies the startup section of a {@link VApp}. - * + * * <pre> * PUT /vApp/{id}/startupSection * </pre> - * + * * @since 0.9 */ - Task editStartupSection(String vAppUrn, StartupSection section); + @PUT + @Path("/startupSection") + @Produces(STARTUP_SECTION) + @Consumes(TASK) + @JAXBResponseParser + Task editStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, + @BinderParam(BindToXMLPayload.class) StartupSection section); - Task editStartupSection(URI vAppHref, StartupSection section); + /** + * Retrieves a {@link VApp}. + * + * The {@link VApp} could be in one of these statuses: + * <ul> + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#FAILED_CREATION + * FAILED_CREATION(-1)} - Transient entity state, e.g., model object is addd but the + * corresponding VC backing does not exist yet. This is further sub-categorized in the respective + * entities. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRESOLVED + * UNRESOLVED(0)} - Entity is whole, e.g., VM creation is complete and all the required model + * objects and VC backings are created. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#RESOLVED + * RESOLVED(1)} - Entity is resolved. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#DEPLOYED + * DEPLOYED(2)} - Entity is deployed. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#SUSPENDED + * SUSPENDED(3)} - All VMs of the vApp are suspended. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_ON + * POWERED_ON(4)} - All VMs of the vApp are powered on. + * <li> + * {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#WAITING_FOR_INPUT + * WAITING_FOR_INPUT(5)} - VM is pending response on a question. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNKNOWN + * UNKNOWN(6)} - Entity state could not be retrieved from the inventory, e.g., VM power state is + * null. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#UNRECOGNIZED + * UNRECOGNIZED(7)} - Entity state was retrieved from the inventory but could not be mapped to an + * internal state. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#POWERED_OFF + * POWERED_OFF(8)} - All VMs of the vApp are powered off. + * <li> + * {@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#INCONSISTENT_STATE + * INCONSISTENT_STATE(9)} - Apply to VM status, if a vm is {@code POWERED_ON}, or + * {@code WAITING_FOR_INPUT}, but is undeployed, it is in an inconsistent state. + * <li>{@link org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status#MIXED MIXED(10)} + * - vApp status is set to {@code MIXED} when the VMs in the vApp are in different power states + * </ul> + * + * <pre> + * GET /vApp/{id} + * </pre> + * + * @since 0.9 + */ + @GET + @Consumes(VAPP) + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + VApp get(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#edit(URI, VApp) + */ + @PUT + @Produces(VAPP) + @Consumes(TASK) + @JAXBResponseParser + Task edit(@EndpointParam URI vAppHref, @BinderParam(BindToXMLPayload.class) VApp vApp); + + /** + * @see VAppApi#remove(URI) + */ + @DELETE + @Consumes(TASK) + @JAXBResponseParser + Task remove(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#editControlAccess(URI, ControlAccessParams) + */ + @POST + @Path("/action/controlAccess") + @Produces(CONTROL_ACCESS) + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + ControlAccessParams editControlAccess(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) ControlAccessParams params); + + /** + * @see VAppApi#deploy(URI, DeployVAppParams) + */ + @POST + @Path("/action/deploy") + @Produces(DEPLOY_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + Task deploy(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) DeployVAppParams params); + + /** + * @see VAppApi#discardSuspendedState(URI) + */ + @POST + @Path("/action/discardSuspendedState") + @Consumes(TASK) + @JAXBResponseParser + Task discardSuspendedState(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#enterMaintenanceMode(URI) + */ + @POST + @Path("/action/enterMaintenanceMode") + @Consumes + @JAXBResponseParser + void enterMaintenanceMode(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#exitMaintenanceMode(URI) + */ + @POST + @Path("/action/exitMaintenanceMode") + @Consumes + @JAXBResponseParser + void exitMaintenanceMode(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#recompose(URI, RecomposeVAppParams) + */ + @POST + @Path("/action/recomposeVApp") + @Produces(RECOMPOSE_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + Task recompose(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); + + /** + * @see VAppApi#undeploy(URI, UndeployVAppParams) + */ + @POST + @Path("/action/undeploy") + @Produces(UNDEPLOY_VAPP_PARAMS) + @Consumes(TASK) + @JAXBResponseParser + Task undeploy(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); + + /** + * @see VAppApi#getAccessControl(URI) + */ + @GET + @Path("/controlAccess") + @Consumes(CONTROL_ACCESS) + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ControlAccessParams getAccessControl(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#powerOff(URI) + */ + @POST + @Path("/power/action/powerOff") + @Consumes(TASK) + @JAXBResponseParser + Task powerOff(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#powerOn(URI) + */ + @POST + @Path("/power/action/powerOn") + @Consumes(TASK) + @JAXBResponseParser + Task powerOn(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#reboot(URI) + */ + @POST + @Path("/power/action/reboot") + @Consumes(TASK) + @JAXBResponseParser + Task reboot(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#reset(URI) + */ + @POST + @Path("/power/action/reset") + @Consumes(TASK) + @JAXBResponseParser + Task reset(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#shutdown(URI) + */ + @POST + @Path("/power/action/shutdown") + @Consumes(TASK) + @JAXBResponseParser + Task shutdown(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#suspend(URI) + */ + @POST + @Path("/power/action/suspend") + @Consumes(TASK) + @JAXBResponseParser + Task suspend(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#getLeaseSettingsSection(URI) + */ + @GET + @Path("/leaseSettingsSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + LeaseSettingsSection getLeaseSettingsSection(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#editLeaseSettingsSection(URI, LeaseSettingsSection) + */ + @PUT + @Path("/leaseSettingsSection") + @Produces(LEASE_SETTINGS_SECTION) + @Consumes(TASK) + @JAXBResponseParser + Task editLeaseSettingsSection(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); + + /** + * @see VAppApi#getNetworkConfigSection(URI) + */ + @GET + @Path("/networkConfigSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkConfigSection getNetworkConfigSection(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#editNetworkConfigSection(URI, NetworkConfigSection) + */ + @PUT + @Path("/networkConfigSection") + @Produces(NETWORK_CONFIG_SECTION) + @Consumes(TASK) + @JAXBResponseParser + Task editNetworkConfigSection(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); + + /** + * @see VAppApi#getNetworkSection(URI) + */ + @GET + @Path("/networkSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkSection getNetworkSection(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#getOwner(URI) + */ + @GET + @Path("/owner") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Owner getOwner(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#editOwner(URI, Owner) + */ + @PUT + @Path("/owner") + @Produces(OWNER) + @Consumes(TASK) + @JAXBResponseParser + void editOwner(@EndpointParam URI vAppHref, @BinderParam(BindToXMLPayload.class) Owner owner); + + /** + * @see VAppApi#getProductSections(URI) + */ + @GET + @Path("/productSections") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ProductSectionList getProductSections(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#editProductSections(URI, ProductSectionList) + */ + @PUT + @Path("/productSections") + @Produces(PRODUCT_SECTION_LIST) + @Consumes(TASK) + @JAXBResponseParser + Task editProductSections(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); + + /** + * @see VAppApi#getStartupSection(URI) + */ + @GET + @Path("/startupSection") + @Consumes + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + StartupSection getStartupSection(@EndpointParam URI vAppHref); + + /** + * @see VAppApi#editStartupSection(URI, StartupSection) + */ + @PUT + @Path("/startupSection") + @Produces(STARTUP_SECTION) + @Consumes(TASK) + @JAXBResponseParser + Task editStartupSection(@EndpointParam URI vAppHref, + @BinderParam(BindToXMLPayload.class) StartupSection section); } http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java deleted file mode 100644 index b42006e..0000000 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppAsyncApi.java +++ /dev/null @@ -1,624 +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.CONTROL_ACCESS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.LEASE_SETTINGS_SECTION; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONFIG_SECTION; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OWNER; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PRODUCT_SECTION_LIST; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.STARTUP_SECTION; -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.VAPP; - -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.dmtf.ovf.NetworkSection; -import org.jclouds.dmtf.ovf.StartupSection; -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.Owner; -import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; -import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.VApp; -import org.jclouds.vcloud.director.v1_5.domain.params.ControlAccessParams; -import org.jclouds.vcloud.director.v1_5.domain.params.DeployVAppParams; -import org.jclouds.vcloud.director.v1_5.domain.params.RecomposeVAppParams; -import org.jclouds.vcloud.director.v1_5.domain.params.UndeployVAppParams; -import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection; -import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection; -import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; -import org.jclouds.vcloud.director.v1_5.functions.URNToHref; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * @see VAppApi - */ -@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) -public interface VAppAsyncApi { - - /** - * @see VAppApi#get(String) - */ - @GET - @Consumes(VAPP) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<VApp> get(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#edit(String, VApp) - */ - @PUT - @Produces(VAPP) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> edit(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) VApp vApp); - - /** - * @see VAppApi#remove(String) - */ - @DELETE - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> remove(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#editControlAccess(String, ControlAccessParams) - */ - @POST - @Path("/action/controlAccess") - @Produces(CONTROL_ACCESS) - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) ControlAccessParams params); - - /** - * @see VAppApi#deploy(String, DeployVAppParams) - */ - @POST - @Path("/action/deploy") - @Produces(DEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> deploy(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) DeployVAppParams params); - - /** - * @see VAppApi#discardSuspendedState(String) - */ - @POST - @Path("/action/discardSuspendedState") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> discardSuspendedState(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#enterMaintenanceMode(String) - */ - @POST - @Path("/action/enterMaintenanceMode") - @Consumes - @JAXBResponseParser - ListenableFuture<Void> enterMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#exitMaintenanceMode(String) - */ - @POST - @Path("/action/exitMaintenanceMode") - @Consumes - @JAXBResponseParser - ListenableFuture<Void> exitMaintenanceMode(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#recompose(String, RecomposeVAppParams) - */ - @POST - @Path("/action/recomposeVApp") - @Produces(RECOMPOSE_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> recompose(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); - - /** - * @see VAppApi#undeploy(String, UndeployVAppParams) - */ - @POST - @Path("/action/undeploy") - @Produces(UNDEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> undeploy(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); - - /** - * @see VAppApi#getAccessControl(String) - */ - @GET - @Path("/controlAccess") - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#powerOff(String) - */ - @POST - @Path("/power/action/powerOff") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOff(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#powerOn(String) - */ - @POST - @Path("/power/action/powerOn") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOn(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#reboot(String) - */ - @POST - @Path("/power/action/reboot") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reboot(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#reset(String) - */ - @POST - @Path("/power/action/reset") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reset(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#shutdown(String) - */ - @POST - @Path("/power/action/shutdown") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> shutdown(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#suspend(String) - */ - @POST - @Path("/power/action/suspend") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> suspend(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#getLeaseSettingsSection(String) - */ - @GET - @Path("/leaseSettingsSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection( - @EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#editLeaseSettingsSection(String, LeaseSettingsSection) - */ - @PUT - @Path("/leaseSettingsSection") - @Produces(LEASE_SETTINGS_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); - - /** - * @see VAppApi#getNetworkConfigSection(String) - */ - @GET - @Path("/networkConfigSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<NetworkConfigSection> getNetworkConfigSection( - @EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#editNetworkConfigSection(String, NetworkConfigSection) - */ - @PUT - @Path("/networkConfigSection") - @Produces(NETWORK_CONFIG_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editNetworkConfigSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); - - /** - * @see VAppApi#getNetworkSection(String) - */ - @GET - @Path("/networkSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#getOwner(String) - */ - @GET - @Path("/owner") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Owner> getOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#editOwner(String, Owner) - */ - @PUT - @Path("/owner") - @Produces(OWNER) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Void> editOwner(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) Owner owner); - - /** - * @see VAppApi#getProductSections(String) - */ - @GET - @Path("/productSections") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ProductSectionList> getProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#editProductSections(String, ProductSectionList) - */ - @PUT - @Path("/productSections") - @Produces(PRODUCT_SECTION_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editProductSections(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); - - /** - * @see VAppApi#getStartupSection(String) - */ - @GET - @Path("/startupSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<StartupSection> getStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn); - - /** - * @see VAppApi#editStartupSection(String, StartupSection) - */ - @PUT - @Path("/startupSection") - @Produces(STARTUP_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editStartupSection(@EndpointParam(parser = URNToHref.class) String vAppUrn, - @BinderParam(BindToXMLPayload.class) StartupSection section); - - /** - * @see VAppApi#get(URI) - */ - @GET - @Consumes(VAPP) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<VApp> get(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#edit(URI, VApp) - */ - @PUT - @Produces(VAPP) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> edit(@EndpointParam URI vAppHref, @BinderParam(BindToXMLPayload.class) VApp vApp); - - /** - * @see VAppApi#remove(URI) - */ - @DELETE - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> remove(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#editControlAccess(URI, ControlAccessParams) - */ - @POST - @Path("/action/controlAccess") - @Produces(CONTROL_ACCESS) - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - ListenableFuture<ControlAccessParams> editControlAccess(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) ControlAccessParams params); - - /** - * @see VAppApi#deploy(URI, DeployVAppParams) - */ - @POST - @Path("/action/deploy") - @Produces(DEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> deploy(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) DeployVAppParams params); - - /** - * @see VAppApi#discardSuspendedState(URI) - */ - @POST - @Path("/action/discardSuspendedState") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> discardSuspendedState(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#enterMaintenanceMode(URI) - */ - @POST - @Path("/action/enterMaintenanceMode") - @Consumes - @JAXBResponseParser - ListenableFuture<Void> enterMaintenanceMode(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#exitMaintenanceMode(URI) - */ - @POST - @Path("/action/exitMaintenanceMode") - @Consumes - @JAXBResponseParser - ListenableFuture<Void> exitMaintenanceMode(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#recompose(URI, RecomposeVAppParams) - */ - @POST - @Path("/action/recomposeVApp") - @Produces(RECOMPOSE_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> recompose(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) RecomposeVAppParams params); - - /** - * @see VAppApi#undeploy(URI, UndeployVAppParams) - */ - @POST - @Path("/action/undeploy") - @Produces(UNDEPLOY_VAPP_PARAMS) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> undeploy(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) UndeployVAppParams params); - - /** - * @see VAppApi#getAccessControl(URI) - */ - @GET - @Path("/controlAccess") - @Consumes(CONTROL_ACCESS) - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ControlAccessParams> getAccessControl(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#powerOff(URI) - */ - @POST - @Path("/power/action/powerOff") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOff(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#powerOn(URI) - */ - @POST - @Path("/power/action/powerOn") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> powerOn(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#reboot(URI) - */ - @POST - @Path("/power/action/reboot") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reboot(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#reset(URI) - */ - @POST - @Path("/power/action/reset") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> reset(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#shutdown(URI) - */ - @POST - @Path("/power/action/shutdown") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> shutdown(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#suspend(URI) - */ - @POST - @Path("/power/action/suspend") - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> suspend(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#getLeaseSettingsSection(URI) - */ - @GET - @Path("/leaseSettingsSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<LeaseSettingsSection> getLeaseSettingsSection(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#editLeaseSettingsSection(URI, LeaseSettingsSection) - */ - @PUT - @Path("/leaseSettingsSection") - @Produces(LEASE_SETTINGS_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editLeaseSettingsSection(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) LeaseSettingsSection section); - - /** - * @see VAppApi#getNetworkConfigSection(URI) - */ - @GET - @Path("/networkConfigSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<NetworkConfigSection> getNetworkConfigSection(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#editNetworkConfigSection(URI, NetworkConfigSection) - */ - @PUT - @Path("/networkConfigSection") - @Produces(NETWORK_CONFIG_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editNetworkConfigSection(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) NetworkConfigSection section); - - /** - * @see VAppApi#getNetworkSection(URI) - */ - @GET - @Path("/networkSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<NetworkSection> getNetworkSection(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#getOwner(URI) - */ - @GET - @Path("/owner") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<Owner> getOwner(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#editOwner(URI, Owner) - */ - @PUT - @Path("/owner") - @Produces(OWNER) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Void> editOwner(@EndpointParam URI vAppHref, @BinderParam(BindToXMLPayload.class) Owner owner); - - /** - * @see VAppApi#getProductSections(URI) - */ - @GET - @Path("/productSections") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<ProductSectionList> getProductSections(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#editProductSections(URI, ProductSectionList) - */ - @PUT - @Path("/productSections") - @Produces(PRODUCT_SECTION_LIST) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editProductSections(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) ProductSectionList sectionList); - - /** - * @see VAppApi#getStartupSection(URI) - */ - @GET - @Path("/startupSection") - @Consumes - @JAXBResponseParser - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture<StartupSection> getStartupSection(@EndpointParam URI vAppHref); - - /** - * @see VAppApi#editStartupSection(URI, StartupSection) - */ - @PUT - @Path("/startupSection") - @Produces(STARTUP_SECTION) - @Consumes(TASK) - @JAXBResponseParser - ListenableFuture<Task> editStartupSection(@EndpointParam URI vAppHref, - @BinderParam(BindToXMLPayload.class) StartupSection section); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/3ecf3f03/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java ---------------------------------------------------------------------- diff --git a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java index ab76580..df1ad86 100644 --- a/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java +++ b/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateApi.java @@ -16,9 +16,33 @@ */ package org.jclouds.vcloud.director.v1_5.features; +import static org.jclouds.Fallbacks.NullOnNotFoundOr404; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CUSTOMIZATION_SECTION; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.LEASE_SETTINGS_SECTION; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONFIG_SECTION; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_SECTION; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OWNER; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PRODUCT_SECTION_LIST; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP_TEMPLATE; + 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.dmtf.ovf.NetworkSection; +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.Owner; import org.jclouds.vcloud.director.v1_5.domain.ProductSectionList; import org.jclouds.vcloud.director.v1_5.domain.References; @@ -28,12 +52,10 @@ import org.jclouds.vcloud.director.v1_5.domain.dmtf.Envelope; import org.jclouds.vcloud.director.v1_5.domain.section.CustomizationSection; import org.jclouds.vcloud.director.v1_5.domain.section.LeaseSettingsSection; import org.jclouds.vcloud.director.v1_5.domain.section.NetworkConfigSection; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationAndCookieToRequest; +import org.jclouds.vcloud.director.v1_5.functions.URNToHref; -/** - * Provides synchronous access to {@link VAppTemplate} objects. - * - * @see VAppTemplateAsyncApi - */ +@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class) public interface VAppTemplateApi { /** @@ -68,9 +90,17 @@ public interface VAppTemplateApi { * the String of the template * @return the requested template */ - VAppTemplate get(String templateUrn); - - VAppTemplate get(URI templateHref); + @GET + @Consumes(VAPP_TEMPLATE) + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + VAppTemplate get(@EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes(VAPP_TEMPLATE) + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + VAppTemplate get(@EndpointParam URI reference); /** * Modifies only the name/description of a vApp template. @@ -86,9 +116,19 @@ public interface VAppTemplateApi { * @return the task performing the action. This operation is asynchronous and the user should * monitor the returned task status in order to check when it is completed. */ - Task edit(String templateUrn, VAppTemplate template); - - Task edit(URI templateHref, VAppTemplate template); + @PUT + @Produces(VAPP_TEMPLATE) + @Consumes(TASK) + @JAXBResponseParser + Task edit(@EndpointParam(parser = URNToHref.class) String templateUrn, + @BinderParam(BindToXMLPayload.class) VAppTemplate template); + + @PUT + @Produces(VAPP_TEMPLATE) + @Consumes(TASK) + @JAXBResponseParser + Task edit(@EndpointParam URI templateHref, + @BinderParam(BindToXMLPayload.class) VAppTemplate template); /** * Deletes a vApp template. @@ -102,9 +142,15 @@ public interface VAppTemplateApi { * @return the task performing the action. This operation is asynchronous and the user should * monitor the returned task status in order to check when it is completed. */ - Task remove(String templateUrn); + @DELETE + @Consumes(TASK) + @JAXBResponseParser + Task remove(@EndpointParam String templateUrn); - Task remove(URI templateHref); + @DELETE + @Consumes(TASK) + @JAXBResponseParser + Task remove(@EndpointParam URI templateUri); /** * Disables the download link to the ovf of a vApp template. @@ -116,9 +162,15 @@ public interface VAppTemplateApi { * @param templateUrn * the String of the template */ - void disableDownload(String templateUrn); + @POST + @Path("/action/disableDownload") + @JAXBResponseParser + void disableDownload(@EndpointParam(parser = URNToHref.class) String templateUrn); - void disableDownload(URI templateHref); + @POST + @Path("/action/disableDownload") + @JAXBResponseParser + void disableDownload(@EndpointParam URI templateHref); /** * Enables downloading of the ovf of a vApp template. @@ -132,9 +184,17 @@ public interface VAppTemplateApi { * @return the task performing the action. This operation is asynchronous and the user should * monitor the returned task status in order to check when it is completed. */ - Task enableDownload(String templateUrn); - - Task enableDownload(URI templateHref); + @POST + @Consumes(TASK) + @Path("/action/enableDownload") + @JAXBResponseParser + Task enableDownload(@EndpointParam(parser = URNToHref.class) String templateUrn); + + @POST + @Consumes(TASK) + @Path("/action/enableDownload") + @JAXBResponseParser + Task enableDownload(@EndpointParam URI templateHref); /** * Retrieves the customization section of a vApp template. @@ -147,9 +207,20 @@ public interface VAppTemplateApi { * the String of the template * @return the customization section */ - CustomizationSection getCustomizationSection(String templateUrn); - - CustomizationSection getCustomizationSection(URI templateHref); + @GET + @Consumes(CUSTOMIZATION_SECTION) + @Path("/customizationSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + CustomizationSection getCustomizationSection( + @EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes(CUSTOMIZATION_SECTION) + @Path("/customizationSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + CustomizationSection getCustomizationSection(@EndpointParam URI templateHref); /** * Retrieves the lease settings section of a vApp or vApp template @@ -162,9 +233,20 @@ public interface VAppTemplateApi { * the String of the template * @return the lease settings */ - LeaseSettingsSection getLeaseSettingsSection(String templateUrn); - - LeaseSettingsSection getLeaseSettingsSection(URI templateHref); + @GET + @Consumes(LEASE_SETTINGS_SECTION) + @Path("/leaseSettingsSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + LeaseSettingsSection getLeaseSettingsSection( + @EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes(LEASE_SETTINGS_SECTION) + @Path("/leaseSettingsSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + LeaseSettingsSection getLeaseSettingsSection(@EndpointParam URI templateHref); /** * Modifies the lease settings section of a vApp or vApp template. @@ -175,14 +257,27 @@ public interface VAppTemplateApi { * * @param templateUrn * the String of the template - * @param section + * @param settingsSection * the new configuration to apply * @return the task performing the action. This operation is asynchronous and the user should * monitor the returned task status in order to check when it is completed. */ - Task editLeaseSettingsSection(String templateUrn, LeaseSettingsSection section); - - Task editLeaseSettingsSection(URI templateHref, LeaseSettingsSection section); + @PUT + @Produces(LEASE_SETTINGS_SECTION) + @Consumes(TASK) + @Path("/leaseSettingsSection") + @JAXBResponseParser + Task editLeaseSettingsSection( + @EndpointParam(parser = URNToHref.class) String templateUrn, + @BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection); + + @PUT + @Produces(LEASE_SETTINGS_SECTION) + @Consumes(TASK) + @Path("/leaseSettingsSection") + @JAXBResponseParser + Task editLeaseSettingsSection(@EndpointParam URI templateHref, + @BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection); /** * Retrieves the network config section of a vApp or vApp template. @@ -195,9 +290,20 @@ public interface VAppTemplateApi { * the String of the template * @return the network config section requested */ - NetworkConfigSection getNetworkConfigSection(String templateUrn); - - NetworkConfigSection getNetworkConfigSection(URI templateHref); + @GET + @Consumes(NETWORK_CONFIG_SECTION) + @Path("/networkConfigSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkConfigSection getNetworkConfigSection( + @EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes(NETWORK_CONFIG_SECTION) + @Path("/networkConfigSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkConfigSection getNetworkConfigSection(@EndpointParam URI templateHref); /** * Retrieves the network section of a vApp or vApp template. @@ -210,9 +316,20 @@ public interface VAppTemplateApi { * the String of the template * @return the network section requested */ - NetworkSection getNetworkSection(String templateUrn); - - NetworkSection getNetworkSection(URI templateHref); + @GET + @Consumes(NETWORK_SECTION) + @Path("/networkSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkSection getNetworkSection( + @EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes(NETWORK_SECTION) + @Path("/networkSection") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + NetworkSection getNetworkSection(@EndpointParam URI templateHref); /** * Retrieves an OVF descriptor of a vApp template. @@ -229,9 +346,19 @@ public interface VAppTemplateApi { * the String of the template * @return the ovf envelope */ - Envelope getOvf(String templateUrn); - - Envelope getOvf(URI templateHref); + @GET + @Consumes + @Path("/ovf") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Envelope getOvf(@EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes + @Path("/ovf") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Envelope getOvf(@EndpointParam URI templateHref); /** * Retrieves vApp template owner. @@ -244,9 +371,19 @@ public interface VAppTemplateApi { * the String of the template * @return the owner of the vApp template */ - Owner getOwner(String templateUrn); - - Owner getOwner(URI templateHref); + @GET + @Consumes(OWNER) + @Path("/owner") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Owner getOwner(@EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes(OWNER) + @Path("/owner") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + Owner getOwner(@EndpointParam URI templateHref); /** * Retrieves VAppTemplate/VM product sections @@ -259,9 +396,20 @@ public interface VAppTemplateApi { * the String of the template * @return the product sections */ - ProductSectionList getProductSections(String templateUrn); - - ProductSectionList getProductSections(URI templateHref); + @GET + @Consumes(PRODUCT_SECTION_LIST) + @Path("/productSections") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ProductSectionList getProductSections( + @EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes(PRODUCT_SECTION_LIST) + @Path("/productSections") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + ProductSectionList getProductSections(@EndpointParam URI templateHref); /** * Modifies the product sections of a vApp or vApp template. @@ -275,9 +423,21 @@ public interface VAppTemplateApi { * @return the task performing the action. This operation is asynchronous and the user should * monitor the returned task status in order to check when it is completed. */ - Task editProductSections(String templateUrn, ProductSectionList sections); - - Task editProductSections(URI templateHref, ProductSectionList sections); + @PUT + @Produces(PRODUCT_SECTION_LIST) + @Consumes(TASK) + @Path("/productSections") + @JAXBResponseParser + Task editProductSections(@EndpointParam(parser = URNToHref.class) String templateUrn, + @BinderParam(BindToXMLPayload.class) ProductSectionList sections); + + @PUT + @Produces(PRODUCT_SECTION_LIST) + @Consumes(TASK) + @Path("/productSections") + @JAXBResponseParser + Task editProductSections(@EndpointParam URI templateHref, + @BinderParam(BindToXMLPayload.class) ProductSectionList sections); /** * <pre> @@ -288,7 +448,17 @@ public interface VAppTemplateApi { * the String of the template * @return shadowVM references */ - References getShadowVms(String templateUrn); - - References getShadowVms(URI templateHref); + @GET + @Consumes + @Path("/shadowVms") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + References getShadowVms(@EndpointParam(parser = URNToHref.class) String templateUrn); + + @GET + @Consumes + @Path("/shadowVms") + @JAXBResponseParser + @Fallback(NullOnNotFoundOr404.class) + References getShadowVms(@EndpointParam URI templateHref); }
