Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewAlarmConfiguration"/> class with the specified
 /// values.
 /// </summary>
 /// <param name="checkId">The ID of the check to alert on. This is obtained from <see cref="Check.Id">Check.Id</see>.</param>
 /// <param name="notificationPlanId">The ID of the notification plan to execute when the state changes. This is obtained from <see cref="NotificationPlan.Id">NotificationPlan.Id</see>.</param>
 /// <param name="criteria">The <see href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/alerts-language.html">alarm DSL</see> for describing alerting conditions and their output states.</param>
 /// <param name="enabled"><see langword="true"/> to enable processing and alerts on this alarm; otherwise, <see langword="false"/>. If this value is <see langword="null"/>, <placeholder/>.</param>
 /// <param name="label">A friendly label for the alarm.</param>
 /// <param name="metadata">A collection of metadata to associate with the alarm.</param>
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="checkId"/> is <see langword="null"/>.
 /// <para>-or-</para>
 /// <para>If <paramref name="notificationPlanId"/> is <see langword="null"/>.</para>
 /// </exception>
 /// <exception cref="ArgumentException">
 /// If <paramref name="metadata"/> contains any values with empty keys.
 /// </exception>
 public NewAlarmConfiguration(CheckId checkId, NotificationPlanId notificationPlanId, string criteria = null, bool?enabled = null, string label = null, IDictionary <string, string> metadata = null)
     : base(checkId, notificationPlanId, criteria, enabled, label, metadata)
 {
     if (checkId == null)
     {
         throw new ArgumentNullException("checkId");
     }
     if (notificationPlanId == null)
     {
         throw new ArgumentNullException("notificationPlanId");
     }
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AlarmConfiguration"/> class with the specified
        /// values.
        /// </summary>
        /// <param name="checkId">The ID of the check to alert on. This is obtained from <see cref="Check.Id">Check.Id</see>. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="notificationPlanId">The ID of the notification plan to execute when the state changes. This is obtained from <see cref="NotificationPlan.Id">NotificationPlan.Id</see>. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="criteria">The <see href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/alerts-language.html">alarm DSL</see> for describing alerting conditions and their output states. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="enabled"><see langword="true"/> to enable processing and alerts on this alarm; otherwise, <see langword="false"/>. If this value is <see langword="null"/>, the underlying property will be omitted from the JSON representation of the object.</param>
        /// <param name="label">A friendly label for the alarm. 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 alarm. 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="metadata"/> contains any values with empty keys.
        /// </exception>
        protected AlarmConfiguration(CheckId checkId, NotificationPlanId notificationPlanId, string criteria, bool?enabled, string label, IDictionary <string, string> metadata)
        {
            if (metadata != null && metadata.ContainsKey(string.Empty))
            {
                throw new ArgumentException("metadata cannot contain any empty keys", "metadata");
            }

            _checkId            = checkId;
            _notificationPlanId = notificationPlanId;
            _criteria           = criteria;
            _disabled           = !enabled;
            _label    = label;
            _metadata = metadata;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateAlarmConfiguration"/> class with the specified
 /// values.
 /// </summary>
 /// <param name="checkId">The ID of the check to alert on. This is obtained from <see cref="Check.Id">Check.Id</see>. If this value is <see langword="null"/>, the existing value for the alarm is not changed.</param>
 /// <param name="notificationPlanId">The ID of the notification plan to execute when the state changes. This is obtained from <see cref="NotificationPlan.Id">NotificationPlan.Id</see>. If this value is <see langword="null"/>, the existing value for the alarm is not changed.</param>
 /// <param name="criteria">The <see href="http://docs.rackspace.com/cm/api/v1.0/cm-devguide/content/alerts-language.html">alarm DSL</see> for describing alerting conditions and their output states. If this value is <see langword="null"/>, the existing value for the alarm is not changed.</param>
 /// <param name="enabled"><see langword="true"/> to enable processing and alerts on this alarm; otherwise, <see langword="false"/>. If this value is <see langword="null"/>, the existing value for the alarm is not changed.</param>
 /// <param name="label">A friendly label for the alarm. If this value is <see langword="null"/>, the existing value for the alarm is not changed.</param>
 /// <param name="metadata">A collection of metadata to associate with the alarm. If this value is <see langword="null"/>, the existing value for the alarm is not changed.</param>
 /// <exception cref="ArgumentException">
 /// If <paramref name="metadata"/> contains any values with empty keys.
 /// </exception>
 public UpdateAlarmConfiguration(CheckId checkId = null, NotificationPlanId notificationPlanId = null, string criteria = null, bool?enabled = null, string label = null, IDictionary <string, string> metadata = null)
     : base(checkId, notificationPlanId, criteria, enabled, label, metadata)
 {
 }