Search in sources :

Example 6 with VolumeInfo

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

the class VolumeCLI method getCurrentVolumes.

private void getCurrentVolumes() throws SoapFaultException, IOException, ServiceException, HttpException {
    GetAllVolumesRequest req = new GetAllVolumesRequest();
    auth(auth);
    GetAllVolumesResponse all = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req)));
    for (VolumeInfo vol : all.getVolumes()) {
        if (vol.isCurrent()) {
            print(vol);
        }
    }
}
Also used : GetAllVolumesResponse(com.zimbra.soap.admin.message.GetAllVolumesResponse) VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo) GetAllVolumesRequest(com.zimbra.soap.admin.message.GetAllVolumesRequest)

Example 7 with VolumeInfo

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

the class ModifyVolume method handle.

private ModifyVolumeResponse handle(ModifyVolumeRequest req, Map<String, Object> ctx) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(ctx);
    checkRight(zsc, ctx, Provisioning.getInstance().getLocalServer(), Admin.R_manageVolume);
    VolumeManager mgr = VolumeManager.getInstance();
    Volume.Builder builder = Volume.builder(mgr.getVolume(req.getId()));
    VolumeInfo vol = req.getVolume();
    if (vol == null) {
        throw ServiceException.INVALID_REQUEST("must specify a volume Element", null);
    }
    StoreManager storeManager = StoreManager.getInstance();
    if (storeManager.supports(StoreManager.StoreFeature.CUSTOM_STORE_API, String.valueOf(vol.getId()))) {
        throw ServiceException.INVALID_REQUEST("Operation unsupported, use zxsuite to edit this volume", null);
    }
    if (vol.getType() > 0) {
        builder.setType(vol.getType());
    }
    if (vol.getName() != null) {
        builder.setName(vol.getName());
    }
    if (vol.getRootPath() != null) {
        builder.setPath(vol.getRootPath(), true);
    }
    if (vol.getCompressBlobs() != null) {
        builder.setCompressBlobs(vol.getCompressBlobs());
    }
    if (vol.getCompressionThreshold() > 0) {
        builder.setCompressionThreshold(vol.getCompressionThreshold());
    }
    mgr.update(builder.build());
    return new ModifyVolumeResponse();
}
Also used : VolumeManager(com.zimbra.cs.volume.VolumeManager) Volume(com.zimbra.cs.volume.Volume) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo) ModifyVolumeResponse(com.zimbra.soap.admin.message.ModifyVolumeResponse) StoreManager(com.zimbra.cs.store.StoreManager)

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