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

4.1.14 Set an IP address to a Cloud Server

By using the Aruba WsEndUser method SetEnqueueAssociateIpAddress it is possible to assign a set of IP Address to a specified network adapter.

Parameters
ipAddressResourceIds
Type: int[]
Value of int Array with the IP addresses to associate to network adapter

networkAdapterId
Type: int
Value of type int which is the unique identifier of the network adapter to which associate 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.SetEnqueueAssociateIpAddress Method (c# .NET)
private static void AssociateIpAddress(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 SetEnqueueAssociateIpAddress, 
        //obtaining a WsResult item
        WsResult result = client.SetEnqueueAssociateIpAddress(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.setEnqueueAssociateIpAddress Method (JAVA)
private static void associateIpAddress(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 setEnqueueAssociateIpAddress, 
        //obtaining a WsResult item
        WsResult result = client.setEnqueueAssociateIpAddress(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