@Override public void execute() { Vpc vpc = null; try { if (isStart()) { _vpcService.startVpc(getEntityId(), true); } else { s_logger.debug("Not starting VPC as " + ApiConstants.START + "=false was passed to the API"); } vpc = _entityMgr.findById(Vpc.class, getEntityId()); } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { s_logger.info(ex); s_logger.trace(ex); throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } if (vpc != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Restricted, vpc); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC"); } }
response.setResponseName(getCommandName()); setResponseObject(response); } else {
@Override public void execute() { Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), isDisplayVpc()); if (result != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC"); } }
@Override public void execute(){ Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), isDisplayVpc()); if (result != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseView.Full, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC"); } }
@Override public void execute() { User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId()); Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId()); Vpc result = _networkService.migrateVpcNetwork(getId(), getVpcOfferingId(), getTierNetworkOfferings(), callerAccount, callerUser, getResume()); if (result != null) { VpcResponse response = _responseGenerator.createVpcResponse(ResponseObject.ResponseView.Restricted, result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vpc"); } }