From f2c56e59e60cd1a42d2d6f5aa14e1c0dbff48db6 Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Fri, 1 Sep 2023 16:05:14 -0700
Subject: [PATCH 01/36] wip
---
.../src/Generated/MetricsBatchRestClient.cs | 227 +++++++
...ditionalInfoErrorResponse.Serialization.cs | 33 +
.../Models/AdditionalInfoErrorResponse.cs | 29 +
...nalInfoErrorResponseError.Serialization.cs | 55 ++
.../AdditionalInfoErrorResponseError.cs | 49 ++
...seErrorAdditionalInfoItem.Serialization.cs | 39 ++
...nfoErrorResponseErrorAdditionalInfoItem.cs | 32 +
.../MetricResultsResponse.Serialization.cs | 43 ++
.../Generated/Models/MetricResultsResponse.cs | 32 +
...ResultsResponseValuesItem.Serialization.cs | 80 +++
.../Models/MetricResultsResponseValuesItem.cs | 68 +++
...eryBatchLocalizableString.Serialization.cs | 39 ++
.../Models/QueryBatchLocalizableString.cs | 40 ++
.../QueryBatchMetadataValue.Serialization.cs | 43 ++
.../Models/QueryBatchMetadataValue.cs | 32 +
.../Models/QueryBatchMetric.Serialization.cs | 81 +++
.../src/Generated/Models/QueryBatchMetric.cs | 80 +++
.../QueryBatchMetricUnit.Serialization.cs | 50 ++
.../Generated/Models/QueryBatchMetricUnit.cs | 40 ++
.../QueryBatchMetricValue.Serialization.cs | 84 +++
.../Generated/Models/QueryBatchMetricValue.cs | 52 ++
...eryBatchTimeSeriesElement.Serialization.cs | 58 ++
.../Models/QueryBatchTimeSeriesElement.cs | 37 ++
.../Models/ResourceIdList.Serialization.cs | 36 ++
.../src/Generated/Models/ResourceIdList.cs | 25 +
.../src/Generated/MonitorQueryModelFactory.cs | 88 +++
.../Azure.Monitor.Query/src/autorest.md | 1 +
.../Azure.Monitor.Query/src/metricBatch.json | 562 ++++++++++++++++++
28 files changed, 2035 insertions(+)
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/MetricsBatchRestClient.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.Serialization.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/metricBatch.json
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/MetricsBatchRestClient.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/MetricsBatchRestClient.cs
new file mode 100644
index 000000000000..4f9968e3a3fb
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/MetricsBatchRestClient.cs
@@ -0,0 +1,227 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using System.Threading;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Core.Pipeline;
+using Azure.Monitor.Query.Models;
+
+namespace Azure.Monitor.Query
+{
+ internal partial class MetricsBatchRestClient
+ {
+ private readonly HttpPipeline _pipeline;
+ private readonly Uri _endpoint;
+
+ /// The ClientDiagnostics is used to provide tracing support for the client library.
+ internal ClientDiagnostics ClientDiagnostics { get; }
+
+ /// Initializes a new instance of MetricsBatchRestClient.
+ /// The handler for diagnostic messaging in the client.
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ /// The regional endpoint to use, for example https://eastus.metrics.monitor.azure.com. The region should match the region of the requested resources. For global resources, the region should be 'global'.
+ /// , or is null.
+ public MetricsBatchRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint)
+ {
+ ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
+ _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
+ _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
+ }
+
+ internal HttpMessage CreateBatchRequest(string subscriptionId, string metricnamespace, IEnumerable metricnames, ResourceIdList resourceIds, string starttime, string endtime, TimeSpan? interval, string aggregation, int? top, string orderby, string filter)
+ {
+ var message = _pipeline.CreateMessage();
+ var request = message.Request;
+ request.Method = RequestMethod.Post;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/subscriptions/", false);
+ uri.AppendPath(subscriptionId, true);
+ uri.AppendPath("/metrics:getBatch", false);
+ if (starttime != null)
+ {
+ uri.AppendQuery("starttime", starttime, true);
+ }
+ if (endtime != null)
+ {
+ uri.AppendQuery("endtime", endtime, true);
+ }
+ if (interval != null)
+ {
+ uri.AppendQuery("interval", interval.Value, "P", true);
+ }
+ uri.AppendQuery("metricnamespace", metricnamespace, true);
+ if (metricnames != null && Optional.IsCollectionDefined(metricnames))
+ {
+ uri.AppendQueryDelimited("metricnames", metricnames, ",", true);
+ }
+ if (aggregation != null)
+ {
+ uri.AppendQuery("aggregation", aggregation, true);
+ }
+ if (top != null)
+ {
+ uri.AppendQuery("top", top.Value, true);
+ }
+ if (orderby != null)
+ {
+ uri.AppendQuery("orderby", orderby, true);
+ }
+ if (filter != null)
+ {
+ uri.AppendQuery("filter", filter, true);
+ }
+ uri.AppendQuery("api-version", "2023-05-01-preview", true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ request.Headers.Add("Content-Type", "application/json");
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(resourceIds);
+ request.Content = content;
+ return message;
+ }
+
+ /// Lists the metric values for multiple resources.
+ /// The subscription identifier for the resources in this batch.
+ /// Metric namespace that contains the requested metric names.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// The comma separated list of resource IDs to query metrics for.
+ ///
+ /// The start time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'. If you have specified the endtime parameter, then this parameter is required.
+ /// If only starttime is specified, then endtime defaults to the current time.
+ /// If no time interval is specified, the default is 1 hour.
+ ///
+ /// The end time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'.
+ ///
+ /// The interval (i.e. timegrain) of the query.
+ /// *Examples: PT15M, PT1H, P1D*
+ ///
+ ///
+ /// The list of aggregation types (comma separated) to retrieve.
+ /// *Examples: average, minimum, maximum*
+ ///
+ ///
+ /// The maximum number of records to retrieve per resource ID in the request.
+ /// Valid only if filter is specified.
+ /// Defaults to 10.
+ ///
+ ///
+ /// The aggregation to use for sorting results and the direction of the sort.
+ /// Only one order can be specified.
+ /// *Examples: sum asc*
+ ///
+ /// The filter is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public async Task> BatchAsync(string subscriptionId, string metricnamespace, IEnumerable metricnames, ResourceIdList resourceIds, string starttime = null, string endtime = null, TimeSpan? interval = null, string aggregation = null, int? top = null, string orderby = null, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ if (metricnamespace == null)
+ {
+ throw new ArgumentNullException(nameof(metricnamespace));
+ }
+ if (metricnames == null)
+ {
+ throw new ArgumentNullException(nameof(metricnames));
+ }
+ if (resourceIds == null)
+ {
+ throw new ArgumentNullException(nameof(resourceIds));
+ }
+
+ using var message = CreateBatchRequest(subscriptionId, metricnamespace, metricnames, resourceIds, starttime, endtime, interval, aggregation, top, orderby, filter);
+ await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricResultsResponse value = default;
+ using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
+ value = MetricResultsResponse.DeserializeMetricResultsResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+
+ /// Lists the metric values for multiple resources.
+ /// The subscription identifier for the resources in this batch.
+ /// Metric namespace that contains the requested metric names.
+ /// The names of the metrics (comma separated) to retrieve.
+ /// The comma separated list of resource IDs to query metrics for.
+ ///
+ /// The start time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'. If you have specified the endtime parameter, then this parameter is required.
+ /// If only starttime is specified, then endtime defaults to the current time.
+ /// If no time interval is specified, the default is 1 hour.
+ ///
+ /// The end time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'.
+ ///
+ /// The interval (i.e. timegrain) of the query.
+ /// *Examples: PT15M, PT1H, P1D*
+ ///
+ ///
+ /// The list of aggregation types (comma separated) to retrieve.
+ /// *Examples: average, minimum, maximum*
+ ///
+ ///
+ /// The maximum number of records to retrieve per resource ID in the request.
+ /// Valid only if filter is specified.
+ /// Defaults to 10.
+ ///
+ ///
+ /// The aggregation to use for sorting results and the direction of the sort.
+ /// Only one order can be specified.
+ /// *Examples: sum asc*
+ ///
+ /// The filter is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.
+ /// The cancellation token to use.
+ /// , , or is null.
+ public Response Batch(string subscriptionId, string metricnamespace, IEnumerable metricnames, ResourceIdList resourceIds, string starttime = null, string endtime = null, TimeSpan? interval = null, string aggregation = null, int? top = null, string orderby = null, string filter = null, CancellationToken cancellationToken = default)
+ {
+ if (subscriptionId == null)
+ {
+ throw new ArgumentNullException(nameof(subscriptionId));
+ }
+ if (metricnamespace == null)
+ {
+ throw new ArgumentNullException(nameof(metricnamespace));
+ }
+ if (metricnames == null)
+ {
+ throw new ArgumentNullException(nameof(metricnames));
+ }
+ if (resourceIds == null)
+ {
+ throw new ArgumentNullException(nameof(resourceIds));
+ }
+
+ using var message = CreateBatchRequest(subscriptionId, metricnamespace, metricnames, resourceIds, starttime, endtime, interval, aggregation, top, orderby, filter);
+ _pipeline.Send(message, cancellationToken);
+ switch (message.Response.Status)
+ {
+ case 200:
+ {
+ MetricResultsResponse value = default;
+ using var document = JsonDocument.Parse(message.Response.ContentStream);
+ value = MetricResultsResponse.DeserializeMetricResultsResponse(document.RootElement);
+ return Response.FromValue(value, message.Response);
+ }
+ default:
+ throw new RequestFailedException(message.Response);
+ }
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.Serialization.cs
new file mode 100644
index 000000000000..7ba720e24ad3
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.Serialization.cs
@@ -0,0 +1,33 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ internal partial class AdditionalInfoErrorResponse
+ {
+ internal static AdditionalInfoErrorResponse DeserializeAdditionalInfoErrorResponse(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ AdditionalInfoErrorResponseError error = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("error"u8))
+ {
+ error = AdditionalInfoErrorResponseError.DeserializeAdditionalInfoErrorResponseError(property.Value);
+ continue;
+ }
+ }
+ return new AdditionalInfoErrorResponse(error);
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.cs
new file mode 100644
index 000000000000..c88e253b8bf2
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponse.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The response to a metrics query that results in a bad request, with optional additional information.
+ internal partial class AdditionalInfoErrorResponse
+ {
+ /// Initializes a new instance of AdditionalInfoErrorResponse.
+ /// Top level error object that contains all relevant information.
+ /// is null.
+ internal AdditionalInfoErrorResponse(AdditionalInfoErrorResponseError error)
+ {
+ Argument.AssertNotNull(error, nameof(error));
+
+ Error = error;
+ }
+
+ /// Top level error object that contains all relevant information.
+ public AdditionalInfoErrorResponseError Error { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.Serialization.cs
new file mode 100644
index 000000000000..6fbb6ffd3697
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.Serialization.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ internal partial class AdditionalInfoErrorResponseError
+ {
+ internal static AdditionalInfoErrorResponseError DeserializeAdditionalInfoErrorResponseError(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Optional> additionalInfo = default;
+ string code = default;
+ string message = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("additionalInfo"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(AdditionalInfoErrorResponseErrorAdditionalInfoItem.DeserializeAdditionalInfoErrorResponseErrorAdditionalInfoItem(item));
+ }
+ additionalInfo = array;
+ continue;
+ }
+ if (property.NameEquals("code"u8))
+ {
+ code = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("message"u8))
+ {
+ message = property.Value.GetString();
+ continue;
+ }
+ }
+ return new AdditionalInfoErrorResponseError(Optional.ToList(additionalInfo), code, message);
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.cs
new file mode 100644
index 000000000000..9a9e3b59cea4
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseError.cs
@@ -0,0 +1,49 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// Top level error object that contains all relevant information.
+ internal partial class AdditionalInfoErrorResponseError
+ {
+ /// Initializes a new instance of AdditionalInfoErrorResponseError.
+ /// Error code.
+ /// Error message indicating why the operation failed.
+ /// or is null.
+ internal AdditionalInfoErrorResponseError(string code, string message)
+ {
+ Argument.AssertNotNull(code, nameof(code));
+ Argument.AssertNotNull(message, nameof(message));
+
+ AdditionalInfo = new ChangeTrackingList();
+ Code = code;
+ Message = message;
+ }
+
+ /// Initializes a new instance of AdditionalInfoErrorResponseError.
+ /// Additional information about the error.
+ /// Error code.
+ /// Error message indicating why the operation failed.
+ internal AdditionalInfoErrorResponseError(IReadOnlyList additionalInfo, string code, string message)
+ {
+ AdditionalInfo = additionalInfo;
+ Code = code;
+ Message = message;
+ }
+
+ /// Additional information about the error.
+ public IReadOnlyList AdditionalInfo { get; }
+ /// Error code.
+ public string Code { get; }
+ /// Error message indicating why the operation failed.
+ public string Message { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.Serialization.cs
new file mode 100644
index 000000000000..7b5f218f7af4
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.Serialization.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ internal partial class AdditionalInfoErrorResponseErrorAdditionalInfoItem
+ {
+ internal static AdditionalInfoErrorResponseErrorAdditionalInfoItem DeserializeAdditionalInfoErrorResponseErrorAdditionalInfoItem(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Optional type = default;
+ Optional info = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("info"u8))
+ {
+ info = property.Value.GetString();
+ continue;
+ }
+ }
+ return new AdditionalInfoErrorResponseErrorAdditionalInfoItem(type.Value, info.Value);
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.cs
new file mode 100644
index 000000000000..eda896e6ff82
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/AdditionalInfoErrorResponseErrorAdditionalInfoItem.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The AdditionalInfoErrorResponseErrorAdditionalInfoItem.
+ internal partial class AdditionalInfoErrorResponseErrorAdditionalInfoItem
+ {
+ /// Initializes a new instance of AdditionalInfoErrorResponseErrorAdditionalInfoItem.
+ internal AdditionalInfoErrorResponseErrorAdditionalInfoItem()
+ {
+ }
+
+ /// Initializes a new instance of AdditionalInfoErrorResponseErrorAdditionalInfoItem.
+ /// The type of the info property (e.g. string).
+ /// Additional information related to the error.
+ internal AdditionalInfoErrorResponseErrorAdditionalInfoItem(string type, string info)
+ {
+ Type = type;
+ Info = info;
+ }
+
+ /// The type of the info property (e.g. string).
+ public string Type { get; }
+ /// Additional information related to the error.
+ public string Info { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.Serialization.cs
new file mode 100644
index 000000000000..cac5dbf5e6b7
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.Serialization.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class MetricResultsResponse
+ {
+ internal static MetricResultsResponse DeserializeMetricResultsResponse(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Optional> values = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("values"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(MetricResultsResponseValuesItem.DeserializeMetricResultsResponseValuesItem(item));
+ }
+ values = array;
+ continue;
+ }
+ }
+ return new MetricResultsResponse(Optional.ToList(values));
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.cs
new file mode 100644
index 000000000000..f9b129a01dbf
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponse.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The metrics result for a resource.
+ public partial class MetricResultsResponse
+ {
+ /// Initializes a new instance of MetricResultsResponse.
+ internal MetricResultsResponse()
+ {
+ Values = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of MetricResultsResponse.
+ /// The collection of metric data responses per resource, per metric.
+ internal MetricResultsResponse(IReadOnlyList values)
+ {
+ Values = values;
+ }
+
+ /// The collection of metric data responses per resource, per metric.
+ public IReadOnlyList Values { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.Serialization.cs
new file mode 100644
index 000000000000..de68768b0929
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.Serialization.cs
@@ -0,0 +1,80 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class MetricResultsResponseValuesItem
+ {
+ internal static MetricResultsResponseValuesItem DeserializeMetricResultsResponseValuesItem(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string starttime = default;
+ string endtime = default;
+ Optional interval = default;
+ Optional @namespace = default;
+ Optional resourceregion = default;
+ Optional resourceid = default;
+ IReadOnlyList value = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("starttime"u8))
+ {
+ starttime = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("endtime"u8))
+ {
+ endtime = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("interval"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ interval = property.Value.GetTimeSpan("P");
+ continue;
+ }
+ if (property.NameEquals("namespace"u8))
+ {
+ @namespace = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("resourceregion"u8))
+ {
+ resourceregion = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("resourceid"u8))
+ {
+ resourceid = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("value"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(QueryBatchMetric.DeserializeQueryBatchMetric(item));
+ }
+ value = array;
+ continue;
+ }
+ }
+ return new MetricResultsResponseValuesItem(starttime, endtime, Optional.ToNullable(interval), @namespace.Value, resourceregion.Value, resourceid.Value, value);
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.cs
new file mode 100644
index 000000000000..fa77cd65b910
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricResultsResponseValuesItem.cs
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The MetricResultsResponseValuesItem.
+ public partial class MetricResultsResponseValuesItem
+ {
+ /// Initializes a new instance of MetricResultsResponseValuesItem.
+ /// The start time, in datetime format, for which the data was retrieved.
+ /// The end time, in datetime format, for which the data was retrieved.
+ /// The value of the collection.
+ /// , or is null.
+ internal MetricResultsResponseValuesItem(string starttime, string endtime, IEnumerable value)
+ {
+ Argument.AssertNotNull(starttime, nameof(starttime));
+ Argument.AssertNotNull(endtime, nameof(endtime));
+ Argument.AssertNotNull(value, nameof(value));
+
+ Starttime = starttime;
+ Endtime = endtime;
+ Value = value.ToList();
+ }
+
+ /// Initializes a new instance of MetricResultsResponseValuesItem.
+ /// The start time, in datetime format, for which the data was retrieved.
+ /// The end time, in datetime format, for which the data was retrieved.
+ /// The interval (window size) for which the metric data was returned in. Follows the IS8601/RFC3339 duration format (e.g. 'P1D' for 1 day). This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made.
+ /// The namespace of the metrics been queried.
+ /// The region of the resource been queried for metrics.
+ /// The resource that has been queried for metrics.
+ /// The value of the collection.
+ internal MetricResultsResponseValuesItem(string starttime, string endtime, TimeSpan? interval, string @namespace, string resourceregion, string resourceid, IReadOnlyList value)
+ {
+ Starttime = starttime;
+ Endtime = endtime;
+ Interval = interval;
+ Namespace = @namespace;
+ Resourceregion = resourceregion;
+ Resourceid = resourceid;
+ Value = value;
+ }
+
+ /// The start time, in datetime format, for which the data was retrieved.
+ public string Starttime { get; }
+ /// The end time, in datetime format, for which the data was retrieved.
+ public string Endtime { get; }
+ /// The interval (window size) for which the metric data was returned in. Follows the IS8601/RFC3339 duration format (e.g. 'P1D' for 1 day). This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made.
+ public TimeSpan? Interval { get; }
+ /// The namespace of the metrics been queried.
+ public string Namespace { get; }
+ /// The region of the resource been queried for metrics.
+ public string Resourceregion { get; }
+ /// The resource that has been queried for metrics.
+ public string Resourceid { get; }
+ /// The value of the collection.
+ public IReadOnlyList Value { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.Serialization.cs
new file mode 100644
index 000000000000..ec5865be531c
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.Serialization.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class QueryBatchLocalizableString
+ {
+ internal static QueryBatchLocalizableString DeserializeQueryBatchLocalizableString(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string value = default;
+ Optional localizedValue = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("value"u8))
+ {
+ value = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("localizedValue"u8))
+ {
+ localizedValue = property.Value.GetString();
+ continue;
+ }
+ }
+ return new QueryBatchLocalizableString(value, localizedValue.Value);
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.cs
new file mode 100644
index 000000000000..ea2db1594e6b
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchLocalizableString.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The localizable string class.
+ public partial class QueryBatchLocalizableString
+ {
+ /// Initializes a new instance of QueryBatchLocalizableString.
+ /// The invariant value.
+ /// is null.
+ internal QueryBatchLocalizableString(string value)
+ {
+ Argument.AssertNotNull(value, nameof(value));
+
+ Value = value;
+ }
+
+ /// Initializes a new instance of QueryBatchLocalizableString.
+ /// The invariant value.
+ /// The display name.
+ internal QueryBatchLocalizableString(string value, string localizedValue)
+ {
+ Value = value;
+ LocalizedValue = localizedValue;
+ }
+
+ /// The invariant value.
+ public string Value { get; }
+ /// The display name.
+ public string LocalizedValue { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.Serialization.cs
new file mode 100644
index 000000000000..257ba6da9b85
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.Serialization.cs
@@ -0,0 +1,43 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class QueryBatchMetadataValue
+ {
+ internal static QueryBatchMetadataValue DeserializeQueryBatchMetadataValue(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Optional name = default;
+ Optional value = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("name"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ name = QueryBatchLocalizableString.DeserializeQueryBatchLocalizableString(property.Value);
+ continue;
+ }
+ if (property.NameEquals("value"u8))
+ {
+ value = property.Value.GetString();
+ continue;
+ }
+ }
+ return new QueryBatchMetadataValue(name.Value, value.Value);
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.cs
new file mode 100644
index 000000000000..d61fd87d4cc8
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetadataValue.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Monitor.Query.Models
+{
+ /// Represents a metric metadata value.
+ public partial class QueryBatchMetadataValue
+ {
+ /// Initializes a new instance of QueryBatchMetadataValue.
+ internal QueryBatchMetadataValue()
+ {
+ }
+
+ /// Initializes a new instance of QueryBatchMetadataValue.
+ /// The name of the metadata.
+ /// The value of the metadata.
+ internal QueryBatchMetadataValue(QueryBatchLocalizableString name, string value)
+ {
+ Name = name;
+ Value = value;
+ }
+
+ /// The name of the metadata.
+ public QueryBatchLocalizableString Name { get; }
+ /// The value of the metadata.
+ public string Value { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.Serialization.cs
new file mode 100644
index 000000000000..99e7839d2bf6
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.Serialization.cs
@@ -0,0 +1,81 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class QueryBatchMetric
+ {
+ internal static QueryBatchMetric DeserializeQueryBatchMetric(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ QueryBatchLocalizableString name = default;
+ string displayDescription = default;
+ string type = default;
+ QueryBatchMetricUnit unit = default;
+ IReadOnlyList timeseries = default;
+ Optional errorCode = default;
+ Optional errorMessage = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("name"u8))
+ {
+ name = QueryBatchLocalizableString.DeserializeQueryBatchLocalizableString(property.Value);
+ continue;
+ }
+ if (property.NameEquals("displayDescription"u8))
+ {
+ displayDescription = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("type"u8))
+ {
+ type = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("unit"u8))
+ {
+ unit = property.Value.GetString().ToQueryBatchMetricUnit();
+ continue;
+ }
+ if (property.NameEquals("timeseries"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(QueryBatchTimeSeriesElement.DeserializeQueryBatchTimeSeriesElement(item));
+ }
+ timeseries = array;
+ continue;
+ }
+ if (property.NameEquals("errorCode"u8))
+ {
+ errorCode = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("errorMessage"u8))
+ {
+ errorMessage = property.Value.GetString();
+ continue;
+ }
+ }
+ return new QueryBatchMetric(id, name, displayDescription, type, unit, timeseries, errorCode.Value, errorMessage.Value);
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.cs
new file mode 100644
index 000000000000..b9749f23b2fa
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetric.cs
@@ -0,0 +1,80 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The result data of a query.
+ public partial class QueryBatchMetric
+ {
+ /// Initializes a new instance of QueryBatchMetric.
+ /// The metric Id.
+ /// The name and the display name of the metric, i.e. it is localizable string.
+ /// Description of this metric.
+ /// The resource type of the metric resource.
+ /// The unit of the metric.
+ /// The time series returned when a data query is performed.
+ /// , , , or is null.
+ internal QueryBatchMetric(string id, QueryBatchLocalizableString name, string displayDescription, string type, QueryBatchMetricUnit unit, IEnumerable timeseries)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(name, nameof(name));
+ Argument.AssertNotNull(displayDescription, nameof(displayDescription));
+ Argument.AssertNotNull(type, nameof(type));
+ Argument.AssertNotNull(timeseries, nameof(timeseries));
+
+ Id = id;
+ Name = name;
+ DisplayDescription = displayDescription;
+ Type = type;
+ Unit = unit;
+ Timeseries = timeseries.ToList();
+ }
+
+ /// Initializes a new instance of QueryBatchMetric.
+ /// The metric Id.
+ /// The name and the display name of the metric, i.e. it is localizable string.
+ /// Description of this metric.
+ /// The resource type of the metric resource.
+ /// The unit of the metric.
+ /// The time series returned when a data query is performed.
+ /// 'Success' or the error details on query failures for this metric.
+ /// Error message encountered querying this specific metric.
+ internal QueryBatchMetric(string id, QueryBatchLocalizableString name, string displayDescription, string type, QueryBatchMetricUnit unit, IReadOnlyList timeseries, string errorCode, string errorMessage)
+ {
+ Id = id;
+ Name = name;
+ DisplayDescription = displayDescription;
+ Type = type;
+ Unit = unit;
+ Timeseries = timeseries;
+ ErrorCode = errorCode;
+ ErrorMessage = errorMessage;
+ }
+
+ /// The metric Id.
+ public string Id { get; }
+ /// The name and the display name of the metric, i.e. it is localizable string.
+ public QueryBatchLocalizableString Name { get; }
+ /// Description of this metric.
+ public string DisplayDescription { get; }
+ /// The resource type of the metric resource.
+ public string Type { get; }
+ /// The unit of the metric.
+ public QueryBatchMetricUnit Unit { get; }
+ /// The time series returned when a data query is performed.
+ public IReadOnlyList Timeseries { get; }
+ /// 'Success' or the error details on query failures for this metric.
+ public string ErrorCode { get; }
+ /// Error message encountered querying this specific metric.
+ public string ErrorMessage { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.Serialization.cs
new file mode 100644
index 000000000000..be5c87bb0d61
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.Serialization.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.Monitor.Query.Models
+{
+ internal static partial class QueryBatchMetricUnitExtensions
+ {
+ public static string ToSerialString(this QueryBatchMetricUnit value) => value switch
+ {
+ QueryBatchMetricUnit.Count => "Count",
+ QueryBatchMetricUnit.Bytes => "Bytes",
+ QueryBatchMetricUnit.Seconds => "Seconds",
+ QueryBatchMetricUnit.CountPerSecond => "CountPerSecond",
+ QueryBatchMetricUnit.BytesPerSecond => "BytesPerSecond",
+ QueryBatchMetricUnit.Percent => "Percent",
+ QueryBatchMetricUnit.MilliSeconds => "MilliSeconds",
+ QueryBatchMetricUnit.ByteSeconds => "ByteSeconds",
+ QueryBatchMetricUnit.Unspecified => "Unspecified",
+ QueryBatchMetricUnit.Cores => "Cores",
+ QueryBatchMetricUnit.MilliCores => "MilliCores",
+ QueryBatchMetricUnit.NanoCores => "NanoCores",
+ QueryBatchMetricUnit.BitsPerSecond => "BitsPerSecond",
+ _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown QueryBatchMetricUnit value.")
+ };
+
+ public static QueryBatchMetricUnit ToQueryBatchMetricUnit(this string value)
+ {
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "Count")) return QueryBatchMetricUnit.Count;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "Bytes")) return QueryBatchMetricUnit.Bytes;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "Seconds")) return QueryBatchMetricUnit.Seconds;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "CountPerSecond")) return QueryBatchMetricUnit.CountPerSecond;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "BytesPerSecond")) return QueryBatchMetricUnit.BytesPerSecond;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "Percent")) return QueryBatchMetricUnit.Percent;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "MilliSeconds")) return QueryBatchMetricUnit.MilliSeconds;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "ByteSeconds")) return QueryBatchMetricUnit.ByteSeconds;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "Unspecified")) return QueryBatchMetricUnit.Unspecified;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "Cores")) return QueryBatchMetricUnit.Cores;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "MilliCores")) return QueryBatchMetricUnit.MilliCores;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "NanoCores")) return QueryBatchMetricUnit.NanoCores;
+ if (StringComparer.OrdinalIgnoreCase.Equals(value, "BitsPerSecond")) return QueryBatchMetricUnit.BitsPerSecond;
+ throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown QueryBatchMetricUnit value.");
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.cs
new file mode 100644
index 000000000000..dbf5f5240d09
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricUnit.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The unit of the metric.
+ public enum QueryBatchMetricUnit
+ {
+ /// Unit of raw quantity.
+ Count,
+ /// Unit of memory in bytes.
+ Bytes,
+ /// Unit of time in seconds.
+ Seconds,
+ /// Rate unit of raw quantity per second.
+ CountPerSecond,
+ /// Rate unit of memory in bytes per second.
+ BytesPerSecond,
+ /// Percentage unit.
+ Percent,
+ /// Unit of time in 1/1000th of a second.
+ MilliSeconds,
+ /// Unit of data transfer or storage. It is the size of the data in bytes multiplied by the time it takes to transfer or store the data in seconds.
+ ByteSeconds,
+ /// No specified unit.
+ Unspecified,
+ /// Unit of processing power.
+ Cores,
+ /// Unit of processing power in 1/1000th of a CPU core.
+ MilliCores,
+ /// Unit of processing power in one billionth of a CPU core.
+ NanoCores,
+ /// Rate unit of binary digits per second.
+ BitsPerSecond
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.Serialization.cs
new file mode 100644
index 000000000000..9fe6b5755e78
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.Serialization.cs
@@ -0,0 +1,84 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class QueryBatchMetricValue
+ {
+ internal static QueryBatchMetricValue DeserializeQueryBatchMetricValue(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ DateTimeOffset timeStamp = default;
+ Optional average = default;
+ Optional minimum = default;
+ Optional maximum = default;
+ Optional total = default;
+ Optional count = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("timeStamp"u8))
+ {
+ timeStamp = property.Value.GetDateTimeOffset("O");
+ continue;
+ }
+ if (property.NameEquals("average"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ average = property.Value.GetDouble();
+ continue;
+ }
+ if (property.NameEquals("minimum"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ minimum = property.Value.GetDouble();
+ continue;
+ }
+ if (property.NameEquals("maximum"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ maximum = property.Value.GetDouble();
+ continue;
+ }
+ if (property.NameEquals("total"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ total = property.Value.GetDouble();
+ continue;
+ }
+ if (property.NameEquals("count"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ count = property.Value.GetDouble();
+ continue;
+ }
+ }
+ return new QueryBatchMetricValue(timeStamp, Optional.ToNullable(average), Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(total), Optional.ToNullable(count));
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.cs
new file mode 100644
index 000000000000..4f2d798ab131
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchMetricValue.cs
@@ -0,0 +1,52 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// Represents a metric value.
+ public partial class QueryBatchMetricValue
+ {
+ /// Initializes a new instance of QueryBatchMetricValue.
+ /// The timestamp for the metric value in ISO 8601 format.
+ internal QueryBatchMetricValue(DateTimeOffset timeStamp)
+ {
+ TimeStamp = timeStamp;
+ }
+
+ /// Initializes a new instance of QueryBatchMetricValue.
+ /// The timestamp for the metric value in ISO 8601 format.
+ /// The average value in the time range.
+ /// The least value in the time range.
+ /// The greatest value in the time range.
+ /// The sum of all of the values in the time range.
+ /// The number of samples in the time range. Can be used to determine the number of values that contributed to the average value.
+ internal QueryBatchMetricValue(DateTimeOffset timeStamp, double? average, double? minimum, double? maximum, double? total, double? count)
+ {
+ TimeStamp = timeStamp;
+ Average = average;
+ Minimum = minimum;
+ Maximum = maximum;
+ Total = total;
+ Count = count;
+ }
+
+ /// The timestamp for the metric value in ISO 8601 format.
+ public DateTimeOffset TimeStamp { get; }
+ /// The average value in the time range.
+ public double? Average { get; }
+ /// The least value in the time range.
+ public double? Minimum { get; }
+ /// The greatest value in the time range.
+ public double? Maximum { get; }
+ /// The sum of all of the values in the time range.
+ public double? Total { get; }
+ /// The number of samples in the time range. Can be used to determine the number of values that contributed to the average value.
+ public double? Count { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.Serialization.cs
new file mode 100644
index 000000000000..38f5770feae5
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.Serialization.cs
@@ -0,0 +1,58 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class QueryBatchTimeSeriesElement
+ {
+ internal static QueryBatchTimeSeriesElement DeserializeQueryBatchTimeSeriesElement(JsonElement element)
+ {
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ Optional> metadatavalues = default;
+ Optional> data = default;
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("metadatavalues"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(QueryBatchMetadataValue.DeserializeQueryBatchMetadataValue(item));
+ }
+ metadatavalues = array;
+ continue;
+ }
+ if (property.NameEquals("data"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(QueryBatchMetricValue.DeserializeQueryBatchMetricValue(item));
+ }
+ data = array;
+ continue;
+ }
+ }
+ return new QueryBatchTimeSeriesElement(Optional.ToList(metadatavalues), Optional.ToList(data));
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.cs
new file mode 100644
index 000000000000..8c1578b83bbd
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/QueryBatchTimeSeriesElement.cs
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// A time series result type. The discriminator value is always TimeSeries in this case.
+ public partial class QueryBatchTimeSeriesElement
+ {
+ /// Initializes a new instance of QueryBatchTimeSeriesElement.
+ internal QueryBatchTimeSeriesElement()
+ {
+ Metadatavalues = new ChangeTrackingList();
+ Data = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of QueryBatchTimeSeriesElement.
+ /// The metadata values returned if filter was specified in the call.
+ /// An array of data points representing the metric values. This is only returned if a result type of data is specified.
+ internal QueryBatchTimeSeriesElement(IReadOnlyList metadatavalues, IReadOnlyList data)
+ {
+ Metadatavalues = metadatavalues;
+ Data = data;
+ }
+
+ /// The metadata values returned if filter was specified in the call.
+ public IReadOnlyList Metadatavalues { get; }
+ /// An array of data points representing the metric values. This is only returned if a result type of data is specified.
+ public IReadOnlyList Data { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.Serialization.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.Serialization.cs
new file mode 100644
index 000000000000..ccbf1841cde1
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.Serialization.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Text.Json;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ public partial class ResourceIdList : IUtf8JsonSerializable
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
+ {
+ writer.WriteStartObject();
+ if (Optional.IsCollectionDefined(Resourceids))
+ {
+ writer.WritePropertyName("resourceids"u8);
+ writer.WriteStartArray();
+ foreach (var item in Resourceids)
+ {
+ if (item == null)
+ {
+ writer.WriteNullValue();
+ continue;
+ }
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ writer.WriteEndObject();
+ }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.cs
new file mode 100644
index 000000000000..92540028cbe7
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/ResourceIdList.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.Monitor.Query.Models
+{
+ /// The comma separated list of resource IDs to query metrics for.
+ public partial class ResourceIdList
+ {
+ /// Initializes a new instance of ResourceIdList.
+ public ResourceIdList()
+ {
+ Resourceids = new ChangeTrackingList();
+ }
+
+ /// The list of resource IDs to query metrics for.
+ public IList Resourceids { get; }
+ }
+}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/MonitorQueryModelFactory.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/MonitorQueryModelFactory.cs
index 15e6f27bd309..ed78eec94f65 100644
--- a/sdk/monitor/Azure.Monitor.Query/src/Generated/MonitorQueryModelFactory.cs
+++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/MonitorQueryModelFactory.cs
@@ -6,6 +6,8 @@
#nullable disable
using System;
+using System.Collections.Generic;
+using System.Linq;
namespace Azure.Monitor.Query.Models
{
@@ -35,5 +37,91 @@ public static MetricAvailability MetricAvailability(TimeSpan? granularity = null
{
return new MetricAvailability(granularity, retention);
}
+
+ /// Initializes a new instance of MetricResultsResponse.
+ /// The collection of metric data responses per resource, per metric.
+ /// A new instance for mocking.
+ public static MetricResultsResponse MetricResultsResponse(IEnumerable values = null)
+ {
+ values ??= new List();
+
+ return new MetricResultsResponse(values?.ToList());
+ }
+
+ /// Initializes a new instance of MetricResultsResponseValuesItem.
+ /// The start time, in datetime format, for which the data was retrieved.
+ /// The end time, in datetime format, for which the data was retrieved.
+ /// The interval (window size) for which the metric data was returned in. Follows the IS8601/RFC3339 duration format (e.g. 'P1D' for 1 day). This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made.
+ /// The namespace of the metrics been queried.
+ /// The region of the resource been queried for metrics.
+ /// The resource that has been queried for metrics.
+ /// The value of the collection.
+ /// A new instance for mocking.
+ public static MetricResultsResponseValuesItem MetricResultsResponseValuesItem(string starttime = null, string endtime = null, TimeSpan? interval = null, string @namespace = null, string resourceregion = null, string resourceid = null, IEnumerable value = null)
+ {
+ value ??= new List();
+
+ return new MetricResultsResponseValuesItem(starttime, endtime, interval, @namespace, resourceregion, resourceid, value?.ToList());
+ }
+
+ /// Initializes a new instance of QueryBatchMetric.
+ /// The metric Id.
+ /// The name and the display name of the metric, i.e. it is localizable string.
+ /// Description of this metric.
+ /// The resource type of the metric resource.
+ /// The unit of the metric.
+ /// The time series returned when a data query is performed.
+ /// 'Success' or the error details on query failures for this metric.
+ /// Error message encountered querying this specific metric.
+ /// A new instance for mocking.
+ public static QueryBatchMetric QueryBatchMetric(string id = null, QueryBatchLocalizableString name = null, string displayDescription = null, string type = null, QueryBatchMetricUnit unit = default, IEnumerable timeseries = null, string errorCode = null, string errorMessage = null)
+ {
+ timeseries ??= new List();
+
+ return new QueryBatchMetric(id, name, displayDescription, type, unit, timeseries?.ToList(), errorCode, errorMessage);
+ }
+
+ /// Initializes a new instance of QueryBatchLocalizableString.
+ /// The invariant value.
+ /// The display name.
+ /// A new instance for mocking.
+ public static QueryBatchLocalizableString QueryBatchLocalizableString(string value = null, string localizedValue = null)
+ {
+ return new QueryBatchLocalizableString(value, localizedValue);
+ }
+
+ /// Initializes a new instance of QueryBatchTimeSeriesElement.
+ /// The metadata values returned if filter was specified in the call.
+ /// An array of data points representing the metric values. This is only returned if a result type of data is specified.
+ /// A new instance for mocking.
+ public static QueryBatchTimeSeriesElement QueryBatchTimeSeriesElement(IEnumerable metadatavalues = null, IEnumerable data = null)
+ {
+ metadatavalues ??= new List();
+ data ??= new List();
+
+ return new QueryBatchTimeSeriesElement(metadatavalues?.ToList(), data?.ToList());
+ }
+
+ /// Initializes a new instance of QueryBatchMetadataValue.
+ /// The name of the metadata.
+ /// The value of the metadata.
+ /// A new instance for mocking.
+ public static QueryBatchMetadataValue QueryBatchMetadataValue(QueryBatchLocalizableString name = null, string value = null)
+ {
+ return new QueryBatchMetadataValue(name, value);
+ }
+
+ /// Initializes a new instance of QueryBatchMetricValue.
+ /// The timestamp for the metric value in ISO 8601 format.
+ /// The average value in the time range.
+ /// The least value in the time range.
+ /// The greatest value in the time range.
+ /// The sum of all of the values in the time range.
+ /// The number of samples in the time range. Can be used to determine the number of values that contributed to the average value.
+ /// A new instance for mocking.
+ public static QueryBatchMetricValue QueryBatchMetricValue(DateTimeOffset timeStamp = default, double? average = null, double? minimum = null, double? maximum = null, double? total = null, double? count = null)
+ {
+ return new QueryBatchMetricValue(timeStamp, average, minimum, maximum, total, count);
+ }
}
}
diff --git a/sdk/monitor/Azure.Monitor.Query/src/autorest.md b/sdk/monitor/Azure.Monitor.Query/src/autorest.md
index f1d5a5310824..9c96da747fc9 100644
--- a/sdk/monitor/Azure.Monitor.Query/src/autorest.md
+++ b/sdk/monitor/Azure.Monitor.Query/src/autorest.md
@@ -9,6 +9,7 @@ input-file:
- https://github.com/Azure/azure-rest-api-specs/blob/fc3c409825d6a31ba909a88ea34dcc13165edc9c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metricDefinitions_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/fc3c409825d6a31ba909a88ea34dcc13165edc9c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metrics_API.json
- https://github.com/Azure/azure-rest-api-specs/blob/fc3c409825d6a31ba909a88ea34dcc13165edc9c/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json
+ - metricBatch.json
generation1-convenience-client: true
modelerfour:
lenient-model-deduplication: true
diff --git a/sdk/monitor/Azure.Monitor.Query/src/metricBatch.json b/sdk/monitor/Azure.Monitor.Query/src/metricBatch.json
new file mode 100644
index 000000000000..25926dfa767f
--- /dev/null
+++ b/sdk/monitor/Azure.Monitor.Query/src/metricBatch.json
@@ -0,0 +1,562 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "title": "Azure Monitor Metric Batch",
+ "version": "2023-05-01-preview"
+ },
+ "securityDefinitions": {
+ "AADToken": {
+ "type": "oauth2",
+ "tokenUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/token",
+ "flow": "application",
+ "description": "Azure Active Directory OAuth2 Authentication",
+ "scopes": {
+ "https://metrics.monitor.azure.com/.default": "https://metrics.monitor.azure.com/.default"
+ }
+ }
+ },
+ "security": [
+ {
+ "AADToken": [
+ "https://metrics.monitor.azure.com/.default"
+ ]
+ }
+ ],
+ "x-ms-parameterized-host": {
+ "hostTemplate": "{endpoint}",
+ "useSchemePrefix": false,
+ "positionInOperation": "first",
+ "parameters": [
+ {
+ "name": "endpoint",
+ "description": "The regional endpoint to use, for example https://eastus.metrics.monitor.azure.com. The region should match the region of the requested resources. For global resources, the region should be 'global'.",
+ "required": true,
+ "type": "string",
+ "in": "path",
+ "x-ms-skip-url-encoding": true,
+ "x-ms-parameter-location": "client",
+ "format": "url"
+ }
+ ]
+ },
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "paths": {
+ "/subscriptions/{subscriptionId}/metrics:getBatch": {
+ "post": {
+ "tags": [
+ "Metrics"
+ ],
+ "operationId": "MetricsBatch_Batch",
+ "description": "Lists the metric values for multiple resources.",
+ "parameters": [
+ {
+ "$ref": "#/parameters/SubscriptionIdParameter"
+ },
+ {
+ "$ref": "#/parameters/StartTimeParameter"
+ },
+ {
+ "$ref": "#/parameters/EndTimeParameter"
+ },
+ {
+ "$ref": "#/parameters/IntervalParameter"
+ },
+ {
+ "$ref": "#/parameters/MetricNamespaceParameter"
+ },
+ {
+ "$ref": "#/parameters/MetricNamesParameter"
+ },
+ {
+ "$ref": "#/parameters/AggregationsParameter"
+ },
+ {
+ "$ref": "#/parameters/TopParameter"
+ },
+ {
+ "$ref": "#/parameters/OrderByParameter"
+ },
+ {
+ "$ref": "#/parameters/FilterParameter"
+ },
+ {
+ "$ref": "#/parameters/ApiVersionParameter"
+ },
+ {
+ "$ref": "#/parameters/ResourceIdList"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "The response to a metrics query.",
+ "schema": {
+ "$ref": "#/definitions/MetricResultsResponse"
+ }
+ },
+ "default": {
+ "description": "Describes the format of Error response.",
+ "headers": {
+ "x-ms-error-code": {
+ "type": "string",
+ "description": "Error code for specific error that occurred."
+ }
+ },
+ "schema": {
+ "$ref": "#/definitions/AdditionalInfoErrorResponse"
+ }
+ }
+ },
+ "x-ms-examples": {
+ "Query Storage Metrics": {
+ "$ref": "./examples/MetricBatchExample.json"
+ }
+ }
+ }
+ }
+ },
+ "parameters": {
+ "ResourceIdList": {
+ "name": "resourceIds",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/ResourceIdList"
+ },
+ "description": "The comma separated list of resource IDs to query metrics for."
+ },
+ "SubscriptionIdParameter": {
+ "name": "subscriptionId",
+ "in": "path",
+ "required": true,
+ "type": "string",
+ "description": "The subscription identifier for the resources in this batch.",
+ "x-ms-parameter-location": "method"
+ },
+ "StartTimeParameter": {
+ "name": "starttime",
+ "in": "query",
+ "required": false,
+ "type": "string",
+ "description": "The start time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'. If you have specified the endtime parameter, then this parameter is required.\nIf only starttime is specified, then endtime defaults to the current time.\nIf no time interval is specified, the default is 1 hour.",
+ "x-ms-parameter-location": "method"
+ },
+ "EndTimeParameter": {
+ "name": "endtime",
+ "in": "query",
+ "required": false,
+ "type": "string",
+ "description": "The end time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'.",
+ "x-ms-parameter-location": "method"
+ },
+ "IntervalParameter": {
+ "name": "interval",
+ "in": "query",
+ "required": false,
+ "type": "string",
+ "format": "duration",
+ "default": "PT1M",
+ "description": "The interval (i.e. timegrain) of the query.\n*Examples: PT15M, PT1H, P1D*",
+ "x-ms-parameter-location": "method"
+ },
+ "MetricNamespaceParameter": {
+ "name": "metricnamespace",
+ "in": "query",
+ "required": true,
+ "type": "string",
+ "description": "Metric namespace that contains the requested metric names.",
+ "x-ms-parameter-location": "method"
+ },
+ "MetricNamesParameter": {
+ "name": "metricnames",
+ "in": "query",
+ "required": true,
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "collectionFormat": "csv",
+ "description": "The names of the metrics (comma separated) to retrieve.",
+ "x-ms-parameter-location": "method"
+ },
+ "AggregationsParameter": {
+ "name": "aggregation",
+ "in": "query",
+ "required": false,
+ "type": "string",
+ "description": "The list of aggregation types (comma separated) to retrieve.\n*Examples: average, minimum, maximum*",
+ "x-ms-parameter-location": "method"
+ },
+ "TopParameter": {
+ "name": "top",
+ "in": "query",
+ "required": false,
+ "type": "integer",
+ "format": "int32",
+ "description": "The maximum number of records to retrieve per resource ID in the request.\nValid only if filter is specified.\nDefaults to 10.",
+ "x-ms-parameter-location": "method"
+ },
+ "OrderByParameter": {
+ "name": "orderby",
+ "in": "query",
+ "required": false,
+ "type": "string",
+ "description": "The aggregation to use for sorting results and the direction of the sort.\nOnly one order can be specified.\n*Examples: sum asc*",
+ "x-ms-parameter-location": "method"
+ },
+ "FilterParameter": {
+ "name": "filter",
+ "in": "query",
+ "required": false,
+ "type": "string",
+ "description": "The filter is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all time series of C where A = a1 and B = b1 or b2 **filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’** - Invalid variant: **filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’** This is invalid because the logical or operator cannot separate two different metadata names. - Return all time series where A = a1, B = b1 and C = c1: **filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’** - Return all time series where A = a1 **filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**.",
+ "x-ms-parameter-location": "method"
+ },
+ "ApiVersionParameter": {
+ "name": "api-version",
+ "in": "query",
+ "required": true,
+ "type": "string",
+ "description": "Client Api Version.",
+ "x-ms-parameter-location": "client"
+ }
+ },
+ "definitions": {
+ "ResourceIdList": {
+ "description": "The comma separated list of resource IDs to query metrics for.",
+ "type": "object",
+ "properties": {
+ "resourceids": {
+ "description": "The list of resource IDs to query metrics for.",
+ "type": "array",
+ "items": {
+ "type": "string",
+ "format": "arm-id"
+ }
+ }
+ },
+ "example": {
+ "resourceids": [
+ "/subscriptions/123456728-abcd-1234-abcd-123456789abc/resourceGroups/TestGroup/providers/Microsoft.Storage/storageAccounts/TestStorage1",
+ "/subscriptions/123456728-abcd-1234-abcd-123456789abc/resourceGroups/TestGroup/providers/Microsoft.Storage/storageAccounts/TestStorage2"
+ ]
+ }
+ },
+ "AdditionalInfoErrorResponse": {
+ "description": "The response to a metrics query that results in a bad request, with optional additional information.",
+ "type": "object",
+ "properties": {
+ "error": {
+ "description": "Top level error object that contains all relevant information.",
+ "type": "object",
+ "properties": {
+ "additionalInfo": {
+ "description": "Additional information about the error",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "type": {
+ "description": "The type of the info property (e.g. string).",
+ "type": "string"
+ },
+ "info": {
+ "description": "Additional information related to the error.",
+ "type": "string"
+ }
+ }
+ }
+ },
+ "code": {
+ "description": "Error code",
+ "type": "string"
+ },
+ "message": {
+ "description": "Error message indicating why the operation failed.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "code",
+ "message"
+ ]
+ }
+ },
+ "required": [
+ "error"
+ ]
+ },
+ "MetricResultsResponse": {
+ "description": "The metrics result for a resource.",
+ "type": "object",
+ "properties": {
+ "values": {
+ "description": "The collection of metric data responses per resource, per metric.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "starttime": {
+ "type": "string",
+ "description": "The start time, in datetime format, for which the data was retrieved."
+ },
+ "endtime": {
+ "type": "string",
+ "description": "The end time, in datetime format, for which the data was retrieved."
+ },
+ "interval": {
+ "type": "string",
+ "format": "duration",
+ "description": "The interval (window size) for which the metric data was returned in. Follows the IS8601/RFC3339 duration format (e.g. 'P1D' for 1 day). This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made."
+ },
+ "namespace": {
+ "type": "string",
+ "description": "The namespace of the metrics been queried"
+ },
+ "resourceregion": {
+ "type": "string",
+ "description": "The region of the resource been queried for metrics."
+ },
+ "resourceid": {
+ "type": "string",
+ "description": "The resource that has been queried for metrics."
+ },
+ "value": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/QueryBatchMetric"
+ },
+ "description": "The value of the collection."
+ }
+ },
+ "required": [
+ "starttime",
+ "endtime",
+ "value"
+ ]
+ }
+ }
+ }
+ },
+ "QueryBatchLocalizableString": {
+ "type": "object",
+ "required": [
+ "value"
+ ],
+ "properties": {
+ "value": {
+ "type": "string",
+ "description": "The invariant value."
+ },
+ "localizedValue": {
+ "type": "string",
+ "description": "The display name."
+ }
+ },
+ "description": "The localizable string class."
+ },
+ "QueryBatchMetricUnit": {
+ "type": "string",
+ "description": "The unit of the metric.",
+ "enum": [
+ "Count",
+ "Bytes",
+ "Seconds",
+ "CountPerSecond",
+ "BytesPerSecond",
+ "Percent",
+ "MilliSeconds",
+ "ByteSeconds",
+ "Unspecified",
+ "Cores",
+ "MilliCores",
+ "NanoCores",
+ "BitsPerSecond"
+ ],
+ "x-ms-enum": {
+ "name": "QueryBatchMetricUnit",
+ "modelAsString": false,
+ "values": [
+ {
+ "value": "Count",
+ "description": "Unit of raw quantity."
+ },
+ {
+ "value": "Bytes",
+ "description": "Unit of memory in bytes."
+ },
+ {
+ "value": "Seconds",
+ "description": "Unit of time in seconds."
+ },
+ {
+ "value": "CountPerSecond",
+ "description": "Rate unit of raw quantity per second."
+ },
+ {
+ "value": "BytesPerSecond",
+ "description": "Rate unit of memory in bytes per second."
+ },
+ {
+ "value": "Percent",
+ "description": "Percentage unit."
+ },
+ {
+ "value": "MilliSeconds",
+ "description": "Unit of time in 1/1000th of a second."
+ },
+ {
+ "value": "ByteSeconds",
+ "description": "Unit of data transfer or storage. It is the size of the data in bytes multiplied by the time it takes to transfer or store the data in seconds."
+ },
+ {
+ "value": "Unspecified",
+ "description": "No specified unit."
+ },
+ {
+ "value": "Cores",
+ "description": "Unit of processing power."
+ },
+ {
+ "value": "MilliCores",
+ "description": "Unit of processing power in 1/1000th of a CPU core."
+ },
+ {
+ "value": "NanoCores",
+ "description": "Unit of processing power in one billionth of a CPU core."
+ },
+ {
+ "value": "BitsPerSecond",
+ "description": "Rate unit of binary digits per second."
+ }
+ ]
+ }
+ },
+ "QueryBatchMetricValue": {
+ "type": "object",
+ "required": [
+ "timeStamp"
+ ],
+ "properties": {
+ "timeStamp": {
+ "type": "string",
+ "format": "date-time",
+ "description": "The timestamp for the metric value in ISO 8601 format."
+ },
+ "average": {
+ "type": "number",
+ "format": "double",
+ "description": "The average value in the time range."
+ },
+ "minimum": {
+ "type": "number",
+ "format": "double",
+ "description": "The least value in the time range."
+ },
+ "maximum": {
+ "type": "number",
+ "format": "double",
+ "description": "The greatest value in the time range."
+ },
+ "total": {
+ "type": "number",
+ "format": "double",
+ "description": "The sum of all of the values in the time range."
+ },
+ "count": {
+ "type": "number",
+ "format": "double",
+ "description": "The number of samples in the time range. Can be used to determine the number of values that contributed to the average value."
+ }
+ },
+ "description": "Represents a metric value."
+ },
+ "QueryBatchMetadataValue": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "$ref": "#/definitions/QueryBatchLocalizableString",
+ "description": "The name of the metadata."
+ },
+ "value": {
+ "type": "string",
+ "description": "The value of the metadata."
+ }
+ },
+ "description": "Represents a metric metadata value."
+ },
+ "QueryBatchMetric": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "The metric Id."
+ },
+ "name": {
+ "$ref": "#/definitions/QueryBatchLocalizableString",
+ "description": "The name and the display name of the metric, i.e. it is localizable string."
+ },
+ "displayDescription": {
+ "type": "string",
+ "description": "Description of this metric"
+ },
+ "type": {
+ "type": "string",
+ "description": "The resource type of the metric resource."
+ },
+ "unit": {
+ "$ref": "#/definitions/QueryBatchMetricUnit",
+ "description": "The unit of the metric."
+ },
+ "timeseries": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/QueryBatchTimeSeriesElement"
+ },
+ "description": "The time series returned when a data query is performed."
+ },
+ "errorCode": {
+ "type": "string",
+ "description": "'Success' or the error details on query failures for this metric."
+ },
+ "errorMessage": {
+ "type": "string",
+ "description": "Error message encountered querying this specific metric."
+ }
+ },
+ "required": [
+ "id",
+ "name",
+ "displayDescription",
+ "type",
+ "unit",
+ "timeseries"
+ ],
+ "description": "The result data of a query."
+ },
+ "QueryBatchTimeSeriesElement": {
+ "type": "object",
+ "properties": {
+ "metadatavalues": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/QueryBatchMetadataValue"
+ },
+ "description": "The metadata values returned if filter was specified in the call."
+ },
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/QueryBatchMetricValue"
+ },
+ "description": "An array of data points representing the metric values. This is only returned if a result type of data is specified."
+ }
+ },
+ "description": "A time series result type. The discriminator value is always TimeSeries in this case."
+ }
+ }
+}
From 75afbb1bfde74e2789d18e1707ca2a681540d9ea Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Thu, 7 Sep 2023 14:45:10 -0700
Subject: [PATCH 02/36] wip
---
sdk/core/Azure.Core/api/Azure.Core.net472.cs | 1239 +++++++++++++++++
.../src/MetricsBatchQueryClient.cs | 155 +++
2 files changed, 1394 insertions(+)
create mode 100644 sdk/core/Azure.Core/api/Azure.Core.net472.cs
create mode 100644 sdk/monitor/Azure.Monitor.Query/src/MetricsBatchQueryClient.cs
diff --git a/sdk/core/Azure.Core/api/Azure.Core.net472.cs b/sdk/core/Azure.Core/api/Azure.Core.net472.cs
new file mode 100644
index 000000000000..9aaf09bb355c
--- /dev/null
+++ b/sdk/core/Azure.Core/api/Azure.Core.net472.cs
@@ -0,0 +1,1239 @@
+namespace Azure
+{
+ public abstract partial class AsyncPageable : System.Collections.Generic.IAsyncEnumerable where T : notnull
+ {
+ protected AsyncPageable() { }
+ protected AsyncPageable(System.Threading.CancellationToken cancellationToken) { }
+ protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } }
+ public abstract System.Collections.Generic.IAsyncEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?));
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ public static Azure.AsyncPageable FromPages(System.Collections.Generic.IEnumerable> pages) { throw null; }
+ public virtual System.Collections.Generic.IAsyncEnumerator GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string? ToString() { throw null; }
+ }
+ public static partial class AzureCoreExtensions
+ {
+ public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json) { throw null; }
+ public static dynamic ToDynamicFromJson(this System.BinaryData utf8Json, Azure.Core.Serialization.JsonPropertyNames propertyNameFormat, string dateTimeFormat = "o") { throw null; }
+ public static System.Threading.Tasks.ValueTask ToObjectAsync(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public static object? ToObjectFromJson(this System.BinaryData data) { throw null; }
+ public static T? ToObject(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ }
+ public partial class AzureKeyCredential
+ {
+ public AzureKeyCredential(string key) { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public string Key { get { throw null; } }
+ public void Update(string key) { }
+ }
+ public partial class AzureNamedKeyCredential
+ {
+ public AzureNamedKeyCredential(string name, string key) { }
+ public string Name { get { throw null; } }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public void Deconstruct(out string name, out string key) { throw null; }
+ public void Update(string name, string key) { }
+ }
+ public partial class AzureSasCredential
+ {
+ public AzureSasCredential(string signature) { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public string Signature { get { throw null; } }
+ public void Update(string signature) { }
+ }
+ [System.FlagsAttribute]
+ public enum ErrorOptions
+ {
+ Default = 0,
+ NoThrow = 1,
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct ETag : System.IEquatable
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public static readonly Azure.ETag All;
+ public ETag(string etag) { throw null; }
+ public bool Equals(Azure.ETag other) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
+ public bool Equals(string? other) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(Azure.ETag left, Azure.ETag right) { throw null; }
+ public static bool operator !=(Azure.ETag left, Azure.ETag right) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string ToString() { throw null; }
+ public string ToString(string format) { throw null; }
+ }
+ public partial class HttpAuthorization
+ {
+ public HttpAuthorization(string scheme, string parameter) { }
+ public string Parameter { get { throw null; } }
+ public string Scheme { get { throw null; } }
+ public override string ToString() { throw null; }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct HttpRange : System.IEquatable
+ {
+ private readonly int _dummyPrimitive;
+ public HttpRange(long offset = (long)0, long? length = default(long?)) { throw null; }
+ public long? Length { get { throw null; } }
+ public long Offset { get { throw null; } }
+ public bool Equals(Azure.HttpRange other) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(Azure.HttpRange left, Azure.HttpRange right) { throw null; }
+ public static bool operator !=(Azure.HttpRange left, Azure.HttpRange right) { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public partial class JsonPatchDocument
+ {
+ public JsonPatchDocument() { }
+ public JsonPatchDocument(Azure.Core.Serialization.ObjectSerializer serializer) { }
+ public JsonPatchDocument(System.ReadOnlyMemory rawDocument) { }
+ public JsonPatchDocument(System.ReadOnlyMemory rawDocument, Azure.Core.Serialization.ObjectSerializer serializer) { }
+ public void AppendAddRaw(string path, string rawJsonValue) { }
+ public void AppendAdd(string path, T value) { }
+ public void AppendCopy(string from, string path) { }
+ public void AppendMove(string from, string path) { }
+ public void AppendRemove(string path) { }
+ public void AppendReplaceRaw(string path, string rawJsonValue) { }
+ public void AppendReplace(string path, T value) { }
+ public void AppendTestRaw(string path, string rawJsonValue) { }
+ public void AppendTest(string path, T value) { }
+ public System.ReadOnlyMemory ToBytes() { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public partial class MatchConditions
+ {
+ public MatchConditions() { }
+ public Azure.ETag? IfMatch { get { throw null; } set { } }
+ public Azure.ETag? IfNoneMatch { get { throw null; } set { } }
+ }
+ public abstract partial class NullableResponse
+ {
+ protected NullableResponse() { }
+ public abstract bool HasValue { get; }
+ public abstract T? Value { get; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public abstract Azure.Response GetRawResponse();
+ public override string ToString() { throw null; }
+ }
+ public abstract partial class Operation
+ {
+ protected Operation() { }
+ public abstract bool HasCompleted { get; }
+ public abstract string Id { get; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public abstract Azure.Response GetRawResponse();
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string? ToString() { throw null; }
+ public abstract Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ public abstract System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ public virtual Azure.Response WaitForCompletionResponse(Azure.Core.DelayStrategy delayStrategy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response WaitForCompletionResponse(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response WaitForCompletionResponse(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(Azure.Core.DelayStrategy delayStrategy, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ }
+ public abstract partial class Operation : Azure.Operation where T : notnull
+ {
+ protected Operation() { }
+ public abstract bool HasValue { get; }
+ public abstract T Value { get; }
+ public virtual Azure.Response WaitForCompletion(Azure.Core.DelayStrategy delayStrategy, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual Azure.Response WaitForCompletion(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual Azure.Response WaitForCompletion(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.ValueTask> WaitForCompletionAsync(Azure.Core.DelayStrategy delayStrategy, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public virtual System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ public virtual System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
+ }
+ public abstract partial class PageableOperation : Azure.Operation> where T : notnull
+ {
+ protected PageableOperation() { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override Azure.AsyncPageable Value { get { throw null; } }
+ public abstract Azure.Pageable GetValues(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ public abstract Azure.AsyncPageable GetValuesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ }
+ public abstract partial class Pageable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : notnull
+ {
+ protected Pageable() { }
+ protected Pageable(System.Threading.CancellationToken cancellationToken) { }
+ protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } }
+ public abstract System.Collections.Generic.IEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?));
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ public static Azure.Pageable FromPages(System.Collections.Generic.IEnumerable> pages) { throw null; }
+ public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string? ToString() { throw null; }
+ }
+ public abstract partial class Page
+ {
+ protected Page() { }
+ public abstract string? ContinuationToken { get; }
+ public abstract System.Collections.Generic.IReadOnlyList Values { get; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ public static Azure.Page FromValues(System.Collections.Generic.IReadOnlyList values, string? continuationToken, Azure.Response response) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public abstract Azure.Response GetRawResponse();
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string? ToString() { throw null; }
+ }
+ public partial class RequestConditions : Azure.MatchConditions
+ {
+ public RequestConditions() { }
+ public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } }
+ public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } }
+ }
+ public partial class RequestContext
+ {
+ public RequestContext() { }
+ public System.Threading.CancellationToken CancellationToken { get { throw null; } set { } }
+ public Azure.ErrorOptions ErrorOptions { get { throw null; } set { } }
+ public void AddClassifier(Azure.Core.ResponseClassificationHandler classifier) { }
+ public void AddClassifier(int statusCode, bool isError) { }
+ public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
+ public static implicit operator Azure.RequestContext (Azure.ErrorOptions options) { throw null; }
+ }
+ public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable
+ {
+ public RequestFailedException(Azure.Response response) { }
+ public RequestFailedException(Azure.Response response, System.Exception? innerException) { }
+ public RequestFailedException(Azure.Response response, System.Exception? innerException, Azure.Core.RequestFailedDetailsParser? detailsParser) { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public RequestFailedException(int status, string message) { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public RequestFailedException(int status, string message, System.Exception? innerException) { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public RequestFailedException(int status, string message, string? errorCode, System.Exception? innerException) { }
+ protected RequestFailedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+ public RequestFailedException(string message) { }
+ public RequestFailedException(string message, System.Exception? innerException) { }
+ public string? ErrorCode { get { throw null; } }
+ public int Status { get { throw null; } }
+ public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
+ public Azure.Response? GetRawResponse() { throw null; }
+ }
+ public abstract partial class Response : System.IDisposable
+ {
+ protected Response() { }
+ public abstract string ClientRequestId { get; set; }
+ public virtual System.BinaryData Content { get { throw null; } }
+ public abstract System.IO.Stream? ContentStream { get; set; }
+ public virtual Azure.Core.ResponseHeaders Headers { get { throw null; } }
+ public virtual bool IsError { get { throw null; } }
+ public abstract string ReasonPhrase { get; }
+ public abstract int Status { get; }
+ protected internal abstract bool ContainsHeader(string name);
+ public abstract void Dispose();
+ protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders();
+ public static Azure.Response FromValue(T value, Azure.Response response) { throw null; }
+ public override string ToString() { throw null; }
+ protected internal abstract bool TryGetHeader(string name, out string? value);
+ protected internal abstract bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable? values);
+ }
+ public sealed partial class ResponseError
+ {
+ public ResponseError(string? code, string? message) { }
+ public string? Code { get { throw null; } }
+ public string? Message { get { throw null; } }
+ public override string ToString() { throw null; }
+ }
+ public abstract partial class Response : Azure.NullableResponse
+ {
+ protected Response() { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool HasValue { get { throw null; } }
+ public override T Value { get { throw null; } }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public static implicit operator T (Azure.Response response) { throw null; }
+ }
+ public partial class SyncAsyncEventArgs : System.EventArgs
+ {
+ public SyncAsyncEventArgs(bool isRunningSynchronously, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { }
+ public System.Threading.CancellationToken CancellationToken { get { throw null; } }
+ public bool IsRunningSynchronously { get { throw null; } }
+ }
+ public enum WaitUntil
+ {
+ Completed = 0,
+ Started = 1,
+ }
+}
+namespace Azure.Core
+{
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public partial struct AccessToken
+ {
+ private object _dummy;
+ private int _dummyPrimitive;
+ public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; }
+ public System.DateTimeOffset ExpiresOn { get { throw null; } }
+ public string Token { get { throw null; } }
+ public override bool Equals(object? obj) { throw null; }
+ public override int GetHashCode() { throw null; }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct AzureLocation : System.IEquatable
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public AzureLocation(string location) { throw null; }
+ public AzureLocation(string name, string displayName) { throw null; }
+ public static Azure.Core.AzureLocation AustraliaCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation AustraliaCentral2 { get { throw null; } }
+ public static Azure.Core.AzureLocation AustraliaEast { get { throw null; } }
+ public static Azure.Core.AzureLocation AustraliaSoutheast { get { throw null; } }
+ public static Azure.Core.AzureLocation BrazilSouth { get { throw null; } }
+ public static Azure.Core.AzureLocation BrazilSoutheast { get { throw null; } }
+ public static Azure.Core.AzureLocation CanadaCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation CanadaEast { get { throw null; } }
+ public static Azure.Core.AzureLocation CentralIndia { get { throw null; } }
+ public static Azure.Core.AzureLocation CentralUS { get { throw null; } }
+ public static Azure.Core.AzureLocation ChinaEast { get { throw null; } }
+ public static Azure.Core.AzureLocation ChinaEast2 { get { throw null; } }
+ public static Azure.Core.AzureLocation ChinaNorth { get { throw null; } }
+ public static Azure.Core.AzureLocation ChinaNorth2 { get { throw null; } }
+ public string? DisplayName { get { throw null; } }
+ public static Azure.Core.AzureLocation EastAsia { get { throw null; } }
+ public static Azure.Core.AzureLocation EastUS { get { throw null; } }
+ public static Azure.Core.AzureLocation EastUS2 { get { throw null; } }
+ public static Azure.Core.AzureLocation FranceCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation FranceSouth { get { throw null; } }
+ public static Azure.Core.AzureLocation GermanyCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation GermanyNorth { get { throw null; } }
+ public static Azure.Core.AzureLocation GermanyNorthEast { get { throw null; } }
+ public static Azure.Core.AzureLocation GermanyWestCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation JapanEast { get { throw null; } }
+ public static Azure.Core.AzureLocation JapanWest { get { throw null; } }
+ public static Azure.Core.AzureLocation KoreaCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation KoreaSouth { get { throw null; } }
+ public string Name { get { throw null; } }
+ public static Azure.Core.AzureLocation NorthCentralUS { get { throw null; } }
+ public static Azure.Core.AzureLocation NorthEurope { get { throw null; } }
+ public static Azure.Core.AzureLocation NorwayEast { get { throw null; } }
+ public static Azure.Core.AzureLocation NorwayWest { get { throw null; } }
+ public static Azure.Core.AzureLocation QatarCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation SouthAfricaNorth { get { throw null; } }
+ public static Azure.Core.AzureLocation SouthAfricaWest { get { throw null; } }
+ public static Azure.Core.AzureLocation SouthCentralUS { get { throw null; } }
+ public static Azure.Core.AzureLocation SoutheastAsia { get { throw null; } }
+ public static Azure.Core.AzureLocation SouthIndia { get { throw null; } }
+ public static Azure.Core.AzureLocation SwedenCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation SwitzerlandNorth { get { throw null; } }
+ public static Azure.Core.AzureLocation SwitzerlandWest { get { throw null; } }
+ public static Azure.Core.AzureLocation UAECentral { get { throw null; } }
+ public static Azure.Core.AzureLocation UAENorth { get { throw null; } }
+ public static Azure.Core.AzureLocation UKSouth { get { throw null; } }
+ public static Azure.Core.AzureLocation UKWest { get { throw null; } }
+ public static Azure.Core.AzureLocation USDoDCentral { get { throw null; } }
+ public static Azure.Core.AzureLocation USDoDEast { get { throw null; } }
+ public static Azure.Core.AzureLocation USGovArizona { get { throw null; } }
+ public static Azure.Core.AzureLocation USGovIowa { get { throw null; } }
+ public static Azure.Core.AzureLocation USGovTexas { get { throw null; } }
+ public static Azure.Core.AzureLocation USGovVirginia { get { throw null; } }
+ public static Azure.Core.AzureLocation WestCentralUS { get { throw null; } }
+ public static Azure.Core.AzureLocation WestEurope { get { throw null; } }
+ public static Azure.Core.AzureLocation WestIndia { get { throw null; } }
+ public static Azure.Core.AzureLocation WestUS { get { throw null; } }
+ public static Azure.Core.AzureLocation WestUS2 { get { throw null; } }
+ public static Azure.Core.AzureLocation WestUS3 { get { throw null; } }
+ public bool Equals(Azure.Core.AzureLocation other) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(Azure.Core.AzureLocation left, Azure.Core.AzureLocation right) { throw null; }
+ public static implicit operator string (Azure.Core.AzureLocation location) { throw null; }
+ public static implicit operator Azure.Core.AzureLocation (string location) { throw null; }
+ public static bool operator !=(Azure.Core.AzureLocation left, Azure.Core.AzureLocation right) { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public abstract partial class ClientOptions
+ {
+ protected ClientOptions() { }
+ protected ClientOptions(Azure.Core.DiagnosticsOptions? diagnostics) { }
+ public static Azure.Core.ClientOptions Default { get { throw null; } }
+ public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } }
+ public Azure.Core.RetryOptions Retry { get { throw null; } }
+ public Azure.Core.Pipeline.HttpPipelinePolicy? RetryPolicy { get { throw null; } set { } }
+ public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } }
+ public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override bool Equals(object? obj) { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override int GetHashCode() { throw null; }
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
+ public override string? ToString() { throw null; }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct ContentType : System.IEquatable, System.IEquatable
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public ContentType(string contentType) { throw null; }
+ public static Azure.Core.ContentType ApplicationJson { get { throw null; } }
+ public static Azure.Core.ContentType ApplicationOctetStream { get { throw null; } }
+ public static Azure.Core.ContentType TextPlain { get { throw null; } }
+ public bool Equals(Azure.Core.ContentType other) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
+ public bool Equals(string? other) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public static bool operator ==(Azure.Core.ContentType left, Azure.Core.ContentType right) { throw null; }
+ public static implicit operator Azure.Core.ContentType (string contentType) { throw null; }
+ public static bool operator !=(Azure.Core.ContentType left, Azure.Core.ContentType right) { throw null; }
+ public override string ToString() { throw null; }
+ }
+ public abstract partial class DelayStrategy
+ {
+ protected DelayStrategy(System.TimeSpan? maxDelay = default(System.TimeSpan?), double jitterFactor = 0.2) { }
+ public static Azure.Core.DelayStrategy CreateExponentialDelayStrategy(System.TimeSpan? initialDelay = default(System.TimeSpan?), System.TimeSpan? maxDelay = default(System.TimeSpan?)) { throw null; }
+ public static Azure.Core.DelayStrategy CreateFixedDelayStrategy(System.TimeSpan? delay = default(System.TimeSpan?)) { throw null; }
+ public System.TimeSpan GetNextDelay(Azure.Response? response, int retryNumber) { throw null; }
+ protected abstract System.TimeSpan GetNextDelayCore(Azure.Response? response, int retryNumber);
+ protected static System.TimeSpan Max(System.TimeSpan val1, System.TimeSpan val2) { throw null; }
+ protected static System.TimeSpan Min(System.TimeSpan val1, System.TimeSpan val2) { throw null; }
+ }
+ public static partial class DelegatedTokenCredential
+ {
+ public static Azure.Core.TokenCredential Create(System.Func getToken) { throw null; }
+ public static Azure.Core.TokenCredential Create(System.Func getToken, System.Func> getTokenAsync) { throw null; }
+ }
+ public partial class DiagnosticsOptions
+ {
+ protected internal DiagnosticsOptions() { }
+ public string? ApplicationId { get { throw null; } set { } }
+ public static string? DefaultApplicationId { get { throw null; } set { } }
+ public bool IsDistributedTracingEnabled { get { throw null; } set { } }
+ public bool IsLoggingContentEnabled { get { throw null; } set { } }
+ public bool IsLoggingEnabled { get { throw null; } set { } }
+ public bool IsTelemetryEnabled { get { throw null; } set { } }
+ public int LoggedContentSizeLimit { get { throw null; } set { } }
+ public System.Collections.Generic.IList LoggedHeaderNames { get { throw null; } }
+ public System.Collections.Generic.IList LoggedQueryParameters { get { throw null; } }
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct HttpHeader : System.IEquatable
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public HttpHeader(string name, string value) { throw null; }
+ public string Name { get { throw null; } }
+ public string Value { get { throw null; } }
+ public bool Equals(Azure.Core.HttpHeader other) { throw null; }
+ public override bool Equals(object? obj) { throw null; }
+ public override int GetHashCode() { throw null; }
+ public override string ToString() { throw null; }
+ public static partial class Common
+ {
+ public static readonly Azure.Core.HttpHeader FormUrlEncodedContentType;
+ public static readonly Azure.Core.HttpHeader JsonAccept;
+ public static readonly Azure.Core.HttpHeader JsonContentType;
+ public static readonly Azure.Core.HttpHeader OctetStreamContentType;
+ }
+ public static partial class Names
+ {
+ public static string Accept { get { throw null; } }
+ public static string Authorization { get { throw null; } }
+ public static string ContentDisposition { get { throw null; } }
+ public static string ContentLength { get { throw null; } }
+ public static string ContentType { get { throw null; } }
+ public static string Date { get { throw null; } }
+ public static string ETag { get { throw null; } }
+ public static string Host { get { throw null; } }
+ public static string IfMatch { get { throw null; } }
+ public static string IfModifiedSince { get { throw null; } }
+ public static string IfNoneMatch { get { throw null; } }
+ public static string IfUnmodifiedSince { get { throw null; } }
+ public static string Prefer { get { throw null; } }
+ public static string Range { get { throw null; } }
+ public static string Referer { get { throw null; } }
+ public static string UserAgent { get { throw null; } }
+ public static string WwwAuthenticate { get { throw null; } }
+ public static string XMsDate { get { throw null; } }
+ public static string XMsRange { get { throw null; } }
+ public static string XMsRequestId { get { throw null; } }
+ }
+ }
+ public sealed partial class HttpMessage : System.IDisposable
+ {
+ public HttpMessage(Azure.Core.Request request, Azure.Core.ResponseClassifier responseClassifier) { }
+ public bool BufferResponse { get { throw null; } set { } }
+ public System.Threading.CancellationToken CancellationToken { get { throw null; } }
+ public bool HasResponse { get { throw null; } }
+ public System.TimeSpan? NetworkTimeout { get { throw null; } set { } }
+ public Azure.Core.MessageProcessingContext ProcessingContext { get { throw null; } }
+ public Azure.Core.Request Request { get { throw null; } }
+ public Azure.Response Response { get { throw null; } set { } }
+ public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } set { } }
+ public void Dispose() { }
+ public System.IO.Stream? ExtractResponseContent() { throw null; }
+ public void SetProperty(string name, object value) { }
+ public void SetProperty(System.Type type, object value) { }
+ public bool TryGetProperty(string name, out object? value) { throw null; }
+ public bool TryGetProperty(System.Type type, out object? value) { throw null; }
+ }
+ public enum HttpPipelinePosition
+ {
+ PerCall = 0,
+ PerRetry = 1,
+ BeforeTransport = 2,
+ }
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct MessageProcessingContext
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public int RetryNumber { get { throw null; } set { } }
+ public System.DateTimeOffset StartTime { get { throw null; } }
+ }
+ public static partial class MultipartResponse
+ {
+ public static Azure.Response[] Parse(Azure.Response response, bool expectCrLf, System.Threading.CancellationToken cancellationToken) { throw null; }
+ public static System.Threading.Tasks.Task ParseAsync(Azure.Response response, bool expectCrLf, System.Threading.CancellationToken cancellationToken) { throw null; }
+ }
+ public abstract partial class Request : System.IDisposable
+ {
+ protected Request() { }
+ public abstract string ClientRequestId { get; set; }
+ public virtual Azure.Core.RequestContent? Content { get { throw null; } set { } }
+ public Azure.Core.RequestHeaders Headers { get { throw null; } }
+ public virtual Azure.Core.RequestMethod Method { get { throw null; } set { } }
+ public virtual Azure.Core.RequestUriBuilder Uri { get { throw null; } set { } }
+ protected internal abstract void AddHeader(string name, string value);
+ protected internal abstract bool ContainsHeader(string name);
+ public abstract void Dispose();
+ protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders();
+ protected internal abstract bool RemoveHeader(string name);
+ protected internal virtual void SetHeader(string name, string value) { }
+ protected internal abstract bool TryGetHeader(string name, out string? value);
+ protected internal abstract bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable? values);
+ }
+ public abstract partial class RequestContent : System.IDisposable
+ {
+ protected RequestContent() { }
+ public static Azure.Core.RequestContent Create(Azure.Core.Serialization.DynamicData content) { throw null; }
+ public static Azure.Core.RequestContent Create(Azure.Core.Serialization.IModelJsonSerializable