internal override object ApiSerializeImpl(bool withClean = false) { object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_status) { Util.SetByPath(ret, "Status", this.M_status); } if (withClean || this.N_beforeStatus) { Util.SetByPath(ret, "BeforeStatus", this.M_beforeStatus); } if (withClean || this.N_statusChangedAt) { Util.SetByPath(ret, "StatusChangedAt", this.M_statusChangedAt == null ? ((string)(null)) : Util.Date2str(this.M_statusChangedAt)); } if (withClean || this.N_isoImage) { Util.SetByPath(ret, "CDROM", withClean ? (this.M_isoImage == null ? ((IsoImage)(null)) : this.M_isoImage.ApiSerialize(withClean)) : (this.M_isoImage == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : this.M_isoImage.ApiSerializeID())); } return(ret); }
private void _Normalize() { if (this._Servers == null) { this._Servers = new System.Collections.Generic.List <GslbServer> { }; } if (this.RawSettings == null) { this.RawSettings = new System.Collections.Generic.Dictionary <string, object> { }; } if (!Util.ExistsPath(this.RawSettings, "GSLB")) { Util.SetByPath(this.RawSettings, "GSLB", new System.Collections.Generic.Dictionary <string, object> { }); } if (!Util.ExistsPath(this.RawSettings, "GSLB.HealthCheck")) { Util.SetByPath(this.RawSettings, "GSLB.HealthCheck", new System.Collections.Generic.Dictionary <string, object> { }); } if (!Util.ExistsPath(this.RawSettings, "GSLB.Servers")) { Util.SetByPath(this.RawSettings, "GSLB.Servers", new System.Collections.Generic.List <object> { }); } }
internal override object ApiSerializeImpl(bool withClean = false) { System.Collections.Generic.List <string> missing = new System.Collections.Generic.List <string> { }; object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_name) { Util.SetByPath(ret, "Name", this.M_name); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("name"); } } if (withClean || this.N_description) { Util.SetByPath(ret, "Description", this.M_description); } if (missing.Count > 0) { throw new SaklientException("required_field", "Required fields must be set before the Region creation: " + string.Join(", ", (missing).ToArray())); } return(ret); }
internal override object ApiSerializeImpl(bool withClean = false) { object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_name) { Util.SetByPath(ret, "Name", this.M_name); } if (withClean || this.N_cpu) { Util.SetByPath(ret, "CPU", this.M_cpu); } if (withClean || this.N_memoryMib) { Util.SetByPath(ret, "MemoryMB", this.M_memoryMib); } if (withClean || this.N_serviceClass) { Util.SetByPath(ret, "ServiceClass", this.M_serviceClass); } return(ret); }
/// <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); }
internal override object ApiSerializeImpl(bool withClean = false) { object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_address) { Util.SetByPath(ret, "NetworkAddress", this.M_address); } if (withClean || this.N_maskLen) { Util.SetByPath(ret, "NetworkMaskLen", this.M_maskLen); } if (withClean || this.N_defaultRoute) { Util.SetByPath(ret, "DefaultRoute", this.M_defaultRoute); } if (withClean || this.N_nextHop) { Util.SetByPath(ret, "NextHop", this.M_nextHop); } return(ret); }
internal override void _OnAfterApiSerialize(object r, bool withClean) { if (r == null) { return; } Util.SetByPath(r, "Provider", new System.Collections.Generic.Dictionary <string, object> { }); Util.SetByPath(r, "Provider.Class", "gslb"); }
/// <summary>FTPSを開始し、イメージファイルをアップロード・ダウンロードできる状態にします。 /// /// アカウント情報は、ftpInfo プロパティから取得することができます。 /// /// <param name="reset">既にFTPSが開始されているとき、trueを指定してこのメソッドを呼ぶことでパスワードを再設定します。</param> /// <returns>this</returns> /// </summary> public Archive OpenFtp(bool reset = false) { string path = this._ApiPath() + "/" + Util.UrlEncode(this._Id()) + "/ftp"; object q = new System.Collections.Generic.Dictionary <string, object> { }; Util.SetByPath(q, "ChangePassword", reset); object result = this._Client.Request("PUT", path, q); this._OnAfterApiDeserialize(null, result); return(this); }
/// <summary>このルータ+スイッチにスタティックルートを追加します。 /// /// <param name="maskLen" /> /// <param name="nextHop" /> /// <returns>追加されたスタティックルート</returns> /// </summary> public Ipv4Net AddStaticRoute(long maskLen, string nextHop) { object q = new System.Collections.Generic.Dictionary <string, object> { }; Util.SetByPath(q, "NetworkMaskLen", maskLen); Util.SetByPath(q, "NextHop", nextHop); object result = this._Client.Request("POST", this._ApiPath() + "/" + Util.UrlEncode(this._Id()) + "/subnet", q); this.Reload(); return(new Ipv4Net(this._Client, (result as System.Collections.Generic.Dictionary <string, object>)["Subnet"])); }
internal override void _OnBeforeApiSerialize(bool withClean) { this._Normalize(); System.Collections.Generic.List <object> servers = new System.Collections.Generic.List <object> { }; for (int __it1 = 0; __it1 < (this._Servers as System.Collections.IList).Count; __it1++) { var server = this._Servers[__it1]; (servers as System.Collections.IList).Add(server.ToRawSettings()); } Util.SetByPath(this.RawSettings, "GSLB.Servers", servers); }
/// <summary>このルータ+スイッチの帯域プランを変更します。 /// /// 成功時はリソースIDが変わることにご注意ください。 /// /// <param name="bandWidthMbps" /> /// <returns>this</returns> /// </summary> public Router ChangePlan(long bandWidthMbps) { string path = this._ApiPath() + "/" + Util.UrlEncode(this._Id()) + "/bandwidth"; object q = new System.Collections.Generic.Dictionary <string, object> { }; Util.SetByPath(q, "Internet.BandWidthMbps", bandWidthMbps); object result = this._Client.Request("PUT", path, q); this.ApiDeserialize(result, true); return(this); }
internal object _UsedIpv4AddressHash() { object filter = new System.Collections.Generic.Dictionary <string, object> { }; (filter as System.Collections.Generic.Dictionary <string, object>)["Switch" + ".ID"] = this._Id(); object query = new System.Collections.Generic.Dictionary <string, object> { }; Util.SetByPath(query, "Count", 0); Util.SetByPath(query, "Filter", filter); Util.SetByPath(query, "Include", new System.Collections.Generic.List <string> { "IPAddress", "UserIPAddress" }); object result = this._Client.Request("GET", "/interface", query); if (result == null) { return(null); } result = (result as System.Collections.Generic.Dictionary <string, object>)["Interfaces"]; if (result == null) { return(null); } System.Collections.Generic.List <object> ifaces = ((System.Collections.Generic.List <object>)(result)); if (ifaces == null) { return(null); } object found = new System.Collections.Generic.Dictionary <string, object> { }; for (int __it1 = 0; __it1 < (ifaces as System.Collections.IList).Count; __it1++) { var iface = ifaces[__it1]; string ip = ((string)((iface as System.Collections.Generic.Dictionary <string, object>)["IPAddress"])); string userIp = ((string)((iface as System.Collections.Generic.Dictionary <string, object>)["UserIPAddress"])); if (ip == null) { ip = userIp; } if (ip != null) { (found as System.Collections.Generic.Dictionary <string, object>)[ip] = true; } } return(found); }
/// <summary>このリソースが存在するかを調べます。 /// </summary> public bool Exists() { object query = new System.Collections.Generic.Dictionary <string, object> { }; Util.SetByPath(query, "Filter.ID", new System.Collections.Generic.List <object> { this._Id() }); Util.SetByPath(query, "Include", new System.Collections.Generic.List <string> { "ID" }); object result = this.RequestRetry("GET", this._ApiPath(), query); object cnt = (result as System.Collections.Generic.Dictionary <string, object>)["Count"]; return(System.Convert.ToInt64(cnt) == 1); }
/// <summary>修正内容を実際のディスクに書き込みます。 /// /// <returns>this</returns> /// </summary> public DiskConfig Write() { object q = new System.Collections.Generic.Dictionary <string, object> { }; if (this._HostName != null) { Util.SetByPath(q, "HostName", this._HostName); } if (this._Password != null) { Util.SetByPath(q, "Password", this._Password); } if (this._SshKeys.Count > 0) { Util.SetByPath(q, "SSHKey.PublicKey", string.Join("\n", (this._SshKeys).ToArray())); } if (this._IpAddress != null) { Util.SetByPath(q, "UserIPAddress", this._IpAddress); } if (this._DefaultRoute != null) { Util.SetByPath(q, "UserSubnet.DefaultRoute", this._DefaultRoute); } if (this._NetworkMaskLen != null) { Util.SetByPath(q, "UserSubnet.NetworkMaskLen", this._NetworkMaskLen); } if (0 < this._Scripts.Count) { System.Collections.Generic.List <object> notes = new System.Collections.Generic.List <object> { }; for (int __it1 = 0; __it1 < (this._Scripts as System.Collections.IList).Count; __it1++) { var script = this._Scripts[__it1]; (notes as System.Collections.IList).Add(new System.Collections.Generic.Dictionary <string, object> { { "ID", script._Id() } }); } Util.SetByPath(q, "Notes", notes); } string path = "/disk/" + this._DiskId + "/config"; this._Client.Request("PUT", path, q); return(this); }
internal override object ApiSerializeImpl(bool withClean = false) { System.Collections.Generic.List <string> missing = new System.Collections.Generic.List <string> { }; object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_macAddress) { Util.SetByPath(ret, "MACAddress", this.M_macAddress); } if (withClean || this.N_ipAddress) { Util.SetByPath(ret, "IPAddress", this.M_ipAddress); } if (withClean || this.N_userIpAddress) { Util.SetByPath(ret, "UserIPAddress", this.M_userIpAddress); } if (withClean || this.N_serverId) { Util.SetByPath(ret, "Server.ID", this.M_serverId); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("serverId"); } } if (withClean || this.N_swytchId) { Util.SetByPath(ret, "Switch.ID", this.M_swytchId); } if (missing.Count > 0) { throw new SaklientException("required_field", "Required fields must be set before the Iface creation: " + string.Join(", ", (missing).ToArray())); } return(ret); }
internal override object ApiSerializeImpl(bool withClean = false) { object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_clazz) { Util.SetByPath(ret, "Class", this.M_clazz); } if (withClean || this.N_name) { Util.SetByPath(ret, "Name", this.M_name); } return(ret); }
internal override object ApiSerializeImpl(bool withClean = false) { System.Collections.Generic.List <string> missing = new System.Collections.Generic.List <string> { }; object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_name) { Util.SetByPath(ret, "Name", this.M_name); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("name"); } } if (withClean || this.N_info) { Util.SetByPath(ret, "LicenseInfo", withClean ? (this.M_info == null ? ((LicenseInfo)(null)) : this.M_info.ApiSerialize(withClean)) : (this.M_info == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : this.M_info.ApiSerializeID())); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("info"); } } if (missing.Count > 0) { throw new SaklientException("required_field", "Required fields must be set before the License creation: " + string.Join(", ", (missing).ToArray())); } return(ret); }
internal override object ApiSerializeImpl(bool withClean = false) { object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_prefix) { Util.SetByPath(ret, "IPv6Prefix", this.M_prefix); } if (withClean || this.N_prefixLen) { Util.SetByPath(ret, "IPv6PrefixLen", this.M_prefixLen); } if (withClean || this.N_prefixTail) { Util.SetByPath(ret, "IPv6PrefixTail", this.M_prefixTail); } return(ret); }
public string Set_pathToCheck(string v) { this._Normalize(); Util.SetByPath(this.RawSettings, "GSLB.HealthCheck.Path", v); return(v); }
public long Set_vrid(long v) { Util.SetByPath(this.RawAnnotation, "VRRP.VRID", v); return(v); }
public long Set_maskLen(long v) { Util.SetByPath(this.RawAnnotation, "Network.NetworkMaskLen", v); return(v); }
public string Set_defaultRoute(string v) { Util.SetByPath(this.RawAnnotation, "Network.DefaultRoute", v); return(v); }
internal override void _OnBeforeSave(object query) { Util.SetByPath(query, "OriginalSettingsHash", this.Get_rawSettingsHash()); }
internal override object ApiSerializeImpl(bool withClean = false) { System.Collections.Generic.List <string> missing = new System.Collections.Generic.List <string> { }; object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_clazz) { Util.SetByPath(ret, "Class", this.M_clazz); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("clazz"); } } if (withClean || this.N_name) { Util.SetByPath(ret, "Name", this.M_name); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("name"); } } if (withClean || this.N_description) { Util.SetByPath(ret, "Description", this.M_description); } if (withClean || this.N_tags) { Util.SetByPath(ret, "Tags", new System.Collections.Generic.List <object> { }); for (int __it1 = 0; __it1 < (this.M_tags as System.Collections.IList).Count; __it1++) { var r1 = this.M_tags[__it1]; object v = null; v = r1; ((ret as System.Collections.Generic.Dictionary <string, object>)["Tags"] as System.Collections.IList).Add(v); } } if (withClean || this.N_icon) { Util.SetByPath(ret, "Icon", withClean ? (this.M_icon == null ? ((Icon)(null)) : this.M_icon.ApiSerialize(withClean)) : (this.M_icon == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : this.M_icon.ApiSerializeID())); } if (withClean || this.N_planId) { Util.SetByPath(ret, "Plan.ID", this.M_planId); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("planId"); } } if (withClean || this.N_ifaces) { Util.SetByPath(ret, "Interfaces", new System.Collections.Generic.List <object> { }); for (int __it2 = 0; __it2 < (this.M_ifaces as System.Collections.IList).Count; __it2++) { var r2 = this.M_ifaces[__it2]; object v = null; v = withClean ? (r2 == null ? ((Iface)(null)) : r2.ApiSerialize(withClean)) : (r2 == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : r2.ApiSerializeID()); ((ret as System.Collections.Generic.Dictionary <string, object>)["Interfaces"] as System.Collections.IList).Add(v); } } if (withClean || this.N_rawAnnotation) { Util.SetByPath(ret, "Remark", this.M_rawAnnotation); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("rawAnnotation"); } } if (withClean || this.N_rawSettings) { Util.SetByPath(ret, "Settings", this.M_rawSettings); } if (withClean || this.N_rawSettingsHash) { Util.SetByPath(ret, "SettingsHash", this.M_rawSettingsHash); } if (withClean || this.N_status) { Util.SetByPath(ret, "Instance.Status", this.M_status); } if (withClean || this.N_serviceClass) { Util.SetByPath(ret, "ServiceClass", this.M_serviceClass); } if (withClean || this.N_availability) { Util.SetByPath(ret, "Availability", this.M_availability); } if (withClean || this.N_swytchId) { Util.SetByPath(ret, "Switch.ID", this.M_swytchId); } if (missing.Count > 0) { throw new SaklientException("required_field", "Required fields must be set before the Appliance creation: " + string.Join(", ", (missing).ToArray())); } return(ret); }
public long Set_delayLoop(long v) { this._Normalize(); Util.SetByPath(this.RawSettings, "GSLB.DelayLoop", v); return(v); }
internal override object ApiSerializeImpl(bool withClean = false) { System.Collections.Generic.List <string> missing = new System.Collections.Generic.List <string> { }; object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_name) { Util.SetByPath(ret, "Name", this.M_name); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("name"); } } if (withClean || this.N_description) { Util.SetByPath(ret, "Description", this.M_description); } if (withClean || this.N_tags) { Util.SetByPath(ret, "Tags", new System.Collections.Generic.List <object> { }); for (int __it1 = 0; __it1 < (this.M_tags as System.Collections.IList).Count; __it1++) { var r1 = this.M_tags[__it1]; object v = null; v = r1; ((ret as System.Collections.Generic.Dictionary <string, object>)["Tags"] as System.Collections.IList).Add(v); } } if (withClean || this.N_icon) { Util.SetByPath(ret, "Icon", withClean ? (this.M_icon == null ? ((Icon)(null)) : this.M_icon.ApiSerialize(withClean)) : (this.M_icon == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : this.M_icon.ApiSerializeID())); } if (withClean || this.N_provider) { Util.SetByPath(ret, "CommonServiceProvider", withClean ? (this.M_provider == null ? ((CommonServiceProvider)(null)) : this.M_provider.ApiSerialize(withClean)) : (this.M_provider == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : this.M_provider.ApiSerializeID())); } if (withClean || this.N_rawSettings) { Util.SetByPath(ret, "Settings", this.M_rawSettings); } if (withClean || this.N_rawStatus) { Util.SetByPath(ret, "Status", this.M_rawStatus); } if (missing.Count > 0) { throw new SaklientException("required_field", "Required fields must be set before the CommonServiceItem creation: " + string.Join(", ", (missing).ToArray())); } return(ret); }
public bool Set_weighted(bool v) { this._Normalize(); Util.SetByPath(this.RawSettings, "GSLB.Weighted", v ? "True" : "False"); return(v); }
public string Set_protocol(string v) { this._Normalize(); Util.SetByPath(this.RawSettings, "GSLB.HealthCheck.Protocol", v); return(v); }
internal override object ApiSerializeImpl(bool withClean = false) { System.Collections.Generic.List <string> missing = new System.Collections.Generic.List <string> { }; object ret = new System.Collections.Generic.Dictionary <string, object> { }; if (withClean || this.N_id) { Util.SetByPath(ret, "ID", this.M_id); } if (withClean || this.N_scope) { Util.SetByPath(ret, "Scope", this.M_scope); } if (withClean || this.N_name) { Util.SetByPath(ret, "Name", this.M_name); } else { if (this.IsNew) { (missing as System.Collections.IList).Add("name"); } } if (withClean || this.N_description) { Util.SetByPath(ret, "Description", this.M_description); } if (withClean || this.N_tags) { Util.SetByPath(ret, "Tags", new System.Collections.Generic.List <object> { }); for (int __it1 = 0; __it1 < (this.M_tags as System.Collections.IList).Count; __it1++) { var r1 = this.M_tags[__it1]; object v = null; v = r1; ((ret as System.Collections.Generic.Dictionary <string, object>)["Tags"] as System.Collections.IList).Add(v); } } if (withClean || this.N_icon) { Util.SetByPath(ret, "Icon", withClean ? (this.M_icon == null ? ((Icon)(null)) : this.M_icon.ApiSerialize(withClean)) : (this.M_icon == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : this.M_icon.ApiSerializeID())); } if (withClean || this.N_displayOrder) { Util.SetByPath(ret, "DisplayOrder", this.M_displayOrder); } if (withClean || this.N_sizeMib) { Util.SetByPath(ret, "SizeMB", this.M_sizeMib); } if (withClean || this.N_serviceClass) { Util.SetByPath(ret, "ServiceClass", this.M_serviceClass); } if (withClean || this.N_plan) { Util.SetByPath(ret, "Plan", withClean ? (this.M_plan == null ? ((DiskPlan)(null)) : this.M_plan.ApiSerialize(withClean)) : (this.M_plan == null ? new System.Collections.Generic.Dictionary <string, object> { { "ID", "0" } } : this.M_plan.ApiSerializeID())); } if (withClean || this.N_availability) { Util.SetByPath(ret, "Availability", this.M_availability); } if (missing.Count > 0) { throw new SaklientException("required_field", "Required fields must be set before the Archive creation: " + string.Join(", ", (missing).ToArray())); } return(ret); }
public long Set_responseExpected(long v) { this._Normalize(); Util.SetByPath(this.RawSettings, "GSLB.HealthCheck.Status", v); return(v); }