Пример #1
0
 /// <summary>指定したプランのサーバに絞り込みます。
 ///
 /// <param name="plan" />
 /// </summary>
 public Model_Server WithPlan(ServerPlan plan)
 {
     this._FilterBy("ServerPlan.ID", new System.Collections.Generic.List <object> {
         plan._Id()
     });
     return(this);
 }
Пример #2
0
        /// <summary>サーバプランを変更します。
        ///
        /// 成功時はリソースIDが変わることにご注意ください。
        ///
        /// <param name="planTo" />
        /// <returns>this</returns>
        /// </summary>
        public Server ChangePlan(ServerPlan planTo)
        {
            string path   = this._ApiPath() + "/" + Util.UrlEncode(this._Id()) + "/to/plan/" + Util.UrlEncode(planTo._Id());
            object result = this._Client.Request("PUT", path);

            this.ApiDeserialize(result, true);
            return(this);
        }
Пример #3
0
 private ServerPlan Set_plan(ServerPlan v)
 {
     if (!this.IsNew)
     {
         throw new SaklientException("immutable_field", "Immutable fields cannot be modified after the resource creation: " + "saklient.cloud.resources.Server#Set_plan");
     }
     this.M_plan = v;
     this.N_plan = true;
     return(this.M_plan);
 }
Пример #4
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;
 }