예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityConfiguration"/> class
        /// with the specified values.
        /// </summary>
        /// <param name="label">The name for the entity. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="agentId">The agent which this entity is bound to. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="ipAddresses">The IP addresses which can be referenced by checks on this entity. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="metadata">A collection of metadata to associate with the entity. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <exception cref="ArgumentException">
        /// If <paramref name="label"/> is empty.
        /// <para>-or-</para>
        /// <para>If <paramref name="ipAddresses"/> contains any empty keys.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
        /// </exception>
        protected EntityConfiguration(string label, AgentId agentId, IDictionary <string, IPAddress> ipAddresses, IDictionary <string, string> metadata)
        {
            if (label == string.Empty)
            {
                throw new ArgumentException("label cannot be empty");
            }

            _label       = label;
            _agentId     = agentId;
            _ipAddresses = ipAddresses;
            if (_ipAddresses != null)
            {
                if (_ipAddresses.ContainsKey(string.Empty))
                {
                    throw new ArgumentException("ipAddresses cannot contain any empty keys", "ipAddresses");
                }
            }

            _metadata = metadata;
            if (_metadata != null)
            {
                if (_metadata.ContainsKey(string.Empty))
                {
                    throw new ArgumentException("metadata cannot contain any empty keys", "metadata");
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewEntityConfiguration"/> class
 /// with the specified values.
 /// </summary>
 /// <param name="label">The name for the entity.</param>
 /// <param name="agentId">The agent which this entity is bound to. If this parameter is <see langword="null"/>, <placeholder>placeholder</placeholder>.</param>
 /// <param name="ipAddresses">The IP addresses which can be referenced by checks on this entity. If this parameter is <see langword="null"/>, <placeholder>placeholder</placeholder>.</param>
 /// <param name="metadata">A collection of metadata to associate with the entity. If this parameter is <see langword="null"/>, the entity is created without any custom metadata.</param>
 /// <exception cref="ArgumentNullException">If <paramref name="label"/> is <see langword="null"/>.</exception>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is empty.
 /// <para>-or-</para>
 /// <para>If <paramref name="ipAddresses"/> contains any empty keys.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
 /// </exception>
 public NewEntityConfiguration(string label, AgentId agentId, IDictionary <string, IPAddress> ipAddresses, IDictionary <string, string> metadata)
     : base(label, agentId, ipAddresses, metadata)
 {
     if (label == null)
     {
         throw new ArgumentNullException("label");
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateEntityConfiguration"/> class
 /// with the specified values.
 /// </summary>
 /// <param name="label">The name for the entity. If this parameter is <see langword="null"/>, the name for the entity is not changed.</param>
 /// <param name="agentId">The agent which this entity is bound to. If this parameter is <see langword="null"/>, the agent for the entity is not changed.</param>
 /// <param name="ipAddresses">The IP addresses which can be referenced by checks on this entity. If this parameter is <see langword="null"/>, the IP addresses for the entity are not changed.</param>
 /// <param name="metadata">A collection of metadata to associate with the entity. If this parameter is <see langword="null"/>, the metadata for the entity is not changed.</param>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is empty.
 /// <para>-or-</para>
 /// <para>If <paramref name="ipAddresses"/> contains any empty keys, or any <see langword="null"/> values.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys, or any <see langword="null"/> values.</para>
 /// </exception>
 public UpdateEntityConfiguration(string label = null, AgentId agentId = null, IDictionary <string, IPAddress> ipAddresses = null, IDictionary <string, string> metadata = null)
     : base(label, agentId, ipAddresses, metadata)
 {
 }