Search in sources :

Example 1 with GetVolumeResponse

use of com.zimbra.soap.admin.message.GetVolumeResponse 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 GetVolumeResponse

use of com.zimbra.soap.admin.message.GetVolumeResponse 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 GetVolumeResponse

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

the class GetVolume method handle.

private GetVolumeResponse handle(GetVolumeRequest req, Map<String, Object> ctx) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(ctx);
    checkRight(zsc, ctx, Provisioning.getInstance().getLocalServer(), Admin.R_manageVolume);
    Volume vol = VolumeManager.getInstance().getVolume(req.getId());
    GetVolumeResponse resp = new GetVolumeResponse(vol.toJAXB());
    return resp;
}
Also used : Volume(com.zimbra.cs.volume.Volume) GetVolumeResponse(com.zimbra.soap.admin.message.GetVolumeResponse) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext)

Aggregations

GetVolumeResponse (com.zimbra.soap.admin.message.GetVolumeResponse)3 GetVolumeRequest (com.zimbra.soap.admin.message.GetVolumeRequest)2 VolumeInfo (com.zimbra.soap.admin.type.VolumeInfo)2 Volume (com.zimbra.cs.volume.Volume)1 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)1 GetAllVolumesRequest (com.zimbra.soap.admin.message.GetAllVolumesRequest)1 GetAllVolumesResponse (com.zimbra.soap.admin.message.GetAllVolumesResponse)1 SetCurrentVolumeRequest (com.zimbra.soap.admin.message.SetCurrentVolumeRequest)1 ParseException (org.apache.commons.cli.ParseException)1