diff --git a/doc/GeneratorMigration/Library_Inventory.md b/doc/GeneratorMigration/Library_Inventory.md index 9d1b9e31c2c1..a9fae06919e3 100644 --- a/doc/GeneratorMigration/Library_Inventory.md +++ b/doc/GeneratorMigration/Library_Inventory.md @@ -13,25 +13,25 @@ ## Summary -- Total libraries: 400 -- Management Plane (MPG): 226 +- Total libraries: 402 +- Management Plane (MPG): 227 - Autorest/Swagger: 140 - - New Emitter (TypeSpec): 86 + - New Emitter (TypeSpec): 87 - Old TypeSpec: 0 -- Data Plane (DPG): 143 +- Data Plane (DPG): 144 - Autorest/Swagger: 55 - - New Emitter (TypeSpec): 33 - - Old TypeSpec: 7 + - New Emitter (TypeSpec): 34 + - Old TypeSpec: 6 - Provisioning: 31 - Custom reflection-based generator: 31 -- No generator: 48 +- No generator: 49 ## Data Plane Libraries (DPG) - Migrated to New Emitter Libraries that provide client APIs for Azure services and have been migrated to the new TypeSpec emitter. -**Migration Status**: 33 / 40 (82.5%) +**Migration Status**: 34 / 40 (85%) | Service | Library | New Emitter | Using SCM | | ------- | ------- | ----------- | --------- | @@ -39,7 +39,7 @@ Libraries that provide client APIs for Azure services and have been migrated to | ai | Azure.AI.Projects | ✅ | ✅ | | ai | Azure.AI.Projects.OpenAI | ✅ | ✅ | | ai | Azure.AI.VoiceLive | ✅ | | -| anomalydetector | Azure.AI.AnomalyDetector | | | +| anomalydetector | Azure.AI.AnomalyDetector | ✅ | | | appconfiguration | Azure.Data.AppConfiguration | ✅ | | | batch | Azure.Compute.Batch | ✅ | | | cognitivelanguage | Azure.AI.Language.Conversations | ✅ | | @@ -144,7 +144,7 @@ Libraries that have not yet been migrated to the new TypeSpec emitter. Total: 55 Libraries that provide resource management APIs for Azure services and have been migrated to the new TypeSpec emitter. -**Migration Status**: 86 / 86 (100%) +**Migration Status**: 87 / 87 (100%) | Service | Library | New Emitter | | ------- | ------- | ----------- | @@ -152,6 +152,7 @@ Libraries that provide resource management APIs for Azure services and have been | agricultureplatform | Azure.ResourceManager.AgriculturePlatform | ✅ | | appcomplianceautomation | Azure.ResourceManager.AppComplianceAutomation | ✅ | | arizeaiobservabilityeval | Azure.ResourceManager.ArizeAIObservabilityEval | ✅ | +| artifactsigning | Azure.ResourceManager.ArtifactSigning | ✅ | | astronomer | Azure.ResourceManager.Astro | ✅ | | avs | Azure.ResourceManager.Avs | ✅ | | azurelargeinstance | Azure.ResourceManager.LargeInstance | ✅ | @@ -429,7 +430,7 @@ Total: 31 ## Libraries with No Generator -Libraries with no generator have neither autorest.md nor tsp-location.yaml files. Total: 48 +Libraries with no generator have neither autorest.md nor tsp-location.yaml files. Total: 49 | Service | Library | | ------- | ------- | @@ -479,5 +480,6 @@ Libraries with no generator have neither autorest.md nor tsp-location.yaml files | storage | Azure.Storage.DataMovement.Files.Shares | | storage | Azure.Storage.Internal.Avro | | synapse | Azure.Analytics.Synapse.Shared | +| tools | Azure.GeneratorAgent | | tools | Azure.SdkAnalyzers | | webpubsub | Azure.Messaging.WebPubSub.Client | diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/README.md b/sdk/anomalydetector/Azure.AI.AnomalyDetector/README.md index b30cdb77933a..38ca6ba6f7e4 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/README.md +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/README.md @@ -126,7 +126,7 @@ Console.WriteLine("Detecting anomalies in the entire time series."); try { - Response response = client.GetUnivariateClient().DetectUnivariateEntireSeries(request.ToRequestContent()); + Response response = client.GetUnivariateClient().DetectUnivariateEntireSeries(request); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; bool hasAnomaly = false; diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net10.0.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net10.0.cs index dd25bf3f00d8..95867a31de47 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net10.0.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net10.0.cs @@ -1,25 +1,5 @@ namespace Azure.AI.AnomalyDetector { - public static partial class AIAnomalyDetectorModelFactory - { - public static Azure.AI.AnomalyDetector.AnomalyDetectionModel AnomalyDetectionModel(System.Guid modelId = default(System.Guid), System.DateTimeOffset createdTime = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedTime = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.ModelInfo modelInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = default(float?), Azure.AI.AnomalyDetector.CorrelationChanges correlationChanges = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyState AnomalyState(System.DateTimeOffset timestamp = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.AnomalyValue value = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyValue AnomalyValue(bool isAnomaly = false, float severity = 0f, float score = 0f, System.Collections.Generic.IEnumerable interpretation = null) { throw null; } - public static Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges(System.Collections.Generic.IEnumerable changedVariables = null) { throw null; } - public static Azure.AI.AnomalyDetector.DiagnosticsInfo DiagnosticsInfo(Azure.AI.AnomalyDetector.ModelState modelState = null, System.Collections.Generic.IEnumerable variableStates = null) { throw null; } - public static Azure.AI.AnomalyDetector.ErrorResponse ErrorResponse(string code = null, string message = null) { throw null; } - public static Azure.AI.AnomalyDetector.ModelInfo ModelInfo(System.Uri dataSource = null, Azure.AI.AnomalyDetector.DataSchema? dataSchema = default(Azure.AI.AnomalyDetector.DataSchema?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset), string displayName = null, int? slidingWindow = default(int?), Azure.AI.AnomalyDetector.AlignPolicy alignPolicy = null, Azure.AI.AnomalyDetector.ModelStatus? status = default(Azure.AI.AnomalyDetector.ModelStatus?), System.Collections.Generic.IEnumerable errors = null, Azure.AI.AnomalyDetector.DiagnosticsInfo diagnosticsInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.ModelState ModelState(System.Collections.Generic.IEnumerable epochIds = null, System.Collections.Generic.IEnumerable trainLosses = null, System.Collections.Generic.IEnumerable validationLosses = null, System.Collections.Generic.IEnumerable latenciesInSeconds = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus status = default(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus), System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable variableStates = null, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions setupInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateDetectionResult MultivariateDetectionResult(System.Guid resultId = default(System.Guid), Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary summary = null, System.Collections.Generic.IEnumerable results = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateLastDetectionResult MultivariateLastDetectionResult(System.Collections.Generic.IEnumerable variableStates = null, System.Collections.Generic.IEnumerable results = null) { throw null; } - public static Azure.AI.AnomalyDetector.TimeSeriesPoint TimeSeriesPoint(System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), float value = 0f) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity granularity = default(Azure.AI.AnomalyDetector.TimeGranularity), int? customInterval = default(int?), int? period = default(int?), int? stableTrendWindow = default(int?), float? threshold = default(float?)) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = default(int?), System.Collections.Generic.IEnumerable isChangePoint = null, System.Collections.Generic.IEnumerable confidenceScores = null) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = 0, int suggestedWindow = 0, float expectedValue = 0f, float upperMargin = 0f, float lowerMargin = 0f, bool isAnomaly = false, bool isNegativeAnomaly = false, bool isPositiveAnomaly = false, float? severity = default(float?)) { throw null; } - public static Azure.AI.AnomalyDetector.VariableState VariableState(string variable = null, float? filledNARatio = default(float?), int? effectiveCount = default(int?), System.DateTimeOffset? firstTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? lastTimestamp = default(System.DateTimeOffset?)) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AlignMode : System.IEquatable { @@ -33,6 +13,7 @@ public static partial class AIAnomalyDetectorModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.AlignMode left, Azure.AI.AnomalyDetector.AlignMode right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.AlignMode (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.AlignMode? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.AlignMode left, Azure.AI.AnomalyDetector.AlignMode right) { throw null; } public override string ToString() { throw null; } } @@ -42,7 +23,10 @@ public AlignPolicy() { } public Azure.AI.AnomalyDetector.AlignMode? AlignMode { get { throw null; } set { } } public Azure.AI.AnomalyDetector.FillNAMethod? FillNAMethod { get { throw null; } set { } } public float? PaddingValue { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.AlignPolicy JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AlignPolicy PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AlignPolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AlignPolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -56,7 +40,11 @@ internal AnomalyDetectionModel() { } public System.DateTimeOffset LastUpdatedTime { get { throw null; } } public System.Guid ModelId { get { throw null; } } public Azure.AI.AnomalyDetector.ModelInfo ModelInfo { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyDetectionModel JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.AnomalyDetectionModel (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.AnomalyDetectionModel PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyDetectionModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyDetectionModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -80,13 +68,41 @@ public enum ServiceVersion V1_1 = 1, } } + public static partial class AnomalyDetectorModelFactory + { + public static Azure.AI.AnomalyDetector.AlignPolicy AlignPolicy(Azure.AI.AnomalyDetector.AlignMode? alignMode = default(Azure.AI.AnomalyDetector.AlignMode?), Azure.AI.AnomalyDetector.FillNAMethod? fillNAMethod = default(Azure.AI.AnomalyDetector.FillNAMethod?), float? paddingValue = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyDetectionModel AnomalyDetectionModel(System.Guid modelId = default(System.Guid), System.DateTimeOffset createdTime = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedTime = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.ModelInfo modelInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = default(float?), Azure.AI.AnomalyDetector.CorrelationChanges correlationChanges = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyState AnomalyState(System.DateTimeOffset timestamp = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.AnomalyValue value = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyValue AnomalyValue(bool isAnomaly = false, float severity = 0f, float score = 0f, System.Collections.Generic.IEnumerable interpretation = null) { throw null; } + public static Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges(System.Collections.Generic.IEnumerable changedVariables = null) { throw null; } + public static Azure.AI.AnomalyDetector.DiagnosticsInfo DiagnosticsInfo(Azure.AI.AnomalyDetector.ModelState modelState = null, System.Collections.Generic.IEnumerable variableStates = null) { throw null; } + public static Azure.AI.AnomalyDetector.ErrorResponse ErrorResponse(string code = null, string message = null) { throw null; } + public static Azure.AI.AnomalyDetector.ModelInfo ModelInfo(System.Uri dataSource = null, Azure.AI.AnomalyDetector.DataSchema? dataSchema = default(Azure.AI.AnomalyDetector.DataSchema?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset), string displayName = null, int? slidingWindow = default(int?), Azure.AI.AnomalyDetector.AlignPolicy alignPolicy = null, Azure.AI.AnomalyDetector.ModelStatus? status = default(Azure.AI.AnomalyDetector.ModelStatus?), System.Collections.Generic.IEnumerable errors = null, Azure.AI.AnomalyDetector.DiagnosticsInfo diagnosticsInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.ModelState ModelState(System.Collections.Generic.IEnumerable epochIds = null, System.Collections.Generic.IEnumerable trainLosses = null, System.Collections.Generic.IEnumerable validationLosses = null, System.Collections.Generic.IEnumerable latenciesInSeconds = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions MultivariateBatchDetectionOptions(System.Uri dataSource = null, int? topContributorCount = default(int?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset)) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus status = default(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus), System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable variableStates = null, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions setupInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateDetectionResult MultivariateDetectionResult(System.Guid resultId = default(System.Guid), Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary summary = null, System.Collections.Generic.IEnumerable results = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions MultivariateLastDetectionOptions(System.Collections.Generic.IEnumerable variables = null, int? topContributorCount = default(int?)) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateLastDetectionResult MultivariateLastDetectionResult(System.Collections.Generic.IEnumerable variableStates = null, System.Collections.Generic.IEnumerable results = null) { throw null; } + public static Azure.AI.AnomalyDetector.TimeSeriesPoint TimeSeriesPoint(System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), float value = 0f) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity granularity = default(Azure.AI.AnomalyDetector.TimeGranularity), int? customInterval = default(int?), int? period = default(int?), int? stableTrendWindow = default(int?), float? threshold = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = default(int?), System.Collections.Generic.IEnumerable isChangePoint = null, System.Collections.Generic.IEnumerable confidenceScores = null) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateDetectionOptions UnivariateDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity? granularity = default(Azure.AI.AnomalyDetector.TimeGranularity?), int? customInterval = default(int?), int? period = default(int?), float? maxAnomalyRatio = default(float?), int? sensitivity = default(int?), Azure.AI.AnomalyDetector.ImputeMode? imputeMode = default(Azure.AI.AnomalyDetector.ImputeMode?), float? imputeFixedValue = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = 0, int suggestedWindow = 0, float expectedValue = 0f, float upperMargin = 0f, float lowerMargin = 0f, bool isAnomaly = false, bool isNegativeAnomaly = false, bool isPositiveAnomaly = false, float? severity = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.VariableState VariableState(string variable = null, float? filledNARatio = default(float?), int? effectiveCount = default(int?), System.DateTimeOffset? firstTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? lastTimestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.AnomalyDetector.VariableValues VariableValues(string variable = null, System.Collections.Generic.IEnumerable timestamps = null, System.Collections.Generic.IEnumerable values = null) { throw null; } + } public partial class AnomalyInterpretation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyInterpretation() { } public float? ContributionScore { get { throw null; } } public Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyInterpretation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyInterpretation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyInterpretation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyInterpretation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -96,10 +112,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AnomalyState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyState() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset Timestamp { get { throw null; } } public Azure.AI.AnomalyDetector.AnomalyValue Value { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -109,11 +128,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AnomalyValue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyValue() { } - public System.Collections.Generic.IReadOnlyList Interpretation { get { throw null; } } + public System.Collections.Generic.IList Interpretation { get { throw null; } } public bool IsAnomaly { get { throw null; } } public float Score { get { throw null; } } public float Severity { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyValue JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyValue PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyValue System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyValue System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -129,8 +151,11 @@ internal AzureAIAnomalyDetectorContext() { } public partial class CorrelationChanges : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal CorrelationChanges() { } - public System.Collections.Generic.IReadOnlyList ChangedVariables { get { throw null; } } + public System.Collections.Generic.IList ChangedVariables { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.CorrelationChanges JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.CorrelationChanges PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.CorrelationChanges System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.CorrelationChanges System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -150,6 +175,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.DataSchema (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.DataSchema? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; } public override string ToString() { throw null; } } @@ -157,8 +183,11 @@ public partial class DiagnosticsInfo : System.ClientModel.Primitives.IJsonModel< { internal DiagnosticsInfo() { } public Azure.AI.AnomalyDetector.ModelState ModelState { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.DiagnosticsInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.DiagnosticsInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.DiagnosticsInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.DiagnosticsInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -170,7 +199,10 @@ public partial class ErrorResponse : System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ErrorResponse System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -193,6 +225,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.FillNAMethod left, Azure.AI.AnomalyDetector.FillNAMethod right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.FillNAMethod (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.FillNAMethod? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.FillNAMethod left, Azure.AI.AnomalyDetector.FillNAMethod right) { throw null; } public override string ToString() { throw null; } } @@ -213,6 +246,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.ImputeMode left, Azure.AI.AnomalyDetector.ImputeMode right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.ImputeMode (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.ImputeMode? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.ImputeMode left, Azure.AI.AnomalyDetector.ImputeMode right) { throw null; } public override string ToString() { throw null; } } @@ -229,7 +263,11 @@ public ModelInfo(System.Uri dataSource, System.DateTimeOffset startTime, System. public int? SlidingWindow { get { throw null; } set { } } public System.DateTimeOffset StartTime { get { throw null; } set { } } public Azure.AI.AnomalyDetector.ModelStatus? Status { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.ModelInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.ModelInfo modelInfo) { throw null; } + protected virtual Azure.AI.AnomalyDetector.ModelInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.ModelInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ModelInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -239,11 +277,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class ModelState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ModelState() { } - public System.Collections.Generic.IReadOnlyList EpochIds { get { throw null; } } - public System.Collections.Generic.IReadOnlyList LatenciesInSeconds { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TrainLosses { get { throw null; } } - public System.Collections.Generic.IReadOnlyList ValidationLosses { get { throw null; } } + public System.Collections.Generic.IList EpochIds { get { throw null; } } + public System.Collections.Generic.IList LatenciesInSeconds { get { throw null; } } + public System.Collections.Generic.IList TrainLosses { get { throw null; } } + public System.Collections.Generic.IList ValidationLosses { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.ModelState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.ModelState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.ModelState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ModelState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -265,6 +306,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.ModelStatus left, Azure.AI.AnomalyDetector.ModelStatus right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.ModelStatus (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.ModelStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.ModelStatus left, Azure.AI.AnomalyDetector.ModelStatus right) { throw null; } public override string ToString() { throw null; } } @@ -272,8 +314,10 @@ public partial class Multivariate { protected Multivariate() { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response DeleteMultivariateModel(string modelId, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteMultivariateModel(string modelId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response DeleteMultivariateModel(string modelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DetectMultivariateBatchAnomaly(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DetectMultivariateBatchAnomaly(string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task> DetectMultivariateBatchAnomalyAsync(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -306,7 +350,11 @@ public MultivariateBatchDetectionOptions(System.Uri dataSource, System.DateTimeO public System.DateTimeOffset EndTime { get { throw null; } set { } } public System.DateTimeOffset StartTime { get { throw null; } set { } } public int? TopContributorCount { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions multivariateBatchDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -316,11 +364,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MultivariateBatchDetectionResultSummary : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MultivariateBatchDetectionResultSummary() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions SetupInfo { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus Status { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -342,6 +393,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus left, Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus left, Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus right) { throw null; } public override string ToString() { throw null; } } @@ -349,9 +401,13 @@ public partial class MultivariateDetectionResult : System.ClientModel.Primitives { internal MultivariateDetectionResult() { } public System.Guid ResultId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary Summary { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.MultivariateDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -363,7 +419,11 @@ public partial class MultivariateLastDetectionOptions : System.ClientModel.Primi public MultivariateLastDetectionOptions(System.Collections.Generic.IEnumerable variables) { } public int? TopContributorCount { get { throw null; } set { } } public System.Collections.Generic.IList Variables { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions multivariateLastDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -373,9 +433,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MultivariateLastDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MultivariateLastDetectionResult() { } - public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.MultivariateLastDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateLastDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateLastDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -402,6 +466,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.TimeGranularity left, Azure.AI.AnomalyDetector.TimeGranularity right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.TimeGranularity (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.TimeGranularity? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.TimeGranularity left, Azure.AI.AnomalyDetector.TimeGranularity right) { throw null; } public override string ToString() { throw null; } } @@ -410,7 +475,10 @@ public partial class TimeSeriesPoint : System.ClientModel.Primitives.IJsonModel< public TimeSeriesPoint(float value) { } public System.DateTimeOffset? Timestamp { get { throw null; } set { } } public float Value { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.TimeSeriesPoint JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.TimeSeriesPoint PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.TimeSeriesPoint System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.TimeSeriesPoint System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -441,7 +509,11 @@ public UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumera public System.Collections.Generic.IList Series { get { throw null; } } public int? StableTrendWindow { get { throw null; } set { } } public float? Threshold { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions univariateChangePointDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -451,10 +523,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class UnivariateChangePointDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal UnivariateChangePointDetectionResult() { } - public System.Collections.Generic.IReadOnlyList ConfidenceScores { get { throw null; } } - public System.Collections.Generic.IReadOnlyList IsChangePoint { get { throw null; } } + public System.Collections.Generic.IList ConfidenceScores { get { throw null; } } + public System.Collections.Generic.IList IsChangePoint { get { throw null; } } public int? Period { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -472,7 +548,11 @@ public UnivariateDetectionOptions(System.Collections.Generic.IEnumerable Series { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.UnivariateDetectionOptions univariateDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -491,7 +571,11 @@ internal UnivariateLastDetectionResult() { } public float? Severity { get { throw null; } } public int SuggestedWindow { get { throw null; } } public float UpperMargin { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateLastDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.UnivariateLastDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateLastDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateLastDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateLastDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -506,7 +590,10 @@ internal VariableState() { } public System.DateTimeOffset? FirstTimestamp { get { throw null; } } public System.DateTimeOffset? LastTimestamp { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.VariableState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.VariableState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.VariableState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.VariableState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -519,7 +606,10 @@ public VariableValues(string variable, System.Collections.Generic.IEnumerable Timestamps { get { throw null; } } public System.Collections.Generic.IList Values { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.VariableValues JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.VariableValues PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.VariableValues System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.VariableValues System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -529,7 +619,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } namespace Microsoft.Extensions.Azure { - public static partial class AIAnomalyDetectorClientBuilderExtensions + public static partial class AnomalyDetectorClientBuilderExtensions { public static Azure.Core.Extensions.IAzureClientBuilder AddAnomalyDetectorClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net8.0.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net8.0.cs index dd25bf3f00d8..95867a31de47 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net8.0.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.net8.0.cs @@ -1,25 +1,5 @@ namespace Azure.AI.AnomalyDetector { - public static partial class AIAnomalyDetectorModelFactory - { - public static Azure.AI.AnomalyDetector.AnomalyDetectionModel AnomalyDetectionModel(System.Guid modelId = default(System.Guid), System.DateTimeOffset createdTime = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedTime = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.ModelInfo modelInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = default(float?), Azure.AI.AnomalyDetector.CorrelationChanges correlationChanges = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyState AnomalyState(System.DateTimeOffset timestamp = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.AnomalyValue value = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyValue AnomalyValue(bool isAnomaly = false, float severity = 0f, float score = 0f, System.Collections.Generic.IEnumerable interpretation = null) { throw null; } - public static Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges(System.Collections.Generic.IEnumerable changedVariables = null) { throw null; } - public static Azure.AI.AnomalyDetector.DiagnosticsInfo DiagnosticsInfo(Azure.AI.AnomalyDetector.ModelState modelState = null, System.Collections.Generic.IEnumerable variableStates = null) { throw null; } - public static Azure.AI.AnomalyDetector.ErrorResponse ErrorResponse(string code = null, string message = null) { throw null; } - public static Azure.AI.AnomalyDetector.ModelInfo ModelInfo(System.Uri dataSource = null, Azure.AI.AnomalyDetector.DataSchema? dataSchema = default(Azure.AI.AnomalyDetector.DataSchema?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset), string displayName = null, int? slidingWindow = default(int?), Azure.AI.AnomalyDetector.AlignPolicy alignPolicy = null, Azure.AI.AnomalyDetector.ModelStatus? status = default(Azure.AI.AnomalyDetector.ModelStatus?), System.Collections.Generic.IEnumerable errors = null, Azure.AI.AnomalyDetector.DiagnosticsInfo diagnosticsInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.ModelState ModelState(System.Collections.Generic.IEnumerable epochIds = null, System.Collections.Generic.IEnumerable trainLosses = null, System.Collections.Generic.IEnumerable validationLosses = null, System.Collections.Generic.IEnumerable latenciesInSeconds = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus status = default(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus), System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable variableStates = null, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions setupInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateDetectionResult MultivariateDetectionResult(System.Guid resultId = default(System.Guid), Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary summary = null, System.Collections.Generic.IEnumerable results = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateLastDetectionResult MultivariateLastDetectionResult(System.Collections.Generic.IEnumerable variableStates = null, System.Collections.Generic.IEnumerable results = null) { throw null; } - public static Azure.AI.AnomalyDetector.TimeSeriesPoint TimeSeriesPoint(System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), float value = 0f) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity granularity = default(Azure.AI.AnomalyDetector.TimeGranularity), int? customInterval = default(int?), int? period = default(int?), int? stableTrendWindow = default(int?), float? threshold = default(float?)) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = default(int?), System.Collections.Generic.IEnumerable isChangePoint = null, System.Collections.Generic.IEnumerable confidenceScores = null) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = 0, int suggestedWindow = 0, float expectedValue = 0f, float upperMargin = 0f, float lowerMargin = 0f, bool isAnomaly = false, bool isNegativeAnomaly = false, bool isPositiveAnomaly = false, float? severity = default(float?)) { throw null; } - public static Azure.AI.AnomalyDetector.VariableState VariableState(string variable = null, float? filledNARatio = default(float?), int? effectiveCount = default(int?), System.DateTimeOffset? firstTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? lastTimestamp = default(System.DateTimeOffset?)) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AlignMode : System.IEquatable { @@ -33,6 +13,7 @@ public static partial class AIAnomalyDetectorModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.AlignMode left, Azure.AI.AnomalyDetector.AlignMode right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.AlignMode (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.AlignMode? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.AlignMode left, Azure.AI.AnomalyDetector.AlignMode right) { throw null; } public override string ToString() { throw null; } } @@ -42,7 +23,10 @@ public AlignPolicy() { } public Azure.AI.AnomalyDetector.AlignMode? AlignMode { get { throw null; } set { } } public Azure.AI.AnomalyDetector.FillNAMethod? FillNAMethod { get { throw null; } set { } } public float? PaddingValue { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.AlignPolicy JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AlignPolicy PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AlignPolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AlignPolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -56,7 +40,11 @@ internal AnomalyDetectionModel() { } public System.DateTimeOffset LastUpdatedTime { get { throw null; } } public System.Guid ModelId { get { throw null; } } public Azure.AI.AnomalyDetector.ModelInfo ModelInfo { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyDetectionModel JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.AnomalyDetectionModel (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.AnomalyDetectionModel PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyDetectionModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyDetectionModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -80,13 +68,41 @@ public enum ServiceVersion V1_1 = 1, } } + public static partial class AnomalyDetectorModelFactory + { + public static Azure.AI.AnomalyDetector.AlignPolicy AlignPolicy(Azure.AI.AnomalyDetector.AlignMode? alignMode = default(Azure.AI.AnomalyDetector.AlignMode?), Azure.AI.AnomalyDetector.FillNAMethod? fillNAMethod = default(Azure.AI.AnomalyDetector.FillNAMethod?), float? paddingValue = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyDetectionModel AnomalyDetectionModel(System.Guid modelId = default(System.Guid), System.DateTimeOffset createdTime = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedTime = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.ModelInfo modelInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = default(float?), Azure.AI.AnomalyDetector.CorrelationChanges correlationChanges = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyState AnomalyState(System.DateTimeOffset timestamp = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.AnomalyValue value = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyValue AnomalyValue(bool isAnomaly = false, float severity = 0f, float score = 0f, System.Collections.Generic.IEnumerable interpretation = null) { throw null; } + public static Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges(System.Collections.Generic.IEnumerable changedVariables = null) { throw null; } + public static Azure.AI.AnomalyDetector.DiagnosticsInfo DiagnosticsInfo(Azure.AI.AnomalyDetector.ModelState modelState = null, System.Collections.Generic.IEnumerable variableStates = null) { throw null; } + public static Azure.AI.AnomalyDetector.ErrorResponse ErrorResponse(string code = null, string message = null) { throw null; } + public static Azure.AI.AnomalyDetector.ModelInfo ModelInfo(System.Uri dataSource = null, Azure.AI.AnomalyDetector.DataSchema? dataSchema = default(Azure.AI.AnomalyDetector.DataSchema?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset), string displayName = null, int? slidingWindow = default(int?), Azure.AI.AnomalyDetector.AlignPolicy alignPolicy = null, Azure.AI.AnomalyDetector.ModelStatus? status = default(Azure.AI.AnomalyDetector.ModelStatus?), System.Collections.Generic.IEnumerable errors = null, Azure.AI.AnomalyDetector.DiagnosticsInfo diagnosticsInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.ModelState ModelState(System.Collections.Generic.IEnumerable epochIds = null, System.Collections.Generic.IEnumerable trainLosses = null, System.Collections.Generic.IEnumerable validationLosses = null, System.Collections.Generic.IEnumerable latenciesInSeconds = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions MultivariateBatchDetectionOptions(System.Uri dataSource = null, int? topContributorCount = default(int?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset)) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus status = default(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus), System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable variableStates = null, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions setupInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateDetectionResult MultivariateDetectionResult(System.Guid resultId = default(System.Guid), Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary summary = null, System.Collections.Generic.IEnumerable results = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions MultivariateLastDetectionOptions(System.Collections.Generic.IEnumerable variables = null, int? topContributorCount = default(int?)) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateLastDetectionResult MultivariateLastDetectionResult(System.Collections.Generic.IEnumerable variableStates = null, System.Collections.Generic.IEnumerable results = null) { throw null; } + public static Azure.AI.AnomalyDetector.TimeSeriesPoint TimeSeriesPoint(System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), float value = 0f) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity granularity = default(Azure.AI.AnomalyDetector.TimeGranularity), int? customInterval = default(int?), int? period = default(int?), int? stableTrendWindow = default(int?), float? threshold = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = default(int?), System.Collections.Generic.IEnumerable isChangePoint = null, System.Collections.Generic.IEnumerable confidenceScores = null) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateDetectionOptions UnivariateDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity? granularity = default(Azure.AI.AnomalyDetector.TimeGranularity?), int? customInterval = default(int?), int? period = default(int?), float? maxAnomalyRatio = default(float?), int? sensitivity = default(int?), Azure.AI.AnomalyDetector.ImputeMode? imputeMode = default(Azure.AI.AnomalyDetector.ImputeMode?), float? imputeFixedValue = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = 0, int suggestedWindow = 0, float expectedValue = 0f, float upperMargin = 0f, float lowerMargin = 0f, bool isAnomaly = false, bool isNegativeAnomaly = false, bool isPositiveAnomaly = false, float? severity = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.VariableState VariableState(string variable = null, float? filledNARatio = default(float?), int? effectiveCount = default(int?), System.DateTimeOffset? firstTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? lastTimestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.AnomalyDetector.VariableValues VariableValues(string variable = null, System.Collections.Generic.IEnumerable timestamps = null, System.Collections.Generic.IEnumerable values = null) { throw null; } + } public partial class AnomalyInterpretation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyInterpretation() { } public float? ContributionScore { get { throw null; } } public Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyInterpretation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyInterpretation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyInterpretation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyInterpretation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -96,10 +112,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AnomalyState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyState() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset Timestamp { get { throw null; } } public Azure.AI.AnomalyDetector.AnomalyValue Value { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -109,11 +128,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AnomalyValue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyValue() { } - public System.Collections.Generic.IReadOnlyList Interpretation { get { throw null; } } + public System.Collections.Generic.IList Interpretation { get { throw null; } } public bool IsAnomaly { get { throw null; } } public float Score { get { throw null; } } public float Severity { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyValue JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyValue PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyValue System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyValue System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -129,8 +151,11 @@ internal AzureAIAnomalyDetectorContext() { } public partial class CorrelationChanges : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal CorrelationChanges() { } - public System.Collections.Generic.IReadOnlyList ChangedVariables { get { throw null; } } + public System.Collections.Generic.IList ChangedVariables { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.CorrelationChanges JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.CorrelationChanges PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.CorrelationChanges System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.CorrelationChanges System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -150,6 +175,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.DataSchema (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.DataSchema? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; } public override string ToString() { throw null; } } @@ -157,8 +183,11 @@ public partial class DiagnosticsInfo : System.ClientModel.Primitives.IJsonModel< { internal DiagnosticsInfo() { } public Azure.AI.AnomalyDetector.ModelState ModelState { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.DiagnosticsInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.DiagnosticsInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.DiagnosticsInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.DiagnosticsInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -170,7 +199,10 @@ public partial class ErrorResponse : System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ErrorResponse System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -193,6 +225,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.FillNAMethod left, Azure.AI.AnomalyDetector.FillNAMethod right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.FillNAMethod (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.FillNAMethod? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.FillNAMethod left, Azure.AI.AnomalyDetector.FillNAMethod right) { throw null; } public override string ToString() { throw null; } } @@ -213,6 +246,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.ImputeMode left, Azure.AI.AnomalyDetector.ImputeMode right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.ImputeMode (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.ImputeMode? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.ImputeMode left, Azure.AI.AnomalyDetector.ImputeMode right) { throw null; } public override string ToString() { throw null; } } @@ -229,7 +263,11 @@ public ModelInfo(System.Uri dataSource, System.DateTimeOffset startTime, System. public int? SlidingWindow { get { throw null; } set { } } public System.DateTimeOffset StartTime { get { throw null; } set { } } public Azure.AI.AnomalyDetector.ModelStatus? Status { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.ModelInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.ModelInfo modelInfo) { throw null; } + protected virtual Azure.AI.AnomalyDetector.ModelInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.ModelInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ModelInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -239,11 +277,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class ModelState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ModelState() { } - public System.Collections.Generic.IReadOnlyList EpochIds { get { throw null; } } - public System.Collections.Generic.IReadOnlyList LatenciesInSeconds { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TrainLosses { get { throw null; } } - public System.Collections.Generic.IReadOnlyList ValidationLosses { get { throw null; } } + public System.Collections.Generic.IList EpochIds { get { throw null; } } + public System.Collections.Generic.IList LatenciesInSeconds { get { throw null; } } + public System.Collections.Generic.IList TrainLosses { get { throw null; } } + public System.Collections.Generic.IList ValidationLosses { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.ModelState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.ModelState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.ModelState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ModelState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -265,6 +306,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.ModelStatus left, Azure.AI.AnomalyDetector.ModelStatus right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.ModelStatus (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.ModelStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.ModelStatus left, Azure.AI.AnomalyDetector.ModelStatus right) { throw null; } public override string ToString() { throw null; } } @@ -272,8 +314,10 @@ public partial class Multivariate { protected Multivariate() { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response DeleteMultivariateModel(string modelId, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteMultivariateModel(string modelId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response DeleteMultivariateModel(string modelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DetectMultivariateBatchAnomaly(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DetectMultivariateBatchAnomaly(string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task> DetectMultivariateBatchAnomalyAsync(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -306,7 +350,11 @@ public MultivariateBatchDetectionOptions(System.Uri dataSource, System.DateTimeO public System.DateTimeOffset EndTime { get { throw null; } set { } } public System.DateTimeOffset StartTime { get { throw null; } set { } } public int? TopContributorCount { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions multivariateBatchDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -316,11 +364,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MultivariateBatchDetectionResultSummary : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MultivariateBatchDetectionResultSummary() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions SetupInfo { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus Status { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -342,6 +393,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus left, Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus left, Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus right) { throw null; } public override string ToString() { throw null; } } @@ -349,9 +401,13 @@ public partial class MultivariateDetectionResult : System.ClientModel.Primitives { internal MultivariateDetectionResult() { } public System.Guid ResultId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary Summary { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.MultivariateDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -363,7 +419,11 @@ public partial class MultivariateLastDetectionOptions : System.ClientModel.Primi public MultivariateLastDetectionOptions(System.Collections.Generic.IEnumerable variables) { } public int? TopContributorCount { get { throw null; } set { } } public System.Collections.Generic.IList Variables { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions multivariateLastDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -373,9 +433,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MultivariateLastDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MultivariateLastDetectionResult() { } - public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.MultivariateLastDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateLastDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateLastDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -402,6 +466,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.TimeGranularity left, Azure.AI.AnomalyDetector.TimeGranularity right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.TimeGranularity (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.TimeGranularity? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.TimeGranularity left, Azure.AI.AnomalyDetector.TimeGranularity right) { throw null; } public override string ToString() { throw null; } } @@ -410,7 +475,10 @@ public partial class TimeSeriesPoint : System.ClientModel.Primitives.IJsonModel< public TimeSeriesPoint(float value) { } public System.DateTimeOffset? Timestamp { get { throw null; } set { } } public float Value { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.TimeSeriesPoint JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.TimeSeriesPoint PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.TimeSeriesPoint System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.TimeSeriesPoint System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -441,7 +509,11 @@ public UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumera public System.Collections.Generic.IList Series { get { throw null; } } public int? StableTrendWindow { get { throw null; } set { } } public float? Threshold { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions univariateChangePointDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -451,10 +523,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class UnivariateChangePointDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal UnivariateChangePointDetectionResult() { } - public System.Collections.Generic.IReadOnlyList ConfidenceScores { get { throw null; } } - public System.Collections.Generic.IReadOnlyList IsChangePoint { get { throw null; } } + public System.Collections.Generic.IList ConfidenceScores { get { throw null; } } + public System.Collections.Generic.IList IsChangePoint { get { throw null; } } public int? Period { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -472,7 +548,11 @@ public UnivariateDetectionOptions(System.Collections.Generic.IEnumerable Series { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.UnivariateDetectionOptions univariateDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -491,7 +571,11 @@ internal UnivariateLastDetectionResult() { } public float? Severity { get { throw null; } } public int SuggestedWindow { get { throw null; } } public float UpperMargin { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateLastDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.UnivariateLastDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateLastDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateLastDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateLastDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -506,7 +590,10 @@ internal VariableState() { } public System.DateTimeOffset? FirstTimestamp { get { throw null; } } public System.DateTimeOffset? LastTimestamp { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.VariableState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.VariableState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.VariableState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.VariableState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -519,7 +606,10 @@ public VariableValues(string variable, System.Collections.Generic.IEnumerable Timestamps { get { throw null; } } public System.Collections.Generic.IList Values { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.VariableValues JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.VariableValues PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.VariableValues System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.VariableValues System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -529,7 +619,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } namespace Microsoft.Extensions.Azure { - public static partial class AIAnomalyDetectorClientBuilderExtensions + public static partial class AnomalyDetectorClientBuilderExtensions { public static Azure.Core.Extensions.IAzureClientBuilder AddAnomalyDetectorClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } [System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.netstandard2.0.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.netstandard2.0.cs index 1a632cf55fc5..518315e144d6 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.netstandard2.0.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/api/Azure.AI.AnomalyDetector.netstandard2.0.cs @@ -1,25 +1,5 @@ namespace Azure.AI.AnomalyDetector { - public static partial class AIAnomalyDetectorModelFactory - { - public static Azure.AI.AnomalyDetector.AnomalyDetectionModel AnomalyDetectionModel(System.Guid modelId = default(System.Guid), System.DateTimeOffset createdTime = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedTime = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.ModelInfo modelInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = default(float?), Azure.AI.AnomalyDetector.CorrelationChanges correlationChanges = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyState AnomalyState(System.DateTimeOffset timestamp = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.AnomalyValue value = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } - public static Azure.AI.AnomalyDetector.AnomalyValue AnomalyValue(bool isAnomaly = false, float severity = 0f, float score = 0f, System.Collections.Generic.IEnumerable interpretation = null) { throw null; } - public static Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges(System.Collections.Generic.IEnumerable changedVariables = null) { throw null; } - public static Azure.AI.AnomalyDetector.DiagnosticsInfo DiagnosticsInfo(Azure.AI.AnomalyDetector.ModelState modelState = null, System.Collections.Generic.IEnumerable variableStates = null) { throw null; } - public static Azure.AI.AnomalyDetector.ErrorResponse ErrorResponse(string code = null, string message = null) { throw null; } - public static Azure.AI.AnomalyDetector.ModelInfo ModelInfo(System.Uri dataSource = null, Azure.AI.AnomalyDetector.DataSchema? dataSchema = default(Azure.AI.AnomalyDetector.DataSchema?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset), string displayName = null, int? slidingWindow = default(int?), Azure.AI.AnomalyDetector.AlignPolicy alignPolicy = null, Azure.AI.AnomalyDetector.ModelStatus? status = default(Azure.AI.AnomalyDetector.ModelStatus?), System.Collections.Generic.IEnumerable errors = null, Azure.AI.AnomalyDetector.DiagnosticsInfo diagnosticsInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.ModelState ModelState(System.Collections.Generic.IEnumerable epochIds = null, System.Collections.Generic.IEnumerable trainLosses = null, System.Collections.Generic.IEnumerable validationLosses = null, System.Collections.Generic.IEnumerable latenciesInSeconds = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus status = default(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus), System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable variableStates = null, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions setupInfo = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateDetectionResult MultivariateDetectionResult(System.Guid resultId = default(System.Guid), Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary summary = null, System.Collections.Generic.IEnumerable results = null) { throw null; } - public static Azure.AI.AnomalyDetector.MultivariateLastDetectionResult MultivariateLastDetectionResult(System.Collections.Generic.IEnumerable variableStates = null, System.Collections.Generic.IEnumerable results = null) { throw null; } - public static Azure.AI.AnomalyDetector.TimeSeriesPoint TimeSeriesPoint(System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), float value = 0f) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity granularity = default(Azure.AI.AnomalyDetector.TimeGranularity), int? customInterval = default(int?), int? period = default(int?), int? stableTrendWindow = default(int?), float? threshold = default(float?)) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = default(int?), System.Collections.Generic.IEnumerable isChangePoint = null, System.Collections.Generic.IEnumerable confidenceScores = null) { throw null; } - public static Azure.AI.AnomalyDetector.UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = 0, int suggestedWindow = 0, float expectedValue = 0f, float upperMargin = 0f, float lowerMargin = 0f, bool isAnomaly = false, bool isNegativeAnomaly = false, bool isPositiveAnomaly = false, float? severity = default(float?)) { throw null; } - public static Azure.AI.AnomalyDetector.VariableState VariableState(string variable = null, float? filledNARatio = default(float?), int? effectiveCount = default(int?), System.DateTimeOffset? firstTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? lastTimestamp = default(System.DateTimeOffset?)) { throw null; } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AlignMode : System.IEquatable { @@ -33,6 +13,7 @@ public static partial class AIAnomalyDetectorModelFactory public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.AlignMode left, Azure.AI.AnomalyDetector.AlignMode right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.AlignMode (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.AlignMode? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.AlignMode left, Azure.AI.AnomalyDetector.AlignMode right) { throw null; } public override string ToString() { throw null; } } @@ -42,7 +23,10 @@ public AlignPolicy() { } public Azure.AI.AnomalyDetector.AlignMode? AlignMode { get { throw null; } set { } } public Azure.AI.AnomalyDetector.FillNAMethod? FillNAMethod { get { throw null; } set { } } public float? PaddingValue { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.AlignPolicy JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AlignPolicy PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AlignPolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AlignPolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -56,7 +40,11 @@ internal AnomalyDetectionModel() { } public System.DateTimeOffset LastUpdatedTime { get { throw null; } } public System.Guid ModelId { get { throw null; } } public Azure.AI.AnomalyDetector.ModelInfo ModelInfo { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyDetectionModel JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.AnomalyDetectionModel (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.AnomalyDetectionModel PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyDetectionModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyDetectionModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -80,13 +68,41 @@ public enum ServiceVersion V1_1 = 1, } } + public static partial class AnomalyDetectorModelFactory + { + public static Azure.AI.AnomalyDetector.AlignPolicy AlignPolicy(Azure.AI.AnomalyDetector.AlignMode? alignMode = default(Azure.AI.AnomalyDetector.AlignMode?), Azure.AI.AnomalyDetector.FillNAMethod? fillNAMethod = default(Azure.AI.AnomalyDetector.FillNAMethod?), float? paddingValue = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyDetectionModel AnomalyDetectionModel(System.Guid modelId = default(System.Guid), System.DateTimeOffset createdTime = default(System.DateTimeOffset), System.DateTimeOffset lastUpdatedTime = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.ModelInfo modelInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = default(float?), Azure.AI.AnomalyDetector.CorrelationChanges correlationChanges = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyState AnomalyState(System.DateTimeOffset timestamp = default(System.DateTimeOffset), Azure.AI.AnomalyDetector.AnomalyValue value = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.AI.AnomalyDetector.AnomalyValue AnomalyValue(bool isAnomaly = false, float severity = 0f, float score = 0f, System.Collections.Generic.IEnumerable interpretation = null) { throw null; } + public static Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges(System.Collections.Generic.IEnumerable changedVariables = null) { throw null; } + public static Azure.AI.AnomalyDetector.DiagnosticsInfo DiagnosticsInfo(Azure.AI.AnomalyDetector.ModelState modelState = null, System.Collections.Generic.IEnumerable variableStates = null) { throw null; } + public static Azure.AI.AnomalyDetector.ErrorResponse ErrorResponse(string code = null, string message = null) { throw null; } + public static Azure.AI.AnomalyDetector.ModelInfo ModelInfo(System.Uri dataSource = null, Azure.AI.AnomalyDetector.DataSchema? dataSchema = default(Azure.AI.AnomalyDetector.DataSchema?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset), string displayName = null, int? slidingWindow = default(int?), Azure.AI.AnomalyDetector.AlignPolicy alignPolicy = null, Azure.AI.AnomalyDetector.ModelStatus? status = default(Azure.AI.AnomalyDetector.ModelStatus?), System.Collections.Generic.IEnumerable errors = null, Azure.AI.AnomalyDetector.DiagnosticsInfo diagnosticsInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.ModelState ModelState(System.Collections.Generic.IEnumerable epochIds = null, System.Collections.Generic.IEnumerable trainLosses = null, System.Collections.Generic.IEnumerable validationLosses = null, System.Collections.Generic.IEnumerable latenciesInSeconds = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions MultivariateBatchDetectionOptions(System.Uri dataSource = null, int? topContributorCount = default(int?), System.DateTimeOffset startTime = default(System.DateTimeOffset), System.DateTimeOffset endTime = default(System.DateTimeOffset)) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus status = default(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus), System.Collections.Generic.IEnumerable errors = null, System.Collections.Generic.IEnumerable variableStates = null, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions setupInfo = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateDetectionResult MultivariateDetectionResult(System.Guid resultId = default(System.Guid), Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary summary = null, System.Collections.Generic.IEnumerable results = null) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions MultivariateLastDetectionOptions(System.Collections.Generic.IEnumerable variables = null, int? topContributorCount = default(int?)) { throw null; } + public static Azure.AI.AnomalyDetector.MultivariateLastDetectionResult MultivariateLastDetectionResult(System.Collections.Generic.IEnumerable variableStates = null, System.Collections.Generic.IEnumerable results = null) { throw null; } + public static Azure.AI.AnomalyDetector.TimeSeriesPoint TimeSeriesPoint(System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), float value = 0f) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity granularity = default(Azure.AI.AnomalyDetector.TimeGranularity), int? customInterval = default(int?), int? period = default(int?), int? stableTrendWindow = default(int?), float? threshold = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = default(int?), System.Collections.Generic.IEnumerable isChangePoint = null, System.Collections.Generic.IEnumerable confidenceScores = null) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateDetectionOptions UnivariateDetectionOptions(System.Collections.Generic.IEnumerable series = null, Azure.AI.AnomalyDetector.TimeGranularity? granularity = default(Azure.AI.AnomalyDetector.TimeGranularity?), int? customInterval = default(int?), int? period = default(int?), float? maxAnomalyRatio = default(float?), int? sensitivity = default(int?), Azure.AI.AnomalyDetector.ImputeMode? imputeMode = default(Azure.AI.AnomalyDetector.ImputeMode?), float? imputeFixedValue = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = 0, int suggestedWindow = 0, float expectedValue = 0f, float upperMargin = 0f, float lowerMargin = 0f, bool isAnomaly = false, bool isNegativeAnomaly = false, bool isPositiveAnomaly = false, float? severity = default(float?)) { throw null; } + public static Azure.AI.AnomalyDetector.VariableState VariableState(string variable = null, float? filledNARatio = default(float?), int? effectiveCount = default(int?), System.DateTimeOffset? firstTimestamp = default(System.DateTimeOffset?), System.DateTimeOffset? lastTimestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.AI.AnomalyDetector.VariableValues VariableValues(string variable = null, System.Collections.Generic.IEnumerable timestamps = null, System.Collections.Generic.IEnumerable values = null) { throw null; } + } public partial class AnomalyInterpretation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyInterpretation() { } public float? ContributionScore { get { throw null; } } public Azure.AI.AnomalyDetector.CorrelationChanges CorrelationChanges { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyInterpretation JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyInterpretation PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyInterpretation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyInterpretation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -96,10 +112,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AnomalyState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyState() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public System.DateTimeOffset Timestamp { get { throw null; } } public Azure.AI.AnomalyDetector.AnomalyValue Value { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -109,11 +128,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class AnomalyValue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal AnomalyValue() { } - public System.Collections.Generic.IReadOnlyList Interpretation { get { throw null; } } + public System.Collections.Generic.IList Interpretation { get { throw null; } } public bool IsAnomaly { get { throw null; } } public float Score { get { throw null; } } public float Severity { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.AnomalyValue JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.AnomalyValue PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.AnomalyValue System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.AnomalyValue System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -129,8 +151,11 @@ internal AzureAIAnomalyDetectorContext() { } public partial class CorrelationChanges : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal CorrelationChanges() { } - public System.Collections.Generic.IReadOnlyList ChangedVariables { get { throw null; } } + public System.Collections.Generic.IList ChangedVariables { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.CorrelationChanges JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.CorrelationChanges PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.CorrelationChanges System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.CorrelationChanges System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -150,6 +175,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.DataSchema (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.DataSchema? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.DataSchema left, Azure.AI.AnomalyDetector.DataSchema right) { throw null; } public override string ToString() { throw null; } } @@ -157,8 +183,11 @@ public partial class DiagnosticsInfo : System.ClientModel.Primitives.IJsonModel< { internal DiagnosticsInfo() { } public Azure.AI.AnomalyDetector.ModelState ModelState { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.DiagnosticsInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.DiagnosticsInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.DiagnosticsInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.DiagnosticsInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -170,7 +199,10 @@ public partial class ErrorResponse : System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ErrorResponse System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -193,6 +225,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.FillNAMethod left, Azure.AI.AnomalyDetector.FillNAMethod right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.FillNAMethod (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.FillNAMethod? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.FillNAMethod left, Azure.AI.AnomalyDetector.FillNAMethod right) { throw null; } public override string ToString() { throw null; } } @@ -213,6 +246,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.ImputeMode left, Azure.AI.AnomalyDetector.ImputeMode right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.ImputeMode (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.ImputeMode? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.ImputeMode left, Azure.AI.AnomalyDetector.ImputeMode right) { throw null; } public override string ToString() { throw null; } } @@ -229,7 +263,11 @@ public ModelInfo(System.Uri dataSource, System.DateTimeOffset startTime, System. public int? SlidingWindow { get { throw null; } set { } } public System.DateTimeOffset StartTime { get { throw null; } set { } } public Azure.AI.AnomalyDetector.ModelStatus? Status { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.ModelInfo JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.ModelInfo modelInfo) { throw null; } + protected virtual Azure.AI.AnomalyDetector.ModelInfo PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.ModelInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ModelInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -239,11 +277,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class ModelState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal ModelState() { } - public System.Collections.Generic.IReadOnlyList EpochIds { get { throw null; } } - public System.Collections.Generic.IReadOnlyList LatenciesInSeconds { get { throw null; } } - public System.Collections.Generic.IReadOnlyList TrainLosses { get { throw null; } } - public System.Collections.Generic.IReadOnlyList ValidationLosses { get { throw null; } } + public System.Collections.Generic.IList EpochIds { get { throw null; } } + public System.Collections.Generic.IList LatenciesInSeconds { get { throw null; } } + public System.Collections.Generic.IList TrainLosses { get { throw null; } } + public System.Collections.Generic.IList ValidationLosses { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.ModelState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.ModelState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.ModelState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.ModelState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -265,6 +306,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.ModelStatus left, Azure.AI.AnomalyDetector.ModelStatus right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.ModelStatus (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.ModelStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.ModelStatus left, Azure.AI.AnomalyDetector.ModelStatus right) { throw null; } public override string ToString() { throw null; } } @@ -272,8 +314,10 @@ public partial class Multivariate { protected Multivariate() { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response DeleteMultivariateModel(string modelId, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteMultivariateModel(string modelId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response DeleteMultivariateModel(string modelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task DeleteMultivariateModelAsync(string modelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DetectMultivariateBatchAnomaly(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DetectMultivariateBatchAnomaly(string modelId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task> DetectMultivariateBatchAnomalyAsync(string modelId, Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -306,7 +350,11 @@ public MultivariateBatchDetectionOptions(System.Uri dataSource, System.DateTimeO public System.DateTimeOffset EndTime { get { throw null; } set { } } public System.DateTimeOffset StartTime { get { throw null; } set { } } public int? TopContributorCount { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions multivariateBatchDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -316,11 +364,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MultivariateBatchDetectionResultSummary : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MultivariateBatchDetectionResultSummary() { } - public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.Collections.Generic.IList Errors { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionOptions SetupInfo { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus Status { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -342,6 +393,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus left, Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus left, Azure.AI.AnomalyDetector.MultivariateBatchDetectionStatus right) { throw null; } public override string ToString() { throw null; } } @@ -349,9 +401,13 @@ public partial class MultivariateDetectionResult : System.ClientModel.Primitives { internal MultivariateDetectionResult() { } public System.Guid ResultId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } public Azure.AI.AnomalyDetector.MultivariateBatchDetectionResultSummary Summary { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.MultivariateDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -363,7 +419,11 @@ public partial class MultivariateLastDetectionOptions : System.ClientModel.Primi public MultivariateLastDetectionOptions(System.Collections.Generic.IEnumerable variables) { } public int? TopContributorCount { get { throw null; } set { } } public System.Collections.Generic.IList Variables { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions multivariateLastDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateLastDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -373,9 +433,13 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class MultivariateLastDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal MultivariateLastDetectionResult() { } - public System.Collections.Generic.IReadOnlyList Results { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VariableStates { get { throw null; } } + public System.Collections.Generic.IList Results { get { throw null; } } + public System.Collections.Generic.IList VariableStates { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.MultivariateLastDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.MultivariateLastDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.MultivariateLastDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.MultivariateLastDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -402,6 +466,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override int GetHashCode() { throw null; } public static bool operator ==(Azure.AI.AnomalyDetector.TimeGranularity left, Azure.AI.AnomalyDetector.TimeGranularity right) { throw null; } public static implicit operator Azure.AI.AnomalyDetector.TimeGranularity (string value) { throw null; } + public static implicit operator Azure.AI.AnomalyDetector.TimeGranularity? (string value) { throw null; } public static bool operator !=(Azure.AI.AnomalyDetector.TimeGranularity left, Azure.AI.AnomalyDetector.TimeGranularity right) { throw null; } public override string ToString() { throw null; } } @@ -410,7 +475,10 @@ public partial class TimeSeriesPoint : System.ClientModel.Primitives.IJsonModel< public TimeSeriesPoint(float value) { } public System.DateTimeOffset? Timestamp { get { throw null; } set { } } public float Value { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.TimeSeriesPoint JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.TimeSeriesPoint PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.TimeSeriesPoint System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.TimeSeriesPoint System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -441,7 +509,11 @@ public UnivariateChangePointDetectionOptions(System.Collections.Generic.IEnumera public System.Collections.Generic.IList Series { get { throw null; } } public int? StableTrendWindow { get { throw null; } set { } } public float? Threshold { get { throw null; } set { } } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions univariateChangePointDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -451,10 +523,14 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class UnivariateChangePointDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal UnivariateChangePointDetectionResult() { } - public System.Collections.Generic.IReadOnlyList ConfidenceScores { get { throw null; } } - public System.Collections.Generic.IReadOnlyList IsChangePoint { get { throw null; } } + public System.Collections.Generic.IList ConfidenceScores { get { throw null; } } + public System.Collections.Generic.IList IsChangePoint { get { throw null; } } public int? Period { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateChangePointDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -472,7 +548,11 @@ public UnivariateDetectionOptions(System.Collections.Generic.IEnumerable Series { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateDetectionOptions JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static implicit operator Azure.Core.RequestContent (Azure.AI.AnomalyDetector.UnivariateDetectionOptions univariateDetectionOptions) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateDetectionOptions PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateDetectionOptions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateDetectionOptions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -491,7 +571,11 @@ internal UnivariateLastDetectionResult() { } public float? Severity { get { throw null; } } public int SuggestedWindow { get { throw null; } } public float UpperMargin { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.UnivariateLastDetectionResult JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + public static explicit operator Azure.AI.AnomalyDetector.UnivariateLastDetectionResult (Azure.Response response) { throw null; } + protected virtual Azure.AI.AnomalyDetector.UnivariateLastDetectionResult PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.UnivariateLastDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.UnivariateLastDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -506,7 +590,10 @@ internal VariableState() { } public System.DateTimeOffset? FirstTimestamp { get { throw null; } } public System.DateTimeOffset? LastTimestamp { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.VariableState JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.VariableState PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.VariableState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.VariableState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -519,7 +606,10 @@ public VariableValues(string variable, System.Collections.Generic.IEnumerable Timestamps { get { throw null; } } public System.Collections.Generic.IList Values { get { throw null; } } public string Variable { get { throw null; } } + protected virtual Azure.AI.AnomalyDetector.VariableValues JsonModelCreateCore(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + protected virtual Azure.AI.AnomalyDetector.VariableValues PersistableModelCreateCore(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + protected virtual System.BinaryData PersistableModelWriteCore(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } Azure.AI.AnomalyDetector.VariableValues System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.AnomalyDetector.VariableValues System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -529,7 +619,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } namespace Microsoft.Extensions.Azure { - public static partial class AIAnomalyDetectorClientBuilderExtensions + public static partial class AnomalyDetectorClientBuilderExtensions { public static Azure.Core.Extensions.IAzureClientBuilder AddAnomalyDetectorClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } public static Azure.Core.Extensions.IAzureClientBuilder AddAnomalyDetectorClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/metadata.json b/sdk/anomalydetector/Azure.AI.AnomalyDetector/metadata.json new file mode 100644 index 000000000000..1a87858d6224 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/metadata.json @@ -0,0 +1,3 @@ +{ + "apiVersion": "v1.1" +} \ No newline at end of file diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/samples/Sample1_DetectEntireSeriesAnomaly.md b/sdk/anomalydetector/Azure.AI.AnomalyDetector/samples/Sample1_DetectEntireSeriesAnomaly.md index 86db2f2e181a..ad04e7779eeb 100755 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/samples/Sample1_DetectEntireSeriesAnomaly.md +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/samples/Sample1_DetectEntireSeriesAnomaly.md @@ -55,7 +55,7 @@ Console.WriteLine("Detecting anomalies in the entire time series."); try { - Response response = client.GetUnivariateClient().DetectUnivariateEntireSeries(request.ToRequestContent()); + Response response = client.GetUnivariateClient().DetectUnivariateEntireSeries(request); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; bool hasAnomaly = false; diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Azure.AI.AnomalyDetector.csproj b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Azure.AI.AnomalyDetector.csproj index 9ab1be401f84..ae767623f055 100755 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Azure.AI.AnomalyDetector.csproj +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Azure.AI.AnomalyDetector.csproj @@ -9,7 +9,6 @@ true $(NoWarn);CS1591;AZC0012 true - true diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.RestClient.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.RestClient.cs new file mode 100644 index 000000000000..7b4dd99a7f87 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.RestClient.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.AnomalyDetector +{ + /// + public partial class AnomalyDetectorClient + { + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs index 28869804a4bb..5708b7542f3e 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClient.cs @@ -7,12 +7,12 @@ using System; using System.Threading; +using Azure; using Azure.Core; using Azure.Core.Pipeline; namespace Azure.AI.AnomalyDetector { - // Data plane generated client. /// /// The Anomaly Detector API detects anomalies automatically in time series data. /// It supports both a stateless detection mode and a @@ -33,17 +33,13 @@ namespace Azure.AI.AnomalyDetector /// public partial class AnomalyDetectorClient { - private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; - private readonly AzureKeyCredential _keyCredential; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; + /// A credential used to authenticate to the service. + private readonly AzureKeyCredential _keyCredential; + private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; + private Univariate _cachedUnivariate; + private Multivariate _cachedMultivariate; /// Initializes a new instance of AnomalyDetectorClient for mocking. protected AnomalyDetectorClient() @@ -51,50 +47,48 @@ protected AnomalyDetectorClient() } /// Initializes a new instance of AnomalyDetectorClient. - /// - /// Supported Azure Cognitive Services endpoints (protocol and host name, such as - /// https://westus2.api.cognitive.microsoft.com). - /// - /// A credential used to authenticate to an Azure Service. + /// Service endpoint. + /// A credential used to authenticate to the service. /// or is null. public AnomalyDetectorClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new AnomalyDetectorClientOptions()) { } /// Initializes a new instance of AnomalyDetectorClient. - /// - /// Supported Azure Cognitive Services endpoints (protocol and host name, such as - /// https://westus2.api.cognitive.microsoft.com). - /// - /// A credential used to authenticate to an Azure Service. + /// Service endpoint. + /// A credential used to authenticate to the service. /// The options for configuring the client. /// or is null. public AnomalyDetectorClient(Uri endpoint, AzureKeyCredential credential, AnomalyDetectorClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AnomalyDetectorClientOptions(); - ClientDiagnostics = new ClientDiagnostics(options, true); - _keyCredential = credential; - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }, new ResponseClassifier()); _endpoint = endpoint; + _keyCredential = credential; + Pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }); _apiVersion = options.Version; + ClientDiagnostics = new ClientDiagnostics(options, true); } - private Univariate _cachedUnivariate; - private Multivariate _cachedMultivariate; + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } /// Initializes a new instance of Univariate. public virtual Univariate GetUnivariateClient() { - return Volatile.Read(ref _cachedUnivariate) ?? Interlocked.CompareExchange(ref _cachedUnivariate, new Univariate(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, _apiVersion), null) ?? _cachedUnivariate; + return Volatile.Read(ref _cachedUnivariate) ?? Interlocked.CompareExchange(ref _cachedUnivariate, new Univariate(ClientDiagnostics, Pipeline, _endpoint, _apiVersion), null) ?? _cachedUnivariate; } /// Initializes a new instance of Multivariate. public virtual Multivariate GetMultivariateClient() { - return Volatile.Read(ref _cachedMultivariate) ?? Interlocked.CompareExchange(ref _cachedMultivariate, new Multivariate(ClientDiagnostics, _pipeline, _keyCredential, _endpoint, _apiVersion), null) ?? _cachedMultivariate; + return Volatile.Read(ref _cachedMultivariate) ?? Interlocked.CompareExchange(ref _cachedMultivariate, new Multivariate(ClientDiagnostics, Pipeline, _endpoint, _apiVersion), null) ?? _cachedMultivariate; } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorClientBuilderExtensions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClientBuilderExtensions.cs similarity index 58% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorClientBuilderExtensions.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClientBuilderExtensions.cs index 2f527e4cd1b5..a6cf3f03bfec 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorClientBuilderExtensions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClientBuilderExtensions.cs @@ -13,29 +13,30 @@ namespace Microsoft.Extensions.Azure { - /// Extension methods to add to client builder. - public static partial class AIAnomalyDetectorClientBuilderExtensions + /// Extension methods to add clients to . + public static partial class AnomalyDetectorClientBuilderExtensions { - /// Registers a instance. + /// Registers a client with the specified . /// The builder to register with. - /// - /// Supported Azure Cognitive Services endpoints (protocol and host name, such as - /// https://westus2.api.cognitive.microsoft.com). - /// - /// A credential used to authenticate to an Azure Service. + /// Service endpoint. + /// A credential used to authenticate to the service. + /// or is null. public static IAzureClientBuilder AddAnomalyDetectorClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) - where TBuilder : IAzureClientFactoryBuilder + where TBuilder : IAzureClientFactoryBuilder { - return builder.RegisterClientFactory((options) => new AnomalyDetectorClient(endpoint, credential, options)); + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + + return builder.RegisterClientFactory(options => new AnomalyDetectorClient(endpoint, credential, options)); } - /// Registers a instance. + /// Registers a client with the specified . /// The builder to register with. - /// The configuration values. + /// The configuration to use for the client. [RequiresUnreferencedCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] [RequiresDynamicCode("Requires unreferenced code until we opt into EnableConfigurationBindingGenerator.")] public static IAzureClientBuilder AddAnomalyDetectorClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration + where TBuilder : IAzureClientFactoryBuilderWithConfiguration { return builder.RegisterClientFactory(configuration); } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClientOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClientOptions.cs index 66de90f89c8c..6476576e6505 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClientOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorClientOptions.cs @@ -10,21 +10,13 @@ namespace Azure.AI.AnomalyDetector { - /// Client options for AnomalyDetectorClient. + /// Client options for . public partial class AnomalyDetectorClientOptions : ClientOptions { private const ServiceVersion LatestVersion = ServiceVersion.V1_1; - /// The version of the service to use. - public enum ServiceVersion - { - /// Service version "v1.1". - V1_1 = 1, - } - - internal string Version { get; } - - /// Initializes new instance of AnomalyDetectorClientOptions. + /// Initializes a new instance of AnomalyDetectorClientOptions. + /// The service version. public AnomalyDetectorClientOptions(ServiceVersion version = LatestVersion) { Version = version switch @@ -33,5 +25,15 @@ public AnomalyDetectorClientOptions(ServiceVersion version = LatestVersion) _ => throw new NotSupportedException() }; } + + /// Gets the Version. + internal string Version { get; } + + /// The version of the service to use. + public enum ServiceVersion + { + /// V1_1. + V1_1 = 1 + } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorModelFactory.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorModelFactory.cs similarity index 53% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorModelFactory.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorModelFactory.cs index 626724564619..53b8f0016001 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AIAnomalyDetectorModelFactory.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectorModelFactory.cs @@ -11,19 +11,71 @@ namespace Azure.AI.AnomalyDetector { - /// Model factory for models. - public static partial class AIAnomalyDetectorModelFactory + /// A factory class for creating instances of the models for mocking. + public static partial class AnomalyDetectorModelFactory { - /// Initializes a new instance of . + /// Request of the entire or last anomaly detection. + /// + /// Time series data points. Points should be sorted by time stamp in ascending + /// order to match the anomaly detection result. If the data is not sorted + /// correctly or there's a duplicated time stamp, the API won't work. In such + /// a case, an error message is returned. + /// + /// + /// Argument that indicates time granularity. If granularity is not present, the value + /// is none by default. If granularity is none, the time stamp property in the time + /// series point can be absent. + /// + /// + /// A custom interval is used to set a nonstandard time interval. For example, if the + /// series is 5 minutes, the request can be set as {"granularity":"minutely", + /// "customInterval":5}. + /// + /// + /// Argument that indicates the periodic value of a time series. If the value is null or + /// is not present, the API determines the period automatically. + /// + /// Argument that indicates an advanced model parameter. It's the maximum anomaly ratio in a time series. + /// + /// Argument that indicates an advanced model parameter between 0 and 99. The lower the value + /// is, the larger the margin value is, which means fewer anomalies will be + /// accepted. + /// + /// + /// Specifies how to deal with missing values in the input series. It's used + /// when granularity is not "none". + /// + /// + /// Specifies the value to fill. It's used when granularity is not "none" + /// and imputeMode is "fixed". + /// + /// A new instance for mocking. + public static UnivariateDetectionOptions UnivariateDetectionOptions(IEnumerable series = default, TimeGranularity? granularity = default, int? customInterval = default, int? period = default, float? maxAnomalyRatio = default, int? sensitivity = default, ImputeMode? imputeMode = default, float? imputeFixedValue = default) + { + series ??= new ChangeTrackingList(); + + return new UnivariateDetectionOptions( + series.ToList(), + granularity, + customInterval, + period, + maxAnomalyRatio, + sensitivity, + imputeMode, + imputeFixedValue, + additionalBinaryDataProperties: null); + } + + /// Definition of input time series points. /// Argument that indicates the time stamp of a data point (ISO8601 format). /// Measurement of that point. /// A new instance for mocking. - public static TimeSeriesPoint TimeSeriesPoint(DateTimeOffset? timestamp = null, float value = default) + public static TimeSeriesPoint TimeSeriesPoint(DateTimeOffset? timestamp = default, float value = default) { - return new TimeSeriesPoint(timestamp, value, serializedAdditionalRawData: null); + return new TimeSeriesPoint(timestamp, value, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Response of the last anomaly detection. /// /// Frequency extracted from the series. Zero means no recurrent pattern has been /// found. @@ -58,7 +110,7 @@ public static TimeSeriesPoint TimeSeriesPoint(DateTimeOffset? timestamp = null, /// severe the anomaly is. For normal points, the severity is always 0. /// /// A new instance for mocking. - public static UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = default, int suggestedWindow = default, float expectedValue = default, float upperMargin = default, float lowerMargin = default, bool isAnomaly = default, bool isNegativeAnomaly = default, bool isPositiveAnomaly = default, float? severity = null) + public static UnivariateLastDetectionResult UnivariateLastDetectionResult(int period = default, int suggestedWindow = default, float expectedValue = default, float upperMargin = default, float lowerMargin = default, bool isAnomaly = default, bool isNegativeAnomaly = default, bool isPositiveAnomaly = default, float? severity = default) { return new UnivariateLastDetectionResult( period, @@ -70,10 +122,10 @@ public static UnivariateLastDetectionResult UnivariateLastDetectionResult(int pe isNegativeAnomaly, isPositiveAnomaly, severity, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Request of change point detection. /// /// Time series data points. Points should be sorted by time stamp in ascending /// order to match the change point detection result. @@ -98,21 +150,21 @@ public static UnivariateLastDetectionResult UnivariateLastDetectionResult(int pe /// be accepted. /// /// A new instance for mocking. - public static UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(IEnumerable series = null, TimeGranularity granularity = default, int? customInterval = null, int? period = null, int? stableTrendWindow = null, float? threshold = null) + public static UnivariateChangePointDetectionOptions UnivariateChangePointDetectionOptions(IEnumerable series = default, TimeGranularity granularity = default, int? customInterval = default, int? period = default, int? stableTrendWindow = default, float? threshold = default) { - series ??= new List(); + series ??= new ChangeTrackingList(); return new UnivariateChangePointDetectionOptions( - series?.ToList(), + series.ToList(), granularity, customInterval, period, stableTrendWindow, threshold, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Response of change point detection. /// /// Frequency extracted from the series. Zero means no recurrent pattern has been /// found. @@ -124,27 +176,27 @@ public static UnivariateChangePointDetectionOptions UnivariateChangePointDetecti /// /// Change point confidence of each point. /// A new instance for mocking. - public static UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = null, IEnumerable isChangePoint = null, IEnumerable confidenceScores = null) + public static UnivariateChangePointDetectionResult UnivariateChangePointDetectionResult(int? period = default, IEnumerable isChangePoint = default, IEnumerable confidenceScores = default) { - isChangePoint ??= new List(); - confidenceScores ??= new List(); + isChangePoint ??= new ChangeTrackingList(); + confidenceScores ??= new ChangeTrackingList(); - return new UnivariateChangePointDetectionResult(period, isChangePoint?.ToList(), confidenceScores?.ToList(), serializedAdditionalRawData: null); + return new UnivariateChangePointDetectionResult(period, isChangePoint.ToList(), confidenceScores.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Detection results for the resultId value. /// Result identifier that's used to fetch the results of an inference call. /// Multivariate anomaly detection status. /// Detection result for each time stamp. /// A new instance for mocking. - public static MultivariateDetectionResult MultivariateDetectionResult(Guid resultId = default, MultivariateBatchDetectionResultSummary summary = null, IEnumerable results = null) + public static MultivariateDetectionResult MultivariateDetectionResult(Guid resultId = default, MultivariateBatchDetectionResultSummary summary = default, IEnumerable results = default) { - results ??= new List(); + results ??= new ChangeTrackingList(); - return new MultivariateDetectionResult(resultId, summary, results?.ToList(), serializedAdditionalRawData: null); + return new MultivariateDetectionResult(resultId, summary, results.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Multivariate anomaly detection status. /// Status of detection results. /// Error message when detection fails. /// Variable status. @@ -153,31 +205,31 @@ public static MultivariateDetectionResult MultivariateDetectionResult(Guid resul /// will need another API to get detection results. /// /// A new instance for mocking. - public static MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatus status = default, IEnumerable errors = null, IEnumerable variableStates = null, MultivariateBatchDetectionOptions setupInfo = null) + public static MultivariateBatchDetectionResultSummary MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatus status = default, IEnumerable errors = default, IEnumerable variableStates = default, MultivariateBatchDetectionOptions setupInfo = default) { - errors ??= new List(); - variableStates ??= new List(); + errors ??= new ChangeTrackingList(); + variableStates ??= new ChangeTrackingList(); - return new MultivariateBatchDetectionResultSummary(status, errors?.ToList(), variableStates?.ToList(), setupInfo, serializedAdditionalRawData: null); + return new MultivariateBatchDetectionResultSummary(status, errors.ToList(), variableStates.ToList(), setupInfo, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Error information that the API returned. /// Error code. /// Message that explains the error that the service reported. /// A new instance for mocking. - public static ErrorResponse ErrorResponse(string code = null, string message = null) + public static ErrorResponse ErrorResponse(string code = default, string message = default) { - return new ErrorResponse(code, message, serializedAdditionalRawData: null); + return new ErrorResponse(code, message, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Variable status. /// Variable name in variable states. /// Proportion of missing values that need to be filled by fillNAMethod. /// Number of effective data points before fillNAMethod is applied. /// First valid time stamp with a value of input data. /// Last valid time stamp with a value of input data. /// A new instance for mocking. - public static VariableState VariableState(string variable = null, float? filledNARatio = null, int? effectiveCount = null, DateTimeOffset? firstTimestamp = null, DateTimeOffset? lastTimestamp = null) + public static VariableState VariableState(string variable = default, float? filledNARatio = default, int? effectiveCount = default, DateTimeOffset? firstTimestamp = default, DateTimeOffset? lastTimestamp = default) { return new VariableState( variable, @@ -185,22 +237,49 @@ public static VariableState VariableState(string variable = null, float? filledN effectiveCount, firstTimestamp, lastTimestamp, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// + /// Detection request for batch inference. This is an asynchronous inference that + /// will need another API to get detection results. + /// + /// + /// Source link to the input data to indicate an accessible Azure Storage URI. + /// It either points to an Azure Blob Storage folder or points to a CSV file in + /// Azure Blob Storage, based on your data schema selection. The data schema should + /// be exactly the same as those used in the training phase. The input data must + /// contain at least slidingWindow entries preceding the start time of the data + /// to be detected. + /// + /// Number of top contributed variables for one anomalous time stamp in the response. + /// + /// Start date/time of data for detection, which should + /// be in ISO 8601 format. + /// + /// + /// End date/time of data for detection, which should + /// be in ISO 8601 format. + /// + /// A new instance for mocking. + public static MultivariateBatchDetectionOptions MultivariateBatchDetectionOptions(Uri dataSource = default, int? topContributorCount = default, DateTimeOffset startTime = default, DateTimeOffset endTime = default) + { + return new MultivariateBatchDetectionOptions(dataSource, topContributorCount, startTime, endTime, additionalBinaryDataProperties: null); + } + + /// Anomaly status and information. /// Time stamp for this anomaly. /// Detailed value of this anomalous time stamp. /// Error message for the current time stamp. /// A new instance for mocking. - public static AnomalyState AnomalyState(DateTimeOffset timestamp = default, AnomalyValue value = null, IEnumerable errors = null) + public static AnomalyState AnomalyState(DateTimeOffset timestamp = default, AnomalyValue value = default, IEnumerable errors = default) { - errors ??= new List(); + errors ??= new ChangeTrackingList(); - return new AnomalyState(timestamp, value, errors?.ToList(), serializedAdditionalRawData: null); + return new AnomalyState(timestamp, value, errors.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Detailed information of the anomalous time stamp. /// True if an anomaly is detected at the current time stamp. /// /// Indicates the significance of the anomaly. The higher the severity, the more @@ -209,14 +288,14 @@ public static AnomalyState AnomalyState(DateTimeOffset timestamp = default, Anom /// Raw anomaly score of severity, to help indicate the degree of abnormality. /// Interpretation of this anomalous time stamp. /// A new instance for mocking. - public static AnomalyValue AnomalyValue(bool isAnomaly = default, float severity = default, float score = default, IEnumerable interpretation = null) + public static AnomalyValue AnomalyValue(bool isAnomaly = default, float severity = default, float score = default, IEnumerable interpretation = default) { - interpretation ??= new List(); + interpretation ??= new ChangeTrackingList(); - return new AnomalyValue(isAnomaly, severity, score, interpretation?.ToList(), serializedAdditionalRawData: null); + return new AnomalyValue(isAnomaly, severity, score, interpretation.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Interpretation of the anomalous time stamp. /// Variable. /// /// This score shows the percentage that contributes to the anomalous time stamp. It's a @@ -224,22 +303,25 @@ public static AnomalyValue AnomalyValue(bool isAnomaly = default, float severity /// /// Correlation changes among the anomalous variables. /// A new instance for mocking. - public static AnomalyInterpretation AnomalyInterpretation(string variable = null, float? contributionScore = null, CorrelationChanges correlationChanges = null) + public static AnomalyInterpretation AnomalyInterpretation(string variable = default, float? contributionScore = default, CorrelationChanges correlationChanges = default) { - return new AnomalyInterpretation(variable, contributionScore, correlationChanges, serializedAdditionalRawData: null); + return new AnomalyInterpretation(variable, contributionScore, correlationChanges, additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Correlation changes among the anomalous variables. /// Correlated variables that have correlation changes under an anomaly. /// A new instance for mocking. - public static CorrelationChanges CorrelationChanges(IEnumerable changedVariables = null) + public static CorrelationChanges CorrelationChanges(IEnumerable changedVariables = default) { - changedVariables ??= new List(); + changedVariables ??= new ChangeTrackingList(); - return new CorrelationChanges(changedVariables?.ToList(), serializedAdditionalRawData: null); + return new CorrelationChanges(changedVariables.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// + /// Training result of a model, including its status, errors, and diagnostics + /// information. + /// /// /// Source link to the input data to indicate an accessible Azure Storage URI. /// It either points to an Azure Blob Storage folder or points to a CSV file in @@ -270,9 +352,9 @@ public static CorrelationChanges CorrelationChanges(IEnumerable changedV /// Error messages after failure to create a model. /// Diagnostics information to help inspect the states of a model or variable. /// A new instance for mocking. - public static ModelInfo ModelInfo(Uri dataSource = null, DataSchema? dataSchema = null, DateTimeOffset startTime = default, DateTimeOffset endTime = default, string displayName = null, int? slidingWindow = null, AlignPolicy alignPolicy = null, ModelStatus? status = null, IEnumerable errors = null, DiagnosticsInfo diagnosticsInfo = null) + public static ModelInfo ModelInfo(Uri dataSource = default, DataSchema? dataSchema = default, DateTimeOffset startTime = default, DateTimeOffset endTime = default, string displayName = default, int? slidingWindow = default, AlignPolicy alignPolicy = default, ModelStatus? status = default, IEnumerable errors = default, DiagnosticsInfo diagnosticsInfo = default) { - errors ??= new List(); + errors ??= new ChangeTrackingList(); return new ModelInfo( dataSource, @@ -283,23 +365,36 @@ public static ModelInfo ModelInfo(Uri dataSource = null, DataSchema? dataSchema slidingWindow, alignPolicy, status, - errors?.ToList(), + errors.ToList(), diagnosticsInfo, - serializedAdditionalRawData: null); + additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Manner of aligning multiple variables. + /// + /// Field that indicates how to align different variables to the same + /// time range. + /// + /// Field that indicates how missing values will be filled. + /// Field that's required when fillNAMethod is Fixed. + /// A new instance for mocking. + public static AlignPolicy AlignPolicy(AlignMode? alignMode = default, FillNAMethod? fillNAMethod = default, float? paddingValue = default) + { + return new AlignPolicy(alignMode, fillNAMethod, paddingValue, additionalBinaryDataProperties: null); + } + + /// Diagnostics information to help inspect the states of a model or variable. /// Model status. /// Variable status. /// A new instance for mocking. - public static DiagnosticsInfo DiagnosticsInfo(ModelState modelState = null, IEnumerable variableStates = null) + public static DiagnosticsInfo DiagnosticsInfo(ModelState modelState = default, IEnumerable variableStates = default) { - variableStates ??= new List(); + variableStates ??= new ChangeTrackingList(); - return new DiagnosticsInfo(modelState, variableStates?.ToList(), serializedAdditionalRawData: null); + return new DiagnosticsInfo(modelState, variableStates.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Model status. /// /// Number of passes of the entire training dataset that the /// algorithm has completed. @@ -314,17 +409,17 @@ public static DiagnosticsInfo DiagnosticsInfo(ModelState modelState = null, IEnu /// /// Latency for each epoch. /// A new instance for mocking. - public static ModelState ModelState(IEnumerable epochIds = null, IEnumerable trainLosses = null, IEnumerable validationLosses = null, IEnumerable latenciesInSeconds = null) + public static ModelState ModelState(IEnumerable epochIds = default, IEnumerable trainLosses = default, IEnumerable validationLosses = default, IEnumerable latenciesInSeconds = default) { - epochIds ??= new List(); - trainLosses ??= new List(); - validationLosses ??= new List(); - latenciesInSeconds ??= new List(); + epochIds ??= new ChangeTrackingList(); + trainLosses ??= new ChangeTrackingList(); + validationLosses ??= new ChangeTrackingList(); + latenciesInSeconds ??= new ChangeTrackingList(); - return new ModelState(epochIds?.ToList(), trainLosses?.ToList(), validationLosses?.ToList(), latenciesInSeconds?.ToList(), serializedAdditionalRawData: null); + return new ModelState(epochIds.ToList(), trainLosses.ToList(), validationLosses.ToList(), latenciesInSeconds.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Response of getting a model. /// Model identifier. /// Date and time (UTC) when the model was created. /// Date and time (UTC) when the model was last updated. @@ -333,21 +428,52 @@ public static ModelState ModelState(IEnumerable epochIds = null, IEnumerabl /// information. /// /// A new instance for mocking. - public static AnomalyDetectionModel AnomalyDetectionModel(Guid modelId = default, DateTimeOffset createdTime = default, DateTimeOffset lastUpdatedTime = default, ModelInfo modelInfo = null) + public static AnomalyDetectionModel AnomalyDetectionModel(Guid modelId = default, DateTimeOffset createdTime = default, DateTimeOffset lastUpdatedTime = default, ModelInfo modelInfo = default) + { + return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo, additionalBinaryDataProperties: null); + } + + /// Request of the last detection. + /// + /// Contains the inference data, including the name, time stamps (ISO 8601), and + /// values of variables. + /// + /// + /// Number of top contributed + /// variables for one anomalous time stamp in the response. The default is + /// 10. + /// + /// A new instance for mocking. + public static MultivariateLastDetectionOptions MultivariateLastDetectionOptions(IEnumerable variables = default, int? topContributorCount = default) + { + variables ??= new ChangeTrackingList(); + + return new MultivariateLastDetectionOptions(variables.ToList(), topContributorCount, additionalBinaryDataProperties: null); + } + + /// Variable values. + /// Variable name of the last detection request. + /// Time stamps of the last detection request. + /// Values of variables. + /// A new instance for mocking. + public static VariableValues VariableValues(string variable = default, IEnumerable timestamps = default, IEnumerable values = default) { - return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo, serializedAdditionalRawData: null); + timestamps ??= new ChangeTrackingList(); + values ??= new ChangeTrackingList(); + + return new VariableValues(variable, timestamps.ToList(), values.ToList(), additionalBinaryDataProperties: null); } - /// Initializes a new instance of . + /// Results of the last detection. /// Variable status. /// Anomaly status and information. /// A new instance for mocking. - public static MultivariateLastDetectionResult MultivariateLastDetectionResult(IEnumerable variableStates = null, IEnumerable results = null) + public static MultivariateLastDetectionResult MultivariateLastDetectionResult(IEnumerable variableStates = default, IEnumerable results = default) { - variableStates ??= new List(); - results ??= new List(); + variableStates ??= new ChangeTrackingList(); + results ??= new ChangeTrackingList(); - return new MultivariateLastDetectionResult(variableStates?.ToList(), results?.ToList(), serializedAdditionalRawData: null); + return new MultivariateLastDetectionResult(variableStates.ToList(), results.ToList(), additionalBinaryDataProperties: null); } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.cs deleted file mode 100644 index 5eb76bea55b4..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.AnomalyDetector -{ - /// Anomaly status and information. - public partial class AnomalyState - { - /// - /// 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 . - /// Time stamp for this anomaly. - internal AnomalyState(DateTimeOffset timestamp) - { - Timestamp = timestamp; - Errors = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Time stamp for this anomaly. - /// Detailed value of this anomalous time stamp. - /// Error message for the current time stamp. - /// Keeps track of any properties unknown to the library. - internal AnomalyState(DateTimeOffset timestamp, AnomalyValue value, IReadOnlyList errors, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - Value = value; - Errors = errors; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AnomalyState() - { - } - - /// Time stamp for this anomaly. - public DateTimeOffset Timestamp { get; } - /// Detailed value of this anomalous time stamp. - public AnomalyValue Value { get; } - /// Error message for the current time stamp. - public IReadOnlyList Errors { get; } - } -} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsAsyncCollectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsAsyncCollectionResult.cs new file mode 100644 index 000000000000..baf190ab6dd0 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsAsyncCollectionResult.cs @@ -0,0 +1,87 @@ +// 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.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.AnomalyDetector +{ + internal partial class MultivariateGetMultivariateModelsAsyncCollectionResult : AsyncPageable + { + private readonly Multivariate _client; + private readonly int? _skip; + private readonly int? _maxCount; + private readonly RequestContext _context; + + /// Initializes a new instance of MultivariateGetMultivariateModelsAsyncCollectionResult, which is used to iterate over the pages of a collection. + /// The Multivariate client used to send requests. + /// The number of result items to skip. + /// The number of result items to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public MultivariateGetMultivariateModelsAsyncCollectionResult(Multivariate client, int? skip, int? maxCount, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _skip = skip; + _maxCount = maxCount; + _context = context; + } + + /// Gets the pages of MultivariateGetMultivariateModelsAsyncCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of MultivariateGetMultivariateModelsAsyncCollectionResult as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ModelList result = (ModelList)response; + List items = new List(); + foreach (var item in result.Models) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAIAnomalyDetectorContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + string nextPageString = result.NextLink; + if (string.IsNullOrEmpty(nextPageString)) + { + yield break; + } + nextPage = new Uri(nextPageString); + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetMultivariateModelsRequest(nextLink, _skip, _maxCount, _context) : _client.CreateGetMultivariateModelsRequest(_skip, _maxCount, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModels"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsAsyncCollectionResultOfT.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsAsyncCollectionResultOfT.cs new file mode 100644 index 000000000000..ac780d7b6fb3 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsAsyncCollectionResultOfT.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; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.AnomalyDetector +{ + internal partial class MultivariateGetMultivariateModelsAsyncCollectionResultOfT : AsyncPageable + { + private readonly Multivariate _client; + private readonly int? _skip; + private readonly int? _maxCount; + private readonly RequestContext _context; + + /// Initializes a new instance of MultivariateGetMultivariateModelsAsyncCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Multivariate client used to send requests. + /// The number of result items to skip. + /// The number of result items to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public MultivariateGetMultivariateModelsAsyncCollectionResultOfT(Multivariate client, int? skip, int? maxCount, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _skip = skip; + _maxCount = maxCount; + _context = context; + } + + /// Gets the pages of MultivariateGetMultivariateModelsAsyncCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of MultivariateGetMultivariateModelsAsyncCollectionResultOfT as an enumerable collection. + public override async IAsyncEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = await GetNextResponseAsync(pageSizeHint, nextPage).ConfigureAwait(false); + if (response is null) + { + yield break; + } + ModelList result = (ModelList)response; + yield return Page.FromValues((IReadOnlyList)result.Models, nextPage?.AbsoluteUri, response); + string nextPageString = result.NextLink; + if (string.IsNullOrEmpty(nextPageString)) + { + yield break; + } + nextPage = new Uri(nextPageString); + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private async ValueTask GetNextResponseAsync(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetMultivariateModelsRequest(nextLink, _skip, _maxCount, _context) : _client.CreateGetMultivariateModelsRequest(_skip, _maxCount, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModels"); + scope.Start(); + try + { + return await _client.Pipeline.ProcessMessageAsync(message, _context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsCollectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsCollectionResult.cs new file mode 100644 index 000000000000..eec7c2654a05 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsCollectionResult.cs @@ -0,0 +1,86 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.AnomalyDetector +{ + internal partial class MultivariateGetMultivariateModelsCollectionResult : Pageable + { + private readonly Multivariate _client; + private readonly int? _skip; + private readonly int? _maxCount; + private readonly RequestContext _context; + + /// Initializes a new instance of MultivariateGetMultivariateModelsCollectionResult, which is used to iterate over the pages of a collection. + /// The Multivariate client used to send requests. + /// The number of result items to skip. + /// The number of result items to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public MultivariateGetMultivariateModelsCollectionResult(Multivariate client, int? skip, int? maxCount, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _skip = skip; + _maxCount = maxCount; + _context = context; + } + + /// Gets the pages of MultivariateGetMultivariateModelsCollectionResult as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of MultivariateGetMultivariateModelsCollectionResult as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ModelList result = (ModelList)response; + List items = new List(); + foreach (var item in result.Models) + { + items.Add(ModelReaderWriter.Write(item, ModelSerializationExtensions.WireOptions, AzureAIAnomalyDetectorContext.Default)); + } + yield return Page.FromValues(items, nextPage?.AbsoluteUri, response); + string nextPageString = result.NextLink; + if (string.IsNullOrEmpty(nextPageString)) + { + yield break; + } + nextPage = new Uri(nextPageString); + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetMultivariateModelsRequest(nextLink, _skip, _maxCount, _context) : _client.CreateGetMultivariateModelsRequest(_skip, _maxCount, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModels"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsCollectionResultOfT.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsCollectionResultOfT.cs new file mode 100644 index 000000000000..4a11d2151ae8 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CollectionResults/MultivariateGetMultivariateModelsCollectionResultOfT.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.AnomalyDetector +{ + internal partial class MultivariateGetMultivariateModelsCollectionResultOfT : Pageable + { + private readonly Multivariate _client; + private readonly int? _skip; + private readonly int? _maxCount; + private readonly RequestContext _context; + + /// Initializes a new instance of MultivariateGetMultivariateModelsCollectionResultOfT, which is used to iterate over the pages of a collection. + /// The Multivariate client used to send requests. + /// The number of result items to skip. + /// The number of result items to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + public MultivariateGetMultivariateModelsCollectionResultOfT(Multivariate client, int? skip, int? maxCount, RequestContext context) : base(context?.CancellationToken ?? default) + { + _client = client; + _skip = skip; + _maxCount = maxCount; + _context = context; + } + + /// Gets the pages of MultivariateGetMultivariateModelsCollectionResultOfT as an enumerable collection. + /// A continuation token indicating where to resume paging. + /// The number of items per page. + /// The pages of MultivariateGetMultivariateModelsCollectionResultOfT as an enumerable collection. + public override IEnumerable> AsPages(string continuationToken, int? pageSizeHint) + { + Uri nextPage = continuationToken != null ? new Uri(continuationToken) : null; + while (true) + { + Response response = GetNextResponse(pageSizeHint, nextPage); + if (response is null) + { + yield break; + } + ModelList result = (ModelList)response; + yield return Page.FromValues((IReadOnlyList)result.Models, nextPage?.AbsoluteUri, response); + string nextPageString = result.NextLink; + if (string.IsNullOrEmpty(nextPageString)) + { + yield break; + } + nextPage = new Uri(nextPageString); + } + } + + /// Get next page. + /// The number of items per page. + /// The next link to use for the next page of results. + private Response GetNextResponse(int? pageSizeHint, Uri nextLink) + { + HttpMessage message = nextLink != null ? _client.CreateNextGetMultivariateModelsRequest(nextLink, _skip, _maxCount, _context) : _client.CreateGetMultivariateModelsRequest(_skip, _maxCount, _context); + using DiagnosticScope scope = _client.ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModels"); + scope.Start(); + try + { + return _client.Pipeline.ProcessMessage(message, _context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.Serialization.cs deleted file mode 100644 index 89d58b586c59..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.Serialization.cs +++ /dev/null @@ -1,159 +0,0 @@ -// 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.Core; - -namespace Azure.AI.AnomalyDetector -{ - public partial class CorrelationChanges : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(CorrelationChanges)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(ChangedVariables)) - { - writer.WritePropertyName("changedVariables"u8); - writer.WriteStartArray(); - foreach (var item in ChangedVariables) - { - writer.WriteStringValue(item); - } - 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, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CorrelationChanges 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(CorrelationChanges)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCorrelationChanges(document.RootElement, options); - } - - internal static CorrelationChanges DeserializeCorrelationChanges(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList changedVariables = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("changedVariables"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - changedVariables = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CorrelationChanges(changedVariables ?? new ChangeTrackingList(), 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(CorrelationChanges)} does not support writing '{options.Format}' format."); - } - } - - CorrelationChanges 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, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCorrelationChanges(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CorrelationChanges)} 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 CorrelationChanges FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCorrelationChanges(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.cs deleted file mode 100644 index a15516beee30..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/CorrelationChanges.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.AnomalyDetector -{ - /// Correlation changes among the anomalous variables. - public partial class CorrelationChanges - { - /// - /// 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 . - internal CorrelationChanges() - { - ChangedVariables = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Correlated variables that have correlation changes under an anomaly. - /// Keeps track of any properties unknown to the library. - internal CorrelationChanges(IReadOnlyList changedVariables, IDictionary serializedAdditionalRawData) - { - ChangedVariables = changedVariables; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Correlated variables that have correlation changes under an anomaly. - public IReadOnlyList ChangedVariables { get; } - } -} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.cs deleted file mode 100644 index 41d720c51357..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.AnomalyDetector -{ - /// Diagnostics information to help inspect the states of a model or variable. - public partial class DiagnosticsInfo - { - /// - /// 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 . - internal DiagnosticsInfo() - { - VariableStates = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Model status. - /// Variable status. - /// Keeps track of any properties unknown to the library. - internal DiagnosticsInfo(ModelState modelState, IReadOnlyList variableStates, IDictionary serializedAdditionalRawData) - { - ModelState = modelState; - VariableStates = variableStates; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Model status. - public ModelState ModelState { get; } - /// Variable status. - public IReadOnlyList VariableStates { get; } - } -} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Docs/Multivariate.xml b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Docs/Multivariate.xml deleted file mode 100644 index 36f0861211bb..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Docs/Multivariate.xml +++ /dev/null @@ -1,897 +0,0 @@ - - - - - -This sample shows how to call GetMultivariateBatchDetectionResultAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("663884e6-b117-11ea-b3de-0242ac130004")); -]]> - - - -This sample shows how to call GetMultivariateBatchDetectionResult. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("663884e6-b117-11ea-b3de-0242ac130004")); -]]> - - - -This sample shows how to call GetMultivariateBatchDetectionResultAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = await client.GetMultivariateBatchDetectionResultAsync(Guid.Parse("663884e6-b117-11ea-b3de-0242ac130004"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("resultId").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); -]]> - - - -This sample shows how to call GetMultivariateBatchDetectionResult and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = client.GetMultivariateBatchDetectionResult(Guid.Parse("663884e6-b117-11ea-b3de-0242ac130004"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("resultId").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); -]]> - - - -This sample shows how to call TrainMultivariateModelAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -ModelInfo modelInfo = new ModelInfo(new Uri("https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv"), DateTimeOffset.Parse("2019-04-01T00:00:00Z"), DateTimeOffset.Parse("2019-04-02T00:00:00Z")) -{ - DataSchema = DataSchema.OneTable, - DisplayName = "Devops-MultiAD", - SlidingWindow = 20, - AlignPolicy = new AlignPolicy - { - AlignMode = AlignMode.Outer, - FillNAMethod = FillNAMethod.Linear, - PaddingValue = 0F, - }, -}; -Response response = await client.TrainMultivariateModelAsync(modelInfo); -]]> - - - -This sample shows how to call TrainMultivariateModel. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -ModelInfo modelInfo = new ModelInfo(new Uri("https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv"), DateTimeOffset.Parse("2019-04-01T00:00:00Z"), DateTimeOffset.Parse("2019-04-02T00:00:00Z")) -{ - DataSchema = DataSchema.OneTable, - DisplayName = "Devops-MultiAD", - SlidingWindow = 20, - AlignPolicy = new AlignPolicy - { - AlignMode = AlignMode.Outer, - FillNAMethod = FillNAMethod.Linear, - PaddingValue = 0F, - }, -}; -Response response = client.TrainMultivariateModel(modelInfo); -]]> - - - -This sample shows how to call TrainMultivariateModelAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - slidingWindow = 20, - alignPolicy = new - { - alignMode = "Outer", - fillNAMethod = "Linear", - paddingValue = 0F, - }, - dataSource = "https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv", - dataSchema = "OneTable", - startTime = "2019-04-01T00:00:00Z", - endTime = "2019-04-02T00:00:00Z", - displayName = "Devops-MultiAD", -}); -Response response = await client.TrainMultivariateModelAsync(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); -]]> - - - -This sample shows how to call TrainMultivariateModel and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - slidingWindow = 20, - alignPolicy = new - { - alignMode = "Outer", - fillNAMethod = "Linear", - paddingValue = 0F, - }, - dataSource = "https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv", - dataSchema = "OneTable", - startTime = "2019-04-01T00:00:00Z", - endTime = "2019-04-02T00:00:00Z", - displayName = "Devops-MultiAD", -}); -Response response = client.TrainMultivariateModel(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); -]]> - - - -This sample shows how to call DeleteMultivariateModelAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = await client.DeleteMultivariateModelAsync("45aad126-aafd-11ea-b8fb-d89ef3400c5f"); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call DeleteMultivariateModel. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = client.DeleteMultivariateModel("45aad126-aafd-11ea-b8fb-d89ef3400c5f"); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call GetMultivariateModelAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = await client.GetMultivariateModelAsync("45aad126-aafd-11ea-b8fb-d89ef3400c5f"); -]]> - - - -This sample shows how to call GetMultivariateModel. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = client.GetMultivariateModel("45aad126-aafd-11ea-b8fb-d89ef3400c5f"); -]]> - - - -This sample shows how to call GetMultivariateModelAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = await client.GetMultivariateModelAsync("45aad126-aafd-11ea-b8fb-d89ef3400c5f", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); -]]> - - - -This sample shows how to call GetMultivariateModel and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -Response response = client.GetMultivariateModel("45aad126-aafd-11ea-b8fb-d89ef3400c5f", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); -]]> - - - -This sample shows how to call DetectMultivariateBatchAnomalyAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv"), DateTimeOffset.Parse("2019-04-01T00:15:00Z"), DateTimeOffset.Parse("2019-04-01T00:40:00Z")) -{ - TopContributorCount = 10, -}; -Response response = await client.DetectMultivariateBatchAnomalyAsync("45aad126-aafd-11ea-b8fb-d89ef3400c5f", options); -]]> - - - -This sample shows how to call DetectMultivariateBatchAnomaly. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -MultivariateBatchDetectionOptions options = new MultivariateBatchDetectionOptions(new Uri("https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv"), DateTimeOffset.Parse("2019-04-01T00:15:00Z"), DateTimeOffset.Parse("2019-04-01T00:40:00Z")) -{ - TopContributorCount = 10, -}; -Response response = client.DetectMultivariateBatchAnomaly("45aad126-aafd-11ea-b8fb-d89ef3400c5f", options); -]]> - - - -This sample shows how to call DetectMultivariateBatchAnomalyAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - dataSource = "https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv", - topContributorCount = 10, - startTime = "2019-04-01T00:15:00Z", - endTime = "2019-04-01T00:40:00Z", -}); -Response response = await client.DetectMultivariateBatchAnomalyAsync("45aad126-aafd-11ea-b8fb-d89ef3400c5f", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("resultId").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); -]]> - - - -This sample shows how to call DetectMultivariateBatchAnomaly and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - dataSource = "https://multiadsample.blob.core.windows.net/data/sample_data_2_1000.csv", - topContributorCount = 10, - startTime = "2019-04-01T00:15:00Z", - endTime = "2019-04-01T00:40:00Z", -}); -Response response = client.DetectMultivariateBatchAnomaly("45aad126-aafd-11ea-b8fb-d89ef3400c5f", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("resultId").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("dataSource").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("summary").GetProperty("setupInfo").GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("results")[0].GetProperty("timestamp").ToString()); -]]> - - - -This sample shows how to call DetectMultivariateLastAnomalyAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new VariableValues[] -{ - new VariableValues("Variable_1", new string[]{"2021-01-01T00:00:00Z", "2021-01-01T00:01:00Z", "2021-01-01T00:02:00Z", "2021-01-01T00:03:00Z", "2021-01-01T00:04:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:06:00Z", "2021-01-01T00:07:00Z", "2021-01-01T00:08:00Z", "2021-01-01T00:09:00Z", "2021-01-01T00:10:00Z", "2021-01-01T00:11:00Z", "2021-01-01T00:12:00Z", "2021-01-01T00:13:00Z", "2021-01-01T00:14:00Z", "2021-01-01T00:15:00Z", "2021-01-01T00:16:00Z", "2021-01-01T00:17:00Z", "2021-01-01T00:18:00Z", "2021-01-01T00:19:00Z", "2021-01-01T00:20:00Z", "2021-01-01T00:21:00Z", "2021-01-01T00:22:00Z", "2021-01-01T00:23:00Z", "2021-01-01T00:24:00Z", "2021-01-01T00:25:00Z", "2021-01-01T00:26:00Z", "2021-01-01T00:27:00Z", "2021-01-01T00:28:00Z", "2021-01-01T00:29:00Z"}, new float[]{0.45513785F, 0.73886037F, 0.20108825F, 0.7462812F, 0.07308129F, 0.33090475F, 0.7544925F, 0.98750633F, 0.6665933F, 0.6308352F, 0.0808331F, 0.8414416F, 0.5145835F, 0.095448986F, 0.7786793F, 0.41646135F, 0.030176187F, 0.3474215F, 0.5085302F, 0.424512F, 0.21159442F, 0.2473352F, 0.87910223F, 0.94796216F, 0.26702702F, 0.69545037F, 0.12357284F, 0.82149154F, 0.11813002F, 0.8579046F}), - new VariableValues("Variable_2", new string[]{"2021-01-01T00:00:00Z", "2021-01-01T00:01:00Z", "2021-01-01T00:02:00Z", "2021-01-01T00:03:00Z", "2021-01-01T00:04:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:06:00Z", "2021-01-01T00:07:00Z", "2021-01-01T00:08:00Z", "2021-01-01T00:09:00Z", "2021-01-01T00:10:00Z", "2021-01-01T00:11:00Z", "2021-01-01T00:12:00Z", "2021-01-01T00:13:00Z", "2021-01-01T00:14:00Z", "2021-01-01T00:15:00Z", "2021-01-01T00:16:00Z", "2021-01-01T00:17:00Z", "2021-01-01T00:18:00Z", "2021-01-01T00:19:00Z", "2021-01-01T00:20:00Z", "2021-01-01T00:21:00Z", "2021-01-01T00:22:00Z", "2021-01-01T00:23:00Z", "2021-01-01T00:24:00Z", "2021-01-01T00:25:00Z", "2021-01-01T00:26:00Z", "2021-01-01T00:27:00Z", "2021-01-01T00:28:00Z", "2021-01-01T00:29:00Z"}, new float[]{0.96178716F, 0.24903311F, 0.49205613F, 0.9895601F, 0.91717595F, 0.5754205F, 0.18110333F, 0.8852312F, 0.9543232F, 0.70880127F, 0.78435725F, 0.7664787F, 0.36995524F, 0.5045199F, 0.5848931F, 0.76289135F, 0.8148406F, 0.08540459F, 0.034819767F, 0.21275099F, 0.98361754F, 0.93214417F, 0.038466606F, 0.17231384F, 0.86263835F, 0.3505323F, 0.63114166F, 0.07303526F, 0.08886179F, 0.7488606F}), - new VariableValues("Variable_3", new string[]{"2021-01-01T00:00:00Z", "2021-01-01T00:01:00Z", "2021-01-01T00:02:00Z", "2021-01-01T00:03:00Z", "2021-01-01T00:04:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:06:00Z", "2021-01-01T00:07:00Z", "2021-01-01T00:08:00Z", "2021-01-01T00:09:00Z", "2021-01-01T00:10:00Z", "2021-01-01T00:11:00Z", "2021-01-01T00:12:00Z", "2021-01-01T00:13:00Z", "2021-01-01T00:14:00Z", "2021-01-01T00:15:00Z", "2021-01-01T00:16:00Z", "2021-01-01T00:17:00Z", "2021-01-01T00:18:00Z", "2021-01-01T00:19:00Z", "2021-01-01T00:20:00Z", "2021-01-01T00:21:00Z", "2021-01-01T00:22:00Z", "2021-01-01T00:23:00Z", "2021-01-01T00:24:00Z", "2021-01-01T00:25:00Z", "2021-01-01T00:26:00Z", "2021-01-01T00:27:00Z", "2021-01-01T00:28:00Z", "2021-01-01T00:29:00Z"}, new float[]{0.4030757F, 0.1552689F, 0.36352226F, 0.60512006F, 0.8516795F, 0.26456058F, 0.68108755F, 0.91658944F, 0.70078325F, 0.56241554F, 0.62772894F, 0.15992056F, 0.60209644F, 0.35937968F, 0.8731686F, 0.20301549F, 0.029261872F, 0.62614995F, 0.4585078F, 0.8275007F, 0.03276027F, 0.44852027F, 0.8915691F, 0.89166903F, 0.94699794F, 0.115293086F, 0.088187724F, 0.74262863F, 0.32372248F, 0.93626815F}) -}) -{ - TopContributorCount = 10, -}; -Response response = await client.DetectMultivariateLastAnomalyAsync("45aad126-aafd-11ea-b8fb-d89ef3400c5f", options); -]]> - - - -This sample shows how to call DetectMultivariateLastAnomaly. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -MultivariateLastDetectionOptions options = new MultivariateLastDetectionOptions(new VariableValues[] -{ - new VariableValues("Variable_1", new string[]{"2021-01-01T00:00:00Z", "2021-01-01T00:01:00Z", "2021-01-01T00:02:00Z", "2021-01-01T00:03:00Z", "2021-01-01T00:04:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:06:00Z", "2021-01-01T00:07:00Z", "2021-01-01T00:08:00Z", "2021-01-01T00:09:00Z", "2021-01-01T00:10:00Z", "2021-01-01T00:11:00Z", "2021-01-01T00:12:00Z", "2021-01-01T00:13:00Z", "2021-01-01T00:14:00Z", "2021-01-01T00:15:00Z", "2021-01-01T00:16:00Z", "2021-01-01T00:17:00Z", "2021-01-01T00:18:00Z", "2021-01-01T00:19:00Z", "2021-01-01T00:20:00Z", "2021-01-01T00:21:00Z", "2021-01-01T00:22:00Z", "2021-01-01T00:23:00Z", "2021-01-01T00:24:00Z", "2021-01-01T00:25:00Z", "2021-01-01T00:26:00Z", "2021-01-01T00:27:00Z", "2021-01-01T00:28:00Z", "2021-01-01T00:29:00Z"}, new float[]{0.45513785F, 0.73886037F, 0.20108825F, 0.7462812F, 0.07308129F, 0.33090475F, 0.7544925F, 0.98750633F, 0.6665933F, 0.6308352F, 0.0808331F, 0.8414416F, 0.5145835F, 0.095448986F, 0.7786793F, 0.41646135F, 0.030176187F, 0.3474215F, 0.5085302F, 0.424512F, 0.21159442F, 0.2473352F, 0.87910223F, 0.94796216F, 0.26702702F, 0.69545037F, 0.12357284F, 0.82149154F, 0.11813002F, 0.8579046F}), - new VariableValues("Variable_2", new string[]{"2021-01-01T00:00:00Z", "2021-01-01T00:01:00Z", "2021-01-01T00:02:00Z", "2021-01-01T00:03:00Z", "2021-01-01T00:04:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:06:00Z", "2021-01-01T00:07:00Z", "2021-01-01T00:08:00Z", "2021-01-01T00:09:00Z", "2021-01-01T00:10:00Z", "2021-01-01T00:11:00Z", "2021-01-01T00:12:00Z", "2021-01-01T00:13:00Z", "2021-01-01T00:14:00Z", "2021-01-01T00:15:00Z", "2021-01-01T00:16:00Z", "2021-01-01T00:17:00Z", "2021-01-01T00:18:00Z", "2021-01-01T00:19:00Z", "2021-01-01T00:20:00Z", "2021-01-01T00:21:00Z", "2021-01-01T00:22:00Z", "2021-01-01T00:23:00Z", "2021-01-01T00:24:00Z", "2021-01-01T00:25:00Z", "2021-01-01T00:26:00Z", "2021-01-01T00:27:00Z", "2021-01-01T00:28:00Z", "2021-01-01T00:29:00Z"}, new float[]{0.96178716F, 0.24903311F, 0.49205613F, 0.9895601F, 0.91717595F, 0.5754205F, 0.18110333F, 0.8852312F, 0.9543232F, 0.70880127F, 0.78435725F, 0.7664787F, 0.36995524F, 0.5045199F, 0.5848931F, 0.76289135F, 0.8148406F, 0.08540459F, 0.034819767F, 0.21275099F, 0.98361754F, 0.93214417F, 0.038466606F, 0.17231384F, 0.86263835F, 0.3505323F, 0.63114166F, 0.07303526F, 0.08886179F, 0.7488606F}), - new VariableValues("Variable_3", new string[]{"2021-01-01T00:00:00Z", "2021-01-01T00:01:00Z", "2021-01-01T00:02:00Z", "2021-01-01T00:03:00Z", "2021-01-01T00:04:00Z", "2021-01-01T00:05:00Z", "2021-01-01T00:06:00Z", "2021-01-01T00:07:00Z", "2021-01-01T00:08:00Z", "2021-01-01T00:09:00Z", "2021-01-01T00:10:00Z", "2021-01-01T00:11:00Z", "2021-01-01T00:12:00Z", "2021-01-01T00:13:00Z", "2021-01-01T00:14:00Z", "2021-01-01T00:15:00Z", "2021-01-01T00:16:00Z", "2021-01-01T00:17:00Z", "2021-01-01T00:18:00Z", "2021-01-01T00:19:00Z", "2021-01-01T00:20:00Z", "2021-01-01T00:21:00Z", "2021-01-01T00:22:00Z", "2021-01-01T00:23:00Z", "2021-01-01T00:24:00Z", "2021-01-01T00:25:00Z", "2021-01-01T00:26:00Z", "2021-01-01T00:27:00Z", "2021-01-01T00:28:00Z", "2021-01-01T00:29:00Z"}, new float[]{0.4030757F, 0.1552689F, 0.36352226F, 0.60512006F, 0.8516795F, 0.26456058F, 0.68108755F, 0.91658944F, 0.70078325F, 0.56241554F, 0.62772894F, 0.15992056F, 0.60209644F, 0.35937968F, 0.8731686F, 0.20301549F, 0.029261872F, 0.62614995F, 0.4585078F, 0.8275007F, 0.03276027F, 0.44852027F, 0.8915691F, 0.89166903F, 0.94699794F, 0.115293086F, 0.088187724F, 0.74262863F, 0.32372248F, 0.93626815F}) -}) -{ - TopContributorCount = 10, -}; -Response response = client.DetectMultivariateLastAnomaly("45aad126-aafd-11ea-b8fb-d89ef3400c5f", options); -]]> - - - -This sample shows how to call DetectMultivariateLastAnomalyAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - variables = new object[] - { - new - { - variable = "Variable_1", - timestamps = new object[] - { - "2021-01-01T00:00:00Z", - "2021-01-01T00:01:00Z", - "2021-01-01T00:02:00Z", - "2021-01-01T00:03:00Z", - "2021-01-01T00:04:00Z", - "2021-01-01T00:05:00Z", - "2021-01-01T00:06:00Z", - "2021-01-01T00:07:00Z", - "2021-01-01T00:08:00Z", - "2021-01-01T00:09:00Z", - "2021-01-01T00:10:00Z", - "2021-01-01T00:11:00Z", - "2021-01-01T00:12:00Z", - "2021-01-01T00:13:00Z", - "2021-01-01T00:14:00Z", - "2021-01-01T00:15:00Z", - "2021-01-01T00:16:00Z", - "2021-01-01T00:17:00Z", - "2021-01-01T00:18:00Z", - "2021-01-01T00:19:00Z", - "2021-01-01T00:20:00Z", - "2021-01-01T00:21:00Z", - "2021-01-01T00:22:00Z", - "2021-01-01T00:23:00Z", - "2021-01-01T00:24:00Z", - "2021-01-01T00:25:00Z", - "2021-01-01T00:26:00Z", - "2021-01-01T00:27:00Z", - "2021-01-01T00:28:00Z", - "2021-01-01T00:29:00Z" - }, - values = new object[] - { - 0.45513785F, - 0.73886037F, - 0.20108825F, - 0.7462812F, - 0.07308129F, - 0.33090475F, - 0.7544925F, - 0.98750633F, - 0.6665933F, - 0.6308352F, - 0.0808331F, - 0.8414416F, - 0.5145835F, - 0.095448986F, - 0.7786793F, - 0.41646135F, - 0.030176187F, - 0.3474215F, - 0.5085302F, - 0.424512F, - 0.21159442F, - 0.2473352F, - 0.87910223F, - 0.94796216F, - 0.26702702F, - 0.69545037F, - 0.12357284F, - 0.82149154F, - 0.11813002F, - 0.8579046F - }, - }, - new - { - variable = "Variable_2", - timestamps = new object[] - { - "2021-01-01T00:00:00Z", - "2021-01-01T00:01:00Z", - "2021-01-01T00:02:00Z", - "2021-01-01T00:03:00Z", - "2021-01-01T00:04:00Z", - "2021-01-01T00:05:00Z", - "2021-01-01T00:06:00Z", - "2021-01-01T00:07:00Z", - "2021-01-01T00:08:00Z", - "2021-01-01T00:09:00Z", - "2021-01-01T00:10:00Z", - "2021-01-01T00:11:00Z", - "2021-01-01T00:12:00Z", - "2021-01-01T00:13:00Z", - "2021-01-01T00:14:00Z", - "2021-01-01T00:15:00Z", - "2021-01-01T00:16:00Z", - "2021-01-01T00:17:00Z", - "2021-01-01T00:18:00Z", - "2021-01-01T00:19:00Z", - "2021-01-01T00:20:00Z", - "2021-01-01T00:21:00Z", - "2021-01-01T00:22:00Z", - "2021-01-01T00:23:00Z", - "2021-01-01T00:24:00Z", - "2021-01-01T00:25:00Z", - "2021-01-01T00:26:00Z", - "2021-01-01T00:27:00Z", - "2021-01-01T00:28:00Z", - "2021-01-01T00:29:00Z" - }, - values = new object[] - { - 0.96178716F, - 0.24903311F, - 0.49205613F, - 0.9895601F, - 0.91717595F, - 0.5754205F, - 0.18110333F, - 0.8852312F, - 0.9543232F, - 0.70880127F, - 0.78435725F, - 0.7664787F, - 0.36995524F, - 0.5045199F, - 0.5848931F, - 0.76289135F, - 0.8148406F, - 0.08540459F, - 0.034819767F, - 0.21275099F, - 0.98361754F, - 0.93214417F, - 0.038466606F, - 0.17231384F, - 0.86263835F, - 0.3505323F, - 0.63114166F, - 0.07303526F, - 0.08886179F, - 0.7488606F - }, - }, - new - { - variable = "Variable_3", - timestamps = new object[] - { - "2021-01-01T00:00:00Z", - "2021-01-01T00:01:00Z", - "2021-01-01T00:02:00Z", - "2021-01-01T00:03:00Z", - "2021-01-01T00:04:00Z", - "2021-01-01T00:05:00Z", - "2021-01-01T00:06:00Z", - "2021-01-01T00:07:00Z", - "2021-01-01T00:08:00Z", - "2021-01-01T00:09:00Z", - "2021-01-01T00:10:00Z", - "2021-01-01T00:11:00Z", - "2021-01-01T00:12:00Z", - "2021-01-01T00:13:00Z", - "2021-01-01T00:14:00Z", - "2021-01-01T00:15:00Z", - "2021-01-01T00:16:00Z", - "2021-01-01T00:17:00Z", - "2021-01-01T00:18:00Z", - "2021-01-01T00:19:00Z", - "2021-01-01T00:20:00Z", - "2021-01-01T00:21:00Z", - "2021-01-01T00:22:00Z", - "2021-01-01T00:23:00Z", - "2021-01-01T00:24:00Z", - "2021-01-01T00:25:00Z", - "2021-01-01T00:26:00Z", - "2021-01-01T00:27:00Z", - "2021-01-01T00:28:00Z", - "2021-01-01T00:29:00Z" - }, - values = new object[] - { - 0.4030757F, - 0.1552689F, - 0.36352226F, - 0.60512006F, - 0.8516795F, - 0.26456058F, - 0.68108755F, - 0.91658944F, - 0.70078325F, - 0.56241554F, - 0.62772894F, - 0.15992056F, - 0.60209644F, - 0.35937968F, - 0.8731686F, - 0.20301549F, - 0.029261872F, - 0.62614995F, - 0.4585078F, - 0.8275007F, - 0.03276027F, - 0.44852027F, - 0.8915691F, - 0.89166903F, - 0.94699794F, - 0.115293086F, - 0.088187724F, - 0.74262863F, - 0.32372248F, - 0.93626815F - }, - } - }, - topContributorCount = 10, -}); -Response response = await client.DetectMultivariateLastAnomalyAsync("45aad126-aafd-11ea-b8fb-d89ef3400c5f", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> - - - -This sample shows how to call DetectMultivariateLastAnomaly and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - variables = new object[] - { - new - { - variable = "Variable_1", - timestamps = new object[] - { - "2021-01-01T00:00:00Z", - "2021-01-01T00:01:00Z", - "2021-01-01T00:02:00Z", - "2021-01-01T00:03:00Z", - "2021-01-01T00:04:00Z", - "2021-01-01T00:05:00Z", - "2021-01-01T00:06:00Z", - "2021-01-01T00:07:00Z", - "2021-01-01T00:08:00Z", - "2021-01-01T00:09:00Z", - "2021-01-01T00:10:00Z", - "2021-01-01T00:11:00Z", - "2021-01-01T00:12:00Z", - "2021-01-01T00:13:00Z", - "2021-01-01T00:14:00Z", - "2021-01-01T00:15:00Z", - "2021-01-01T00:16:00Z", - "2021-01-01T00:17:00Z", - "2021-01-01T00:18:00Z", - "2021-01-01T00:19:00Z", - "2021-01-01T00:20:00Z", - "2021-01-01T00:21:00Z", - "2021-01-01T00:22:00Z", - "2021-01-01T00:23:00Z", - "2021-01-01T00:24:00Z", - "2021-01-01T00:25:00Z", - "2021-01-01T00:26:00Z", - "2021-01-01T00:27:00Z", - "2021-01-01T00:28:00Z", - "2021-01-01T00:29:00Z" - }, - values = new object[] - { - 0.45513785F, - 0.73886037F, - 0.20108825F, - 0.7462812F, - 0.07308129F, - 0.33090475F, - 0.7544925F, - 0.98750633F, - 0.6665933F, - 0.6308352F, - 0.0808331F, - 0.8414416F, - 0.5145835F, - 0.095448986F, - 0.7786793F, - 0.41646135F, - 0.030176187F, - 0.3474215F, - 0.5085302F, - 0.424512F, - 0.21159442F, - 0.2473352F, - 0.87910223F, - 0.94796216F, - 0.26702702F, - 0.69545037F, - 0.12357284F, - 0.82149154F, - 0.11813002F, - 0.8579046F - }, - }, - new - { - variable = "Variable_2", - timestamps = new object[] - { - "2021-01-01T00:00:00Z", - "2021-01-01T00:01:00Z", - "2021-01-01T00:02:00Z", - "2021-01-01T00:03:00Z", - "2021-01-01T00:04:00Z", - "2021-01-01T00:05:00Z", - "2021-01-01T00:06:00Z", - "2021-01-01T00:07:00Z", - "2021-01-01T00:08:00Z", - "2021-01-01T00:09:00Z", - "2021-01-01T00:10:00Z", - "2021-01-01T00:11:00Z", - "2021-01-01T00:12:00Z", - "2021-01-01T00:13:00Z", - "2021-01-01T00:14:00Z", - "2021-01-01T00:15:00Z", - "2021-01-01T00:16:00Z", - "2021-01-01T00:17:00Z", - "2021-01-01T00:18:00Z", - "2021-01-01T00:19:00Z", - "2021-01-01T00:20:00Z", - "2021-01-01T00:21:00Z", - "2021-01-01T00:22:00Z", - "2021-01-01T00:23:00Z", - "2021-01-01T00:24:00Z", - "2021-01-01T00:25:00Z", - "2021-01-01T00:26:00Z", - "2021-01-01T00:27:00Z", - "2021-01-01T00:28:00Z", - "2021-01-01T00:29:00Z" - }, - values = new object[] - { - 0.96178716F, - 0.24903311F, - 0.49205613F, - 0.9895601F, - 0.91717595F, - 0.5754205F, - 0.18110333F, - 0.8852312F, - 0.9543232F, - 0.70880127F, - 0.78435725F, - 0.7664787F, - 0.36995524F, - 0.5045199F, - 0.5848931F, - 0.76289135F, - 0.8148406F, - 0.08540459F, - 0.034819767F, - 0.21275099F, - 0.98361754F, - 0.93214417F, - 0.038466606F, - 0.17231384F, - 0.86263835F, - 0.3505323F, - 0.63114166F, - 0.07303526F, - 0.08886179F, - 0.7488606F - }, - }, - new - { - variable = "Variable_3", - timestamps = new object[] - { - "2021-01-01T00:00:00Z", - "2021-01-01T00:01:00Z", - "2021-01-01T00:02:00Z", - "2021-01-01T00:03:00Z", - "2021-01-01T00:04:00Z", - "2021-01-01T00:05:00Z", - "2021-01-01T00:06:00Z", - "2021-01-01T00:07:00Z", - "2021-01-01T00:08:00Z", - "2021-01-01T00:09:00Z", - "2021-01-01T00:10:00Z", - "2021-01-01T00:11:00Z", - "2021-01-01T00:12:00Z", - "2021-01-01T00:13:00Z", - "2021-01-01T00:14:00Z", - "2021-01-01T00:15:00Z", - "2021-01-01T00:16:00Z", - "2021-01-01T00:17:00Z", - "2021-01-01T00:18:00Z", - "2021-01-01T00:19:00Z", - "2021-01-01T00:20:00Z", - "2021-01-01T00:21:00Z", - "2021-01-01T00:22:00Z", - "2021-01-01T00:23:00Z", - "2021-01-01T00:24:00Z", - "2021-01-01T00:25:00Z", - "2021-01-01T00:26:00Z", - "2021-01-01T00:27:00Z", - "2021-01-01T00:28:00Z", - "2021-01-01T00:29:00Z" - }, - values = new object[] - { - 0.4030757F, - 0.1552689F, - 0.36352226F, - 0.60512006F, - 0.8516795F, - 0.26456058F, - 0.68108755F, - 0.91658944F, - 0.70078325F, - 0.56241554F, - 0.62772894F, - 0.15992056F, - 0.60209644F, - 0.35937968F, - 0.8731686F, - 0.20301549F, - 0.029261872F, - 0.62614995F, - 0.4585078F, - 0.8275007F, - 0.03276027F, - 0.44852027F, - 0.8915691F, - 0.89166903F, - 0.94699794F, - 0.115293086F, - 0.088187724F, - 0.74262863F, - 0.32372248F, - 0.93626815F - }, - } - }, - topContributorCount = 10, -}); -Response response = client.DetectMultivariateLastAnomaly("45aad126-aafd-11ea-b8fb-d89ef3400c5f", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> - - - -This sample shows how to call GetMultivariateModelsAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -await foreach (AnomalyDetectionModel item in client.GetMultivariateModelsAsync()) -{ -} -]]> - - - -This sample shows how to call GetMultivariateModels. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -foreach (AnomalyDetectionModel item in client.GetMultivariateModels()) -{ -} -]]> - - - -This sample shows how to call GetMultivariateModelsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -await foreach (BinaryData item in client.GetMultivariateModelsAsync(0, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); -} -]]> - - - -This sample shows how to call GetMultivariateModels and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Multivariate client = new AnomalyDetectorClient(endpoint, credential).GetMultivariateClient(); - -foreach (BinaryData item in client.GetMultivariateModels(0, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedTime").ToString()); -} -]]> - - - \ No newline at end of file diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Docs/Univariate.xml b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Docs/Univariate.xml deleted file mode 100644 index 0dcbb1d28219..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Docs/Univariate.xml +++ /dev/null @@ -1,6231 +0,0 @@ - - - - - -This sample shows how to call DetectUnivariateEntireSeriesAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - series = new object[] - { - new - { - timestamp = "1972-01-01T00:00:00Z", - value = 826F, - }, - new - { - timestamp = "1972-02-01T00:00:00Z", - value = 799F, - }, - new - { - timestamp = "1972-03-01T00:00:00Z", - value = 890F, - }, - new - { - timestamp = "1972-04-01T00:00:00Z", - value = 900F, - }, - new - { - timestamp = "1972-05-01T00:00:00Z", - value = 961F, - }, - new - { - timestamp = "1972-06-01T00:00:00Z", - value = 935F, - }, - new - { - timestamp = "1972-07-01T00:00:00Z", - value = 894F, - }, - new - { - timestamp = "1972-08-01T00:00:00Z", - value = 855F, - }, - new - { - timestamp = "1972-09-01T00:00:00Z", - value = 809F, - }, - new - { - timestamp = "1972-10-01T00:00:00Z", - value = 810F, - }, - new - { - timestamp = "1972-11-01T00:00:00Z", - value = 766F, - }, - new - { - timestamp = "1972-12-01T00:00:00Z", - value = 805F, - }, - new - { - timestamp = "1973-01-01T00:00:00Z", - value = 821F, - }, - new - { - timestamp = "1973-02-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1973-03-01T00:00:00Z", - value = 883F, - }, - new - { - timestamp = "1973-04-01T00:00:00Z", - value = 898F, - }, - new - { - timestamp = "1973-05-01T00:00:00Z", - value = 957F, - }, - new - { - timestamp = "1973-06-01T00:00:00Z", - value = 924F, - }, - new - { - timestamp = "1973-07-01T00:00:00Z", - value = 881F, - }, - new - { - timestamp = "1973-08-01T00:00:00Z", - value = 837F, - }, - new - { - timestamp = "1973-09-01T00:00:00Z", - value = 784F, - }, - new - { - timestamp = "1973-10-01T00:00:00Z", - value = 791F, - }, - new - { - timestamp = "1973-11-01T00:00:00Z", - value = 760F, - }, - new - { - timestamp = "1973-12-01T00:00:00Z", - value = 802F, - }, - new - { - timestamp = "1974-01-01T00:00:00Z", - value = 828F, - }, - new - { - timestamp = "1974-02-01T00:00:00Z", - value = 1030F, - }, - new - { - timestamp = "1974-03-01T00:00:00Z", - value = 889F, - }, - new - { - timestamp = "1974-04-01T00:00:00Z", - value = 902F, - }, - new - { - timestamp = "1974-05-01T00:00:00Z", - value = 969F, - }, - new - { - timestamp = "1974-06-01T00:00:00Z", - value = 947F, - }, - new - { - timestamp = "1974-07-01T00:00:00Z", - value = 908F, - }, - new - { - timestamp = "1974-08-01T00:00:00Z", - value = 867F, - }, - new - { - timestamp = "1974-09-01T00:00:00Z", - value = 815F, - }, - new - { - timestamp = "1974-10-01T00:00:00Z", - value = 812F, - }, - new - { - timestamp = "1974-11-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1974-12-01T00:00:00Z", - value = 813F, - }, - new - { - timestamp = "1975-01-01T00:00:00Z", - value = 834F, - }, - new - { - timestamp = "1975-02-01T00:00:00Z", - value = 782F, - }, - new - { - timestamp = "1975-03-01T00:00:00Z", - value = 892F, - }, - new - { - timestamp = "1975-04-01T00:00:00Z", - value = 903F, - }, - new - { - timestamp = "1975-05-01T00:00:00Z", - value = 966F, - }, - new - { - timestamp = "1975-06-01T00:00:00Z", - value = 937F, - }, - new - { - timestamp = "1975-07-01T00:00:00Z", - value = 896F, - }, - new - { - timestamp = "1975-08-01T00:00:00Z", - value = 858F, - }, - new - { - timestamp = "1975-09-01T00:00:00Z", - value = 817F, - }, - new - { - timestamp = "1975-10-01T00:00:00Z", - value = 827F, - }, - new - { - timestamp = "1975-11-01T00:00:00Z", - value = 797F, - }, - new - { - timestamp = "1975-12-01T00:00:00Z", - value = 843F, - } - }, - maxAnomalyRatio = 0.25F, - sensitivity = 95, - granularity = "monthly", - imputeMode = "auto", -}); -Response response = await client.DetectUnivariateEntireSeriesAsync(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("period").ToString()); -Console.WriteLine(result.GetProperty("expectedValues")[0].ToString()); -Console.WriteLine(result.GetProperty("upperMargins")[0].ToString()); -Console.WriteLine(result.GetProperty("lowerMargins")[0].ToString()); -Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString()); -Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString()); -Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString()); -]]> - - - -This sample shows how to call DetectUnivariateEntireSeries and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - series = new object[] - { - new - { - timestamp = "1972-01-01T00:00:00Z", - value = 826F, - }, - new - { - timestamp = "1972-02-01T00:00:00Z", - value = 799F, - }, - new - { - timestamp = "1972-03-01T00:00:00Z", - value = 890F, - }, - new - { - timestamp = "1972-04-01T00:00:00Z", - value = 900F, - }, - new - { - timestamp = "1972-05-01T00:00:00Z", - value = 961F, - }, - new - { - timestamp = "1972-06-01T00:00:00Z", - value = 935F, - }, - new - { - timestamp = "1972-07-01T00:00:00Z", - value = 894F, - }, - new - { - timestamp = "1972-08-01T00:00:00Z", - value = 855F, - }, - new - { - timestamp = "1972-09-01T00:00:00Z", - value = 809F, - }, - new - { - timestamp = "1972-10-01T00:00:00Z", - value = 810F, - }, - new - { - timestamp = "1972-11-01T00:00:00Z", - value = 766F, - }, - new - { - timestamp = "1972-12-01T00:00:00Z", - value = 805F, - }, - new - { - timestamp = "1973-01-01T00:00:00Z", - value = 821F, - }, - new - { - timestamp = "1973-02-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1973-03-01T00:00:00Z", - value = 883F, - }, - new - { - timestamp = "1973-04-01T00:00:00Z", - value = 898F, - }, - new - { - timestamp = "1973-05-01T00:00:00Z", - value = 957F, - }, - new - { - timestamp = "1973-06-01T00:00:00Z", - value = 924F, - }, - new - { - timestamp = "1973-07-01T00:00:00Z", - value = 881F, - }, - new - { - timestamp = "1973-08-01T00:00:00Z", - value = 837F, - }, - new - { - timestamp = "1973-09-01T00:00:00Z", - value = 784F, - }, - new - { - timestamp = "1973-10-01T00:00:00Z", - value = 791F, - }, - new - { - timestamp = "1973-11-01T00:00:00Z", - value = 760F, - }, - new - { - timestamp = "1973-12-01T00:00:00Z", - value = 802F, - }, - new - { - timestamp = "1974-01-01T00:00:00Z", - value = 828F, - }, - new - { - timestamp = "1974-02-01T00:00:00Z", - value = 1030F, - }, - new - { - timestamp = "1974-03-01T00:00:00Z", - value = 889F, - }, - new - { - timestamp = "1974-04-01T00:00:00Z", - value = 902F, - }, - new - { - timestamp = "1974-05-01T00:00:00Z", - value = 969F, - }, - new - { - timestamp = "1974-06-01T00:00:00Z", - value = 947F, - }, - new - { - timestamp = "1974-07-01T00:00:00Z", - value = 908F, - }, - new - { - timestamp = "1974-08-01T00:00:00Z", - value = 867F, - }, - new - { - timestamp = "1974-09-01T00:00:00Z", - value = 815F, - }, - new - { - timestamp = "1974-10-01T00:00:00Z", - value = 812F, - }, - new - { - timestamp = "1974-11-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1974-12-01T00:00:00Z", - value = 813F, - }, - new - { - timestamp = "1975-01-01T00:00:00Z", - value = 834F, - }, - new - { - timestamp = "1975-02-01T00:00:00Z", - value = 782F, - }, - new - { - timestamp = "1975-03-01T00:00:00Z", - value = 892F, - }, - new - { - timestamp = "1975-04-01T00:00:00Z", - value = 903F, - }, - new - { - timestamp = "1975-05-01T00:00:00Z", - value = 966F, - }, - new - { - timestamp = "1975-06-01T00:00:00Z", - value = 937F, - }, - new - { - timestamp = "1975-07-01T00:00:00Z", - value = 896F, - }, - new - { - timestamp = "1975-08-01T00:00:00Z", - value = 858F, - }, - new - { - timestamp = "1975-09-01T00:00:00Z", - value = 817F, - }, - new - { - timestamp = "1975-10-01T00:00:00Z", - value = 827F, - }, - new - { - timestamp = "1975-11-01T00:00:00Z", - value = 797F, - }, - new - { - timestamp = "1975-12-01T00:00:00Z", - value = 843F, - } - }, - maxAnomalyRatio = 0.25F, - sensitivity = 95, - granularity = "monthly", - imputeMode = "auto", -}); -Response response = client.DetectUnivariateEntireSeries(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("period").ToString()); -Console.WriteLine(result.GetProperty("expectedValues")[0].ToString()); -Console.WriteLine(result.GetProperty("upperMargins")[0].ToString()); -Console.WriteLine(result.GetProperty("lowerMargins")[0].ToString()); -Console.WriteLine(result.GetProperty("isAnomaly")[0].ToString()); -Console.WriteLine(result.GetProperty("isNegativeAnomaly")[0].ToString()); -Console.WriteLine(result.GetProperty("isPositiveAnomaly")[0].ToString()); -]]> - - - -This sample shows how to call DetectUnivariateLastPointAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -UnivariateDetectionOptions options = new UnivariateDetectionOptions(new TimeSeriesPoint[] -{ - new TimeSeriesPoint(826F) - { - Timestamp = DateTimeOffset.Parse("1972-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(799F) - { - Timestamp = DateTimeOffset.Parse("1972-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(890F) - { - Timestamp = DateTimeOffset.Parse("1972-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(900F) - { - Timestamp = DateTimeOffset.Parse("1972-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(961F) - { - Timestamp = DateTimeOffset.Parse("1972-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(935F) - { - Timestamp = DateTimeOffset.Parse("1972-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(894F) - { - Timestamp = DateTimeOffset.Parse("1972-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(855F) - { - Timestamp = DateTimeOffset.Parse("1972-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(809F) - { - Timestamp = DateTimeOffset.Parse("1972-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(810F) - { - Timestamp = DateTimeOffset.Parse("1972-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(766F) - { - Timestamp = DateTimeOffset.Parse("1972-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(805F) - { - Timestamp = DateTimeOffset.Parse("1972-12-01T00:00:00Z"), - }, - new TimeSeriesPoint(821F) - { - Timestamp = DateTimeOffset.Parse("1973-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(773F) - { - Timestamp = DateTimeOffset.Parse("1973-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(883F) - { - Timestamp = DateTimeOffset.Parse("1973-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(898F) - { - Timestamp = DateTimeOffset.Parse("1973-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(957F) - { - Timestamp = DateTimeOffset.Parse("1973-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(924F) - { - Timestamp = DateTimeOffset.Parse("1973-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(881F) - { - Timestamp = DateTimeOffset.Parse("1973-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(837F) - { - Timestamp = DateTimeOffset.Parse("1973-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(784F) - { - Timestamp = DateTimeOffset.Parse("1973-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(791F) - { - Timestamp = DateTimeOffset.Parse("1973-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(760F) - { - Timestamp = DateTimeOffset.Parse("1973-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(802F) - { - Timestamp = DateTimeOffset.Parse("1973-12-01T00:00:00Z"), - }, - new TimeSeriesPoint(828F) - { - Timestamp = DateTimeOffset.Parse("1974-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(1030F) - { - Timestamp = DateTimeOffset.Parse("1974-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(889F) - { - Timestamp = DateTimeOffset.Parse("1974-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(902F) - { - Timestamp = DateTimeOffset.Parse("1974-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(969F) - { - Timestamp = DateTimeOffset.Parse("1974-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(947F) - { - Timestamp = DateTimeOffset.Parse("1974-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(908F) - { - Timestamp = DateTimeOffset.Parse("1974-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(867F) - { - Timestamp = DateTimeOffset.Parse("1974-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(815F) - { - Timestamp = DateTimeOffset.Parse("1974-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(812F) - { - Timestamp = DateTimeOffset.Parse("1974-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(773F) - { - Timestamp = DateTimeOffset.Parse("1974-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(813F) - { - Timestamp = DateTimeOffset.Parse("1974-12-01T00:00:00Z"), - }, - new TimeSeriesPoint(834F) - { - Timestamp = DateTimeOffset.Parse("1975-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(782F) - { - Timestamp = DateTimeOffset.Parse("1975-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(892F) - { - Timestamp = DateTimeOffset.Parse("1975-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(903F) - { - Timestamp = DateTimeOffset.Parse("1975-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(966F) - { - Timestamp = DateTimeOffset.Parse("1975-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(937F) - { - Timestamp = DateTimeOffset.Parse("1975-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(896F) - { - Timestamp = DateTimeOffset.Parse("1975-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(858F) - { - Timestamp = DateTimeOffset.Parse("1975-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(817F) - { - Timestamp = DateTimeOffset.Parse("1975-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(827F) - { - Timestamp = DateTimeOffset.Parse("1975-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(797F) - { - Timestamp = DateTimeOffset.Parse("1975-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(843F) - { - Timestamp = DateTimeOffset.Parse("1975-12-01T00:00:00Z"), - } -}) -{ - Granularity = TimeGranularity.Monthly, - MaxAnomalyRatio = 0.25F, - Sensitivity = 95, - ImputeMode = ImputeMode.Fixed, - ImputeFixedValue = 800F, -}; -Response response = await client.DetectUnivariateLastPointAsync(options); -]]> - - - -This sample shows how to call DetectUnivariateLastPoint. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -UnivariateDetectionOptions options = new UnivariateDetectionOptions(new TimeSeriesPoint[] -{ - new TimeSeriesPoint(826F) - { - Timestamp = DateTimeOffset.Parse("1972-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(799F) - { - Timestamp = DateTimeOffset.Parse("1972-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(890F) - { - Timestamp = DateTimeOffset.Parse("1972-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(900F) - { - Timestamp = DateTimeOffset.Parse("1972-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(961F) - { - Timestamp = DateTimeOffset.Parse("1972-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(935F) - { - Timestamp = DateTimeOffset.Parse("1972-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(894F) - { - Timestamp = DateTimeOffset.Parse("1972-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(855F) - { - Timestamp = DateTimeOffset.Parse("1972-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(809F) - { - Timestamp = DateTimeOffset.Parse("1972-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(810F) - { - Timestamp = DateTimeOffset.Parse("1972-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(766F) - { - Timestamp = DateTimeOffset.Parse("1972-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(805F) - { - Timestamp = DateTimeOffset.Parse("1972-12-01T00:00:00Z"), - }, - new TimeSeriesPoint(821F) - { - Timestamp = DateTimeOffset.Parse("1973-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(773F) - { - Timestamp = DateTimeOffset.Parse("1973-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(883F) - { - Timestamp = DateTimeOffset.Parse("1973-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(898F) - { - Timestamp = DateTimeOffset.Parse("1973-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(957F) - { - Timestamp = DateTimeOffset.Parse("1973-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(924F) - { - Timestamp = DateTimeOffset.Parse("1973-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(881F) - { - Timestamp = DateTimeOffset.Parse("1973-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(837F) - { - Timestamp = DateTimeOffset.Parse("1973-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(784F) - { - Timestamp = DateTimeOffset.Parse("1973-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(791F) - { - Timestamp = DateTimeOffset.Parse("1973-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(760F) - { - Timestamp = DateTimeOffset.Parse("1973-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(802F) - { - Timestamp = DateTimeOffset.Parse("1973-12-01T00:00:00Z"), - }, - new TimeSeriesPoint(828F) - { - Timestamp = DateTimeOffset.Parse("1974-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(1030F) - { - Timestamp = DateTimeOffset.Parse("1974-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(889F) - { - Timestamp = DateTimeOffset.Parse("1974-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(902F) - { - Timestamp = DateTimeOffset.Parse("1974-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(969F) - { - Timestamp = DateTimeOffset.Parse("1974-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(947F) - { - Timestamp = DateTimeOffset.Parse("1974-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(908F) - { - Timestamp = DateTimeOffset.Parse("1974-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(867F) - { - Timestamp = DateTimeOffset.Parse("1974-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(815F) - { - Timestamp = DateTimeOffset.Parse("1974-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(812F) - { - Timestamp = DateTimeOffset.Parse("1974-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(773F) - { - Timestamp = DateTimeOffset.Parse("1974-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(813F) - { - Timestamp = DateTimeOffset.Parse("1974-12-01T00:00:00Z"), - }, - new TimeSeriesPoint(834F) - { - Timestamp = DateTimeOffset.Parse("1975-01-01T00:00:00Z"), - }, - new TimeSeriesPoint(782F) - { - Timestamp = DateTimeOffset.Parse("1975-02-01T00:00:00Z"), - }, - new TimeSeriesPoint(892F) - { - Timestamp = DateTimeOffset.Parse("1975-03-01T00:00:00Z"), - }, - new TimeSeriesPoint(903F) - { - Timestamp = DateTimeOffset.Parse("1975-04-01T00:00:00Z"), - }, - new TimeSeriesPoint(966F) - { - Timestamp = DateTimeOffset.Parse("1975-05-01T00:00:00Z"), - }, - new TimeSeriesPoint(937F) - { - Timestamp = DateTimeOffset.Parse("1975-06-01T00:00:00Z"), - }, - new TimeSeriesPoint(896F) - { - Timestamp = DateTimeOffset.Parse("1975-07-01T00:00:00Z"), - }, - new TimeSeriesPoint(858F) - { - Timestamp = DateTimeOffset.Parse("1975-08-01T00:00:00Z"), - }, - new TimeSeriesPoint(817F) - { - Timestamp = DateTimeOffset.Parse("1975-09-01T00:00:00Z"), - }, - new TimeSeriesPoint(827F) - { - Timestamp = DateTimeOffset.Parse("1975-10-01T00:00:00Z"), - }, - new TimeSeriesPoint(797F) - { - Timestamp = DateTimeOffset.Parse("1975-11-01T00:00:00Z"), - }, - new TimeSeriesPoint(843F) - { - Timestamp = DateTimeOffset.Parse("1975-12-01T00:00:00Z"), - } -}) -{ - Granularity = TimeGranularity.Monthly, - MaxAnomalyRatio = 0.25F, - Sensitivity = 95, - ImputeMode = ImputeMode.Fixed, - ImputeFixedValue = 800F, -}; -Response response = client.DetectUnivariateLastPoint(options); -]]> - - - -This sample shows how to call DetectUnivariateLastPointAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - series = new object[] - { - new - { - timestamp = "1972-01-01T00:00:00Z", - value = 826F, - }, - new - { - timestamp = "1972-02-01T00:00:00Z", - value = 799F, - }, - new - { - timestamp = "1972-03-01T00:00:00Z", - value = 890F, - }, - new - { - timestamp = "1972-04-01T00:00:00Z", - value = 900F, - }, - new - { - timestamp = "1972-05-01T00:00:00Z", - value = 961F, - }, - new - { - timestamp = "1972-06-01T00:00:00Z", - value = 935F, - }, - new - { - timestamp = "1972-07-01T00:00:00Z", - value = 894F, - }, - new - { - timestamp = "1972-08-01T00:00:00Z", - value = 855F, - }, - new - { - timestamp = "1972-09-01T00:00:00Z", - value = 809F, - }, - new - { - timestamp = "1972-10-01T00:00:00Z", - value = 810F, - }, - new - { - timestamp = "1972-11-01T00:00:00Z", - value = 766F, - }, - new - { - timestamp = "1972-12-01T00:00:00Z", - value = 805F, - }, - new - { - timestamp = "1973-01-01T00:00:00Z", - value = 821F, - }, - new - { - timestamp = "1973-02-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1973-03-01T00:00:00Z", - value = 883F, - }, - new - { - timestamp = "1973-04-01T00:00:00Z", - value = 898F, - }, - new - { - timestamp = "1973-05-01T00:00:00Z", - value = 957F, - }, - new - { - timestamp = "1973-06-01T00:00:00Z", - value = 924F, - }, - new - { - timestamp = "1973-07-01T00:00:00Z", - value = 881F, - }, - new - { - timestamp = "1973-08-01T00:00:00Z", - value = 837F, - }, - new - { - timestamp = "1973-09-01T00:00:00Z", - value = 784F, - }, - new - { - timestamp = "1973-10-01T00:00:00Z", - value = 791F, - }, - new - { - timestamp = "1973-11-01T00:00:00Z", - value = 760F, - }, - new - { - timestamp = "1973-12-01T00:00:00Z", - value = 802F, - }, - new - { - timestamp = "1974-01-01T00:00:00Z", - value = 828F, - }, - new - { - timestamp = "1974-02-01T00:00:00Z", - value = 1030F, - }, - new - { - timestamp = "1974-03-01T00:00:00Z", - value = 889F, - }, - new - { - timestamp = "1974-04-01T00:00:00Z", - value = 902F, - }, - new - { - timestamp = "1974-05-01T00:00:00Z", - value = 969F, - }, - new - { - timestamp = "1974-06-01T00:00:00Z", - value = 947F, - }, - new - { - timestamp = "1974-07-01T00:00:00Z", - value = 908F, - }, - new - { - timestamp = "1974-08-01T00:00:00Z", - value = 867F, - }, - new - { - timestamp = "1974-09-01T00:00:00Z", - value = 815F, - }, - new - { - timestamp = "1974-10-01T00:00:00Z", - value = 812F, - }, - new - { - timestamp = "1974-11-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1974-12-01T00:00:00Z", - value = 813F, - }, - new - { - timestamp = "1975-01-01T00:00:00Z", - value = 834F, - }, - new - { - timestamp = "1975-02-01T00:00:00Z", - value = 782F, - }, - new - { - timestamp = "1975-03-01T00:00:00Z", - value = 892F, - }, - new - { - timestamp = "1975-04-01T00:00:00Z", - value = 903F, - }, - new - { - timestamp = "1975-05-01T00:00:00Z", - value = 966F, - }, - new - { - timestamp = "1975-06-01T00:00:00Z", - value = 937F, - }, - new - { - timestamp = "1975-07-01T00:00:00Z", - value = 896F, - }, - new - { - timestamp = "1975-08-01T00:00:00Z", - value = 858F, - }, - new - { - timestamp = "1975-09-01T00:00:00Z", - value = 817F, - }, - new - { - timestamp = "1975-10-01T00:00:00Z", - value = 827F, - }, - new - { - timestamp = "1975-11-01T00:00:00Z", - value = 797F, - }, - new - { - timestamp = "1975-12-01T00:00:00Z", - value = 843F, - } - }, - maxAnomalyRatio = 0.25F, - sensitivity = 95, - granularity = "monthly", - imputeMode = "fixed", - imputeFixedValue = 800F, -}); -Response response = await client.DetectUnivariateLastPointAsync(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("period").ToString()); -Console.WriteLine(result.GetProperty("suggestedWindow").ToString()); -Console.WriteLine(result.GetProperty("expectedValue").ToString()); -Console.WriteLine(result.GetProperty("upperMargin").ToString()); -Console.WriteLine(result.GetProperty("lowerMargin").ToString()); -Console.WriteLine(result.GetProperty("isAnomaly").ToString()); -Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString()); -Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString()); -]]> - - - -This sample shows how to call DetectUnivariateLastPoint and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - series = new object[] - { - new - { - timestamp = "1972-01-01T00:00:00Z", - value = 826F, - }, - new - { - timestamp = "1972-02-01T00:00:00Z", - value = 799F, - }, - new - { - timestamp = "1972-03-01T00:00:00Z", - value = 890F, - }, - new - { - timestamp = "1972-04-01T00:00:00Z", - value = 900F, - }, - new - { - timestamp = "1972-05-01T00:00:00Z", - value = 961F, - }, - new - { - timestamp = "1972-06-01T00:00:00Z", - value = 935F, - }, - new - { - timestamp = "1972-07-01T00:00:00Z", - value = 894F, - }, - new - { - timestamp = "1972-08-01T00:00:00Z", - value = 855F, - }, - new - { - timestamp = "1972-09-01T00:00:00Z", - value = 809F, - }, - new - { - timestamp = "1972-10-01T00:00:00Z", - value = 810F, - }, - new - { - timestamp = "1972-11-01T00:00:00Z", - value = 766F, - }, - new - { - timestamp = "1972-12-01T00:00:00Z", - value = 805F, - }, - new - { - timestamp = "1973-01-01T00:00:00Z", - value = 821F, - }, - new - { - timestamp = "1973-02-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1973-03-01T00:00:00Z", - value = 883F, - }, - new - { - timestamp = "1973-04-01T00:00:00Z", - value = 898F, - }, - new - { - timestamp = "1973-05-01T00:00:00Z", - value = 957F, - }, - new - { - timestamp = "1973-06-01T00:00:00Z", - value = 924F, - }, - new - { - timestamp = "1973-07-01T00:00:00Z", - value = 881F, - }, - new - { - timestamp = "1973-08-01T00:00:00Z", - value = 837F, - }, - new - { - timestamp = "1973-09-01T00:00:00Z", - value = 784F, - }, - new - { - timestamp = "1973-10-01T00:00:00Z", - value = 791F, - }, - new - { - timestamp = "1973-11-01T00:00:00Z", - value = 760F, - }, - new - { - timestamp = "1973-12-01T00:00:00Z", - value = 802F, - }, - new - { - timestamp = "1974-01-01T00:00:00Z", - value = 828F, - }, - new - { - timestamp = "1974-02-01T00:00:00Z", - value = 1030F, - }, - new - { - timestamp = "1974-03-01T00:00:00Z", - value = 889F, - }, - new - { - timestamp = "1974-04-01T00:00:00Z", - value = 902F, - }, - new - { - timestamp = "1974-05-01T00:00:00Z", - value = 969F, - }, - new - { - timestamp = "1974-06-01T00:00:00Z", - value = 947F, - }, - new - { - timestamp = "1974-07-01T00:00:00Z", - value = 908F, - }, - new - { - timestamp = "1974-08-01T00:00:00Z", - value = 867F, - }, - new - { - timestamp = "1974-09-01T00:00:00Z", - value = 815F, - }, - new - { - timestamp = "1974-10-01T00:00:00Z", - value = 812F, - }, - new - { - timestamp = "1974-11-01T00:00:00Z", - value = 773F, - }, - new - { - timestamp = "1974-12-01T00:00:00Z", - value = 813F, - }, - new - { - timestamp = "1975-01-01T00:00:00Z", - value = 834F, - }, - new - { - timestamp = "1975-02-01T00:00:00Z", - value = 782F, - }, - new - { - timestamp = "1975-03-01T00:00:00Z", - value = 892F, - }, - new - { - timestamp = "1975-04-01T00:00:00Z", - value = 903F, - }, - new - { - timestamp = "1975-05-01T00:00:00Z", - value = 966F, - }, - new - { - timestamp = "1975-06-01T00:00:00Z", - value = 937F, - }, - new - { - timestamp = "1975-07-01T00:00:00Z", - value = 896F, - }, - new - { - timestamp = "1975-08-01T00:00:00Z", - value = 858F, - }, - new - { - timestamp = "1975-09-01T00:00:00Z", - value = 817F, - }, - new - { - timestamp = "1975-10-01T00:00:00Z", - value = 827F, - }, - new - { - timestamp = "1975-11-01T00:00:00Z", - value = 797F, - }, - new - { - timestamp = "1975-12-01T00:00:00Z", - value = 843F, - } - }, - maxAnomalyRatio = 0.25F, - sensitivity = 95, - granularity = "monthly", - imputeMode = "fixed", - imputeFixedValue = 800F, -}); -Response response = client.DetectUnivariateLastPoint(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("period").ToString()); -Console.WriteLine(result.GetProperty("suggestedWindow").ToString()); -Console.WriteLine(result.GetProperty("expectedValue").ToString()); -Console.WriteLine(result.GetProperty("upperMargin").ToString()); -Console.WriteLine(result.GetProperty("lowerMargin").ToString()); -Console.WriteLine(result.GetProperty("isAnomaly").ToString()); -Console.WriteLine(result.GetProperty("isNegativeAnomaly").ToString()); -Console.WriteLine(result.GetProperty("isPositiveAnomaly").ToString()); -]]> - - - -This sample shows how to call DetectUnivariateChangePointAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new TimeSeriesPoint[] -{ - new TimeSeriesPoint(1639196F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T06:45:00Z"), - }, - new TimeSeriesPoint(1639290F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T06:50:00Z"), - }, - new TimeSeriesPoint(1667293F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T06:55:00Z"), - }, - new TimeSeriesPoint(1703130F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:00:00Z"), - }, - new TimeSeriesPoint(1650912F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:05:00Z"), - }, - new TimeSeriesPoint(1653596F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:10:00Z"), - }, - new TimeSeriesPoint(1653793F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:15:00Z"), - }, - new TimeSeriesPoint(1653795F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:20:00Z"), - }, - new TimeSeriesPoint(1663471F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:25:00Z"), - }, - new TimeSeriesPoint(1662358F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:30:00Z"), - }, - new TimeSeriesPoint(1664320F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:35:00Z"), - }, - new TimeSeriesPoint(1664942F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:40:00Z"), - }, - new TimeSeriesPoint(1664966F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:45:00Z"), - }, - new TimeSeriesPoint(1724271F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:50:00Z"), - }, - new TimeSeriesPoint(1678720F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:55:00Z"), - }, - new TimeSeriesPoint(1672536F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:00:00Z"), - }, - new TimeSeriesPoint(1672544F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:05:00Z"), - }, - new TimeSeriesPoint(1672364F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:10:00Z"), - }, - new TimeSeriesPoint(1672912F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:15:00Z"), - }, - new TimeSeriesPoint(1672736F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:20:00Z"), - }, - new TimeSeriesPoint(1672725F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:25:00Z"), - }, - new TimeSeriesPoint(1673247F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:30:00Z"), - }, - new TimeSeriesPoint(1673109F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:35:00Z"), - }, - new TimeSeriesPoint(1690088F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:40:00Z"), - }, - new TimeSeriesPoint(1703865F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:45:00Z"), - }, - new TimeSeriesPoint(1703865F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:50:00Z"), - }, - new TimeSeriesPoint(1786581F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:55:00Z"), - }, - new TimeSeriesPoint(1800945F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:00:00Z"), - }, - new TimeSeriesPoint(1800957F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:05:00Z"), - }, - new TimeSeriesPoint(1801191F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:10:00Z"), - }, - new TimeSeriesPoint(1801412F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:15:00Z"), - }, - new TimeSeriesPoint(1801621F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:20:00Z"), - }, - new TimeSeriesPoint(1801621F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:25:00Z"), - }, - new TimeSeriesPoint(1801654F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:30:00Z"), - }, - new TimeSeriesPoint(1802105F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:35:00Z"), - }, - new TimeSeriesPoint(1801800F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:40:00Z"), - }, - new TimeSeriesPoint(1803040F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:45:00Z"), - }, - new TimeSeriesPoint(1803672F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:50:00Z"), - }, - new TimeSeriesPoint(1803535F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:55:00Z"), - }, - new TimeSeriesPoint(1803541F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:00:00Z"), - }, - new TimeSeriesPoint(1803545F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:05:00Z"), - }, - new TimeSeriesPoint(1803599F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:10:00Z"), - }, - new TimeSeriesPoint(1803616F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:15:00Z"), - }, - new TimeSeriesPoint(1803619F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:20:00Z"), - }, - new TimeSeriesPoint(1809942F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:25:00Z"), - }, - new TimeSeriesPoint(1802720F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:30:00Z"), - }, - new TimeSeriesPoint(1802720F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:35:00Z"), - }, - new TimeSeriesPoint(1802888F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:40:00Z"), - }, - new TimeSeriesPoint(1809574F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:45:00Z"), - }, - new TimeSeriesPoint(1803896F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:50:00Z"), - }, - new TimeSeriesPoint(1803850F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:55:00Z"), - }, - new TimeSeriesPoint(1803854F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:00:00Z"), - }, - new TimeSeriesPoint(1803854F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:05:00Z"), - }, - new TimeSeriesPoint(1803797F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:10:00Z"), - }, - new TimeSeriesPoint(1803921F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:15:00Z"), - }, - new TimeSeriesPoint(1803933F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:20:00Z"), - }, - new TimeSeriesPoint(1804040F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:25:00Z"), - }, - new TimeSeriesPoint(1804044F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:30:00Z"), - }, - new TimeSeriesPoint(1804070F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:35:00Z"), - }, - new TimeSeriesPoint(1804070F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:40:00Z"), - }, - new TimeSeriesPoint(1804068F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:45:00Z"), - }, - new TimeSeriesPoint(1804073F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:50:00Z"), - }, - new TimeSeriesPoint(1804101F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:55:00Z"), - }, - new TimeSeriesPoint(1804674F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:00:00Z"), - }, - new TimeSeriesPoint(1804714F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:05:00Z"), - }, - new TimeSeriesPoint(1804730F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:10:00Z"), - }, - new TimeSeriesPoint(1804816F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:15:00Z"), - }, - new TimeSeriesPoint(1803996F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:20:00Z"), - }, - new TimeSeriesPoint(1803998F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:25:00Z"), - }, - new TimeSeriesPoint(1804015F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:30:00Z"), - }, - new TimeSeriesPoint(1804047F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:35:00Z"), - }, - new TimeSeriesPoint(1804050F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:40:00Z"), - }, - new TimeSeriesPoint(1804218F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:45:00Z"), - }, - new TimeSeriesPoint(1804217F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:50:00Z"), - }, - new TimeSeriesPoint(1804217F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:55:00Z"), - }, - new TimeSeriesPoint(1804205F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:00:00Z"), - }, - new TimeSeriesPoint(1804728F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:05:00Z"), - }, - new TimeSeriesPoint(1804748F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:10:00Z"), - }, - new TimeSeriesPoint(1805232F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:15:00Z"), - }, - new TimeSeriesPoint(1814121F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:20:00Z"), - }, - new TimeSeriesPoint(1806789F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:25:00Z"), - }, - new TimeSeriesPoint(1806119F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:30:00Z"), - }, - new TimeSeriesPoint(1806329F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:35:00Z"), - }, - new TimeSeriesPoint(1806454F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:40:00Z"), - }, - new TimeSeriesPoint(1806852F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:45:00Z"), - }, - new TimeSeriesPoint(1807347F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:50:00Z"), - }, - new TimeSeriesPoint(1812144F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:55:00Z"), - }, - new TimeSeriesPoint(1807418F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:00:00Z"), - }, - new TimeSeriesPoint(1807418F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:05:00Z"), - }, - new TimeSeriesPoint(1807432F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:10:00Z"), - }, - new TimeSeriesPoint(1808540F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:15:00Z"), - }, - new TimeSeriesPoint(1808541F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:20:00Z"), - }, - new TimeSeriesPoint(1807831F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:25:00Z"), - }, - new TimeSeriesPoint(1807852F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:30:00Z"), - }, - new TimeSeriesPoint(1807811F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:35:00Z"), - }, - new TimeSeriesPoint(2214285F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:40:00Z"), - }, - new TimeSeriesPoint(2215019F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:45:00Z"), - }, - new TimeSeriesPoint(2215329F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:50:00Z"), - }, - new TimeSeriesPoint(2215097F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:55:00Z"), - }, - new TimeSeriesPoint(2215129F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:00:00Z"), - }, - new TimeSeriesPoint(2215120F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:05:00Z"), - }, - new TimeSeriesPoint(2217056F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:10:00Z"), - }, - new TimeSeriesPoint(2217056F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:15:00Z"), - }, - new TimeSeriesPoint(2222126F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:20:00Z"), - }, - new TimeSeriesPoint(2226472F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:25:00Z"), - }, - new TimeSeriesPoint(2226722F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:30:00Z"), - }, - new TimeSeriesPoint(2226729F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:35:00Z"), - }, - new TimeSeriesPoint(2226735F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:40:00Z"), - }, - new TimeSeriesPoint(2226735F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:45:00Z"), - }, - new TimeSeriesPoint(2226735F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:50:00Z"), - }, - new TimeSeriesPoint(2226952F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:55:00Z"), - }, - new TimeSeriesPoint(2226962F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:00:00Z"), - }, - new TimeSeriesPoint(2649337F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:05:00Z"), - }, - new TimeSeriesPoint(2092796F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:10:00Z"), - }, - new TimeSeriesPoint(2092839F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:15:00Z"), - }, - new TimeSeriesPoint(2092940F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:20:00Z"), - }, - new TimeSeriesPoint(2092940F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:25:00Z"), - }, - new TimeSeriesPoint(2092965F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:30:00Z"), - }, - new TimeSeriesPoint(2092979F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:35:00Z"), - }, - new TimeSeriesPoint(2095588F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:40:00Z"), - }, - new TimeSeriesPoint(2099586F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:45:00Z"), - }, - new TimeSeriesPoint(2102981F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:50:00Z"), - }, - new TimeSeriesPoint(2108053F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:55:00Z"), - }, - new TimeSeriesPoint(2107907F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:00:00Z"), - }, - new TimeSeriesPoint(2108241F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:05:00Z"), - }, - new TimeSeriesPoint(2100321F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:10:00Z"), - }, - new TimeSeriesPoint(2100448F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:15:00Z"), - }, - new TimeSeriesPoint(2100483F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:20:00Z"), - }, - new TimeSeriesPoint(2103042F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:25:00Z"), - }, - new TimeSeriesPoint(2103037F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:30:00Z"), - }, - new TimeSeriesPoint(2103040F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:35:00Z"), - }, - new TimeSeriesPoint(2103054F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:40:00Z"), - }, - new TimeSeriesPoint(2103058F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:45:00Z"), - }, - new TimeSeriesPoint(1830757F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:50:00Z"), - }, - new TimeSeriesPoint(1830855F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:55:00Z"), - }, - new TimeSeriesPoint(1831495F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:00:00Z"), - }, - new TimeSeriesPoint(1831463F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:05:00Z"), - }, - new TimeSeriesPoint(1831963F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:10:00Z"), - }, - new TimeSeriesPoint(1832046F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:15:00Z"), - }, - new TimeSeriesPoint(1832070F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:20:00Z"), - }, - new TimeSeriesPoint(1835511F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:25:00Z"), - }, - new TimeSeriesPoint(1835265F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:30:00Z"), - }, - new TimeSeriesPoint(1835481F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:35:00Z"), - }, - new TimeSeriesPoint(1835578F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:40:00Z"), - }, - new TimeSeriesPoint(1835611F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:45:00Z"), - }, - new TimeSeriesPoint(1836314F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:50:00Z"), - }, - new TimeSeriesPoint(1836369F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:55:00Z"), - }, - new TimeSeriesPoint(1837280F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:00:00Z"), - }, - new TimeSeriesPoint(1842939F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:05:00Z"), - }, - new TimeSeriesPoint(1843126F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:10:00Z"), - }, - new TimeSeriesPoint(1845840F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:15:00Z"), - }, - new TimeSeriesPoint(1842444F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:20:00Z"), - }, - new TimeSeriesPoint(1839891F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:25:00Z"), - }, - new TimeSeriesPoint(1839875F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:30:00Z"), - }, - new TimeSeriesPoint(1839870F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:35:00Z"), - }, - new TimeSeriesPoint(1840090F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:40:00Z"), - }, - new TimeSeriesPoint(1840479F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:45:00Z"), - }, - new TimeSeriesPoint(1840479F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:50:00Z"), - }, - new TimeSeriesPoint(1840482F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:55:00Z"), - }, - new TimeSeriesPoint(1841522F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:00:00Z"), - }, - new TimeSeriesPoint(1841836F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:05:00Z"), - }, - new TimeSeriesPoint(1842377F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:10:00Z"), - }, - new TimeSeriesPoint(1842388F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:15:00Z"), - }, - new TimeSeriesPoint(1842489F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:20:00Z"), - }, - new TimeSeriesPoint(1842489F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:25:00Z"), - }, - new TimeSeriesPoint(1842489F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:30:00Z"), - }, - new TimeSeriesPoint(1842496F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:35:00Z"), - }, - new TimeSeriesPoint(1842689F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:40:00Z"), - }, - new TimeSeriesPoint(1843117F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:45:00Z"), - }, - new TimeSeriesPoint(1843116F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:50:00Z"), - }, - new TimeSeriesPoint(1843227F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:55:00Z"), - }, - new TimeSeriesPoint(1843138F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:00:00Z"), - }, - new TimeSeriesPoint(1843141F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:05:00Z"), - }, - new TimeSeriesPoint(1843310F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:10:00Z"), - }, - new TimeSeriesPoint(1843310F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:15:00Z"), - }, - new TimeSeriesPoint(1843507F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:20:00Z"), - }, - new TimeSeriesPoint(1843953F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:25:00Z"), - }, - new TimeSeriesPoint(1844778F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:30:00Z"), - }, - new TimeSeriesPoint(1843918F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:35:00Z"), - }, - new TimeSeriesPoint(1882692F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:40:00Z"), - }, - new TimeSeriesPoint(1974888F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:45:00Z"), - }, - new TimeSeriesPoint(2157136F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:50:00Z"), - }, - new TimeSeriesPoint(2154987F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:55:00Z"), - }, - new TimeSeriesPoint(2155664F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:00:00Z"), - }, - new TimeSeriesPoint(2155660F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:05:00Z"), - }, - new TimeSeriesPoint(2155824F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:10:00Z"), - }, - new TimeSeriesPoint(2155824F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:15:00Z"), - }, - new TimeSeriesPoint(2156329F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:20:00Z"), - }, - new TimeSeriesPoint(2156479F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:25:00Z"), - }, - new TimeSeriesPoint(2165269F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:30:00Z"), - }, - new TimeSeriesPoint(2165433F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:35:00Z"), - }, - new TimeSeriesPoint(2165739F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:40:00Z"), - }, - new TimeSeriesPoint(2165931F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:45:00Z"), - }, - new TimeSeriesPoint(2165928F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:50:00Z"), - }, - new TimeSeriesPoint(2165989F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:55:00Z"), - }, - new TimeSeriesPoint(2228961F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:00:00Z"), - }, - new TimeSeriesPoint(2228961F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:05:00Z"), - }, - new TimeSeriesPoint(2228961F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:10:00Z"), - }, - new TimeSeriesPoint(2485802F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:15:00Z"), - }, - new TimeSeriesPoint(2485802F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:20:00Z"), - }, - new TimeSeriesPoint(2486021F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:25:00Z"), - }, - new TimeSeriesPoint(2485293F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:30:00Z"), - }, - new TimeSeriesPoint(2485293F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:35:00Z"), - }, - new TimeSeriesPoint(2485324F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:40:00Z"), - }, - new TimeSeriesPoint(2489142F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:45:00Z"), - }, - new TimeSeriesPoint(2526312F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:50:00Z"), - }, - new TimeSeriesPoint(2526313F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:55:00Z"), - }, - new TimeSeriesPoint(2526314F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:00:00Z"), - }, - new TimeSeriesPoint(2526324F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:05:00Z"), - }, - new TimeSeriesPoint(2526325F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:10:00Z"), - }, - new TimeSeriesPoint(2526205F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:15:00Z"), - }, - new TimeSeriesPoint(2526226F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:20:00Z"), - }, - new TimeSeriesPoint(2526475F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:25:00Z"), - }, - new TimeSeriesPoint(2526471F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:30:00Z"), - }, - new TimeSeriesPoint(2526471F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:35:00Z"), - }, - new TimeSeriesPoint(2526534F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:40:00Z"), - }, - new TimeSeriesPoint(2526646F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:45:00Z"), - }, - new TimeSeriesPoint(2526646F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:50:00Z"), - }, - new TimeSeriesPoint(2526648F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:55:00Z"), - }, - new TimeSeriesPoint(2526658F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:00:00Z"), - }, - new TimeSeriesPoint(2526771F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:05:00Z"), - }, - new TimeSeriesPoint(2526773F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:10:00Z"), - }, - new TimeSeriesPoint(2526793F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:15:00Z"), - }, - new TimeSeriesPoint(2527010F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:20:00Z"), - }, - new TimeSeriesPoint(2527031F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:25:00Z"), - }, - new TimeSeriesPoint(3178096F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:30:00Z"), - }, - new TimeSeriesPoint(3196305F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:35:00Z"), - }, - new TimeSeriesPoint(3196202F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:40:00Z"), - }, - new TimeSeriesPoint(3196202F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:45:00Z"), - }, - new TimeSeriesPoint(3196205F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:50:00Z"), - }, - new TimeSeriesPoint(3229232F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:55:00Z"), - }, - new TimeSeriesPoint(3230463F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:00:00Z"), - }, - new TimeSeriesPoint(3230468F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:05:00Z"), - }, - new TimeSeriesPoint(3230468F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:10:00Z"), - }, - new TimeSeriesPoint(3230468F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:15:00Z"), - }, - new TimeSeriesPoint(3230470F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:20:00Z"), - }, - new TimeSeriesPoint(3230467F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:25:00Z"), - }, - new TimeSeriesPoint(3230506F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:30:00Z"), - }, - new TimeSeriesPoint(3231536F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:35:00Z"), - }, - new TimeSeriesPoint(3230723F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:40:00Z"), - }, - new TimeSeriesPoint(3230727F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:45:00Z"), - }, - new TimeSeriesPoint(3230727F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:50:00Z"), - }, - new TimeSeriesPoint(3230727F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:55:00Z"), - }, - new TimeSeriesPoint(3231880F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:00:00Z"), - }, - new TimeSeriesPoint(3232283F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:05:00Z"), - }, - new TimeSeriesPoint(3232283F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:10:00Z"), - }, - new TimeSeriesPoint(3232283F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:15:00Z"), - }, - new TimeSeriesPoint(3232325F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:20:00Z"), - }, - new TimeSeriesPoint(3232323F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:25:00Z"), - }, - new TimeSeriesPoint(3232327F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:30:00Z"), - }, - new TimeSeriesPoint(3232340F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:35:00Z"), - }, - new TimeSeriesPoint(3232713F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:40:00Z"), - }, - new TimeSeriesPoint(3232729F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:45:00Z"), - }, - new TimeSeriesPoint(3232756F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:50:00Z"), - }, - new TimeSeriesPoint(3233500F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:55:00Z"), - }, - new TimeSeriesPoint(3233500F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T04:00:00Z"), - }, - new TimeSeriesPoint(3233500F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T04:05:00Z"), - } -}, TimeGranularity.PerMinute) -{ - CustomInterval = 5, - Period = 0, - StableTrendWindow = 10, - Threshold = 0.99F, -}; -Response response = await client.DetectUnivariateChangePointAsync(options); -]]> - - - -This sample shows how to call DetectUnivariateChangePoint. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -UnivariateChangePointDetectionOptions options = new UnivariateChangePointDetectionOptions(new TimeSeriesPoint[] -{ - new TimeSeriesPoint(1639196F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T06:45:00Z"), - }, - new TimeSeriesPoint(1639290F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T06:50:00Z"), - }, - new TimeSeriesPoint(1667293F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T06:55:00Z"), - }, - new TimeSeriesPoint(1703130F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:00:00Z"), - }, - new TimeSeriesPoint(1650912F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:05:00Z"), - }, - new TimeSeriesPoint(1653596F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:10:00Z"), - }, - new TimeSeriesPoint(1653793F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:15:00Z"), - }, - new TimeSeriesPoint(1653795F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:20:00Z"), - }, - new TimeSeriesPoint(1663471F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:25:00Z"), - }, - new TimeSeriesPoint(1662358F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:30:00Z"), - }, - new TimeSeriesPoint(1664320F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:35:00Z"), - }, - new TimeSeriesPoint(1664942F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:40:00Z"), - }, - new TimeSeriesPoint(1664966F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:45:00Z"), - }, - new TimeSeriesPoint(1724271F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:50:00Z"), - }, - new TimeSeriesPoint(1678720F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T07:55:00Z"), - }, - new TimeSeriesPoint(1672536F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:00:00Z"), - }, - new TimeSeriesPoint(1672544F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:05:00Z"), - }, - new TimeSeriesPoint(1672364F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:10:00Z"), - }, - new TimeSeriesPoint(1672912F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:15:00Z"), - }, - new TimeSeriesPoint(1672736F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:20:00Z"), - }, - new TimeSeriesPoint(1672725F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:25:00Z"), - }, - new TimeSeriesPoint(1673247F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:30:00Z"), - }, - new TimeSeriesPoint(1673109F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:35:00Z"), - }, - new TimeSeriesPoint(1690088F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:40:00Z"), - }, - new TimeSeriesPoint(1703865F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:45:00Z"), - }, - new TimeSeriesPoint(1703865F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:50:00Z"), - }, - new TimeSeriesPoint(1786581F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T08:55:00Z"), - }, - new TimeSeriesPoint(1800945F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:00:00Z"), - }, - new TimeSeriesPoint(1800957F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:05:00Z"), - }, - new TimeSeriesPoint(1801191F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:10:00Z"), - }, - new TimeSeriesPoint(1801412F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:15:00Z"), - }, - new TimeSeriesPoint(1801621F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:20:00Z"), - }, - new TimeSeriesPoint(1801621F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:25:00Z"), - }, - new TimeSeriesPoint(1801654F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:30:00Z"), - }, - new TimeSeriesPoint(1802105F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:35:00Z"), - }, - new TimeSeriesPoint(1801800F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:40:00Z"), - }, - new TimeSeriesPoint(1803040F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:45:00Z"), - }, - new TimeSeriesPoint(1803672F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:50:00Z"), - }, - new TimeSeriesPoint(1803535F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T09:55:00Z"), - }, - new TimeSeriesPoint(1803541F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:00:00Z"), - }, - new TimeSeriesPoint(1803545F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:05:00Z"), - }, - new TimeSeriesPoint(1803599F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:10:00Z"), - }, - new TimeSeriesPoint(1803616F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:15:00Z"), - }, - new TimeSeriesPoint(1803619F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:20:00Z"), - }, - new TimeSeriesPoint(1809942F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:25:00Z"), - }, - new TimeSeriesPoint(1802720F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:30:00Z"), - }, - new TimeSeriesPoint(1802720F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:35:00Z"), - }, - new TimeSeriesPoint(1802888F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:40:00Z"), - }, - new TimeSeriesPoint(1809574F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:45:00Z"), - }, - new TimeSeriesPoint(1803896F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:50:00Z"), - }, - new TimeSeriesPoint(1803850F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T10:55:00Z"), - }, - new TimeSeriesPoint(1803854F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:00:00Z"), - }, - new TimeSeriesPoint(1803854F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:05:00Z"), - }, - new TimeSeriesPoint(1803797F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:10:00Z"), - }, - new TimeSeriesPoint(1803921F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:15:00Z"), - }, - new TimeSeriesPoint(1803933F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:20:00Z"), - }, - new TimeSeriesPoint(1804040F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:25:00Z"), - }, - new TimeSeriesPoint(1804044F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:30:00Z"), - }, - new TimeSeriesPoint(1804070F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:35:00Z"), - }, - new TimeSeriesPoint(1804070F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:40:00Z"), - }, - new TimeSeriesPoint(1804068F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:45:00Z"), - }, - new TimeSeriesPoint(1804073F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:50:00Z"), - }, - new TimeSeriesPoint(1804101F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T11:55:00Z"), - }, - new TimeSeriesPoint(1804674F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:00:00Z"), - }, - new TimeSeriesPoint(1804714F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:05:00Z"), - }, - new TimeSeriesPoint(1804730F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:10:00Z"), - }, - new TimeSeriesPoint(1804816F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:15:00Z"), - }, - new TimeSeriesPoint(1803996F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:20:00Z"), - }, - new TimeSeriesPoint(1803998F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:25:00Z"), - }, - new TimeSeriesPoint(1804015F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:30:00Z"), - }, - new TimeSeriesPoint(1804047F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:35:00Z"), - }, - new TimeSeriesPoint(1804050F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:40:00Z"), - }, - new TimeSeriesPoint(1804218F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:45:00Z"), - }, - new TimeSeriesPoint(1804217F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:50:00Z"), - }, - new TimeSeriesPoint(1804217F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T12:55:00Z"), - }, - new TimeSeriesPoint(1804205F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:00:00Z"), - }, - new TimeSeriesPoint(1804728F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:05:00Z"), - }, - new TimeSeriesPoint(1804748F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:10:00Z"), - }, - new TimeSeriesPoint(1805232F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:15:00Z"), - }, - new TimeSeriesPoint(1814121F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:20:00Z"), - }, - new TimeSeriesPoint(1806789F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:25:00Z"), - }, - new TimeSeriesPoint(1806119F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:30:00Z"), - }, - new TimeSeriesPoint(1806329F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:35:00Z"), - }, - new TimeSeriesPoint(1806454F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:40:00Z"), - }, - new TimeSeriesPoint(1806852F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:45:00Z"), - }, - new TimeSeriesPoint(1807347F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:50:00Z"), - }, - new TimeSeriesPoint(1812144F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T13:55:00Z"), - }, - new TimeSeriesPoint(1807418F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:00:00Z"), - }, - new TimeSeriesPoint(1807418F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:05:00Z"), - }, - new TimeSeriesPoint(1807432F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:10:00Z"), - }, - new TimeSeriesPoint(1808540F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:15:00Z"), - }, - new TimeSeriesPoint(1808541F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:20:00Z"), - }, - new TimeSeriesPoint(1807831F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:25:00Z"), - }, - new TimeSeriesPoint(1807852F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:30:00Z"), - }, - new TimeSeriesPoint(1807811F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:35:00Z"), - }, - new TimeSeriesPoint(2214285F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:40:00Z"), - }, - new TimeSeriesPoint(2215019F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:45:00Z"), - }, - new TimeSeriesPoint(2215329F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:50:00Z"), - }, - new TimeSeriesPoint(2215097F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T14:55:00Z"), - }, - new TimeSeriesPoint(2215129F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:00:00Z"), - }, - new TimeSeriesPoint(2215120F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:05:00Z"), - }, - new TimeSeriesPoint(2217056F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:10:00Z"), - }, - new TimeSeriesPoint(2217056F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:15:00Z"), - }, - new TimeSeriesPoint(2222126F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:20:00Z"), - }, - new TimeSeriesPoint(2226472F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:25:00Z"), - }, - new TimeSeriesPoint(2226722F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:30:00Z"), - }, - new TimeSeriesPoint(2226729F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:35:00Z"), - }, - new TimeSeriesPoint(2226735F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:40:00Z"), - }, - new TimeSeriesPoint(2226735F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:45:00Z"), - }, - new TimeSeriesPoint(2226735F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:50:00Z"), - }, - new TimeSeriesPoint(2226952F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T15:55:00Z"), - }, - new TimeSeriesPoint(2226962F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:00:00Z"), - }, - new TimeSeriesPoint(2649337F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:05:00Z"), - }, - new TimeSeriesPoint(2092796F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:10:00Z"), - }, - new TimeSeriesPoint(2092839F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:15:00Z"), - }, - new TimeSeriesPoint(2092940F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:20:00Z"), - }, - new TimeSeriesPoint(2092940F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:25:00Z"), - }, - new TimeSeriesPoint(2092965F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:30:00Z"), - }, - new TimeSeriesPoint(2092979F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:35:00Z"), - }, - new TimeSeriesPoint(2095588F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:40:00Z"), - }, - new TimeSeriesPoint(2099586F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:45:00Z"), - }, - new TimeSeriesPoint(2102981F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:50:00Z"), - }, - new TimeSeriesPoint(2108053F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T16:55:00Z"), - }, - new TimeSeriesPoint(2107907F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:00:00Z"), - }, - new TimeSeriesPoint(2108241F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:05:00Z"), - }, - new TimeSeriesPoint(2100321F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:10:00Z"), - }, - new TimeSeriesPoint(2100448F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:15:00Z"), - }, - new TimeSeriesPoint(2100483F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:20:00Z"), - }, - new TimeSeriesPoint(2103042F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:25:00Z"), - }, - new TimeSeriesPoint(2103037F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:30:00Z"), - }, - new TimeSeriesPoint(2103040F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:35:00Z"), - }, - new TimeSeriesPoint(2103054F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:40:00Z"), - }, - new TimeSeriesPoint(2103058F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:45:00Z"), - }, - new TimeSeriesPoint(1830757F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:50:00Z"), - }, - new TimeSeriesPoint(1830855F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T17:55:00Z"), - }, - new TimeSeriesPoint(1831495F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:00:00Z"), - }, - new TimeSeriesPoint(1831463F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:05:00Z"), - }, - new TimeSeriesPoint(1831963F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:10:00Z"), - }, - new TimeSeriesPoint(1832046F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:15:00Z"), - }, - new TimeSeriesPoint(1832070F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:20:00Z"), - }, - new TimeSeriesPoint(1835511F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:25:00Z"), - }, - new TimeSeriesPoint(1835265F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:30:00Z"), - }, - new TimeSeriesPoint(1835481F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:35:00Z"), - }, - new TimeSeriesPoint(1835578F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:40:00Z"), - }, - new TimeSeriesPoint(1835611F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:45:00Z"), - }, - new TimeSeriesPoint(1836314F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:50:00Z"), - }, - new TimeSeriesPoint(1836369F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T18:55:00Z"), - }, - new TimeSeriesPoint(1837280F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:00:00Z"), - }, - new TimeSeriesPoint(1842939F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:05:00Z"), - }, - new TimeSeriesPoint(1843126F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:10:00Z"), - }, - new TimeSeriesPoint(1845840F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:15:00Z"), - }, - new TimeSeriesPoint(1842444F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:20:00Z"), - }, - new TimeSeriesPoint(1839891F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:25:00Z"), - }, - new TimeSeriesPoint(1839875F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:30:00Z"), - }, - new TimeSeriesPoint(1839870F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:35:00Z"), - }, - new TimeSeriesPoint(1840090F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:40:00Z"), - }, - new TimeSeriesPoint(1840479F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:45:00Z"), - }, - new TimeSeriesPoint(1840479F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:50:00Z"), - }, - new TimeSeriesPoint(1840482F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T19:55:00Z"), - }, - new TimeSeriesPoint(1841522F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:00:00Z"), - }, - new TimeSeriesPoint(1841836F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:05:00Z"), - }, - new TimeSeriesPoint(1842377F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:10:00Z"), - }, - new TimeSeriesPoint(1842388F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:15:00Z"), - }, - new TimeSeriesPoint(1842489F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:20:00Z"), - }, - new TimeSeriesPoint(1842489F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:25:00Z"), - }, - new TimeSeriesPoint(1842489F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:30:00Z"), - }, - new TimeSeriesPoint(1842496F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:35:00Z"), - }, - new TimeSeriesPoint(1842689F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:40:00Z"), - }, - new TimeSeriesPoint(1843117F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:45:00Z"), - }, - new TimeSeriesPoint(1843116F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:50:00Z"), - }, - new TimeSeriesPoint(1843227F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T20:55:00Z"), - }, - new TimeSeriesPoint(1843138F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:00:00Z"), - }, - new TimeSeriesPoint(1843141F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:05:00Z"), - }, - new TimeSeriesPoint(1843310F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:10:00Z"), - }, - new TimeSeriesPoint(1843310F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:15:00Z"), - }, - new TimeSeriesPoint(1843507F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:20:00Z"), - }, - new TimeSeriesPoint(1843953F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:25:00Z"), - }, - new TimeSeriesPoint(1844778F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:30:00Z"), - }, - new TimeSeriesPoint(1843918F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:35:00Z"), - }, - new TimeSeriesPoint(1882692F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:40:00Z"), - }, - new TimeSeriesPoint(1974888F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:45:00Z"), - }, - new TimeSeriesPoint(2157136F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:50:00Z"), - }, - new TimeSeriesPoint(2154987F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T21:55:00Z"), - }, - new TimeSeriesPoint(2155664F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:00:00Z"), - }, - new TimeSeriesPoint(2155660F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:05:00Z"), - }, - new TimeSeriesPoint(2155824F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:10:00Z"), - }, - new TimeSeriesPoint(2155824F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:15:00Z"), - }, - new TimeSeriesPoint(2156329F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:20:00Z"), - }, - new TimeSeriesPoint(2156479F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:25:00Z"), - }, - new TimeSeriesPoint(2165269F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:30:00Z"), - }, - new TimeSeriesPoint(2165433F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:35:00Z"), - }, - new TimeSeriesPoint(2165739F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:40:00Z"), - }, - new TimeSeriesPoint(2165931F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:45:00Z"), - }, - new TimeSeriesPoint(2165928F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:50:00Z"), - }, - new TimeSeriesPoint(2165989F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T22:55:00Z"), - }, - new TimeSeriesPoint(2228961F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:00:00Z"), - }, - new TimeSeriesPoint(2228961F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:05:00Z"), - }, - new TimeSeriesPoint(2228961F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:10:00Z"), - }, - new TimeSeriesPoint(2485802F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:15:00Z"), - }, - new TimeSeriesPoint(2485802F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:20:00Z"), - }, - new TimeSeriesPoint(2486021F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:25:00Z"), - }, - new TimeSeriesPoint(2485293F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:30:00Z"), - }, - new TimeSeriesPoint(2485293F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:35:00Z"), - }, - new TimeSeriesPoint(2485324F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:40:00Z"), - }, - new TimeSeriesPoint(2489142F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:45:00Z"), - }, - new TimeSeriesPoint(2526312F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:50:00Z"), - }, - new TimeSeriesPoint(2526313F) - { - Timestamp = DateTimeOffset.Parse("2017-01-01T23:55:00Z"), - }, - new TimeSeriesPoint(2526314F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:00:00Z"), - }, - new TimeSeriesPoint(2526324F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:05:00Z"), - }, - new TimeSeriesPoint(2526325F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:10:00Z"), - }, - new TimeSeriesPoint(2526205F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:15:00Z"), - }, - new TimeSeriesPoint(2526226F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:20:00Z"), - }, - new TimeSeriesPoint(2526475F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:25:00Z"), - }, - new TimeSeriesPoint(2526471F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:30:00Z"), - }, - new TimeSeriesPoint(2526471F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:35:00Z"), - }, - new TimeSeriesPoint(2526534F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:40:00Z"), - }, - new TimeSeriesPoint(2526646F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:45:00Z"), - }, - new TimeSeriesPoint(2526646F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:50:00Z"), - }, - new TimeSeriesPoint(2526648F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T00:55:00Z"), - }, - new TimeSeriesPoint(2526658F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:00:00Z"), - }, - new TimeSeriesPoint(2526771F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:05:00Z"), - }, - new TimeSeriesPoint(2526773F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:10:00Z"), - }, - new TimeSeriesPoint(2526793F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:15:00Z"), - }, - new TimeSeriesPoint(2527010F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:20:00Z"), - }, - new TimeSeriesPoint(2527031F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:25:00Z"), - }, - new TimeSeriesPoint(3178096F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:30:00Z"), - }, - new TimeSeriesPoint(3196305F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:35:00Z"), - }, - new TimeSeriesPoint(3196202F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:40:00Z"), - }, - new TimeSeriesPoint(3196202F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:45:00Z"), - }, - new TimeSeriesPoint(3196205F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:50:00Z"), - }, - new TimeSeriesPoint(3229232F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T01:55:00Z"), - }, - new TimeSeriesPoint(3230463F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:00:00Z"), - }, - new TimeSeriesPoint(3230468F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:05:00Z"), - }, - new TimeSeriesPoint(3230468F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:10:00Z"), - }, - new TimeSeriesPoint(3230468F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:15:00Z"), - }, - new TimeSeriesPoint(3230470F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:20:00Z"), - }, - new TimeSeriesPoint(3230467F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:25:00Z"), - }, - new TimeSeriesPoint(3230506F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:30:00Z"), - }, - new TimeSeriesPoint(3231536F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:35:00Z"), - }, - new TimeSeriesPoint(3230723F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:40:00Z"), - }, - new TimeSeriesPoint(3230727F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:45:00Z"), - }, - new TimeSeriesPoint(3230727F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:50:00Z"), - }, - new TimeSeriesPoint(3230727F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T02:55:00Z"), - }, - new TimeSeriesPoint(3231880F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:00:00Z"), - }, - new TimeSeriesPoint(3232283F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:05:00Z"), - }, - new TimeSeriesPoint(3232283F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:10:00Z"), - }, - new TimeSeriesPoint(3232283F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:15:00Z"), - }, - new TimeSeriesPoint(3232325F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:20:00Z"), - }, - new TimeSeriesPoint(3232323F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:25:00Z"), - }, - new TimeSeriesPoint(3232327F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:30:00Z"), - }, - new TimeSeriesPoint(3232340F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:35:00Z"), - }, - new TimeSeriesPoint(3232713F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:40:00Z"), - }, - new TimeSeriesPoint(3232729F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:45:00Z"), - }, - new TimeSeriesPoint(3232756F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:50:00Z"), - }, - new TimeSeriesPoint(3233500F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T03:55:00Z"), - }, - new TimeSeriesPoint(3233500F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T04:00:00Z"), - }, - new TimeSeriesPoint(3233500F) - { - Timestamp = DateTimeOffset.Parse("2017-01-02T04:05:00Z"), - } -}, TimeGranularity.PerMinute) -{ - CustomInterval = 5, - Period = 0, - StableTrendWindow = 10, - Threshold = 0.99F, -}; -Response response = client.DetectUnivariateChangePoint(options); -]]> - - - -This sample shows how to call DetectUnivariateChangePointAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - series = new object[] - { - new - { - timestamp = "2017-01-01T06:45:00Z", - value = 1639196F, - }, - new - { - timestamp = "2017-01-01T06:50:00Z", - value = 1639290F, - }, - new - { - timestamp = "2017-01-01T06:55:00Z", - value = 1667293F, - }, - new - { - timestamp = "2017-01-01T07:00:00Z", - value = 1703130F, - }, - new - { - timestamp = "2017-01-01T07:05:00Z", - value = 1650912F, - }, - new - { - timestamp = "2017-01-01T07:10:00Z", - value = 1653596F, - }, - new - { - timestamp = "2017-01-01T07:15:00Z", - value = 1653793F, - }, - new - { - timestamp = "2017-01-01T07:20:00Z", - value = 1653795F, - }, - new - { - timestamp = "2017-01-01T07:25:00Z", - value = 1663471F, - }, - new - { - timestamp = "2017-01-01T07:30:00Z", - value = 1662358F, - }, - new - { - timestamp = "2017-01-01T07:35:00Z", - value = 1664320F, - }, - new - { - timestamp = "2017-01-01T07:40:00Z", - value = 1664942F, - }, - new - { - timestamp = "2017-01-01T07:45:00Z", - value = 1664966F, - }, - new - { - timestamp = "2017-01-01T07:50:00Z", - value = 1724271F, - }, - new - { - timestamp = "2017-01-01T07:55:00Z", - value = 1678720F, - }, - new - { - timestamp = "2017-01-01T08:00:00Z", - value = 1672536F, - }, - new - { - timestamp = "2017-01-01T08:05:00Z", - value = 1672544F, - }, - new - { - timestamp = "2017-01-01T08:10:00Z", - value = 1672364F, - }, - new - { - timestamp = "2017-01-01T08:15:00Z", - value = 1672912F, - }, - new - { - timestamp = "2017-01-01T08:20:00Z", - value = 1672736F, - }, - new - { - timestamp = "2017-01-01T08:25:00Z", - value = 1672725F, - }, - new - { - timestamp = "2017-01-01T08:30:00Z", - value = 1673247F, - }, - new - { - timestamp = "2017-01-01T08:35:00Z", - value = 1673109F, - }, - new - { - timestamp = "2017-01-01T08:40:00Z", - value = 1690088F, - }, - new - { - timestamp = "2017-01-01T08:45:00Z", - value = 1703865F, - }, - new - { - timestamp = "2017-01-01T08:50:00Z", - value = 1703865F, - }, - new - { - timestamp = "2017-01-01T08:55:00Z", - value = 1786581F, - }, - new - { - timestamp = "2017-01-01T09:00:00Z", - value = 1800945F, - }, - new - { - timestamp = "2017-01-01T09:05:00Z", - value = 1800957F, - }, - new - { - timestamp = "2017-01-01T09:10:00Z", - value = 1801191F, - }, - new - { - timestamp = "2017-01-01T09:15:00Z", - value = 1801412F, - }, - new - { - timestamp = "2017-01-01T09:20:00Z", - value = 1801621F, - }, - new - { - timestamp = "2017-01-01T09:25:00Z", - value = 1801621F, - }, - new - { - timestamp = "2017-01-01T09:30:00Z", - value = 1801654F, - }, - new - { - timestamp = "2017-01-01T09:35:00Z", - value = 1802105F, - }, - new - { - timestamp = "2017-01-01T09:40:00Z", - value = 1801800F, - }, - new - { - timestamp = "2017-01-01T09:45:00Z", - value = 1803040F, - }, - new - { - timestamp = "2017-01-01T09:50:00Z", - value = 1803672F, - }, - new - { - timestamp = "2017-01-01T09:55:00Z", - value = 1803535F, - }, - new - { - timestamp = "2017-01-01T10:00:00Z", - value = 1803541F, - }, - new - { - timestamp = "2017-01-01T10:05:00Z", - value = 1803545F, - }, - new - { - timestamp = "2017-01-01T10:10:00Z", - value = 1803599F, - }, - new - { - timestamp = "2017-01-01T10:15:00Z", - value = 1803616F, - }, - new - { - timestamp = "2017-01-01T10:20:00Z", - value = 1803619F, - }, - new - { - timestamp = "2017-01-01T10:25:00Z", - value = 1809942F, - }, - new - { - timestamp = "2017-01-01T10:30:00Z", - value = 1802720F, - }, - new - { - timestamp = "2017-01-01T10:35:00Z", - value = 1802720F, - }, - new - { - timestamp = "2017-01-01T10:40:00Z", - value = 1802888F, - }, - new - { - timestamp = "2017-01-01T10:45:00Z", - value = 1809574F, - }, - new - { - timestamp = "2017-01-01T10:50:00Z", - value = 1803896F, - }, - new - { - timestamp = "2017-01-01T10:55:00Z", - value = 1803850F, - }, - new - { - timestamp = "2017-01-01T11:00:00Z", - value = 1803854F, - }, - new - { - timestamp = "2017-01-01T11:05:00Z", - value = 1803854F, - }, - new - { - timestamp = "2017-01-01T11:10:00Z", - value = 1803797F, - }, - new - { - timestamp = "2017-01-01T11:15:00Z", - value = 1803921F, - }, - new - { - timestamp = "2017-01-01T11:20:00Z", - value = 1803933F, - }, - new - { - timestamp = "2017-01-01T11:25:00Z", - value = 1804040F, - }, - new - { - timestamp = "2017-01-01T11:30:00Z", - value = 1804044F, - }, - new - { - timestamp = "2017-01-01T11:35:00Z", - value = 1804070F, - }, - new - { - timestamp = "2017-01-01T11:40:00Z", - value = 1804070F, - }, - new - { - timestamp = "2017-01-01T11:45:00Z", - value = 1804068F, - }, - new - { - timestamp = "2017-01-01T11:50:00Z", - value = 1804073F, - }, - new - { - timestamp = "2017-01-01T11:55:00Z", - value = 1804101F, - }, - new - { - timestamp = "2017-01-01T12:00:00Z", - value = 1804674F, - }, - new - { - timestamp = "2017-01-01T12:05:00Z", - value = 1804714F, - }, - new - { - timestamp = "2017-01-01T12:10:00Z", - value = 1804730F, - }, - new - { - timestamp = "2017-01-01T12:15:00Z", - value = 1804816F, - }, - new - { - timestamp = "2017-01-01T12:20:00Z", - value = 1803996F, - }, - new - { - timestamp = "2017-01-01T12:25:00Z", - value = 1803998F, - }, - new - { - timestamp = "2017-01-01T12:30:00Z", - value = 1804015F, - }, - new - { - timestamp = "2017-01-01T12:35:00Z", - value = 1804047F, - }, - new - { - timestamp = "2017-01-01T12:40:00Z", - value = 1804050F, - }, - new - { - timestamp = "2017-01-01T12:45:00Z", - value = 1804218F, - }, - new - { - timestamp = "2017-01-01T12:50:00Z", - value = 1804217F, - }, - new - { - timestamp = "2017-01-01T12:55:00Z", - value = 1804217F, - }, - new - { - timestamp = "2017-01-01T13:00:00Z", - value = 1804205F, - }, - new - { - timestamp = "2017-01-01T13:05:00Z", - value = 1804728F, - }, - new - { - timestamp = "2017-01-01T13:10:00Z", - value = 1804748F, - }, - new - { - timestamp = "2017-01-01T13:15:00Z", - value = 1805232F, - }, - new - { - timestamp = "2017-01-01T13:20:00Z", - value = 1814121F, - }, - new - { - timestamp = "2017-01-01T13:25:00Z", - value = 1806789F, - }, - new - { - timestamp = "2017-01-01T13:30:00Z", - value = 1806119F, - }, - new - { - timestamp = "2017-01-01T13:35:00Z", - value = 1806329F, - }, - new - { - timestamp = "2017-01-01T13:40:00Z", - value = 1806454F, - }, - new - { - timestamp = "2017-01-01T13:45:00Z", - value = 1806852F, - }, - new - { - timestamp = "2017-01-01T13:50:00Z", - value = 1807347F, - }, - new - { - timestamp = "2017-01-01T13:55:00Z", - value = 1812144F, - }, - new - { - timestamp = "2017-01-01T14:00:00Z", - value = 1807418F, - }, - new - { - timestamp = "2017-01-01T14:05:00Z", - value = 1807418F, - }, - new - { - timestamp = "2017-01-01T14:10:00Z", - value = 1807432F, - }, - new - { - timestamp = "2017-01-01T14:15:00Z", - value = 1808540F, - }, - new - { - timestamp = "2017-01-01T14:20:00Z", - value = 1808541F, - }, - new - { - timestamp = "2017-01-01T14:25:00Z", - value = 1807831F, - }, - new - { - timestamp = "2017-01-01T14:30:00Z", - value = 1807852F, - }, - new - { - timestamp = "2017-01-01T14:35:00Z", - value = 1807811F, - }, - new - { - timestamp = "2017-01-01T14:40:00Z", - value = 2214285F, - }, - new - { - timestamp = "2017-01-01T14:45:00Z", - value = 2215019F, - }, - new - { - timestamp = "2017-01-01T14:50:00Z", - value = 2215329F, - }, - new - { - timestamp = "2017-01-01T14:55:00Z", - value = 2215097F, - }, - new - { - timestamp = "2017-01-01T15:00:00Z", - value = 2215129F, - }, - new - { - timestamp = "2017-01-01T15:05:00Z", - value = 2215120F, - }, - new - { - timestamp = "2017-01-01T15:10:00Z", - value = 2217056F, - }, - new - { - timestamp = "2017-01-01T15:15:00Z", - value = 2217056F, - }, - new - { - timestamp = "2017-01-01T15:20:00Z", - value = 2222126F, - }, - new - { - timestamp = "2017-01-01T15:25:00Z", - value = 2226472F, - }, - new - { - timestamp = "2017-01-01T15:30:00Z", - value = 2226722F, - }, - new - { - timestamp = "2017-01-01T15:35:00Z", - value = 2226729F, - }, - new - { - timestamp = "2017-01-01T15:40:00Z", - value = 2226735F, - }, - new - { - timestamp = "2017-01-01T15:45:00Z", - value = 2226735F, - }, - new - { - timestamp = "2017-01-01T15:50:00Z", - value = 2226735F, - }, - new - { - timestamp = "2017-01-01T15:55:00Z", - value = 2226952F, - }, - new - { - timestamp = "2017-01-01T16:00:00Z", - value = 2226962F, - }, - new - { - timestamp = "2017-01-01T16:05:00Z", - value = 2649337F, - }, - new - { - timestamp = "2017-01-01T16:10:00Z", - value = 2092796F, - }, - new - { - timestamp = "2017-01-01T16:15:00Z", - value = 2092839F, - }, - new - { - timestamp = "2017-01-01T16:20:00Z", - value = 2092940F, - }, - new - { - timestamp = "2017-01-01T16:25:00Z", - value = 2092940F, - }, - new - { - timestamp = "2017-01-01T16:30:00Z", - value = 2092965F, - }, - new - { - timestamp = "2017-01-01T16:35:00Z", - value = 2092979F, - }, - new - { - timestamp = "2017-01-01T16:40:00Z", - value = 2095588F, - }, - new - { - timestamp = "2017-01-01T16:45:00Z", - value = 2099586F, - }, - new - { - timestamp = "2017-01-01T16:50:00Z", - value = 2102981F, - }, - new - { - timestamp = "2017-01-01T16:55:00Z", - value = 2108053F, - }, - new - { - timestamp = "2017-01-01T17:00:00Z", - value = 2107907F, - }, - new - { - timestamp = "2017-01-01T17:05:00Z", - value = 2108241F, - }, - new - { - timestamp = "2017-01-01T17:10:00Z", - value = 2100321F, - }, - new - { - timestamp = "2017-01-01T17:15:00Z", - value = 2100448F, - }, - new - { - timestamp = "2017-01-01T17:20:00Z", - value = 2100483F, - }, - new - { - timestamp = "2017-01-01T17:25:00Z", - value = 2103042F, - }, - new - { - timestamp = "2017-01-01T17:30:00Z", - value = 2103037F, - }, - new - { - timestamp = "2017-01-01T17:35:00Z", - value = 2103040F, - }, - new - { - timestamp = "2017-01-01T17:40:00Z", - value = 2103054F, - }, - new - { - timestamp = "2017-01-01T17:45:00Z", - value = 2103058F, - }, - new - { - timestamp = "2017-01-01T17:50:00Z", - value = 1830757F, - }, - new - { - timestamp = "2017-01-01T17:55:00Z", - value = 1830855F, - }, - new - { - timestamp = "2017-01-01T18:00:00Z", - value = 1831495F, - }, - new - { - timestamp = "2017-01-01T18:05:00Z", - value = 1831463F, - }, - new - { - timestamp = "2017-01-01T18:10:00Z", - value = 1831963F, - }, - new - { - timestamp = "2017-01-01T18:15:00Z", - value = 1832046F, - }, - new - { - timestamp = "2017-01-01T18:20:00Z", - value = 1832070F, - }, - new - { - timestamp = "2017-01-01T18:25:00Z", - value = 1835511F, - }, - new - { - timestamp = "2017-01-01T18:30:00Z", - value = 1835265F, - }, - new - { - timestamp = "2017-01-01T18:35:00Z", - value = 1835481F, - }, - new - { - timestamp = "2017-01-01T18:40:00Z", - value = 1835578F, - }, - new - { - timestamp = "2017-01-01T18:45:00Z", - value = 1835611F, - }, - new - { - timestamp = "2017-01-01T18:50:00Z", - value = 1836314F, - }, - new - { - timestamp = "2017-01-01T18:55:00Z", - value = 1836369F, - }, - new - { - timestamp = "2017-01-01T19:00:00Z", - value = 1837280F, - }, - new - { - timestamp = "2017-01-01T19:05:00Z", - value = 1842939F, - }, - new - { - timestamp = "2017-01-01T19:10:00Z", - value = 1843126F, - }, - new - { - timestamp = "2017-01-01T19:15:00Z", - value = 1845840F, - }, - new - { - timestamp = "2017-01-01T19:20:00Z", - value = 1842444F, - }, - new - { - timestamp = "2017-01-01T19:25:00Z", - value = 1839891F, - }, - new - { - timestamp = "2017-01-01T19:30:00Z", - value = 1839875F, - }, - new - { - timestamp = "2017-01-01T19:35:00Z", - value = 1839870F, - }, - new - { - timestamp = "2017-01-01T19:40:00Z", - value = 1840090F, - }, - new - { - timestamp = "2017-01-01T19:45:00Z", - value = 1840479F, - }, - new - { - timestamp = "2017-01-01T19:50:00Z", - value = 1840479F, - }, - new - { - timestamp = "2017-01-01T19:55:00Z", - value = 1840482F, - }, - new - { - timestamp = "2017-01-01T20:00:00Z", - value = 1841522F, - }, - new - { - timestamp = "2017-01-01T20:05:00Z", - value = 1841836F, - }, - new - { - timestamp = "2017-01-01T20:10:00Z", - value = 1842377F, - }, - new - { - timestamp = "2017-01-01T20:15:00Z", - value = 1842388F, - }, - new - { - timestamp = "2017-01-01T20:20:00Z", - value = 1842489F, - }, - new - { - timestamp = "2017-01-01T20:25:00Z", - value = 1842489F, - }, - new - { - timestamp = "2017-01-01T20:30:00Z", - value = 1842489F, - }, - new - { - timestamp = "2017-01-01T20:35:00Z", - value = 1842496F, - }, - new - { - timestamp = "2017-01-01T20:40:00Z", - value = 1842689F, - }, - new - { - timestamp = "2017-01-01T20:45:00Z", - value = 1843117F, - }, - new - { - timestamp = "2017-01-01T20:50:00Z", - value = 1843116F, - }, - new - { - timestamp = "2017-01-01T20:55:00Z", - value = 1843227F, - }, - new - { - timestamp = "2017-01-01T21:00:00Z", - value = 1843138F, - }, - new - { - timestamp = "2017-01-01T21:05:00Z", - value = 1843141F, - }, - new - { - timestamp = "2017-01-01T21:10:00Z", - value = 1843310F, - }, - new - { - timestamp = "2017-01-01T21:15:00Z", - value = 1843310F, - }, - new - { - timestamp = "2017-01-01T21:20:00Z", - value = 1843507F, - }, - new - { - timestamp = "2017-01-01T21:25:00Z", - value = 1843953F, - }, - new - { - timestamp = "2017-01-01T21:30:00Z", - value = 1844778F, - }, - new - { - timestamp = "2017-01-01T21:35:00Z", - value = 1843918F, - }, - new - { - timestamp = "2017-01-01T21:40:00Z", - value = 1882692F, - }, - new - { - timestamp = "2017-01-01T21:45:00Z", - value = 1974888F, - }, - new - { - timestamp = "2017-01-01T21:50:00Z", - value = 2157136F, - }, - new - { - timestamp = "2017-01-01T21:55:00Z", - value = 2154987F, - }, - new - { - timestamp = "2017-01-01T22:00:00Z", - value = 2155664F, - }, - new - { - timestamp = "2017-01-01T22:05:00Z", - value = 2155660F, - }, - new - { - timestamp = "2017-01-01T22:10:00Z", - value = 2155824F, - }, - new - { - timestamp = "2017-01-01T22:15:00Z", - value = 2155824F, - }, - new - { - timestamp = "2017-01-01T22:20:00Z", - value = 2156329F, - }, - new - { - timestamp = "2017-01-01T22:25:00Z", - value = 2156479F, - }, - new - { - timestamp = "2017-01-01T22:30:00Z", - value = 2165269F, - }, - new - { - timestamp = "2017-01-01T22:35:00Z", - value = 2165433F, - }, - new - { - timestamp = "2017-01-01T22:40:00Z", - value = 2165739F, - }, - new - { - timestamp = "2017-01-01T22:45:00Z", - value = 2165931F, - }, - new - { - timestamp = "2017-01-01T22:50:00Z", - value = 2165928F, - }, - new - { - timestamp = "2017-01-01T22:55:00Z", - value = 2165989F, - }, - new - { - timestamp = "2017-01-01T23:00:00Z", - value = 2228961F, - }, - new - { - timestamp = "2017-01-01T23:05:00Z", - value = 2228961F, - }, - new - { - timestamp = "2017-01-01T23:10:00Z", - value = 2228961F, - }, - new - { - timestamp = "2017-01-01T23:15:00Z", - value = 2485802F, - }, - new - { - timestamp = "2017-01-01T23:20:00Z", - value = 2485802F, - }, - new - { - timestamp = "2017-01-01T23:25:00Z", - value = 2486021F, - }, - new - { - timestamp = "2017-01-01T23:30:00Z", - value = 2485293F, - }, - new - { - timestamp = "2017-01-01T23:35:00Z", - value = 2485293F, - }, - new - { - timestamp = "2017-01-01T23:40:00Z", - value = 2485324F, - }, - new - { - timestamp = "2017-01-01T23:45:00Z", - value = 2489142F, - }, - new - { - timestamp = "2017-01-01T23:50:00Z", - value = 2526312F, - }, - new - { - timestamp = "2017-01-01T23:55:00Z", - value = 2526313F, - }, - new - { - timestamp = "2017-01-02T00:00:00Z", - value = 2526314F, - }, - new - { - timestamp = "2017-01-02T00:05:00Z", - value = 2526324F, - }, - new - { - timestamp = "2017-01-02T00:10:00Z", - value = 2526325F, - }, - new - { - timestamp = "2017-01-02T00:15:00Z", - value = 2526205F, - }, - new - { - timestamp = "2017-01-02T00:20:00Z", - value = 2526226F, - }, - new - { - timestamp = "2017-01-02T00:25:00Z", - value = 2526475F, - }, - new - { - timestamp = "2017-01-02T00:30:00Z", - value = 2526471F, - }, - new - { - timestamp = "2017-01-02T00:35:00Z", - value = 2526471F, - }, - new - { - timestamp = "2017-01-02T00:40:00Z", - value = 2526534F, - }, - new - { - timestamp = "2017-01-02T00:45:00Z", - value = 2526646F, - }, - new - { - timestamp = "2017-01-02T00:50:00Z", - value = 2526646F, - }, - new - { - timestamp = "2017-01-02T00:55:00Z", - value = 2526648F, - }, - new - { - timestamp = "2017-01-02T01:00:00Z", - value = 2526658F, - }, - new - { - timestamp = "2017-01-02T01:05:00Z", - value = 2526771F, - }, - new - { - timestamp = "2017-01-02T01:10:00Z", - value = 2526773F, - }, - new - { - timestamp = "2017-01-02T01:15:00Z", - value = 2526793F, - }, - new - { - timestamp = "2017-01-02T01:20:00Z", - value = 2527010F, - }, - new - { - timestamp = "2017-01-02T01:25:00Z", - value = 2527031F, - }, - new - { - timestamp = "2017-01-02T01:30:00Z", - value = 3178096F, - }, - new - { - timestamp = "2017-01-02T01:35:00Z", - value = 3196305F, - }, - new - { - timestamp = "2017-01-02T01:40:00Z", - value = 3196202F, - }, - new - { - timestamp = "2017-01-02T01:45:00Z", - value = 3196202F, - }, - new - { - timestamp = "2017-01-02T01:50:00Z", - value = 3196205F, - }, - new - { - timestamp = "2017-01-02T01:55:00Z", - value = 3229232F, - }, - new - { - timestamp = "2017-01-02T02:00:00Z", - value = 3230463F, - }, - new - { - timestamp = "2017-01-02T02:05:00Z", - value = 3230468F, - }, - new - { - timestamp = "2017-01-02T02:10:00Z", - value = 3230468F, - }, - new - { - timestamp = "2017-01-02T02:15:00Z", - value = 3230468F, - }, - new - { - timestamp = "2017-01-02T02:20:00Z", - value = 3230470F, - }, - new - { - timestamp = "2017-01-02T02:25:00Z", - value = 3230467F, - }, - new - { - timestamp = "2017-01-02T02:30:00Z", - value = 3230506F, - }, - new - { - timestamp = "2017-01-02T02:35:00Z", - value = 3231536F, - }, - new - { - timestamp = "2017-01-02T02:40:00Z", - value = 3230723F, - }, - new - { - timestamp = "2017-01-02T02:45:00Z", - value = 3230727F, - }, - new - { - timestamp = "2017-01-02T02:50:00Z", - value = 3230727F, - }, - new - { - timestamp = "2017-01-02T02:55:00Z", - value = 3230727F, - }, - new - { - timestamp = "2017-01-02T03:00:00Z", - value = 3231880F, - }, - new - { - timestamp = "2017-01-02T03:05:00Z", - value = 3232283F, - }, - new - { - timestamp = "2017-01-02T03:10:00Z", - value = 3232283F, - }, - new - { - timestamp = "2017-01-02T03:15:00Z", - value = 3232283F, - }, - new - { - timestamp = "2017-01-02T03:20:00Z", - value = 3232325F, - }, - new - { - timestamp = "2017-01-02T03:25:00Z", - value = 3232323F, - }, - new - { - timestamp = "2017-01-02T03:30:00Z", - value = 3232327F, - }, - new - { - timestamp = "2017-01-02T03:35:00Z", - value = 3232340F, - }, - new - { - timestamp = "2017-01-02T03:40:00Z", - value = 3232713F, - }, - new - { - timestamp = "2017-01-02T03:45:00Z", - value = 3232729F, - }, - new - { - timestamp = "2017-01-02T03:50:00Z", - value = 3232756F, - }, - new - { - timestamp = "2017-01-02T03:55:00Z", - value = 3233500F, - }, - new - { - timestamp = "2017-01-02T04:00:00Z", - value = 3233500F, - }, - new - { - timestamp = "2017-01-02T04:05:00Z", - value = 3233500F, - } - }, - granularity = "minutely", - customInterval = 5, - stableTrendWindow = 10, - threshold = 0.99F, - period = 0, -}); -Response response = await client.DetectUnivariateChangePointAsync(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> - - - -This sample shows how to call DetectUnivariateChangePoint and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -Univariate client = new AnomalyDetectorClient(endpoint, credential).GetUnivariateClient(); - -using RequestContent content = RequestContent.Create(new -{ - series = new object[] - { - new - { - timestamp = "2017-01-01T06:45:00Z", - value = 1639196F, - }, - new - { - timestamp = "2017-01-01T06:50:00Z", - value = 1639290F, - }, - new - { - timestamp = "2017-01-01T06:55:00Z", - value = 1667293F, - }, - new - { - timestamp = "2017-01-01T07:00:00Z", - value = 1703130F, - }, - new - { - timestamp = "2017-01-01T07:05:00Z", - value = 1650912F, - }, - new - { - timestamp = "2017-01-01T07:10:00Z", - value = 1653596F, - }, - new - { - timestamp = "2017-01-01T07:15:00Z", - value = 1653793F, - }, - new - { - timestamp = "2017-01-01T07:20:00Z", - value = 1653795F, - }, - new - { - timestamp = "2017-01-01T07:25:00Z", - value = 1663471F, - }, - new - { - timestamp = "2017-01-01T07:30:00Z", - value = 1662358F, - }, - new - { - timestamp = "2017-01-01T07:35:00Z", - value = 1664320F, - }, - new - { - timestamp = "2017-01-01T07:40:00Z", - value = 1664942F, - }, - new - { - timestamp = "2017-01-01T07:45:00Z", - value = 1664966F, - }, - new - { - timestamp = "2017-01-01T07:50:00Z", - value = 1724271F, - }, - new - { - timestamp = "2017-01-01T07:55:00Z", - value = 1678720F, - }, - new - { - timestamp = "2017-01-01T08:00:00Z", - value = 1672536F, - }, - new - { - timestamp = "2017-01-01T08:05:00Z", - value = 1672544F, - }, - new - { - timestamp = "2017-01-01T08:10:00Z", - value = 1672364F, - }, - new - { - timestamp = "2017-01-01T08:15:00Z", - value = 1672912F, - }, - new - { - timestamp = "2017-01-01T08:20:00Z", - value = 1672736F, - }, - new - { - timestamp = "2017-01-01T08:25:00Z", - value = 1672725F, - }, - new - { - timestamp = "2017-01-01T08:30:00Z", - value = 1673247F, - }, - new - { - timestamp = "2017-01-01T08:35:00Z", - value = 1673109F, - }, - new - { - timestamp = "2017-01-01T08:40:00Z", - value = 1690088F, - }, - new - { - timestamp = "2017-01-01T08:45:00Z", - value = 1703865F, - }, - new - { - timestamp = "2017-01-01T08:50:00Z", - value = 1703865F, - }, - new - { - timestamp = "2017-01-01T08:55:00Z", - value = 1786581F, - }, - new - { - timestamp = "2017-01-01T09:00:00Z", - value = 1800945F, - }, - new - { - timestamp = "2017-01-01T09:05:00Z", - value = 1800957F, - }, - new - { - timestamp = "2017-01-01T09:10:00Z", - value = 1801191F, - }, - new - { - timestamp = "2017-01-01T09:15:00Z", - value = 1801412F, - }, - new - { - timestamp = "2017-01-01T09:20:00Z", - value = 1801621F, - }, - new - { - timestamp = "2017-01-01T09:25:00Z", - value = 1801621F, - }, - new - { - timestamp = "2017-01-01T09:30:00Z", - value = 1801654F, - }, - new - { - timestamp = "2017-01-01T09:35:00Z", - value = 1802105F, - }, - new - { - timestamp = "2017-01-01T09:40:00Z", - value = 1801800F, - }, - new - { - timestamp = "2017-01-01T09:45:00Z", - value = 1803040F, - }, - new - { - timestamp = "2017-01-01T09:50:00Z", - value = 1803672F, - }, - new - { - timestamp = "2017-01-01T09:55:00Z", - value = 1803535F, - }, - new - { - timestamp = "2017-01-01T10:00:00Z", - value = 1803541F, - }, - new - { - timestamp = "2017-01-01T10:05:00Z", - value = 1803545F, - }, - new - { - timestamp = "2017-01-01T10:10:00Z", - value = 1803599F, - }, - new - { - timestamp = "2017-01-01T10:15:00Z", - value = 1803616F, - }, - new - { - timestamp = "2017-01-01T10:20:00Z", - value = 1803619F, - }, - new - { - timestamp = "2017-01-01T10:25:00Z", - value = 1809942F, - }, - new - { - timestamp = "2017-01-01T10:30:00Z", - value = 1802720F, - }, - new - { - timestamp = "2017-01-01T10:35:00Z", - value = 1802720F, - }, - new - { - timestamp = "2017-01-01T10:40:00Z", - value = 1802888F, - }, - new - { - timestamp = "2017-01-01T10:45:00Z", - value = 1809574F, - }, - new - { - timestamp = "2017-01-01T10:50:00Z", - value = 1803896F, - }, - new - { - timestamp = "2017-01-01T10:55:00Z", - value = 1803850F, - }, - new - { - timestamp = "2017-01-01T11:00:00Z", - value = 1803854F, - }, - new - { - timestamp = "2017-01-01T11:05:00Z", - value = 1803854F, - }, - new - { - timestamp = "2017-01-01T11:10:00Z", - value = 1803797F, - }, - new - { - timestamp = "2017-01-01T11:15:00Z", - value = 1803921F, - }, - new - { - timestamp = "2017-01-01T11:20:00Z", - value = 1803933F, - }, - new - { - timestamp = "2017-01-01T11:25:00Z", - value = 1804040F, - }, - new - { - timestamp = "2017-01-01T11:30:00Z", - value = 1804044F, - }, - new - { - timestamp = "2017-01-01T11:35:00Z", - value = 1804070F, - }, - new - { - timestamp = "2017-01-01T11:40:00Z", - value = 1804070F, - }, - new - { - timestamp = "2017-01-01T11:45:00Z", - value = 1804068F, - }, - new - { - timestamp = "2017-01-01T11:50:00Z", - value = 1804073F, - }, - new - { - timestamp = "2017-01-01T11:55:00Z", - value = 1804101F, - }, - new - { - timestamp = "2017-01-01T12:00:00Z", - value = 1804674F, - }, - new - { - timestamp = "2017-01-01T12:05:00Z", - value = 1804714F, - }, - new - { - timestamp = "2017-01-01T12:10:00Z", - value = 1804730F, - }, - new - { - timestamp = "2017-01-01T12:15:00Z", - value = 1804816F, - }, - new - { - timestamp = "2017-01-01T12:20:00Z", - value = 1803996F, - }, - new - { - timestamp = "2017-01-01T12:25:00Z", - value = 1803998F, - }, - new - { - timestamp = "2017-01-01T12:30:00Z", - value = 1804015F, - }, - new - { - timestamp = "2017-01-01T12:35:00Z", - value = 1804047F, - }, - new - { - timestamp = "2017-01-01T12:40:00Z", - value = 1804050F, - }, - new - { - timestamp = "2017-01-01T12:45:00Z", - value = 1804218F, - }, - new - { - timestamp = "2017-01-01T12:50:00Z", - value = 1804217F, - }, - new - { - timestamp = "2017-01-01T12:55:00Z", - value = 1804217F, - }, - new - { - timestamp = "2017-01-01T13:00:00Z", - value = 1804205F, - }, - new - { - timestamp = "2017-01-01T13:05:00Z", - value = 1804728F, - }, - new - { - timestamp = "2017-01-01T13:10:00Z", - value = 1804748F, - }, - new - { - timestamp = "2017-01-01T13:15:00Z", - value = 1805232F, - }, - new - { - timestamp = "2017-01-01T13:20:00Z", - value = 1814121F, - }, - new - { - timestamp = "2017-01-01T13:25:00Z", - value = 1806789F, - }, - new - { - timestamp = "2017-01-01T13:30:00Z", - value = 1806119F, - }, - new - { - timestamp = "2017-01-01T13:35:00Z", - value = 1806329F, - }, - new - { - timestamp = "2017-01-01T13:40:00Z", - value = 1806454F, - }, - new - { - timestamp = "2017-01-01T13:45:00Z", - value = 1806852F, - }, - new - { - timestamp = "2017-01-01T13:50:00Z", - value = 1807347F, - }, - new - { - timestamp = "2017-01-01T13:55:00Z", - value = 1812144F, - }, - new - { - timestamp = "2017-01-01T14:00:00Z", - value = 1807418F, - }, - new - { - timestamp = "2017-01-01T14:05:00Z", - value = 1807418F, - }, - new - { - timestamp = "2017-01-01T14:10:00Z", - value = 1807432F, - }, - new - { - timestamp = "2017-01-01T14:15:00Z", - value = 1808540F, - }, - new - { - timestamp = "2017-01-01T14:20:00Z", - value = 1808541F, - }, - new - { - timestamp = "2017-01-01T14:25:00Z", - value = 1807831F, - }, - new - { - timestamp = "2017-01-01T14:30:00Z", - value = 1807852F, - }, - new - { - timestamp = "2017-01-01T14:35:00Z", - value = 1807811F, - }, - new - { - timestamp = "2017-01-01T14:40:00Z", - value = 2214285F, - }, - new - { - timestamp = "2017-01-01T14:45:00Z", - value = 2215019F, - }, - new - { - timestamp = "2017-01-01T14:50:00Z", - value = 2215329F, - }, - new - { - timestamp = "2017-01-01T14:55:00Z", - value = 2215097F, - }, - new - { - timestamp = "2017-01-01T15:00:00Z", - value = 2215129F, - }, - new - { - timestamp = "2017-01-01T15:05:00Z", - value = 2215120F, - }, - new - { - timestamp = "2017-01-01T15:10:00Z", - value = 2217056F, - }, - new - { - timestamp = "2017-01-01T15:15:00Z", - value = 2217056F, - }, - new - { - timestamp = "2017-01-01T15:20:00Z", - value = 2222126F, - }, - new - { - timestamp = "2017-01-01T15:25:00Z", - value = 2226472F, - }, - new - { - timestamp = "2017-01-01T15:30:00Z", - value = 2226722F, - }, - new - { - timestamp = "2017-01-01T15:35:00Z", - value = 2226729F, - }, - new - { - timestamp = "2017-01-01T15:40:00Z", - value = 2226735F, - }, - new - { - timestamp = "2017-01-01T15:45:00Z", - value = 2226735F, - }, - new - { - timestamp = "2017-01-01T15:50:00Z", - value = 2226735F, - }, - new - { - timestamp = "2017-01-01T15:55:00Z", - value = 2226952F, - }, - new - { - timestamp = "2017-01-01T16:00:00Z", - value = 2226962F, - }, - new - { - timestamp = "2017-01-01T16:05:00Z", - value = 2649337F, - }, - new - { - timestamp = "2017-01-01T16:10:00Z", - value = 2092796F, - }, - new - { - timestamp = "2017-01-01T16:15:00Z", - value = 2092839F, - }, - new - { - timestamp = "2017-01-01T16:20:00Z", - value = 2092940F, - }, - new - { - timestamp = "2017-01-01T16:25:00Z", - value = 2092940F, - }, - new - { - timestamp = "2017-01-01T16:30:00Z", - value = 2092965F, - }, - new - { - timestamp = "2017-01-01T16:35:00Z", - value = 2092979F, - }, - new - { - timestamp = "2017-01-01T16:40:00Z", - value = 2095588F, - }, - new - { - timestamp = "2017-01-01T16:45:00Z", - value = 2099586F, - }, - new - { - timestamp = "2017-01-01T16:50:00Z", - value = 2102981F, - }, - new - { - timestamp = "2017-01-01T16:55:00Z", - value = 2108053F, - }, - new - { - timestamp = "2017-01-01T17:00:00Z", - value = 2107907F, - }, - new - { - timestamp = "2017-01-01T17:05:00Z", - value = 2108241F, - }, - new - { - timestamp = "2017-01-01T17:10:00Z", - value = 2100321F, - }, - new - { - timestamp = "2017-01-01T17:15:00Z", - value = 2100448F, - }, - new - { - timestamp = "2017-01-01T17:20:00Z", - value = 2100483F, - }, - new - { - timestamp = "2017-01-01T17:25:00Z", - value = 2103042F, - }, - new - { - timestamp = "2017-01-01T17:30:00Z", - value = 2103037F, - }, - new - { - timestamp = "2017-01-01T17:35:00Z", - value = 2103040F, - }, - new - { - timestamp = "2017-01-01T17:40:00Z", - value = 2103054F, - }, - new - { - timestamp = "2017-01-01T17:45:00Z", - value = 2103058F, - }, - new - { - timestamp = "2017-01-01T17:50:00Z", - value = 1830757F, - }, - new - { - timestamp = "2017-01-01T17:55:00Z", - value = 1830855F, - }, - new - { - timestamp = "2017-01-01T18:00:00Z", - value = 1831495F, - }, - new - { - timestamp = "2017-01-01T18:05:00Z", - value = 1831463F, - }, - new - { - timestamp = "2017-01-01T18:10:00Z", - value = 1831963F, - }, - new - { - timestamp = "2017-01-01T18:15:00Z", - value = 1832046F, - }, - new - { - timestamp = "2017-01-01T18:20:00Z", - value = 1832070F, - }, - new - { - timestamp = "2017-01-01T18:25:00Z", - value = 1835511F, - }, - new - { - timestamp = "2017-01-01T18:30:00Z", - value = 1835265F, - }, - new - { - timestamp = "2017-01-01T18:35:00Z", - value = 1835481F, - }, - new - { - timestamp = "2017-01-01T18:40:00Z", - value = 1835578F, - }, - new - { - timestamp = "2017-01-01T18:45:00Z", - value = 1835611F, - }, - new - { - timestamp = "2017-01-01T18:50:00Z", - value = 1836314F, - }, - new - { - timestamp = "2017-01-01T18:55:00Z", - value = 1836369F, - }, - new - { - timestamp = "2017-01-01T19:00:00Z", - value = 1837280F, - }, - new - { - timestamp = "2017-01-01T19:05:00Z", - value = 1842939F, - }, - new - { - timestamp = "2017-01-01T19:10:00Z", - value = 1843126F, - }, - new - { - timestamp = "2017-01-01T19:15:00Z", - value = 1845840F, - }, - new - { - timestamp = "2017-01-01T19:20:00Z", - value = 1842444F, - }, - new - { - timestamp = "2017-01-01T19:25:00Z", - value = 1839891F, - }, - new - { - timestamp = "2017-01-01T19:30:00Z", - value = 1839875F, - }, - new - { - timestamp = "2017-01-01T19:35:00Z", - value = 1839870F, - }, - new - { - timestamp = "2017-01-01T19:40:00Z", - value = 1840090F, - }, - new - { - timestamp = "2017-01-01T19:45:00Z", - value = 1840479F, - }, - new - { - timestamp = "2017-01-01T19:50:00Z", - value = 1840479F, - }, - new - { - timestamp = "2017-01-01T19:55:00Z", - value = 1840482F, - }, - new - { - timestamp = "2017-01-01T20:00:00Z", - value = 1841522F, - }, - new - { - timestamp = "2017-01-01T20:05:00Z", - value = 1841836F, - }, - new - { - timestamp = "2017-01-01T20:10:00Z", - value = 1842377F, - }, - new - { - timestamp = "2017-01-01T20:15:00Z", - value = 1842388F, - }, - new - { - timestamp = "2017-01-01T20:20:00Z", - value = 1842489F, - }, - new - { - timestamp = "2017-01-01T20:25:00Z", - value = 1842489F, - }, - new - { - timestamp = "2017-01-01T20:30:00Z", - value = 1842489F, - }, - new - { - timestamp = "2017-01-01T20:35:00Z", - value = 1842496F, - }, - new - { - timestamp = "2017-01-01T20:40:00Z", - value = 1842689F, - }, - new - { - timestamp = "2017-01-01T20:45:00Z", - value = 1843117F, - }, - new - { - timestamp = "2017-01-01T20:50:00Z", - value = 1843116F, - }, - new - { - timestamp = "2017-01-01T20:55:00Z", - value = 1843227F, - }, - new - { - timestamp = "2017-01-01T21:00:00Z", - value = 1843138F, - }, - new - { - timestamp = "2017-01-01T21:05:00Z", - value = 1843141F, - }, - new - { - timestamp = "2017-01-01T21:10:00Z", - value = 1843310F, - }, - new - { - timestamp = "2017-01-01T21:15:00Z", - value = 1843310F, - }, - new - { - timestamp = "2017-01-01T21:20:00Z", - value = 1843507F, - }, - new - { - timestamp = "2017-01-01T21:25:00Z", - value = 1843953F, - }, - new - { - timestamp = "2017-01-01T21:30:00Z", - value = 1844778F, - }, - new - { - timestamp = "2017-01-01T21:35:00Z", - value = 1843918F, - }, - new - { - timestamp = "2017-01-01T21:40:00Z", - value = 1882692F, - }, - new - { - timestamp = "2017-01-01T21:45:00Z", - value = 1974888F, - }, - new - { - timestamp = "2017-01-01T21:50:00Z", - value = 2157136F, - }, - new - { - timestamp = "2017-01-01T21:55:00Z", - value = 2154987F, - }, - new - { - timestamp = "2017-01-01T22:00:00Z", - value = 2155664F, - }, - new - { - timestamp = "2017-01-01T22:05:00Z", - value = 2155660F, - }, - new - { - timestamp = "2017-01-01T22:10:00Z", - value = 2155824F, - }, - new - { - timestamp = "2017-01-01T22:15:00Z", - value = 2155824F, - }, - new - { - timestamp = "2017-01-01T22:20:00Z", - value = 2156329F, - }, - new - { - timestamp = "2017-01-01T22:25:00Z", - value = 2156479F, - }, - new - { - timestamp = "2017-01-01T22:30:00Z", - value = 2165269F, - }, - new - { - timestamp = "2017-01-01T22:35:00Z", - value = 2165433F, - }, - new - { - timestamp = "2017-01-01T22:40:00Z", - value = 2165739F, - }, - new - { - timestamp = "2017-01-01T22:45:00Z", - value = 2165931F, - }, - new - { - timestamp = "2017-01-01T22:50:00Z", - value = 2165928F, - }, - new - { - timestamp = "2017-01-01T22:55:00Z", - value = 2165989F, - }, - new - { - timestamp = "2017-01-01T23:00:00Z", - value = 2228961F, - }, - new - { - timestamp = "2017-01-01T23:05:00Z", - value = 2228961F, - }, - new - { - timestamp = "2017-01-01T23:10:00Z", - value = 2228961F, - }, - new - { - timestamp = "2017-01-01T23:15:00Z", - value = 2485802F, - }, - new - { - timestamp = "2017-01-01T23:20:00Z", - value = 2485802F, - }, - new - { - timestamp = "2017-01-01T23:25:00Z", - value = 2486021F, - }, - new - { - timestamp = "2017-01-01T23:30:00Z", - value = 2485293F, - }, - new - { - timestamp = "2017-01-01T23:35:00Z", - value = 2485293F, - }, - new - { - timestamp = "2017-01-01T23:40:00Z", - value = 2485324F, - }, - new - { - timestamp = "2017-01-01T23:45:00Z", - value = 2489142F, - }, - new - { - timestamp = "2017-01-01T23:50:00Z", - value = 2526312F, - }, - new - { - timestamp = "2017-01-01T23:55:00Z", - value = 2526313F, - }, - new - { - timestamp = "2017-01-02T00:00:00Z", - value = 2526314F, - }, - new - { - timestamp = "2017-01-02T00:05:00Z", - value = 2526324F, - }, - new - { - timestamp = "2017-01-02T00:10:00Z", - value = 2526325F, - }, - new - { - timestamp = "2017-01-02T00:15:00Z", - value = 2526205F, - }, - new - { - timestamp = "2017-01-02T00:20:00Z", - value = 2526226F, - }, - new - { - timestamp = "2017-01-02T00:25:00Z", - value = 2526475F, - }, - new - { - timestamp = "2017-01-02T00:30:00Z", - value = 2526471F, - }, - new - { - timestamp = "2017-01-02T00:35:00Z", - value = 2526471F, - }, - new - { - timestamp = "2017-01-02T00:40:00Z", - value = 2526534F, - }, - new - { - timestamp = "2017-01-02T00:45:00Z", - value = 2526646F, - }, - new - { - timestamp = "2017-01-02T00:50:00Z", - value = 2526646F, - }, - new - { - timestamp = "2017-01-02T00:55:00Z", - value = 2526648F, - }, - new - { - timestamp = "2017-01-02T01:00:00Z", - value = 2526658F, - }, - new - { - timestamp = "2017-01-02T01:05:00Z", - value = 2526771F, - }, - new - { - timestamp = "2017-01-02T01:10:00Z", - value = 2526773F, - }, - new - { - timestamp = "2017-01-02T01:15:00Z", - value = 2526793F, - }, - new - { - timestamp = "2017-01-02T01:20:00Z", - value = 2527010F, - }, - new - { - timestamp = "2017-01-02T01:25:00Z", - value = 2527031F, - }, - new - { - timestamp = "2017-01-02T01:30:00Z", - value = 3178096F, - }, - new - { - timestamp = "2017-01-02T01:35:00Z", - value = 3196305F, - }, - new - { - timestamp = "2017-01-02T01:40:00Z", - value = 3196202F, - }, - new - { - timestamp = "2017-01-02T01:45:00Z", - value = 3196202F, - }, - new - { - timestamp = "2017-01-02T01:50:00Z", - value = 3196205F, - }, - new - { - timestamp = "2017-01-02T01:55:00Z", - value = 3229232F, - }, - new - { - timestamp = "2017-01-02T02:00:00Z", - value = 3230463F, - }, - new - { - timestamp = "2017-01-02T02:05:00Z", - value = 3230468F, - }, - new - { - timestamp = "2017-01-02T02:10:00Z", - value = 3230468F, - }, - new - { - timestamp = "2017-01-02T02:15:00Z", - value = 3230468F, - }, - new - { - timestamp = "2017-01-02T02:20:00Z", - value = 3230470F, - }, - new - { - timestamp = "2017-01-02T02:25:00Z", - value = 3230467F, - }, - new - { - timestamp = "2017-01-02T02:30:00Z", - value = 3230506F, - }, - new - { - timestamp = "2017-01-02T02:35:00Z", - value = 3231536F, - }, - new - { - timestamp = "2017-01-02T02:40:00Z", - value = 3230723F, - }, - new - { - timestamp = "2017-01-02T02:45:00Z", - value = 3230727F, - }, - new - { - timestamp = "2017-01-02T02:50:00Z", - value = 3230727F, - }, - new - { - timestamp = "2017-01-02T02:55:00Z", - value = 3230727F, - }, - new - { - timestamp = "2017-01-02T03:00:00Z", - value = 3231880F, - }, - new - { - timestamp = "2017-01-02T03:05:00Z", - value = 3232283F, - }, - new - { - timestamp = "2017-01-02T03:10:00Z", - value = 3232283F, - }, - new - { - timestamp = "2017-01-02T03:15:00Z", - value = 3232283F, - }, - new - { - timestamp = "2017-01-02T03:20:00Z", - value = 3232325F, - }, - new - { - timestamp = "2017-01-02T03:25:00Z", - value = 3232323F, - }, - new - { - timestamp = "2017-01-02T03:30:00Z", - value = 3232327F, - }, - new - { - timestamp = "2017-01-02T03:35:00Z", - value = 3232340F, - }, - new - { - timestamp = "2017-01-02T03:40:00Z", - value = 3232713F, - }, - new - { - timestamp = "2017-01-02T03:45:00Z", - value = 3232729F, - }, - new - { - timestamp = "2017-01-02T03:50:00Z", - value = 3232756F, - }, - new - { - timestamp = "2017-01-02T03:55:00Z", - value = 3233500F, - }, - new - { - timestamp = "2017-01-02T04:00:00Z", - value = 3233500F, - }, - new - { - timestamp = "2017-01-02T04:05:00Z", - value = 3233500F, - } - }, - granularity = "minutely", - customInterval = 5, - stableTrendWindow = 10, - threshold = 0.99F, - period = 0, -}); -Response response = client.DetectUnivariateChangePoint(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> - - - \ No newline at end of file diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.Serialization.cs deleted file mode 100644 index f8469d96fc15..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.Serialization.cs +++ /dev/null @@ -1,150 +0,0 @@ -// 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.Core; - -namespace Azure.AI.AnomalyDetector -{ - public partial class ErrorResponse : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code); - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - 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, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ErrorResponse 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(ErrorResponse)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeErrorResponse(document.RootElement, options); - } - - internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string code = default; - string message = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ErrorResponse(code, message, 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{options.Format}' format."); - } - } - - ErrorResponse 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, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeErrorResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ErrorResponse)} 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 ErrorResponse FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeErrorResponse(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.cs deleted file mode 100644 index 3e04d1378eff..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ErrorResponse.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.AnomalyDetector -{ - /// Error information that the API returned. - public partial class ErrorResponse - { - /// - /// 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 code. - /// Message that explains the error that the service reported. - /// or is null. - internal ErrorResponse(string code, string message) - { - Argument.AssertNotNull(code, nameof(code)); - Argument.AssertNotNull(message, nameof(message)); - - Code = code; - Message = message; - } - - /// Initializes a new instance of . - /// Error code. - /// Message that explains the error that the service reported. - /// Keeps track of any properties unknown to the library. - internal ErrorResponse(string code, string message, IDictionary serializedAdditionalRawData) - { - Code = code; - Message = message; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ErrorResponse() - { - } - - /// Error code. - public string Code { get; } - /// Message that explains the error that the service reported. - public string Message { get; } - } -} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Argument.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Argument.cs index 8b55bbd78c7c..95069a21ffdf 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Argument.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Argument.cs @@ -11,8 +11,10 @@ namespace Azure.AI.AnomalyDetector { - internal static class Argument + internal static partial class Argument { + /// The value. + /// The name. public static void AssertNotNull(T value, string name) { if (value is null) @@ -21,8 +23,10 @@ public static void AssertNotNull(T value, string name) } } + /// The value. + /// The name. public static void AssertNotNull(T? value, string name) - where T : struct + where T : struct { if (!value.HasValue) { @@ -30,6 +34,8 @@ public static void AssertNotNull(T? value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(IEnumerable value, string name) { if (value is null) @@ -51,6 +57,8 @@ public static void AssertNotNullOrEmpty(IEnumerable value, string name) } } + /// The value. + /// The name. public static void AssertNotNullOrEmpty(string value, string name) { if (value is null) @@ -62,68 +70,5 @@ public static void AssertNotNullOrEmpty(string value, string name) 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CancellationTokenExtensions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CancellationTokenExtensions.cs new file mode 100644 index 000000000000..1d0d5d3a7255 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CancellationTokenExtensions.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Azure; + +namespace Azure.AI.AnomalyDetector +{ + internal static partial class CancellationTokenExtensions + { + public static RequestContext ToRequestContext(this CancellationToken cancellationToken) => cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingDictionary.cs index 0644b1bbf9e6..9fdf8c42e058 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingDictionary.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -11,7 +11,8 @@ namespace Azure.AI.AnomalyDetector { - internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + internal partial class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary + where TKey : notnull { private IDictionary _innerDictionary; @@ -19,6 +20,7 @@ public ChangeTrackingDictionary() { } + /// The inner dictionary. public ChangeTrackingDictionary(IDictionary dictionary) { if (dictionary == null) @@ -28,6 +30,7 @@ public ChangeTrackingDictionary(IDictionary dictionary) _innerDictionary = new Dictionary(dictionary); } + /// The inner dictionary. public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) { if (dictionary == null) @@ -41,16 +44,22 @@ public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerDictionary == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + /// Gets the Keys. public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + /// Gets the Values. public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + /// Gets or sets the value associated with the specified key. public TValue this[TKey key] { get @@ -67,8 +76,10 @@ public TValue this[TKey key] } } + /// Gets the Keys. IEnumerable IReadOnlyDictionary.Keys => Keys; + /// Gets the Values. IEnumerable IReadOnlyDictionary.Values => Values; public IEnumerator> GetEnumerator() @@ -89,6 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(KeyValuePair item) { EnsureDictionary().Add(item); @@ -99,6 +111,7 @@ public void Clear() EnsureDictionary().Clear(); } + /// The item to search for. public bool Contains(KeyValuePair item) { if (IsUndefined) @@ -108,6 +121,8 @@ public bool Contains(KeyValuePair item) return EnsureDictionary().Contains(item); } + /// The array to copy. + /// The index. public void CopyTo(KeyValuePair[] array, int index) { if (IsUndefined) @@ -117,6 +132,7 @@ public void CopyTo(KeyValuePair[] array, int index) EnsureDictionary().CopyTo(array, index); } + /// The item to remove. public bool Remove(KeyValuePair item) { if (IsUndefined) @@ -126,11 +142,14 @@ public bool Remove(KeyValuePair item) return EnsureDictionary().Remove(item); } + /// The key. + /// The value to add. public void Add(TKey key, TValue value) { EnsureDictionary().Add(key, value); } + /// The key to search for. public bool ContainsKey(TKey key) { if (IsUndefined) @@ -140,6 +159,7 @@ public bool ContainsKey(TKey key) return EnsureDictionary().ContainsKey(key); } + /// The key. public bool Remove(TKey key) { if (IsUndefined) @@ -149,6 +169,8 @@ public bool Remove(TKey key) return EnsureDictionary().Remove(key); } + /// The key to search for. + /// The value. public bool TryGetValue(TKey key, out TValue value) { if (IsUndefined) diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingList.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingList.cs index f6bc141694f5..ba624f39bfe2 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingList.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ChangeTrackingList.cs @@ -12,7 +12,7 @@ namespace Azure.AI.AnomalyDetector { - internal class ChangeTrackingList : IList, IReadOnlyList + internal partial class ChangeTrackingList : IList, IReadOnlyList { private IList _innerList; @@ -20,6 +20,7 @@ public ChangeTrackingList() { } + /// The inner list. public ChangeTrackingList(IList innerList) { if (innerList != null) @@ -28,6 +29,7 @@ public ChangeTrackingList(IList innerList) } } + /// The inner list. public ChangeTrackingList(IReadOnlyList innerList) { if (innerList != null) @@ -36,12 +38,16 @@ public ChangeTrackingList(IReadOnlyList innerList) } } + /// Gets the IsUndefined. public bool IsUndefined => _innerList == null; + /// Gets the Count. public int Count => IsUndefined ? 0 : EnsureList().Count; + /// Gets the IsReadOnly. public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + /// Gets or sets the value associated with the specified key. public T this[int index] { get @@ -85,6 +91,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } + /// The item to add. public void Add(T item) { EnsureList().Add(item); @@ -95,6 +102,7 @@ public void Clear() EnsureList().Clear(); } + /// The item. public bool Contains(T item) { if (IsUndefined) @@ -104,6 +112,8 @@ public bool Contains(T item) return EnsureList().Contains(item); } + /// The array to copy to. + /// The array index. public void CopyTo(T[] array, int arrayIndex) { if (IsUndefined) @@ -113,6 +123,7 @@ public void CopyTo(T[] array, int arrayIndex) EnsureList().CopyTo(array, arrayIndex); } + /// The item. public bool Remove(T item) { if (IsUndefined) @@ -122,6 +133,7 @@ public bool Remove(T item) return EnsureList().Remove(item); } + /// The item. public int IndexOf(T item) { if (IsUndefined) @@ -131,11 +143,14 @@ public int IndexOf(T item) return EnsureList().IndexOf(item); } + /// The inner list. + /// The item. public void Insert(int index, T item) { EnsureList().Insert(index, item); } + /// The inner list. public void RemoveAt(int index) { if (IsUndefined) diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ClientPipelineExtensions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ClientPipelineExtensions.cs new file mode 100644 index 000000000000..321c1aed1505 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ClientPipelineExtensions.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.AnomalyDetector +{ + internal static partial class ClientPipelineExtensions + { + public static async ValueTask ProcessMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + await pipeline.SendAsync(message, userCancellationToken).ConfigureAwait(false); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static Response ProcessMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + (CancellationToken userCancellationToken, ErrorOptions statusOption) = context.Parse(); + pipeline.Send(message, userCancellationToken); + + if (message.Response.IsError && (context?.ErrorOptions & ErrorOptions.NoThrow) != ErrorOptions.NoThrow) + { + throw new RequestFailedException(message.Response); + } + + return message.Response; + } + + public static async ValueTask> ProcessHeadAsBoolMessageAsync(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = await pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + + public static Response ProcessHeadAsBoolMessage(this HttpPipeline pipeline, HttpMessage message, RequestContext context) + { + Response response = pipeline.ProcessMessage(message, context); + switch (response.Status) + { + case >= 200 and < 300: + return Response.FromValue(true, response); + case >= 400 and < 500: + return Response.FromValue(false, response); + default: + return new ErrorResult(response, new RequestFailedException(response)); + } + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenMemberAttribute.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenMemberAttribute.cs new file mode 100644 index 000000000000..72778edeb7e4 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenMemberAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Property | AttributeTargets.Field))] + internal partial class CodeGenMemberAttribute : CodeGenTypeAttribute + { + /// The original name of the member. + public CodeGenMemberAttribute(string originalName) : base(originalName) + { + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenSerializationAttribute.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenSerializationAttribute.cs new file mode 100644 index 000000000000..dfcabf517497 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenSerializationAttribute.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Struct), AllowMultiple = true, Inherited = true)] + internal partial class CodeGenSerializationAttribute : Attribute + { + /// The property name which these hooks apply to. + public CodeGenSerializationAttribute(string propertyName) + { + PropertyName = propertyName; + } + + /// The property name which these hooks apply to. + /// The serialization name of the property. + public CodeGenSerializationAttribute(string propertyName, string serializationName) + { + PropertyName = propertyName; + SerializationName = serializationName; + } + + /// Gets or sets the property name which these hooks should apply to. + public string PropertyName { get; } + + /// Gets or sets the serialization name of the property. + public string SerializationName { get; set; } + + /// + /// Gets or sets the method name to use when serializing the property value (property name excluded). + /// The signature of the serialization hook method must be or compatible with when invoking: private void SerializeHook(Utf8JsonWriter writer); + /// + public string SerializationValueHook { get; set; } + + /// + /// Gets or sets the method name to use when deserializing the property value from the JSON. + /// private static void DeserializationHook(JsonProperty property, ref TypeOfTheProperty propertyValue); // if the property is required + /// private static void DeserializationHook(JsonProperty property, ref Optional<TypeOfTheProperty> propertyValue); // if the property is optional + /// + public string DeserializationValueHook { get; set; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenSuppressAttribute.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenSuppressAttribute.cs new file mode 100644 index 000000000000..38d536e69173 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenSuppressAttribute.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct), AllowMultiple = true)] + internal partial class CodeGenSuppressAttribute : Attribute + { + /// The member to suppress. + /// The types of the parameters of the member. + public CodeGenSuppressAttribute(string member, params Type[] parameters) + { + Member = member; + Parameters = parameters; + } + + /// Gets the Member. + public string Member { get; } + + /// Gets the Parameters. + public Type[] Parameters { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenTypeAttribute.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenTypeAttribute.cs new file mode 100644 index 000000000000..f36b5f513173 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/CodeGenTypeAttribute.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Microsoft.TypeSpec.Generator.Customizations +{ + [AttributeUsage((AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct))] + internal partial class CodeGenTypeAttribute : Attribute + { + /// The original name of the type. + public CodeGenTypeAttribute(string originalName) + { + OriginalName = originalName; + } + + /// Gets the OriginalName. + public string OriginalName { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ErrorResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ErrorResult.cs new file mode 100644 index 000000000000..28e549f5ad6c --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ErrorResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; + +namespace Azure.AI.AnomalyDetector +{ + internal partial class ErrorResult : Response + { + private readonly Response _response; + private readonly RequestFailedException _exception; + + public ErrorResult(Response response, RequestFailedException exception) + { + _response = response; + _exception = exception; + } + + /// Gets the Value. + public override T Value => throw _exception; + + /// + public override Response GetRawResponse() + { + return _response; + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ModelSerializationExtensions.cs index 9ae1d424179e..5222596aa1a1 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ModelSerializationExtensions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/ModelSerializationExtensions.cs @@ -10,19 +10,18 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using System.Runtime.InteropServices; using System.Text.Json; -using System.Xml; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - internal static class ModelSerializationExtensions + internal static partial class ModelSerializationExtensions { - internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); - internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); - internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); - internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions + { + MaxDepth = 256 + }; public static object GetObject(this JsonElement element) { @@ -48,14 +47,14 @@ public static object GetObject(this JsonElement element) case JsonValueKind.Null: return null; case JsonValueKind.Object: - var dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var jsonProperty in element.EnumerateObject()) { dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); } return dictionary; case JsonValueKind.Array: - var list = new List(); + List list = new List(); foreach (var item in element.EnumerateArray()) { list.Add(item.GetObject()); @@ -93,7 +92,7 @@ public static char GetChar(this JsonElement element) { if (element.ValueKind == JsonValueKind.String) { - var text = element.GetString(); + string text = element.GetString(); if (text == null || text.Length != 1) { throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); @@ -107,14 +106,14 @@ public static char GetChar(this JsonElement element) } [Conditional("DEBUG")] - public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + public static void ThrowNonNullablePropertyIsNull(this JsonProperty @property) { - throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + throw new JsonException($"A property '{@property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); } public static string GetRequiredString(this JsonElement element) { - var value = element.GetString(); + string value = element.GetString(); if (value == null) { throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); @@ -181,9 +180,6 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, T value, Mode case IJsonModel jsonModel: jsonModel.Write(writer, options ?? WireOptions); break; - case IUtf8JsonSerializable serializable: - serializable.Write(writer); - break; case byte[] bytes: writer.WriteBase64StringValue(bytes); break; @@ -260,150 +256,13 @@ public static void WriteObjectValue(this Utf8JsonWriter writer, object value, Mo writer.WriteObjectValue(value, options); } - internal static bool IsSentinelValue(BinaryData value) - { - ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; - ReadOnlySpan valueSpan = value.ToMemory().Span; - return sentinelSpan.SequenceEqual(valueSpan); - } - - internal static class TypeFormatters + public static BinaryData GetUtf8Bytes(this JsonElement element) { - private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; - public const string DefaultNumberFormat = "G"; - - public static string ToString(bool value) => value ? "true" : "false"; - - public static string ToString(DateTime value, string format) => value.Kind switch - { - DateTimeKind.Utc => ToString((DateTimeOffset)value, format), - _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") - }; - - public static string ToString(DateTimeOffset value, string format) => format switch - { - "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), - "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), - "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), - "R" => value.ToString("r", CultureInfo.InvariantCulture), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(TimeSpan value, string format) => format switch - { - "P" => XmlConvert.ToString(value), - _ => value.ToString(format, CultureInfo.InvariantCulture) - }; - - public static string ToString(byte[] value, string format) => format switch - { - "U" => ToBase64UrlString(value), - "D" => Convert.ToBase64String(value), - _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) - }; - - public static string ToBase64UrlString(byte[] value) - { - int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; - int size = checked(numWholeOrPartialInputBlocks * 4); - char[] output = new char[size]; - - int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); - - int i = 0; - for (; i < numBase64Chars; i++) - { - char ch = output[i]; - if (ch == '+') - { - output[i] = '-'; - } - else - { - if (ch == '/') - { - output[i] = '_'; - } - else - { - if (ch == '=') - { - break; - } - } - } - } - - return new string(output, 0, i); - } - - public static byte[] FromBase64UrlString(string value) - { - int paddingCharsToAdd = (value.Length % 4) switch - { - 0 => 0, - 2 => 2, - 3 => 1, - _ => throw new InvalidOperationException("Malformed input") - }; - char[] output = new char[(value.Length + paddingCharsToAdd)]; - int i = 0; - for (; i < value.Length; i++) - { - char ch = value[i]; - if (ch == '-') - { - output[i] = '+'; - } - else - { - if (ch == '_') - { - output[i] = '/'; - } - else - { - output[i] = ch; - } - } - } - - for (; i < output.Length; i++) - { - output[i] = '='; - } - - return Convert.FromBase64CharArray(output, 0, output.Length); - } - - public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch - { - "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), - _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) - }; - - public static TimeSpan ParseTimeSpan(string value, string format) => format switch - { - "P" => XmlConvert.ToTimeSpan(value), - _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) - }; - - public static string ConvertToString(object value, string format = null) => value switch - { - null => "null", - string s => s, - bool b => ToString(b), - int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), - byte[] b0 when format != null => ToString(b0, format), - IEnumerable s0 => string.Join(",", s0), - DateTimeOffset dateTime when format != null => ToString(dateTime, format), - TimeSpan timeSpan when format != null => ToString(timeSpan, format), - TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), - Guid guid => guid.ToString(), - BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), - _ => value.ToString() - }; +#if NET9_0_OR_GREATER + return new global::System.BinaryData(global::System.Runtime.InteropServices.JsonMarshal.GetRawUtf8Value(element).ToArray()); +#else + return BinaryData.FromString(element.GetRawText()); +#endif } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Optional.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Optional.cs index 619080aa7784..4e63d13faee5 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Optional.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Optional.cs @@ -10,7 +10,7 @@ namespace Azure.AI.AnomalyDetector { - internal static class Optional + internal static partial class Optional { public static bool IsCollectionDefined(IEnumerable collection) { @@ -28,7 +28,7 @@ public static bool IsCollectionDefined(IReadOnlyDictionary(T? value) - where T : struct + where T : struct { return value.HasValue; } @@ -38,14 +38,14 @@ public static bool IsDefined(object value) return value != null; } - public static bool IsDefined(JsonElement value) + public static bool IsDefined(string value) { - return value.ValueKind != JsonValueKind.Undefined; + return value != null; } - public static bool IsDefined(string value) + public static bool IsDefined(JsonElement value) { - return value != null; + return value.ValueKind != JsonValueKind.Undefined; } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/RawRequestUriBuilderExtensions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/RawRequestUriBuilderExtensions.cs new file mode 100644 index 000000000000..845532ee867f --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/RawRequestUriBuilderExtensions.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.AI.AnomalyDetector +{ + internal static partial class RawRequestUriBuilderExtensions + { + public static void AppendQueryDelimited(this RawRequestUriBuilder builder, string name, IEnumerable value, string delimiter, SerializationFormat format = SerializationFormat.Default, bool escape = true) + { + delimiter ??= ","; + IEnumerable stringValues = value.Select(v => TypeFormatters.ConvertToString(v, format)); + builder.AppendQuery(name, string.Join(delimiter, stringValues), escape); + } + + public static void UpdateQuery(this RawRequestUriBuilder builder, string name, string value) + { + string currentQuery = builder.Query; + string searchPattern = string.Concat(name, "="); + int paramStartIndex = -1; + if (currentQuery.StartsWith(string.Concat("?", searchPattern))) + { + paramStartIndex = 1; + } + if (paramStartIndex == -1) + { + string prefixedPattern = string.Concat("&", searchPattern); + int prefixedIndex = currentQuery.IndexOf(prefixedPattern); + if (prefixedIndex >= 0) + { + paramStartIndex = prefixedIndex + 1; + } + } + if (paramStartIndex >= 0) + { + int valueStartIndex = paramStartIndex + searchPattern.Length; + int valueEndIndex = currentQuery.IndexOf('&', valueStartIndex); + if (valueEndIndex == -1) + { + valueEndIndex = currentQuery.Length; + } + string beforeParam = currentQuery.Substring(0, valueStartIndex); + string afterParam = currentQuery.Substring(valueEndIndex); + string newQuery = string.Concat(beforeParam, value, afterParam); + builder.Query = newQuery; + } + else + { + builder.AppendQuery(name, value, true); + } + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/RequestContextExtensions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/RequestContextExtensions.cs new file mode 100644 index 000000000000..d6647cc1a313 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/RequestContextExtensions.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using Azure; + +namespace Azure.AI.AnomalyDetector +{ + internal static partial class RequestContextExtensions + { + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + public static ValueTuple Parse(this RequestContext context) + { + if (context == null) + { + return (CancellationToken.None, ErrorOptions.Default); + } + return (context.CancellationToken, context.ErrorOptions); + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/SerializationFormat.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/SerializationFormat.cs new file mode 100644 index 000000000000..23082a2d1deb --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/SerializationFormat.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.AnomalyDetector +{ + internal enum SerializationFormat + { + /// The default serialization format. + Default = 0, + /// The RFC1123 date time format. + DateTime_RFC1123 = 1, + /// The RFC3339 date time format. + DateTime_RFC3339 = 2, + /// The RFC7231 date time format. + DateTime_RFC7231 = 3, + /// The ISO8601 date time format. + DateTime_ISO8601 = 4, + /// The Unix date time format. + DateTime_Unix = 5, + /// The ISO8601 date format. + Date_ISO8601 = 6, + /// The ISO8601 duration format. + Duration_ISO8601 = 7, + /// The constant duration format. + Duration_Constant = 8, + /// The seconds duration format. + Duration_Seconds = 9, + /// The seconds duration format with float precision. + Duration_Seconds_Float = 10, + /// The seconds duration format with double precision. + Duration_Seconds_Double = 11, + /// The milliseconds duration format. + Duration_Milliseconds = 12, + /// The milliseconds duration format with float precision. + Duration_Milliseconds_Float = 13, + /// The milliseconds duration format with double precision. + Duration_Milliseconds_Double = 14, + /// The ISO8601 time format. + Time_ISO8601 = 15, + /// The Base64Url bytes format. + Bytes_Base64Url = 16, + /// The Base64 bytes format. + Bytes_Base64 = 17 + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/TypeFormatters.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/TypeFormatters.cs new file mode 100644 index 000000000000..0fb493ec3284 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/TypeFormatters.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Xml; + +namespace Azure.AI.AnomalyDetector +{ + internal static partial class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Generated clients require it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked (value.Length + 2) / 3; + int size = checked (numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ToFormatSpecifier(SerializationFormat format) => format switch + { + SerializationFormat.DateTime_RFC1123 => "R", + SerializationFormat.DateTime_RFC3339 => "O", + SerializationFormat.DateTime_RFC7231 => "R", + SerializationFormat.DateTime_ISO8601 => "O", + SerializationFormat.Date_ISO8601 => "D", + SerializationFormat.DateTime_Unix => "U", + SerializationFormat.Bytes_Base64Url => "U", + SerializationFormat.Bytes_Base64 => "D", + SerializationFormat.Duration_ISO8601 => "P", + SerializationFormat.Duration_Constant => "c", + SerializationFormat.Duration_Seconds => "%s", + SerializationFormat.Duration_Seconds_Float => "s\\.FFF", + SerializationFormat.Duration_Seconds_Double => "s\\.FFFFFF", + SerializationFormat.Time_ISO8601 => "T", + _ => null + }; + + public static string ConvertToString(object value, SerializationFormat format = SerializationFormat.Default) + { + string formatSpecifier = ToFormatSpecifier(format); + + return value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when formatSpecifier != null => ToString(b0, formatSpecifier), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when formatSpecifier != null => ToString(dateTime, formatSpecifier), + TimeSpan timeSpan when format == SerializationFormat.Duration_Seconds => Convert.ToInt32(timeSpan.TotalSeconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan0 when format == SerializationFormat.Duration_Seconds_Float || format == SerializationFormat.Duration_Seconds_Double => timeSpan0.TotalSeconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan1 when format == SerializationFormat.Duration_Milliseconds => Convert.ToInt32(timeSpan1.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan2 when format == SerializationFormat.Duration_Milliseconds_Float || format == SerializationFormat.Duration_Milliseconds_Double => timeSpan2.TotalMilliseconds.ToString(CultureInfo.InvariantCulture), + TimeSpan timeSpan3 when formatSpecifier != null => ToString(timeSpan3, formatSpecifier), + TimeSpan timeSpan4 => XmlConvert.ToString(timeSpan4), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Utf8JsonRequestContent.cs index 003e09a25a10..0124c991639a 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Utf8JsonRequestContent.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -13,7 +13,7 @@ namespace Azure.AI.AnomalyDetector { - internal class Utf8JsonRequestContent : RequestContent + internal partial class Utf8JsonRequestContent : RequestContent { private readonly MemoryStream _stream; private readonly RequestContent _content; @@ -25,20 +25,26 @@ public Utf8JsonRequestContent() JsonWriter = new Utf8JsonWriter(_stream); } + /// Gets the JsonWriter. public Utf8JsonWriter JsonWriter { get; } + /// The stream containing the data to be written. + /// The cancellation token to use. public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) { await JsonWriter.FlushAsync().ConfigureAwait(false); await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); } + /// The stream containing the data to be written. + /// The cancellation token to use. public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) { JsonWriter.Flush(); _content.WriteTo(stream, cancellationToken); } + /// public override bool TryComputeLength(out long length) { length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignMode.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignMode.cs similarity index 63% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignMode.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignMode.cs index bb911d7d52d2..b33a1d4348ff 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignMode.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignMode.cs @@ -10,42 +10,59 @@ namespace Azure.AI.AnomalyDetector { - /// The AlignMode. + /// public readonly partial struct AlignMode : IEquatable { private readonly string _value; + private const string InnerValue = "Inner"; + private const string OuterValue = "Outer"; /// Initializes a new instance of . + /// The value. /// is null. public AlignMode(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string InnerValue = "Inner"; - private const string OuterValue = "Outer"; + _value = value; + } - /// Inner. + /// Gets the Inner. public static AlignMode Inner { get; } = new AlignMode(InnerValue); - /// Outer. + + /// Gets the Outer. public static AlignMode Outer { get; } = new AlignMode(OuterValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(AlignMode left, AlignMode right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(AlignMode left, AlignMode right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator AlignMode(string value) => new AlignMode(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator AlignMode?(string value) => value == null ? null : new AlignMode(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AlignMode other && Equals(other); - /// + + /// public bool Equals(AlignMode 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignPolicy.Serialization.cs similarity index 53% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignPolicy.Serialization.cs index 3f8004651510..efffc3f1c578 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignPolicy.Serialization.cs @@ -9,14 +9,44 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class AlignPolicy : IUtf8JsonSerializable, IJsonModel + /// Manner of aligning multiple variables. + public partial class AlignPolicy : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AlignPolicy PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAlignPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AlignPolicy)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(AlignPolicy)} does not support writing '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +58,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptio /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AlignPolicy)} does not support writing '{format}' format."); } - if (Optional.IsDefined(AlignMode)) { writer.WritePropertyName("alignMode"u8); @@ -49,15 +78,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("paddingValue"u8); writer.WriteNumberValue(PaddingValue.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +95,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AlignPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AlignPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AlignPolicy JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AlignPolicy)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAlignPolicy(document.RootElement, options); } - internal static AlignPolicy DeserializeAlignPolicy(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AlignPolicy DeserializeAlignPolicy(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,91 +123,52 @@ internal static AlignPolicy DeserializeAlignPolicy(JsonElement element, ModelRea AlignMode? alignMode = default; FillNAMethod? fillNAMethod = default; float? paddingValue = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("alignMode"u8)) + if (prop.NameEquals("alignMode"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - alignMode = new AlignMode(property.Value.GetString()); + alignMode = new AlignMode(prop.Value.GetString()); continue; } - if (property.NameEquals("fillNAMethod"u8)) + if (prop.NameEquals("fillNAMethod"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - fillNAMethod = new FillNAMethod(property.Value.GetString()); + fillNAMethod = new FillNAMethod(prop.Value.GetString()); continue; } - if (property.NameEquals("paddingValue"u8)) + if (prop.NameEquals("paddingValue"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - paddingValue = property.Value.GetSingle(); + paddingValue = prop.Value.GetSingle(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AlignPolicy(alignMode, fillNAMethod, paddingValue, serializedAdditionalRawData); + return new AlignPolicy(alignMode, fillNAMethod, paddingValue, additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(AlignPolicy)} does not support writing '{options.Format}' format."); - } - } - - AlignPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAlignPolicy(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AlignPolicy)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + AlignPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AlignPolicy FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAlignPolicy(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignPolicy.cs similarity index 51% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignPolicy.cs index b62fad077c86..8ca992883303 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AlignPolicy.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AlignPolicy.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Manner of aligning multiple variables. public partial class AlignPolicy { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . public AlignPolicy() @@ -57,13 +28,13 @@ public AlignPolicy() /// /// Field that indicates how missing values will be filled. /// Field that's required when fillNAMethod is Fixed. - /// Keeps track of any properties unknown to the library. - internal AlignPolicy(AlignMode? alignMode, FillNAMethod? fillNAMethod, float? paddingValue, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AlignPolicy(AlignMode? alignMode, FillNAMethod? fillNAMethod, float? paddingValue, IDictionary additionalBinaryDataProperties) { AlignMode = alignMode; FillNAMethod = fillNAMethod; PaddingValue = paddingValue; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -71,8 +42,10 @@ internal AlignPolicy(AlignMode? alignMode, FillNAMethod? fillNAMethod, float? pa /// time range. /// public AlignMode? AlignMode { get; set; } + /// Field that indicates how missing values will be filled. public FillNAMethod? FillNAMethod { get; set; } + /// Field that's required when fillNAMethod is Fixed. public float? PaddingValue { get; set; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyDetectionModel.Serialization.cs similarity index 52% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyDetectionModel.Serialization.cs index 7939fc9d31e1..5f84292a8811 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyDetectionModel.Serialization.cs @@ -9,14 +9,57 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyDetectionModel : IUtf8JsonSerializable, IJsonModel + /// Response of getting a model. + public partial class AnomalyDetectionModel : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal AnomalyDetectionModel() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AnomalyDetectionModel PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAnomalyDetectionModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnomalyDetectionModel)} does not support reading '{options.Format}' format."); + } + } + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(AnomalyDetectionModel)} does not support writing '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator AnomalyDetectionModel(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAnomalyDetectionModel(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +71,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyDetectionModel)} does not support writing '{format}' format."); } - writer.WritePropertyName("modelId"u8); writer.WriteStringValue(ModelId); writer.WritePropertyName("createdTime"u8); @@ -45,15 +87,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("modelInfo"u8); writer.WriteObjectValue(ModelInfo, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -62,22 +104,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AnomalyDetectionModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AnomalyDetectionModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AnomalyDetectionModel JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyDetectionModel)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAnomalyDetectionModel(document.RootElement, options); } - internal static AnomalyDetectionModel DeserializeAnomalyDetectionModel(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AnomalyDetectionModel DeserializeAnomalyDetectionModel(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -86,88 +133,49 @@ internal static AnomalyDetectionModel DeserializeAnomalyDetectionModel(JsonEleme DateTimeOffset createdTime = default; DateTimeOffset lastUpdatedTime = default; ModelInfo modelInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("modelId"u8)) + if (prop.NameEquals("modelId"u8)) { - modelId = property.Value.GetGuid(); + modelId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("createdTime"u8)) + if (prop.NameEquals("createdTime"u8)) { - createdTime = property.Value.GetDateTimeOffset("O"); + createdTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("lastUpdatedTime"u8)) + if (prop.NameEquals("lastUpdatedTime"u8)) { - lastUpdatedTime = property.Value.GetDateTimeOffset("O"); + lastUpdatedTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("modelInfo"u8)) + if (prop.NameEquals("modelInfo"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - modelInfo = ModelInfo.DeserializeModelInfo(property.Value, options); + modelInfo = ModelInfo.DeserializeModelInfo(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo, serializedAdditionalRawData); + return new AnomalyDetectionModel(modelId, createdTime, lastUpdatedTime, modelInfo, additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(AnomalyDetectionModel)} does not support writing '{options.Format}' format."); - } - } - - AnomalyDetectionModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyDetectionModel(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AnomalyDetectionModel)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + AnomalyDetectionModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyDetectionModel FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyDetectionModel(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyDetectionModel.cs similarity index 56% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyDetectionModel.cs index ff58b20132a1..e3b84b77b345 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyDetectionModel.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyDetectionModel.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Response of getting a model. public partial class AnomalyDetectionModel { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Model identifier. @@ -64,27 +35,25 @@ internal AnomalyDetectionModel(Guid modelId, DateTimeOffset createdTime, DateTim /// Training result of a model, including its status, errors, and diagnostics /// information. /// - /// Keeps track of any properties unknown to the library. - internal AnomalyDetectionModel(Guid modelId, DateTimeOffset createdTime, DateTimeOffset lastUpdatedTime, ModelInfo modelInfo, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AnomalyDetectionModel(Guid modelId, DateTimeOffset createdTime, DateTimeOffset lastUpdatedTime, ModelInfo modelInfo, IDictionary additionalBinaryDataProperties) { ModelId = modelId; CreatedTime = createdTime; LastUpdatedTime = lastUpdatedTime; ModelInfo = modelInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AnomalyDetectionModel() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Model identifier. public Guid ModelId { get; } + /// Date and time (UTC) when the model was created. public DateTimeOffset CreatedTime { get; } + /// Date and time (UTC) when the model was last updated. public DateTimeOffset LastUpdatedTime { get; } + /// /// Training result of a model, including its status, errors, and diagnostics /// information. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyInterpretation.Serialization.cs similarity index 55% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyInterpretation.Serialization.cs index 6ff1c2f39ac8..9527d8d15b73 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyInterpretation.Serialization.cs @@ -9,14 +9,44 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyInterpretation : IUtf8JsonSerializable, IJsonModel + /// Interpretation of the anomalous time stamp. + public partial class AnomalyInterpretation : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AnomalyInterpretation PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAnomalyInterpretation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnomalyInterpretation)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(AnomalyInterpretation)} does not support writing '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +58,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyInterpretation)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Variable)) { writer.WritePropertyName("variable"u8); @@ -49,15 +78,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("correlationChanges"u8); writer.WriteObjectValue(CorrelationChanges, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,22 +95,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AnomalyInterpretation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AnomalyInterpretation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AnomalyInterpretation JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyInterpretation)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAnomalyInterpretation(document.RootElement, options); } - internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -89,87 +123,48 @@ internal static AnomalyInterpretation DeserializeAnomalyInterpretation(JsonEleme string variable = default; float? contributionScore = default; CorrelationChanges correlationChanges = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("variable"u8)) + if (prop.NameEquals("variable"u8)) { - variable = property.Value.GetString(); + variable = prop.Value.GetString(); continue; } - if (property.NameEquals("contributionScore"u8)) + if (prop.NameEquals("contributionScore"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - contributionScore = property.Value.GetSingle(); + contributionScore = prop.Value.GetSingle(); continue; } - if (property.NameEquals("correlationChanges"u8)) + if (prop.NameEquals("correlationChanges"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - correlationChanges = CorrelationChanges.DeserializeCorrelationChanges(property.Value, options); + correlationChanges = CorrelationChanges.DeserializeCorrelationChanges(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AnomalyInterpretation(variable, contributionScore, correlationChanges, serializedAdditionalRawData); + return new AnomalyInterpretation(variable, contributionScore, correlationChanges, additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(AnomalyInterpretation)} does not support writing '{options.Format}' format."); - } - } - - AnomalyInterpretation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyInterpretation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AnomalyInterpretation)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + AnomalyInterpretation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyInterpretation FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyInterpretation(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyInterpretation.cs similarity index 51% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyInterpretation.cs index f21681eb869d..74cff580c8b4 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyInterpretation.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyInterpretation.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Interpretation of the anomalous time stamp. public partial class AnomalyInterpretation { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal AnomalyInterpretation() @@ -57,22 +28,24 @@ internal AnomalyInterpretation() /// number between 0 and 1. /// /// Correlation changes among the anomalous variables. - /// Keeps track of any properties unknown to the library. - internal AnomalyInterpretation(string variable, float? contributionScore, CorrelationChanges correlationChanges, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AnomalyInterpretation(string variable, float? contributionScore, CorrelationChanges correlationChanges, IDictionary additionalBinaryDataProperties) { Variable = variable; ContributionScore = contributionScore; CorrelationChanges = correlationChanges; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Variable. public string Variable { get; } + /// /// This score shows the percentage that contributes to the anomalous time stamp. It's a /// number between 0 and 1. /// public float? ContributionScore { get; } + /// Correlation changes among the anomalous variables. public CorrelationChanges CorrelationChanges { get; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyState.Serialization.cs similarity index 53% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyState.Serialization.cs index 8f674de8940c..0d7d183231d7 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyState.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyState.Serialization.cs @@ -9,14 +9,49 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyState : IUtf8JsonSerializable, IJsonModel + /// Anomaly status and information. + public partial class AnomalyState : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal AnomalyState() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AnomalyState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAnomalyState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnomalyState)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(AnomalyState)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +63,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyState)} does not support writing '{format}' format."); } - writer.WritePropertyName("timestamp"u8); writer.WriteStringValue(Timestamp, "O"); if (Optional.IsDefined(Value)) @@ -45,21 +79,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("errors"u8); writer.WriteStartArray(); - foreach (var item in Errors) + foreach (ErrorResponse item in Errors) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -68,55 +102,59 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AnomalyState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AnomalyState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AnomalyState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAnomalyState(document.RootElement, options); } - internal static AnomalyState DeserializeAnomalyState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AnomalyState DeserializeAnomalyState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } DateTimeOffset timestamp = default; AnomalyValue value = default; - IReadOnlyList errors = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList errors = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("timestamp"u8)) + if (prop.NameEquals("timestamp"u8)) { - timestamp = property.Value.GetDateTimeOffset("O"); + timestamp = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("value"u8)) + if (prop.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - value = AnomalyValue.DeserializeAnomalyValue(property.Value, options); + value = AnomalyValue.DeserializeAnomalyValue(prop.Value, options); continue; } - if (property.NameEquals("errors"u8)) + if (prop.NameEquals("errors"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item, options)); } @@ -125,58 +163,20 @@ internal static AnomalyState DeserializeAnomalyState(JsonElement element, ModelR } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AnomalyState(timestamp, value, errors ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new AnomalyState(timestamp, value, errors ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(AnomalyState)} does not support writing '{options.Format}' format."); - } - } - - AnomalyState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AnomalyState)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + AnomalyState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyState(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyState.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyState.cs new file mode 100644 index 000000000000..b19ce1308bdd --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyState.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.AnomalyDetector +{ + /// Anomaly status and information. + public partial class AnomalyState + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Time stamp for this anomaly. + internal AnomalyState(DateTimeOffset timestamp) + { + Timestamp = timestamp; + Errors = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Time stamp for this anomaly. + /// Detailed value of this anomalous time stamp. + /// Error message for the current time stamp. + /// Keeps track of any properties unknown to the library. + internal AnomalyState(DateTimeOffset timestamp, AnomalyValue value, IList errors, IDictionary additionalBinaryDataProperties) + { + Timestamp = timestamp; + Value = value; + Errors = errors; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Time stamp for this anomaly. + public DateTimeOffset Timestamp { get; } + + /// Detailed value of this anomalous time stamp. + public AnomalyValue Value { get; } + + /// Error message for the current time stamp. + public IList Errors { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyValue.Serialization.cs similarity index 53% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyValue.Serialization.cs index 69e6158df183..b3b2d03267c6 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyValue.Serialization.cs @@ -9,14 +9,49 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class AnomalyValue : IUtf8JsonSerializable, IJsonModel + /// Detailed information of the anomalous time stamp. + public partial class AnomalyValue : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal AnomalyValue() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual AnomalyValue PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeAnomalyValue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnomalyValue)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(AnomalyValue)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +63,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyValue)} does not support writing '{format}' format."); } - writer.WritePropertyName("isAnomaly"u8); writer.WriteBooleanValue(IsAnomaly); writer.WritePropertyName("severity"u8); @@ -44,21 +78,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("interpretation"u8); writer.WriteStartArray(); - foreach (var item in Interpretation) + foreach (AnomalyInterpretation item in Interpretation) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,22 +101,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AnomalyValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + AnomalyValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual AnomalyValue JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(AnomalyValue)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeAnomalyValue(document.RootElement, options); } - internal static AnomalyValue DeserializeAnomalyValue(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static AnomalyValue DeserializeAnomalyValue(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,34 +129,33 @@ internal static AnomalyValue DeserializeAnomalyValue(JsonElement element, ModelR bool isAnomaly = default; float severity = default; float score = default; - IReadOnlyList interpretation = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList interpretation = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("isAnomaly"u8)) + if (prop.NameEquals("isAnomaly"u8)) { - isAnomaly = property.Value.GetBoolean(); + isAnomaly = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("severity"u8)) + if (prop.NameEquals("severity"u8)) { - severity = property.Value.GetSingle(); + severity = prop.Value.GetSingle(); continue; } - if (property.NameEquals("score"u8)) + if (prop.NameEquals("score"u8)) { - score = property.Value.GetSingle(); + score = prop.Value.GetSingle(); continue; } - if (property.NameEquals("interpretation"u8)) + if (prop.NameEquals("interpretation"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(AnomalyInterpretation.DeserializeAnomalyInterpretation(item, options)); } @@ -126,58 +164,20 @@ internal static AnomalyValue DeserializeAnomalyValue(JsonElement element, ModelR } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new AnomalyValue(isAnomaly, severity, score, interpretation ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new AnomalyValue(isAnomaly, severity, score, interpretation ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(AnomalyValue)} does not support writing '{options.Format}' format."); - } - } - - AnomalyValue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyValue(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AnomalyValue)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + AnomalyValue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnomalyValue FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAnomalyValue(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyValue.cs similarity index 56% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyValue.cs index 636f981364d5..ff3a9a8ad960 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/AnomalyValue.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AnomalyValue.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Detailed information of the anomalous time stamp. public partial class AnomalyValue { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// True if an anomaly is detected at the current time stamp. @@ -68,31 +39,29 @@ internal AnomalyValue(bool isAnomaly, float severity, float score) /// /// Raw anomaly score of severity, to help indicate the degree of abnormality. /// Interpretation of this anomalous time stamp. - /// Keeps track of any properties unknown to the library. - internal AnomalyValue(bool isAnomaly, float severity, float score, IReadOnlyList interpretation, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal AnomalyValue(bool isAnomaly, float severity, float score, IList interpretation, IDictionary additionalBinaryDataProperties) { IsAnomaly = isAnomaly; Severity = severity; Score = score; Interpretation = interpretation; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AnomalyValue() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// True if an anomaly is detected at the current time stamp. public bool IsAnomaly { get; } + /// /// Indicates the significance of the anomaly. The higher the severity, the more /// significant the anomaly is. /// public float Severity { get; } + /// Raw anomaly score of severity, to help indicate the degree of abnormality. public float Score { get; } + /// Interpretation of this anomalous time stamp. - public IReadOnlyList Interpretation { get; } + public IList Interpretation { get; } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AzureAIAnomalyDetectorContext.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AzureAIAnomalyDetectorContext.cs index 8af1a5529b7e..9bb8d7505e1c 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AzureAIAnomalyDetectorContext.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/AzureAIAnomalyDetectorContext.cs @@ -11,7 +11,7 @@ namespace Azure.AI.AnomalyDetector { /// /// Context class which will be filled in by the System.ClientModel.SourceGeneration. - /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// For more information /// [ModelReaderWriterBuildable(typeof(AlignPolicy))] [ModelReaderWriterBuildable(typeof(AnomalyDetectionModel))] @@ -22,6 +22,7 @@ namespace Azure.AI.AnomalyDetector [ModelReaderWriterBuildable(typeof(DiagnosticsInfo))] [ModelReaderWriterBuildable(typeof(ErrorResponse))] [ModelReaderWriterBuildable(typeof(ModelInfo))] + [ModelReaderWriterBuildable(typeof(ModelList))] [ModelReaderWriterBuildable(typeof(ModelState))] [ModelReaderWriterBuildable(typeof(MultivariateBatchDetectionOptions))] [ModelReaderWriterBuildable(typeof(MultivariateBatchDetectionResultSummary))] diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/CorrelationChanges.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/CorrelationChanges.Serialization.cs new file mode 100644 index 000000000000..1cb5ebbc189f --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/CorrelationChanges.Serialization.cs @@ -0,0 +1,166 @@ +// 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; + +namespace Azure.AI.AnomalyDetector +{ + /// Correlation changes among the anomalous variables. + public partial class CorrelationChanges : IJsonModel + { + /// The data to parse. + /// The client options for reading and writing models. + protected virtual CorrelationChanges PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeCorrelationChanges(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CorrelationChanges)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(CorrelationChanges)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CorrelationChanges)} does not support writing '{format}' format."); + } + if (Optional.IsCollectionDefined(ChangedVariables)) + { + writer.WritePropertyName("changedVariables"u8); + writer.WriteStartArray(); + foreach (string item in ChangedVariables) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + CorrelationChanges IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual CorrelationChanges JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CorrelationChanges)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCorrelationChanges(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static CorrelationChanges DeserializeCorrelationChanges(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList changedVariables = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("changedVariables"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } + } + changedVariables = array; + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new CorrelationChanges(changedVariables ?? new ChangeTrackingList(), additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + CorrelationChanges IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/CorrelationChanges.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/CorrelationChanges.cs new file mode 100644 index 000000000000..1ddfbf900727 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/CorrelationChanges.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.AnomalyDetector +{ + /// Correlation changes among the anomalous variables. + public partial class CorrelationChanges + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal CorrelationChanges() + { + ChangedVariables = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Correlated variables that have correlation changes under an anomaly. + /// Keeps track of any properties unknown to the library. + internal CorrelationChanges(IList changedVariables, IDictionary additionalBinaryDataProperties) + { + ChangedVariables = changedVariables; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Correlated variables that have correlation changes under an anomaly. + public IList ChangedVariables { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DataSchema.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DataSchema.cs similarity index 63% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DataSchema.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DataSchema.cs index 7eecf099c17f..2d05c98ccee9 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DataSchema.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DataSchema.cs @@ -14,38 +14,57 @@ namespace Azure.AI.AnomalyDetector public readonly partial struct DataSchema : IEquatable { private readonly string _value; + /// OneTable means that your input data is in one CSV file, which contains one time stamp column and several variable columns. The default DataSchema value is OneTable. + private const string OneTableValue = "OneTable"; + /// MultiTable means that your input data is separated in multiple CSV files. Each file contains one time stamp column and one variable column, and the CSV file name should indicate the name of the variable. The default DataSchema value is OneTable. + private const string MultiTableValue = "MultiTable"; /// Initializes a new instance of . + /// The value. /// is null. public DataSchema(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string OneTableValue = "OneTable"; - private const string MultiTableValue = "MultiTable"; + _value = value; + } /// OneTable means that your input data is in one CSV file, which contains one time stamp column and several variable columns. The default DataSchema value is OneTable. public static DataSchema OneTable { get; } = new DataSchema(OneTableValue); + /// MultiTable means that your input data is separated in multiple CSV files. Each file contains one time stamp column and one variable column, and the CSV file name should indicate the name of the variable. The default DataSchema value is OneTable. public static DataSchema MultiTable { get; } = new DataSchema(MultiTableValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(DataSchema left, DataSchema right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(DataSchema left, DataSchema right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator DataSchema(string value) => new DataSchema(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator DataSchema?(string value) => value == null ? null : new DataSchema(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is DataSchema other && Equals(other); - /// + + /// public bool Equals(DataSchema 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DiagnosticsInfo.Serialization.cs similarity index 53% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DiagnosticsInfo.Serialization.cs index 0e0992521b01..5d9aea2ea2a1 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/DiagnosticsInfo.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DiagnosticsInfo.Serialization.cs @@ -9,14 +9,44 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class DiagnosticsInfo : IUtf8JsonSerializable, IJsonModel + /// Diagnostics information to help inspect the states of a model or variable. + public partial class DiagnosticsInfo : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual DiagnosticsInfo PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeDiagnosticsInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiagnosticsInfo)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(DiagnosticsInfo)} does not support writing '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +58,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(DiagnosticsInfo)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ModelState)) { writer.WritePropertyName("modelState"u8); @@ -43,21 +72,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("variableStates"u8); writer.WriteStartArray(); - foreach (var item in VariableStates) + foreach (VariableState item in VariableStates) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -66,49 +95,53 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DiagnosticsInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + DiagnosticsInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual DiagnosticsInfo JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(DiagnosticsInfo)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeDiagnosticsInfo(document.RootElement, options); } - internal static DiagnosticsInfo DeserializeDiagnosticsInfo(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static DiagnosticsInfo DeserializeDiagnosticsInfo(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } ModelState modelState = default; - IReadOnlyList variableStates = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList variableStates = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("modelState"u8)) + if (prop.NameEquals("modelState"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - modelState = ModelState.DeserializeModelState(property.Value, options); + modelState = ModelState.DeserializeModelState(prop.Value, options); continue; } - if (property.NameEquals("variableStates"u8)) + if (prop.NameEquals("variableStates"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(VariableState.DeserializeVariableState(item, options)); } @@ -117,58 +150,20 @@ internal static DiagnosticsInfo DeserializeDiagnosticsInfo(JsonElement element, } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new DiagnosticsInfo(modelState, variableStates ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DiagnosticsInfo(modelState, variableStates ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(DiagnosticsInfo)} does not support writing '{options.Format}' format."); - } - } - - DiagnosticsInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDiagnosticsInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(DiagnosticsInfo)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + DiagnosticsInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static DiagnosticsInfo FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeDiagnosticsInfo(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DiagnosticsInfo.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DiagnosticsInfo.cs new file mode 100644 index 000000000000..420ded8a966d --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/DiagnosticsInfo.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.AnomalyDetector +{ + /// Diagnostics information to help inspect the states of a model or variable. + public partial class DiagnosticsInfo + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal DiagnosticsInfo() + { + VariableStates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Model status. + /// Variable status. + /// Keeps track of any properties unknown to the library. + internal DiagnosticsInfo(ModelState modelState, IList variableStates, IDictionary additionalBinaryDataProperties) + { + ModelState = modelState; + VariableStates = variableStates; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Model status. + public ModelState ModelState { get; } + + /// Variable status. + public IList VariableStates { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ErrorResponse.Serialization.cs new file mode 100644 index 000000000000..16e04b2cd142 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ErrorResponse.Serialization.cs @@ -0,0 +1,150 @@ +// 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; + +namespace Azure.AI.AnomalyDetector +{ + /// Error information that the API returned. + public partial class ErrorResponse : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ErrorResponse() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ErrorResponse PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeErrorResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorResponse)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{format}' format."); + } + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ErrorResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ErrorResponse JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorResponse)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string code = default; + string message = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("code"u8)) + { + code = prop.Value.GetString(); + continue; + } + if (prop.NameEquals("message"u8)) + { + message = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ErrorResponse(code, message, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + ErrorResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ErrorResponse.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..4b98ff0e0319 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.AnomalyDetector +{ + /// Error information that the API returned. + public partial class ErrorResponse + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Error code. + /// Message that explains the error that the service reported. + internal ErrorResponse(string code, string message) + { + Code = code; + Message = message; + } + + /// Initializes a new instance of . + /// Error code. + /// Message that explains the error that the service reported. + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(string code, string message, IDictionary additionalBinaryDataProperties) + { + Code = code; + Message = message; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Error code. + public string Code { get; } + + /// Message that explains the error that the service reported. + public string Message { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/FillNAMethod.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/FillNAMethod.cs similarity index 67% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/FillNAMethod.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/FillNAMethod.cs index 6d479ff813ea..3e27a93fddfa 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/FillNAMethod.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/FillNAMethod.cs @@ -14,47 +14,67 @@ namespace Azure.AI.AnomalyDetector public readonly partial struct FillNAMethod : IEquatable { private readonly string _value; + private const string PreviousValue = "Previous"; + private const string SubsequentValue = "Subsequent"; + private const string LinearValue = "Linear"; + private const string ZeroValue = "Zero"; + private const string FixedValue = "Fixed"; /// Initializes a new instance of . + /// The value. /// is null. public FillNAMethod(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string PreviousValue = "Previous"; - private const string SubsequentValue = "Subsequent"; - private const string LinearValue = "Linear"; - private const string ZeroValue = "Zero"; - private const string FixedValue = "Fixed"; + _value = value; + } - /// Previous. + /// Gets the Previous. public static FillNAMethod Previous { get; } = new FillNAMethod(PreviousValue); - /// Subsequent. + + /// Gets the Subsequent. public static FillNAMethod Subsequent { get; } = new FillNAMethod(SubsequentValue); - /// Linear. + + /// Gets the Linear. public static FillNAMethod Linear { get; } = new FillNAMethod(LinearValue); - /// Zero. + + /// Gets the Zero. public static FillNAMethod Zero { get; } = new FillNAMethod(ZeroValue); - /// Fixed. + + /// Gets the Fixed. public static FillNAMethod Fixed { get; } = new FillNAMethod(FixedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(FillNAMethod left, FillNAMethod right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(FillNAMethod left, FillNAMethod right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator FillNAMethod(string value) => new FillNAMethod(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator FillNAMethod?(string value) => value == null ? null : new FillNAMethod(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is FillNAMethod other && Equals(other); - /// + + /// public bool Equals(FillNAMethod 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ImputeMode.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ImputeMode.cs similarity index 65% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ImputeMode.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ImputeMode.cs index d1b5311fd7cd..a67c37a8f08f 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ImputeMode.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ImputeMode.cs @@ -10,18 +10,10 @@ namespace Azure.AI.AnomalyDetector { - /// The ImputeMode. + /// public readonly partial struct ImputeMode : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ImputeMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string AutoValue = "auto"; private const string PreviousValue = "previous"; private const string LinearValue = "linear"; @@ -29,35 +21,64 @@ public ImputeMode(string value) private const string ZeroValue = "zero"; private const string NotFillValue = "notFill"; - /// auto. + /// Initializes a new instance of . + /// The value. + /// is null. + public ImputeMode(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Auto. public static ImputeMode Auto { get; } = new ImputeMode(AutoValue); - /// previous. + + /// Gets the Previous. public static ImputeMode Previous { get; } = new ImputeMode(PreviousValue); - /// linear. + + /// Gets the Linear. public static ImputeMode Linear { get; } = new ImputeMode(LinearValue); - /// fixed. + + /// Gets the Fixed. public static ImputeMode Fixed { get; } = new ImputeMode(FixedValue); - /// zero. + + /// Gets the Zero. public static ImputeMode Zero { get; } = new ImputeMode(ZeroValue); - /// notFill. + + /// Gets the NotFill. public static ImputeMode NotFill { get; } = new ImputeMode(NotFillValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ImputeMode left, ImputeMode right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ImputeMode left, ImputeMode right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ImputeMode(string value) => new ImputeMode(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ImputeMode?(string value) => value == null ? null : new ImputeMode(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ImputeMode other && Equals(other); - /// + + /// public bool Equals(ImputeMode 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelInfo.Serialization.cs similarity index 57% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelInfo.Serialization.cs index 239bc58ba0d8..209f9ade97ee 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelInfo.Serialization.cs @@ -13,10 +13,49 @@ namespace Azure.AI.AnomalyDetector { - public partial class ModelInfo : IUtf8JsonSerializable, IJsonModel + /// + /// Training result of a model, including its status, errors, and diagnostics + /// information. + /// + public partial class ModelInfo : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal ModelInfo() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ModelInfo PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeModelInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelInfo)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(ModelInfo)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +67,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ModelInfo)} does not support writing '{format}' format."); } - writer.WritePropertyName("dataSource"u8); writer.WriteStringValue(DataSource.AbsoluteUri); if (Optional.IsDefined(DataSchema)) @@ -69,7 +107,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("errors"u8); writer.WriteStartArray(); - foreach (var item in Errors) + foreach (ErrorResponse item in Errors) { writer.WriteObjectValue(item, options); } @@ -80,15 +118,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("diagnosticsInfo"u8); writer.WriteObjectValue(DiagnosticsInfo, options); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -97,22 +135,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ModelInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ModelInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ModelInfo JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ModelInfo)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeModelInfo(document.RootElement, options); } - internal static ModelInfo DeserializeModelInfo(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ModelInfo DeserializeModelInfo(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -127,95 +170,93 @@ internal static ModelInfo DeserializeModelInfo(JsonElement element, ModelReaderW ModelStatus? status = default; IReadOnlyList errors = default; DiagnosticsInfo diagnosticsInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("dataSource"u8)) + if (prop.NameEquals("dataSource"u8)) { - dataSource = new Uri(property.Value.GetString()); + dataSource = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); continue; } - if (property.NameEquals("dataSchema"u8)) + if (prop.NameEquals("dataSchema"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - dataSchema = new DataSchema(property.Value.GetString()); + dataSchema = new DataSchema(prop.Value.GetString()); continue; } - if (property.NameEquals("startTime"u8)) + if (prop.NameEquals("startTime"u8)) { - startTime = property.Value.GetDateTimeOffset("O"); + startTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("endTime"u8)) + if (prop.NameEquals("endTime"u8)) { - endTime = property.Value.GetDateTimeOffset("O"); + endTime = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("displayName"u8)) + if (prop.NameEquals("displayName"u8)) { - displayName = property.Value.GetString(); + displayName = prop.Value.GetString(); continue; } - if (property.NameEquals("slidingWindow"u8)) + if (prop.NameEquals("slidingWindow"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - slidingWindow = property.Value.GetInt32(); + slidingWindow = prop.Value.GetInt32(); continue; } - if (property.NameEquals("alignPolicy"u8)) + if (prop.NameEquals("alignPolicy"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - alignPolicy = AlignPolicy.DeserializeAlignPolicy(property.Value, options); + alignPolicy = AlignPolicy.DeserializeAlignPolicy(prop.Value, options); continue; } - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - status = new ModelStatus(property.Value.GetString()); + status = new ModelStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("errors"u8)) + if (prop.NameEquals("errors"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item, options)); } errors = array; continue; } - if (property.NameEquals("diagnosticsInfo"u8)) + if (prop.NameEquals("diagnosticsInfo"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - diagnosticsInfo = DiagnosticsInfo.DeserializeDiagnosticsInfo(property.Value, options); + diagnosticsInfo = DiagnosticsInfo.DeserializeDiagnosticsInfo(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new ModelInfo( dataSource, dataSchema, @@ -227,53 +268,28 @@ internal static ModelInfo DeserializeModelInfo(JsonElement element, ModelReaderW status, errors ?? new ChangeTrackingList(), diagnosticsInfo, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(ModelInfo)} does not support writing '{options.Format}' format."); - } - } - - ModelInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeModelInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ModelInfo)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ModelInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ModelInfo FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeModelInfo(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() + /// The to serialize into . + public static implicit operator RequestContent(ModelInfo modelInfo) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + if (modelInfo == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(modelInfo, ModelSerializationExtensions.WireOptions); return content; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelInfo.cs similarity index 75% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelInfo.cs index 982c21965e96..4cb61a2377dd 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelInfo.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelInfo.cs @@ -16,37 +16,8 @@ namespace Azure.AI.AnomalyDetector /// public partial class ModelInfo { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// @@ -103,8 +74,8 @@ public ModelInfo(Uri dataSource, DateTimeOffset startTime, DateTimeOffset endTim /// Model status. /// Error messages after failure to create a model. /// Diagnostics information to help inspect the states of a model or variable. - /// Keeps track of any properties unknown to the library. - internal ModelInfo(Uri dataSource, DataSchema? dataSchema, DateTimeOffset startTime, DateTimeOffset endTime, string displayName, int? slidingWindow, AlignPolicy alignPolicy, ModelStatus? status, IReadOnlyList errors, DiagnosticsInfo diagnosticsInfo, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ModelInfo(Uri dataSource, DataSchema? dataSchema, DateTimeOffset startTime, DateTimeOffset endTime, string displayName, int? slidingWindow, AlignPolicy alignPolicy, ModelStatus? status, IReadOnlyList errors, DiagnosticsInfo diagnosticsInfo, IDictionary additionalBinaryDataProperties) { DataSource = dataSource; DataSchema = dataSchema; @@ -116,12 +87,7 @@ internal ModelInfo(Uri dataSource, DataSchema? dataSchema, DateTimeOffset startT Status = status; Errors = errors; DiagnosticsInfo = diagnosticsInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ModelInfo() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -130,37 +96,46 @@ internal ModelInfo() /// Azure Blob Storage, based on your data schema selection. /// public Uri DataSource { get; set; } + /// /// Data schema of the input data source. The default /// is OneTable. /// public DataSchema? DataSchema { get; set; } + /// /// Start date/time of training data, which should be /// in ISO 8601 format. /// public DateTimeOffset StartTime { get; set; } + /// /// End date/time of training data, which should be /// in ISO 8601 format. /// public DateTimeOffset EndTime { get; set; } + /// /// Display name of the model. Maximum length is 24 /// characters. /// public string DisplayName { get; set; } + /// /// Number of previous time stamps that will be used to /// detect whether the time stamp is an anomaly or not. /// public int? SlidingWindow { get; set; } + /// Manner of aligning multiple variables. public AlignPolicy AlignPolicy { get; set; } + /// Model status. public ModelStatus? Status { get; } + /// Error messages after failure to create a model. public IReadOnlyList Errors { get; } + /// Diagnostics information to help inspect the states of a model or variable. public DiagnosticsInfo DiagnosticsInfo { get; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelList.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelList.Serialization.cs new file mode 100644 index 000000000000..f5a0e0d442bf --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelList.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; + +namespace Azure.AI.AnomalyDetector +{ + /// Response of listing models. + internal partial class ModelList : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal ModelList() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ModelList PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeModelList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelList)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(ModelList)} does not support writing '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator ModelList(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeModelList(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelList)} does not support writing '{format}' format."); + } + writer.WritePropertyName("models"u8); + writer.WriteStartArray(); + foreach (AnomalyDetectionModel item in Models) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("currentCount"u8); + writer.WriteNumberValue(CurrentCount); + writer.WritePropertyName("maxCount"u8); + writer.WriteNumberValue(MaxCount); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + ModelList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ModelList JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelList)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeModelList(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ModelList DeserializeModelList(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList models = default; + int currentCount = default; + int maxCount = default; + string nextLink = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("models"u8)) + { + List array = new List(); + foreach (var item in prop.Value.EnumerateArray()) + { + array.Add(AnomalyDetectionModel.DeserializeAnomalyDetectionModel(item, options)); + } + models = array; + continue; + } + if (prop.NameEquals("currentCount"u8)) + { + currentCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("maxCount"u8)) + { + maxCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("nextLink"u8)) + { + nextLink = prop.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new ModelList(models, currentCount, maxCount, nextLink, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + ModelList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelList.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelList.cs new file mode 100644 index 000000000000..2fc24cf859f5 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelList.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.AnomalyDetector +{ + /// Response of listing models. + internal partial class ModelList + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// List of models. + /// Number of trained multivariate models. + /// Maximum number of models that can be trained for this Anomaly Detector resource. + internal ModelList(IEnumerable models, int currentCount, int maxCount) + { + Models = models.ToList(); + CurrentCount = currentCount; + MaxCount = maxCount; + } + + /// Initializes a new instance of . + /// List of models. + /// Number of trained multivariate models. + /// Maximum number of models that can be trained for this Anomaly Detector resource. + /// Link to fetch more models. + /// Keeps track of any properties unknown to the library. + internal ModelList(IList models, int currentCount, int maxCount, string nextLink, IDictionary additionalBinaryDataProperties) + { + Models = models; + CurrentCount = currentCount; + MaxCount = maxCount; + NextLink = nextLink; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// List of models. + public IList Models { get; } + + /// Number of trained multivariate models. + public int CurrentCount { get; } + + /// Maximum number of models that can be trained for this Anomaly Detector resource. + public int MaxCount { get; } + + /// Link to fetch more models. + public string NextLink { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelState.Serialization.cs similarity index 57% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelState.Serialization.cs index c7edd3235af4..f51f62c2fd39 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelState.Serialization.cs @@ -9,14 +9,44 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class ModelState : IUtf8JsonSerializable, IJsonModel + /// Model status. + public partial class ModelState : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual ModelState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeModelState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelState)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(ModelState)} does not support writing '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,17 +58,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ModelState)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(EpochIds)) { writer.WritePropertyName("epochIds"u8); writer.WriteStartArray(); - foreach (var item in EpochIds) + foreach (int item in EpochIds) { writer.WriteNumberValue(item); } @@ -48,7 +77,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("trainLosses"u8); writer.WriteStartArray(); - foreach (var item in TrainLosses) + foreach (float item in TrainLosses) { writer.WriteNumberValue(item); } @@ -58,7 +87,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("validationLosses"u8); writer.WriteStartArray(); - foreach (var item in ValidationLosses) + foreach (float item in ValidationLosses) { writer.WriteNumberValue(item); } @@ -68,21 +97,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("latenciesInSeconds"u8); writer.WriteStartArray(); - foreach (var item in LatenciesInSeconds) + foreach (float item in LatenciesInSeconds) { writer.WriteNumberValue(item); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -91,84 +120,88 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ModelState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + ModelState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual ModelState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(ModelState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeModelState(document.RootElement, options); } - internal static ModelState DeserializeModelState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static ModelState DeserializeModelState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList epochIds = default; - IReadOnlyList trainLosses = default; - IReadOnlyList validationLosses = default; - IReadOnlyList latenciesInSeconds = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList epochIds = default; + IList trainLosses = default; + IList validationLosses = default; + IList latenciesInSeconds = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("epochIds"u8)) + if (prop.NameEquals("epochIds"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetInt32()); } epochIds = array; continue; } - if (property.NameEquals("trainLosses"u8)) + if (prop.NameEquals("trainLosses"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetSingle()); } trainLosses = array; continue; } - if (property.NameEquals("validationLosses"u8)) + if (prop.NameEquals("validationLosses"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetSingle()); } validationLosses = array; continue; } - if (property.NameEquals("latenciesInSeconds"u8)) + if (prop.NameEquals("latenciesInSeconds"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetSingle()); } @@ -177,58 +210,20 @@ internal static ModelState DeserializeModelState(JsonElement element, ModelReade } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new ModelState(epochIds ?? new ChangeTrackingList(), trainLosses ?? new ChangeTrackingList(), validationLosses ?? new ChangeTrackingList(), latenciesInSeconds ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ModelState(epochIds ?? new ChangeTrackingList(), trainLosses ?? new ChangeTrackingList(), validationLosses ?? new ChangeTrackingList(), latenciesInSeconds ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(ModelState)} does not support writing '{options.Format}' format."); - } - } - - ModelState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeModelState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ModelState)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + ModelState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ModelState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeModelState(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelState.cs similarity index 50% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelState.cs index 19e0b1ff3fd5..deb1002b5d34 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelState.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelState.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Model status. public partial class ModelState { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal ModelState() @@ -68,32 +39,35 @@ internal ModelState() /// epoch. /// /// Latency for each epoch. - /// Keeps track of any properties unknown to the library. - internal ModelState(IReadOnlyList epochIds, IReadOnlyList trainLosses, IReadOnlyList validationLosses, IReadOnlyList latenciesInSeconds, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal ModelState(IList epochIds, IList trainLosses, IList validationLosses, IList latenciesInSeconds, IDictionary additionalBinaryDataProperties) { EpochIds = epochIds; TrainLosses = trainLosses; ValidationLosses = validationLosses; LatenciesInSeconds = latenciesInSeconds; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// /// Number of passes of the entire training dataset that the /// algorithm has completed. /// - public IReadOnlyList EpochIds { get; } + public IList EpochIds { get; } + /// /// List of metrics used to assess how the model fits the training data for each /// epoch. /// - public IReadOnlyList TrainLosses { get; } + public IList TrainLosses { get; } + /// /// List of metrics used to assess how the model fits the validation set for each /// epoch. /// - public IReadOnlyList ValidationLosses { get; } + public IList ValidationLosses { get; } + /// Latency for each epoch. - public IReadOnlyList LatenciesInSeconds { get; } + public IList LatenciesInSeconds { get; } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelStatus.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelStatus.cs similarity index 66% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelStatus.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelStatus.cs index 0197b72e7234..b5e2b8ebbfc4 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/ModelStatus.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/ModelStatus.cs @@ -10,48 +10,71 @@ namespace Azure.AI.AnomalyDetector { - /// The ModelStatus. + /// public readonly partial struct ModelStatus : IEquatable { private readonly string _value; + /// The model has been created. Training has been scheduled but not yet started. + private const string CreatedValue = "CREATED"; + /// The model is being trained. + private const string RunningValue = "RUNNING"; + /// The model has been trained and is ready to be used for anomaly detection. + private const string ReadyValue = "READY"; + /// The model training failed. + private const string FailedValue = "FAILED"; /// Initializes a new instance of . + /// The value. /// is null. public ModelStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string CreatedValue = "CREATED"; - private const string RunningValue = "RUNNING"; - private const string ReadyValue = "READY"; - private const string FailedValue = "FAILED"; + _value = value; + } /// The model has been created. Training has been scheduled but not yet started. public static ModelStatus Created { get; } = new ModelStatus(CreatedValue); + /// The model is being trained. public static ModelStatus Running { get; } = new ModelStatus(RunningValue); + /// The model has been trained and is ready to be used for anomaly detection. public static ModelStatus Ready { get; } = new ModelStatus(ReadyValue); + /// The model training failed. public static ModelStatus Failed { get; } = new ModelStatus(FailedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(ModelStatus left, ModelStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(ModelStatus left, ModelStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator ModelStatus(string value) => new ModelStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator ModelStatus?(string value) => value == null ? null : new ModelStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is ModelStatus other && Equals(other); - /// + + /// public bool Equals(ModelStatus 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionOptions.Serialization.cs new file mode 100644 index 000000000000..99886c3f4fb8 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionOptions.Serialization.cs @@ -0,0 +1,189 @@ +// 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.Core; + +namespace Azure.AI.AnomalyDetector +{ + /// + /// Detection request for batch inference. This is an asynchronous inference that + /// will need another API to get detection results. + /// + public partial class MultivariateBatchDetectionOptions : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal MultivariateBatchDetectionOptions() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MultivariateBatchDetectionOptions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeMultivariateBatchDetectionOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultivariateBatchDetectionOptions)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(MultivariateBatchDetectionOptions)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultivariateBatchDetectionOptions)} does not support writing '{format}' format."); + } + writer.WritePropertyName("dataSource"u8); + writer.WriteStringValue(DataSource.AbsoluteUri); + if (Optional.IsDefined(TopContributorCount)) + { + writer.WritePropertyName("topContributorCount"u8); + writer.WriteNumberValue(TopContributorCount.Value); + } + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartTime, "O"); + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndTime, "O"); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + MultivariateBatchDetectionOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MultivariateBatchDetectionOptions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultivariateBatchDetectionOptions)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMultivariateBatchDetectionOptions(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MultivariateBatchDetectionOptions DeserializeMultivariateBatchDetectionOptions(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri dataSource = default; + int? topContributorCount = default; + DateTimeOffset startTime = default; + DateTimeOffset endTime = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("dataSource"u8)) + { + dataSource = string.IsNullOrEmpty(prop.Value.GetString()) ? null : new Uri(prop.Value.GetString()); + continue; + } + if (prop.NameEquals("topContributorCount"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topContributorCount = prop.Value.GetInt32(); + continue; + } + if (prop.NameEquals("startTime"u8)) + { + startTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("endTime"u8)) + { + endTime = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new MultivariateBatchDetectionOptions(dataSource, topContributorCount, startTime, endTime, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + MultivariateBatchDetectionOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// The to serialize into . + public static implicit operator RequestContent(MultivariateBatchDetectionOptions multivariateBatchDetectionOptions) + { + if (multivariateBatchDetectionOptions == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(multivariateBatchDetectionOptions, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionOptions.cs similarity index 70% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionOptions.cs index cc55c048ef01..1a1d34b72662 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionOptions.cs @@ -16,37 +16,8 @@ namespace Azure.AI.AnomalyDetector /// public partial class MultivariateBatchDetectionOptions { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// @@ -93,19 +64,14 @@ public MultivariateBatchDetectionOptions(Uri dataSource, DateTimeOffset startTim /// End date/time of data for detection, which should /// be in ISO 8601 format. /// - /// Keeps track of any properties unknown to the library. - internal MultivariateBatchDetectionOptions(Uri dataSource, int? topContributorCount, DateTimeOffset startTime, DateTimeOffset endTime, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MultivariateBatchDetectionOptions(Uri dataSource, int? topContributorCount, DateTimeOffset startTime, DateTimeOffset endTime, IDictionary additionalBinaryDataProperties) { DataSource = dataSource; TopContributorCount = topContributorCount; StartTime = startTime; EndTime = endTime; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MultivariateBatchDetectionOptions() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -117,13 +83,16 @@ internal MultivariateBatchDetectionOptions() /// to be detected. /// public Uri DataSource { get; set; } + /// Number of top contributed variables for one anomalous time stamp in the response. public int? TopContributorCount { get; set; } + /// /// Start date/time of data for detection, which should /// be in ISO 8601 format. /// public DateTimeOffset StartTime { get; set; } + /// /// End date/time of data for detection, which should /// be in ISO 8601 format. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionResultSummary.Serialization.cs similarity index 56% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionResultSummary.Serialization.cs index f861b1fae5e0..e921a064d2a7 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionResultSummary.Serialization.cs @@ -9,14 +9,49 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateBatchDetectionResultSummary : IUtf8JsonSerializable, IJsonModel + /// Multivariate anomaly detection status. + public partial class MultivariateBatchDetectionResultSummary : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MultivariateBatchDetectionResultSummary() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MultivariateBatchDetectionResultSummary PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeMultivariateBatchDetectionResultSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultivariateBatchDetectionResultSummary)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(MultivariateBatchDetectionResultSummary)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,19 +63,18 @@ void IJsonModel.Write(Utf8JsonWriter wr /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateBatchDetectionResultSummary)} does not support writing '{format}' format."); } - writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); if (Optional.IsCollectionDefined(Errors)) { writer.WritePropertyName("errors"u8); writer.WriteStartArray(); - foreach (var item in Errors) + foreach (ErrorResponse item in Errors) { writer.WriteObjectValue(item, options); } @@ -50,7 +84,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("variableStates"u8); writer.WriteStartArray(); - foreach (var item in VariableStates) + foreach (VariableState item in VariableStates) { writer.WriteObjectValue(item, options); } @@ -58,15 +92,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("setupInfo"u8); writer.WriteObjectValue(SetupInfo, options); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -75,126 +109,92 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MultivariateBatchDetectionResultSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MultivariateBatchDetectionResultSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MultivariateBatchDetectionResultSummary JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateBatchDetectionResultSummary)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMultivariateBatchDetectionResultSummary(document.RootElement, options); } - internal static MultivariateBatchDetectionResultSummary DeserializeMultivariateBatchDetectionResultSummary(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MultivariateBatchDetectionResultSummary DeserializeMultivariateBatchDetectionResultSummary(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } MultivariateBatchDetectionStatus status = default; - IReadOnlyList errors = default; - IReadOnlyList variableStates = default; + IList errors = default; + IList variableStates = default; MultivariateBatchDetectionOptions setupInfo = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("status"u8)) + if (prop.NameEquals("status"u8)) { - status = new MultivariateBatchDetectionStatus(property.Value.GetString()); + status = new MultivariateBatchDetectionStatus(prop.Value.GetString()); continue; } - if (property.NameEquals("errors"u8)) + if (prop.NameEquals("errors"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(ErrorResponse.DeserializeErrorResponse(item, options)); } errors = array; continue; } - if (property.NameEquals("variableStates"u8)) + if (prop.NameEquals("variableStates"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(VariableState.DeserializeVariableState(item, options)); } variableStates = array; continue; } - if (property.NameEquals("setupInfo"u8)) + if (prop.NameEquals("setupInfo"u8)) { - setupInfo = MultivariateBatchDetectionOptions.DeserializeMultivariateBatchDetectionOptions(property.Value, options); + setupInfo = MultivariateBatchDetectionOptions.DeserializeMultivariateBatchDetectionOptions(prop.Value, options); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new MultivariateBatchDetectionResultSummary(status, errors ?? new ChangeTrackingList(), variableStates ?? new ChangeTrackingList(), setupInfo, serializedAdditionalRawData); + return new MultivariateBatchDetectionResultSummary(status, errors ?? new ChangeTrackingList(), variableStates ?? new ChangeTrackingList(), setupInfo, additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(MultivariateBatchDetectionResultSummary)} does not support writing '{options.Format}' format."); - } - } - - MultivariateBatchDetectionResultSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateBatchDetectionResultSummary(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MultivariateBatchDetectionResultSummary)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + MultivariateBatchDetectionResultSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateBatchDetectionResultSummary FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateBatchDetectionResultSummary(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionResultSummary.cs similarity index 51% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionResultSummary.cs index c13ed1c6424f..902468255767 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionResultSummary.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionResultSummary.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Multivariate anomaly detection status. public partial class MultivariateBatchDetectionResultSummary { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Status of detection results. @@ -51,11 +22,8 @@ public partial class MultivariateBatchDetectionResultSummary /// Detection request for batch inference. This is an asynchronous inference that /// will need another API to get detection results. /// - /// is null. internal MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatus status, MultivariateBatchDetectionOptions setupInfo) { - Argument.AssertNotNull(setupInfo, nameof(setupInfo)); - Status = status; Errors = new ChangeTrackingList(); VariableStates = new ChangeTrackingList(); @@ -70,27 +38,25 @@ internal MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatu /// Detection request for batch inference. This is an asynchronous inference that /// will need another API to get detection results. /// - /// Keeps track of any properties unknown to the library. - internal MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatus status, IReadOnlyList errors, IReadOnlyList variableStates, MultivariateBatchDetectionOptions setupInfo, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MultivariateBatchDetectionResultSummary(MultivariateBatchDetectionStatus status, IList errors, IList variableStates, MultivariateBatchDetectionOptions setupInfo, IDictionary additionalBinaryDataProperties) { Status = status; Errors = errors; VariableStates = variableStates; SetupInfo = setupInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MultivariateBatchDetectionResultSummary() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Status of detection results. public MultivariateBatchDetectionStatus Status { get; } + /// Error message when detection fails. - public IReadOnlyList Errors { get; } + public IList Errors { get; } + /// Variable status. - public IReadOnlyList VariableStates { get; } + public IList VariableStates { get; } + /// /// Detection request for batch inference. This is an asynchronous inference that /// will need another API to get detection results. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionStatus.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionStatus.cs similarity index 68% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionStatus.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionStatus.cs index 20572a14c8ce..80d1be231507 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionStatus.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateBatchDetectionStatus.cs @@ -10,48 +10,67 @@ namespace Azure.AI.AnomalyDetector { - /// The MultivariateBatchDetectionStatus. + /// public readonly partial struct MultivariateBatchDetectionStatus : IEquatable { private readonly string _value; + private const string CreatedValue = "CREATED"; + private const string RunningValue = "RUNNING"; + private const string ReadyValue = "READY"; + private const string FailedValue = "FAILED"; /// Initializes a new instance of . + /// The value. /// is null. public MultivariateBatchDetectionStatus(string value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } + Argument.AssertNotNull(value, nameof(value)); - private const string CreatedValue = "CREATED"; - private const string RunningValue = "RUNNING"; - private const string ReadyValue = "READY"; - private const string FailedValue = "FAILED"; + _value = value; + } - /// CREATED. + /// Gets the Created. public static MultivariateBatchDetectionStatus Created { get; } = new MultivariateBatchDetectionStatus(CreatedValue); - /// RUNNING. + + /// Gets the Running. public static MultivariateBatchDetectionStatus Running { get; } = new MultivariateBatchDetectionStatus(RunningValue); - /// READY. + + /// Gets the Ready. public static MultivariateBatchDetectionStatus Ready { get; } = new MultivariateBatchDetectionStatus(ReadyValue); - /// FAILED. + + /// Gets the Failed. public static MultivariateBatchDetectionStatus Failed { get; } = new MultivariateBatchDetectionStatus(FailedValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(MultivariateBatchDetectionStatus left, MultivariateBatchDetectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(MultivariateBatchDetectionStatus left, MultivariateBatchDetectionStatus right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator MultivariateBatchDetectionStatus(string value) => new MultivariateBatchDetectionStatus(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator MultivariateBatchDetectionStatus?(string value) => value == null ? null : new MultivariateBatchDetectionStatus(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is MultivariateBatchDetectionStatus other && Equals(other); - /// + + /// public bool Equals(MultivariateBatchDetectionStatus 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateDetectionResult.Serialization.cs similarity index 51% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateDetectionResult.Serialization.cs index 2b084b2cf09e..0fc020c42c60 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateDetectionResult.Serialization.cs @@ -9,14 +9,57 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateDetectionResult : IUtf8JsonSerializable, IJsonModel + /// Detection results for the resultId value. + public partial class MultivariateDetectionResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MultivariateDetectionResult() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MultivariateDetectionResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeMultivariateDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultivariateDetectionResult)} does not support reading '{options.Format}' format."); + } + } + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(MultivariateDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator MultivariateDetectionResult(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMultivariateDetectionResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,32 +71,31 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateDetectionResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("resultId"u8); writer.WriteStringValue(ResultId); writer.WritePropertyName("summary"u8); writer.WriteObjectValue(Summary, options); writer.WritePropertyName("results"u8); writer.WriteStartArray(); - foreach (var item in Results) + foreach (AnomalyState item in Results) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -62,47 +104,51 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MultivariateDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MultivariateDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MultivariateDetectionResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateDetectionResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMultivariateDetectionResult(document.RootElement, options); } - internal static MultivariateDetectionResult DeserializeMultivariateDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MultivariateDetectionResult DeserializeMultivariateDetectionResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } Guid resultId = default; MultivariateBatchDetectionResultSummary summary = default; - IReadOnlyList results = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList results = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("resultId"u8)) + if (prop.NameEquals("resultId"u8)) { - resultId = property.Value.GetGuid(); + resultId = new Guid(prop.Value.GetString()); continue; } - if (property.NameEquals("summary"u8)) + if (prop.NameEquals("summary"u8)) { - summary = MultivariateBatchDetectionResultSummary.DeserializeMultivariateBatchDetectionResultSummary(property.Value, options); + summary = MultivariateBatchDetectionResultSummary.DeserializeMultivariateBatchDetectionResultSummary(prop.Value, options); continue; } - if (property.NameEquals("results"u8)) + if (prop.NameEquals("results"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(AnomalyState.DeserializeAnomalyState(item, options)); } @@ -111,58 +157,20 @@ internal static MultivariateDetectionResult DeserializeMultivariateDetectionResu } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new MultivariateDetectionResult(resultId, summary, results, serializedAdditionalRawData); + return new MultivariateDetectionResult(resultId, summary, results, additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(MultivariateDetectionResult)} does not support writing '{options.Format}' format."); - } - } - - MultivariateDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateDetectionResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MultivariateDetectionResult)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + MultivariateDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateDetectionResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateDetectionResult(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateDetectionResult.cs new file mode 100644 index 000000000000..02e5eecd9664 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateDetectionResult.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.AnomalyDetector +{ + /// Detection results for the resultId value. + public partial class MultivariateDetectionResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Result identifier that's used to fetch the results of an inference call. + /// Multivariate anomaly detection status. + /// Detection result for each time stamp. + internal MultivariateDetectionResult(Guid resultId, MultivariateBatchDetectionResultSummary summary, IEnumerable results) + { + ResultId = resultId; + Summary = summary; + Results = results.ToList(); + } + + /// Initializes a new instance of . + /// Result identifier that's used to fetch the results of an inference call. + /// Multivariate anomaly detection status. + /// Detection result for each time stamp. + /// Keeps track of any properties unknown to the library. + internal MultivariateDetectionResult(Guid resultId, MultivariateBatchDetectionResultSummary summary, IList results, IDictionary additionalBinaryDataProperties) + { + ResultId = resultId; + Summary = summary; + Results = results; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Result identifier that's used to fetch the results of an inference call. + public Guid ResultId { get; } + + /// Multivariate anomaly detection status. + public MultivariateBatchDetectionResultSummary Summary { get; } + + /// Detection result for each time stamp. + public IList Results { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionOptions.Serialization.cs similarity index 50% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionOptions.Serialization.cs index 2b81dfd6c974..7e3b10181f13 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionOptions.Serialization.cs @@ -13,10 +13,46 @@ namespace Azure.AI.AnomalyDetector { - public partial class MultivariateLastDetectionOptions : IUtf8JsonSerializable, IJsonModel + /// Request of the last detection. + public partial class MultivariateLastDetectionOptions : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal MultivariateLastDetectionOptions() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MultivariateLastDetectionOptions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeMultivariateLastDetectionOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultivariateLastDetectionOptions)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(MultivariateLastDetectionOptions)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +64,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, M /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateLastDetectionOptions)} does not support writing '{format}' format."); } - writer.WritePropertyName("variables"u8); writer.WriteStartArray(); - foreach (var item in Variables) + foreach (VariableValues item in Variables) { writer.WriteObjectValue(item, options); } @@ -46,15 +81,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("topContributorCount"u8); writer.WriteNumberValue(TopContributorCount.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -63,104 +98,82 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MultivariateLastDetectionOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MultivariateLastDetectionOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MultivariateLastDetectionOptions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateLastDetectionOptions)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMultivariateLastDetectionOptions(document.RootElement, options); } - internal static MultivariateLastDetectionOptions DeserializeMultivariateLastDetectionOptions(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MultivariateLastDetectionOptions DeserializeMultivariateLastDetectionOptions(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } IList variables = default; int? topContributorCount = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("variables"u8)) + if (prop.NameEquals("variables"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(VariableValues.DeserializeVariableValues(item, options)); } variables = array; continue; } - if (property.NameEquals("topContributorCount"u8)) + if (prop.NameEquals("topContributorCount"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - topContributorCount = property.Value.GetInt32(); + topContributorCount = prop.Value.GetInt32(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new MultivariateLastDetectionOptions(variables, topContributorCount, serializedAdditionalRawData); + return new MultivariateLastDetectionOptions(variables, topContributorCount, additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(MultivariateLastDetectionOptions)} does not support writing '{options.Format}' format."); - } - } - - MultivariateLastDetectionOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateLastDetectionOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MultivariateLastDetectionOptions)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + MultivariateLastDetectionOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateLastDetectionOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateLastDetectionOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() + /// The to serialize into . + public static implicit operator RequestContent(MultivariateLastDetectionOptions multivariateLastDetectionOptions) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + if (multivariateLastDetectionOptions == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(multivariateLastDetectionOptions, ModelSerializationExtensions.WireOptions); return content; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionOptions.cs similarity index 54% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionOptions.cs index 4ec8ef1f7b8f..0f9223488c3e 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionOptions.cs @@ -14,37 +14,8 @@ namespace Azure.AI.AnomalyDetector /// Request of the last detection. public partial class MultivariateLastDetectionOptions { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// @@ -69,17 +40,12 @@ public MultivariateLastDetectionOptions(IEnumerable variables) /// variables for one anomalous time stamp in the response. The default is /// 10. /// - /// Keeps track of any properties unknown to the library. - internal MultivariateLastDetectionOptions(IList variables, int? topContributorCount, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal MultivariateLastDetectionOptions(IList variables, int? topContributorCount, IDictionary additionalBinaryDataProperties) { Variables = variables; TopContributorCount = topContributorCount; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MultivariateLastDetectionOptions() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -87,6 +53,7 @@ internal MultivariateLastDetectionOptions() /// values of variables. /// public IList Variables { get; } + /// /// Number of top contributed /// variables for one anomalous time stamp in the response. The default is diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionResult.Serialization.cs similarity index 53% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionResult.Serialization.cs index 22982f03ff89..ecd897098558 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionResult.Serialization.cs @@ -9,14 +9,52 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.AnomalyDetector { - public partial class MultivariateLastDetectionResult : IUtf8JsonSerializable, IJsonModel + /// Results of the last detection. + public partial class MultivariateLastDetectionResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual MultivariateLastDetectionResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeMultivariateLastDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultivariateLastDetectionResult)} does not support reading '{options.Format}' format."); + } + } + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(MultivariateLastDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator MultivariateLastDetectionResult(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMultivariateLastDetectionResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,17 +66,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateLastDetectionResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(VariableStates)) { writer.WritePropertyName("variableStates"u8); writer.WriteStartArray(); - foreach (var item in VariableStates) + foreach (VariableState item in VariableStates) { writer.WriteObjectValue(item, options); } @@ -48,21 +85,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("results"u8); writer.WriteStartArray(); - foreach (var item in Results) + foreach (AnomalyState item in Results) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -71,54 +108,58 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MultivariateLastDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + MultivariateLastDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual MultivariateLastDetectionResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(MultivariateLastDetectionResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeMultivariateLastDetectionResult(document.RootElement, options); } - internal static MultivariateLastDetectionResult DeserializeMultivariateLastDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static MultivariateLastDetectionResult DeserializeMultivariateLastDetectionResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } - IReadOnlyList variableStates = default; - IReadOnlyList results = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList variableStates = default; + IList results = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("variableStates"u8)) + if (prop.NameEquals("variableStates"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(VariableState.DeserializeVariableState(item, options)); } variableStates = array; continue; } - if (property.NameEquals("results"u8)) + if (prop.NameEquals("results"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(AnomalyState.DeserializeAnomalyState(item, options)); } @@ -127,58 +168,20 @@ internal static MultivariateLastDetectionResult DeserializeMultivariateLastDetec } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new MultivariateLastDetectionResult(variableStates ?? new ChangeTrackingList(), results ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new MultivariateLastDetectionResult(variableStates ?? new ChangeTrackingList(), results ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(MultivariateLastDetectionResult)} does not support writing '{options.Format}' format."); - } - } - - MultivariateLastDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateLastDetectionResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MultivariateLastDetectionResult)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + MultivariateLastDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static MultivariateLastDetectionResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateLastDetectionResult(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionResult.cs new file mode 100644 index 000000000000..5669e23fbfa4 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/MultivariateLastDetectionResult.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.AnomalyDetector +{ + /// Results of the last detection. + public partial class MultivariateLastDetectionResult + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + internal MultivariateLastDetectionResult() + { + VariableStates = new ChangeTrackingList(); + Results = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Variable status. + /// Anomaly status and information. + /// Keeps track of any properties unknown to the library. + internal MultivariateLastDetectionResult(IList variableStates, IList results, IDictionary additionalBinaryDataProperties) + { + VariableStates = variableStates; + Results = results; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Variable status. + public IList VariableStates { get; } + + /// Anomaly status and information. + public IList Results { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeGranularity.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeGranularity.cs similarity index 67% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeGranularity.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeGranularity.cs index ced87ab97606..c97357ce869b 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeGranularity.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeGranularity.cs @@ -10,18 +10,10 @@ namespace Azure.AI.AnomalyDetector { - /// The TimeGranularity. + /// public readonly partial struct TimeGranularity : IEquatable { private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public TimeGranularity(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - private const string YearlyValue = "yearly"; private const string MonthlyValue = "monthly"; private const string WeeklyValue = "weekly"; @@ -32,41 +24,73 @@ public TimeGranularity(string value) private const string MicrosecondValue = "microsecond"; private const string NoneValue = "none"; - /// yearly. + /// Initializes a new instance of . + /// The value. + /// is null. + public TimeGranularity(string value) + { + Argument.AssertNotNull(value, nameof(value)); + + _value = value; + } + + /// Gets the Yearly. public static TimeGranularity Yearly { get; } = new TimeGranularity(YearlyValue); - /// monthly. + + /// Gets the Monthly. public static TimeGranularity Monthly { get; } = new TimeGranularity(MonthlyValue); - /// weekly. + + /// Gets the Weekly. public static TimeGranularity Weekly { get; } = new TimeGranularity(WeeklyValue); - /// daily. + + /// Gets the Daily. public static TimeGranularity Daily { get; } = new TimeGranularity(DailyValue); - /// hourly. + + /// Gets the Hourly. public static TimeGranularity Hourly { get; } = new TimeGranularity(HourlyValue); - /// minutely. + + /// Gets the PerMinute. public static TimeGranularity PerMinute { get; } = new TimeGranularity(PerMinuteValue); - /// secondly. + + /// Gets the PerSecond. public static TimeGranularity PerSecond { get; } = new TimeGranularity(PerSecondValue); - /// microsecond. + + /// Gets the Microsecond. public static TimeGranularity Microsecond { get; } = new TimeGranularity(MicrosecondValue); - /// none. + + /// Gets the None. public static TimeGranularity None { get; } = new TimeGranularity(NoneValue); + /// Determines if two values are the same. + /// The left value to compare. + /// The right value to compare. public static bool operator ==(TimeGranularity left, TimeGranularity right) => left.Equals(right); + /// Determines if two values are not the same. + /// The left value to compare. + /// The right value to compare. public static bool operator !=(TimeGranularity left, TimeGranularity right) => !left.Equals(right); - /// Converts a to a . + + /// Converts a string to a . + /// The value. public static implicit operator TimeGranularity(string value) => new TimeGranularity(value); - /// + /// Converts a string to a . + /// The value. + public static implicit operator TimeGranularity?(string value) => value == null ? null : new TimeGranularity(value); + + /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is TimeGranularity other && Equals(other); - /// + + /// public bool Equals(TimeGranularity 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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeSeriesPoint.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeSeriesPoint.Serialization.cs new file mode 100644 index 000000000000..8301d12bf70c --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeSeriesPoint.Serialization.cs @@ -0,0 +1,157 @@ +// 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; + +namespace Azure.AI.AnomalyDetector +{ + /// Definition of input time series points. + public partial class TimeSeriesPoint : IJsonModel + { + /// Initializes a new instance of for deserialization. + internal TimeSeriesPoint() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual TimeSeriesPoint PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeTimeSeriesPoint(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TimeSeriesPoint)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(TimeSeriesPoint)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeSeriesPoint)} does not support writing '{format}' format."); + } + if (Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + if (options.Format != "W" && _additionalBinaryDataProperties != null) + { + foreach (var item in _additionalBinaryDataProperties) + { + 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 + } + } + } + + /// The JSON reader. + /// The client options for reading and writing models. + TimeSeriesPoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual TimeSeriesPoint JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeSeriesPoint)} does not support reading '{format}' format."); + } + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTimeSeriesPoint(document.RootElement, options); + } + + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static TimeSeriesPoint DeserializeTimeSeriesPoint(JsonElement element, ModelReaderWriterOptions options) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? timestamp = default; + float value = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) + { + if (prop.NameEquals("timestamp"u8)) + { + if (prop.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = prop.Value.GetDateTimeOffset("O"); + continue; + } + if (prop.NameEquals("value"u8)) + { + value = prop.Value.GetSingle(); + continue; + } + if (options.Format != "W") + { + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); + } + } + return new TimeSeriesPoint(timestamp, value, additionalBinaryDataProperties); + } + + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); + + /// The data to parse. + /// The client options for reading and writing models. + TimeSeriesPoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + + /// The client options for reading and writing models. + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeSeriesPoint.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeSeriesPoint.cs new file mode 100644 index 000000000000..42a5f5313680 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/TimeSeriesPoint.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.AnomalyDetector +{ + /// Definition of input time series points. + public partial class TimeSeriesPoint + { + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; + + /// Initializes a new instance of . + /// Measurement of that point. + public TimeSeriesPoint(float value) + { + Value = value; + } + + /// Initializes a new instance of . + /// Argument that indicates the time stamp of a data point (ISO8601 format). + /// Measurement of that point. + /// Keeps track of any properties unknown to the library. + internal TimeSeriesPoint(DateTimeOffset? timestamp, float value, IDictionary additionalBinaryDataProperties) + { + Timestamp = timestamp; + Value = value; + _additionalBinaryDataProperties = additionalBinaryDataProperties; + } + + /// Argument that indicates the time stamp of a data point (ISO8601 format). + public DateTimeOffset? Timestamp { get; set; } + + /// Measurement of that point. + public float Value { get; } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionOptions.Serialization.cs similarity index 54% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionOptions.Serialization.cs index 9648b5348437..c62594114576 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionOptions.Serialization.cs @@ -13,10 +13,46 @@ namespace Azure.AI.AnomalyDetector { - public partial class UnivariateChangePointDetectionOptions : IUtf8JsonSerializable, IJsonModel + /// Request of change point detection. + public partial class UnivariateChangePointDetectionOptions : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal UnivariateChangePointDetectionOptions() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UnivariateChangePointDetectionOptions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeUnivariateChangePointDetectionOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UnivariateChangePointDetectionOptions)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(UnivariateChangePointDetectionOptions)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +64,14 @@ void IJsonModel.Write(Utf8JsonWriter writ /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateChangePointDetectionOptions)} does not support writing '{format}' format."); } - writer.WritePropertyName("series"u8); writer.WriteStartArray(); - foreach (var item in Series) + foreach (TimeSeriesPoint item in Series) { writer.WriteObjectValue(item, options); } @@ -63,15 +98,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("threshold"u8); writer.WriteNumberValue(Threshold.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -80,22 +115,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UnivariateChangePointDetectionOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + UnivariateChangePointDetectionOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UnivariateChangePointDetectionOptions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateChangePointDetectionOptions)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeUnivariateChangePointDetectionOptions(document.RootElement, options); } - internal static UnivariateChangePointDetectionOptions DeserializeUnivariateChangePointDetectionOptions(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UnivariateChangePointDetectionOptions DeserializeUnivariateChangePointDetectionOptions(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -106,67 +146,65 @@ internal static UnivariateChangePointDetectionOptions DeserializeUnivariateChang int? period = default; int? stableTrendWindow = default; float? threshold = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("series"u8)) + if (prop.NameEquals("series"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(TimeSeriesPoint.DeserializeTimeSeriesPoint(item, options)); } series = array; continue; } - if (property.NameEquals("granularity"u8)) + if (prop.NameEquals("granularity"u8)) { - granularity = new TimeGranularity(property.Value.GetString()); + granularity = new TimeGranularity(prop.Value.GetString()); continue; } - if (property.NameEquals("customInterval"u8)) + if (prop.NameEquals("customInterval"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - customInterval = property.Value.GetInt32(); + customInterval = prop.Value.GetInt32(); continue; } - if (property.NameEquals("period"u8)) + if (prop.NameEquals("period"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - period = property.Value.GetInt32(); + period = prop.Value.GetInt32(); continue; } - if (property.NameEquals("stableTrendWindow"u8)) + if (prop.NameEquals("stableTrendWindow"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - stableTrendWindow = property.Value.GetInt32(); + stableTrendWindow = prop.Value.GetInt32(); continue; } - if (property.NameEquals("threshold"u8)) + if (prop.NameEquals("threshold"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - threshold = property.Value.GetSingle(); + threshold = prop.Value.GetSingle(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new UnivariateChangePointDetectionOptions( series, granularity, @@ -174,53 +212,28 @@ internal static UnivariateChangePointDetectionOptions DeserializeUnivariateChang period, stableTrendWindow, threshold, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(UnivariateChangePointDetectionOptions)} does not support writing '{options.Format}' format."); - } - } - - UnivariateChangePointDetectionOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateChangePointDetectionOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UnivariateChangePointDetectionOptions)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + UnivariateChangePointDetectionOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UnivariateChangePointDetectionOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateChangePointDetectionOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() + /// The to serialize into . + public static implicit operator RequestContent(UnivariateChangePointDetectionOptions univariateChangePointDetectionOptions) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + if (univariateChangePointDetectionOptions == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(univariateChangePointDetectionOptions, ModelSerializationExtensions.WireOptions); return content; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionOptions.cs similarity index 71% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionOptions.cs index 4a6bcf2fc1fc..d44e55ad28db 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionOptions.cs @@ -14,37 +14,8 @@ namespace Azure.AI.AnomalyDetector /// Request of change point detection. public partial class UnivariateChangePointDetectionOptions { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// @@ -85,8 +56,8 @@ public UnivariateChangePointDetectionOptions(IEnumerable series /// value is, the larger the trend error is, which means less change point will /// be accepted. /// - /// Keeps track of any properties unknown to the library. - internal UnivariateChangePointDetectionOptions(IList series, TimeGranularity granularity, int? customInterval, int? period, int? stableTrendWindow, float? threshold, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal UnivariateChangePointDetectionOptions(IList series, TimeGranularity granularity, int? customInterval, int? period, int? stableTrendWindow, float? threshold, IDictionary additionalBinaryDataProperties) { Series = series; Granularity = granularity; @@ -94,12 +65,7 @@ internal UnivariateChangePointDetectionOptions(IList series, Ti Period = period; StableTrendWindow = stableTrendWindow; Threshold = threshold; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal UnivariateChangePointDetectionOptions() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -107,24 +73,29 @@ internal UnivariateChangePointDetectionOptions() /// order to match the change point detection result. /// public IList Series { get; } + /// Granularity is used to verify whether the input series is valid. public TimeGranularity Granularity { get; } + /// /// A custom interval is used to set a nonstandard time interval. For example, if the /// series is 5 minutes, the request can be set as {"granularity":"minutely", /// "customInterval":5}. /// public int? CustomInterval { get; set; } + /// /// Argument that indicates the periodic value of a time series. If the value is null or /// not present, the API will determine the period automatically. /// public int? Period { get; set; } + /// /// Argument that indicates an advanced model parameter. A default stableTrendWindow value will /// be used in detection. /// public int? StableTrendWindow { get; set; } + /// /// Argument that indicates an advanced model parameter between 0.0 and 1.0. The lower the /// value is, the larger the trend error is, which means less change point will diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionResult.Serialization.cs similarity index 54% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionResult.Serialization.cs index ea4c3fc83fa3..4004522a53b3 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionResult.Serialization.cs @@ -9,14 +9,52 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.AnomalyDetector { - public partial class UnivariateChangePointDetectionResult : IUtf8JsonSerializable, IJsonModel + /// Response of change point detection. + public partial class UnivariateChangePointDetectionResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UnivariateChangePointDetectionResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeUnivariateChangePointDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UnivariateChangePointDetectionResult)} does not support reading '{options.Format}' format."); + } + } + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(UnivariateChangePointDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator UnivariateChangePointDetectionResult(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnivariateChangePointDetectionResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +66,11 @@ void IJsonModel.Write(Utf8JsonWriter write /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateChangePointDetectionResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(Period)) { writer.WritePropertyName("period"u8); @@ -43,7 +80,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("isChangePoint"u8); writer.WriteStartArray(); - foreach (var item in IsChangePoint) + foreach (bool item in IsChangePoint) { writer.WriteBooleanValue(item); } @@ -53,21 +90,21 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit { writer.WritePropertyName("confidenceScores"u8); writer.WriteStartArray(); - foreach (var item in ConfidenceScores) + foreach (float item in ConfidenceScores) { writer.WriteNumberValue(item); } writer.WriteEndArray(); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -76,64 +113,68 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UnivariateChangePointDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + UnivariateChangePointDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UnivariateChangePointDetectionResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateChangePointDetectionResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeUnivariateChangePointDetectionResult(document.RootElement, options); } - internal static UnivariateChangePointDetectionResult DeserializeUnivariateChangePointDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UnivariateChangePointDetectionResult DeserializeUnivariateChangePointDetectionResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; } int? period = default; - IReadOnlyList isChangePoint = default; - IReadOnlyList confidenceScores = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IList isChangePoint = default; + IList confidenceScores = default; + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("period"u8)) + if (prop.NameEquals("period"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - period = property.Value.GetInt32(); + period = prop.Value.GetInt32(); continue; } - if (property.NameEquals("isChangePoint"u8)) + if (prop.NameEquals("isChangePoint"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetBoolean()); } isChangePoint = array; continue; } - if (property.NameEquals("confidenceScores"u8)) + if (prop.NameEquals("confidenceScores"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetSingle()); } @@ -142,58 +183,20 @@ internal static UnivariateChangePointDetectionResult DeserializeUnivariateChange } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new UnivariateChangePointDetectionResult(period, isChangePoint ?? new ChangeTrackingList(), confidenceScores ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new UnivariateChangePointDetectionResult(period, isChangePoint ?? new ChangeTrackingList(), confidenceScores ?? new ChangeTrackingList(), additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(UnivariateChangePointDetectionResult)} does not support writing '{options.Format}' format."); - } - } - - UnivariateChangePointDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateChangePointDetectionResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UnivariateChangePointDetectionResult)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + UnivariateChangePointDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UnivariateChangePointDetectionResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateChangePointDetectionResult(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionResult.cs similarity index 53% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionResult.cs index 7b5e2b419703..f7ce773546c0 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateChangePointDetectionResult.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateChangePointDetectionResult.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Response of change point detection. public partial class UnivariateChangePointDetectionResult { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal UnivariateChangePointDetectionResult() @@ -63,13 +34,13 @@ internal UnivariateChangePointDetectionResult() /// array is consistent with the input series. /// /// Change point confidence of each point. - /// Keeps track of any properties unknown to the library. - internal UnivariateChangePointDetectionResult(int? period, IReadOnlyList isChangePoint, IReadOnlyList confidenceScores, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal UnivariateChangePointDetectionResult(int? period, IList isChangePoint, IList confidenceScores, IDictionary additionalBinaryDataProperties) { Period = period; IsChangePoint = isChangePoint; ConfidenceScores = confidenceScores; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -77,13 +48,15 @@ internal UnivariateChangePointDetectionResult(int? period, IReadOnlyList i /// found. /// public int? Period { get; } + /// /// Change point properties for each input point. True means /// an anomaly (either negative or positive) has been detected. The index of the /// array is consistent with the input series. /// - public IReadOnlyList IsChangePoint { get; } + public IList IsChangePoint { get; } + /// Change point confidence of each point. - public IReadOnlyList ConfidenceScores { get; } + public IList ConfidenceScores { get; } } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateDetectionOptions.Serialization.cs similarity index 56% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateDetectionOptions.Serialization.cs index 8ecfe56e278c..e124a9684dd1 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateDetectionOptions.Serialization.cs @@ -13,10 +13,46 @@ namespace Azure.AI.AnomalyDetector { - public partial class UnivariateDetectionOptions : IUtf8JsonSerializable, IJsonModel + /// Request of the entire or last anomaly detection. + public partial class UnivariateDetectionOptions : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal UnivariateDetectionOptions() + { + } + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UnivariateDetectionOptions PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeUnivariateDetectionOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UnivariateDetectionOptions)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(UnivariateDetectionOptions)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,15 +64,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateDetectionOptions)} does not support writing '{format}' format."); } - writer.WritePropertyName("series"u8); writer.WriteStartArray(); - foreach (var item in Series) + foreach (TimeSeriesPoint item in Series) { writer.WriteObjectValue(item, options); } @@ -76,15 +111,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("imputeFixedValue"u8); writer.WriteNumberValue(ImputeFixedValue.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -93,22 +128,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UnivariateDetectionOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + UnivariateDetectionOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UnivariateDetectionOptions JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateDetectionOptions)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeUnivariateDetectionOptions(document.RootElement, options); } - internal static UnivariateDetectionOptions DeserializeUnivariateDetectionOptions(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UnivariateDetectionOptions DeserializeUnivariateDetectionOptions(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -121,89 +161,87 @@ internal static UnivariateDetectionOptions DeserializeUnivariateDetectionOptions int? sensitivity = default; ImputeMode? imputeMode = default; float? imputeFixedValue = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("series"u8)) + if (prop.NameEquals("series"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(TimeSeriesPoint.DeserializeTimeSeriesPoint(item, options)); } series = array; continue; } - if (property.NameEquals("granularity"u8)) + if (prop.NameEquals("granularity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - granularity = new TimeGranularity(property.Value.GetString()); + granularity = new TimeGranularity(prop.Value.GetString()); continue; } - if (property.NameEquals("customInterval"u8)) + if (prop.NameEquals("customInterval"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - customInterval = property.Value.GetInt32(); + customInterval = prop.Value.GetInt32(); continue; } - if (property.NameEquals("period"u8)) + if (prop.NameEquals("period"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - period = property.Value.GetInt32(); + period = prop.Value.GetInt32(); continue; } - if (property.NameEquals("maxAnomalyRatio"u8)) + if (prop.NameEquals("maxAnomalyRatio"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - maxAnomalyRatio = property.Value.GetSingle(); + maxAnomalyRatio = prop.Value.GetSingle(); continue; } - if (property.NameEquals("sensitivity"u8)) + if (prop.NameEquals("sensitivity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - sensitivity = property.Value.GetInt32(); + sensitivity = prop.Value.GetInt32(); continue; } - if (property.NameEquals("imputeMode"u8)) + if (prop.NameEquals("imputeMode"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - imputeMode = new ImputeMode(property.Value.GetString()); + imputeMode = new ImputeMode(prop.Value.GetString()); continue; } - if (property.NameEquals("imputeFixedValue"u8)) + if (prop.NameEquals("imputeFixedValue"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - imputeFixedValue = property.Value.GetSingle(); + imputeFixedValue = prop.Value.GetSingle(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new UnivariateDetectionOptions( series, granularity, @@ -213,53 +251,28 @@ internal static UnivariateDetectionOptions DeserializeUnivariateDetectionOptions sensitivity, imputeMode, imputeFixedValue, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(UnivariateDetectionOptions)} does not support writing '{options.Format}' format."); - } - } - - UnivariateDetectionOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateDetectionOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UnivariateDetectionOptions)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + UnivariateDetectionOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UnivariateDetectionOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateDetectionOptions(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() + /// The to serialize into . + public static implicit operator RequestContent(UnivariateDetectionOptions univariateDetectionOptions) { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + if (univariateDetectionOptions == null) + { + return null; + } + Utf8JsonRequestContent content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(univariateDetectionOptions, ModelSerializationExtensions.WireOptions); return content; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateDetectionOptions.cs similarity index 77% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateDetectionOptions.cs index 469787638503..dd836ee93272 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateDetectionOptions.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateDetectionOptions.cs @@ -14,37 +14,8 @@ namespace Azure.AI.AnomalyDetector /// Request of the entire or last anomaly detection. public partial class UnivariateDetectionOptions { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// @@ -96,8 +67,8 @@ public UnivariateDetectionOptions(IEnumerable series) /// Specifies the value to fill. It's used when granularity is not "none" /// and imputeMode is "fixed". /// - /// Keeps track of any properties unknown to the library. - internal UnivariateDetectionOptions(IList series, TimeGranularity? granularity, int? customInterval, int? period, float? maxAnomalyRatio, int? sensitivity, ImputeMode? imputeMode, float? imputeFixedValue, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal UnivariateDetectionOptions(IList series, TimeGranularity? granularity, int? customInterval, int? period, float? maxAnomalyRatio, int? sensitivity, ImputeMode? imputeMode, float? imputeFixedValue, IDictionary additionalBinaryDataProperties) { Series = series; Granularity = granularity; @@ -107,12 +78,7 @@ internal UnivariateDetectionOptions(IList series, TimeGranulari Sensitivity = sensitivity; ImputeMode = imputeMode; ImputeFixedValue = imputeFixedValue; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal UnivariateDetectionOptions() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -122,36 +88,43 @@ internal UnivariateDetectionOptions() /// a case, an error message is returned. /// public IList Series { get; } + /// /// Argument that indicates time granularity. If granularity is not present, the value /// is none by default. If granularity is none, the time stamp property in the time /// series point can be absent. /// public TimeGranularity? Granularity { get; set; } + /// /// A custom interval is used to set a nonstandard time interval. For example, if the /// series is 5 minutes, the request can be set as {"granularity":"minutely", /// "customInterval":5}. /// public int? CustomInterval { get; set; } + /// /// Argument that indicates the periodic value of a time series. If the value is null or /// is not present, the API determines the period automatically. /// public int? Period { get; set; } + /// Argument that indicates an advanced model parameter. It's the maximum anomaly ratio in a time series. public float? MaxAnomalyRatio { get; set; } + /// /// Argument that indicates an advanced model parameter between 0 and 99. The lower the value /// is, the larger the margin value is, which means fewer anomalies will be /// accepted. /// public int? Sensitivity { get; set; } + /// /// Specifies how to deal with missing values in the input series. It's used /// when granularity is not "none". /// public ImputeMode? ImputeMode { get; set; } + /// /// Specifies the value to fill. It's used when granularity is not "none" /// and imputeMode is "fixed". diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateLastDetectionResult.Serialization.cs similarity index 54% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateLastDetectionResult.Serialization.cs index c99f0d45ffcc..13a0553680b6 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateLastDetectionResult.Serialization.cs @@ -9,14 +9,57 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.AI.AnomalyDetector { - public partial class UnivariateLastDetectionResult : IUtf8JsonSerializable, IJsonModel + /// Response of the last anomaly detection. + public partial class UnivariateLastDetectionResult : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal UnivariateLastDetectionResult() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual UnivariateLastDetectionResult PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeUnivariateLastDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UnivariateLastDetectionResult)} does not support reading '{options.Format}' format."); + } + } + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(UnivariateLastDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + /// The to deserialize the from. + public static explicit operator UnivariateLastDetectionResult(Response response) + { + using JsonDocument document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnivariateLastDetectionResult(document.RootElement, ModelSerializationExtensions.WireOptions); + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +71,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateLastDetectionResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("period"u8); writer.WriteNumberValue(Period); writer.WritePropertyName("suggestedWindow"u8); @@ -55,15 +97,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("severity"u8); writer.WriteNumberValue(Severity.Value); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -72,22 +114,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UnivariateLastDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + UnivariateLastDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual UnivariateLastDetectionResult JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(UnivariateLastDetectionResult)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeUnivariateLastDetectionResult(document.RootElement, options); } - internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetectionResult(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,65 +148,63 @@ internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetection bool isNegativeAnomaly = default; bool isPositiveAnomaly = default; float? severity = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("period"u8)) + if (prop.NameEquals("period"u8)) { - period = property.Value.GetInt32(); + period = prop.Value.GetInt32(); continue; } - if (property.NameEquals("suggestedWindow"u8)) + if (prop.NameEquals("suggestedWindow"u8)) { - suggestedWindow = property.Value.GetInt32(); + suggestedWindow = prop.Value.GetInt32(); continue; } - if (property.NameEquals("expectedValue"u8)) + if (prop.NameEquals("expectedValue"u8)) { - expectedValue = property.Value.GetSingle(); + expectedValue = prop.Value.GetSingle(); continue; } - if (property.NameEquals("upperMargin"u8)) + if (prop.NameEquals("upperMargin"u8)) { - upperMargin = property.Value.GetSingle(); + upperMargin = prop.Value.GetSingle(); continue; } - if (property.NameEquals("lowerMargin"u8)) + if (prop.NameEquals("lowerMargin"u8)) { - lowerMargin = property.Value.GetSingle(); + lowerMargin = prop.Value.GetSingle(); continue; } - if (property.NameEquals("isAnomaly"u8)) + if (prop.NameEquals("isAnomaly"u8)) { - isAnomaly = property.Value.GetBoolean(); + isAnomaly = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("isNegativeAnomaly"u8)) + if (prop.NameEquals("isNegativeAnomaly"u8)) { - isNegativeAnomaly = property.Value.GetBoolean(); + isNegativeAnomaly = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("isPositiveAnomaly"u8)) + if (prop.NameEquals("isPositiveAnomaly"u8)) { - isPositiveAnomaly = property.Value.GetBoolean(); + isPositiveAnomaly = prop.Value.GetBoolean(); continue; } - if (property.NameEquals("severity"u8)) + if (prop.NameEquals("severity"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - severity = property.Value.GetSingle(); + severity = prop.Value.GetSingle(); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new UnivariateLastDetectionResult( period, suggestedWindow, @@ -170,54 +215,17 @@ internal static UnivariateLastDetectionResult DeserializeUnivariateLastDetection isNegativeAnomaly, isPositiveAnomaly, severity, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(UnivariateLastDetectionResult)} does not support writing '{options.Format}' format."); - } - } - - UnivariateLastDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateLastDetectionResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(UnivariateLastDetectionResult)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + UnivariateLastDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static UnivariateLastDetectionResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUnivariateLastDetectionResult(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateLastDetectionResult.cs similarity index 80% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateLastDetectionResult.cs index ac548f21c76c..4670f5f3a376 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/UnivariateLastDetectionResult.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/UnivariateLastDetectionResult.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Response of the last anomaly detection. public partial class UnivariateLastDetectionResult { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// @@ -121,8 +92,8 @@ internal UnivariateLastDetectionResult(int period, int suggestedWindow, float ex /// Severity score for the last input point. The larger the value is, the more /// severe the anomaly is. For normal points, the severity is always 0. /// - /// Keeps track of any properties unknown to the library. - internal UnivariateLastDetectionResult(int period, int suggestedWindow, float expectedValue, float upperMargin, float lowerMargin, bool isAnomaly, bool isNegativeAnomaly, bool isPositiveAnomaly, float? severity, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal UnivariateLastDetectionResult(int period, int suggestedWindow, float expectedValue, float upperMargin, float lowerMargin, bool isAnomaly, bool isNegativeAnomaly, bool isPositiveAnomaly, float? severity, IDictionary additionalBinaryDataProperties) { Period = period; SuggestedWindow = suggestedWindow; @@ -133,12 +104,7 @@ internal UnivariateLastDetectionResult(int period, int suggestedWindow, float ex IsNegativeAnomaly = isNegativeAnomaly; IsPositiveAnomaly = isPositiveAnomaly; Severity = severity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal UnivariateLastDetectionResult() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// @@ -146,10 +112,13 @@ internal UnivariateLastDetectionResult() /// found. /// public int Period { get; } + /// Suggested input series points needed for detecting the latest point. public int SuggestedWindow { get; } + /// Expected value of the latest point. public float ExpectedValue { get; } + /// /// Upper margin of the latest point. UpperMargin is used to calculate /// upperBoundary, which is equal to expectedValue + (100 - marginScale)*upperMargin. @@ -158,26 +127,31 @@ internal UnivariateLastDetectionResult() /// status of the latest point to be changed. /// public float UpperMargin { get; } + /// /// Lower margin of the latest point. LowerMargin is used to calculate /// lowerBoundary, which is equal to expectedValue - (100 - marginScale)*lowerMargin. /// public float LowerMargin { get; } + /// /// Anomaly status of the latest point. True means the latest point is an anomaly, /// either in the negative direction or in the positive direction. /// public bool IsAnomaly { get; } + /// /// Anomaly status of the latest point in a negative direction. True means the latest /// point is an anomaly and its real value is smaller than the expected one. /// public bool IsNegativeAnomaly { get; } + /// /// Anomaly status of the latest point in a positive direction. True means the latest /// point is an anomaly and its real value is larger than the expected one. /// public bool IsPositiveAnomaly { get; } + /// /// Severity score for the last input point. The larger the value is, the more /// severe the anomaly is. For normal points, the severity is always 0. diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableState.Serialization.cs similarity index 55% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableState.Serialization.cs index 86e9897f1d7a..bcdd169906c0 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableState.Serialization.cs @@ -9,14 +9,44 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class VariableState : IUtf8JsonSerializable, IJsonModel + /// Variable status. + public partial class VariableState : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VariableState PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeVariableState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VariableState)} does not support reading '{options.Format}' format."); + } + } + + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(VariableState)} does not support writing '{options.Format}' format."); + } + } + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,12 +58,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VariableState)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Variable)) { writer.WritePropertyName("variable"u8); @@ -59,15 +88,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("lastTimestamp"u8); writer.WriteStringValue(LastTimestamp.Value, "O"); } - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -76,22 +105,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VariableState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VariableState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VariableState JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VariableState)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVariableState(document.RootElement, options); } - internal static VariableState DeserializeVariableState(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VariableState DeserializeVariableState(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -101,111 +135,72 @@ internal static VariableState DeserializeVariableState(JsonElement element, Mode int? effectiveCount = default; DateTimeOffset? firstTimestamp = default; DateTimeOffset? lastTimestamp = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("variable"u8)) + if (prop.NameEquals("variable"u8)) { - variable = property.Value.GetString(); + variable = prop.Value.GetString(); continue; } - if (property.NameEquals("filledNARatio"u8)) + if (prop.NameEquals("filledNARatio"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - filledNARatio = property.Value.GetSingle(); + filledNARatio = prop.Value.GetSingle(); continue; } - if (property.NameEquals("effectiveCount"u8)) + if (prop.NameEquals("effectiveCount"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - effectiveCount = property.Value.GetInt32(); + effectiveCount = prop.Value.GetInt32(); continue; } - if (property.NameEquals("firstTimestamp"u8)) + if (prop.NameEquals("firstTimestamp"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - firstTimestamp = property.Value.GetDateTimeOffset("O"); + firstTimestamp = prop.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("lastTimestamp"u8)) + if (prop.NameEquals("lastTimestamp"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) + if (prop.Value.ValueKind == JsonValueKind.Null) { continue; } - lastTimestamp = property.Value.GetDateTimeOffset("O"); + lastTimestamp = prop.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; return new VariableState( variable, filledNARatio, effectiveCount, firstTimestamp, lastTimestamp, - serializedAdditionalRawData); + additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(VariableState)} does not support writing '{options.Format}' format."); - } - } - - VariableState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeVariableState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(VariableState)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + VariableState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static VariableState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeVariableState(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableState.cs similarity index 56% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableState.cs index 96249297b19a..7a27fefa0aec 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableState.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableState.cs @@ -13,37 +13,8 @@ namespace Azure.AI.AnomalyDetector /// Variable status. public partial class VariableState { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . internal VariableState() @@ -56,25 +27,29 @@ internal VariableState() /// Number of effective data points before fillNAMethod is applied. /// First valid time stamp with a value of input data. /// Last valid time stamp with a value of input data. - /// Keeps track of any properties unknown to the library. - internal VariableState(string variable, float? filledNARatio, int? effectiveCount, DateTimeOffset? firstTimestamp, DateTimeOffset? lastTimestamp, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal VariableState(string variable, float? filledNARatio, int? effectiveCount, DateTimeOffset? firstTimestamp, DateTimeOffset? lastTimestamp, IDictionary additionalBinaryDataProperties) { Variable = variable; FilledNARatio = filledNARatio; EffectiveCount = effectiveCount; FirstTimestamp = firstTimestamp; LastTimestamp = lastTimestamp; - _serializedAdditionalRawData = serializedAdditionalRawData; + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Variable name in variable states. public string Variable { get; } + /// Proportion of missing values that need to be filled by fillNAMethod. public float? FilledNARatio { get; } + /// Number of effective data points before fillNAMethod is applied. public int? EffectiveCount { get; } + /// First valid time stamp with a value of input data. public DateTimeOffset? FirstTimestamp { get; } + /// Last valid time stamp with a value of input data. public DateTimeOffset? LastTimestamp { get; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableValues.Serialization.cs similarity index 50% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.Serialization.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableValues.Serialization.cs index bf41439ae50f..39d21bcc6ad3 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.Serialization.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableValues.Serialization.cs @@ -9,14 +9,49 @@ using System.ClientModel.Primitives; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.AnomalyDetector { - public partial class VariableValues : IUtf8JsonSerializable, IJsonModel + /// Variable values. + public partial class VariableValues : IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + /// Initializes a new instance of for deserialization. + internal VariableValues() + { + } + + /// The data to parse. + /// The client options for reading and writing models. + protected virtual VariableValues PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + using (JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions)) + { + return DeserializeVariableValues(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VariableValues)} does not support reading '{options.Format}' format."); + } + } + /// The client options for reading and writing models. + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) + { + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureAIAnomalyDetectorContext.Default); + default: + throw new FormatException($"The model {nameof(VariableValues)} does not support writing '{options.Format}' format."); + } + } + + /// The JSON writer. + /// The client options for reading and writing models. void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); @@ -28,37 +63,41 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VariableValues)} does not support writing '{format}' format."); } - writer.WritePropertyName("variable"u8); writer.WriteStringValue(Variable); writer.WritePropertyName("timestamps"u8); writer.WriteStartArray(); - foreach (var item in Timestamps) + foreach (string item in Timestamps) { + if (item == null) + { + writer.WriteNullValue(); + continue; + } writer.WriteStringValue(item); } writer.WriteEndArray(); writer.WritePropertyName("values"u8); writer.WriteStartArray(); - foreach (var item in Values) + foreach (float item in Values) { writer.WriteNumberValue(item); } writer.WriteEndArray(); - if (options.Format != "W" && _serializedAdditionalRawData != null) + if (options.Format != "W" && _additionalBinaryDataProperties != null) { - foreach (var item in _serializedAdditionalRawData) + foreach (var item in _additionalBinaryDataProperties) { writer.WritePropertyName(item.Key); #if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); + writer.WriteRawValue(item.Value); #else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + using (JsonDocument document = JsonDocument.Parse(item.Value)) { JsonSerializer.Serialize(writer, document.RootElement); } @@ -67,22 +106,27 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - VariableValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + /// The JSON reader. + /// The client options for reading and writing models. + VariableValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => JsonModelCreateCore(ref reader, options); + + /// The JSON reader. + /// The client options for reading and writing models. + protected virtual VariableValues JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + string format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { throw new FormatException($"The model {nameof(VariableValues)} does not support reading '{format}' format."); } - using JsonDocument document = JsonDocument.ParseValue(ref reader); return DeserializeVariableValues(document.RootElement, options); } - internal static VariableValues DeserializeVariableValues(JsonElement element, ModelReaderWriterOptions options = null) + /// The JSON element to deserialize. + /// The client options for reading and writing models. + internal static VariableValues DeserializeVariableValues(JsonElement element, ModelReaderWriterOptions options) { - options ??= ModelSerializationExtensions.WireOptions; - if (element.ValueKind == JsonValueKind.Null) { return null; @@ -90,29 +134,35 @@ internal static VariableValues DeserializeVariableValues(JsonElement element, Mo string variable = default; IList timestamps = default; IList values = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) + IDictionary additionalBinaryDataProperties = new ChangeTrackingDictionary(); + foreach (var prop in element.EnumerateObject()) { - if (property.NameEquals("variable"u8)) + if (prop.NameEquals("variable"u8)) { - variable = property.Value.GetString(); + variable = prop.Value.GetString(); continue; } - if (property.NameEquals("timestamps"u8)) + if (prop.NameEquals("timestamps"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { - array.Add(item.GetString()); + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(item.GetString()); + } } timestamps = array; continue; } - if (property.NameEquals("values"u8)) + if (prop.NameEquals("values"u8)) { List array = new List(); - foreach (var item in property.Value.EnumerateArray()) + foreach (var item in prop.Value.EnumerateArray()) { array.Add(item.GetSingle()); } @@ -121,58 +171,20 @@ internal static VariableValues DeserializeVariableValues(JsonElement element, Mo } if (options.Format != "W") { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + additionalBinaryDataProperties.Add(prop.Name, BinaryData.FromString(prop.Value.GetRawText())); } } - serializedAdditionalRawData = rawDataDictionary; - return new VariableValues(variable, timestamps, values, serializedAdditionalRawData); + return new VariableValues(variable, timestamps, values, additionalBinaryDataProperties); } - 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(VariableValues)} does not support writing '{options.Format}' format."); - } - } - - VariableValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + /// The client options for reading and writing models. + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => PersistableModelWriteCore(options); - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeVariableValues(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(VariableValues)} does not support reading '{options.Format}' format."); - } - } + /// The data to parse. + /// The client options for reading and writing models. + VariableValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => PersistableModelCreateCore(data, options); + /// The client options for reading and writing models. string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static VariableValues FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeVariableValues(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableValues.cs similarity index 55% rename from sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.cs rename to sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableValues.cs index 5b3adebc6439..d176509ffd7c 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/VariableValues.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Models/VariableValues.cs @@ -14,37 +14,8 @@ namespace Azure.AI.AnomalyDetector /// Variable values. public partial class VariableValues { - /// - /// 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; + /// Keeps track of any properties unknown to the library. + private protected readonly IDictionary _additionalBinaryDataProperties; /// Initializes a new instance of . /// Variable name of the last detection request. @@ -66,24 +37,21 @@ public VariableValues(string variable, IEnumerable timestamps, IEnumerab /// Variable name of the last detection request. /// Time stamps of the last detection request. /// Values of variables. - /// Keeps track of any properties unknown to the library. - internal VariableValues(string variable, IList timestamps, IList values, IDictionary serializedAdditionalRawData) + /// Keeps track of any properties unknown to the library. + internal VariableValues(string variable, IList timestamps, IList values, IDictionary additionalBinaryDataProperties) { Variable = variable; Timestamps = timestamps; Values = values; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal VariableValues() - { + _additionalBinaryDataProperties = additionalBinaryDataProperties; } /// Variable name of the last detection request. public string Variable { get; } + /// Time stamps of the last detection request. public IList Timestamps { get; } + /// Values of variables. public IList Values { get; } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Multivariate.RestClient.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Multivariate.RestClient.cs new file mode 100644 index 000000000000..f1d6d23cc1e9 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Multivariate.RestClient.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.Core; + +namespace Azure.AI.AnomalyDetector +{ + /// + public partial class Multivariate + { + private static ResponseClassifier _pipelineMessageClassifier200; + private static ResponseClassifier _pipelineMessageClassifier201; + private static ResponseClassifier _pipelineMessageClassifier202; + private static ResponseClassifier _pipelineMessageClassifier204; + + private static ResponseClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + + private static ResponseClassifier PipelineMessageClassifier201 => _pipelineMessageClassifier201 ??= new StatusCodeClassifier(stackalloc ushort[] { 201 }); + + private static ResponseClassifier PipelineMessageClassifier202 => _pipelineMessageClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); + + private static ResponseClassifier PipelineMessageClassifier204 => _pipelineMessageClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + + internal HttpMessage CreateGetMultivariateBatchDetectionResultRequest(Guid resultId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/multivariate/detect-batch/", false); + uri.AppendPath(resultId.ToString(), true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateTrainMultivariateModelRequest(RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/multivariate/models", false); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier201); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetMultivariateModelsRequest(int? skip, int? maxCount, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/multivariate/models", false); + if (skip != null) + { + uri.AppendQuery("skip", TypeFormatters.ConvertToString(skip), true); + } + if (maxCount != null) + { + uri.AppendQuery("top", TypeFormatters.ConvertToString(maxCount), true); + } + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateNextGetMultivariateModelsRequest(Uri nextPage, int? skip, int? maxCount, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(nextPage); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteMultivariateModelRequest(string modelId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/multivariate/models/", false); + uri.AppendPath(modelId, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier204); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Delete; + return message; + } + + internal HttpMessage CreateGetMultivariateModelRequest(string modelId, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/multivariate/models/", false); + uri.AppendPath(modelId, true); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Get; + request.Headers.SetValue("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDetectMultivariateBatchAnomalyRequest(string modelId, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/multivariate/models/", false); + uri.AppendPath(modelId, true); + uri.AppendPath(":detect-batch", false); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier202); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDetectMultivariateLastAnomalyRequest(string modelId, RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/multivariate/models/", false); + uri.AppendPath(modelId, true); + uri.AppendPath(":detect-last", false); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Multivariate.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Multivariate.cs index 5c6f6344b3c8..a8f07eb36e7d 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Multivariate.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Multivariate.cs @@ -8,109 +8,63 @@ using System; using System.Threading; using System.Threading.Tasks; -using Autorest.CSharp.Core; +using Azure; using Azure.Core; using Azure.Core.Pipeline; namespace Azure.AI.AnomalyDetector { - // Data plane generated sub-client. /// The Multivariate sub-client. public partial class Multivariate { - private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; - private readonly AzureKeyCredential _keyCredential; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - /// Initializes a new instance of Multivariate for mocking. protected Multivariate() { } /// Initializes a new instance of Multivariate. - /// The handler for diagnostic messaging in the client. + /// The ClientDiagnostics is used to provide tracing support for the client library. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The key credential to copy. - /// - /// Supported Azure Cognitive Services endpoints (protocol and host name, such as - /// https://westus2.api.cognitive.microsoft.com). - /// - /// Api Version. Allowed values: "v1.1". - internal Multivariate(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, Uri endpoint, string apiVersion) + /// Service endpoint. + /// + internal Multivariate(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _keyCredential = keyCredential; _endpoint = endpoint; + Pipeline = pipeline; _apiVersion = apiVersion; } - /// Get Multivariate Anomaly Detection Result. - /// ID of a batch detection result. - /// The cancellation token to use. - /// - /// For asynchronous inference, get a multivariate anomaly detection result based on the - /// resultId value that the BatchDetectAnomaly API returns. - /// - /// - public virtual async Task> GetMultivariateBatchDetectionResultAsync(Guid resultId, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetMultivariateBatchDetectionResultAsync(resultId, context).ConfigureAwait(false); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); - } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } - /// Get Multivariate Anomaly Detection Result. - /// ID of a batch detection result. - /// The cancellation token to use. - /// - /// For asynchronous inference, get a multivariate anomaly detection result based on the - /// resultId value that the BatchDetectAnomaly API returns. - /// - /// - public virtual Response GetMultivariateBatchDetectionResult(Guid resultId, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetMultivariateBatchDetectionResult(resultId, context); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); - } + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } /// - /// [Protocol Method] Get Multivariate Anomaly Detection Result + /// [Protocol Method] For asynchronous inference, get a multivariate anomaly detection result based on the + /// resultId value that the BatchDetectAnomaly API returns. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// ID of a batch detection result. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetMultivariateBatchDetectionResultAsync(Guid resultId, RequestContext context) + public virtual Response GetMultivariateBatchDetectionResult(Guid resultId, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateBatchDetectionResult"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateBatchDetectionResult"); scope.Start(); try { using HttpMessage message = CreateGetMultivariateBatchDetectionResultRequest(resultId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -120,33 +74,26 @@ public virtual async Task GetMultivariateBatchDetectionResultAsync(Gui } /// - /// [Protocol Method] Get Multivariate Anomaly Detection Result + /// [Protocol Method] For asynchronous inference, get a multivariate anomaly detection result based on the + /// resultId value that the BatchDetectAnomaly API returns. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// ID of a batch detection result. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetMultivariateBatchDetectionResult(Guid resultId, RequestContext context) + public virtual async Task GetMultivariateBatchDetectionResultAsync(Guid resultId, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateBatchDetectionResult"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateBatchDetectionResult"); scope.Start(); try { using HttpMessage message = CreateGetMultivariateBatchDetectionResultRequest(resultId, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -155,12 +102,34 @@ public virtual Response GetMultivariateBatchDetectionResult(Guid resultId, Reque } } - /// Train a Multivariate Anomaly Detection Model. - /// Model information. - /// The cancellation token to use. - /// is null. - /// - /// Create and train a multivariate anomaly detection model. The request must + /// + /// For asynchronous inference, get a multivariate anomaly detection result based on the + /// resultId value that the BatchDetectAnomaly API returns. + /// + /// ID of a batch detection result. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual Response GetMultivariateBatchDetectionResult(Guid resultId, CancellationToken cancellationToken = default) + { + Response result = GetMultivariateBatchDetectionResult(resultId, cancellationToken.ToRequestContext()); + return Response.FromValue((MultivariateDetectionResult)result, result); + } + + /// + /// For asynchronous inference, get a multivariate anomaly detection result based on the + /// resultId value that the BatchDetectAnomaly API returns. + /// + /// ID of a batch detection result. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual async Task> GetMultivariateBatchDetectionResultAsync(Guid resultId, CancellationToken cancellationToken = default) + { + Response result = await GetMultivariateBatchDetectionResultAsync(resultId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((MultivariateDetectionResult)result, result); + } + + /// + /// [Protocol Method] Create and train a multivariate anomaly detection model. The request must /// include a source parameter to indicate an Azure Blob /// Storage URI that's accessible to the service. There are two types of data input. The Blob Storage URI can point to an Azure Blob /// Storage folder that contains multiple CSV files, where each CSV file has @@ -170,24 +139,37 @@ public virtual Response GetMultivariateBatchDetectionResult(Guid resultId, Reque /// training process happens asynchronously. To check the training status, call /// GetMultivariateModel with the modelId value and check the status field in the /// modelInfo object. - /// - /// - public virtual async Task> TrainMultivariateModelAsync(ModelInfo modelInfo, CancellationToken cancellationToken = default) + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// The content to send as the body of the request. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual Response TrainMultivariateModel(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(modelInfo, nameof(modelInfo)); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.TrainMultivariateModel"); + scope.Start(); + try + { + Argument.AssertNotNull(content, nameof(content)); - using RequestContent content = modelInfo.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await TrainMultivariateModelAsync(content, context).ConfigureAwait(false); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); + using HttpMessage message = CreateTrainMultivariateModelRequest(content, context); + return Pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } - /// Train a Multivariate Anomaly Detection Model. - /// Model information. - /// The cancellation token to use. - /// is null. - /// - /// Create and train a multivariate anomaly detection model. The request must + /// + /// [Protocol Method] Create and train a multivariate anomaly detection model. The request must /// include a source parameter to indicate an Azure Blob /// Storage URI that's accessible to the service. There are two types of data input. The Blob Storage URI can point to an Azure Blob /// Storage folder that contains multiple CSV files, where each CSV file has @@ -197,49 +179,27 @@ public virtual async Task> TrainMultivariateMode /// training process happens asynchronously. To check the training status, call /// GetMultivariateModel with the modelId value and check the status field in the /// modelInfo object. - /// - /// - public virtual Response TrainMultivariateModel(ModelInfo modelInfo, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(modelInfo, nameof(modelInfo)); - - using RequestContent content = modelInfo.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = TrainMultivariateModel(content, context); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); - } - - /// - /// [Protocol Method] Train a Multivariate Anomaly Detection Model /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// public virtual async Task TrainMultivariateModelAsync(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.TrainMultivariateModel"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.TrainMultivariateModel"); scope.Start(); try { + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateTrainMultivariateModelRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -249,72 +209,133 @@ public virtual async Task TrainMultivariateModelAsync(RequestContent c } /// - /// [Protocol Method] Train a Multivariate Anomaly Detection Model + /// Create and train a multivariate anomaly detection model. The request must + /// include a source parameter to indicate an Azure Blob + /// Storage URI that's accessible to the service. There are two types of data input. The Blob Storage URI can point to an Azure Blob + /// Storage folder that contains multiple CSV files, where each CSV file has + /// two columns, time stamp and variable. Or the Blob Storage URI can point to a single blob that contains a CSV file that has all the variables and a + /// time stamp column. + /// The model object will be created and returned in the response, but the + /// training process happens asynchronously. To check the training status, call + /// GetMultivariateModel with the modelId value and check the status field in the + /// modelInfo object. + /// + /// Model information. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual Response TrainMultivariateModel(ModelInfo modelInfo, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(modelInfo, nameof(modelInfo)); + + Response result = TrainMultivariateModel(modelInfo, cancellationToken.ToRequestContext()); + return Response.FromValue((AnomalyDetectionModel)result, result); + } + + /// + /// Create and train a multivariate anomaly detection model. The request must + /// include a source parameter to indicate an Azure Blob + /// Storage URI that's accessible to the service. There are two types of data input. The Blob Storage URI can point to an Azure Blob + /// Storage folder that contains multiple CSV files, where each CSV file has + /// two columns, time stamp and variable. Or the Blob Storage URI can point to a single blob that contains a CSV file that has all the variables and a + /// time stamp column. + /// The model object will be created and returned in the response, but the + /// training process happens asynchronously. To check the training status, call + /// GetMultivariateModel with the modelId value and check the status field in the + /// modelInfo object. + /// + /// Model information. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task> TrainMultivariateModelAsync(ModelInfo modelInfo, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(modelInfo, nameof(modelInfo)); + + Response result = await TrainMultivariateModelAsync(modelInfo, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((AnomalyDetectionModel)result, result); + } + + /// + /// [Protocol Method] List models of a resource. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// + /// + /// + /// The number of result items to skip. + /// The number of result items to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + public virtual Pageable GetMultivariateModels(int? skip, int? maxCount, RequestContext context) + { + return new MultivariateGetMultivariateModelsCollectionResult(this, skip, maxCount, context); + } + + /// + /// [Protocol Method] List models of a resource. + /// /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. + /// The number of result items to skip. + /// The number of result items to return. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response TrainMultivariateModel(RequestContent content, RequestContext context = null) + public virtual AsyncPageable GetMultivariateModelsAsync(int? skip, int? maxCount, RequestContext context) { - Argument.AssertNotNull(content, nameof(content)); + return new MultivariateGetMultivariateModelsAsyncCollectionResult(this, skip, maxCount, context); + } - using var scope = ClientDiagnostics.CreateScope("Multivariate.TrainMultivariateModel"); - scope.Start(); - try - { - using HttpMessage message = CreateTrainMultivariateModelRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + /// List models of a resource. + /// The number of result items to skip. + /// The number of result items to return. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual Pageable GetMultivariateModels(int? skip = default, int? maxCount = default, CancellationToken cancellationToken = default) + { + return new MultivariateGetMultivariateModelsCollectionResultOfT(this, skip, maxCount, cancellationToken.ToRequestContext()); + } + + /// List models of a resource. + /// The number of result items to skip. + /// The number of result items to return. + /// The cancellation token that can be used to cancel the operation. + /// Service returned a non-success status code. + public virtual AsyncPageable GetMultivariateModelsAsync(int? skip = default, int? maxCount = default, CancellationToken cancellationToken = default) + { + return new MultivariateGetMultivariateModelsAsyncCollectionResultOfT(this, skip, maxCount, cancellationToken.ToRequestContext()); } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Delete Multivariate Model + /// [Protocol Method] Delete an existing multivariate model according to the modelId value. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DeleteMultivariateModelAsync(string modelId, RequestContext context = null) + public virtual Response DeleteMultivariateModel(string modelId, RequestContext context) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.DeleteMultivariateModel"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.DeleteMultivariateModel"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + using HttpMessage message = CreateDeleteMultivariateModelRequest(modelId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -323,34 +344,30 @@ public virtual async Task DeleteMultivariateModelAsync(string modelId, } } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Delete Multivariate Model + /// [Protocol Method] Delete an existing multivariate model according to the modelId value. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DeleteMultivariateModel(string modelId, RequestContext context = null) + public virtual async Task DeleteMultivariateModelAsync(string modelId, RequestContext context) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.DeleteMultivariateModel"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.DeleteMultivariateModel"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + using HttpMessage message = CreateDeleteMultivariateModelRequest(modelId, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -359,76 +376,57 @@ public virtual Response DeleteMultivariateModel(string modelId, RequestContext c } } - /// Get Multivariate Model. + /// Delete an existing multivariate model according to the modelId value. /// Model identifier. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// is null. /// is an empty string, and was expected to be non-empty. - /// - /// Get detailed information about the multivariate model, including the training status - /// and variables used in the model. - /// - /// - public virtual async Task> GetMultivariateModelAsync(string modelId, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Response DeleteMultivariateModel(string modelId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetMultivariateModelAsync(modelId, context).ConfigureAwait(false); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); + return DeleteMultivariateModel(modelId, cancellationToken.ToRequestContext()); } - /// Get Multivariate Model. + /// Delete an existing multivariate model according to the modelId value. /// Model identifier. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// is null. /// is an empty string, and was expected to be non-empty. - /// - /// Get detailed information about the multivariate model, including the training status - /// and variables used in the model. - /// - /// - public virtual Response GetMultivariateModel(string modelId, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual async Task DeleteMultivariateModelAsync(string modelId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetMultivariateModel(modelId, context); - return Response.FromValue(AnomalyDetectionModel.FromResponse(response), response); + return await DeleteMultivariateModelAsync(modelId, cancellationToken.ToRequestContext()).ConfigureAwait(false); } /// - /// [Protocol Method] Get Multivariate Model + /// [Protocol Method] Get detailed information about the multivariate model, including the training status + /// and variables used in the model. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetMultivariateModelAsync(string modelId, RequestContext context) + public virtual Response GetMultivariateModel(string modelId, RequestContext context) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModel"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModel"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + using HttpMessage message = CreateGetMultivariateModelRequest(modelId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -438,37 +436,30 @@ public virtual async Task GetMultivariateModelAsync(string modelId, Re } /// - /// [Protocol Method] Get Multivariate Model + /// [Protocol Method] Get detailed information about the multivariate model, including the training status + /// and variables used in the model. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetMultivariateModel(string modelId, RequestContext context) + public virtual async Task GetMultivariateModelAsync(string modelId, RequestContext context) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModel"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.GetMultivariateModel"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + using HttpMessage message = CreateGetMultivariateModelRequest(modelId, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -477,92 +468,71 @@ public virtual Response GetMultivariateModel(string modelId, RequestContext cont } } - /// Detect Multivariate Anomaly. + /// + /// Get detailed information about the multivariate model, including the training status + /// and variables used in the model. + /// /// Model identifier. - /// Request of multivariate anomaly detection. - /// The cancellation token to use. - /// or is null. + /// The cancellation token that can be used to cancel the operation. + /// is null. /// is an empty string, and was expected to be non-empty. - /// - /// Submit a multivariate anomaly detection task with the modelId value of a trained model - /// and inference data. The input schema should be the same with the training - /// request. The request will finish asynchronously and return a resultId value to - /// query the detection result. The request should be a source link to indicate an - /// externally accessible Azure Storage URI that either points to an Azure Blob - /// Storage folder or points to a CSV file in Azure Blob Storage. - /// - /// - public virtual async Task> DetectMultivariateBatchAnomalyAsync(string modelId, MultivariateBatchDetectionOptions options, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Response GetMultivariateModel(string modelId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - Argument.AssertNotNull(options, nameof(options)); - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectMultivariateBatchAnomalyAsync(modelId, content, context).ConfigureAwait(false); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); + Response result = GetMultivariateModel(modelId, cancellationToken.ToRequestContext()); + return Response.FromValue((AnomalyDetectionModel)result, result); } - /// Detect Multivariate Anomaly. + /// + /// Get detailed information about the multivariate model, including the training status + /// and variables used in the model. + /// /// Model identifier. - /// Request of multivariate anomaly detection. - /// The cancellation token to use. - /// or is null. + /// The cancellation token that can be used to cancel the operation. + /// is null. /// is an empty string, and was expected to be non-empty. - /// - /// Submit a multivariate anomaly detection task with the modelId value of a trained model - /// and inference data. The input schema should be the same with the training - /// request. The request will finish asynchronously and return a resultId value to - /// query the detection result. The request should be a source link to indicate an - /// externally accessible Azure Storage URI that either points to an Azure Blob - /// Storage folder or points to a CSV file in Azure Blob Storage. - /// - /// - public virtual Response DetectMultivariateBatchAnomaly(string modelId, MultivariateBatchDetectionOptions options, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual async Task> GetMultivariateModelAsync(string modelId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - Argument.AssertNotNull(options, nameof(options)); - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectMultivariateBatchAnomaly(modelId, content, context); - return Response.FromValue(MultivariateDetectionResult.FromResponse(response), response); + Response result = await GetMultivariateModelAsync(modelId, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((AnomalyDetectionModel)result, result); } /// - /// [Protocol Method] Detect Multivariate Anomaly + /// [Protocol Method] Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The input schema should be the same with the training + /// request. The request will finish asynchronously and return a resultId value to + /// query the detection result. The request should be a source link to indicate an + /// externally accessible Azure Storage URI that either points to an Azure Blob + /// Storage folder or points to a CSV file in Azure Blob Storage. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DetectMultivariateBatchAnomalyAsync(string modelId, RequestContent content, RequestContext context = null) + public virtual Response DetectMultivariateBatchAnomaly(string modelId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateBatchAnomaly"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateBatchAnomaly"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectMultivariateBatchAnomalyRequest(modelId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -572,39 +542,36 @@ public virtual async Task DetectMultivariateBatchAnomalyAsync(string m } /// - /// [Protocol Method] Detect Multivariate Anomaly + /// [Protocol Method] Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The input schema should be the same with the training + /// request. The request will finish asynchronously and return a resultId value to + /// query the detection result. The request should be a source link to indicate an + /// externally accessible Azure Storage URI that either points to an Azure Blob + /// Storage folder or points to a CSV file in Azure Blob Storage. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DetectMultivariateBatchAnomaly(string modelId, RequestContent content, RequestContext context = null) + public virtual async Task DetectMultivariateBatchAnomalyAsync(string modelId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateBatchAnomaly"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateBatchAnomaly"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectMultivariateBatchAnomalyRequest(modelId, content, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -613,88 +580,81 @@ public virtual Response DetectMultivariateBatchAnomaly(string modelId, RequestCo } } - /// Detect anomalies in the last point of the request body. + /// + /// Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The input schema should be the same with the training + /// request. The request will finish asynchronously and return a resultId value to + /// query the detection result. The request should be a source link to indicate an + /// externally accessible Azure Storage URI that either points to an Azure Blob + /// Storage folder or points to a CSV file in Azure Blob Storage. + /// /// Model identifier. - /// Request of the last detection. - /// The cancellation token to use. + /// Request of multivariate anomaly detection. + /// The cancellation token that can be used to cancel the operation. /// or is null. /// is an empty string, and was expected to be non-empty. - /// - /// Submit a multivariate anomaly detection task with the modelId value of a trained model - /// and inference data. The inference data should be put into the request body in - /// JSON format. The request will finish synchronously and return the detection - /// immediately in the response body. - /// - /// - public virtual async Task> DetectMultivariateLastAnomalyAsync(string modelId, MultivariateLastDetectionOptions options, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Response DetectMultivariateBatchAnomaly(string modelId, MultivariateBatchDetectionOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); Argument.AssertNotNull(options, nameof(options)); - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectMultivariateLastAnomalyAsync(modelId, content, context).ConfigureAwait(false); - return Response.FromValue(MultivariateLastDetectionResult.FromResponse(response), response); + Response result = DetectMultivariateBatchAnomaly(modelId, options, cancellationToken.ToRequestContext()); + return Response.FromValue((MultivariateDetectionResult)result, result); } - /// Detect anomalies in the last point of the request body. + /// + /// Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The input schema should be the same with the training + /// request. The request will finish asynchronously and return a resultId value to + /// query the detection result. The request should be a source link to indicate an + /// externally accessible Azure Storage URI that either points to an Azure Blob + /// Storage folder or points to a CSV file in Azure Blob Storage. + /// /// Model identifier. - /// Request of the last detection. - /// The cancellation token to use. + /// Request of multivariate anomaly detection. + /// The cancellation token that can be used to cancel the operation. /// or is null. /// is an empty string, and was expected to be non-empty. - /// - /// Submit a multivariate anomaly detection task with the modelId value of a trained model - /// and inference data. The inference data should be put into the request body in - /// JSON format. The request will finish synchronously and return the detection - /// immediately in the response body. - /// - /// - public virtual Response DetectMultivariateLastAnomaly(string modelId, MultivariateLastDetectionOptions options, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual async Task> DetectMultivariateBatchAnomalyAsync(string modelId, MultivariateBatchDetectionOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); Argument.AssertNotNull(options, nameof(options)); - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectMultivariateLastAnomaly(modelId, content, context); - return Response.FromValue(MultivariateLastDetectionResult.FromResponse(response), response); + Response result = await DetectMultivariateBatchAnomalyAsync(modelId, options, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((MultivariateDetectionResult)result, result); } /// - /// [Protocol Method] Detect anomalies in the last point of the request body + /// [Protocol Method] Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The inference data should be put into the request body in + /// JSON format. The request will finish synchronously and return the detection + /// immediately in the response body. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DetectMultivariateLastAnomalyAsync(string modelId, RequestContent content, RequestContext context = null) + public virtual Response DetectMultivariateLastAnomaly(string modelId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateLastAnomaly"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateLastAnomaly"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectMultivariateLastAnomalyRequest(modelId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -704,39 +664,34 @@ public virtual async Task DetectMultivariateLastAnomalyAsync(string mo } /// - /// [Protocol Method] Detect anomalies in the last point of the request body + /// [Protocol Method] Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The inference data should be put into the request body in + /// JSON format. The request will finish synchronously and return the detection + /// immediately in the response body. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// Model identifier. /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DetectMultivariateLastAnomaly(string modelId, RequestContent content, RequestContext context = null) + public virtual async Task DetectMultivariateLastAnomalyAsync(string modelId, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateLastAnomaly"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Multivariate.DetectMultivariateLastAnomaly"); scope.Start(); try { + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectMultivariateLastAnomalyRequest(modelId, content, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -745,248 +700,46 @@ public virtual Response DetectMultivariateLastAnomaly(string modelId, RequestCon } } - /// List Multivariate Models. - /// The number of result items to skip. - /// The number of result items to return. - /// The cancellation token to use. - /// List models of a resource. - /// - public virtual AsyncPageable GetMultivariateModelsAsync(int? skip = null, int? maxCount = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMultivariateModelsRequest(skip, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMultivariateModelsNextPageRequest(nextLink, skip, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => AnomalyDetectionModel.DeserializeAnomalyDetectionModel(e), ClientDiagnostics, _pipeline, "Multivariate.GetMultivariateModels", "models", "nextLink", context); - } - - /// List Multivariate Models. - /// The number of result items to skip. - /// The number of result items to return. - /// The cancellation token to use. - /// List models of a resource. - /// - public virtual Pageable GetMultivariateModels(int? skip = null, int? maxCount = null, CancellationToken cancellationToken = default) - { - RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMultivariateModelsRequest(skip, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMultivariateModelsNextPageRequest(nextLink, skip, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => AnomalyDetectionModel.DeserializeAnomalyDetectionModel(e), ClientDiagnostics, _pipeline, "Multivariate.GetMultivariateModels", "models", "nextLink", context); - } - /// - /// [Protocol Method] List Multivariate Models - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// + /// Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The inference data should be put into the request body in + /// JSON format. The request will finish synchronously and return the detection + /// immediately in the response body. /// - /// The number of result items to skip. - /// The number of result items to return. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Model identifier. + /// Request of the last detection. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetMultivariateModelsAsync(int? skip, int? maxCount, RequestContext context) + public virtual Response DetectMultivariateLastAnomaly(string modelId, MultivariateLastDetectionOptions options, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMultivariateModelsRequest(skip, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMultivariateModelsNextPageRequest(nextLink, skip, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Multivariate.GetMultivariateModels", "models", "nextLink", context); + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + Argument.AssertNotNull(options, nameof(options)); + + Response result = DetectMultivariateLastAnomaly(modelId, options, cancellationToken.ToRequestContext()); + return Response.FromValue((MultivariateLastDetectionResult)result, result); } /// - /// [Protocol Method] List Multivariate Models - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// + /// Submit a multivariate anomaly detection task with the modelId value of a trained model + /// and inference data. The inference data should be put into the request body in + /// JSON format. The request will finish synchronously and return the detection + /// immediately in the response body. /// - /// The number of result items to skip. - /// The number of result items to return. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Model identifier. + /// Request of the last detection. + /// The cancellation token that can be used to cancel the operation. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetMultivariateModels(int? skip, int? maxCount, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMultivariateModelsRequest(skip, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMultivariateModelsNextPageRequest(nextLink, skip, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "Multivariate.GetMultivariateModels", "models", "nextLink", context); - } - - internal HttpMessage CreateGetMultivariateBatchDetectionResultRequest(Guid resultId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/multivariate/detect-batch/", false); - uri.AppendPath(resultId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateTrainMultivariateModelRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier201); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/multivariate/models", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetMultivariateModelsRequest(int? skip, int? maxCount, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/multivariate/models", false); - if (skip != null) - { - uri.AppendQuery("skip", skip.Value, true); - } - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateDeleteMultivariateModelRequest(string modelId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/multivariate/models/", false); - uri.AppendPath(modelId, true); - request.Uri = uri; - return message; - } - - internal HttpMessage CreateGetMultivariateModelRequest(string modelId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/multivariate/models/", false); - uri.AppendPath(modelId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateDetectMultivariateBatchAnomalyRequest(string modelId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier202); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/multivariate/models/", false); - uri.AppendPath(modelId, true); - uri.AppendPath(":detect-batch", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateDetectMultivariateLastAnomalyRequest(string modelId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/multivariate/models/", false); - uri.AppendPath(modelId, true); - uri.AppendPath(":detect-last", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetMultivariateModelsNextPageRequest(string nextLink, int? skip, int? maxCount, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + public virtual async Task> DetectMultivariateLastAnomalyAsync(string modelId, MultivariateLastDetectionOptions options, CancellationToken cancellationToken = default) { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } + Argument.AssertNotNullOrEmpty(modelId, nameof(modelId)); + Argument.AssertNotNull(options, nameof(options)); - return new RequestContext() { CancellationToken = cancellationToken }; + Response result = await DetectMultivariateLastAnomalyAsync(modelId, options, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((MultivariateLastDetectionResult)result, result); } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - private static ResponseClassifier _responseClassifier201; - private static ResponseClassifier ResponseClassifier201 => _responseClassifier201 ??= new StatusCodeClassifier(stackalloc ushort[] { 201 }); - private static ResponseClassifier _responseClassifier204; - private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); - private static ResponseClassifier _responseClassifier202; - private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.Serialization.cs deleted file mode 100644 index 10bc44ab6d1e..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateBatchDetectionOptions.Serialization.cs +++ /dev/null @@ -1,173 +0,0 @@ -// 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.Core; - -namespace Azure.AI.AnomalyDetector -{ - public partial class MultivariateBatchDetectionOptions : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(MultivariateBatchDetectionOptions)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("dataSource"u8); - writer.WriteStringValue(DataSource.AbsoluteUri); - if (Optional.IsDefined(TopContributorCount)) - { - writer.WritePropertyName("topContributorCount"u8); - writer.WriteNumberValue(TopContributorCount.Value); - } - writer.WritePropertyName("startTime"u8); - writer.WriteStringValue(StartTime, "O"); - writer.WritePropertyName("endTime"u8); - writer.WriteStringValue(EndTime, "O"); - 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, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MultivariateBatchDetectionOptions 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(MultivariateBatchDetectionOptions)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMultivariateBatchDetectionOptions(document.RootElement, options); - } - - internal static MultivariateBatchDetectionOptions DeserializeMultivariateBatchDetectionOptions(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Uri dataSource = default; - int? topContributorCount = default; - DateTimeOffset startTime = default; - DateTimeOffset endTime = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("dataSource"u8)) - { - dataSource = new Uri(property.Value.GetString()); - continue; - } - if (property.NameEquals("topContributorCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - topContributorCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("startTime"u8)) - { - startTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("endTime"u8)) - { - endTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MultivariateBatchDetectionOptions(dataSource, topContributorCount, startTime, endTime, 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(MultivariateBatchDetectionOptions)} does not support writing '{options.Format}' format."); - } - } - - MultivariateBatchDetectionOptions 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, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateBatchDetectionOptions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MultivariateBatchDetectionOptions)} 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 MultivariateBatchDetectionOptions FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeMultivariateBatchDetectionOptions(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.cs deleted file mode 100644 index f3b889179b65..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateDetectionResult.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.AI.AnomalyDetector -{ - /// Detection results for the resultId value. - public partial class MultivariateDetectionResult - { - /// - /// 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 . - /// Result identifier that's used to fetch the results of an inference call. - /// Multivariate anomaly detection status. - /// Detection result for each time stamp. - /// or is null. - internal MultivariateDetectionResult(Guid resultId, MultivariateBatchDetectionResultSummary summary, IEnumerable results) - { - Argument.AssertNotNull(summary, nameof(summary)); - Argument.AssertNotNull(results, nameof(results)); - - ResultId = resultId; - Summary = summary; - Results = results.ToList(); - } - - /// Initializes a new instance of . - /// Result identifier that's used to fetch the results of an inference call. - /// Multivariate anomaly detection status. - /// Detection result for each time stamp. - /// Keeps track of any properties unknown to the library. - internal MultivariateDetectionResult(Guid resultId, MultivariateBatchDetectionResultSummary summary, IReadOnlyList results, IDictionary serializedAdditionalRawData) - { - ResultId = resultId; - Summary = summary; - Results = results; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal MultivariateDetectionResult() - { - } - - /// Result identifier that's used to fetch the results of an inference call. - public Guid ResultId { get; } - /// Multivariate anomaly detection status. - public MultivariateBatchDetectionResultSummary Summary { get; } - /// Detection result for each time stamp. - public IReadOnlyList Results { get; } - } -} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.cs deleted file mode 100644 index be55f168d87c..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/MultivariateLastDetectionResult.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.AnomalyDetector -{ - /// Results of the last detection. - public partial class MultivariateLastDetectionResult - { - /// - /// 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 . - internal MultivariateLastDetectionResult() - { - VariableStates = new ChangeTrackingList(); - Results = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Variable status. - /// Anomaly status and information. - /// Keeps track of any properties unknown to the library. - internal MultivariateLastDetectionResult(IReadOnlyList variableStates, IReadOnlyList results, IDictionary serializedAdditionalRawData) - { - VariableStates = variableStates; - Results = results; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Variable status. - public IReadOnlyList VariableStates { get; } - /// Anomaly status and information. - public IReadOnlyList Results { get; } - } -} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.Serialization.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.Serialization.cs deleted file mode 100644 index e8bef88673a5..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.Serialization.cs +++ /dev/null @@ -1,157 +0,0 @@ -// 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.Core; - -namespace Azure.AI.AnomalyDetector -{ - public partial class TimeSeriesPoint : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(TimeSeriesPoint)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Timestamp)) - { - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp.Value, "O"); - } - writer.WritePropertyName("value"u8); - writer.WriteNumberValue(Value); - 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, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - TimeSeriesPoint 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(TimeSeriesPoint)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTimeSeriesPoint(document.RootElement, options); - } - - internal static TimeSeriesPoint DeserializeTimeSeriesPoint(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset? timestamp = default; - float value = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("timestamp"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("value"u8)) - { - value = property.Value.GetSingle(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new TimeSeriesPoint(timestamp, value, 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, AzureAIAnomalyDetectorContext.Default); - default: - throw new FormatException($"The model {nameof(TimeSeriesPoint)} does not support writing '{options.Format}' format."); - } - } - - TimeSeriesPoint 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, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeTimeSeriesPoint(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(TimeSeriesPoint)} 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 TimeSeriesPoint FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeTimeSeriesPoint(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/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.cs deleted file mode 100644 index a98b2c8e60a0..000000000000 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/TimeSeriesPoint.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.AnomalyDetector -{ - /// Definition of input time series points. - public partial class TimeSeriesPoint - { - /// - /// 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 . - /// Measurement of that point. - public TimeSeriesPoint(float value) - { - Value = value; - } - - /// Initializes a new instance of . - /// Argument that indicates the time stamp of a data point (ISO8601 format). - /// Measurement of that point. - /// Keeps track of any properties unknown to the library. - internal TimeSeriesPoint(DateTimeOffset? timestamp, float value, IDictionary serializedAdditionalRawData) - { - Timestamp = timestamp; - Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal TimeSeriesPoint() - { - } - - /// Argument that indicates the time stamp of a data point (ISO8601 format). - public DateTimeOffset? Timestamp { get; set; } - /// Measurement of that point. - public float Value { get; } - } -} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Univariate.RestClient.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Univariate.RestClient.cs new file mode 100644 index 000000000000..beda733b8701 --- /dev/null +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Univariate.RestClient.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; + +namespace Azure.AI.AnomalyDetector +{ + /// + public partial class Univariate + { + private static ResponseClassifier _pipelineMessageClassifier200; + + private static ResponseClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + + internal HttpMessage CreateDetectUnivariateEntireSeriesRequest(RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/timeseries/entire/detect", false); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDetectUnivariateLastPointRequest(RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/timeseries/last/detect", false); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDetectUnivariateChangePointRequest(RequestContent content, RequestContext context) + { + RawRequestUriBuilder uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/anomalydetector/", false); + uri.AppendPath(_apiVersion, true); + uri.AppendPath("/timeseries/changepoint/detect", false); + HttpMessage message = Pipeline.CreateMessage(context, PipelineMessageClassifier200); + Request request = message.Request; + request.Uri = uri; + request.Method = RequestMethod.Post; + request.Headers.SetValue("Content-Type", "application/json"); + request.Headers.SetValue("Accept", "application/json"); + request.Content = content; + return message; + } + } +} diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Univariate.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Univariate.cs index 1d46f1556c11..8a790227bc45 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Univariate.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/src/Generated/Univariate.cs @@ -8,76 +8,68 @@ using System; using System.Threading; using System.Threading.Tasks; +using Azure; using Azure.Core; using Azure.Core.Pipeline; namespace Azure.AI.AnomalyDetector { - // Data plane generated sub-client. /// The Univariate sub-client. public partial class Univariate { - private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; - private readonly AzureKeyCredential _keyCredential; - private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - /// Initializes a new instance of Univariate for mocking. protected Univariate() { } /// Initializes a new instance of Univariate. - /// The handler for diagnostic messaging in the client. + /// The ClientDiagnostics is used to provide tracing support for the client library. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The key credential to copy. - /// - /// Supported Azure Cognitive Services endpoints (protocol and host name, such as - /// https://westus2.api.cognitive.microsoft.com). - /// - /// Api Version. Allowed values: "v1.1". - internal Univariate(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, Uri endpoint, string apiVersion) + /// Service endpoint. + /// + internal Univariate(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint, string apiVersion) { ClientDiagnostics = clientDiagnostics; - _pipeline = pipeline; - _keyCredential = keyCredential; _endpoint = endpoint; + Pipeline = pipeline; _apiVersion = apiVersion; } + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get; } + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + /// - /// [Protocol Method] Detect anomalies for the entire series in batch. + /// [Protocol Method] This operation generates a model with an entire series. Each point is detected + /// with the same model. With this method, points before and after a certain point + /// are used to determine whether it's an anomaly. The entire detection can give the + /// user an overall status of the time series. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DetectUnivariateEntireSeriesAsync(RequestContent content, RequestContext context = null) + public virtual Response DetectUnivariateEntireSeries(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateEntireSeries"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateEntireSeries"); scope.Start(); try { + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectUnivariateEntireSeriesRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -87,31 +79,31 @@ public virtual async Task DetectUnivariateEntireSeriesAsync(RequestCon } /// - /// [Protocol Method] Detect anomalies for the entire series in batch. + /// [Protocol Method] This operation generates a model with an entire series. Each point is detected + /// with the same model. With this method, points before and after a certain point + /// are used to determine whether it's an anomaly. The entire detection can give the + /// user an overall status of the time series. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DetectUnivariateEntireSeries(RequestContent content, RequestContext context = null) + public virtual async Task DetectUnivariateEntireSeriesAsync(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateEntireSeries"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateEntireSeries"); scope.Start(); try { + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectUnivariateEntireSeriesRequest(content, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -120,75 +112,30 @@ public virtual Response DetectUnivariateEntireSeries(RequestContent content, Req } } - /// Detect anomaly status of the latest point in time series. - /// Method of univariate anomaly detection. - /// The cancellation token to use. - /// is null. - /// - /// This operation generates a model by using the points that you sent in to the API - /// and based on all data to determine whether the last point is anomalous. - /// - /// - public virtual async Task> DetectUnivariateLastPointAsync(UnivariateDetectionOptions options, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(options, nameof(options)); - - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectUnivariateLastPointAsync(content, context).ConfigureAwait(false); - return Response.FromValue(UnivariateLastDetectionResult.FromResponse(response), response); - } - - /// Detect anomaly status of the latest point in time series. - /// Method of univariate anomaly detection. - /// The cancellation token to use. - /// is null. - /// - /// This operation generates a model by using the points that you sent in to the API - /// and based on all data to determine whether the last point is anomalous. - /// - /// - public virtual Response DetectUnivariateLastPoint(UnivariateDetectionOptions options, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(options, nameof(options)); - - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectUnivariateLastPoint(content, context); - return Response.FromValue(UnivariateLastDetectionResult.FromResponse(response), response); - } - /// - /// [Protocol Method] Detect anomaly status of the latest point in time series. + /// [Protocol Method] This operation generates a model by using the points that you sent in to the API + /// and based on all data to determine whether the last point is anomalous. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DetectUnivariateLastPointAsync(RequestContent content, RequestContext context = null) + public virtual Response DetectUnivariateLastPoint(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateLastPoint"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateLastPoint"); scope.Start(); try { + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectUnivariateLastPointRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -198,36 +145,29 @@ public virtual async Task DetectUnivariateLastPointAsync(RequestConten } /// - /// [Protocol Method] Detect anomaly status of the latest point in time series. + /// [Protocol Method] This operation generates a model by using the points that you sent in to the API + /// and based on all data to determine whether the last point is anomalous. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DetectUnivariateLastPoint(RequestContent content, RequestContext context = null) + public virtual async Task DetectUnivariateLastPointAsync(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateLastPoint"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateLastPoint"); scope.Start(); try { + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectUnivariateLastPointRequest(content, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -236,69 +176,61 @@ public virtual Response DetectUnivariateLastPoint(RequestContent content, Reques } } - /// Detect change point for the entire series. + /// + /// This operation generates a model by using the points that you sent in to the API + /// and based on all data to determine whether the last point is anomalous. + /// /// Method of univariate anomaly detection. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// is null. - /// Evaluate the change point score of every series point. - /// - public virtual async Task> DetectUnivariateChangePointAsync(UnivariateChangePointDetectionOptions options, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual Response DetectUnivariateLastPoint(UnivariateDetectionOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(options, nameof(options)); - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await DetectUnivariateChangePointAsync(content, context).ConfigureAwait(false); - return Response.FromValue(UnivariateChangePointDetectionResult.FromResponse(response), response); + Response result = DetectUnivariateLastPoint(options, cancellationToken.ToRequestContext()); + return Response.FromValue((UnivariateLastDetectionResult)result, result); } - /// Detect change point for the entire series. + /// + /// This operation generates a model by using the points that you sent in to the API + /// and based on all data to determine whether the last point is anomalous. + /// /// Method of univariate anomaly detection. - /// The cancellation token to use. + /// The cancellation token that can be used to cancel the operation. /// is null. - /// Evaluate the change point score of every series point. - /// - public virtual Response DetectUnivariateChangePoint(UnivariateChangePointDetectionOptions options, CancellationToken cancellationToken = default) + /// Service returned a non-success status code. + public virtual async Task> DetectUnivariateLastPointAsync(UnivariateDetectionOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(options, nameof(options)); - using RequestContent content = options.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = DetectUnivariateChangePoint(content, context); - return Response.FromValue(UnivariateChangePointDetectionResult.FromResponse(response), response); + Response result = await DetectUnivariateLastPointAsync(options, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((UnivariateLastDetectionResult)result, result); } /// - /// [Protocol Method] Detect change point for the entire series + /// [Protocol Method] Evaluate the change point score of every series point. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DetectUnivariateChangePointAsync(RequestContent content, RequestContext context = null) + public virtual Response DetectUnivariateChangePoint(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateChangePoint"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateChangePoint"); scope.Start(); try { + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectUnivariateChangePointRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + return Pipeline.ProcessMessage(message, context); } catch (Exception e) { @@ -308,36 +240,28 @@ public virtual async Task DetectUnivariateChangePointAsync(RequestCont } /// - /// [Protocol Method] Detect change point for the entire series + /// [Protocol Method] Evaluate the change point score of every series point. /// /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// /// /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// The request options, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DetectUnivariateChangePoint(RequestContent content, RequestContext context = null) + public virtual async Task DetectUnivariateChangePointAsync(RequestContent content, RequestContext context = null) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateChangePoint"); + using DiagnosticScope scope = ClientDiagnostics.CreateScope("Univariate.DetectUnivariateChangePoint"); scope.Start(); try { + Argument.AssertNotNull(content, nameof(content)); + using HttpMessage message = CreateDetectUnivariateChangePointRequest(content, context); - return _pipeline.ProcessMessage(message, context); + return await Pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) { @@ -346,69 +270,30 @@ public virtual Response DetectUnivariateChangePoint(RequestContent content, Requ } } - internal HttpMessage CreateDetectUnivariateEntireSeriesRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/timeseries/entire/detect", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateDetectUnivariateLastPointRequest(RequestContent content, RequestContext context) + /// Evaluate the change point score of every series point. + /// Method of univariate anomaly detection. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual Response DetectUnivariateChangePoint(UnivariateChangePointDetectionOptions options, CancellationToken cancellationToken = default) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/timeseries/last/detect", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } + Argument.AssertNotNull(options, nameof(options)); - internal HttpMessage CreateDetectUnivariateChangePointRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/anomalydetector/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/timeseries/changepoint/detect", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; + Response result = DetectUnivariateChangePoint(options, cancellationToken.ToRequestContext()); + return Response.FromValue((UnivariateChangePointDetectionResult)result, result); } - private static RequestContext DefaultRequestContext = new RequestContext(); - internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + /// Evaluate the change point score of every series point. + /// Method of univariate anomaly detection. + /// The cancellation token that can be used to cancel the operation. + /// is null. + /// Service returned a non-success status code. + public virtual async Task> DetectUnivariateChangePointAsync(UnivariateChangePointDetectionOptions options, CancellationToken cancellationToken = default) { - if (!cancellationToken.CanBeCanceled) - { - return DefaultRequestContext; - } + Argument.AssertNotNull(options, nameof(options)); - return new RequestContext() { CancellationToken = cancellationToken }; + Response result = await DetectUnivariateChangePointAsync(options, cancellationToken.ToRequestContext()).ConfigureAwait(false); + return Response.FromValue((UnivariateChangePointDetectionResult)result, result); } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); } } diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/AnomalyDetectorClient/AnomalyDetectorClientLiveTests.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/AnomalyDetectorClient/AnomalyDetectorClientLiveTests.cs index 39c97649a554..869ea1e5c0b6 100755 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/AnomalyDetectorClient/AnomalyDetectorClientLiveTests.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/AnomalyDetectorClient/AnomalyDetectorClientLiveTests.cs @@ -34,7 +34,7 @@ public async Task GetResultForEntireDetect() var request = TestData.TestPointSeries; request.MaxAnomalyRatio = 0.25F; request.Sensitivity = 95; - var response = await client.GetUnivariateClient().DetectUnivariateEntireSeriesAsync(request.ToRequestContent()); + var response = await client.GetUnivariateClient().DetectUnivariateEntireSeriesAsync(request); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Assert.IsNotNull(result.GetProperty("expectedValues")); diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Infrastructure/TestData.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Infrastructure/TestData.cs index 75f4f1e3c0a5..d9ae0c176aad 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Infrastructure/TestData.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/Infrastructure/TestData.cs @@ -327,7 +327,7 @@ internal static class TestData }, TimeGranularity.PerMinute); - public static UnivariateChangePointDetectionResult ExpectedChangePointResult = AIAnomalyDetectorModelFactory.UnivariateChangePointDetectionResult( + public static UnivariateChangePointDetectionResult ExpectedChangePointResult = AnomalyDetectorModelFactory.UnivariateChangePointDetectionResult( 0, new List { diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/samples/Sample1_DetectEntireSeriesAnomaly.cs b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/samples/Sample1_DetectEntireSeriesAnomaly.cs index fbf325a09e9a..c675ac82e190 100755 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/samples/Sample1_DetectEntireSeriesAnomaly.cs +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tests/samples/Sample1_DetectEntireSeriesAnomaly.cs @@ -58,7 +58,7 @@ public void DetectEntireSeriesAnomaly() try { - Response response = client.GetUnivariateClient().DetectUnivariateEntireSeries(request.ToRequestContent()); + Response response = client.GetUnivariateClient().DetectUnivariateEntireSeries(request); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; bool hasAnomaly = false; diff --git a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tsp-location.yaml b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tsp-location.yaml index 996c34fdc7d6..54a8dac83391 100644 --- a/sdk/anomalydetector/Azure.AI.AnomalyDetector/tsp-location.yaml +++ b/sdk/anomalydetector/Azure.AI.AnomalyDetector/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/cognitiveservices/AnomalyDetector -commit: 6267b64842af3d744c5b092a3f3beef49729ad6d +commit: c247303f0a3f231849db17a878727d923b30907e repo: Azure/azure-rest-api-specs -emitterPackageJsonPath: eng/legacy-emitter-package.json +emitterPackageJsonPath: eng/azure-typespec-http-client-csharp-emitter-package.json