From 975033bb72609ee45a0d2b60e1e8d3d26546aaa7 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 10 Nov 2011 13:37:06 +0200 Subject: [PATCH] fixed cloudstack tests --- .../features/TemplateAsyncClient.java | 2 + .../cloudstack/features/TemplateClient.java | 157 ++++++++++++------ .../UpdateTemplatePermissionsOptions.java | 8 +- 3 files changed, 113 insertions(+), 54 deletions(-) diff --git a/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java b/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java index 5b65f6a367..38f6815d37 100644 --- a/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java +++ b/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java @@ -45,6 +45,7 @@ import org.jclouds.rest.annotations.OnlyElement; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.SelectJson; +import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Unwrap; import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; @@ -62,6 +63,7 @@ import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; */ @RequestFilters(QuerySigner.class) @QueryParams(keys = "response", values = "json") +@SkipEncoding(',') public interface TemplateAsyncClient { /** diff --git a/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateClient.java b/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateClient.java index 1c61f91934..e586dc25a9 100644 --- a/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateClient.java +++ b/sandbox-apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateClient.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.Template; import org.jclouds.cloudstack.domain.TemplateFilter; +import org.jclouds.cloudstack.domain.TemplateMetadata; import org.jclouds.cloudstack.domain.TemplatePermission; import org.jclouds.cloudstack.options.AccountInDomainOptions; import org.jclouds.cloudstack.options.CreateTemplateOptions; @@ -40,74 +41,112 @@ import org.jclouds.concurrent.Timeout; *

* * @see TemplateAsyncClient - * @see + * @see * @author Adrian Cole */ @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) public interface TemplateClient { /** - * Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it. - * @see http://download.cloud.com/releases/2.2.0/api_2.2.8/user/createTemplate.html - * @param name the name of the template - * @param osTypeId the ID of the OS Type that best represents the OS of this template. - * @param displayText the display text of the template. This is usually used for display purposes. - * @param options optional arguments + * Creates a template of a virtual machine. The virtual machine must be in a + * STOPPED state. A template created from this command is automatically + * designated as a private template visible to the account that created it. + * + * @see http + * ://download.cloud.com/releases/2.2.0/api_2.2.8/user/createTemplate + * .html + * @param templateMetadata + * overall description of the template + * @param options + * optional arguments * @return an asynchronous job response */ - AsyncCreateResponse createTemplate(String name, long osTypeId, String displayText, CreateTemplateOptions... options); + AsyncCreateResponse createTemplate(TemplateMetadata templateMetadata, CreateTemplateOptions... options); /** * Registers an existing template into the Cloud.com cloud. - * @see http://download.cloud.com/releases/2.2.0/api_2.2.8/user/registerTemplate.html - * @param name the name of the template - * @param osTypeId the ID of the OS Type that best represents the OS of this template. - * @param format the format for the template. Possible values include QCOW2, RAW, and VHD. - * @param hypervisor the target hypervisor for the template - * @param url the URL of where the template is hosted. Possible URL include http:// and https:// - * @param zoneId the ID of the zone the template is to be hosted on - * @param displayText the display text of the template. This is usually used for display purposes. - * @param options optional arguments + * + * @see http + * ://download.cloud.com/releases/2.2.0/api_2.2.8/user/registerTemplate + * .html + * @param templateMetadata + * overall description of the template + * @param format + * the format for the template. Possible values include QCOW2, RAW, + * and VHD. + * + * @param url + * the URL of where the template is hosted. Possible URL include + * http:// and https:// + * @param zoneId + * the ID of the zone the template is to be hosted on + * @param options + * optional arguments * @return data about the newly-registered template */ - Template registerTemplate(String name, long osTypeId, String format, String hypervisor, String url, long zoneId, String displayText, RegisterTemplateOptions... options); + Template registerTemplate(TemplateMetadata templateMetadata, String format, String hypervisor, String url, + long zoneId, RegisterTemplateOptions... options); /** * Updates attributes of a template. - * @see http://download.cloud.com/releases/2.2.0/api_2.2.8/user/updateTemplate.html - * @param id the ID of the image file - * @param options optional arguments + * + * @see http + * ://download.cloud.com/releases/2.2.0/api_2.2.8/user/updateTemplate + * .html + * @param id + * the ID of the image file + * @param options + * optional arguments * @return updated data about the template */ Template updateTemplate(long id, UpdateTemplateOptions... options); /** * Copies a template from one zone to another. - * @see http://download.cloud.com/releases/2.2.0/api_2.2.8/user/copyTemplate.html - * @param id Template ID. - * @param sourceZoneId ID of the zone the template is currently hosted on. - * @param destZoneId ID of the zone the template is being copied to. + * + * @see http + * ://download.cloud.com/releases/2.2.0/api_2.2.8/user/copyTemplate.html + * @param id + * Template ID. + * @param sourceZoneId + * ID of the zone the template is currently hosted on. + * @param destZoneId + * ID of the zone the template is being copied to. * @return an asynchronous job response */ AsyncCreateResponse copyTemplateToZone(long id, long sourceZoneId, long destZoneId); /** - * Deletes a template from the system. All virtual machines using the deleted template will not be affected. - * @see http://download.cloud.com/releases/2.2.0/api_2.2.8/user/deleteTemplate.html - * @param id the ID of the template - * @param options optional arguments + * Deletes a template from the system. All virtual machines using the deleted + * template will not be affected. + * + * @see http + * ://download.cloud.com/releases/2.2.0/api_2.2.8/user/deleteTemplate + * .html + * @param id + * the ID of the template + * @param options + * optional arguments */ void deleteTemplate(long id, DeleteTemplateOptions... options); /** * List all executable templates. - * @see http://download.cloud.com/releases/2.2.0/api_2.2.8/user/listTemplates.html + * + * @see http + * ://download.cloud.com/releases/2.2.0/api_2.2.8/user/listTemplates. + * html * @return all executable templates, or empty set, if no templates are found */ Set