Search in sources :

Example 1 with VolumeInfo

use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.

the class VolumeCLI method setCurrentVolume.

private void setCurrentVolume() throws ParseException, SoapFaultException, IOException, ServiceException, NumberFormatException, HttpException {
    if (id == null) {
        throw new ParseException("id is missing");
    }
    auth(auth);
    GetVolumeResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(new GetVolumeRequest(Short.valueOf(id)))));
    VolumeInfo vol = resp.getVolume();
    SetCurrentVolumeRequest req = new SetCurrentVolumeRequest(vol.getId(), vol.getType());
    getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req));
    System.out.println("Volume " + id + " is now the current " + toTypeName(vol.getType()) + " volume.");
}
Also used : GetVolumeRequest(com.zimbra.soap.admin.message.GetVolumeRequest) GetVolumeResponse(com.zimbra.soap.admin.message.GetVolumeResponse) SetCurrentVolumeRequest(com.zimbra.soap.admin.message.SetCurrentVolumeRequest) VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo) ParseException(org.apache.commons.cli.ParseException)

Example 2 with VolumeInfo

use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.

the class VolumeCLI method getVolume.

private void getVolume() throws IOException, ServiceException, HttpException {
    if (id == null) {
        GetAllVolumesRequest req = new GetAllVolumesRequest();
        auth(auth);
        GetAllVolumesResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req)));
        for (VolumeInfo vol : resp.getVolumes()) {
            print(vol);
        }
    } else {
        GetVolumeRequest req = new GetVolumeRequest(Short.parseShort(id));
        auth(auth);
        GetVolumeResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req)));
        print(resp.getVolume());
    }
}
Also used : GetVolumeRequest(com.zimbra.soap.admin.message.GetVolumeRequest) GetVolumeResponse(com.zimbra.soap.admin.message.GetVolumeResponse) GetAllVolumesResponse(com.zimbra.soap.admin.message.GetAllVolumesResponse) VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo) GetAllVolumesRequest(com.zimbra.soap.admin.message.GetAllVolumesRequest)

Example 3 with VolumeInfo

use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.

the class Volume method toJAXB.

public VolumeInfo toJAXB() {
    VolumeInfo jaxb = new VolumeInfo();
    jaxb.setId(id);
    jaxb.setType(type);
    jaxb.setName(name);
    jaxb.setRootPath(rootPath);
    jaxb.setMgbits(mboxGroupBits);
    jaxb.setMbits(mboxBits);
    jaxb.setFgbits(fileGroupBits);
    jaxb.setFbits(fileBits);
    jaxb.setCompressBlobs(compressBlobs);
    jaxb.setCompressionThreshold(compressionThreshold);
    jaxb.setCurrent(VolumeManager.getInstance().isCurrent(this));
    return jaxb;
}
Also used : VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo)

Example 4 with VolumeInfo

use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.

the class VolumeCLI method editVolume.

private void editVolume() throws ParseException, SoapFaultException, IOException, ServiceException, HttpException {
    if (Strings.isNullOrEmpty(id)) {
        throw new ParseException("id is missing");
    }
    VolumeInfo vol = new VolumeInfo();
    if (!Strings.isNullOrEmpty(type)) {
        vol.setType(toType(type));
    }
    if (!Strings.isNullOrEmpty(name)) {
        vol.setName(name);
    }
    if (!Strings.isNullOrEmpty(path)) {
        vol.setRootPath(path);
    }
    if (!Strings.isNullOrEmpty(compress)) {
        vol.setCompressBlobs(Boolean.parseBoolean(compress));
    }
    if (!Strings.isNullOrEmpty(compressThreshold)) {
        vol.setCompressionThreshold(Long.parseLong(compressThreshold));
    }
    ModifyVolumeRequest req = new ModifyVolumeRequest(Short.parseShort(id), vol);
    auth(auth);
    getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req));
    System.out.println("Edited volume " + id);
}
Also used : ModifyVolumeRequest(com.zimbra.soap.admin.message.ModifyVolumeRequest) VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo) ParseException(org.apache.commons.cli.ParseException)

Example 5 with VolumeInfo

use of com.zimbra.soap.admin.type.VolumeInfo 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

VolumeInfo (com.zimbra.soap.admin.type.VolumeInfo)7 ParseException (org.apache.commons.cli.ParseException)3 GetAllVolumesRequest (com.zimbra.soap.admin.message.GetAllVolumesRequest)2 GetAllVolumesResponse (com.zimbra.soap.admin.message.GetAllVolumesResponse)2 GetVolumeRequest (com.zimbra.soap.admin.message.GetVolumeRequest)2 GetVolumeResponse (com.zimbra.soap.admin.message.GetVolumeResponse)2 StoreManager (com.zimbra.cs.store.StoreManager)1 Volume (com.zimbra.cs.volume.Volume)1 VolumeManager (com.zimbra.cs.volume.VolumeManager)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 CreateVolumeRequest (com.zimbra.soap.admin.message.CreateVolumeRequest)1 CreateVolumeResponse (com.zimbra.soap.admin.message.CreateVolumeResponse)1 ModifyVolumeRequest (com.zimbra.soap.admin.message.ModifyVolumeRequest)1 ModifyVolumeResponse (com.zimbra.soap.admin.message.ModifyVolumeResponse)1 SetCurrentVolumeRequest (com.zimbra.soap.admin.message.SetCurrentVolumeRequest)1