api: Annotate iso related cmd and response classes

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2012-12-23 02:40:14 -08:00
parent 503db14127
commit 0e1083ad83
11 changed files with 57 additions and 43 deletions

View File

@ -40,7 +40,8 @@ public class ListTemplateOrIsoPermissionsCmd extends BaseCmd {
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the template ID")
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplatePermissionsResponse.class,
required=true, description="the template ID")
private Long id;
/////////////////////////////////////////////////////

View File

@ -17,11 +17,12 @@
package com.cloud.api.commands;
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Parameter;
public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
@ -37,15 +38,15 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the image", length=4096)
private String displayText;
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the image file")
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="the ID of the image file")
private Long id;
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the image file")
private String templateName;
@IdentityMapper(entityTableName="guest_os")
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, description="the ID of the OS type that best represents the OS of this image.")
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.UUID, entityType = GuestOSResponse.class,
description="the ID of the OS type that best represents the OS of this image.")
private Long osTypeId;
@Parameter(name=ApiConstants.FORMAT, type=CommandType.STRING, description="the format for the image")

View File

@ -18,11 +18,12 @@ package com.cloud.api.commands;
import java.util.List;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
@ -39,8 +40,8 @@ public abstract class UpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
@Parameter(name = ApiConstants.ACCOUNTS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "a comma delimited list of accounts. If specified, \"op\" parameter has to be passed in.")
private List<String> accountNames;
@IdentityMapper(entityTableName="vm_template")
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the template ID")
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class,
required = true, description = "the template ID")
private Long id;
@Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true for featured template/iso, false otherwise")
@ -55,8 +56,8 @@ public abstract class UpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
@Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "permission operator (add, remove, reset)")
private String operation;
@IdentityMapper(entityTableName="projects")
@Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.LONG, description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
@Parameter(name = ApiConstants.PROJECT_IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectResponse.class,
description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
private List<Long> projectIds;
// ///////////////////////////////////////////////////

View File

@ -17,12 +17,12 @@
package org.apache.cloudstack.api.command.user.iso;
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
@ -42,12 +42,12 @@ public class AttachIsoCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the ISO file")
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="the ID of the ISO file")
private Long id;
@IdentityMapper(entityTableName="vm_instance")
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="the ID of the virtual machine")
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="the ID of the virtual machine")
private Long virtualMachineId;

View File

@ -21,11 +21,12 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.template.VirtualMachineTemplate;
@ -41,12 +42,12 @@ public class DeleteIsoCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the ISO file")
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="the ID of the ISO file")
private Long id;
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
description="the ID of the zone of the ISO file. If not specified, the ISO will be deleted from all the zones")
private Long zoneId;

View File

@ -17,12 +17,12 @@
package org.apache.cloudstack.api.command.user.iso;
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
@ -41,8 +41,8 @@ public class DetachIsoCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="vm_instance")
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.LONG, required=true, description="The ID of the virtual machine")
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="The ID of the virtual machine")
private Long virtualMachineId;
/////////////////////////////////////////////////////

View File

@ -16,12 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
@ -43,15 +44,15 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the ISO file")
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="the ID of the ISO file")
private Long id;
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="the url to which the ISO would be extracted")
private String url;
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=false, description="the ID of the zone where the ISO is originally located")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
required=false, description="the ID of the zone where the ISO is originally located")
private Long zoneId;
@Parameter(name=ApiConstants.MODE, type=CommandType.STRING, required=true, description="the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD")

View File

@ -20,11 +20,11 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
@ -51,8 +51,8 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, description="the hypervisor for which to restrict the search")
private String hypervisor;
@IdentityMapper(entityTableName="vm_template")
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list all isos by id")
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
description="list all isos by id")
private Long id;
@Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="true if the ISO is publicly available to all users, false otherwise.")
@ -71,8 +71,8 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list all isos by name")
private String isoName;
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the ID of the zone")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
description="the ID of the zone")
private Long zoneId;
/////////////////////////////////////////////////////

View File

@ -22,12 +22,15 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.IdentityMapper;
import org.apache.cloudstack.api.Implementation;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.UserContext;
@ -60,19 +63,19 @@ public class RegisterIsoCmd extends BaseCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the ISO")
private String isoName;
@IdentityMapper(entityTableName="guest_os")
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.LONG, description="the ID of the OS Type that best represents the OS of this ISO. If the iso is bootable this parameter needs to be passed")
@Parameter(name=ApiConstants.OS_TYPE_ID, type=CommandType.UUID, entityType = GuestOSResponse.class,
description="the ID of the OS Type that best represents the OS of this ISO. If the iso is bootable this parameter needs to be passed")
private Long osTypeId;
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL to where the ISO is currently being hosted")
private String url;
@IdentityMapper(entityTableName="data_center")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the ID of the zone you wish to register the ISO to.")
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
required=true, description="the ID of the zone you wish to register the ISO to.")
private Long zoneId;
@IdentityMapper(entityTableName="domain")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId. If the account parameter is used, domainId must also be used.")
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
description="an optional domainId. If the account parameter is used, domainId must also be used.")
private Long domainId;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account name. Must be used with domainId.")
@ -81,8 +84,8 @@ public class RegisterIsoCmd extends BaseCmd {
@Parameter(name=ApiConstants.CHECKSUM, type=CommandType.STRING, description="the MD5 checksum value of this ISO")
private String checksum;
@IdentityMapper(entityTableName="projects")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="Register iso for the project")
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
description="Register iso for the project")
private Long projectId;
/////////////////////////////////////////////////////

View File

@ -16,11 +16,14 @@
// under the License.
package org.apache.cloudstack.api.response;
import com.cloud.storage.GuestOS;
import org.apache.cloudstack.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.Entity;
@Entity(value=GuestOS.class)
public class GuestOSResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="the ID of the OS type")
private String id;

View File

@ -18,11 +18,14 @@ package org.apache.cloudstack.api.response;
import java.util.List;
import com.cloud.template.VirtualMachineTemplate;
import org.apache.cloudstack.api.ApiConstants;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.Entity;
@Entity(value=VirtualMachineTemplate.class)
@SuppressWarnings("unused")
public class TemplatePermissionsResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="the template ID")