Class VCenterClient
-
Method Summary
Modifier and TypeMethodDescriptiongetAllHostSystemManagedEntities
(String vCenterName, String username, String password) Retrieve all managed entities of type "HostSystem" in the specified VCenter.static String
requestCertificate
(String vCenterName, String username, String password, String hostname) Request an authentication certificate for the specified hostname from the specified VMware vCenter server.static void
Sets the debug methods to be used by the VCenterClient class.
-
Method Details
-
setDebug
Sets the debug methods to be used by the VCenterClient class.The VCenterClient class may need to write debug information. However, depending on whether it runs in the context of MatsyaEngine or as a CLI, the debug will need to be handled differently.
In the case of MatsyaEngine, before making any further call to this class, use setDebug(MatsyaEngine::getDebugMode, MatsyaEngine::debug).
In the case of CLI, use setDebug() with your own methods (which will probably simply print to stdout).
- Parameters:
isDebugEnabledMethod
- The static method that returns a boolean whether the debug mode is enabled or notdebugMethod
- The static method that will print the debug message somewhere
-
requestCertificate
public static String requestCertificate(String vCenterName, String username, String password, String hostname) throws com.vmware.vim25.InvalidLogin, Exception Request an authentication certificate for the specified hostname from the specified VMware vCenter server.The specified hostname must be registered in VMware vCenter so we can get an authentication "token" for it.
To get this token, we first need to authenticate against VMware vCenter (using the good old username and password mechanism). Then, we will be able to connect to the specified hostname VMware ESX just using this "token"
- Parameters:
vCenterName
- The hostname of IP address of the VMware vCenter systemusername
- Credentials to connect to VMware vCenterpassword
- Associated passwordhostname
- The hostname or IP address of the ESX host that we need an authentication token for- Returns:
- The authentication token in the form of a String
- Throws:
com.vmware.vim25.InvalidLogin
- when the specified username/password is... well, invalidException
- when anything else happens
-
getAllHostSystemManagedEntities
public static List<String> getAllHostSystemManagedEntities(String vCenterName, String username, String password) throws Exception Retrieve all managed entities of type "HostSystem" in the specified VCenter.- Parameters:
vCenterName
- The hostname of IP address of the VMware vCenter systemusername
- Credentials to connect to VMware vCenterpassword
- Associated password- Returns:
- The list of hostnames (or IP addresses) registered in the VCenter
- Throws:
com.vmware.vim25.InvalidLogin
- for bad credentialsException
- when anything else goes south
-