Search in sources :

Example 1 with InstanceGroup

use of com.cloud.vm.InstanceGroup in project CloudStack-archive by CloudStack-extras.

the class UpdateVMGroupCmd method execute.

@Override
public void execute() {
    InstanceGroup result = _mgr.updateVmGroup(this);
    if (result != null) {
        InstanceGroupResponse response = _responseGenerator.createInstanceGroupResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm instance group");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) InstanceGroupResponse(com.cloud.api.response.InstanceGroupResponse) InstanceGroup(com.cloud.vm.InstanceGroup)

Example 2 with InstanceGroup

use of com.cloud.vm.InstanceGroup in project CloudStack-archive by CloudStack-extras.

the class ListVMGroupsCmd method execute.

@Override
public void execute() {
    List<? extends InstanceGroup> groups = _mgr.searchForVmGroups(this);
    ListResponse<InstanceGroupResponse> response = new ListResponse<InstanceGroupResponse>();
    List<InstanceGroupResponse> responses = new ArrayList<InstanceGroupResponse>();
    for (InstanceGroup group : groups) {
        InstanceGroupResponse groupResponse = _responseGenerator.createInstanceGroupResponse(group);
        groupResponse.setObjectName("instancegroup");
        responses.add(groupResponse);
    }
    response.setResponses(responses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ArrayList(java.util.ArrayList) InstanceGroupResponse(com.cloud.api.response.InstanceGroupResponse) InstanceGroup(com.cloud.vm.InstanceGroup)

Example 3 with InstanceGroup

use of com.cloud.vm.InstanceGroup in project cosmic by MissionCriticalCloud.

the class CreateVMGroupCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
    final InstanceGroup result = _userVmService.createVmGroup(this);
    if (result != null) {
        final InstanceGroupResponse response = _responseGenerator.createInstanceGroupResponse(result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm instance group");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) InstanceGroupResponse(com.cloud.api.response.InstanceGroupResponse) InstanceGroup(com.cloud.vm.InstanceGroup)

Example 4 with InstanceGroup

use of com.cloud.vm.InstanceGroup in project CloudStack-archive by CloudStack-extras.

the class CreateVMGroupCmd method execute.

@Override
public void execute() {
    InstanceGroup result = _userVmService.createVmGroup(this);
    if (result != null) {
        InstanceGroupResponse response = _responseGenerator.createInstanceGroupResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vm instance group");
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) InstanceGroupResponse(com.cloud.api.response.InstanceGroupResponse) InstanceGroup(com.cloud.vm.InstanceGroup)

Example 5 with InstanceGroup

use of com.cloud.vm.InstanceGroup in project cloudstack by apache.

the class CreateVMGroupCmd method execute.

@Override
public void execute() {
    InstanceGroup result = _userVmService.createVmGroup(this);
    if (result != null) {
        InstanceGroupResponse response = _responseGenerator.createInstanceGroupResponse(result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm instance group");
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) InstanceGroupResponse(org.apache.cloudstack.api.response.InstanceGroupResponse) InstanceGroup(com.cloud.vm.InstanceGroup)

Aggregations

InstanceGroup (com.cloud.vm.InstanceGroup)7 InstanceGroupResponse (com.cloud.api.response.InstanceGroupResponse)5 ServerApiException (com.cloud.api.ServerApiException)4 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 InstanceGroupResponse (org.apache.cloudstack.api.response.InstanceGroupResponse)2 ListResponse (com.cloud.api.response.ListResponse)1 ArrayList (java.util.ArrayList)1