Beispiel #1
0
        /// <summary>サーバが指定のステータスに遷移するまで待機します。
        ///
        ///
        /// <param name="status" />
        /// <param name="timeoutSec" />
        /// </summary>
        private bool SleepUntil(string status, long timeoutSec = 180)
        {
            long step = 10;

            while (0 < timeoutSec)
            {
                try {
                    this.Reload();
                }
                catch (HttpException ex) {
                }
                string         s    = null;
                ServerInstance inst = this.Instance;
                if (inst != null)
                {
                    s = inst.Status;
                }
                if (s == null)
                {
                    s = EServerInstanceStatus.DOWN;
                }
                if (s == status)
                {
                    return(true);
                }
                timeoutSec -= step;
                if (0 < timeoutSec)
                {
                    Util.Sleep(step);
                }
            }
            return(false);
        }
Beispiel #2
0
 /// <summary>(This method is generated in Translator_default#buildImpl)
 ///
 /// <param name="r" />
 /// </summary>
 internal override void ApiDeserializeImpl(object r)
 {
     this.IsNew = r == null;
     if (this.IsNew)
     {
         r = new System.Collections.Generic.Dictionary <string, object> {
         };
     }
     this.IsIncomplete = false;
     if (Util.ExistsPath(r, "ID"))
     {
         this.M_id = Util.GetByPath(r, "ID") == null ? ((string)(null)) : "" + Util.GetByPath(r, "ID");
     }
     else
     {
         this.M_id         = null;
         this.IsIncomplete = true;
     }
     this.N_id = false;
     if (Util.ExistsPath(r, "Name"))
     {
         this.M_name = Util.GetByPath(r, "Name") == null ? ((string)(null)) : "" + Util.GetByPath(r, "Name");
     }
     else
     {
         this.M_name       = null;
         this.IsIncomplete = true;
     }
     this.N_name = false;
     if (Util.ExistsPath(r, "Description"))
     {
         this.M_description = Util.GetByPath(r, "Description") == null ? ((string)(null)) : "" + Util.GetByPath(r, "Description");
     }
     else
     {
         this.M_description = null;
         this.IsIncomplete  = true;
     }
     this.N_description = false;
     if (Util.ExistsPath(r, "Tags"))
     {
         if (Util.GetByPath(r, "Tags") == null)
         {
             this.M_tags = new System.Collections.Generic.List <string> {
             };
         }
         else
         {
             this.M_tags = new System.Collections.Generic.List <string> {
             };
             for (int __it1 = 0; __it1 < (((System.Collections.Generic.List <object>)(Util.GetByPath(r, "Tags"))) as System.Collections.IList).Count; __it1++)
             {
                 var    t  = ((System.Collections.Generic.List <object>)(Util.GetByPath(r, "Tags")))[__it1];
                 string v1 = null;
                 v1 = t == null ? ((string)(null)) : "" + t;
                 (this.M_tags as System.Collections.IList).Add(v1);
             }
         }
     }
     else
     {
         this.M_tags       = null;
         this.IsIncomplete = true;
     }
     this.N_tags = false;
     if (Util.ExistsPath(r, "Icon"))
     {
         this.M_icon = Util.GetByPath(r, "Icon") == null ? null : new Icon(this._Client, Util.GetByPath(r, "Icon"));
     }
     else
     {
         this.M_icon       = null;
         this.IsIncomplete = true;
     }
     this.N_icon = false;
     if (Util.ExistsPath(r, "ServerPlan"))
     {
         this.M_plan = Util.GetByPath(r, "ServerPlan") == null ? null : new ServerPlan(this._Client, Util.GetByPath(r, "ServerPlan"));
     }
     else
     {
         this.M_plan       = null;
         this.IsIncomplete = true;
     }
     this.N_plan = false;
     if (Util.ExistsPath(r, "Interfaces"))
     {
         if (Util.GetByPath(r, "Interfaces") == null)
         {
             this.M_ifaces = new System.Collections.Generic.List <Iface> {
             };
         }
         else
         {
             this.M_ifaces = new System.Collections.Generic.List <Iface> {
             };
             for (int __it2 = 0; __it2 < (((System.Collections.Generic.List <object>)(Util.GetByPath(r, "Interfaces"))) as System.Collections.IList).Count; __it2++)
             {
                 var   t  = ((System.Collections.Generic.List <object>)(Util.GetByPath(r, "Interfaces")))[__it2];
                 Iface v2 = null;
                 v2 = t == null ? null : new Iface(this._Client, t);
                 (this.M_ifaces as System.Collections.IList).Add(v2);
             }
         }
     }
     else
     {
         this.M_ifaces     = null;
         this.IsIncomplete = true;
     }
     this.N_ifaces = false;
     if (Util.ExistsPath(r, "Instance"))
     {
         this.M_instance = Util.GetByPath(r, "Instance") == null ? null : new ServerInstance(this._Client, Util.GetByPath(r, "Instance"));
     }
     else
     {
         this.M_instance   = null;
         this.IsIncomplete = true;
     }
     this.N_instance = false;
     if (Util.ExistsPath(r, "Availability"))
     {
         this.M_availability = Util.GetByPath(r, "Availability") == null ? ((string)(null)) : "" + Util.GetByPath(r, "Availability");
     }
     else
     {
         this.M_availability = null;
         this.IsIncomplete   = true;
     }
     this.N_availability = false;
 }