use of org.apache.cloudstack.api.response.AutoScaleVmProfileResponse in project cloudstack by apache.
the class CreateAutoScaleVmProfileCmd method execute.
@Override
public void execute() {
AutoScaleVmProfile result = _entityMgr.findById(AutoScaleVmProfile.class, getEntityId());
AutoScaleVmProfileResponse response = _responseGenerator.createAutoScaleVmProfileResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.AutoScaleVmProfileResponse in project cloudstack by apache.
the class UpdateAutoScaleVmProfileCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
CallContext.current().setEventDetails("AutoScale Policy Id: " + getId());
AutoScaleVmProfile result = _autoScaleService.updateAutoScaleVmProfile(this);
if (result != null) {
AutoScaleVmProfileResponse response = _responseGenerator.createAutoScaleVmProfileResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale vm profile");
}
}
use of org.apache.cloudstack.api.response.AutoScaleVmProfileResponse in project cloudstack by apache.
the class ListAutoScaleVmProfilesCmd method execute.
@Override
public void execute() {
List<? extends AutoScaleVmProfile> autoScaleProfiles = _autoScaleService.listAutoScaleVmProfiles(this);
ListResponse<AutoScaleVmProfileResponse> response = new ListResponse<AutoScaleVmProfileResponse>();
List<AutoScaleVmProfileResponse> responses = new ArrayList<AutoScaleVmProfileResponse>();
if (autoScaleProfiles != null) {
for (AutoScaleVmProfile autoScaleVmProfile : autoScaleProfiles) {
AutoScaleVmProfileResponse autoScaleVmProfileResponse = _responseGenerator.createAutoScaleVmProfileResponse(autoScaleVmProfile);
autoScaleVmProfileResponse.setObjectName("autoscalevmprofile");
responses.add(autoScaleVmProfileResponse);
}
}
response.setResponses(responses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.AutoScaleVmProfileResponse in project cloudstack by apache.
the class ApiResponseHelper method createAutoScaleVmProfileResponse.
@Override
public AutoScaleVmProfileResponse createAutoScaleVmProfileResponse(AutoScaleVmProfile profile) {
AutoScaleVmProfileResponse response = new AutoScaleVmProfileResponse();
response.setId(profile.getUuid());
if (profile.getZoneId() != null) {
DataCenter zone = ApiDBUtils.findZoneById(profile.getZoneId());
if (zone != null) {
response.setZoneId(zone.getUuid());
}
}
if (profile.getServiceOfferingId() != null) {
ServiceOffering so = ApiDBUtils.findServiceOfferingById(profile.getServiceOfferingId());
if (so != null) {
response.setServiceOfferingId(so.getUuid());
}
}
if (profile.getTemplateId() != null) {
VMTemplateVO template = ApiDBUtils.findTemplateById(profile.getTemplateId());
if (template != null) {
response.setTemplateId(template.getUuid());
}
}
response.setOtherDeployParams(profile.getOtherDeployParams());
response.setCounterParams(profile.getCounterParams());
response.setDestroyVmGraceperiod(profile.getDestroyVmGraceperiod());
User user = ApiDBUtils.findUserById(profile.getAutoScaleUserId());
if (user != null) {
response.setAutoscaleUserId(user.getUuid());
}
response.setObjectName("autoscalevmprofile");
// Populates the account information in the response
populateOwner(response, profile);
return response;
}
Aggregations