listAutoscaleVmProfiles: added zoneId to the list of optional api parameters

This commit is contained in:
Alena Prokharchyk 2014-01-30 11:57:12 -08:00
parent 13e6c2fe72
commit cb073e0634
2 changed files with 14 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.network.as.AutoScaleVmProfile;
@ -53,6 +54,9 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
@Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.STRING, description = "the otherdeployparameters of the autoscale vm profile")
private String otherDeployParams;
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, since = "4.4", description = "availability zone for the auto deployed virtual machine")
private Long zoneId;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@ -73,10 +77,14 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
return serviceOffId;
}
public Long getZoneId() {
return zoneId;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;

View File

@ -438,6 +438,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
Long templateId = cmd.getTemplateId();
String otherDeployParams = cmd.getOtherDeployParams();
Long serviceOffId = cmd.getServiceOfferingId();
Long zoneId = cmd.getZoneId();
SearchWrapper<AutoScaleVmProfileVO> searchWrapper = new SearchWrapper<AutoScaleVmProfileVO>(_autoScaleVmProfileDao, AutoScaleVmProfileVO.class, cmd, cmd.getId());
SearchBuilder<AutoScaleVmProfileVO> sb = searchWrapper.getSearchBuilder();
@ -446,6 +447,7 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
sb.and("templateId", sb.entity().getTemplateId(), SearchCriteria.Op.EQ);
sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(), SearchCriteria.Op.EQ);
sb.and("otherDeployParams", sb.entity().getOtherDeployParams(), SearchCriteria.Op.LIKE);
sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.LIKE);
SearchCriteria<AutoScaleVmProfileVO> sc = searchWrapper.buildSearchCriteria();
if (id != null) {
@ -462,6 +464,10 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
sc.setParameters("serviceOfferingId", serviceOffId);
}
if (zoneId != null) {
sc.setParameters("zoneId", zoneId);
}
return searchWrapper.search();
}