Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
}
VpnUsersResponse vpnResponse = new VpnUsersResponse();
vpnResponse.setId(vpnUser.getUuid());
vpnResponse.setUserName(vpnUser.getUsername());
vpnResponse.setAccountName(account.getAccountName());
Domain domain = _entityMgr.findById(Domain.class, account.getDomainId());
if (domain != null) {
vpnResponse.setDomainId(domain.getUuid());
vpnResponse.setDomainName(domain.getName());
}
vpnResponse.setResponseName(getCommandName());
vpnResponse.setObjectName("vpnuser");
this.setResponseObject(vpnResponse);
}