diff --git a/sdk/monitor/Azure.Monitor.Query/README.md b/sdk/monitor/Azure.Monitor.Query/README.md index b823b8fb1fc21..889db7e07ff04 100644 --- a/sdk/monitor/Azure.Monitor.Query/README.md +++ b/sdk/monitor/Azure.Monitor.Query/README.md @@ -74,7 +74,7 @@ Response response = await client.QueryAsync( "AzureActivity | top 10 by TimeGenerated", new DateTimeRange(TimeSpan.FromDays(1))); -LogsQueryResultTable table = response.Value.Table; +LogsTable table = response.Value.Table; foreach (var row in table.Rows) { @@ -178,7 +178,7 @@ Response response = await client.QueryAsync( "AzureActivity | top 10 by TimeGenerated", new DateTimeRange(TimeSpan.FromDays(1))); -LogsQueryResultTable table = response.Value.Table; +LogsTable table = response.Value.Table; foreach (var column in table.Columns) { diff --git a/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs b/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs index 3c74cfb21005b..af1770e21fdc4 100644 --- a/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs +++ b/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs @@ -63,10 +63,10 @@ public partial class MetricsQueryOptions public MetricsQueryOptions() { } public System.Collections.Generic.IList Aggregations { get { throw null; } } public string Filter { get { throw null; } set { } } - public System.TimeSpan? Interval { get { throw null; } set { } } + public System.TimeSpan? Granularity { get { throw null; } set { } } public string MetricNamespace { get { throw null; } set { } } public string OrderBy { get { throw null; } set { } } - public Azure.Core.DateTimeRange? TimeSpan { get { throw null; } set { } } + public Azure.Core.DateTimeRange? TimeRange { get { throw null; } set { } } public int? Top { get { throw null; } set { } } } } @@ -114,22 +114,31 @@ internal LogsBatchQueryResults() { } public partial class LogsQueryResult { internal LogsQueryResult() { } - public System.Collections.Generic.IReadOnlyList AllTables { get { throw null; } } + public System.Collections.Generic.IReadOnlyList AllTables { get { throw null; } } public Azure.Core.ResponseError Error { get { throw null; } } - public Azure.Monitor.Query.Models.LogsQueryResultTable Table { get { throw null; } } + public Azure.Monitor.Query.Models.LogsTable Table { get { throw null; } } public System.BinaryData GetStatistics() { throw null; } public System.BinaryData GetVisualization() { throw null; } } - public partial class LogsQueryResultColumn + public partial class LogsTable { - internal LogsQueryResultColumn() { } + internal LogsTable() { } + public System.Collections.Generic.IReadOnlyList Columns { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Rows { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Deserialize() { throw null; } + public override string ToString() { throw null; } + } + public partial class LogsTableColumn + { + internal LogsTableColumn() { } public string Name { get { throw null; } } public Azure.Monitor.Query.Models.LogsColumnType Type { get { throw null; } } public override string ToString() { throw null; } } - public partial class LogsQueryResultRow + public partial class LogsTableRow { - internal LogsQueryResultRow() { } + internal LogsTableRow() { } public int Count { get { throw null; } } public object this[int index] { get { throw null; } } public object this[string name] { get { throw null; } } @@ -159,26 +168,6 @@ internal LogsQueryResultRow() { } public bool IsNull(string name) { throw null; } public override string ToString() { throw null; } } - public partial class LogsQueryResultTable - { - internal LogsQueryResultTable() { } - public System.Collections.Generic.IReadOnlyList Columns { get { throw null; } } - public string Name { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Rows { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Deserialize() { throw null; } - public override string ToString() { throw null; } - } - public partial class Metric - { - internal Metric() { } - public string DisplayDescription { get { throw null; } } - public Azure.Core.ResponseError Error { get { throw null; } } - public string Id { get { throw null; } } - public string Name { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TimeSeries { get { throw null; } } - public string Type { get { throw null; } } - public Azure.Monitor.Query.Models.MetricUnit Unit { get { throw null; } } - } public enum MetricAggregationType { None = 0, @@ -241,12 +230,23 @@ internal MetricNamespace() { } public string Name { get { throw null; } } public string Type { get { throw null; } } } + public partial class MetricResult + { + internal MetricResult() { } + public string DisplayDescription { get { throw null; } } + public Azure.Core.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList TimeSeries { get { throw null; } } + public string Type { get { throw null; } } + public Azure.Monitor.Query.Models.MetricUnit Unit { get { throw null; } } + } public partial class MetricsQueryResult { internal MetricsQueryResult() { } public int? Cost { get { throw null; } } public System.TimeSpan? Interval { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Metrics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Metrics { get { throw null; } } public string Namespace { get { throw null; } } public string ResourceRegion { get { throw null; } } public Azure.Core.DateTimeRange TimeSpan { get { throw null; } } @@ -312,7 +312,7 @@ internal MetricValue() { } } public static partial class QueryModelFactory { - public static Azure.Monitor.Query.Models.LogsQueryResultColumn LogsQueryResultColumn(string name = null, Azure.Monitor.Query.Models.LogsColumnType type = default(Azure.Monitor.Query.Models.LogsColumnType)) { throw null; } + public static Azure.Monitor.Query.Models.LogsTableColumn LogsTableColumn(string name = null, Azure.Monitor.Query.Models.LogsColumnType type = default(Azure.Monitor.Query.Models.LogsColumnType)) { throw null; } public static Azure.Monitor.Query.Models.MetricAvailability MetricAvailability(System.TimeSpan? timeGrain = default(System.TimeSpan?), System.TimeSpan? retention = default(System.TimeSpan?)) { throw null; } public static Azure.Monitor.Query.Models.MetricValue MetricValue(System.DateTimeOffset timeStamp = default(System.DateTimeOffset), double? average = default(double?), double? minimum = default(double?), double? maximum = default(double?), double? total = default(double?), double? count = default(double?)) { throw null; } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsBatchQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsBatchQueryResult.cs index 080b38896cee8..8a199528e1ff7 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsBatchQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsBatchQueryResult.cs @@ -17,7 +17,7 @@ public partial class LogsBatchQueryResult : LogsQueryResult /// Initializes a new instance of LogsBatchQueryResult. /// The list of tables, columns and rows. /// is null. - internal LogsBatchQueryResult(IEnumerable allTables) : base(allTables) + internal LogsBatchQueryResult(IEnumerable allTables) : base(allTables) { if (allTables == null) { @@ -30,7 +30,7 @@ internal LogsBatchQueryResult(IEnumerable allTables) : bas /// Any object. /// Any object. /// Any object. - internal LogsBatchQueryResult(IReadOnlyList allTables, JsonElement statistics, JsonElement visualization, JsonElement error) : base(allTables, statistics, visualization, error) + internal LogsBatchQueryResult(IReadOnlyList allTables, JsonElement statistics, JsonElement visualization, JsonElement error) : base(allTables, statistics, visualization, error) { } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.Serialization.cs index 7f88c93adb8c0..111a65079f04c 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.Serialization.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.Serialization.cs @@ -15,7 +15,7 @@ public partial class LogsQueryResult { internal static LogsQueryResult DeserializeLogsQueryResult(JsonElement element) { - IReadOnlyList tables = default; + IReadOnlyList tables = default; Optional statistics = default; Optional render = default; Optional error = default; @@ -23,10 +23,10 @@ internal static LogsQueryResult DeserializeLogsQueryResult(JsonElement element) { if (property.NameEquals("tables")) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(LogsQueryResultTable.DeserializeLogsQueryResultTable(item)); + array.Add(LogsTable.DeserializeLogsTable(item)); } tables = array; continue; diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs index a80785576a7c8..57c78433f1d8a 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs @@ -18,7 +18,7 @@ public partial class LogsQueryResult /// Initializes a new instance of LogsQueryResult. /// The list of tables, columns and rows. /// is null. - internal LogsQueryResult(IEnumerable allTables) + internal LogsQueryResult(IEnumerable allTables) { if (allTables == null) { @@ -33,7 +33,7 @@ internal LogsQueryResult(IEnumerable allTables) /// Any object. /// Any object. /// Any object. - internal LogsQueryResult(IReadOnlyList allTables, JsonElement statistics, JsonElement visualization, JsonElement error) + internal LogsQueryResult(IReadOnlyList allTables, JsonElement statistics, JsonElement visualization, JsonElement error) { AllTables = allTables; _statistics = statistics; diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultTable.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTable.Serialization.cs similarity index 69% rename from sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultTable.Serialization.cs rename to sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTable.Serialization.cs index 9e3236e7203d6..1641f701ec6b3 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultTable.Serialization.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTable.Serialization.cs @@ -11,12 +11,12 @@ namespace Azure.Monitor.Query.Models { - public partial class LogsQueryResultTable + public partial class LogsTable { - internal static LogsQueryResultTable DeserializeLogsQueryResultTable(JsonElement element) + internal static LogsTable DeserializeLogsTable(JsonElement element) { string name = default; - IReadOnlyList columns = default; + IReadOnlyList columns = default; JsonElement rows = default; foreach (var property in element.EnumerateObject()) { @@ -27,10 +27,10 @@ internal static LogsQueryResultTable DeserializeLogsQueryResultTable(JsonElement } if (property.NameEquals("columns")) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(LogsQueryResultColumn.DeserializeLogsQueryResultColumn(item)); + array.Add(LogsTableColumn.DeserializeLogsTableColumn(item)); } columns = array; continue; @@ -41,7 +41,7 @@ internal static LogsQueryResultTable DeserializeLogsQueryResultTable(JsonElement continue; } } - return new LogsQueryResultTable(name, columns, rows); + return new LogsTable(name, columns, rows); } } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultTable.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTable.cs similarity index 75% rename from sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultTable.cs rename to sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTable.cs index 6861a0f36e559..409043d197749 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultTable.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTable.cs @@ -13,14 +13,14 @@ namespace Azure.Monitor.Query.Models { /// Contains the columns and rows for one table in a query response. - public partial class LogsQueryResultTable + public partial class LogsTable { - /// Initializes a new instance of LogsQueryResultTable. + /// Initializes a new instance of LogsTable. /// The name of the table. /// The list of columns in this table. /// The resulting rows from this query. /// or is null. - internal LogsQueryResultTable(string name, IEnumerable columns, JsonElement internalRows) + internal LogsTable(string name, IEnumerable columns, JsonElement internalRows) { if (name == null) { @@ -36,11 +36,11 @@ internal LogsQueryResultTable(string name, IEnumerable co InternalRows = internalRows; } - /// Initializes a new instance of LogsQueryResultTable. + /// Initializes a new instance of LogsTable. /// The name of the table. /// The list of columns in this table. /// The resulting rows from this query. - internal LogsQueryResultTable(string name, IReadOnlyList columns, JsonElement internalRows) + internal LogsTable(string name, IReadOnlyList columns, JsonElement internalRows) { Name = name; Columns = columns; @@ -50,6 +50,6 @@ internal LogsQueryResultTable(string name, IReadOnlyList /// The name of the table. public string Name { get; } /// The list of columns in this table. - public IReadOnlyList Columns { get; } + public IReadOnlyList Columns { get; } } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultColumn.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTableColumn.Serialization.cs similarity index 79% rename from sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultColumn.Serialization.cs rename to sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTableColumn.Serialization.cs index 186f482383270..a89d672c21883 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultColumn.Serialization.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTableColumn.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.Monitor.Query.Models { - public partial class LogsQueryResultColumn + public partial class LogsTableColumn { - internal static LogsQueryResultColumn DeserializeLogsQueryResultColumn(JsonElement element) + internal static LogsTableColumn DeserializeLogsTableColumn(JsonElement element) { string name = default; LogsColumnType type = default; @@ -29,7 +29,7 @@ internal static LogsQueryResultColumn DeserializeLogsQueryResultColumn(JsonEleme continue; } } - return new LogsQueryResultColumn(name, type); + return new LogsTableColumn(name, type); } } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultColumn.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTableColumn.cs similarity index 81% rename from sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultColumn.cs rename to sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTableColumn.cs index 169c5fd092841..a7f9558177756 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResultColumn.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsTableColumn.cs @@ -10,13 +10,13 @@ namespace Azure.Monitor.Query.Models { /// A column in a table. - public partial class LogsQueryResultColumn + public partial class LogsTableColumn { - /// Initializes a new instance of LogsQueryResultColumn. + /// Initializes a new instance of LogsTableColumn. /// The name of this column. /// The data type of this column. /// is null. - internal LogsQueryResultColumn(string name, LogsColumnType type) + internal LogsTableColumn(string name, LogsColumnType type) { if (name == null) { diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResult.Serialization.cs similarity index 90% rename from sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.Serialization.cs rename to sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResult.Serialization.cs index 359c4de83c7e5..c18c1773a9d25 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.Serialization.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResult.Serialization.cs @@ -11,9 +11,9 @@ namespace Azure.Monitor.Query.Models { - public partial class Metric + public partial class MetricResult { - internal static Metric DeserializeMetric(JsonElement element) + internal static MetricResult DeserializeMetricResult(JsonElement element) { string id = default; string type = default; @@ -71,7 +71,7 @@ internal static Metric DeserializeMetric(JsonElement element) continue; } } - return new Metric(id, type, name, displayDescription.Value, errorCode.Value, errorMessage.Value, unit, timeseries); + return new MetricResult(id, type, name, displayDescription.Value, errorCode.Value, errorMessage.Value, unit, timeseries); } } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResult.cs similarity index 84% rename from sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.cs rename to sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResult.cs index c644fe047a108..1d582893bc7fa 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResult.cs @@ -12,16 +12,16 @@ namespace Azure.Monitor.Query.Models { /// The result data of a query. - public partial class Metric + public partial class MetricResult { - /// Initializes a new instance of Metric. + /// Initializes a new instance of MetricResult. /// the metric Id. /// the resource type of the metric resource. /// the name and the display name of the metric, i.e. it is localizable string. /// The unit of the metric. /// the time series returned when a data query is performed. /// , , , or is null. - internal Metric(string id, string type, LocalizableString localizedName, MetricUnit unit, IEnumerable timeSeries) + internal MetricResult(string id, string type, LocalizableString localizedName, MetricUnit unit, IEnumerable timeSeries) { if (id == null) { @@ -47,7 +47,7 @@ internal Metric(string id, string type, LocalizableString localizedName, MetricU TimeSeries = timeSeries.ToList(); } - /// Initializes a new instance of Metric. + /// Initializes a new instance of MetricResult. /// the metric Id. /// the resource type of the metric resource. /// the name and the display name of the metric, i.e. it is localizable string. @@ -56,7 +56,7 @@ internal Metric(string id, string type, LocalizableString localizedName, MetricU /// Error message encountered querying this specific metric. /// The unit of the metric. /// the time series returned when a data query is performed. - internal Metric(string id, string type, LocalizableString localizedName, string displayDescription, string errorCode, string errorMessage, MetricUnit unit, IReadOnlyList timeSeries) + internal MetricResult(string id, string type, LocalizableString localizedName, string displayDescription, string errorCode, string errorMessage, MetricUnit unit, IReadOnlyList timeSeries) { Id = id; Type = type; diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.Serialization.cs index 63a16b06cde51..3ff71589b737b 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.Serialization.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.Serialization.cs @@ -21,7 +21,7 @@ internal static MetricsQueryResult DeserializeMetricsQueryResult(JsonElement ele Optional interval = default; Optional @namespace = default; Optional resourceregion = default; - IReadOnlyList value = default; + IReadOnlyList value = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("cost")) @@ -61,10 +61,10 @@ internal static MetricsQueryResult DeserializeMetricsQueryResult(JsonElement ele } if (property.NameEquals("value")) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(Metric.DeserializeMetric(item)); + array.Add(MetricResult.DeserializeMetricResult(item)); } value = array; continue; diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.cs index 2b2c965e32505..f07bffbe44ba4 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricsQueryResult.cs @@ -18,7 +18,7 @@ public partial class MetricsQueryResult /// The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. /// the value of the collection. /// or is null. - internal MetricsQueryResult(string timespan, IEnumerable metrics) + internal MetricsQueryResult(string timespan, IEnumerable metrics) { if (timespan == null) { @@ -40,7 +40,7 @@ internal MetricsQueryResult(string timespan, IEnumerable metrics) /// The namespace of the metrics being queried. /// The region of the resource being queried for metrics. /// the value of the collection. - internal MetricsQueryResult(int? cost, string timespan, TimeSpan? interval, string @namespace, string resourceRegion, IReadOnlyList metrics) + internal MetricsQueryResult(int? cost, string timespan, TimeSpan? interval, string @namespace, string resourceRegion, IReadOnlyList metrics) { Cost = cost; _timespan = timespan; diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/QueryModelFactory.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/QueryModelFactory.cs index b8b3133515251..cb962391945b3 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/QueryModelFactory.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/QueryModelFactory.cs @@ -12,13 +12,13 @@ namespace Azure.Monitor.Query.Models /// Model factory for read-only models. public static partial class QueryModelFactory { - /// Initializes a new instance of LogsQueryResultColumn. + /// Initializes a new instance of LogsTableColumn. /// The name of this column. /// The data type of this column. - /// A new instance for mocking. - public static LogsQueryResultColumn LogsQueryResultColumn(string name = null, LogsColumnType type = default) + /// A new instance for mocking. + public static LogsTableColumn LogsTableColumn(string name = null, LogsColumnType type = default) { - return new LogsQueryResultColumn(name, type); + return new LogsTableColumn(name, type); } /// Initializes a new instance of MetricAvailability. diff --git a/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryClient.cs b/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryClient.cs index 3f0570b51a416..c96f31339ef94 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryClient.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryClient.cs @@ -115,8 +115,8 @@ public virtual Response Query(string resourceId, IEnumerable try { return _metricsRestClient.List(resourceId, - timespan: options?.TimeSpan?.ToString(), - interval: options?.Interval, + timespan: options?.TimeRange?.ToString(), + interval: options?.Granularity, filter: options?.Filter, top: options?.Top, aggregation: GetAggregation(options), @@ -177,8 +177,8 @@ public virtual async Task> QueryAsync(string resour try { return await _metricsRestClient.ListAsync(resourceId, - timespan: options?.TimeSpan?.ToString(), - interval: options?.Interval, + timespan: options?.TimeRange?.ToString(), + interval: options?.Granularity, filter: options?.Filter, top: options?.Top, aggregation: GetAggregation(options), diff --git a/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryOptions.cs b/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryOptions.cs index 3f4621aa6511b..540aa2070f02b 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryOptions.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/MetricsQueryOptions.cs @@ -16,12 +16,14 @@ public class MetricsQueryOptions /// /// Gets or sets the timespan over which the metric will be queried. /// - public DateTimeRange? TimeSpan { get; set; } + [CodeGenMember("TimeSpan")] + public DateTimeRange? TimeRange { get; set; } /// /// Gets or sets the interval at which to sample metrics. /// - public TimeSpan? Interval { get; set; } + [CodeGenMember("Interval")] + public TimeSpan? Granularity { get; set; } /// /// Gets the list of metric aggregations to retrieve. @@ -36,7 +38,7 @@ public class MetricsQueryOptions /// /// Gets or sets the filter that is used to refine the set of metric data returned. /// - /// Metric contains metadata A, B and C.
+ /// MetricResult contains metadata A, B and C.
///
/// - Return all time series of C where A = a1 and B = b1 or b2:
/// A eq 'a1' and B eq 'b1' or B eq 'b2' and C eq '*'
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsBatchQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsBatchQueryResult.cs index 3f7283401834e..3e6171fff2858 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsBatchQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsBatchQueryResult.cs @@ -24,7 +24,7 @@ public partial class LogsBatchQueryResult: LogsQueryResult internal static LogsBatchQueryResult DeserializeLogsBatchQueryResult(JsonElement element) { Optional error = default; - IReadOnlyList tables = default; + IReadOnlyList tables = default; Optional statistics = default; Optional render = default; @@ -56,10 +56,10 @@ internal static LogsBatchQueryResult DeserializeLogsBatchQueryResult(JsonElement } if (property.NameEquals("tables")) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(LogsQueryResultTable.DeserializeLogsQueryResultTable(item)); + array.Add(LogsTable.DeserializeLogsTable(item)); } tables = array; continue; @@ -78,4 +78,4 @@ internal static LogsBatchQueryResult DeserializeLogsBatchQueryResult(JsonElement return new LogsBatchQueryResult(tables, statistics, render, error); } } -} \ No newline at end of file +} diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResults.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResults.cs index ca73c51bf9968..80ff830731504 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResults.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResults.cs @@ -24,7 +24,7 @@ public partial class LogsQueryResult /// /// Gets the single table result of the query. /// - public LogsQueryResultTable Table + public LogsTable Table { get { @@ -41,7 +41,7 @@ public LogsQueryResultTable Table /// Gets the multi-table result of the query. ///
[CodeGenMember("Tables")] - public IReadOnlyList AllTables { get; } + public IReadOnlyList AllTables { get; } /// /// Returns the query statistics if the is set to true. null otherwise. diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResultTable.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsTable.cs similarity index 76% rename from sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResultTable.cs rename to sdk/monitor/Azure.Monitor.Query/src/Models/LogsTable.cs index 6e2b119edb10f..a563dd0d36bd3 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResultTable.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsTable.cs @@ -9,9 +9,9 @@ namespace Azure.Monitor.Query.Models { [CodeGenModel("Table")] - public partial class LogsQueryResultTable + public partial class LogsTable { - private IReadOnlyList _rows; + private IReadOnlyList _rows; [CodeGenMember("Rows")] private JsonElement InternalRows { get; } @@ -19,9 +19,9 @@ public partial class LogsQueryResultTable /// /// Gets the rows of the result table. /// - public IReadOnlyList Rows => _rows ??= CreateRows(); + public IReadOnlyList Rows => _rows ??= CreateRows(); - private IReadOnlyList CreateRows() + private IReadOnlyList CreateRows() { Dictionary columnDictionary = new(); @@ -30,11 +30,11 @@ private IReadOnlyList CreateRows() columnDictionary[Columns[index].Name] = index; } - List rows = new List(); + List rows = new List(); foreach (var row in InternalRows.EnumerateArray()) { - rows.Add(new LogsQueryResultRow(columnDictionary, Columns, row)); + rows.Add(new LogsTableRow(columnDictionary, Columns, row)); } return rows; @@ -55,4 +55,4 @@ public override string ToString() return $"{Name}: {Rows.Count} rows, {Columns.Count} columns"; } } -} \ No newline at end of file +} diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResultRow.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsTableRow.cs similarity index 97% rename from sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResultRow.cs rename to sdk/monitor/Azure.Monitor.Query/src/Models/LogsTableRow.cs index 97b0aaad6546b..b21f51f2bdf50 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResultRow.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsTableRow.cs @@ -12,13 +12,14 @@ namespace Azure.Monitor.Query.Models /// /// Represents a row in the table of results returned from the logs query. /// - public class LogsQueryResultRow + [CodeGenModel("LogsQueryResultRow")] + public class LogsTableRow { private readonly Dictionary _columnMap; - private readonly IReadOnlyList _columns; + private readonly IReadOnlyList _columns; private readonly JsonElement _row; - internal LogsQueryResultRow(Dictionary columnMap, IReadOnlyList columns, JsonElement row) + internal LogsTableRow(Dictionary columnMap, IReadOnlyList columns, JsonElement row) { _columnMap = columnMap; _columns = columns; diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/Metric.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/MetricResult.cs similarity index 94% rename from sdk/monitor/Azure.Monitor.Query/src/Models/Metric.cs rename to sdk/monitor/Azure.Monitor.Query/src/Models/MetricResult.cs index 5037746176c6a..322b85d28bd05 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/Metric.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/MetricResult.cs @@ -6,7 +6,8 @@ namespace Azure.Monitor.Query.Models { - public partial class Metric + [CodeGenModel("Metric")] + public partial class MetricResult { private const string SuccessErrorCode = "Success"; diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/MetricsQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/MetricsQueryResult.cs index da44b85ef36d1..bb182b2c96ec5 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/MetricsQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/MetricsQueryResult.cs @@ -14,7 +14,7 @@ public partial class MetricsQueryResult /// Metrics returned as the result of the query. [CodeGenMember("Value")] - public IReadOnlyList Metrics { get; } + public IReadOnlyList Metrics { get; } /// /// The timespan for which the data was retrieved. diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/QueryResultColumn.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/QueryResultColumn.cs index 0e1796323e3df..9bff8c090858f 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/QueryResultColumn.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/QueryResultColumn.cs @@ -6,7 +6,7 @@ namespace Azure.Monitor.Query.Models { [CodeGenModel("Column")] - public partial class LogsQueryResultColumn + public partial class LogsTableColumn { /// public override string ToString() @@ -14,4 +14,4 @@ public override string ToString() return $"{Name} ({Type})"; } } -} \ No newline at end of file +} diff --git a/sdk/monitor/Azure.Monitor.Query/src/Properties/AssemblyInfo.cs b/sdk/monitor/Azure.Monitor.Query/src/Properties/AssemblyInfo.cs index 390e37022ebbd..40c34c4bb91d8 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Properties/AssemblyInfo.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Properties/AssemblyInfo.cs @@ -8,5 +8,5 @@ [assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Insights")] -[assembly: SuppressMessage("Usage", "AZC0012:Avoid single word type names", Justification = "", Scope = "type", Target = "~T:Azure.Monitor.Query.Models.Metric")] +[assembly: SuppressMessage("Usage", "AZC0012:Avoid single word type names", Justification = "", Scope = "type", Target = "~T:Azure.Monitor.Query.Models.MetricResult")] [assembly: SuppressMessage("Usage", "AZC0014:Types from System.Text.Json, Newtonsoft.Json, System.Collections.Immutable assemblies should not be exposed as part of public API surface.", Justification = "")] diff --git a/sdk/monitor/Azure.Monitor.Query/src/RowBinder.cs b/sdk/monitor/Azure.Monitor.Query/src/RowBinder.cs index 98f098faf9c86..570d9667b9644 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/RowBinder.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/RowBinder.cs @@ -7,10 +7,10 @@ namespace Azure.Monitor.Query { - internal class RowBinder: TypeBinder + internal class RowBinder: TypeBinder { internal static RowBinder Shared = new(); - internal IReadOnlyList BindResults(IReadOnlyList tables) + internal IReadOnlyList BindResults(IReadOnlyList tables) { List results = new List(); if (typeof(IDictionary).IsAssignableFrom(typeof(T))) @@ -45,12 +45,12 @@ internal IReadOnlyList BindResults(IReadOnlyList tab return results; } - protected override void Set(LogsQueryResultRow destination, T value, BoundMemberInfo memberInfo) + protected override void Set(LogsTableRow destination, T value, BoundMemberInfo memberInfo) { throw new NotSupportedException(); } - protected override bool TryGet(BoundMemberInfo memberInfo, LogsQueryResultRow source, out T value) + protected override bool TryGet(BoundMemberInfo memberInfo, LogsTableRow source, out T value) { int column; @@ -98,7 +98,7 @@ protected override bool TryGet(BoundMemberInfo memberInfo, LogsQueryResultRow else { throw new NotSupportedException($"The {typeof(T)} type is not supported as a deserialization target. " + - "Supported types are string, bool, long, decimal, double, object, Guid, DateTimeOffset, TimeSpan, BinaryData."); + "Supported types are string, bool, long, decimal, double, object, Guid, DateTimeOffset, TimeRange, BinaryData."); } return true; diff --git a/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs b/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs index 117d2f6807669..390469173877e 100644 --- a/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs +++ b/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs @@ -240,7 +240,7 @@ public async Task CanQueryAllSupportedTypes() "dynamic({\"a\":123, \"b\":\"hello\", \"c\":[1,2,3], \"d\":{}})" + "]", _logsTestData.DataTimeRange); - LogsQueryResultRow row = results.Value.Table.Rows[0]; + LogsTableRow row = results.Value.Table.Rows[0]; var expectedDate = DateTimeOffset.Parse("2015-12-31 23:59:59.9+00:00"); Assert.AreEqual(expectedDate, row.GetDateTimeOffset("DateTime")); diff --git a/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientSamples.cs b/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientSamples.cs index 8fe8509a84f11..e86da46342b21 100644 --- a/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientSamples.cs +++ b/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientSamples.cs @@ -31,7 +31,7 @@ public async Task QueryLogsAsTable() "AzureActivity | top 10 by TimeGenerated", new DateTimeRange(TimeSpan.FromDays(1))); - LogsQueryResultTable table = response.Value.Table; + LogsTable table = response.Value.Table; foreach (var row in table.Rows) { @@ -58,7 +58,7 @@ public async Task QueryLogsAsTablePrintAll() "AzureActivity | top 10 by TimeGenerated", new DateTimeRange(TimeSpan.FromDays(1))); - LogsQueryResultTable table = response.Value.Table; + LogsTable table = response.Value.Table; foreach (var column in table.Columns) { diff --git a/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs b/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs index 6bdd28b49ec88..304440dd34f6a 100644 --- a/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs +++ b/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs @@ -57,7 +57,7 @@ public async Task CanQueryMetrics() new MetricsQueryOptions() { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.StartTime, duration) + TimeRange = new DateTimeRange(_testData.StartTime, duration) }); var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; @@ -80,7 +80,7 @@ public async Task CanQueryMetricsAllAggregations() new MetricsQueryOptions { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.StartTime, _testData.StartTime.Add(_testData.Duration)), + TimeRange = new DateTimeRange(_testData.StartTime, _testData.StartTime.Add(_testData.Duration)), Aggregations = { MetricAggregationType.Average, @@ -113,7 +113,7 @@ public async Task CanQueryMetricsStartEnd() new MetricsQueryOptions { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.StartTime, _testData.EndTime), + TimeRange = new DateTimeRange(_testData.StartTime, _testData.EndTime), }); var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; @@ -133,7 +133,7 @@ public async Task CanQueryMetricsStartDuration() new MetricsQueryOptions { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.StartTime, _testData.Duration) + TimeRange = new DateTimeRange(_testData.StartTime, _testData.Duration) }); var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; @@ -153,7 +153,7 @@ public async Task CanQueryMetricsDurationEnd() new MetricsQueryOptions { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.Duration, _testData.EndTime) + TimeRange = new DateTimeRange(_testData.Duration, _testData.EndTime) }); var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; @@ -190,8 +190,8 @@ public async Task CanQueryMetricsStartEndInterval() new MetricsQueryOptions { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.StartTime, _testData.EndTime), - Interval = TimeSpan.FromMinutes(5) + TimeRange = new DateTimeRange(_testData.StartTime, _testData.EndTime), + Granularity = TimeSpan.FromMinutes(5) }); var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; @@ -211,7 +211,7 @@ public async Task CanQueryMetricsFilter() new MetricsQueryOptions { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.StartTime, _testData.EndTime), + TimeRange = new DateTimeRange(_testData.StartTime, _testData.EndTime), Filter = $"Name eq '{_testData.Name1}'", Aggregations = { @@ -234,7 +234,7 @@ public async Task CanQueryMetricsFilterTop() new MetricsQueryOptions { MetricNamespace = _testData.MetricNamespace, - TimeSpan = new DateTimeRange(_testData.StartTime, _testData.EndTime), + TimeRange = new DateTimeRange(_testData.StartTime, _testData.EndTime), Filter = $"Name eq '*'", Top = 1, Aggregations = diff --git a/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs b/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs index a471905f4645f..1c2e2d3388237 100644 --- a/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs +++ b/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs @@ -110,9 +110,9 @@ private async Task MetricsPropagated(MetricsQueryClient metricQueryClient) var metrics = await metricQueryClient.QueryAsync(_testEnvironment.MetricsResource, new[] {MetricName}, new MetricsQueryOptions() { - TimeSpan = new DateTimeRange(StartTime, Duration), + TimeRange = new DateTimeRange(StartTime, Duration), MetricNamespace = MetricNamespace, - Interval = TimeSpan.FromMinutes(1), + Granularity = TimeSpan.FromMinutes(1), Aggregations = { MetricAggregationType.Count