Search in sources :

Example 6 with AutoScaleVmGroup

use of com.cloud.network.as.AutoScaleVmGroup 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);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) AutoScaleVmGroup(com.cloud.network.as.AutoScaleVmGroup) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) ArrayList(java.util.ArrayList) AutoScaleVmGroupResponse(org.apache.cloudstack.api.response.AutoScaleVmGroupResponse)

Example 7 with AutoScaleVmGroup

use of com.cloud.network.as.AutoScaleVmGroup 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");
    }
}
Also used : AutoScaleVmGroup(com.cloud.network.as.AutoScaleVmGroup) ServerApiException(org.apache.cloudstack.api.ServerApiException) AutoScaleVmGroupResponse(org.apache.cloudstack.api.response.AutoScaleVmGroupResponse)

Aggregations

AutoScaleVmGroup (com.cloud.network.as.AutoScaleVmGroup)7 ServerApiException (org.apache.cloudstack.api.ServerApiException)5 AutoScaleVmGroupResponse (org.apache.cloudstack.api.response.AutoScaleVmGroupResponse)5 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)2 ArrayList (java.util.ArrayList)2 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)1 AutoScalePolicy (com.cloud.network.as.AutoScalePolicy)1 AutoScaleVmProfile (com.cloud.network.as.AutoScaleVmProfile)1 Condition (com.cloud.network.as.Condition)1 Counter (com.cloud.network.as.Counter)1 LbAutoScalePolicy (com.cloud.network.lb.LoadBalancingRule.LbAutoScalePolicy)1 LbAutoScaleVmGroup (com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmGroup)1 LbAutoScaleVmProfile (com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmProfile)1 LbCondition (com.cloud.network.lb.LoadBalancingRule.LbCondition)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1