Package com.xensource.xenapi
Class Session
java.lang.Object
com.xensource.xenapi.XenAPIObject
com.xensource.xenapi.Session
A session
First published in XenServer 4.0.
- Author:
- Cloud Software Group, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents all the fields in a Session -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToOtherConfig
(Connection c, String key, String value) Add the given key-value pair to the other_config field of the given session.static void
changePassword
(Connection c, String oldPwd, String newPwd) 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 First published in XenServer 4.0.static Session
createFromDbFile
(Connection c, String filename) First published in XenServer 7.0.static Task
createFromDbFileAsync
(Connection c, String filename) First published in XenServer 7.0.boolean
If obj is a Session, compares XenAPI references for equality.Return a list of all the user subject-identifiers of all existing sessions First published in XenServer 5.5.static Task
Return a list of all the user subject-identifiers of all existing sessions First published in XenServer 5.5.Get the auth_user_name field of the given session.Get the auth_user_sid field of the given session.static Session
getByUuid
(Connection c, String uuid) Get a reference to the session instance with the specified UUID.Get the client_certificate field of the given session.Get the is_local_superuser field of the given session.Get the last_active field of the given session.Get the originator field of the given session.Get the other_config field of the given session.Get the parent field of the given session.Get the pool field of the given session.Get the rbac_permissions field of the given session.Get a record containing the current state of the given session.Get the subject field of the given session.Get the tasks field of the given session.Get the this_host field of the given session.Get the this_user field of the given session.Get the uuid field of the given session.Get the validation_time field of the given session.int
hashCode()
static void
Log out of local session.static Session
loginWithPassword
(Connection c, String uname, String pwd) Attempt to authenticate the user, returning a session reference if successful First published in XenServer 4.0.static Session
loginWithPassword
(Connection c, String uname, String pwd, String version) Attempt to authenticate the user, returning a session reference if successful First published in XenServer 4.0.static Session
loginWithPassword
(Connection c, String uname, String pwd, String version, String originator) Attempt to authenticate the user, returning a session reference if successful First published in XenServer 4.0.static void
logout
(Connection c) Log out of a session First published in XenServer 4.0.static void
logoutSubjectIdentifier
(Connection c, String subjectIdentifier) Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function First published in XenServer 5.5.static Task
logoutSubjectIdentifierAsync
(Connection c, String subjectIdentifier) Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function First published in XenServer 5.5.void
removeFromOtherConfig
(Connection c, String key) Remove the given key and its corresponding value from the other_config field of the given session.void
setOtherConfig
(Connection c, Map<String, String> otherConfig) Set the other_config field of the given session.static Session
slaveLocalLoginWithPassword
(Connection c, String uname, String pwd) Authenticate locally against a slave in emergency mode.Methods inherited from class com.xensource.xenapi.XenAPIObject
isNull
-
Field Details
-
ref
The XenAPI reference (OpaqueRef) to this object.
-
-
Method Details
-
toWireString
- Specified by:
toWireString
in classXenAPIObject
- Returns:
- The XenAPI reference (OpaqueRef) to this object.
-
equals
If obj is a Session, compares XenAPI references for equality. -
hashCode
public int hashCode() -
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. 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. First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onuuid
- 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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.XmlRpcExceptionSet the other_config field of the given session. First published in XenServer 4.1.- Parameters:
c
- The connection the call is made onotherConfig
- 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. First published in XenServer 4.1.- Parameters:
c
- The connection the call is made onkey
- Key to addvalue
- 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. First published in XenServer 4.1.- Parameters:
c
- The connection the call is made onkey
- 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 First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onuname
- 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 First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onuname
- 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 First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onuname
- 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 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 First published in XenServer 4.0.- Parameters:
c
- The connection the call is made onoldPwd
- Old password for accountnewPwd
- 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. First published in XenServer 4.1.- Parameters:
c
- The connection the call is made onuname
- 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 First published in XenServer 7.0.- Parameters:
c
- The connection the call is made onfilename
- 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 First published in XenServer 7.0.- Parameters:
c
- The connection the call is made onfilename
- 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. 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 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 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 First published in XenServer 5.5.- Parameters:
c
- The connection the call is made onsubjectIdentifier
- 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 First published in XenServer 5.5.- Parameters:
c
- The connection the call is made onsubjectIdentifier
- 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.
-