コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription" /> class.
 /// </summary>
 /// <param name="contacts">ID of contacts that are part of this subscription.</param>
 /// <param name="tags">The tags for this subscription.</param>
 /// <param name="sched">sched.</param>
 /// <param name="plotting">plotting.</param>
 /// <param name="id">ID of this subscription.</param>
 /// <param name="enabled">If false, notifications due for thsi subscription will not be sent.</param>
 /// <param name="anyTags">anyTags.</param>
 /// <param name="ignoreWarnings">If true, notifications will not be sent for warning values..</param>
 /// <param name="ignoreRecoverings">ignoreRecoverings.</param>
 /// <param name="throttling">throttling.</param>
 /// <param name="user">ID of the user that created the subscription.</param>
 public Subscription(List <Guid> contacts = default(List <Guid>), List <string> tags = default(List <string>), SubscriptionSched sched = default(SubscriptionSched), SubscriptionPlotting plotting = default(SubscriptionPlotting), string id = default(string), bool enabled = default(bool), bool anyTags = default(bool), bool ignoreWarnings = default(bool), bool ignoreRecoverings = default(bool), bool throttling = default(bool), string user = default(string))
 {
     this.Contacts          = contacts;
     this.Tags              = tags;
     this.Sched             = sched;
     this.Plotting          = plotting;
     this.Id                = id;
     this.Enabled           = enabled;
     this.AnyTags           = anyTags;
     this.IgnoreWarnings    = ignoreWarnings;
     this.IgnoreRecoverings = ignoreRecoverings;
     this.Throttling        = throttling;
     this.User              = user;
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Trigger" /> class.
        /// </summary>
        /// <param name="id">ID of the trigger.</param>
        /// <param name="name">name of the trigger (required).</param>
        /// <param name="desc">informative description of the trigger (required).</param>
        /// <param name="targets">graphite metric to cause this trigger.</param>
        /// <param name="warnValue">value at which Moira should send a WARNING alert.</param>
        /// <param name="errorValue">value at which Moira should send an ERROR alert (required).</param>
        /// <param name="triggerType">Value is either &#39;rising&#39; or &#39;falling&#39;. Dictates when alerts are sent for &#x60;warn_value&#x60; and &#x60;error_value&#x60;.</param>
        /// <param name="tags">the tags associated with this trigger. New tags are automatically created.</param>
        /// <param name="ttlState">state to put the metric in if Moira doesn&#39;t receive new data for it from graphite. See &lt;https://moira.readthedocs.io/en/latest/development/architecture.html?highlight&#x3D;ttl#state/&gt; (required).</param>
        /// <param name="ttl">number of seconds to wait for metric update from Graphite before changing the metric state (required).</param>
        /// <param name="sched">sched.</param>
        /// <param name="expression">expression.</param>
        /// <param name="patterns">optional Graphite pattern is a single dot-separated metric name, possibly containing one or more wildcards.</param>
        /// <param name="isRemote">dictates if trigger should be added to Graphite instead of Redis. See &lt;https://moira.readthedocs.io/en/latest/installation/configuration.html#remote-triggers-checker/&gt;.</param>
        /// <param name="muteNewMetrics">if true, Moira will notify you each time the metric state changes, e.g NODATA -&gt; OK (required).</param>
        /// <param name="throttling">See &lt;https://moira.readthedocs.io/en/latest/user_guide/throttling.html/&gt;.</param>
        public Trigger(Guid id = default(Guid), string name = default(string), string desc = default(string), List <string> targets = default(List <string>), int warnValue = default(int), int errorValue = default(int), TriggerTypeEnum?triggerType = default(TriggerTypeEnum?), List <string> tags = default(List <string>), TtlStateEnum ttlState = default(TtlStateEnum), int ttl = default(int), SubscriptionSched sched = default(SubscriptionSched), string expression = default(string), List <string> patterns = default(List <string>), bool isRemote = default(bool), bool muteNewMetrics = default(bool), int throttling = default(int))
        {
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for Trigger and cannot be null");
            }
            else
            {
                this.Name = name;
            }

            // to ensure "desc" is required (not null)
            if (desc == null)
            {
                throw new InvalidDataException("desc is a required property for Trigger and cannot be null");
            }
            else
            {
                this.Desc = desc;
            }

            // to ensure "errorValue" is required (not null)
            if (errorValue == null)
            {
                throw new InvalidDataException("errorValue is a required property for Trigger and cannot be null");
            }
            else
            {
                this.ErrorValue = errorValue;
            }

            // to ensure "ttlState" is required (not null)
            if (ttlState == null)
            {
                throw new InvalidDataException("ttlState is a required property for Trigger and cannot be null");
            }
            else
            {
                this.TtlState = ttlState;
            }

            // to ensure "ttl" is required (not null)
            if (ttl == null)
            {
                throw new InvalidDataException("ttl is a required property for Trigger and cannot be null");
            }
            else
            {
                this.Ttl = ttl;
            }

            // to ensure "muteNewMetrics" is required (not null)
            if (muteNewMetrics == null)
            {
                throw new InvalidDataException("muteNewMetrics is a required property for Trigger and cannot be null");
            }
            else
            {
                this.MuteNewMetrics = muteNewMetrics;
            }

            this.Id          = id;
            this.Targets     = targets;
            this.WarnValue   = warnValue;
            this.TriggerType = triggerType;
            this.Tags        = tags;
            this.Sched       = sched;
            this.Expression  = expression;
            this.Patterns    = patterns;
            this.IsRemote    = isRemote;
            this.Throttling  = throttling;
        }