/// <summary>
        /// Initializes a new instance of the <see cref="TraceRouteConfiguration"/> class
        /// with the specified target and resolver type.
        /// </summary>
        /// <param name="target">The target for the traceroute operation.</param>
        /// <param name="resolverType">The type of resolver to use for resolving the target to an IP address.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="target"/> is <see langword="null"/>.</exception>
        /// <exception cref="ArgumentException">If <paramref name="target"/> is empty.</exception>
        public TraceRouteConfiguration(string target, TargetResolverType resolverType)
        {
            if (target == null)
                throw new ArgumentNullException("target");
            if (string.IsNullOrEmpty(target))
                throw new ArgumentException("target cannot be empty");

            _target = target;
            _targetResolver = resolverType;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NewCheckConfiguration"/> class
 /// with the specified properties.
 /// </summary>
 /// <param name="label">The friendly name of the check. If this is <see langword="null"/>, the label assigned to the new check is unspecified.</param>
 /// <param name="checkTypeId">The check type ID. This is obtained from <see cref="CheckType.Id">CheckType.Id</see>, or from the predefined values in <see cref="CheckTypeId"/>.</param>
 /// <param name="details">A <see cref="CheckDetails"/> object containing detailed configuration information for the specific check type.</param>
 /// <param name="monitoringZonesPoll">A collection of <see cref="MonitoringZoneId"/> objects identifying the monitoring zones to poll from.</param>
 /// <param name="timeout">The timeout of a check operation. If this value is <see langword="null"/>, a provider-specific default value is used.</param>
 /// <param name="period">The period between check operations. If this value is <see langword="null"/>, a provider-specific default value is used.</param>
 /// <param name="targetAlias">The alias of the target for this check in the associated entity's <see cref="EntityConfiguration.IPAddresses"/> map.</param>
 /// <param name="targetHostname">The hostname this check should target.</param>
 /// <param name="resolverType">The type of resolver to use for converting <paramref name="targetHostname"/> to an IP address.</param>
 /// <param name="metadata">A collection of metadata to associate with the check. If this parameter is <see langword="null"/>, the check is created without any custom metadata.</param>
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="checkTypeId"/> is <see langword="null"/>.
 /// <para>-or-</para>
 /// <para>If <paramref name="details"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is non-<see langword="null"/> but empty.
 /// <para>-or-</para>
 /// <para>If the specified <paramref name="details"/> object does support checks of type <paramref name="checkTypeId"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="checkTypeId"/> is a remote check (i.e. the <see cref="Monitoring.CheckTypeId.IsRemote"/> property is <see langword="true"/>) and <paramref name="monitoringZonesPoll"/> is <see langword="null"/> or empty.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="checkTypeId"/> is a remote check (i.e. the <see cref="Monitoring.CheckTypeId.IsRemote"/> property is <see langword="true"/>) and both <paramref name="targetAlias"/> and <paramref name="targetHostname"/> are <see langword="null"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="monitoringZonesPoll"/> contains any <see langword="null"/> values.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="period"/> is less than or equal to <paramref name="timeout"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="targetAlias"/> is non-<see langword="null"/> but empty.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="targetHostname"/> is non-<see langword="null"/> but empty.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys, or any <see langword="null"/> values.</para>
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// If <paramref name="timeout"/> is less than or equal to <see cref="TimeSpan.Zero"/>.
 /// <para>-or-</para>
 /// <para>If <paramref name="period"/> is less than or equal to <see cref="TimeSpan.Zero"/>.</para>
 /// </exception>
 /// <exception cref="InvalidOperationException">
 /// If <paramref name="targetAlias"/> and <paramref name="targetHostname"/> are both non-<see langword="null"/>.
 /// </exception>
 public NewCheckConfiguration(string label, CheckTypeId checkTypeId, CheckDetails details, IEnumerable<MonitoringZoneId> monitoringZonesPoll, TimeSpan? timeout, TimeSpan? period, string targetAlias, string targetHostname, TargetResolverType resolverType, IDictionary<string, string> metadata)
     : base(label, checkTypeId, details, monitoringZonesPoll, timeout, period, targetAlias, targetHostname, resolverType, metadata)
 {
     if (checkTypeId == null)
         throw new ArgumentNullException("checkTypeId");
     if (details == null)
         throw new ArgumentNullException("details");
     if (checkTypeId.IsRemote && monitoringZonesPoll == null)
         throw new ArgumentException("monitoringZonesPoll cannot be null or empty for remote checks", "monitoringZonesPoll");
     if (checkTypeId.IsRemote && targetAlias == null && targetHostname == null)
         throw new ArgumentException("targetAlias and targetHostname cannot both be null for remote checks");
     if (checkTypeId.IsRemote && MonitoringZonesPoll.Count == 0)
         throw new ArgumentException("monitoringZonesPoll cannot be null or empty for remote checks", "monitoringZonesPoll");
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CheckConfiguration"/> class
        /// with the specified properties.
        /// </summary>
        /// <param name="label">The friendly name of the check. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="checkTypeId">The check type ID. This is obtained from <see cref="CheckType.Id">CheckType.Id</see>, or from the predefined values in <see cref="CheckTypeId"/>. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="details">A <see cref="CheckDetails"/> object containing detailed configuration information for the specific check type. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="monitoringZonesPoll">A collection of <see cref="MonitoringZoneId"/> objects identifying the monitoring zones to poll from. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="timeout">The timeout of a check operation. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="period">The period between check operations. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="targetAlias">The alias of the target for this check in the associated entity's <see cref="EntityConfiguration.IPAddresses"/> map. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="targetHostname">The hostname this check should target. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="resolverType">The type of resolver to use for converting <paramref name="targetHostname"/> to an IP address. 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 check. 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 non-<see langword="null"/> but empty.
        /// <para>-or-</para>
        /// <para>If the specified <paramref name="details"/> object does support checks of type <paramref name="checkTypeId"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="monitoringZonesPoll"/> contains any <see langword="null"/> values.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="period"/> is less than or equal to <paramref name="timeout"/>.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="targetAlias"/> is non-<see langword="null"/> but empty.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="targetHostname"/> is non-<see langword="null"/> but empty.</para>
        /// <para>-or-</para>
        /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// If <paramref name="timeout"/> is less than or equal to <see cref="TimeSpan.Zero"/>.
        /// <para>-or-</para>
        /// <para>If <paramref name="period"/> is less than or equal to <see cref="TimeSpan.Zero"/>.</para>
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// If <paramref name="targetAlias"/> and <paramref name="targetHostname"/> are both non-<see langword="null"/>.
        /// </exception>
        protected CheckConfiguration(string label, CheckTypeId checkTypeId, CheckDetails details, IEnumerable<MonitoringZoneId> monitoringZonesPoll, TimeSpan? timeout, TimeSpan? period, string targetAlias, string targetHostname, TargetResolverType resolverType, IDictionary<string, string> metadata)
        {
            if (label == string.Empty)
                throw new ArgumentException("label cannot be empty");
            if (targetAlias == string.Empty)
                throw new ArgumentException("targetAlias cannot be empty");
            if (targetHostname == string.Empty)
                throw new ArgumentException("targetHostname cannot be empty");
            if (details != null && !details.SupportsCheckType(checkTypeId))
                throw new ArgumentException(string.Format("The check details object does not support '{0}' checks.", checkTypeId), "details");
            if (timeout <= TimeSpan.Zero)
                throw new ArgumentOutOfRangeException("timeout");
            if (period <= TimeSpan.Zero)
                throw new ArgumentOutOfRangeException("period");
            if (period <= timeout)
                throw new ArgumentException("period cannot be less than or equal to timeout", "period");
            if (targetAlias != null && targetHostname != null)
                throw new InvalidOperationException("targetAlias and targetHostname cannot both be specified");
            if (metadata != null && metadata.ContainsKey(string.Empty))
                throw new ArgumentException("metadata cannot contain any empty keys", "metadata");

            _label = label;
            _type = checkTypeId;
            _details = details != null ? JObject.FromObject(details) : null;
            _monitoringZonesPoll = monitoringZonesPoll != null ? monitoringZonesPoll.ToArray() : null;
            _timeout = timeout.HasValue ? (int?)timeout.Value.TotalSeconds : null;
            _period = period.HasValue ? (int?)period.Value.TotalSeconds : null;
            _targetAlias = targetAlias;
            _targetHostname = targetHostname;
            _resolverType = resolverType;
            _metadata = metadata;

            // this check is at the end of the constructor so monitoringZonesPoll is only enumerated once
            if (_monitoringZonesPoll != null && _monitoringZonesPoll.Contains(null))
                throw new ArgumentException("monitoringZonesPoll cannot contain any null values", "monitoringZonesPoll");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateCheckConfiguration"/> class
 /// with the specified properties.
 /// </summary>
 /// <param name="label">The friendly name of the check. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="checkTypeId">The check type ID. This is obtained from <see cref="CheckType.Id">CheckType.Id</see>, or from the predefined values in <see cref="CheckTypeId"/>. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="details">A <see cref="CheckDetails"/> object containing detailed configuration information for the specific check type. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="monitoringZonesPoll">A collection of <see cref="MonitoringZoneId"/> objects identifying the monitoring zones to poll from. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="timeout">The timeout of a check operation. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="period">The period between check operations. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="targetAlias">The alias of the target for this check in the associated entity's <see cref="EntityConfiguration.IPAddresses"/> map. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="targetHostname">The hostname this check should target. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="resolverType">The type of resolver to use for converting <paramref name="targetHostname"/> to an IP address. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <param name="metadata">A collection of metadata to associate with the check. If this value is <see langword="null"/>, the existing value for the check is not changed.</param>
 /// <exception cref="ArgumentException">
 /// If <paramref name="label"/> is non-<see langword="null"/> but empty.
 /// <para>-or-</para>
 /// <para>If the specified <paramref name="details"/> object does support checks of type <paramref name="checkTypeId"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="monitoringZonesPoll"/> contains any <see langword="null"/> values.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="period"/> is less than or equal to <paramref name="timeout"/>.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="targetAlias"/> is non-<see langword="null"/> but empty.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="targetHostname"/> is non-<see langword="null"/> but empty.</para>
 /// <para>-or-</para>
 /// <para>If <paramref name="metadata"/> contains any empty keys.</para>
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// If <paramref name="timeout"/> is less than or equal to <see cref="TimeSpan.Zero"/>.
 /// <para>-or-</para>
 /// <para>If <paramref name="period"/> is less than or equal to <see cref="TimeSpan.Zero"/>.</para>
 /// </exception>
 /// <exception cref="InvalidOperationException">
 /// If <paramref name="targetAlias"/> and <paramref name="targetHostname"/> are both non-<see langword="null"/>.
 /// </exception>
 public UpdateCheckConfiguration(string label = null, CheckTypeId checkTypeId = null, CheckDetails details = null, IEnumerable<MonitoringZoneId> monitoringZonesPoll = null, TimeSpan? timeout = null, TimeSpan? period = null, string targetAlias = null, string targetHostname = null, TargetResolverType resolverType = null, IDictionary<string, string> metadata = null)
     : base(label, checkTypeId, details, monitoringZonesPoll, timeout, period, targetAlias, targetHostname, resolverType, metadata)
 {
 }