Package com.vmware.spbm.connection
Class BasicConnection
- java.lang.Object
-
- com.vmware.spbm.connection.BasicConnection
-
- All Implemented Interfaces:
Connection
public class BasicConnection extends java.lang.Object implements Connection
This is the basic connection implementation that establishes an authenticated session with the STS Service, VC Service, and SPBM service in that order SPBM utilizes the per-authenticated http session cookie from the vCenter server for its authentication. The implementation provides Login functionality as follows: 1. Uses the sampleAcquireHoKTokenByUserCredentialSamplefrom the ssoclient sample set for acquiring a HoK token 2. Use this HoK token to perform LoginByToken using another sampleLoginByTokenSamplefrom the ssoclient sample set to establish authenticated session 3. Uses the authenticates session cookie from the established session and sets the PbmPortType to use the same session to make further SPBM API calls- See Also:
ConnectedServiceBase
-
-
Constructor Summary
Constructors Constructor Description BasicConnection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connectionconnect()Establishes the authenticated connection to the various servicesConnectiondisconnect()Disconnects all the servicesjava.lang.StringgetPassword()Returns the password used for this connectioncom.vmware.pbm.PbmPortTypegetPbmPort()Returns thePbmPortTypeinstance for the SPBM servicecom.vmware.pbm.PbmServicegetPbmService()Returns thePbmServiceinstance for the SPBM servicecom.vmware.pbm.PbmServiceInstanceContentgetPbmServiceContent()Returns thePbmServiceInstanceContentinstance for the SPBM servicecom.vmware.vim25.ManagedObjectReferencegetPbmServiceInstanceReference()Returns theManagedObjectReferencefor the ServiceInstance for the SPBM Servicejava.net.URLgetSpbmURL()Returns the SPBM Service URLjava.net.URLgetSsoURL()Will attempt to return the SSO URL you set from the command line, if you forgot or didn't set one it will call getDefaultSsoUrl to attempt to calculate what the URL should have been.java.lang.StringgetUsername()Returns the username used for this connectioncom.vmware.vim25.UserSessiongetUserSession()Returns theUserSessioninstance associated with the current connectionjava.net.URLgetVcURL()Returns the vSphere web services URLcom.vmware.vim25.VimPortTypegetVimPort()Returns theVimPortTypeinstance for the vsphere servicecom.vmware.vim25.VimServicegetVimService()Returns theVimServiceinstance for the vsphere servicecom.vmware.vim25.ServiceContentgetVimServiceContent()Returns theServiceContentinstance for the vsphere servicecom.vmware.vim25.ManagedObjectReferencegetVimServiceInstanceReference()Returns theManagedObjectReferencefor the ServiceInstance for the vsphere servicebooleanisConnected()Returns if an authenticated connection to the vCenter Server is establishedvoidsetIgnoreCert(java.lang.Boolean ignorecert)DEV ONLY option to ignore the SSL certificate check.voidsetPassword(java.lang.String password)Password for the user to be used to acquire SAML token from the STS Service for accessing vCenter ServervoidsetSpbmUrl(java.lang.String spbmurl)SPBM Service URL e.g.voidsetSsoUrl(java.lang.String ssourl)vCenter Single Sign-On STS service URLvoidsetUsername(java.lang.String username)Username to be used to acquire SAML token from the STS Service for accessing vCenter ServervoidsetVcUrl(java.lang.String vcurl)vSphere web services URL e.g https://\<vcenter>/sdk
-
-
-
Method Detail
-
connect
public Connection connect()
Description copied from interface:ConnectionEstablishes the authenticated connection to the various services- Specified by:
connectin interfaceConnection- Returns:
-
disconnect
public Connection disconnect()
Description copied from interface:ConnectionDisconnects all the services- Specified by:
disconnectin interfaceConnection- Returns:
-
getPassword
public java.lang.String getPassword()
Description copied from interface:ConnectionReturns the password used for this connection- Specified by:
getPasswordin interfaceConnection- Returns:
-
getPbmPort
public com.vmware.pbm.PbmPortType getPbmPort()
Description copied from interface:ConnectionReturns thePbmPortTypeinstance for the SPBM service- Specified by:
getPbmPortin interfaceConnection- Returns:
-
getPbmService
public com.vmware.pbm.PbmService getPbmService()
Description copied from interface:ConnectionReturns thePbmServiceinstance for the SPBM service- Specified by:
getPbmServicein interfaceConnection- Returns:
-
getPbmServiceContent
public com.vmware.pbm.PbmServiceInstanceContent getPbmServiceContent()
Description copied from interface:ConnectionReturns thePbmServiceInstanceContentinstance for the SPBM service- Specified by:
getPbmServiceContentin interfaceConnection- Returns:
-
getPbmServiceInstanceReference
public com.vmware.vim25.ManagedObjectReference getPbmServiceInstanceReference()
Description copied from interface:ConnectionReturns theManagedObjectReferencefor the ServiceInstance for the SPBM Service- Specified by:
getPbmServiceInstanceReferencein interfaceConnection- Returns:
-
getSpbmURL
public java.net.URL getSpbmURL()
Description copied from interface:ConnectionReturns the SPBM Service URL- Specified by:
getSpbmURLin interfaceConnection- Returns:
-
getSsoURL
public java.net.URL getSsoURL()
Will attempt to return the SSO URL you set from the command line, if you forgot or didn't set one it will call getDefaultSsoUrl to attempt to calculate what the URL should have been.- Specified by:
getSsoURLin interfaceConnection- Returns:
- the URL for the SSO services
-
getUsername
public java.lang.String getUsername()
Description copied from interface:ConnectionReturns the username used for this connection- Specified by:
getUsernamein interfaceConnection- Returns:
-
getUserSession
public com.vmware.vim25.UserSession getUserSession()
Description copied from interface:ConnectionReturns theUserSessioninstance associated with the current connection- Specified by:
getUserSessionin interfaceConnection- Returns:
-
getVcURL
public java.net.URL getVcURL()
Description copied from interface:ConnectionReturns the vSphere web services URL- Specified by:
getVcURLin interfaceConnection- Returns:
-
getVimPort
public com.vmware.vim25.VimPortType getVimPort()
Description copied from interface:ConnectionReturns theVimPortTypeinstance for the vsphere service- Specified by:
getVimPortin interfaceConnection- Returns:
-
getVimService
public com.vmware.vim25.VimService getVimService()
Description copied from interface:ConnectionReturns theVimServiceinstance for the vsphere service- Specified by:
getVimServicein interfaceConnection- Returns:
-
getVimServiceContent
public com.vmware.vim25.ServiceContent getVimServiceContent()
Description copied from interface:ConnectionReturns theServiceContentinstance for the vsphere service- Specified by:
getVimServiceContentin interfaceConnection- Returns:
-
getVimServiceInstanceReference
public com.vmware.vim25.ManagedObjectReference getVimServiceInstanceReference()
Description copied from interface:ConnectionReturns theManagedObjectReferencefor the ServiceInstance for the vsphere service- Specified by:
getVimServiceInstanceReferencein interfaceConnection- Returns:
-
isConnected
public boolean isConnected()
Description copied from interface:ConnectionReturns if an authenticated connection to the vCenter Server is established- Specified by:
isConnectedin interfaceConnection- Returns:
-
setIgnoreCert
public void setIgnoreCert(java.lang.Boolean ignorecert)
Description copied from interface:ConnectionDEV ONLY option to ignore the SSL certificate check. DO NOT USE THIS OPTION FOR PRODUCTION CODE- Specified by:
setIgnoreCertin interfaceConnection
-
setPassword
public void setPassword(java.lang.String password)
Description copied from interface:ConnectionPassword for the user to be used to acquire SAML token from the STS Service for accessing vCenter Server- Specified by:
setPasswordin interfaceConnection
-
setSpbmUrl
public void setSpbmUrl(java.lang.String spbmurl)
Description copied from interface:ConnectionSPBM Service URL e.g. https://\<vcenter>/pbm- Specified by:
setSpbmUrlin interfaceConnection
-
setSsoUrl
public void setSsoUrl(java.lang.String ssourl)
Description copied from interface:ConnectionvCenter Single Sign-On STS service URL- Specified by:
setSsoUrlin interfaceConnection
-
setUsername
public void setUsername(java.lang.String username)
Description copied from interface:ConnectionUsername to be used to acquire SAML token from the STS Service for accessing vCenter Server- Specified by:
setUsernamein interfaceConnection
-
setVcUrl
@Option(name="vcurl", systemProperty="vimService.url", description="full url to the vSphere WS SDK service on vCenter") public void setVcUrl(java.lang.String vcurl)Description copied from interface:ConnectionvSphere web services URL e.g https://\<vcenter>/sdk- Specified by:
setVcUrlin interfaceConnection
-
-