Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 
Computing > 4 - Advanced manipulation of the items > Unset an IP address from a Cloud Server

4.1.15 Unset an IP address from a Cloud Server

By using the Aruba WsEndUser method SetEnqueueDeassociateIpAddress it is possible to remove the association between a network adapter and one or more IPAddress.

ipAddressResourceIds
Type: int[]
Value of int Array with the IP addresses to disassociate from network adapter
networkAdapterId
Type: int
Value of type int which is the unique identifier of the network adapter to which disassociate the IP addresses

setOnVirtualMachine
Type: bool
Value of type bool that, if "true", it applies the new configuration directly on the Virtual Machine as well as save it on database if the parameter ExtraControl is active on the server.


/// IWsEndUser.SetEnqueueDeassociateIpAddress Method (c# .NET)
private static void DeassociateIpAddress(WsEndUserClient client,
    int[] ipAddressResourceIds, int networkAdapterId, bool setOnVirtualMachine)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    try
    {
        // create the object IpAddressesRequest for the request 
        //with data to process
        IpAddressesRequest request = new IpAddressesRequest();
        request.IpAddressResourceIds = ipAddressResourceIds;
        request.NetworkAdapterId = networkAdapterId;
        request.SetOnVirtualMachine = setOnVirtualMachine;

        //call method SetEnqueueDeassociateIpAddress, 
        //obtaining a WsResult item
        WsResult result = client.SetEnqueueDeassociateIpAddress(request);

        //if the call is not successful, re-run the error indicating the message
        if (!result.Success)
            throw new ApplicationException( result.ResultMessage);                
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException( ex.Message);
    }
}
//IWsEndUser.setEnqueueDeassociateIpAddress Method (JAVA)
private static void deassociateIpAddress(IWsEndUser client, 
    ArrayOfint ipAddressResourceIds, int networkAdapterId, 
    boolean setOnVirtualMachine)
{
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
    .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
    .put(BindingProvider.PASSWORD_PROPERTY, "1234567890");

    try
    {
        // create the object IpAddressesRequest for the request 
        //with data to process
        IpAddressesRequest request = new IpAddressesRequest();
        request.setIpAddressResourceIds(ipAddressResourceIds);
        request.setNetworkAdapterId(networkAdapterId);
        request.setSetOnVirtualMachine(setOnVirtualMachine);

        //call method setEnqueueDeassociateIpAddress, 
        //obtaining a WsResult item
        WsResult result = client.setEnqueueDeassociateIpAddress(request);

        //if the call is not successful, re-run the error indicating the message
        if (!result.isSuccess())
            throw new Exception( result.getResultMessage().getValue());                
    }
    catch (Exception ex)
    {
        //show error
        System.out.println(ex);
    }
}
Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl
See also




Bookmark and Share