Connect a solution to ESX Agent Manager
To connect a solution to ESX Agent Manager, you must obtain connection information from the
vCenter Server
in which you run the solution. You pass a reference to the EsxAgentManager
instance that is running in vCenter Server
to the solution.- Obtain the following information from thevCenter Serverinstance on which you run a solution:
- ThevCenter Serverhost ID.
- The HTTPS proxy port forvCenter Server.
- The session cookie for the current user session in which the solution is logged in as an extension.
- The managed object reference (MoRef) of the ESX Agent Manager instance that is running in thevCenter Serverinstance.
You pass the connection information to a solution by calling the appropriate methods from the vSphere API.
If you integrate your solution with the vCenter Extension vService, the vService obtains the
vCenter Server
connection information for you. See How do I integrate an extension with the vCenter Extension vService.You can define the connection to
vCenter Server
in the MyVimConnection.java
class and the connection to ESX Agent Manager in the MyEamConnection.java
class.The
MyVimConnection
class defines methods to obtain the vCenter Server
host ID, HTTPS proxy, and the session cookie. The MyManager.java
class implements MyVimConnection
to connect to the vCenter Server
on which your solution is running. See Connect the extension to vCenter Server.- Establish a connection to thevCenter Serverinstance on which the solution runs.Your solution can establish the connection tovCenter Serverin theMyVimConnection.javaclass.
- Create an instance of theManagedObjectReferenceobject of typeEsxAgentManager.TheMyEamConnection.javaclass can define a constructor that creates a MoRef named_myeamRefand a method namedgetEsxAgentManager()that returns the MoRef to the solution.public MyEamConnection(String vcHost, int vcHttpsProxyPort, String sessionCookie) { [...] _myeamRef = new ManagedObjectReference(); _myeamRef.setType("EsxAgentManager"); _myeamRef.setValue("EsxAgentManager"); } [...] public ManagedObjectReference getEsxAgentManager() { return _myeamRef; }
- Connect to the ESX Agent Manager with the URL to the ESX Agent Manager service and the session cookie for the current session in which the solution is logged as an extension.TheMyEamConnectionclass can define aconnect()method that connects to the ESX Agent Manager service.public void connect() { if (_isConnected) { return; } try { [...] String myeamUrl = "https://" + _vcHost + ":" + _vcHttpsProxyPort + "/eam/sdk/"; [...] Map<String, List<String>> map = new HashMap<String, List<String>>(); map.put("Cookie", Collections.singletonList(_sessionCookie)); ((BindingProvider) _stub).getRequestContext() .put(MessageContext.HTTP_REQUEST_HEADERS, map); _isConnected = true; } }
You obtained the connection details for
vCenter Server
and connected a solution to ESX Agent Manager.Configure ESX agencies and agents to deploy from the solution.