Search in sources :

Example 1 with GetVolumeRequest

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

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

Aggregations

GetVolumeRequest (com.zimbra.soap.admin.message.GetVolumeRequest)2 GetVolumeResponse (com.zimbra.soap.admin.message.GetVolumeResponse)2 VolumeInfo (com.zimbra.soap.admin.type.VolumeInfo)2 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