Package com.cloud.api

Examples of com.cloud.api.ServerApiException


    @Override
    public void execute(){
            VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
            Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
            if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
            }
           
            VpnUsersResponse vpnResponse = new VpnUsersResponse();
            vpnResponse.setId(vpnUser.getId());
            vpnResponse.setUserName(vpnUser.getUsername());
View Full Code Here


    public void create() {
        Account owner = _accountService.getAccount(getEntityOwnerId());
    
        VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password);
        if (vpnUser == null) {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
        }
        setEntityId(vpnUser.getId());
   
View Full Code Here

    public void create() throws ResourceAllocationException {
        Snapshot snapshot = _snapshotService.allocSnapshot(getVolumeId(), getPolicyId());
        if (snapshot != null) {
            this.setEntityId(snapshot.getId());
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot");
        }
    }
View Full Code Here

        if (snapshot != null) {
            SnapshotResponse response = _responseGenerator.createSnapshotResponse(snapshot);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
        }
    }
View Full Code Here

            response.setResponses(lbDevicesResponse);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        catch (InvalidParameterValueException invalidParamExcp) {
            throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage());
        } catch (CloudRuntimeException runtimeExcp) {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage());
        }
    }
View Full Code Here

        boolean result = _resourceService.deleteHost(getId(), isForced(), isForceDestoryLocalStorage());
        if (result) {
            SuccessResponse response = new SuccessResponse(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete host");
        }
    }
View Full Code Here

        if (project != null) {
            ProjectResponse response = _responseGenerator.createProjectResponse(project);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update a project");
        }
    }
View Full Code Here

        if (result != null) {
            VolumeResponse response = _responseGenerator.createVolumeResponse(result);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach volume");
        }
    }
View Full Code Here

        if (result != null){
            UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reset vm password");
        }
    }
View Full Code Here

        if (result != null){
            HypervisorCapabilitiesResponse response = _responseGenerator.createHypervisorCapabilitiesResponse(result);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
        }
    }
View Full Code Here

TOP

Related Classes of com.cloud.api.ServerApiException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.