Search in sources :

Example 1 with CreateVolumeRequest

use of com.zimbra.soap.admin.message.CreateVolumeRequest in project zm-mailbox by Zimbra.

the class VolumeCLI method addVolume.

private void addVolume() throws ParseException, SoapFaultException, IOException, ServiceException, HttpException {
    if (id != null) {
        throw new ParseException("id cannot be specified when adding a volume");
    }
    if (Strings.isNullOrEmpty(type)) {
        throw new ParseException("type is missing");
    }
    if (Strings.isNullOrEmpty(name)) {
        throw new ParseException("name is missing");
    }
    if (Strings.isNullOrEmpty(path)) {
        throw new ParseException("path is missing");
    }
    VolumeInfo vol = new VolumeInfo();
    vol.setType(toType(type));
    vol.setName(name);
    vol.setRootPath(path);
    vol.setCompressBlobs(compress != null ? Boolean.parseBoolean(compress) : false);
    vol.setCompressionThreshold(compressThreshold != null ? Long.parseLong(compressThreshold) : 4096L);
    CreateVolumeRequest req = new CreateVolumeRequest(vol);
    auth();
    CreateVolumeResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req)));
    System.out.println("Volume " + resp.getVolume().getId() + " is created");
}
Also used : CreateVolumeRequest(com.zimbra.soap.admin.message.CreateVolumeRequest) CreateVolumeResponse(com.zimbra.soap.admin.message.CreateVolumeResponse) VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo) ParseException(org.apache.commons.cli.ParseException)

Aggregations

CreateVolumeRequest (com.zimbra.soap.admin.message.CreateVolumeRequest)1 CreateVolumeResponse (com.zimbra.soap.admin.message.CreateVolumeResponse)1 VolumeInfo (com.zimbra.soap.admin.type.VolumeInfo)1 ParseException (org.apache.commons.cli.ParseException)1