diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/LiveMetrics.sln b/sdk/applicationinsights.livemetrics/LiveMetrics/LiveMetrics.sln
new file mode 100644
index 000000000000..202d00182aa1
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/LiveMetrics.sln
@@ -0,0 +1,50 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveMetrics", "src\LiveMetrics.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveMetrics.Tests", "tests\LiveMetrics.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/AggregationType.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/AggregationType.cs
new file mode 100644
index 000000000000..f785f0dec7ee
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/AggregationType.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace LiveMetrics
+{
+ /// Aggregation type.
+ public readonly partial struct AggregationType : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public AggregationType(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string AvgValue = "Avg";
+ private const string SumValue = "Sum";
+ private const string MinValue = "Min";
+ private const string MaxValue = "Max";
+
+ /// Average.
+ public static AggregationType Avg { get; } = new AggregationType(AvgValue);
+ /// Sum.
+ public static AggregationType Sum { get; } = new AggregationType(SumValue);
+ /// Minimum.
+ public static AggregationType Min { get; } = new AggregationType(MinValue);
+ /// Maximum.
+ public static AggregationType Max { get; } = new AggregationType(MaxValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(AggregationType left, AggregationType right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(AggregationType left, AggregationType right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator AggregationType(string value) => new AggregationType(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is AggregationType other && Equals(other);
+ ///
+ public bool Equals(AggregationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationError.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationError.Serialization.cs
new file mode 100644
index 000000000000..a359ba3fd714
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationError.Serialization.cs
@@ -0,0 +1,170 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class CollectionConfigurationError : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(CollectionConfigurationError)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("CollectionConfigurationErrorType"u8);
+ writer.WriteStringValue(CollectionConfigurationErrorType.ToString());
+ writer.WritePropertyName("Message"u8);
+ writer.WriteStringValue(Message);
+ writer.WritePropertyName("FullException"u8);
+ writer.WriteStringValue(FullException);
+ writer.WritePropertyName("Data"u8);
+ writer.WriteStartArray();
+ foreach (var item in Data)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ CollectionConfigurationError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(CollectionConfigurationError)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCollectionConfigurationError(document.RootElement, options);
+ }
+
+ internal static CollectionConfigurationError DeserializeCollectionConfigurationError(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ CollectionConfigurationErrorType collectionConfigurationErrorType = default;
+ string message = default;
+ string fullException = default;
+ IList data = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("CollectionConfigurationErrorType"u8))
+ {
+ collectionConfigurationErrorType = new CollectionConfigurationErrorType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("Message"u8))
+ {
+ message = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("FullException"u8))
+ {
+ fullException = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("Data"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(KeyValuePairStringString.DeserializeKeyValuePairStringString(item, options));
+ }
+ data = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new CollectionConfigurationError(collectionConfigurationErrorType, message, fullException, data, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(CollectionConfigurationError)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ CollectionConfigurationError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeCollectionConfigurationError(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(CollectionConfigurationError)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static CollectionConfigurationError FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCollectionConfigurationError(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationError.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationError.cs
new file mode 100644
index 000000000000..2c827786fc4b
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationError.cs
@@ -0,0 +1,96 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace LiveMetrics
+{
+ /// Represents an error while SDK parses and applies an instance of CollectionConfigurationInfo.
+ public partial class CollectionConfigurationError
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// Error type.
+ /// Error message.
+ /// Exception that led to the creation of the configuration error.
+ /// Custom properties to add more information to the error.
+ /// , or is null.
+ public CollectionConfigurationError(CollectionConfigurationErrorType collectionConfigurationErrorType, string message, string fullException, IEnumerable data)
+ {
+ Argument.AssertNotNull(message, nameof(message));
+ Argument.AssertNotNull(fullException, nameof(fullException));
+ Argument.AssertNotNull(data, nameof(data));
+
+ CollectionConfigurationErrorType = collectionConfigurationErrorType;
+ Message = message;
+ FullException = fullException;
+ Data = data.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// Error type.
+ /// Error message.
+ /// Exception that led to the creation of the configuration error.
+ /// Custom properties to add more information to the error.
+ /// Keeps track of any properties unknown to the library.
+ internal CollectionConfigurationError(CollectionConfigurationErrorType collectionConfigurationErrorType, string message, string fullException, IList data, IDictionary serializedAdditionalRawData)
+ {
+ CollectionConfigurationErrorType = collectionConfigurationErrorType;
+ Message = message;
+ FullException = fullException;
+ Data = data;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal CollectionConfigurationError()
+ {
+ }
+
+ /// Error type.
+ public CollectionConfigurationErrorType CollectionConfigurationErrorType { get; }
+ /// Error message.
+ public string Message { get; }
+ /// Exception that led to the creation of the configuration error.
+ public string FullException { get; }
+ /// Custom properties to add more information to the error.
+ public IList Data { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationErrorType.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationErrorType.cs
new file mode 100644
index 000000000000..9e116938866b
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationErrorType.cs
@@ -0,0 +1,84 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace LiveMetrics
+{
+ /// Collection configuration error type reported by the client SDK.
+ public readonly partial struct CollectionConfigurationErrorType : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public CollectionConfigurationErrorType(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string UnknownValue = "Unknown";
+ private const string PerformanceCounterParsingValue = "PerformanceCounterParsing";
+ private const string PerformanceCounterUnexpectedValue = "PerformanceCounterUnexpected";
+ private const string PerformanceCounterDuplicateIdsValue = "PerformanceCounterDuplicateIds";
+ private const string DocumentStreamDuplicateIdsValue = "DocumentStreamDuplicateIds";
+ private const string DocumentStreamFailureToCreateValue = "DocumentStreamFailureToCreate";
+ private const string DocumentStreamFailureToCreateFilterUnexpectedValue = "DocumentStreamFailureToCreateFilterUnexpected";
+ private const string MetricDuplicateIdsValue = "MetricDuplicateIds";
+ private const string MetricTelemetryTypeUnsupportedValue = "MetricTelemetryTypeUnsupported";
+ private const string MetricFailureToCreateValue = "MetricFailureToCreate";
+ private const string MetricFailureToCreateFilterUnexpectedValue = "MetricFailureToCreateFilterUnexpected";
+ private const string FilterFailureToCreateUnexpectedValue = "FilterFailureToCreateUnexpected";
+ private const string CollectionConfigurationFailureToCreateUnexpectedValue = "CollectionConfigurationFailureToCreateUnexpected";
+
+ /// Unknown error type.
+ public static CollectionConfigurationErrorType Unknown { get; } = new CollectionConfigurationErrorType(UnknownValue);
+ /// Performance counter parsing error.
+ public static CollectionConfigurationErrorType PerformanceCounterParsing { get; } = new CollectionConfigurationErrorType(PerformanceCounterParsingValue);
+ /// Performance counter unexpected error.
+ public static CollectionConfigurationErrorType PerformanceCounterUnexpected { get; } = new CollectionConfigurationErrorType(PerformanceCounterUnexpectedValue);
+ /// Performance counter duplicate ids.
+ public static CollectionConfigurationErrorType PerformanceCounterDuplicateIds { get; } = new CollectionConfigurationErrorType(PerformanceCounterDuplicateIdsValue);
+ /// Document stream duplication ids.
+ public static CollectionConfigurationErrorType DocumentStreamDuplicateIds { get; } = new CollectionConfigurationErrorType(DocumentStreamDuplicateIdsValue);
+ /// Document stream failed to create.
+ public static CollectionConfigurationErrorType DocumentStreamFailureToCreate { get; } = new CollectionConfigurationErrorType(DocumentStreamFailureToCreateValue);
+ /// Document stream failed to create filter unexpectedly.
+ public static CollectionConfigurationErrorType DocumentStreamFailureToCreateFilterUnexpected { get; } = new CollectionConfigurationErrorType(DocumentStreamFailureToCreateFilterUnexpectedValue);
+ /// Metric duplicate ids.
+ public static CollectionConfigurationErrorType MetricDuplicateIds { get; } = new CollectionConfigurationErrorType(MetricDuplicateIdsValue);
+ /// Metric telemetry type unsupported.
+ public static CollectionConfigurationErrorType MetricTelemetryTypeUnsupported { get; } = new CollectionConfigurationErrorType(MetricTelemetryTypeUnsupportedValue);
+ /// Metric failed to create.
+ public static CollectionConfigurationErrorType MetricFailureToCreate { get; } = new CollectionConfigurationErrorType(MetricFailureToCreateValue);
+ /// Metric failed to create filter unexpectedly.
+ public static CollectionConfigurationErrorType MetricFailureToCreateFilterUnexpected { get; } = new CollectionConfigurationErrorType(MetricFailureToCreateFilterUnexpectedValue);
+ /// Filter failed to create unexpectedly.
+ public static CollectionConfigurationErrorType FilterFailureToCreateUnexpected { get; } = new CollectionConfigurationErrorType(FilterFailureToCreateUnexpectedValue);
+ /// Collection configuration failed to create unexpectedly.
+ public static CollectionConfigurationErrorType CollectionConfigurationFailureToCreateUnexpected { get; } = new CollectionConfigurationErrorType(CollectionConfigurationFailureToCreateUnexpectedValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(CollectionConfigurationErrorType left, CollectionConfigurationErrorType right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(CollectionConfigurationErrorType left, CollectionConfigurationErrorType right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator CollectionConfigurationErrorType(string value) => new CollectionConfigurationErrorType(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is CollectionConfigurationErrorType other && Equals(other);
+ ///
+ public bool Equals(CollectionConfigurationErrorType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationInfo.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationInfo.Serialization.cs
new file mode 100644
index 000000000000..48593c5c360f
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationInfo.Serialization.cs
@@ -0,0 +1,187 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class CollectionConfigurationInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(CollectionConfigurationInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("ETag"u8);
+ writer.WriteStringValue(ETag);
+ writer.WritePropertyName("Metrics"u8);
+ writer.WriteStartArray();
+ foreach (var item in Metrics)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ writer.WritePropertyName("DocumentStreams"u8);
+ writer.WriteStartArray();
+ foreach (var item in DocumentStreams)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ if (Optional.IsDefined(QuotaInfo))
+ {
+ writer.WritePropertyName("QuotaInfo"u8);
+ writer.WriteObjectValue(QuotaInfo, options);
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ CollectionConfigurationInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(CollectionConfigurationInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeCollectionConfigurationInfo(document.RootElement, options);
+ }
+
+ internal static CollectionConfigurationInfo DeserializeCollectionConfigurationInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string eTag = default;
+ IReadOnlyList metrics = default;
+ IReadOnlyList documentStreams = default;
+ QuotaConfigurationInfo quotaInfo = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("ETag"u8))
+ {
+ eTag = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("Metrics"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(DerivedMetricInfo.DeserializeDerivedMetricInfo(item, options));
+ }
+ metrics = array;
+ continue;
+ }
+ if (property.NameEquals("DocumentStreams"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(DocumentStreamInfo.DeserializeDocumentStreamInfo(item, options));
+ }
+ documentStreams = array;
+ continue;
+ }
+ if (property.NameEquals("QuotaInfo"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ quotaInfo = QuotaConfigurationInfo.DeserializeQuotaConfigurationInfo(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new CollectionConfigurationInfo(eTag, metrics, documentStreams, quotaInfo, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(CollectionConfigurationInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ CollectionConfigurationInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeCollectionConfigurationInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(CollectionConfigurationInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static CollectionConfigurationInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCollectionConfigurationInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationInfo.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationInfo.cs
new file mode 100644
index 000000000000..2202b8fcc18b
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/CollectionConfigurationInfo.cs
@@ -0,0 +1,94 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace LiveMetrics
+{
+ /// Represents the collection configuration - a customizable description of performance counters, metrics, and full telemetry documents to be collected by the client SDK.
+ public partial class CollectionConfigurationInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// An encoded string that indicates whether the collection configuration is changed.
+ /// An array of metric configuration info.
+ /// An array of document stream configuration info.
+ /// , or is null.
+ internal CollectionConfigurationInfo(string eTag, IEnumerable metrics, IEnumerable documentStreams)
+ {
+ Argument.AssertNotNull(eTag, nameof(eTag));
+ Argument.AssertNotNull(metrics, nameof(metrics));
+ Argument.AssertNotNull(documentStreams, nameof(documentStreams));
+
+ ETag = eTag;
+ Metrics = metrics.ToList();
+ DocumentStreams = documentStreams.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// An encoded string that indicates whether the collection configuration is changed.
+ /// An array of metric configuration info.
+ /// An array of document stream configuration info.
+ /// Controls document quotas to be sent to Live Metrics.
+ /// Keeps track of any properties unknown to the library.
+ internal CollectionConfigurationInfo(string eTag, IReadOnlyList metrics, IReadOnlyList documentStreams, QuotaConfigurationInfo quotaInfo, IDictionary serializedAdditionalRawData)
+ {
+ ETag = eTag;
+ Metrics = metrics;
+ DocumentStreams = documentStreams;
+ QuotaInfo = quotaInfo;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal CollectionConfigurationInfo()
+ {
+ }
+
+ /// An encoded string that indicates whether the collection configuration is changed.
+ public string ETag { get; }
+ /// An array of metric configuration info.
+ public IReadOnlyList Metrics { get; }
+ /// An array of document stream configuration info.
+ public IReadOnlyList DocumentStreams { get; }
+ /// Controls document quotas to be sent to Live Metrics.
+ public QuotaConfigurationInfo QuotaInfo { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DerivedMetricInfo.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DerivedMetricInfo.Serialization.cs
new file mode 100644
index 000000000000..17baa33a86a4
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DerivedMetricInfo.Serialization.cs
@@ -0,0 +1,193 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class DerivedMetricInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DerivedMetricInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("Id"u8);
+ writer.WriteStringValue(Id);
+ writer.WritePropertyName("TelemetryType"u8);
+ writer.WriteStringValue(TelemetryType);
+ writer.WritePropertyName("FilterGroups"u8);
+ writer.WriteStartArray();
+ foreach (var item in FilterGroups)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ writer.WritePropertyName("Projection"u8);
+ writer.WriteStringValue(Projection);
+ writer.WritePropertyName("Aggregation"u8);
+ writer.WriteStringValue(Aggregation.ToString());
+ writer.WritePropertyName("BackEndAggregation"u8);
+ writer.WriteStringValue(BackEndAggregation.ToString());
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ DerivedMetricInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DerivedMetricInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeDerivedMetricInfo(document.RootElement, options);
+ }
+
+ internal static DerivedMetricInfo DeserializeDerivedMetricInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ string telemetryType = default;
+ IReadOnlyList filterGroups = default;
+ string projection = default;
+ AggregationType aggregation = default;
+ AggregationType backEndAggregation = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("Id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("TelemetryType"u8))
+ {
+ telemetryType = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("FilterGroups"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(FilterConjunctionGroupInfo.DeserializeFilterConjunctionGroupInfo(item, options));
+ }
+ filterGroups = array;
+ continue;
+ }
+ if (property.NameEquals("Projection"u8))
+ {
+ projection = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("Aggregation"u8))
+ {
+ aggregation = new AggregationType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("BackEndAggregation"u8))
+ {
+ backEndAggregation = new AggregationType(property.Value.GetString());
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new DerivedMetricInfo(
+ id,
+ telemetryType,
+ filterGroups,
+ projection,
+ aggregation,
+ backEndAggregation,
+ serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(DerivedMetricInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ DerivedMetricInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeDerivedMetricInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(DerivedMetricInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static DerivedMetricInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDerivedMetricInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DerivedMetricInfo.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DerivedMetricInfo.cs
new file mode 100644
index 000000000000..bf65e8969c59
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DerivedMetricInfo.cs
@@ -0,0 +1,109 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace LiveMetrics
+{
+ /// A metric configuration set by UX to scope the metrics it's interested in.
+ public partial class DerivedMetricInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// metric configuration identifier.
+ /// Telemetry type.
+ /// A collection of filters to scope metrics that UX needs.
+ /// Telemetry's metric dimension whose value is to be aggregated. Example values: Duration, Count(),...
+ /// Aggregation type. This is the aggregation done from everything within a single server.
+ /// Aggregation type. This Aggregation is done across the values for all the servers taken together.
+ /// , , or is null.
+ internal DerivedMetricInfo(string id, string telemetryType, IEnumerable filterGroups, string projection, AggregationType aggregation, AggregationType backEndAggregation)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(telemetryType, nameof(telemetryType));
+ Argument.AssertNotNull(filterGroups, nameof(filterGroups));
+ Argument.AssertNotNull(projection, nameof(projection));
+
+ Id = id;
+ TelemetryType = telemetryType;
+ FilterGroups = filterGroups.ToList();
+ Projection = projection;
+ Aggregation = aggregation;
+ BackEndAggregation = backEndAggregation;
+ }
+
+ /// Initializes a new instance of .
+ /// metric configuration identifier.
+ /// Telemetry type.
+ /// A collection of filters to scope metrics that UX needs.
+ /// Telemetry's metric dimension whose value is to be aggregated. Example values: Duration, Count(),...
+ /// Aggregation type. This is the aggregation done from everything within a single server.
+ /// Aggregation type. This Aggregation is done across the values for all the servers taken together.
+ /// Keeps track of any properties unknown to the library.
+ internal DerivedMetricInfo(string id, string telemetryType, IReadOnlyList filterGroups, string projection, AggregationType aggregation, AggregationType backEndAggregation, IDictionary serializedAdditionalRawData)
+ {
+ Id = id;
+ TelemetryType = telemetryType;
+ FilterGroups = filterGroups;
+ Projection = projection;
+ Aggregation = aggregation;
+ BackEndAggregation = backEndAggregation;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal DerivedMetricInfo()
+ {
+ }
+
+ /// metric configuration identifier.
+ public string Id { get; }
+ /// Telemetry type.
+ public string TelemetryType { get; }
+ /// A collection of filters to scope metrics that UX needs.
+ public IReadOnlyList FilterGroups { get; }
+ /// Telemetry's metric dimension whose value is to be aggregated. Example values: Duration, Count(),...
+ public string Projection { get; }
+ /// Aggregation type. This is the aggregation done from everything within a single server.
+ public AggregationType Aggregation { get; }
+ /// Aggregation type. This Aggregation is done across the values for all the servers taken together.
+ public AggregationType BackEndAggregation { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Docs/LiveMetricsClient.xml b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Docs/LiveMetricsClient.xml
new file mode 100644
index 000000000000..d20fe9db0cf7
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Docs/LiveMetricsClient.xml
@@ -0,0 +1,439 @@
+
+
+
+
+
+This sample shows how to call IsSubscribedAsync.
+ response = await client.IsSubscribedAsync("4473b98e-c70d-4220-b57c-2984c2a0e5cd");
+]]>
+
+
+
+This sample shows how to call IsSubscribed.
+ response = client.IsSubscribed("4473b98e-c70d-4220-b57c-2984c2a0e5cd");
+]]>
+
+
+
+This sample shows how to call IsSubscribedAsync and parse the result.
+
+
+
+
+This sample shows how to call IsSubscribed and parse the result.
+
+
+
+
+This sample shows how to call PublishAsync.
+ response = await client.PublishAsync("4473b98e-c70d-4220-b57c-2984c2a0e5cd");
+]]>
+
+
+
+This sample shows how to call Publish.
+ response = client.Publish("4473b98e-c70d-4220-b57c-2984c2a0e5cd");
+]]>
+
+
+
+This sample shows how to call PublishAsync and parse the result.
+
+
+
+
+This sample shows how to call Publish and parse the result.
+
+
+
+
\ No newline at end of file
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentFilterConjunctionGroupInfo.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentFilterConjunctionGroupInfo.Serialization.cs
new file mode 100644
index 000000000000..e7de6a3e4334
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentFilterConjunctionGroupInfo.Serialization.cs
@@ -0,0 +1,144 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class DocumentFilterConjunctionGroupInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DocumentFilterConjunctionGroupInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("TelemetryType"u8);
+ writer.WriteStringValue(TelemetryType.ToString());
+ writer.WritePropertyName("Filters"u8);
+ writer.WriteObjectValue(Filters, options);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ DocumentFilterConjunctionGroupInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DocumentFilterConjunctionGroupInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeDocumentFilterConjunctionGroupInfo(document.RootElement, options);
+ }
+
+ internal static DocumentFilterConjunctionGroupInfo DeserializeDocumentFilterConjunctionGroupInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ TelemetryType telemetryType = default;
+ FilterConjunctionGroupInfo filters = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("TelemetryType"u8))
+ {
+ telemetryType = new TelemetryType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("Filters"u8))
+ {
+ filters = FilterConjunctionGroupInfo.DeserializeFilterConjunctionGroupInfo(property.Value, options);
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new DocumentFilterConjunctionGroupInfo(telemetryType, filters, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(DocumentFilterConjunctionGroupInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ DocumentFilterConjunctionGroupInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeDocumentFilterConjunctionGroupInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(DocumentFilterConjunctionGroupInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static DocumentFilterConjunctionGroupInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDocumentFilterConjunctionGroupInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentFilterConjunctionGroupInfo.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentFilterConjunctionGroupInfo.cs
new file mode 100644
index 000000000000..ab47aa5a5a85
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentFilterConjunctionGroupInfo.cs
@@ -0,0 +1,81 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace LiveMetrics
+{
+ /// A collection of filters for a specific telemetry type.
+ public partial class DocumentFilterConjunctionGroupInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// Telemetry type.
+ /// An array of filter groups.
+ /// is null.
+ internal DocumentFilterConjunctionGroupInfo(TelemetryType telemetryType, FilterConjunctionGroupInfo filters)
+ {
+ Argument.AssertNotNull(filters, nameof(filters));
+
+ TelemetryType = telemetryType;
+ Filters = filters;
+ }
+
+ /// Initializes a new instance of .
+ /// Telemetry type.
+ /// An array of filter groups.
+ /// Keeps track of any properties unknown to the library.
+ internal DocumentFilterConjunctionGroupInfo(TelemetryType telemetryType, FilterConjunctionGroupInfo filters, IDictionary serializedAdditionalRawData)
+ {
+ TelemetryType = telemetryType;
+ Filters = filters;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal DocumentFilterConjunctionGroupInfo()
+ {
+ }
+
+ /// Telemetry type.
+ public TelemetryType TelemetryType { get; }
+ /// An array of filter groups.
+ public FilterConjunctionGroupInfo Filters { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentIngress.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentIngress.Serialization.cs
new file mode 100644
index 000000000000..1be02faa164f
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentIngress.Serialization.cs
@@ -0,0 +1,151 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ [PersistableModelProxy(typeof(UnknownDocumentIngress))]
+ public partial class DocumentIngress : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DocumentIngress)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("DocumentType"u8);
+ writer.WriteStringValue(DocumentType.ToString());
+ if (Optional.IsCollectionDefined(DocumentStreamIds))
+ {
+ writer.WritePropertyName("DocumentStreamIds"u8);
+ writer.WriteStartArray();
+ foreach (var item in DocumentStreamIds)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Properties))
+ {
+ writer.WritePropertyName("Properties"u8);
+ writer.WriteStartArray();
+ foreach (var item in Properties)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ DocumentIngress IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DocumentIngress)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeDocumentIngress(document.RootElement, options);
+ }
+
+ internal static DocumentIngress DeserializeDocumentIngress(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ if (element.TryGetProperty("DocumentType", out JsonElement discriminator))
+ {
+ switch (discriminator.GetString())
+ {
+ case "Event": return Event.DeserializeEvent(element, options);
+ case "Exception": return Exception.DeserializeException(element, options);
+ case "RemoteDependency": return RemoteDependency.DeserializeRemoteDependency(element, options);
+ case "Request": return Request.DeserializeRequest(element, options);
+ case "Trace": return Trace.DeserializeTrace(element, options);
+ }
+ }
+ return UnknownDocumentIngress.DeserializeUnknownDocumentIngress(element, options);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(DocumentIngress)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ DocumentIngress IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeDocumentIngress(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(DocumentIngress)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static DocumentIngress FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDocumentIngress(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentIngress.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentIngress.cs
new file mode 100644
index 000000000000..495a1ba03e02
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentIngress.cs
@@ -0,0 +1,79 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace LiveMetrics
+{
+ ///
+ /// Base class of the specific document types.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , , and .
+ ///
+ public abstract partial class DocumentIngress
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private protected IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ protected DocumentIngress()
+ {
+ DocumentStreamIds = new ChangeTrackingList();
+ Properties = new ChangeTrackingList();
+ }
+
+ /// Initializes a new instance of .
+ /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type.
+ /// An array of document streaming ids. Each id identifies a flow of documents customized by UX customers.
+ /// Collection of custom properties.
+ /// Keeps track of any properties unknown to the library.
+ internal DocumentIngress(DocumentType documentType, IList documentStreamIds, IList properties, IDictionary serializedAdditionalRawData)
+ {
+ DocumentType = documentType;
+ DocumentStreamIds = documentStreamIds;
+ Properties = properties;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type.
+ internal DocumentType DocumentType { get; set; }
+ /// An array of document streaming ids. Each id identifies a flow of documents customized by UX customers.
+ public IList DocumentStreamIds { get; }
+ /// Collection of custom properties.
+ public IList Properties { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentStreamInfo.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentStreamInfo.Serialization.cs
new file mode 100644
index 000000000000..aa75dce40ded
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentStreamInfo.Serialization.cs
@@ -0,0 +1,154 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class DocumentStreamInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DocumentStreamInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("Id"u8);
+ writer.WriteStringValue(Id);
+ writer.WritePropertyName("DocumentFilterGroups"u8);
+ writer.WriteStartArray();
+ foreach (var item in DocumentFilterGroups)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ DocumentStreamInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(DocumentStreamInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeDocumentStreamInfo(document.RootElement, options);
+ }
+
+ internal static DocumentStreamInfo DeserializeDocumentStreamInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string id = default;
+ IReadOnlyList documentFilterGroups = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("Id"u8))
+ {
+ id = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("DocumentFilterGroups"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(DocumentFilterConjunctionGroupInfo.DeserializeDocumentFilterConjunctionGroupInfo(item, options));
+ }
+ documentFilterGroups = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new DocumentStreamInfo(id, documentFilterGroups, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(DocumentStreamInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ DocumentStreamInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeDocumentStreamInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(DocumentStreamInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static DocumentStreamInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDocumentStreamInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentStreamInfo.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentStreamInfo.cs
new file mode 100644
index 000000000000..02101af6454e
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentStreamInfo.cs
@@ -0,0 +1,83 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace LiveMetrics
+{
+ /// Configurations/filters set by UX to scope the document/telemetry it's interested in.
+ public partial class DocumentStreamInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// Identifier of the document stream initiated by a UX.
+ /// Gets or sets an OR-connected collection of filter groups.
+ /// or is null.
+ internal DocumentStreamInfo(string id, IEnumerable documentFilterGroups)
+ {
+ Argument.AssertNotNull(id, nameof(id));
+ Argument.AssertNotNull(documentFilterGroups, nameof(documentFilterGroups));
+
+ Id = id;
+ DocumentFilterGroups = documentFilterGroups.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// Identifier of the document stream initiated by a UX.
+ /// Gets or sets an OR-connected collection of filter groups.
+ /// Keeps track of any properties unknown to the library.
+ internal DocumentStreamInfo(string id, IReadOnlyList documentFilterGroups, IDictionary serializedAdditionalRawData)
+ {
+ Id = id;
+ DocumentFilterGroups = documentFilterGroups;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal DocumentStreamInfo()
+ {
+ }
+
+ /// Identifier of the document stream initiated by a UX.
+ public string Id { get; }
+ /// Gets or sets an OR-connected collection of filter groups.
+ public IReadOnlyList DocumentFilterGroups { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentType.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentType.cs
new file mode 100644
index 000000000000..d0eec283fbcf
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/DocumentType.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace LiveMetrics
+{
+ /// Document type.
+ internal readonly partial struct DocumentType : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public DocumentType(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string RequestValue = "Request";
+ private const string RemoteDependencyValue = "RemoteDependency";
+ private const string ExceptionValue = "Exception";
+ private const string EventValue = "Event";
+ private const string TraceValue = "Trace";
+ private const string UnknownValue = "Unknown";
+
+ /// Represents a request telemetry type.
+ public static DocumentType Request { get; } = new DocumentType(RequestValue);
+ /// Represents a remote dependency telemetry type.
+ public static DocumentType RemoteDependency { get; } = new DocumentType(RemoteDependencyValue);
+ /// Represents an exception telemetry type.
+ public static DocumentType Exception { get; } = new DocumentType(ExceptionValue);
+ /// Represents an event telemetry type.
+ public static DocumentType Event { get; } = new DocumentType(EventValue);
+ /// Represents a trace telemetry type.
+ public static DocumentType Trace { get; } = new DocumentType(TraceValue);
+ /// Represents an unknown telemetry type.
+ public static DocumentType Unknown { get; } = new DocumentType(UnknownValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(DocumentType left, DocumentType right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(DocumentType left, DocumentType right) => !left.Equals(right);
+ /// Converts a to a .
+ public static implicit operator DocumentType(string value) => new DocumentType(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is DocumentType other && Equals(other);
+ ///
+ public bool Equals(DocumentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Event.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Event.Serialization.cs
new file mode 100644
index 000000000000..e5129532dcdb
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Event.Serialization.cs
@@ -0,0 +1,197 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class Event : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Event)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(Name))
+ {
+ writer.WritePropertyName("Name"u8);
+ writer.WriteStringValue(Name);
+ }
+ writer.WritePropertyName("DocumentType"u8);
+ writer.WriteStringValue(DocumentType.ToString());
+ if (Optional.IsCollectionDefined(DocumentStreamIds))
+ {
+ writer.WritePropertyName("DocumentStreamIds"u8);
+ writer.WriteStartArray();
+ foreach (var item in DocumentStreamIds)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Properties))
+ {
+ writer.WritePropertyName("Properties"u8);
+ writer.WriteStartArray();
+ foreach (var item in Properties)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ Event IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Event)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeEvent(document.RootElement, options);
+ }
+
+ internal static Event DeserializeEvent(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string name = default;
+ DocumentType documentType = default;
+ IList documentStreamIds = default;
+ IList properties = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("Name"u8))
+ {
+ name = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("DocumentType"u8))
+ {
+ documentType = new DocumentType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("DocumentStreamIds"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(item.GetString());
+ }
+ documentStreamIds = array;
+ continue;
+ }
+ if (property.NameEquals("Properties"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(KeyValuePairStringString.DeserializeKeyValuePairStringString(item, options));
+ }
+ properties = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Event(documentType, documentStreamIds ?? new ChangeTrackingList(), properties ?? new ChangeTrackingList(), serializedAdditionalRawData, name);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(Event)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Event IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeEvent(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Event)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new Event FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeEvent(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Event.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Event.cs
new file mode 100644
index 000000000000..ac0ba2ec5b66
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Event.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace LiveMetrics
+{
+ /// Event document type.
+ public partial class Event : DocumentIngress
+ {
+ /// Initializes a new instance of .
+ public Event()
+ {
+ DocumentType = DocumentType.Event;
+ }
+
+ /// Initializes a new instance of .
+ /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type.
+ /// An array of document streaming ids. Each id identifies a flow of documents customized by UX customers.
+ /// Collection of custom properties.
+ /// Keeps track of any properties unknown to the library.
+ /// Event name.
+ internal Event(DocumentType documentType, IList documentStreamIds, IList properties, IDictionary serializedAdditionalRawData, string name) : base(documentType, documentStreamIds, properties, serializedAdditionalRawData)
+ {
+ Name = name;
+ }
+
+ /// Event name.
+ public string Name { get; set; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Exception.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Exception.Serialization.cs
new file mode 100644
index 000000000000..d4166a6a8d44
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Exception.Serialization.cs
@@ -0,0 +1,214 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class Exception : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Exception)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ if (Optional.IsDefined(ExceptionType))
+ {
+ writer.WritePropertyName("ExceptionType"u8);
+ writer.WriteStringValue(ExceptionType);
+ }
+ if (Optional.IsDefined(ExceptionMessage))
+ {
+ writer.WritePropertyName("ExceptionMessage"u8);
+ writer.WriteStringValue(ExceptionMessage);
+ }
+ writer.WritePropertyName("DocumentType"u8);
+ writer.WriteStringValue(DocumentType.ToString());
+ if (Optional.IsCollectionDefined(DocumentStreamIds))
+ {
+ writer.WritePropertyName("DocumentStreamIds"u8);
+ writer.WriteStartArray();
+ foreach (var item in DocumentStreamIds)
+ {
+ writer.WriteStringValue(item);
+ }
+ writer.WriteEndArray();
+ }
+ if (Optional.IsCollectionDefined(Properties))
+ {
+ writer.WritePropertyName("Properties"u8);
+ writer.WriteStartArray();
+ foreach (var item in Properties)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ }
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ Exception IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(Exception)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeException(document.RootElement, options);
+ }
+
+ internal static Exception DeserializeException(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string exceptionType = default;
+ string exceptionMessage = default;
+ DocumentType documentType = default;
+ IList documentStreamIds = default;
+ IList properties = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("ExceptionType"u8))
+ {
+ exceptionType = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("ExceptionMessage"u8))
+ {
+ exceptionMessage = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("DocumentType"u8))
+ {
+ documentType = new DocumentType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("DocumentStreamIds"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(item.GetString());
+ }
+ documentStreamIds = array;
+ continue;
+ }
+ if (property.NameEquals("Properties"u8))
+ {
+ if (property.Value.ValueKind == JsonValueKind.Null)
+ {
+ continue;
+ }
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(KeyValuePairStringString.DeserializeKeyValuePairStringString(item, options));
+ }
+ properties = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new Exception(
+ documentType,
+ documentStreamIds ?? new ChangeTrackingList(),
+ properties ?? new ChangeTrackingList(),
+ serializedAdditionalRawData,
+ exceptionType,
+ exceptionMessage);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(Exception)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ Exception IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeException(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(Exception)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new Exception FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeException(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal override RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Exception.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Exception.cs
new file mode 100644
index 000000000000..33c36b88e5e0
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Exception.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace LiveMetrics
+{
+ /// Exception document type.
+ public partial class Exception : DocumentIngress
+ {
+ /// Initializes a new instance of .
+ public Exception()
+ {
+ DocumentType = DocumentType.Exception;
+ }
+
+ /// Initializes a new instance of .
+ /// Telemetry type. Types not defined in enum will get replaced with a 'Unknown' type.
+ /// An array of document streaming ids. Each id identifies a flow of documents customized by UX customers.
+ /// Collection of custom properties.
+ /// Keeps track of any properties unknown to the library.
+ /// Exception type name.
+ /// Exception message.
+ internal Exception(DocumentType documentType, IList documentStreamIds, IList properties, IDictionary serializedAdditionalRawData, string exceptionType, string exceptionMessage) : base(documentType, documentStreamIds, properties, serializedAdditionalRawData)
+ {
+ ExceptionType = exceptionType;
+ ExceptionMessage = exceptionMessage;
+ }
+
+ /// Exception type name.
+ public string ExceptionType { get; set; }
+ /// Exception message.
+ public string ExceptionMessage { get; set; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterConjunctionGroupInfo.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterConjunctionGroupInfo.Serialization.cs
new file mode 100644
index 000000000000..b06b826b356b
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterConjunctionGroupInfo.Serialization.cs
@@ -0,0 +1,146 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class FilterConjunctionGroupInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(FilterConjunctionGroupInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("Filters"u8);
+ writer.WriteStartArray();
+ foreach (var item in Filters)
+ {
+ writer.WriteObjectValue(item, options);
+ }
+ writer.WriteEndArray();
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ FilterConjunctionGroupInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(FilterConjunctionGroupInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeFilterConjunctionGroupInfo(document.RootElement, options);
+ }
+
+ internal static FilterConjunctionGroupInfo DeserializeFilterConjunctionGroupInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ IReadOnlyList filters = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("Filters"u8))
+ {
+ List array = new List();
+ foreach (var item in property.Value.EnumerateArray())
+ {
+ array.Add(FilterInfo.DeserializeFilterInfo(item, options));
+ }
+ filters = array;
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new FilterConjunctionGroupInfo(filters, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(FilterConjunctionGroupInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ FilterConjunctionGroupInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeFilterConjunctionGroupInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(FilterConjunctionGroupInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static FilterConjunctionGroupInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeFilterConjunctionGroupInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterConjunctionGroupInfo.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterConjunctionGroupInfo.cs
new file mode 100644
index 000000000000..16ce6d4a1f18
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterConjunctionGroupInfo.cs
@@ -0,0 +1,76 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace LiveMetrics
+{
+ /// An AND-connected group of FilterInfo objects.
+ public partial class FilterConjunctionGroupInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// An array of filters.
+ /// is null.
+ internal FilterConjunctionGroupInfo(IEnumerable filters)
+ {
+ Argument.AssertNotNull(filters, nameof(filters));
+
+ Filters = filters.ToList();
+ }
+
+ /// Initializes a new instance of .
+ /// An array of filters.
+ /// Keeps track of any properties unknown to the library.
+ internal FilterConjunctionGroupInfo(IReadOnlyList filters, IDictionary serializedAdditionalRawData)
+ {
+ Filters = filters;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal FilterConjunctionGroupInfo()
+ {
+ }
+
+ /// An array of filters.
+ public IReadOnlyList Filters { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterInfo.Serialization.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterInfo.Serialization.cs
new file mode 100644
index 000000000000..18a7b1c91d54
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterInfo.Serialization.cs
@@ -0,0 +1,152 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel.Primitives;
+using System.Collections.Generic;
+using System.Text.Json;
+using Azure;
+using Azure.Core;
+
+namespace LiveMetrics
+{
+ public partial class FilterInfo : IUtf8JsonSerializable, IJsonModel
+ {
+ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions);
+
+ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(FilterInfo)} does not support writing '{format}' format.");
+ }
+
+ writer.WriteStartObject();
+ writer.WritePropertyName("FieldName"u8);
+ writer.WriteStringValue(FieldName);
+ writer.WritePropertyName("Predicate"u8);
+ writer.WriteStringValue(Predicate.ToString());
+ writer.WritePropertyName("Comparand"u8);
+ writer.WriteStringValue(Comparand);
+ if (options.Format != "W" && _serializedAdditionalRawData != null)
+ {
+ foreach (var item in _serializedAdditionalRawData)
+ {
+ writer.WritePropertyName(item.Key);
+#if NET6_0_OR_GREATER
+ writer.WriteRawValue(item.Value);
+#else
+ using (JsonDocument document = JsonDocument.Parse(item.Value))
+ {
+ JsonSerializer.Serialize(writer, document.RootElement);
+ }
+#endif
+ }
+ }
+ writer.WriteEndObject();
+ }
+
+ FilterInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+ if (format != "J")
+ {
+ throw new FormatException($"The model {nameof(FilterInfo)} does not support reading '{format}' format.");
+ }
+
+ using JsonDocument document = JsonDocument.ParseValue(ref reader);
+ return DeserializeFilterInfo(document.RootElement, options);
+ }
+
+ internal static FilterInfo DeserializeFilterInfo(JsonElement element, ModelReaderWriterOptions options = null)
+ {
+ options ??= ModelSerializationExtensions.WireOptions;
+
+ if (element.ValueKind == JsonValueKind.Null)
+ {
+ return null;
+ }
+ string fieldName = default;
+ PredicateType predicate = default;
+ string comparand = default;
+ IDictionary serializedAdditionalRawData = default;
+ Dictionary rawDataDictionary = new Dictionary();
+ foreach (var property in element.EnumerateObject())
+ {
+ if (property.NameEquals("FieldName"u8))
+ {
+ fieldName = property.Value.GetString();
+ continue;
+ }
+ if (property.NameEquals("Predicate"u8))
+ {
+ predicate = new PredicateType(property.Value.GetString());
+ continue;
+ }
+ if (property.NameEquals("Comparand"u8))
+ {
+ comparand = property.Value.GetString();
+ continue;
+ }
+ if (options.Format != "W")
+ {
+ rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText()));
+ }
+ }
+ serializedAdditionalRawData = rawDataDictionary;
+ return new FilterInfo(fieldName, predicate, comparand, serializedAdditionalRawData);
+ }
+
+ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ return ModelReaderWriter.Write(this, options);
+ default:
+ throw new FormatException($"The model {nameof(FilterInfo)} does not support writing '{options.Format}' format.");
+ }
+ }
+
+ FilterInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options)
+ {
+ var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format;
+
+ switch (format)
+ {
+ case "J":
+ {
+ using JsonDocument document = JsonDocument.Parse(data);
+ return DeserializeFilterInfo(document.RootElement, options);
+ }
+ default:
+ throw new FormatException($"The model {nameof(FilterInfo)} does not support reading '{options.Format}' format.");
+ }
+ }
+
+ string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J";
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static FilterInfo FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeFilterInfo(document.RootElement);
+ }
+
+ /// Convert into a .
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions);
+ return content;
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterInfo.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterInfo.cs
new file mode 100644
index 000000000000..227a405ba0cb
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/FilterInfo.cs
@@ -0,0 +1,88 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+
+namespace LiveMetrics
+{
+ /// A filter set on UX.
+ public partial class FilterInfo
+ {
+ ///
+ /// Keeps track of any properties unknown to the library.
+ ///
+ /// To assign an object to the value of this property use .
+ ///
+ ///
+ /// To assign an already formatted json string to this property use .
+ ///
+ ///
+ /// Examples:
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson("foo")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromString("\"foo\"")
+ /// Creates a payload of "foo".
+ ///
+ /// -
+ /// BinaryData.FromObjectAsJson(new { key = "value" })
+ /// Creates a payload of { "key": "value" }.
+ ///
+ /// -
+ /// BinaryData.FromString("{\"key\": \"value\"}")
+ /// Creates a payload of { "key": "value" }.
+ ///
+ ///
+ ///
+ ///
+ private IDictionary _serializedAdditionalRawData;
+
+ /// Initializes a new instance of .
+ /// dimension name of the filter.
+ /// Operator of the filter.
+ /// Comparand of the filter.
+ /// or is null.
+ internal FilterInfo(string fieldName, PredicateType predicate, string comparand)
+ {
+ Argument.AssertNotNull(fieldName, nameof(fieldName));
+ Argument.AssertNotNull(comparand, nameof(comparand));
+
+ FieldName = fieldName;
+ Predicate = predicate;
+ Comparand = comparand;
+ }
+
+ /// Initializes a new instance of .
+ /// dimension name of the filter.
+ /// Operator of the filter.
+ /// Comparand of the filter.
+ /// Keeps track of any properties unknown to the library.
+ internal FilterInfo(string fieldName, PredicateType predicate, string comparand, IDictionary serializedAdditionalRawData)
+ {
+ FieldName = fieldName;
+ Predicate = predicate;
+ Comparand = comparand;
+ _serializedAdditionalRawData = serializedAdditionalRawData;
+ }
+
+ /// Initializes a new instance of for deserialization.
+ internal FilterInfo()
+ {
+ }
+
+ /// dimension name of the filter.
+ public string FieldName { get; }
+ /// Operator of the filter.
+ public PredicateType Predicate { get; }
+ /// Comparand of the filter.
+ public string Comparand { get; }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Internal/Argument.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Internal/Argument.cs
new file mode 100644
index 000000000000..fd93d797ccdf
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Internal/Argument.cs
@@ -0,0 +1,129 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace LiveMetrics
+{
+ internal static class Argument
+ {
+ public static void AssertNotNull(T value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNull(T? value, string name)
+ where T : struct
+ {
+ if (!value.HasValue)
+ {
+ throw new ArgumentNullException(name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(IEnumerable value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value is ICollection collectionOfT && collectionOfT.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ if (value is ICollection collection && collection.Count == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ using IEnumerator e = value.GetEnumerator();
+ if (!e.MoveNext())
+ {
+ throw new ArgumentException("Value cannot be an empty collection.", name);
+ }
+ }
+
+ public static void AssertNotNullOrEmpty(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (value.Length == 0)
+ {
+ throw new ArgumentException("Value cannot be an empty string.", name);
+ }
+ }
+
+ public static void AssertNotNullOrWhiteSpace(string value, string name)
+ {
+ if (value is null)
+ {
+ throw new ArgumentNullException(name);
+ }
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name);
+ }
+ }
+
+ public static void AssertNotDefault(ref T value, string name)
+ where T : struct, IEquatable
+ {
+ if (value.Equals(default))
+ {
+ throw new ArgumentException("Value cannot be empty.", name);
+ }
+ }
+
+ public static void AssertInRange(T value, T minimum, T maximum, string name)
+ where T : notnull, IComparable
+ {
+ if (minimum.CompareTo(value) > 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed.");
+ }
+ if (maximum.CompareTo(value) < 0)
+ {
+ throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed.");
+ }
+ }
+
+ public static void AssertEnumDefined(Type enumType, object value, string name)
+ {
+ if (!Enum.IsDefined(enumType, value))
+ {
+ throw new ArgumentException($"Value not defined for {enumType.FullName}.", name);
+ }
+ }
+
+ public static T CheckNotNull(T value, string name)
+ where T : class
+ {
+ AssertNotNull(value, name);
+ return value;
+ }
+
+ public static string CheckNotNullOrEmpty(string value, string name)
+ {
+ AssertNotNullOrEmpty(value, name);
+ return value;
+ }
+
+ public static void AssertNull(T value, string name, string message = null)
+ {
+ if (value != null)
+ {
+ throw new ArgumentException(message ?? "Value must be null.", name);
+ }
+ }
+ }
+}
diff --git a/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Internal/ChangeTrackingDictionary.cs
new file mode 100644
index 000000000000..adba2e33ac67
--- /dev/null
+++ b/sdk/applicationinsights.livemetrics/LiveMetrics/src/Generated/Internal/ChangeTrackingDictionary.cs
@@ -0,0 +1,167 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace LiveMetrics
+{
+ internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull
+ {
+ private IDictionary _innerDictionary;
+
+ public ChangeTrackingDictionary()
+ {
+ }
+
+ public ChangeTrackingDictionary(IDictionary dictionary)
+ {
+ if (dictionary == null)
+ {
+ return;
+ }
+ _innerDictionary = new Dictionary(dictionary);
+ }
+
+ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary)
+ {
+ if (dictionary == null)
+ {
+ return;
+ }
+ _innerDictionary = new Dictionary();
+ foreach (var pair in dictionary)
+ {
+ _innerDictionary.Add(pair);
+ }
+ }
+
+ public bool IsUndefined => _innerDictionary == null;
+
+ public int Count => IsUndefined ? 0 : EnsureDictionary().Count;
+
+ public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly;
+
+ public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys;
+
+ public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values;
+
+ public TValue this[TKey key]
+ {
+ get
+ {
+ if (IsUndefined)
+ {
+ throw new KeyNotFoundException(nameof(key));
+ }
+ return EnsureDictionary()[key];
+ }
+ set
+ {
+ EnsureDictionary()[key] = value;
+ }
+ }
+
+ IEnumerable IReadOnlyDictionary.Keys => Keys;
+
+ IEnumerable IReadOnlyDictionary.Values => Values;
+
+ public IEnumerator> GetEnumerator()
+ {
+ if (IsUndefined)
+ {
+ IEnumerator> enumerateEmpty()
+ {
+ yield break;
+ }
+ return enumerateEmpty();
+ }
+ return EnsureDictionary().GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public void Add(KeyValuePair item)
+ {
+ EnsureDictionary().Add(item);
+ }
+
+ public void Clear()
+ {
+ EnsureDictionary().Clear();
+ }
+
+ public bool Contains(KeyValuePair item)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().Contains(item);
+ }
+
+ public void CopyTo(KeyValuePair[] array, int index)
+ {
+ if (IsUndefined)
+ {
+ return;
+ }
+ EnsureDictionary().CopyTo(array, index);
+ }
+
+ public bool Remove(KeyValuePair item)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().Remove(item);
+ }
+
+ public void Add(TKey key, TValue value)
+ {
+ EnsureDictionary().Add(key, value);
+ }
+
+ public bool ContainsKey(TKey key)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().ContainsKey(key);
+ }
+
+ public bool Remove(TKey key)
+ {
+ if (IsUndefined)
+ {
+ return false;
+ }
+ return EnsureDictionary().Remove(key);
+ }
+
+ public bool TryGetValue(TKey key, out TValue value)
+ {
+ if (IsUndefined)
+ {
+ value = default;
+ return false;
+ }
+ return EnsureDictionary().TryGetValue(key, out value);
+ }
+
+ public IDictionary