public class GetHost
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
GetHost.IsNotHostAgentException
thrown when this class must assert that a Host is in use.
|
class |
GetHost.IsNotvCenterException
thrown when this class must assert that a vCenter connection is
in use.
|
| Modifier and Type | Field and Description |
|---|---|
Connection |
connection |
| Constructor and Description |
|---|
GetHost(Connection connection)
this class works with a connection object and is immutable against this object
|
| Modifier and Type | Method and Description |
|---|---|
static java.net.InetAddress |
address(java.lang.String value) |
com.vmware.vim25.ManagedObjectReference |
byName(java.lang.String hostname)
given a hostname or IP address, returns the managed object ref for that host using
the connection fed to the constructor.
|
java.lang.String |
getType()
returns the connection type
|
GetHost |
hostCheck()
throws an IsNotHostAgentException if we are NOT talking to an ESX host
|
static java.lang.String |
ipAddress(java.net.InetAddress address)
takes a candidate ipaddress or host name and returns a validated IP address or hostname
|
boolean |
isIpAddress(java.lang.String value)
takes a candidate hostname or IP address and returns true if the address is useful
|
static java.lang.String |
resolve(java.net.InetAddress address)
uses the InetAddress API in Java to process either a hostname or an IP
the return result is a string delimited by "/" that holds the DNS name (if found)
and the IP address (if found) of the result.
|
GetHost |
vCenterCheck()
throws an IsNotvCenterCheck if we are NOT talking to a vCenter instance
|
public final Connection connection
public GetHost(Connection connection)
connection - the connection we are working withpublic boolean isIpAddress(java.lang.String value)
NOTE: this is IPv6 compatible
value - public static java.net.InetAddress address(java.lang.String value)
value - a possible hostname or IP addressInetAddresspublic static java.lang.String resolve(java.net.InetAddress address)
address - a potential ip or hostnamepublic static java.lang.String ipAddress(java.net.InetAddress address)
address - - candidate valuepublic com.vmware.vim25.ManagedObjectReference byName(java.lang.String hostname)
hostname - public GetHost vCenterCheck()
GetHost.IsNotvCenterExceptionpublic GetHost hostCheck()
GetHost.IsNotHostAgentExceptionpublic java.lang.String getType()