public static string APIVersionString(API_Version v) { switch (v) { case API_Version.API_1_1: return("1.1"); case API_Version.API_1_2: return("1.2"); case API_Version.API_1_3: return("1.3"); case API_Version.API_1_4: return("1.4"); case API_Version.API_1_5: return("1.5"); case API_Version.API_1_6: return("1.6"); case API_Version.API_1_7: return("1.7"); case API_Version.API_1_8: return("1.8"); case API_Version.API_1_9: return("1.9"); case API_Version.API_1_10: return("1.10"); case API_Version.API_2_0: return("2.0"); case API_Version.API_2_1: return("2.1"); case API_Version.API_2_2: return("2.2"); case API_Version.API_2_3: return("2.3"); case API_Version.API_2_4: return("2.4"); case API_Version.API_2_5: return("2.5"); case API_Version.API_2_6: //return "2.6"; return(getAPIVersion()); default: return("Unknown"); } }
public Session(Session session, int timeout) : this(timeout, session.Url) { this._uuid = session.uuid; this.APIVersion = session.APIVersion; this._isLocalSuperuser = session._isLocalSuperuser; this._subject = session._subject; this._userSid = session._userSid; }
private void SetAPIVersion() { foreach (Pool pool in Pool.get_all_records(this).Values) { Host host = Host.get_record(this, (string)pool.master); this.APIVersion = Helper.GetAPIVersion(host.API_version_major, host.API_version_minor); break; } }
/// <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) : this(session.Url, timeout) { opaque_ref = session.opaque_ref; APIVersion = session.APIVersion; _isLocalSuperuser = session.IsLocalSuperuser; _subject = session._subject; _userSid = session._userSid; }
public static string APIVersionString(API_Version v) { switch (v) { case API_Version.API_1_1: return("1.1"); case API_Version.API_1_2: return("1.2"); case API_Version.API_1_3: return("1.3"); case API_Version.API_1_4: return("1.4"); case API_Version.API_1_5: return("1.5"); case API_Version.API_1_6: return("1.6"); case API_Version.API_1_7: return("1.7"); case API_Version.API_1_8: return("1.8"); case API_Version.API_1_9: return("1.9"); case API_Version.API_1_10: return("1.10"); case API_Version.API_2_0: return("2.0"); case API_Version.API_2_1: return("2.1"); case API_Version.API_2_2: return("2.2"); case API_Version.API_2_3: return("2.3"); case API_Version.API_2_4: return("2.4"); case API_Version.API_2_5: //return "2.5"; return("WS-2.0"); //兼容WinServer } return("Unknown"); }
private void SetAPIVersion() { Dictionary <XenRef <Pool>, Pool> pools = Pool.get_all_records(this); foreach (Pool pool in pools.Values) { Host host = Host.get_record(this, pool.master); APIVersion = Helper.GetAPIVersion(host.API_version_major, host.API_version_minor); break; } }
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 Session(int timeout, string url) { this.APIVersion = API_Version.API_1_1; this._isLocalSuperuser = true; this.roles = new List <Role>(); this._proxy = XmlRpcProxyGen.Create <WinAPI.Proxy>(); this._proxy.Url = url; this._proxy.NonStandard = XmlRpcNonStandard.All; this._proxy.Timeout = timeout; this._proxy.UseIndentation = false; this._proxy.UserAgent = UserAgent; this._proxy.KeepAlive = true; this._proxy.Proxy = Proxy; }
/// <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) : this(timeout, session.Url) { opaque_ref = session.opaque_ref; APIVersion = session.APIVersion; if (XmlRpcToJsonRpcInvoker != null) { XmlRpcToJsonRpcInvoker(this); } _isLocalSuperuser = session.IsLocalSuperuser; _subject = session._subject; _userSid = session._userSid; roles = session.Roles; permissions = session.Permissions; }
public static string APIVersionString(API_Version v) { switch (v) { case API_Version.API_1_1: return("1.1"); case API_Version.API_1_2: return("1.2"); case API_Version.API_1_3: return("1.3"); case API_Version.API_1_4: return("1.4"); case API_Version.API_1_5: return("1.5"); case API_Version.API_1_6: return("1.6"); case API_Version.API_1_7: return("1.7"); case API_Version.API_1_8: return("1.8"); case API_Version.API_1_9: return("1.9"); case API_Version.API_1_10: return("1.10"); case API_Version.API_2_0: return("2.0"); } return("Unknown"); }
/// <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); }
/// <summary> /// Return true if the given session's API version is greater than or equal to the given /// API_version. /// </summary> internal static bool APIVersionMeets(Session session, API_Version v) { return(APIVersionCompare(session, v) >= 0); }
/// <summary> /// Return a positive number if the given session's API version is greater than the given /// API_version, negative if it is less, and 0 if they are equal. /// </summary> internal static int APIVersionCompare(Session session, API_Version v) { return((int)session.APIVersion - (int)v); }
public void login_with_password(string username, string password, API_Version version) { login_with_password(username, password, Helper.APIVersionString(version)); }
public static string APIVersionString(API_Version v) { switch (v) { case API_Version.API_1_1: return("1.1"); case API_Version.API_1_2: return("1.2"); case API_Version.API_1_3: return("1.3"); case API_Version.API_1_4: return("1.4"); case API_Version.API_1_5: return("1.5"); case API_Version.API_1_6: return("1.6"); case API_Version.API_1_7: return("1.7"); case API_Version.API_1_8: return("1.8"); case API_Version.API_1_9: return("1.9"); case API_Version.API_1_10: return("1.10"); case API_Version.API_2_0: return("2.0"); case API_Version.API_2_1: return("2.1"); case API_Version.API_2_2: return("2.2"); case API_Version.API_2_3: return("2.3"); case API_Version.API_2_4: return("2.4"); case API_Version.API_2_5: return("2.5"); case API_Version.API_2_6: return("2.6"); case API_Version.API_2_7: return("2.7"); case API_Version.API_2_8: return("2.8"); case API_Version.API_2_9: return("2.9"); case API_Version.API_2_10: return("2.10"); case API_Version.API_2_11: return("2.11"); case API_Version.API_2_12: return("2.12"); case API_Version.API_2_13: return("2.13"); case API_Version.API_2_14: return("2.14"); case API_Version.API_2_15: return("2.15"); case API_Version.API_2_16: return("2.16"); default: return("Unknown"); } }
public void slave_local_login_with_password(string username, string password) { _uuid = proxy.session_slave_local_login_with_password(username, password).parse(); //assume the latest API APIVersion = API_Version.LATEST; }
public void slave_local_login_with_password(string username, string password) { this._uuid = this.proxy.session_slave_local_login_with_password(username, password).parse(); this.APIVersion = API_Version.API_2_0; }