Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MetricsAdvisor] Removed setters from collections #18493

Merged
merged 3 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sdk/metricsadvisor/Azure.AI.MetricsAdvisor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@
- In `DataFeedRollupSettings`, removed the setter of the property `AutoRollupGroupByColumnNames`.
- In `AnomalyDetectionConfiguration`, removed the setters of the properties `SeriesDetectionConditions` and `SeriesGroupDetectionConditions`.
- In `WebNotificationHook`, removed the setter of the property `Headers`.
- In `GetAnomaliesForDetectionConfigurationFilter`, removed the setter of the property `SeriesGroupKeys`. Keys can be added directly to the property.
- In `GetMetricSeriesDefinitionsOptions`, removed the setter of the property `DimensionCombinationsToFilter`. Keys combinations can be added directly to the property.
- In `GetValuesOfDimensionWithAnomaliesOptions`, removed the setter of the property `DimensionToFilter`. Dimension columns can be added directly to the property.
- `DataFeed.SourceType` is now nullable. It will be null whenever `DataFeed.DataSource` is null.
- `DataFeed.IngestionStartTime` is now nullable.
- `MetricsAdvisorAdministrationClient.CreateDataFeed` sync and async methods now throw an `ArgumentException` if required properties are not set properly.
- `MetricsAdvisorAdministrationClient.CreateDetectionConfiguration` sync and async methods now throw an `ArgumentException` if required properties are not set properly.
- `MetricsAdvisorAdministrationClient.CreateAlertConfiguration` sync and async methods now throw an `ArgumentException` if required properties are not set properly.
- In `MetricsAdvisorKeyCredential`, renamed the parameter `key` to `subscriptionKey` in the method `UpdateSubscriptionKey`.
- In `MetricsAdvisorKeyCredential`, renamed the parameter `key` to `apiKey` in the method `UpdateApiKey`.
- In `GetMetricSeriesDataOptions`, removed the parameter `seriesToFilter` from the constructor. Keys can be added directly to `SeriesToFilter`.
- In `FeedbackDimensionFilter`, removed the parameter `dimensionFilter` from the constructor. Dimension columns can be added directly to `DimensionFilter`.

### Key Bug Fixes
- Fixed a bug in which setting `WebNotificationHook.CertificatePassword` would actually set the property `Username` instead.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public GetAnomaliesForDetectionConfigurationFilter() { }
public GetAnomaliesForDetectionConfigurationFilter(Azure.AI.MetricsAdvisor.Models.AnomalySeverity minimumSeverity, Azure.AI.MetricsAdvisor.Models.AnomalySeverity maximumSeverity) { }
public Azure.AI.MetricsAdvisor.Models.AnomalySeverity? MaximumSeverity { get { throw null; } }
public Azure.AI.MetricsAdvisor.Models.AnomalySeverity? MinimumSeverity { get { throw null; } }
public System.Collections.Generic.IList<Azure.AI.MetricsAdvisor.Models.DimensionKey> SeriesGroupKeys { get { throw null; } set { } }
public System.Collections.Generic.IList<Azure.AI.MetricsAdvisor.Models.DimensionKey> SeriesGroupKeys { get { throw null; } }
}
public partial class GetAnomaliesForDetectionConfigurationOptions
{
Expand Down Expand Up @@ -142,23 +142,23 @@ public GetMetricEnrichmentStatusesOptions(System.DateTimeOffset startTime, Syste
}
public partial class GetMetricSeriesDataOptions
{
public GetMetricSeriesDataOptions(System.Collections.Generic.IEnumerable<Azure.AI.MetricsAdvisor.Models.DimensionKey> seriesToFilter, System.DateTimeOffset startTime, System.DateTimeOffset endTime) { }
public GetMetricSeriesDataOptions(System.DateTimeOffset startTime, System.DateTimeOffset endTime) { }
public System.DateTimeOffset EndTime { get { throw null; } }
public System.Collections.Generic.IEnumerable<Azure.AI.MetricsAdvisor.Models.DimensionKey> SeriesToFilter { get { throw null; } }
public System.Collections.Generic.ICollection<Azure.AI.MetricsAdvisor.Models.DimensionKey> SeriesToFilter { get { throw null; } }
public System.DateTimeOffset StartTime { get { throw null; } }
}
public partial class GetMetricSeriesDefinitionsOptions
{
public GetMetricSeriesDefinitionsOptions(System.DateTimeOffset activeSince) { }
public System.DateTimeOffset ActiveSince { get { throw null; } }
public System.Collections.Generic.IDictionary<string, System.Collections.Generic.IList<string>> DimensionCombinationsToFilter { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, System.Collections.Generic.IList<string>> DimensionCombinationsToFilter { get { throw null; } }
public int? SkipCount { get { throw null; } set { } }
public int? TopCount { get { throw null; } set { } }
}
public partial class GetValuesOfDimensionWithAnomaliesOptions
{
public GetValuesOfDimensionWithAnomaliesOptions(System.DateTimeOffset startTime, System.DateTimeOffset endTime) { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey DimensionToFilter { get { throw null; } set { } }
public Azure.AI.MetricsAdvisor.Models.DimensionKey DimensionToFilter { get { throw null; } }
public System.DateTimeOffset EndTime { get { throw null; } }
public int? SkipCount { get { throw null; } set { } }
public System.DateTimeOffset StartTime { get { throw null; } }
Expand Down Expand Up @@ -811,7 +811,7 @@ internal EnrichmentStatus() { }
}
public partial class FeedbackDimensionFilter
{
public FeedbackDimensionFilter(Azure.AI.MetricsAdvisor.Models.DimensionKey dimensionFilter) { }
public FeedbackDimensionFilter() { }
public Azure.AI.MetricsAdvisor.Models.DimensionKey DimensionFilter { get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Threading;
using Azure.AI.MetricsAdvisor.Models;
Expand All @@ -15,8 +14,6 @@ namespace Azure.AI.MetricsAdvisor
/// </summary>
public class GetAnomaliesForDetectionConfigurationFilter
{
private IList<DimensionKey> _seriesGroupKeys;

/// <summary>
/// Initializes a new instance of the <see cref="GetAnomaliesForDetectionConfigurationFilter"/> class.
/// </summary>
Expand All @@ -41,18 +38,7 @@ public GetAnomaliesForDetectionConfigurationFilter(AnomalySeverity minimumSeveri
/// Filters the result by series. Only anomalies detected in the time series groups specified will
/// be returned.
/// </summary>
/// <exception cref="ArgumentNullException">The value assigned to <see cref="SeriesGroupKeys"/> is null.</exception>
#pragma warning disable CA2227 // Collection properties should be readonly
public IList<DimensionKey> SeriesGroupKeys
{
get => _seriesGroupKeys;
set
{
Argument.AssertNotNull(value, nameof(SeriesGroupKeys));
_seriesGroupKeys = value;
}
}
#pragma warning restore CA2227 // Collection properties should be readonly
public IList<DimensionKey> SeriesGroupKeys { get; }

/// <summary>
/// The minimum severity level an anomaly must have to be returned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ public class GetMetricSeriesDataOptions
/// <summary>
/// Initializes a new instance of the <see cref="GetMetricSeriesDataOptions"/> class.
/// </summary>
/// <param name="seriesToFilter">Only time series with the specified series keys will be returned. These keys uniquely identify a time series within a metric. Every dimension contained in the associated <see cref="DataFeed"/> must be assigned a value.</param>
/// <param name="startTime">Filters the result. Only data points ingested from this point in time, in UTC, will be returned.</param>
/// <param name="endTime">Filters the result. Only data points ingested up to this point in time, in UTC, will be returned.</param>
public GetMetricSeriesDataOptions(IEnumerable<DimensionKey> seriesToFilter, DateTimeOffset startTime, DateTimeOffset endTime)
public GetMetricSeriesDataOptions(DateTimeOffset startTime, DateTimeOffset endTime)
{
Argument.AssertNotNull(seriesToFilter, nameof(seriesToFilter));

SeriesToFilter = seriesToFilter;
SeriesToFilter = new ChangeTrackingList<DimensionKey>();
StartTime = startTime;
EndTime = endTime;
}
Expand All @@ -34,7 +31,7 @@ public GetMetricSeriesDataOptions(IEnumerable<DimensionKey> seriesToFilter, Date
/// a time series within a metric. Every dimension contained in the associated <see cref="DataFeed"/>
/// must be assigned a value.
/// </summary>
public IEnumerable<DimensionKey> SeriesToFilter { get; }
public ICollection<DimensionKey> SeriesToFilter { get; }

/// <summary>
/// Filters the result. Only data points ingested from this point in time, in UTC, will be returned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace Azure.AI.MetricsAdvisor
/// </summary>
public class GetMetricSeriesDefinitionsOptions
{
private IDictionary<string, IList<string>> _dimensionCombinationsToFilter;

/// <summary>
/// Initializes a new instance of the <see cref="GetMetricSeriesDefinitionsOptions"/> class.
/// </summary>
Expand All @@ -34,17 +32,7 @@ public GetMetricSeriesDefinitionsOptions(DateTimeOffset activeSince)
/// Filters the result, mapping a dimension's name to a list of possible values it can assume. Only time series
/// with the specified dimension values will be returned.
/// </summary>
#pragma warning disable CA2227 // Collection properties should be readonly
public IDictionary<string, IList<string>> DimensionCombinationsToFilter
{
get => _dimensionCombinationsToFilter;
set
{
Argument.AssertNotNull(value, nameof(DimensionCombinationsToFilter));
_dimensionCombinationsToFilter = value;
}
}
#pragma warning restore CA2227 // Collection properties should be readonly
public IDictionary<string, IList<string>> DimensionCombinationsToFilter { get; }

/// <summary>
/// If set, skips the first set of items returned. This property specifies the amount of items to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public GetValuesOfDimensionWithAnomaliesOptions(DateTimeOffset startTime, DateTi
{
StartTime = startTime;
EndTime = endTime;
DimensionToFilter = new DimensionKey();
}

/// <summary>
Expand All @@ -37,7 +38,7 @@ public GetValuesOfDimensionWithAnomaliesOptions(DateTimeOffset startTime, DateTi
/// Filters the result by series. Only anomalies detected in the time series group specified will
/// be returned.
/// </summary>
public DimensionKey DimensionToFilter { get; set; }
public DimensionKey DimensionToFilter { get; }

/// <summary>
/// If set, skips the first set of items returned. This property specifies the amount of items to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using Azure.Core;

namespace Azure.AI.MetricsAdvisor.Models
{
Expand All @@ -15,13 +14,9 @@ public partial class FeedbackDimensionFilter
/// <summary>
/// Initializes a new instance of the <see cref="FeedbackDimensionFilter"/> class.
/// </summary>
/// <param name="dimensionFilter">Filters the result by series. Only feedbacks for the series in the time series group specified will be returned.</param>
/// <exception cref="ArgumentNullException"><paramref name="dimensionFilter"/> is null.</exception>
public FeedbackDimensionFilter(DimensionKey dimensionFilter)
public FeedbackDimensionFilter()
{
Argument.AssertNotNull(dimensionFilter, nameof(dimensionFilter));

DimensionFilter = dimensionFilter;
DimensionFilter = new DimensionKey();
}

/// <summary> Initializes a new instance of FeedbackDimensionFilter. </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,7 @@ public async Task GetValuesOfDimensionWithAnomaliesWithOptionalDimensionFilter()

MetricsAdvisorClient client = GetMetricsAdvisorClient();

var options = new GetValuesOfDimensionWithAnomaliesOptions(SamplingStartTime, SamplingEndTime)
{
DimensionToFilter = new DimensionKey()
};
var options = new GetValuesOfDimensionWithAnomaliesOptions(SamplingStartTime, SamplingEndTime);

options.DimensionToFilter.AddDimensionColumn("category", "Handmade");

Expand Down
Loading