示例#1
0
        internal static MetricAnomalyDetectionConfiguration DeserializeMetricAnomalyDetectionConfiguration(JsonElement element)
        {
            Optional <string> anomalyDetectionConfigurationId = default;
            string            name        = default;
            Optional <string> description = default;
            string            metricId    = default;
            MetricAnomalyDetectionConditions wholeMetricConfiguration = default;
            Optional <IList <MetricSeriesGroupAnomalyDetectionConditions> >  dimensionGroupOverrideConfigurations = default;
            Optional <IList <MetricSingleSeriesAnomalyDetectionConditions> > seriesOverrideConfigurations         = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("anomalyDetectionConfigurationId"))
                {
                    anomalyDetectionConfigurationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("metricId"))
                {
                    metricId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("wholeMetricConfiguration"))
                {
                    wholeMetricConfiguration = MetricAnomalyDetectionConditions.DeserializeMetricAnomalyDetectionConditions(property.Value);
                    continue;
                }
                if (property.NameEquals("dimensionGroupOverrideConfigurations"))
                {
                    List <MetricSeriesGroupAnomalyDetectionConditions> array = new List <MetricSeriesGroupAnomalyDetectionConditions>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(MetricSeriesGroupAnomalyDetectionConditions.DeserializeMetricSeriesGroupAnomalyDetectionConditions(item));
                    }
                    dimensionGroupOverrideConfigurations = array;
                    continue;
                }
                if (property.NameEquals("seriesOverrideConfigurations"))
                {
                    List <MetricSingleSeriesAnomalyDetectionConditions> array = new List <MetricSingleSeriesAnomalyDetectionConditions>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(MetricSingleSeriesAnomalyDetectionConditions.DeserializeMetricSingleSeriesAnomalyDetectionConditions(item));
                    }
                    seriesOverrideConfigurations = array;
                    continue;
                }
            }
            return(new MetricAnomalyDetectionConfiguration(anomalyDetectionConfigurationId.Value, name, description.Value, metricId, wholeMetricConfiguration, Optional.ToList(dimensionGroupOverrideConfigurations), Optional.ToList(seriesOverrideConfigurations)));
        }
 internal MetricAnomalyDetectionConfiguration(string id, string name, string description, string metricId, MetricAnomalyDetectionConditions wholeSeriesDetectionConditions, IList <MetricSeriesGroupAnomalyDetectionConditions> seriesGroupDetectionConditions, IList <MetricSingleSeriesAnomalyDetectionConditions> seriesDetectionConditions)
 {
     Id          = id;
     Name        = name;
     Description = description;
     MetricId    = metricId;
     WholeSeriesDetectionConditions = wholeSeriesDetectionConditions;
     SeriesGroupDetectionConditions = seriesGroupDetectionConditions;
     SeriesDetectionConditions      = seriesDetectionConditions;
 }
示例#3
0
        /// <summary>
        /// </summary>
        public MetricAnomalyDetectionConfiguration(string metricId, string name, MetricAnomalyDetectionConditions wholeSeriesDetectionConditions)
        {
            Argument.AssertNotNullOrEmpty(metricId, nameof(metricId));
            Argument.AssertNotNullOrEmpty(name, nameof(name));
            Argument.AssertNotNull(wholeSeriesDetectionConditions, nameof(wholeSeriesDetectionConditions));

            MetricId = metricId;
            Name     = name;
            WholeSeriesDetectionConditions = wholeSeriesDetectionConditions;
            SeriesDetectionConditions      = new ChangeTrackingList <MetricSingleSeriesAnomalyDetectionConditions>();
            SeriesGroupDetectionConditions = new ChangeTrackingList <MetricSeriesGroupAnomalyDetectionConditions>();
        }