/// <summary>
        /// Initializes a new instance of the <see cref="NodeConfiguration"/> class.
        /// </summary>
        /// <param name="address">The IP address of the node.</param>
        /// <param name="port">The port number for the load balanced service.</param>
        /// <param name="condition">The condition for the node, which determines its role within the load balancer.</param>
        /// <param name="type">The node type. If this value is <see langword="null"/>, a provider-specific default value will be used.</param>
        /// <param name="weight">The weight of the node.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="address"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="condition"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// If <paramref name="port"/> is less than 0 or greater than 65535.
        /// <para>-or-</para>
        /// <para>If <paramref name="weight"/> is less than or equal to 0.</para>
        /// </exception>
        public NodeConfiguration(IPAddress address, int port, NodeCondition condition, NodeType type, int?weight)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }
            if (condition == null)
            {
                throw new ArgumentNullException("condition");
            }
            if (port < 0 || port > 65535)
            {
                throw new ArgumentOutOfRangeException("port");
            }
            if (weight <= 0)
            {
                throw new ArgumentOutOfRangeException("weight");
            }

            _address   = address.ToString();
            _port      = port;
            _condition = condition;
            _type      = type;
            _weight    = weight;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeConfiguration"/> class.
        /// </summary>
        /// <param name="hostDomain">The domain name of the node.</param>
        /// <param name="port">The port number for the load balanced service.</param>
        /// <param name="condition">The condition for the node, which determines its role within the load balancer.</param>
        /// <param name="type">The node type. If this value is <see langword="null"/>, a provider-specific default value will be used.</param>
        /// <param name="weight">The weight of the node.</param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="hostDomain"/> is <see langword="null"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="condition"/> is <see langword="null"/>.</para>
        /// </exception>
        /// <exception cref="ArgumentException">If <paramref name="hostDomain"/> is empty.</exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// If <paramref name="port"/> is less than 0 or greater than 65535.
        /// <para>-or-</para>
        /// <para>If <paramref name="weight"/> is less than or equal to 0.</para>
        /// </exception>
        public NodeConfiguration(string hostDomain, int port, NodeCondition condition, NodeType type, int?weight)
        {
            if (hostDomain == null)
            {
                throw new ArgumentNullException("hostDomain");
            }
            if (condition == null)
            {
                throw new ArgumentNullException("condition");
            }
            if (string.IsNullOrEmpty(hostDomain))
            {
                throw new ArgumentException("hostDomain cannot be empty");
            }
            if (port < 0 || port > 65535)
            {
                throw new ArgumentOutOfRangeException("port");
            }
            if (weight <= 0)
            {
                throw new ArgumentOutOfRangeException("weight");
            }

            _address   = hostDomain;
            _port      = port;
            _condition = condition;
            _type      = type;
            _weight    = weight;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeUpdate"/> class.
        /// </summary>
        /// <param name="condition">The condition for the node, which determines its role within the load balancer. If this value is <see langword="null"/>, the existing value for the node is not changed.</param>
        /// <param name="type">The node type. If this value is <see langword="null"/>, a provider-specific default value will be used. If this value is <see langword="null"/>, the existing value for the node is not changed.</param>
        /// <param name="weight">The weight of the node. If this value is <see langword="null"/>, the existing value for the node is not changed.</param>
        /// <exception cref="ArgumentOutOfRangeException">If <paramref name="weight"/> is less than or equal to 0.</exception>
        public NodeUpdate(NodeCondition condition = null, NodeType type = null, int?weight = null)
        {
            if (weight <= 0)
            {
                throw new ArgumentOutOfRangeException("weight");
            }

            _condition = condition;
            _type      = type;
            _weight    = weight;
        }
Ejemplo n.º 4
0
 /// <inheritdoc/>
 protected override NodeCondition FromName(string name)
 {
     return(NodeCondition.FromName(name));
 }