use of org.apache.cloudstack.api.response.AutoScaleVmGroupResponse in project cloudstack by apache.
the class EnableAutoScaleVmGroupCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
AutoScaleVmGroup result = _autoScaleService.enableAutoScaleVmGroup(getId());
if (result != null) {
AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group");
}
}
use of org.apache.cloudstack.api.response.AutoScaleVmGroupResponse in project cloudstack by apache.
the class CreateAutoScaleVmGroupCmd method execute.
@Override
public void execute() {
boolean success = false;
AutoScaleVmGroup vmGroup = null;
try {
success = _autoScaleService.configureAutoScaleVmGroup(this);
if (success) {
vmGroup = _entityMgr.findById(AutoScaleVmGroup.class, getEntityId());
AutoScaleVmGroupResponse responseObject = _responseGenerator.createAutoScaleVmGroupResponse(vmGroup);
setResponseObject(responseObject);
responseObject.setResponseName(getCommandName());
}
} catch (Exception ex) {
// TODO what will happen if Resource Layer fails in a step inbetween
s_logger.warn("Failed to create autoscale vm group", ex);
} finally {
if (!success || vmGroup == null) {
_autoScaleService.deleteAutoScaleVmGroup(getEntityId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
}
}
}
use of org.apache.cloudstack.api.response.AutoScaleVmGroupResponse in project cloudstack by apache.
the class UpdateAutoScaleVmGroupCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
CallContext.current().setEventDetails("AutoScale Vm Group Id: " + getId());
AutoScaleVmGroup result = _autoScaleService.updateAutoScaleVmGroup(this);
if (result != null) {
AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale VmGroup");
}
}
use of org.apache.cloudstack.api.response.AutoScaleVmGroupResponse in project cloudstack by apache.
the class ListAutoScaleVmGroupsCmd method execute.
@Override
public void execute() {
if (id != null && (loadBalancerId != null || profileId != null || policyId != null))
throw new InvalidParameterValueException("When id is specified other parameters need not be specified");
List<? extends AutoScaleVmGroup> autoScaleGroups = _autoScaleService.listAutoScaleVmGroups(this);
ListResponse<AutoScaleVmGroupResponse> response = new ListResponse<AutoScaleVmGroupResponse>();
List<AutoScaleVmGroupResponse> responses = new ArrayList<AutoScaleVmGroupResponse>();
if (autoScaleGroups != null) {
for (AutoScaleVmGroup autoScaleVmGroup : autoScaleGroups) {
AutoScaleVmGroupResponse autoScaleVmGroupResponse = _responseGenerator.createAutoScaleVmGroupResponse(autoScaleVmGroup);
autoScaleVmGroupResponse.setObjectName("autoscalevmgroup");
responses.add(autoScaleVmGroupResponse);
}
}
response.setResponses(responses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.AutoScaleVmGroupResponse in project cloudstack by apache.
the class DisableAutoScaleVmGroupCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
AutoScaleVmGroup result = _autoScaleService.disableAutoScaleVmGroup(getId());
if (result != null) {
AutoScaleVmGroupResponse response = _responseGenerator.createAutoScaleVmGroupResponse(result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group");
}
}
Aggregations