@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { bmMgr.notifyProvisionDone(this); this.setResponseObject(new SuccessResponse(getCommandName())); } catch (Exception e) { s_logger.warn(String.format("unable to notify baremetal provision done[mac:%s]", mac), e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { resourceManager.deleteController(this); SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); setResponseObject(response); //FIXME } catch (InvalidParameterValueException e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete OpenDaylight controller."); } }
private void setupResponse(final boolean result) { final SuccessResponse response = new SuccessResponse(); response.setSuccess(result); response.setResponseName(getCommandName()); response.setObjectName("ha"); setResponseObject(response); }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { s_logger.trace("execute"); SuccessResponse resp = new SuccessResponse(); resp.setSuccess(_service.deleteSspHost(this)); this.setResponseObject(resp); }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { _certService.deleteSslCert(this); SuccessResponse rsp = new SuccessResponse(); rsp.setResponseName(getCommandName()); rsp.setObjectName("success"); this.setResponseObject(rsp); } catch (Exception e) { throw new CloudRuntimeException(e); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { try { _nuageVspManager.associateNuageVspDomainTemplate(this); SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); response.setSuccess(true); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } }
@Override public void execute() throws ServerApiException, ConcurrentOperationException, EntityExistsException { SuccessResponse response = new SuccessResponse(); try { boolean result = _netsclarLbService.deleteServicePackageOffering(this); if (response != null && result) { response.setDisplayText("Deleted Successfully"); response.setSuccess(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } } catch (CloudRuntimeException runtimeExcp) { response.setDisplayText(runtimeExcp.getMessage()); response.setSuccess(false); response.setResponseName(getCommandName()); this.setResponseObject(response); return; } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Service Package due to internal error."); } }
@Override public void execute() { boolean result = _networkService.releasePodIp(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); response.setDisplayText("IP is released sucessfully"); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release Pod ip "); } } }
@Override public void execute() { boolean result = _mgr.deleteSSHKeyPair(this); SuccessResponse response = new SuccessResponse(getCommandName()); response.setSuccess(result); setResponseObject(response); }
@Override public void execute() { final String templateName = getTemplateName(); if (templateName == null || getTemplateSubject() == null || getTemplateBody() == null) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to update quota email template due to empty or invalid template name or text"); } boolean isValidTemplateName = false; for (QuotaConfig.QuotaEmailTemplateTypes e: QuotaConfig.QuotaEmailTemplateTypes.values()) { if (e.toString().equalsIgnoreCase(templateName)) { isValidTemplateName = true; setTemplateName(e.toString()); break; } } if (!isValidTemplateName) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid quota email template type, allowed values are: " + Arrays.toString(QuotaConfig.QuotaEmailTemplateTypes.values())); } if (!_quotaResponseBuilder.updateQuotaEmailTemplate(this)) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to update quota email template due to an internal error"); } final SuccessResponse response = new SuccessResponse(); response.setResponseName(getCommandName()); response.setSuccess(true); setResponseObject(response); }
@Override public void execute() throws ServerApiException, ConcurrentOperationException, EntityExistsException { SuccessResponse response = new SuccessResponse(); try { boolean result = _netsclarLbService.deleteNetscalerControlCenter(this); if (response != null && result) { response.setDisplayText("Netscaler Control Center Deleted Successfully"); response.setSuccess(result); response.setResponseName(getCommandName()); setResponseObject(response); } } catch (CloudRuntimeException runtimeExcp) { response.setDisplayText(runtimeExcp.getMessage()); response.setSuccess(false); response.setResponseName(getCommandName()); setResponseObject(response); return; } catch (Exception e) { e.printStackTrace(); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { mgr.deleteUcsManager(ucsManagerId); SuccessResponse rsp = new SuccessResponse(); rsp.setResponseName(getCommandName()); rsp.setObjectName("success"); this.setResponseObject(rsp); } catch (Exception e) { logger.debug(e.getMessage(), e); throw new CloudRuntimeException(e); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { vlanMgr.deleteRct(this); SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); } catch (Exception e) { s_logger.warn(String.format("unable to delete baremetal RCT[%s]", getId()), e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage(), e); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { boolean result = _usageService.removeRawUsageRecords(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove old raw usage records from cloud_usage table, a job is likely running at this time. Please try again after 15 mins."); } } }
private void setupResponse(final boolean result) { final SuccessResponse response = new SuccessResponse(); response.setSuccess(result); response.setResponseName(getCommandName()); response.setObjectName("ha"); setResponseObject(response); }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { if (!hypervisor.equalsIgnoreCase("kvm")) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Currently supporting KVM hosts only"); } SuccessResponse response = new SuccessResponse(getCommandName()); try { LOG.debug("Uploading certificate " + name + " to agents for Direct Download"); boolean result = directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor); response.setSuccess(result); setResponseObject(response); } catch (Exception e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } }
@Override public void execute() { // Check permissions UserAccount userAccount = _accountService.getUserAccountById(getId()); if (userAccount == null) { throw new ServerApiException(ApiErrorCode.ACCOUNT_ERROR , "Unable to find a user account with the given ID"); } Domain domain = _domainService.getDomain(userAccount.getDomainId()); Account account = _accountService.getAccount(userAccount.getAccountId()); _accountService.checkAccess(CallContext.current().getCallingAccount(), domain); _accountService.checkAccess(CallContext.current().getCallingAccount(), SecurityChecker.AccessType.OperateEntry, true, account); CallContext.current().setEventDetails("UserId: " + getId()); SuccessResponse response = new SuccessResponse(); Boolean status = false; if (_samlAuthManager.authorizeUser(getId(), getEntityId(), getEnable())) { status = true; } response.setResponseName(getCommandName()); response.setSuccess(status); setResponseObject(response); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { try { _storageNetworkService.deleteIpRange(this); SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } catch (Exception e) { s_logger.warn("Failed to delete storage network ip range " + getId(), e); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } }
@Override public void execute() { try { boolean result = _networkUsageService.deleteTrafficMonitor(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic monitor."); } } catch (InvalidParameterValueException e) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to delete traffic monitor."); } } }
private void setupResponse(final boolean result) { final SuccessResponse response = new SuccessResponse(); response.setSuccess(result); response.setResponseName(getCommandName()); response.setObjectName("ha"); setResponseObject(response); }