/// <summary> /// Creates a new entry in a Load Balancing service pool /// </summary> /// <param name="zone">The zone to add the entry to</param> /// <param name="fqdn">The fqdn to add the entry to</param> /// <param name="address">The IPv4 address of this Node IP</param> /// <param name="label">A descriptive string describing this IP (may be string.empty)</param> /// <param name="weight">A number from 1-15 describing how often this record should be served. Higher means more</param> /// <param name="mode">Sets the behavior of this particular record. always - always serve this IP address, obey - Serve this address based upon its monitoring status, remove - Serve this address based upon its monitoring status. However, if it goes down, don't automatically bring it back up when monitoring reports it up, no - Never serve this IP address</param> /// <returns>The LoadBalancePoolEntry that is created or null if failed</returns> public net.dynect.api2.LoadBalancePoolEntry CreateLoadBalancePoolEntry(string zone, string fqdn, string address, string label, IPWeight weight, IPServeMode mode) { if (sessionData == null) return null; net.dynect.api2.LoadBalancePoolEntry retVal = null; try { net.dynect.api2.CreateLoadBalancePoolEntryRequestType request = new DynSoapWrapper.net.dynect.api2.CreateLoadBalancePoolEntryRequestType(); request.token = sessionData.token; request.fault_incompat = 1; request.fault_incompatSpecified = true; request.zone = zone; request.fqdn = fqdn; request.address = address; request.label = label; if (weight != IPWeight.NONE) request.weight = (int)weight; else request.weight = 1; request.serve_mode = mode.ToString(); net.dynect.api2.CreateLoadBalancePoolEntryResponseType response = dynectWsdl.CreateLoadBalancePoolEntry(request); retVal = response.data; } catch (Exception ex) { ;// TODO: Do your custom error handling here.... } return retVal; }
/// <summary> /// Add or create a GSLB array to send to the load balance service /// </summary> /// <param name="currenetLoadBalanceAddressArray">The GSLB array to add the GSLB to or null to start a new array</param> /// <param name="address">The IPv4 address of this Node IP</param> /// <param name="label">A descriptive string describing this IP (may be string.empty)</param> /// <param name="weight">A number from 1-15 describing how often this record should be served. Higher means more</param> /// <param name="mode">Sets the behavior of this particular record. always - always serve this IP address, obey - Serve this address based upon its monitoring status, remove - Serve this address based upon its monitoring status. However, if it goes down, don't automatically bring it back up when monitoring reports it up, no - Never serve this IP address</param> /// <returns>An array of GSLB to pass to update or create</returns> public net.dynect.api2.GSLBAddress[] AddLoadBalanceAddress(net.dynect.api2.GSLBAddress[] currenetGSLBAddressArray, string address, string label, IPWeight weight, IPServeMode mode) { net.dynect.api2.GSLBAddress[] retVal = null; int index = 0; if (currenetGSLBAddressArray == null) { retVal = new DynSoapWrapper.net.dynect.api2.GSLBAddress[1]; } else { retVal = new DynSoapWrapper.net.dynect.api2.GSLBAddress[currenetGSLBAddressArray.Length + 1]; for (index = 0; index < currenetGSLBAddressArray.Length; index++) { retVal[index] = currenetGSLBAddressArray[index]; } } retVal[index] = new DynSoapWrapper.net.dynect.api2.GSLBAddress(); retVal[index].address = address; retVal[index].label = label; if (weight != IPWeight.NONE) retVal[index].weight = (int)weight; else retVal[index].weight = 1; retVal[index].serve_mode = mode.ToString(); return retVal; }