Class Session


public class Session extends XenAPIObject
A session First published in XenServer 4.0.
Author:
Cloud Software Group, Inc.
  • Field Details

    • ref

      protected final String ref
      The XenAPI reference (OpaqueRef) to this object.
  • Method Details

    • toWireString

      public String toWireString()
      Specified by:
      toWireString in class XenAPIObject
      Returns:
      The XenAPI reference (OpaqueRef) to this object.
    • equals

      public boolean equals(Object obj)
      If obj is a Session, compares XenAPI references for equality.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getRecord

      public Session.Record getRecord(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get a record containing the current state of the given session. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      all fields from the object
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getByUuid

      public static Session getByUuid(Connection c, String uuid) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get a reference to the session instance with the specified UUID. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      uuid - UUID of object to return
      Returns:
      reference to the object
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getUuid

      public String getUuid(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the uuid field of the given session. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getThisHost

      public Host getThisHost(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the this_host field of the given session. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getThisUser

      public User getThisUser(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the this_user field of the given session. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getLastActive

      public Date getLastActive(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the last_active field of the given session. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getPool

      public Boolean getPool(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the pool field of the given session. Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getOtherConfig

      public Map<String,String> getOtherConfig(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the other_config field of the given session. Minimum allowed role: read-only First published in XenServer 4.1.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getIsLocalSuperuser

      public Boolean getIsLocalSuperuser(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the is_local_superuser field of the given session. Minimum allowed role: read-only First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getSubject

      public Subject getSubject(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the subject field of the given session. Minimum allowed role: read-only First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getValidationTime

      public Date getValidationTime(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the validation_time field of the given session. Minimum allowed role: read-only First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getAuthUserSid

      public String getAuthUserSid(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the auth_user_sid field of the given session. Minimum allowed role: read-only First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getAuthUserName

      public String getAuthUserName(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the auth_user_name field of the given session. Minimum allowed role: read-only First published in XenServer 5.6.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getRbacPermissions

      public Set<String> getRbacPermissions(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the rbac_permissions field of the given session. Minimum allowed role: read-only First published in XenServer 5.6.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getTasks

      public Set<Task> getTasks(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the tasks field of the given session. Minimum allowed role: read-only First published in XenServer 5.6.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getParent

      public Session getParent(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the parent field of the given session. Minimum allowed role: read-only First published in XenServer 5.6.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getOriginator

      public String getOriginator(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the originator field of the given session. Minimum allowed role: read-only First published in XenServer 6.2.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getClientCertificate

      public Boolean getClientCertificate(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Get the client_certificate field of the given session. Minimum allowed role: read-only First published in 21.2.0.
      Parameters:
      c - The connection the call is made on
      Returns:
      value of the field
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • setOtherConfig

      public void setOtherConfig(Connection c, Map<String,String> otherConfig) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Set the other_config field of the given session. Minimum allowed role: pool-admin First published in XenServer 4.1.
      Parameters:
      c - The connection the call is made on
      otherConfig - New value to set
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • addToOtherConfig

      public void addToOtherConfig(Connection c, String key, String value) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Add the given key-value pair to the other_config field of the given session. Minimum allowed role: pool-admin First published in XenServer 4.1.
      Parameters:
      c - The connection the call is made on
      key - Key to add
      value - Value to add
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • removeFromOtherConfig

      public void removeFromOtherConfig(Connection c, String key) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Remove the given key and its corresponding value from the other_config field of the given session. If the key is not in that Map, then do nothing. Minimum allowed role: pool-admin First published in XenServer 4.1.
      Parameters:
      c - The connection the call is made on
      key - Key to remove
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • loginWithPassword

      public static Session loginWithPassword(Connection c, String uname, String pwd) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException, Types.SessionAuthenticationFailed, Types.HostIsSlave
      Attempt to authenticate the user, returning a session reference if successful Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      uname - Username for login.
      pwd - Password for login.
      Returns:
      reference of newly created session
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
      Types.SessionAuthenticationFailed - The credentials given by the user are incorrect, so access has been denied, and you have not been issued a session handle.
      Types.HostIsSlave - You cannot make regular API calls directly on a supporter. Please pass API calls via the coordinator host.
    • loginWithPassword

      public static Session loginWithPassword(Connection c, String uname, String pwd, String version) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException, Types.SessionAuthenticationFailed, Types.HostIsSlave
      Attempt to authenticate the user, returning a session reference if successful Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      uname - Username for login.
      pwd - Password for login.
      version - Client API version. First published in XenServer 4.1.
      Returns:
      reference of newly created session
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
      Types.SessionAuthenticationFailed - The credentials given by the user are incorrect, so access has been denied, and you have not been issued a session handle.
      Types.HostIsSlave - You cannot make regular API calls directly on a supporter. Please pass API calls via the coordinator host.
    • loginWithPassword

      public static Session loginWithPassword(Connection c, String uname, String pwd, String version, String originator) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException, Types.SessionAuthenticationFailed, Types.HostIsSlave
      Attempt to authenticate the user, returning a session reference if successful Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      uname - Username for login.
      pwd - Password for login.
      version - Client API version. First published in XenServer 4.1.
      originator - Key string for distinguishing different API users sharing the same login name. First published in XenServer 6.2.
      Returns:
      reference of newly created session
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
      Types.SessionAuthenticationFailed - The credentials given by the user are incorrect, so access has been denied, and you have not been issued a session handle.
      Types.HostIsSlave - You cannot make regular API calls directly on a supporter. Please pass API calls via the coordinator host.
    • logout

      public static void logout(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Log out of a session Minimum allowed role: read-only First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • changePassword

      public static void changePassword(Connection c, String oldPwd, String newPwd) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Change the account password; if your session is authenticated with root priviledges then the old_pwd is validated and the new_pwd is set regardless Minimum allowed role: Not Applicable First published in XenServer 4.0.
      Parameters:
      c - The connection the call is made on
      oldPwd - Old password for account
      newPwd - New password for account
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • slaveLocalLoginWithPassword

      public static Session slaveLocalLoginWithPassword(Connection c, String uname, String pwd) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Authenticate locally against a slave in emergency mode. Note the resulting sessions are only good for use on this host. Minimum allowed role: pool-admin First published in XenServer 4.1.
      Parameters:
      c - The connection the call is made on
      uname - Username for login.
      pwd - Password for login.
      Returns:
      ID of newly created session
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • createFromDbFileAsync

      public static Task createFromDbFileAsync(Connection c, String filename) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Minimum allowed role: Not Applicable First published in XenServer 7.0.
      Parameters:
      c - The connection the call is made on
      filename - Database dump filename.
      Returns:
      Task
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • createFromDbFile

      public static Session createFromDbFile(Connection c, String filename) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Minimum allowed role: Not Applicable First published in XenServer 7.0.
      Parameters:
      c - The connection the call is made on
      filename - Database dump filename.
      Returns:
      ID of newly created session
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • localLogout

      public static void localLogout(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Log out of local session. Minimum allowed role: pool-admin First published in XenServer 4.1.
      Parameters:
      c - The connection the call is made on
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getAllSubjectIdentifiersAsync

      public static Task getAllSubjectIdentifiersAsync(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Return a list of all the user subject-identifiers of all existing sessions Minimum allowed role: read-only First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      Returns:
      Task
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • getAllSubjectIdentifiers

      public static Set<String> getAllSubjectIdentifiers(Connection c) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Return a list of all the user subject-identifiers of all existing sessions Minimum allowed role: read-only First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      Returns:
      The list of user subject-identifiers of all existing sessions
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • logoutSubjectIdentifierAsync

      public static Task logoutSubjectIdentifierAsync(Connection c, String subjectIdentifier) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function Minimum allowed role: pool-operator First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      subjectIdentifier - User subject-identifier of the sessions to be destroyed
      Returns:
      Task
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.
    • logoutSubjectIdentifier

      public static void logoutSubjectIdentifier(Connection c, String subjectIdentifier) throws Types.BadServerResponse, Types.XenAPIException, org.apache.xmlrpc.XmlRpcException
      Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function Minimum allowed role: pool-operator First published in XenServer 5.5.
      Parameters:
      c - The connection the call is made on
      subjectIdentifier - User subject-identifier of the sessions to be destroyed
      Throws:
      Types.BadServerResponse - Thrown if the response from the server contains an invalid status.
      Types.XenAPIException - Thrown if the call failed.
      org.apache.xmlrpc.XmlRpcException - Thrown if the result of an asynchronous call could not be parsed.