Ejemplo n.º 1
0
 internal MetricChangePointFeedback(FeedbackType type, string id, DateTimeOffset?createdTime, string userPrincipal, string metricId, FeedbackDimensionFilter dimensionFilter, DateTimeOffset startTime, DateTimeOffset endTime, ChangePointFeedbackValue valueInternal) : base(type, id, createdTime, userPrincipal, metricId, dimensionFilter)
 {
     StartTime     = startTime;
     EndTime       = endTime;
     ValueInternal = valueInternal;
     Type          = type;
 }
Ejemplo n.º 2
0
 internal MetricChangePointFeedback(MetricFeedbackKind feedbackKind, string id, DateTimeOffset?createdOn, string userPrincipal, string metricId, FeedbackFilter dimensionFilter, DateTimeOffset startsOn, DateTimeOffset endsOn, ChangePointFeedbackValue valueInternal) : base(feedbackKind, id, createdOn, userPrincipal, metricId, dimensionFilter)
 {
     StartsOn      = startsOn;
     EndsOn        = endsOn;
     ValueInternal = valueInternal;
     FeedbackKind  = feedbackKind;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MetricChangePointFeedback"/> class.
 /// </summary>
 /// <param name="metricId">The identifier of the metric to which the <see cref="MetricChangePointFeedback"/> applies.</param>
 /// <param name="dimensionKey">
 /// A key that identifies a set of time series to which the <see cref="MetricChangePointFeedback"/> applies.
 /// If all possible dimensions are set, this key uniquely identifies a single time series
 /// for the specified <paramref name="metricId"/>. If only a subset of dimensions are set, this
 /// key uniquely identifies a group of time series.
 /// </param>
 /// <param name="startsOn">The start timestamp of feedback time range.</param>
 /// <param name="endsOn">The end timestamp of feedback time range. When this is equal to <paramref name="startsOn"/> it indicates a single timestamp.</param>
 /// <param name="value">Indicate whether or not the data points should be considered change points by the service.</param>
 /// <exception cref="ArgumentNullException"><paramref name="metricId"/> or <paramref name="dimensionKey"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentException"><paramref name="metricId"/> is empty.</exception>
 public MetricChangePointFeedback(string metricId, DimensionKey dimensionKey, DateTimeOffset startsOn, DateTimeOffset endsOn, ChangePointValue value)
     : base(metricId, dimensionKey)
 {
     StartsOn      = startsOn;
     EndsOn        = endsOn;
     ValueInternal = new ChangePointFeedbackValue(value);
     FeedbackKind  = MetricFeedbackKind.ChangePoint;
 }
Ejemplo n.º 4
0
        /// <summary> Initializes a new <see cref="MetricChangePointFeedback"/> instance. </summary>
        /// <param name="metricId"> The metric unique id. </param>
        /// <param name="dimensionFilter"> The dimension filter. </param>
        /// <param name="startTime"> The start timestamp of feedback timerange. </param>
        /// <param name="endTime"> The end timestamp of feedback timerange. When this is equal to <paramref name="startTime"/> it indicates a single timestamp. </param>
        /// <param name="value"> The <see cref="Models.ChangePointFeedbackValue"/> for the feedback. </param>
        internal MetricChangePointFeedback(string metricId, FeedbackDimensionFilter dimensionFilter, DateTimeOffset startTime, DateTimeOffset endTime, ChangePointFeedbackValue value) : base(metricId, dimensionFilter)
        {
            Argument.AssertNotNull(value, nameof(value));

            StartTime     = startTime;
            EndTime       = endTime;
            ValueInternal = value;
            Type          = Models.FeedbackType.ChangePoint;
        }
        /// <summary> Initializes a new <see cref="MetricChangePointFeedback"/> instance. </summary>
        /// <param name="metricId"> The metric unique id. </param>
        /// <param name="feedbackFilter"> The dimension filter. </param>
        /// <param name="startsOn"> The start timestamp of feedback timerange. </param>
        /// <param name="endsOn"> The end timestamp of feedback timerange. When this is equal to <paramref name="startsOn"/> it indicates a single timestamp. </param>
        /// <param name="value"> The <see cref="Models.ChangePointFeedbackValue"/> for the feedback. </param>
        internal MetricChangePointFeedback(string metricId, FeedbackFilter feedbackFilter, DateTimeOffset startsOn, DateTimeOffset endsOn, ChangePointFeedbackValue value)
            : base(metricId, feedbackFilter.DimensionKey)
        {
            Argument.AssertNotNull(value, nameof(value));

            StartsOn      = startsOn;
            EndsOn        = endsOn;
            ValueInternal = value;
            FeedbackKind  = MetricFeedbackKind.ChangePoint;
        }
Ejemplo n.º 6
0
        /// <summary> Initializes a new <see cref="MetricChangePointFeedback"/> instance. </summary>
        /// <param name="metricId"> The metric unique id. </param>
        /// <param name="dimensionFilter"> The dimension filter. </param>
        /// <param name="startTime"> The start timestamp of feedback timerange. </param>
        /// <param name="endTime"> The end timestamp of feedback timerange. When this is equal to <paramref name="startTime"/> it indicates a single timestamp. </param>
        /// <param name="value"> The <see cref="Models.ChangePointValue"/> for the feedback. </param>
        /// <exception cref="ArgumentNullException"> <paramref name="dimensionFilter"/> or <paramref name="value"/> is null. </exception>
        public MetricChangePointFeedback(string metricId, FeedbackDimensionFilter dimensionFilter, DateTimeOffset startTime, DateTimeOffset endTime, ChangePointValue value) : base(metricId, dimensionFilter)
        {
            if (value == default)
            {
                throw new ArgumentNullException(nameof(value));
            }

            StartTime     = startTime;
            EndTime       = endTime;
            ValueInternal = new ChangePointFeedbackValue(value);
            Type          = FeedbackType.ChangePoint;
        }
Ejemplo n.º 7
0
        internal static MetricChangePointFeedback DeserializeMetricChangePointFeedback(JsonElement element)
        {
            DateTimeOffset            startTime     = default;
            DateTimeOffset            endTime       = default;
            ChangePointFeedbackValue  value         = default;
            MetricFeedbackKind        feedbackType  = default;
            Optional <string>         feedbackId    = default;
            Optional <DateTimeOffset> createdTime   = default;
            Optional <string>         userPrincipal = default;
            string         metricId        = default;
            FeedbackFilter dimensionFilter = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("startTime"))
                {
                    startTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endTime"))
                {
                    endTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("value"))
                {
                    value = ChangePointFeedbackValue.DeserializeChangePointFeedbackValue(property.Value);
                    continue;
                }
                if (property.NameEquals("feedbackType"))
                {
                    feedbackType = new MetricFeedbackKind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("feedbackId"))
                {
                    feedbackId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("createdTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    createdTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("userPrincipal"))
                {
                    userPrincipal = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("metricId"))
                {
                    metricId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dimensionFilter"))
                {
                    dimensionFilter = FeedbackFilter.DeserializeFeedbackFilter(property.Value);
                    continue;
                }
            }
            return(new MetricChangePointFeedback(feedbackType, feedbackId.Value, Optional.ToNullable(createdTime), userPrincipal.Value, metricId, dimensionFilter, startTime, endTime, value));
        }