Search in sources :

Example 21 with TemplateResponse

use of org.apache.cloudstack.api.response.TemplateResponse in project cloudstack by apache.

the class UpdateTemplateCmdByAdmin method execute.

@Override
public void execute() {
    VirtualMachineTemplate result = _templateService.updateTemplate(this);
    if (result != null) {
        TemplateResponse response = _responseGenerator.createTemplateUpdateResponse(ResponseView.Full, result);
        response.setObjectName("template");
        //Template can be either USER or ROUTING type
        response.setTemplateType(result.getTemplateType().toString());
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template");
    }
}
Also used : VirtualMachineTemplate(com.cloud.template.VirtualMachineTemplate) ServerApiException(org.apache.cloudstack.api.ServerApiException) TemplateResponse(org.apache.cloudstack.api.response.TemplateResponse)

Aggregations

TemplateResponse (org.apache.cloudstack.api.response.TemplateResponse)21 VirtualMachineTemplate (com.cloud.template.VirtualMachineTemplate)13 ServerApiException (org.apache.cloudstack.api.ServerApiException)12 ListResponse (org.apache.cloudstack.api.response.ListResponse)7 TemplateJoinVO (com.cloud.api.query.vo.TemplateJoinVO)5 ArrayList (java.util.ArrayList)5 ResourceTagJoinVO (com.cloud.api.query.vo.ResourceTagJoinVO)2 StorageUnavailableException (com.cloud.exception.StorageUnavailableException)2 URISyntaxException (java.net.URISyntaxException)2 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2 List (java.util.List)2 ResponseView (org.apache.cloudstack.api.ResponseObject.ResponseView)2 Account (com.cloud.user.Account)1 LinkedHashMap (java.util.LinkedHashMap)1 ListIsosCmdByAdmin (org.apache.cloudstack.api.command.admin.iso.ListIsosCmdByAdmin)1 ListTemplatesCmdByAdmin (org.apache.cloudstack.api.command.admin.template.ListTemplatesCmdByAdmin)1