/// <summary> /// /// <param name="swytch" /> /// <param name="vrid" /> /// <param name="realIps" /> /// <param name="isHighSpec" /> /// </summary> public LoadBalancer SetInitialParams(Swytch swytch, long vrid, System.Collections.Generic.List <string> realIps, bool isHighSpec = false) { object annot = this.RawAnnotation; this.Vrid = vrid; Util.SetByPath(annot, "Switch.ID", swytch._Id()); if (swytch.Ipv4Nets != null && 0 < swytch.Ipv4Nets.Count) { Ipv4Net net = swytch.Ipv4Nets[System.Convert.ToInt32(0)]; this.DefaultRoute = ((string)(net.DefaultRoute)); this.MaskLen = System.Convert.ToInt64(net.MaskLen); } else { this.DefaultRoute = ((string)(swytch.UserDefaultRoute)); this.MaskLen = System.Convert.ToInt64(swytch.UserMaskLen); } System.Collections.Generic.List <object> servers = new System.Collections.Generic.List <object> { }; for (int __it1 = 0; __it1 < (realIps as System.Collections.IList).Count; __it1++) { var ip = realIps[__it1]; (servers as System.Collections.IList).Add(new System.Collections.Generic.Dictionary <string, object> { { "IPAddress", ip } }); } Util.SetByPath(annot, "Servers", servers); this.PlanId = isHighSpec ? 2 : 1; return(this); }
/// <summary>スイッチに接続します。 /// /// <param name="swytch">接続先のスイッチ。</param> /// <returns>this</returns> /// </summary> public Iface ConnectToSwytch(Swytch swytch) { this._Client.Request("PUT", this._ApiPath() + "/" + Util.UrlEncode(this._Id()) + "/to/switch/" + Util.UrlEncode(swytch._Id())); return(this.Reload()); }