org.jclouds.cloudstack.functions
Class ReuseOrAssociateNewPublicIPAddress

java.lang.Object
  extended by org.jclouds.cloudstack.functions.ReuseOrAssociateNewPublicIPAddress
All Implemented Interfaces:
com.google.common.base.Function<Network,PublicIPAddress>

@Singleton
public class ReuseOrAssociateNewPublicIPAddress
extends Object
implements com.google.common.base.Function<Network,PublicIPAddress>

Author:
Adrian Cole

Field Summary
protected  Logger logger
           
 
Constructor Summary
ReuseOrAssociateNewPublicIPAddress(CloudStackClient client, BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult)
           
 
Method Summary
 PublicIPAddress apply(Network input)
           
static PublicIPAddress associateIPAddressInNetwork(Network network, CloudStackClient client, BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult)
           
static PublicIPAddress findAvailableAndAssociatedWithNetwork(long networkId, AddressClient client)
          Finds existing addresses who are ready for use and not assigned to a machine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.common.base.Function
equals
 

Field Detail

logger

@Named(value="jclouds.compute")
protected Logger logger
Constructor Detail

ReuseOrAssociateNewPublicIPAddress

@Inject
public ReuseOrAssociateNewPublicIPAddress(CloudStackClient client,
                                                 BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult)
Method Detail

findAvailableAndAssociatedWithNetwork

public static PublicIPAddress findAvailableAndAssociatedWithNetwork(long networkId,
                                                                    AddressClient client)
Finds existing addresses who are ready for use and not assigned to a machine.

Parameters:
networkId - network id to search
client - address client
Returns:
address to use
Throws:
NoSuchElementException - if there's no existing ip address that is free for use

associateIPAddressInNetwork

public static PublicIPAddress associateIPAddressInNetwork(Network network,
                                                          CloudStackClient client,
                                                          BlockUntilJobCompletesAndReturnResult blockUntilJobCompletesAndReturnResult)

apply

public PublicIPAddress apply(Network input)
Specified by:
apply in interface com.google.common.base.Function<Network,PublicIPAddress>


Copyright © 2009-2012 jclouds. All Rights Reserved.