public void login_with_password(string username, string password, string version, string originator) { try { if (JsonRpcClient != null) { opaque_ref = JsonRpcClient.session_login_with_password(username, password, version, originator); } else { opaque_ref = proxy.session_login_with_password(username, password, version, originator).parse(); } SetupSessionDetails(); } catch (Failure exn) { if (exn.ErrorDescription[0] == Failure.MESSAGE_PARAMETER_COUNT_MISMATCH) { // Call the pre-2.0 version instead. login_with_password(username, password, version); } else { throw; } } }
public void login_with_password(string username, string password, string version) { try { if (JsonRpcClient != null) { opaque_ref = JsonRpcClient.session_login_with_password(username, password, version); } else { opaque_ref = proxy.session_login_with_password(username, password, version).parse(); } SetAPIVersion(); if (XmlRpcToJsonRpcInvoker != null) { XmlRpcToJsonRpcInvoker(this); } SetADDetails(); SetRbacPermissions(); } catch (Failure exn) { if (exn.ErrorDescription[0] == Failure.MESSAGE_PARAMETER_COUNT_MISMATCH) { // Call the 1.1 version instead. login_with_password(username, password); } else { throw; } } }
/// <summary> /// Create a new Session instance, using the given instance and timeout. The connection details and Xen-API session handle will be /// copied from the given instance, but a new connection will be created. Use this if you want a duplicate connection to a host, /// for example when you need to cancel an operation that is blocking the primary connection. /// </summary> public Session(Session session, IXenConnection connection, int timeout) { if (session.JsonRpcClient != null) { JsonRpcClient = new JsonRpcClient(session.Url) { JsonRpcVersion = session.JsonRpcClient.JsonRpcVersion, Timeout = timeout, ConnectionGroupName = session.JsonRpcClient.ConnectionGroupName, KeepAlive = session.JsonRpcClient.KeepAlive, UserAgent = session.JsonRpcClient.UserAgent, WebProxy = session.JsonRpcClient.WebProxy, ProtocolVersion = session.JsonRpcClient.ProtocolVersion, Expect100Continue = session.JsonRpcClient.Expect100Continue, AllowAutoRedirect = session.JsonRpcClient.AllowAutoRedirect, PreAuthenticate = session.JsonRpcClient.PreAuthenticate, Cookies = session.JsonRpcClient.Cookies }; JsonRpcClient.RequestEvent += LogJsonRequest; } else { InitializeXmlRpcProxy(session.Url, timeout); proxy.RequestEvent += LogRequest; proxy.ResponseEvent += LogResponse; } Connection = connection; CopyADFromSession(session); }
/// <summary> /// Change the password on the given session2, using this session for the connection. /// </summary> /// <param name="session2">The session to change</param> /// <param name="oldPassword"></param> /// <param name="newPassword"></param> public void change_password(Session session2, string oldPassword, string newPassword) { if (JsonRpcClient != null) { JsonRpcClient.session_change_password(session2.opaque_ref, oldPassword, newPassword); } else { proxy.session_change_password(session2.opaque_ref, oldPassword, newPassword).parse(); } }
public void slave_local_login_with_password(string username, string password) { if (JsonRpcClient != null) { opaque_ref = JsonRpcClient.session_slave_local_login_with_password(username, password); } else { opaque_ref = proxy.session_slave_local_login_with_password(username, password).parse(); } //assume the latest API APIVersion = API_Version.LATEST; }
public void login_with_password(string username, string password) { if (JsonRpcClient != null) { opaque_ref = JsonRpcClient.session_login_with_password(username, password); } else { opaque_ref = proxy.session_login_with_password(username, password).parse(); } SetupSessionDetails(); }
public void local_logout(string opaqueRef) { if (opaqueRef == null) { return; } if (JsonRpcClient != null) { JsonRpcClient.session_local_logout(opaqueRef); } else { proxy.session_local_logout(opaqueRef).parse(); } }
/// <summary> /// Log out of the session with the given reference, using this session for the connection. /// </summary> /// <param name="_self">The session to log out</param> public void logout(string _self) { if (_self == null) { return; } if (JsonRpcClient != null) { JsonRpcClient.session_logout(_self); } else { proxy.session_logout(_self).parse(); } }
public void login_with_password(string username, string password) { if (JsonRpcClient != null) { opaque_ref = JsonRpcClient.session_login_with_password(username, password); } else { opaque_ref = proxy.session_login_with_password(username, password).parse(); } SetAPIVersion(); if (XmlRpcToJsonRpcInvoker != null) { XmlRpcToJsonRpcInvoker(this); } }
/// <summary> /// Create a new Session instance, using the given instance and timeout. The connection details and Xen-API session handle will be /// copied from the given instance, but a new connection will be created. Use this if you want a duplicate connection to a host, /// for example when you need to cancel an operation that is blocking the primary connection. /// </summary> public Session(Session session, IXenConnection connection, int timeout) { if (session.JsonRpcClient != null) { JsonRpcClient = new JsonRpcClient(session.Url) { JsonRpcVersion = session.JsonRpcClient.JsonRpcVersion }; JsonRpcClient.RequestEvent += LogJsonRequest; } else { proxy = CreateProxy(session.Url, timeout); proxy.RequestEvent += LogRequest; proxy.ResponseEvent += LogResponse; } Connection = connection; InitAD(session); }
/// <summary> /// Create a new Session instance, using the given instance and timeout. The connection details and Xen-API session handle will be /// copied from the given instance, but a new connection will be created. Use this if you want a duplicate connection to a host, /// for example when you need to cancel an operation that is blocking the primary connection. /// </summary> public Session(Session session, IXenConnection connection, int timeout) { if (session.JsonRpcClient != null) { JsonRpcClient = new JsonRpcClient(session.Url) { JsonRpcVersion = session.JsonRpcClient.JsonRpcVersion, Timeout = timeout }; JsonRpcClient.RequestEvent += LogJsonRequest; } else { InitializeXmlRpcProxy(session.Url, timeout); proxy.RequestEvent += LogRequest; proxy.ResponseEvent += LogResponse; } Connection = connection; CopyADFromSession(session); }
/// <summary> /// Create a new Session instance, using the given instance and timeout. The connection details and Xen-API session handle will be /// copied from the given instance, but a new connection will be created. Use this if you want a duplicate connection to a host, /// for example when you need to cancel an operation that is blocking the primary connection. /// </summary> /// <param name="session"></param> /// <param name="timeout"></param> public Session(Session session, int timeout) { opaque_ref = session.opaque_ref; APIVersion = session.APIVersion; //in the following do not copy over the ConnectionGroupName if (session.JsonRpcClient != null && (APIVersion == API_Version.API_2_6 || APIVersion >= API_Version.API_2_8)) { JsonRpcClient = new JsonRpcClient(session.Url) { JsonRpcVersion = session.JsonRpcClient.JsonRpcVersion, Timeout = timeout, KeepAlive = session.JsonRpcClient.KeepAlive, UserAgent = session.JsonRpcClient.UserAgent, WebProxy = session.JsonRpcClient.WebProxy, ProtocolVersion = session.JsonRpcClient.ProtocolVersion, Expect100Continue = session.JsonRpcClient.Expect100Continue, AllowAutoRedirect = session.JsonRpcClient.AllowAutoRedirect, PreAuthenticate = session.JsonRpcClient.PreAuthenticate, Cookies = session.JsonRpcClient.Cookies }; } else if (session.proxy != null) { proxy = XmlRpcProxyGen.Create <Proxy>(); proxy.Url = session.Url; proxy.Timeout = timeout; proxy.NonStandard = session.proxy.NonStandard; proxy.UseIndentation = session.proxy.UseIndentation; proxy.UserAgent = session.proxy.UserAgent; proxy.KeepAlive = session.proxy.KeepAlive; proxy.Proxy = session.proxy.Proxy; } CopyADFromSession(session); }