Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 
Computing > 4 - Advanced manipulation of the items > Reading the content of the FTP space

4.2.4 Reading the content of the FTP space

Using Aruba's WsEndUser GetCustomVirtualDisks method you can get a list of CustomVirtualDisk class objects representing the virtual disks imported in the ftp area available to the user specified during authentication.
You can filter the virtual disks for the hypervisor, by using a member of the HyperVisorType enumeration, or by getting an unfiltered list using HyperVisorType.All

Parameters
hypervisorType
Type: HypervisorTypes
Member of the HypervisorTypes enumeration. Indicates the type of hypervisor to filter on when searching the CustomVirtualDisk.

Let's look at an example of a method that gets a list of imported virtual disks to be connected to the virtual servers.
//IWsEndUser.GetCustomVirtualDisks Method (c# .NET)
private List<String> GetCustomVirtualDisk(WsEndUserClient client)
{
    List<String> recentCustomVirtualDisk = new List<String>();

    try
    {
        //calls the GetCustomVirtualDisks method, 
        //getting a WsResultOfArrayOfCustomVirtualDisk object
        WsResultOfArrayOfCustomVirtualDisk result = 
            client.GetCustomVirtualDisks(HypervisorTypes.All);

        if (result.Success)
        {
            //only extracts the custom virtual disks created after 1 January 2012
            IEnumerable<CustomVirtualDisk> listOfRecentCustomVirtualDisk = 
                result.Value.Where(p => p.CreationDate > new DateTime(2012, 01, 01));

            //for each custom virtual disk subsequently created
            //on the date indicated, it extracts the path
            foreach (CustomVirtualDisk cvd in listOfRecentCustomVirtualDisk)
            {
                //adds the path of the virtual disk to the list
                recentCustomVirtualDisk.Add(cvd.RelativePathFile);
            }
        }
    }
    catch (Exception ex)
    {
        //relaunches the error
        throw new ApplicationException(ex.Message);
    }

    return recentCustomVirtualDisk;
}
//IWsEndUser.getCustomVirtualDisks Method (JAVA)
private List<String> GetCustomVirtualDisk(IWsEndUser client)
{
    List<String> recentCustomVirtualDisk = new ArrayList<String>();

    try
    {
        //calls the getCustomVirtualDisks method, 
        //getting a WsResultOfArrayOfCustomVirtualDisk object
        WsResultOfArrayOfCustomVirtualDisk result = 
            client.getCustomVirtualDisks(HypervisorTypes.ALL);

        if (result.isSuccess())
        {
            //sets the reference date
            GregorianCalendar cal = new GregorianCalendar();
            cal.set(2012, 1, 1);
            DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
            XMLGregorianCalendar dateFrom = datatypeFactory.newXMLGregorianCalendar(cal);
            
            for (CustomVirtualDisk cvd : result.getValue().getCustomVirtualDisk())
            {
                //for each custom virtual disk subsequently created
                //on the date 1 January, it extracts the path
                if (cvd.getCreationDate().compare(dateFrom) == DatatypeConstants.GREATER)
                {
                    //adds the path of the virtual disk to the list
                    recentCustomVirtualDisk.add(cvd.getRelativePathFile());
                }
            }
        }
    }
    catch (Exception ex)
    {
        //prints the error
        System.out.println(ex);
    }

    return recentCustomVirtualDisk;
}

Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl
See also

API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl


Bookmark and Share