com.vmware.vcloud.sdk
Class VcloudClient

java.lang.Object
  extended by com.vmware.vcloud.sdk.VcloudClient

public class VcloudClient
extends Object

VcloudClient is used in all the helper classes. Once logged in the vcloud client maintains all the session information. This acts as a handle or a root object through which subsequent helper classes can be reached.


Constructor Summary
VcloudClient(String vCloudUrl, Version version)
          Constructing the vcloud client
 
Method Summary
 Boolean extendSession()
          The default session timeout is 30 mins.
 RecordResult<com.vmware.vcloud.api.rest.schema.QueryResultFileDescriptorRecordType> getFileDescriptorRecords()
          Returns the list of file descriptor records.
 HashMap<String,com.vmware.vcloud.api.rest.schema.OperatingSystemFamilyInfoType> getOperatingSystemFamiliesByName()
          Returns a map of supported operating system family infos by the os family name.
 HashMap<String,com.vmware.vcloud.api.rest.schema.OperatingSystemInfoType> getOperatingSystemsByName()
          Returns a map of supported operating system infos by the os name.
 String getOrgName()
          Returns the org name of the currently logged in user.
 com.vmware.vcloud.api.rest.schema.ReferenceType getOrgRefByName(String orgName)
          Returns the organization reference by name.
 Collection<com.vmware.vcloud.api.rest.schema.ReferenceType> getOrgRefs()
          Returns the organization references.
 HashMap<String,com.vmware.vcloud.api.rest.schema.ReferenceType> getOrgRefsByName()
          Returns a map of organization references by name.
 QueryService getQueryService()
          Returns the Vcloud QueryService
 InputStream getSchemaDefinition(String schemaFileName)
          Returns the specified schema definition file from the server..
 ReferenceResult getServiceRefs()
          Returns the list of user service references.
 HashMap<String,com.vmware.vcloud.api.rest.schema.versioning.VersionInfoType> getSupportedVersions()
          Returns the list of supported api version
 HashMap<String,com.vmware.vcloud.api.rest.schema.ReferenceType> getUpdatedOrgList()
          If an authenticated client (one that has already logged in) needs to retrieve this org list.
 String getUserName()
          Returns the user name of the currently logged in user.
 VcloudAdmin getVcloudAdmin()
          Returns the VcloudAdmin Helper
 VcloudAdminExtension getVcloudAdminExtension()
          Returns the VcloudAdminExtension Helper
 String getVcloudApiURL()
          Returns the base vCloud API url
 Version getVcloudClientVersion()
          This package level method returns the current vcloud client version information.
 String getVcloudToken()
          Returns the vcloud token
 Collection<com.vmware.vcloud.api.rest.schema.ReferenceType> getVdcTemplateRefs()
          Returns a Collection of VdcTemplate References
 void login(String userName, String password)
          Login to vCloud using the credentials and the version information
 void logout()
          Logs out the user and invalidates the authentication
 void registerScheme(String name, Integer port, org.apache.http.conn.ssl.SSLSocketFactory factory)
          Register the protocol scheme such as "http" or "https", port and the socket factory to be used to create the java.net.Socket instances for the given protocol
 void setConnectionTimeout(int milliseconds)
          Sets the timeout in milliseconds which is the timeout for the connection to be established.
static void setLogLevel(Level level)
          Change the log levels.
 void setMaxConnections(int maxConnections)
          The default maxConnectionsPerHost is 2 & maxTotalConnections is 20.
 void setProxy(String proxyHost, int port, String scheme)
          If behind a proxy.
 void setProxyCredentials(String username, String password)
          Setting the username and password for the proxy.
 void setSocketTimeout(int milliseconds)
          Sets the socket timeout in milliseconds which is the timeout for waiting for data.
 void setVcloudToken(String vcloudToken)
          Sets the vcloud token
 void ssoLogin(Element tokenElement, String orgName)
          Login to vCloud Director using SAML Assertion token element from the vSphere SSO/SAML Identity Provider.
 void ssoLogin(Element hokToken, String orgName, String signature, String signature_algorithm)
          Login to vCloud Director using SAML Assertion token element from the vSphere SSO/SAML Identity Provider.
 void ssoLogin(String samlAssertionXML, String orgName)
          Login to vCloud Director using SAML Assertion XML from the vSphere SSO/SAML Identity Provider.
 void ssoLogin(String samlAssertionXML, String orgName, String signature, String signature_algorithm)
          Login to vCloud Director using SAML Assertion XML from the vSphere SSO/SAML Identity Provider.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VcloudClient

public VcloudClient(String vCloudUrl,
                    Version version)
Constructing the vcloud client

Parameters:
vCloudUrl - vCloud URL. Ex: https://hostname
version - Version
Method Detail

getVcloudClientVersion

public Version getVcloudClientVersion()
                               throws VCloudException
This package level method returns the current vcloud client version information.

Returns:
Version
Throws:
VCloudException

getVcloudToken

public String getVcloudToken()
                      throws VCloudException
Returns the vcloud token

Returns:
String
Throws:
VCloudException
Since:
API 1.5, SDK 5.1

setVcloudToken

public void setVcloudToken(String vcloudToken)
Sets the vcloud token

Parameters:
vcloudToken -
Since:
API 1.5, SDK 5.1

setConnectionTimeout

public void setConnectionTimeout(int milliseconds)
Sets the timeout in milliseconds which is the timeout for the connection to be established. The default timeout is infinite.

Parameters:
milliseconds -

setSocketTimeout

public void setSocketTimeout(int milliseconds)
Sets the socket timeout in milliseconds which is the timeout for waiting for data. The default value is infinite.

Parameters:
milliseconds -

getSupportedVersions

public HashMap<String,com.vmware.vcloud.api.rest.schema.versioning.VersionInfoType> getSupportedVersions()
                                                                                                  throws VCloudException
Returns the list of supported api version

Returns:
HashMap
Throws:
VCloudException

setMaxConnections

public void setMaxConnections(int maxConnections)
The default maxConnectionsPerHost is 2 & maxTotalConnections is 20. Overrides maxConnectionsPerHost and maxTotalConnections (maxTotalConnections is overridden only if maxConnectionsPerHost > 20).

Parameters:
maxConnections -

setProxy

public void setProxy(String proxyHost,
                     int port,
                     String scheme)
If behind a proxy. Set proxy settings for the vCloud clients

Parameters:
proxyHost - vCloud client HTTP proxy host
port - vCloud client HTTP proxy port
scheme -

setProxyCredentials

public void setProxyCredentials(String username,
                                String password)
Setting the username and password for the proxy.

Parameters:
username -
password -

login

public void login(String userName,
                  String password)
           throws VCloudException
Login to vCloud using the credentials and the version information

Parameters:
userName - - vCloud userName
password - - vCloud user password
Throws:
VCloudException

ssoLogin

public void ssoLogin(Element tokenElement,
                     String orgName)
              throws VCloudException
Login to vCloud Director using SAML Assertion token element from the vSphere SSO/SAML Identity Provider. This overloaded method can be used in performing: SSO login with Bearer/HOK tokens in both Org/System scope. No signature verification is done when using this method.

Parameters:
tokenElement - - Can be Bearer / HOK token
orgName - - The name of your vCloud Director organization.
Throws:
VCloudException
Since:
API 5.1, SDK 5.1
See Also:
ssoLogin(String, String), ssoLogin(Element, String, String, String), ssoLogin(String, String, String, String)

ssoLogin

public void ssoLogin(String samlAssertionXML,
                     String orgName)
              throws VCloudException
Login to vCloud Director using SAML Assertion XML from the vSphere SSO/SAML Identity Provider. This overloaded method can be used in performing: SSO login with Bearer/HOK tokens in both Org/System scope. No signature verification is done when using this method.

Parameters:
samlAssertionXML - - SAML Assertion XML from the vSphere SSO/SAML Identity Provider.
orgName - - The name of your vCloud Director organization.
Throws:
VCloudException
Since:
API 5.1, SDK 5.1
See Also:
ssoLogin(Element, String), ssoLogin(Element, String, String, String), ssoLogin(String, String, String, String)

ssoLogin

public void ssoLogin(Element hokToken,
                     String orgName,
                     String signature,
                     String signature_algorithm)
              throws VCloudException
Login to vCloud Director using SAML Assertion token element from the vSphere SSO/SAML Identity Provider. This overloaded method can be used in performing: SSO login with HOK tokens and the signature attributes in Org/System scope. vCD also does the signature verification of the provided HOK token. Note: For Bearer tokens there is no signature verification done. Use/Refer to the ssoLogin(tokenElement, orgName) or ssoLogin(tokenXML, orgName).

Parameters:
hokToken - - HOK [Holder-of-key] tokens provide authentication based on security artifacts embedded in the token. The token contains the claims to identify the originator and the delegate. In the vSphere environment, a vCenter Server obtains delegated tokens on a user's behalf and uses those tokens to perform operations.
orgName - - The name of your vCloud Director organization.
signature - - Base64 encoded signaure of the token XML generated using client's private key
signature_algorithm - Standard signature algorithm name
Throws:
VCloudException
Since:
API 5.5, SDK 5.5
See Also:
ssoLogin(Element, String), ssoLogin(String, String), ssoLogin(String, String, String, String)

ssoLogin

public void ssoLogin(String samlAssertionXML,
                     String orgName,
                     String signature,
                     String signature_algorithm)
              throws VCloudException
Login to vCloud Director using SAML Assertion XML from the vSphere SSO/SAML Identity Provider. This overloaded method can be used in performing: SSO login with HOK tokens and the signature attributes in Org/System scope. vCD also does the signature verification of the provided HOK token. Note: For Bearer tokens there is no signature verification done. Use/Refer to the ssoLogin(tokenElement, orgName) or ssoLogin(tokenXML, orgName).

Parameters:
samlAssertionXML - - SAML Assertion XML from the vSphere SSO/SAML Identity Provider.
orgName - - The name of your vCloud Director organization.
signature - - Base64 encoded signaure of the token XML generated using client's private key
signature_algorithm - Standard signature algorithm name
Throws:
VCloudException
Since:
API 5.5, SDK 5.5
See Also:
ssoLogin(Element, String), ssoLogin(String, String), ssoLogin(Element, String, String, String)

logout

public void logout()
            throws VCloudException
Logs out the user and invalidates the authentication

Throws:
VCloudException

getOrgRefsByName

public HashMap<String,com.vmware.vcloud.api.rest.schema.ReferenceType> getOrgRefsByName()
                                                                                 throws VCloudException
Returns a map of organization references by name.

Returns:
HashMap
Throws:
VCloudException
VCloudException

getUpdatedOrgList

public HashMap<String,com.vmware.vcloud.api.rest.schema.ReferenceType> getUpdatedOrgList()
                                                                                  throws VCloudException
If an authenticated client (one that has already logged in) needs to retrieve this org list. This method updates the already existing Organization List and its references

Returns:
HashMap
Throws:
VCloudException

getOrgRefByName

public com.vmware.vcloud.api.rest.schema.ReferenceType getOrgRefByName(String orgName)
                                                                throws VCloudException
Returns the organization reference by name.

Parameters:
orgName - String
Returns:
ReferenceType
Throws:
VCloudException

getOrgRefs

public Collection<com.vmware.vcloud.api.rest.schema.ReferenceType> getOrgRefs()
                                                                       throws VCloudException
Returns the organization references.

Returns:
Collection
Throws:
VCloudException

getVcloudApiURL

public String getVcloudApiURL()
Returns the base vCloud API url

Returns:
the vCloudApiURL

getVcloudAdmin

public VcloudAdmin getVcloudAdmin()
                           throws VCloudException
Returns the VcloudAdmin Helper

Returns:
VcloudAdmin
Throws:
VCloudException

getVcloudAdminExtension

public VcloudAdminExtension getVcloudAdminExtension()
                                             throws VCloudException
Returns the VcloudAdminExtension Helper

Returns:
VcloudAdminExtension
Throws:
VCloudException

setLogLevel

public static void setLogLevel(Level level)
Change the log levels. If this propery is not set. It defaults to the level set in the JDK_HOME/jre/lib/logging.properties file. .

Parameters:
level - Level
Since:
API 1.5, SDK 1.5

registerScheme

public void registerScheme(String name,
                           Integer port,
                           org.apache.http.conn.ssl.SSLSocketFactory factory)
Register the protocol scheme such as "http" or "https", port and the socket factory to be used to create the java.net.Socket instances for the given protocol

Parameters:
name - String "http" or "https"
port - Integer port number
factory - SSLSocketFactory SSLSocketFactory can be used to validate the identity of the HTTPS server against a list of trusted certificates and to authenticate to the HTTPS server using a private key.
Since:
API 1.5, SDK 1.5

getQueryService

public QueryService getQueryService()
Returns the Vcloud QueryService

Returns:
QueryService
Since:
API 1.5, SDK 1.5

getUserName

public String getUserName()
Returns the user name of the currently logged in user.

Returns:
String
Since:
API 1.5, SDK 5.1

getOrgName

public String getOrgName()
Returns the org name of the currently logged in user.

Returns:
String
Since:
API 1.5, SDK 5.1

extendSession

public Boolean extendSession()
The default session timeout is 30 mins. This method extends/renews the current valid session for another 30 mins.

Returns:
Boolean
Throws:
VCloudException
Since:
API 1.5, SDK 5.1

getOperatingSystemFamiliesByName

public HashMap<String,com.vmware.vcloud.api.rest.schema.OperatingSystemFamilyInfoType> getOperatingSystemFamiliesByName()
                                                                                                                 throws VCloudException
Returns a map of supported operating system family infos by the os family name.

Returns:
HashMap<String, OperatingSystemFamilyInfoType>
Throws:
VCloudException
Since:
API 5.1, SDK 5.1
See Also:
OperatingSystemFamilyType

getOperatingSystemsByName

public HashMap<String,com.vmware.vcloud.api.rest.schema.OperatingSystemInfoType> getOperatingSystemsByName()
                                                                                                    throws VCloudException
Returns a map of supported operating system infos by the os name.

Returns:
HashMap<String, OperatingSystemInfoType>
Throws:
VCloudException
Since:
API 5.1, SDK 5.1
See Also:
OperatingSystemType

getServiceRefs

public ReferenceResult getServiceRefs()
                               throws VCloudException
Returns the list of user service references.

Returns:
ReferenceResult
Throws:
VCloudException
Since:
API 5.1, SDK 5.1

getFileDescriptorRecords

public RecordResult<com.vmware.vcloud.api.rest.schema.QueryResultFileDescriptorRecordType> getFileDescriptorRecords()
                                                                                                             throws VCloudException
Returns the list of file descriptor records.

Returns:
RecordResult<QueryResultFileDescriptorRecordType>
Throws:
VCloudException
Since:
API 5.1, SDK 5.1

getSchemaDefinition

public InputStream getSchemaDefinition(String schemaFileName)
                                throws VCloudException
Returns the specified schema definition file from the server..

Parameters:
schemaFileName -
Returns:
InputStream
Throws:
VCloudException
Since:
API 5.1, SDK 5.1

getVdcTemplateRefs

public Collection<com.vmware.vcloud.api.rest.schema.ReferenceType> getVdcTemplateRefs()
                                                                               throws VCloudException
Returns a Collection of VdcTemplate References

Returns:
Collection
Throws:
VCloudException
Since:
API 5.7, SDK 5.7


Copyright © 2016. All Rights Reserved.