/// <summary> /// Initializes a new instance of <see cref="Models.DataPointAnomaly"/> for mocking purposes. /// </summary> /// <param name="dataFeedId">Sets the <see cref="DataPointAnomaly.DataFeedId"/> property.</param> /// <param name="metricId">Sets the <see cref="DataPointAnomaly.MetricId"/> property.</param> /// <param name="detectionConfigurationId">Sets the <see cref="DataPointAnomaly.DetectionConfigurationId"/> property.</param> /// <param name="timestamp">Sets the <see cref="DataPointAnomaly.Timestamp"/> property.</param> /// <param name="createdOn">Sets the <see cref="DataPointAnomaly.CreatedOn"/> property.</param> /// <param name="lastModified">Sets the <see cref="DataPointAnomaly.LastModified"/> property.</param> /// <param name="seriesKey">Sets the <see cref="DataPointAnomaly.SeriesKey"/> property.</param> /// <param name="severity">Sets the <see cref="DataPointAnomaly.Severity"/> property.</param> /// <param name="status">Sets the <see cref="DataPointAnomaly.Status"/> property.</param> /// <param name="value">Sets the <see cref="DataPointAnomaly.Value"/> property.</param> /// <param name="expectedValue">Sets the <see cref="DataPointAnomaly.ExpectedValue"/> property.</param> /// <returns>A new instance of <see cref="Models.DataPointAnomaly"/> for mocking purposes.</returns> public static DataPointAnomaly DataPointAnomaly(string dataFeedId = null, string metricId = null, string detectionConfigurationId = null, DateTimeOffset timestamp = default, DateTimeOffset?createdOn = null, DateTimeOffset?lastModified = null, DimensionKey seriesKey = null, AnomalySeverity severity = default, AnomalyStatus?status = null, double value = default, double?expectedValue = null) { Dictionary <string, string> dimensions = seriesKey?.ToDictionary(key => key.Key, key => key.Value); AnomalyProperty anomalyProperty = new AnomalyProperty(severity, status, value, expectedValue); return(new DataPointAnomaly(dataFeedId, metricId, detectionConfigurationId, timestamp, createdOn, lastModified, dimensions, anomalyProperty)); }
internal static DataAnomaly DeserializeDataAnomaly(JsonElement element) { Optional <string> metricId = default; Optional <string> anomalyDetectionConfigurationId = default; DateTimeOffset timestamp = default; Optional <DateTimeOffset> createdTime = default; Optional <DateTimeOffset> modifiedTime = default; IReadOnlyDictionary <string, string> dimension = default; AnomalyProperty property = default; foreach (var property0 in element.EnumerateObject()) { if (property0.NameEquals("metricId")) { metricId = property0.Value.GetString(); continue; } if (property0.NameEquals("anomalyDetectionConfigurationId")) { anomalyDetectionConfigurationId = property0.Value.GetString(); continue; } if (property0.NameEquals("timestamp")) { timestamp = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("createdTime")) { createdTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("modifiedTime")) { modifiedTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("dimension")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property1 in property0.Value.EnumerateObject()) { dictionary.Add(property1.Name, property1.Value.GetString()); } dimension = dictionary; continue; } if (property0.NameEquals("property")) { property = AnomalyProperty.DeserializeAnomalyProperty(property0.Value); continue; } } return(new DataAnomaly(metricId.Value, anomalyDetectionConfigurationId.Value, timestamp, Optional.ToNullable(createdTime), Optional.ToNullable(modifiedTime), dimension, property)); }
internal DataAnomaly(string metricId, string anomalyDetectionConfigurationId, DateTimeOffset timestamp, DateTimeOffset?createdTime, DateTimeOffset?modifiedTime, IReadOnlyDictionary <string, string> dimension, AnomalyProperty property) { MetricId = metricId; AnomalyDetectionConfigurationId = anomalyDetectionConfigurationId; Timestamp = timestamp; CreatedTime = createdTime; ModifiedTime = modifiedTime; SeriesKey = new DimensionKey(dimension); Severity = property.AnomalySeverity; AnomalyStatus = property.AnomalyStatus; }
internal DataPointAnomaly(string dataFeedId, string metricId, string anomalyDetectionConfigurationId, DateTimeOffset timestamp, DateTimeOffset?createdOn, DateTimeOffset?lastModified, IReadOnlyDictionary <string, string> dimension, AnomalyProperty property) { DataFeedId = dataFeedId; MetricId = metricId; DetectionConfigurationId = anomalyDetectionConfigurationId; Timestamp = timestamp; CreatedOn = createdOn; LastModified = lastModified; SeriesKey = new DimensionKey(dimension); Severity = property.AnomalySeverity; Status = property.AnomalyStatus; Value = property.Value; ExpectedValue = property.ExpectedValue; }