From 1453a21bd1e93a9e0ac38029d9eb00d207195c6e Mon Sep 17 00:00:00 2001 From: Sahil Pawar Date: Sun, 22 Oct 2023 23:43:38 -0400 Subject: [PATCH] Revert "address comments" This reverts commit 2d41b6b2bb1503df5b61c988bf1baaa3c9a5bdee. --- .../Sample_SolutionResourceCollection.cs | 2 +- .../src/Generated/ArmSelfHelpModelFactory.cs | 2 +- .../src/Generated/Models/Confidence.cs | 54 ++++++++++++++++++ ...rialization.cs => Filter.Serialization.cs} | 6 +- .../Models/{SelfHelpFilter.cs => Filter.cs} | 10 ++-- ...zation.cs => FilterGroup.Serialization.cs} | 12 ++-- ...{SelfHelpFilterGroup.cs => FilterGroup.cs} | 14 ++--- .../Models/MetricsBasedChart.Serialization.cs | 4 +- .../src/Generated/Models/MetricsBasedChart.cs | 8 +-- .../src/Generated/Models/Name.cs | 54 ++++++++++++++++++ .../Models/ReplacementMaps.Serialization.cs | 12 ++-- .../src/Generated/Models/ReplacementMaps.cs | 10 ++-- .../src/Generated/Models/ResultType.cs | 51 +++++++++++++++++ .../Models/SearchResult.Serialization.cs | 8 +-- .../src/Generated/Models/SearchResult.cs | 6 +- ...ialization.cs => Section.Serialization.cs} | 6 +- .../Models/{SelfHelpSection.cs => Section.cs} | 10 ++-- .../Generated/Models/SelfHelpConfidence.cs | 54 ------------------ .../src/Generated/Models/SelfHelpName.cs | 54 ------------------ .../Generated/Models/SelfHelpResultType.cs | 51 ----------------- .../src/Generated/Models/SelfHelpType.cs | 57 ------------------- ...olutionResourceProperties.Serialization.cs | 6 +- .../Models/SolutionResourceProperties.cs | 6 +- .../Generated/Models/Step.Serialization.cs | 4 +- .../src/Generated/Models/Step.cs | 4 +- .../Models/TriggerCriterion.Serialization.cs | 4 +- .../src/Generated/Models/TriggerCriterion.cs | 4 +- .../src/Generated/Models/Type.cs | 57 +++++++++++++++++++ ...erialization.cs => Video.Serialization.cs} | 6 +- .../Models/{SelfHelpVideo.cs => Video.cs} | 10 ++-- ...ization.cs => VideoGroup.Serialization.cs} | 6 +- .../{SelfHelpVideoGroup.cs => VideoGroup.cs} | 10 ++-- .../src/autorest.md | 9 --- .../tests/SolutionsTests.cs | 2 +- .../tests/TroubleshooterTests.cs | 2 +- 35 files changed, 303 insertions(+), 312 deletions(-) create mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Confidence.cs rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpFilter.Serialization.cs => Filter.Serialization.cs} (88%) rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpFilter.cs => Filter.cs} (72%) rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpFilterGroup.Serialization.cs => FilterGroup.Serialization.cs} (75%) rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpFilterGroup.cs => FilterGroup.cs} (52%) create mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Name.cs create mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ResultType.cs rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpSection.Serialization.cs => Section.Serialization.cs} (89%) rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpSection.cs => Section.cs} (74%) delete mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpConfidence.cs delete mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpName.cs delete mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpResultType.cs delete mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpType.cs create mode 100644 sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Type.cs rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpVideo.Serialization.cs => Video.Serialization.cs} (88%) rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpVideo.cs => Video.cs} (68%) rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpVideoGroup.Serialization.cs => VideoGroup.Serialization.cs} (89%) rename sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/{SelfHelpVideoGroup.cs => VideoGroup.cs} (74%) diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResourceCollection.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResourceCollection.cs index 8d1b6db1070be..f7e10e8329630 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResourceCollection.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/samples/Generated/Samples/Sample_SolutionResourceCollection.cs @@ -49,7 +49,7 @@ public async Task CreateOrUpdate_SolutionCreate() { new TriggerCriterion() { -Name = SelfHelpName.SolutionId, +Name = Name.SolutionId, Value = "SolutionId1", } }, diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs index 026ffe4413919..5090caaa89963 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/ArmSelfHelpModelFactory.cs @@ -145,7 +145,7 @@ public static TroubleshooterResourceData TroubleshooterResourceData(ResourceIden /// /// The error detail. /// A new instance for mocking. - public static Step Step(string id = null, string title = null, string description = null, string guidance = null, ExecutionStatus? executionStatus = null, string executionStatusDescription = null, SelfHelpType? stepType = null, bool? isLastStep = null, IEnumerable inputs = null, AutomatedCheckResult automatedCheckResults = null, IEnumerable insights = null, ResponseError error = null) + public static Step Step(string id = null, string title = null, string description = null, string guidance = null, ExecutionStatus? executionStatus = null, string executionStatusDescription = null, Type? stepType = null, bool? isLastStep = null, IEnumerable inputs = null, AutomatedCheckResult automatedCheckResults = null, IEnumerable insights = null, ResponseError error = null) { inputs ??= new List(); insights ??= new List(); diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Confidence.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Confidence.cs new file mode 100644 index 0000000000000..2be749b95d77b --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Confidence.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Confidence of the search result. + public readonly partial struct Confidence : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Confidence(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LowValue = "Low"; + private const string MediumValue = "Medium"; + private const string HighValue = "High"; + + /// Low. + public static Confidence Low { get; } = new Confidence(LowValue); + /// Medium. + public static Confidence Medium { get; } = new Confidence(MediumValue); + /// High. + public static Confidence High { get; } = new Confidence(HighValue); + /// Determines if two values are the same. + public static bool operator ==(Confidence left, Confidence right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Confidence left, Confidence right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator Confidence(string value) => new Confidence(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Confidence other && Equals(other); + /// + public bool Equals(Confidence other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Filter.Serialization.cs similarity index 88% rename from sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.Serialization.cs rename to sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Filter.Serialization.cs index 438e7189bc36f..bc388c559f9fb 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.Serialization.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Filter.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.SelfHelp.Models { - public partial class SelfHelpFilter : IUtf8JsonSerializable + public partial class Filter : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -33,7 +33,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SelfHelpFilter DeserializeSelfHelpFilter(JsonElement element) + internal static Filter DeserializeFilter(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -60,7 +60,7 @@ internal static SelfHelpFilter DeserializeSelfHelpFilter(JsonElement element) continue; } } - return new SelfHelpFilter(name.Value, values.Value, @operator.Value); + return new Filter(name.Value, values.Value, @operator.Value); } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Filter.cs similarity index 72% rename from sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.cs rename to sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Filter.cs index 0b299ceec09b6..314f4691cc0ac 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilter.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Filter.cs @@ -8,18 +8,18 @@ namespace Azure.ResourceManager.SelfHelp.Models { /// Filter criterion. - public partial class SelfHelpFilter + public partial class Filter { - /// Initializes a new instance of SelfHelpFilter. - public SelfHelpFilter() + /// Initializes a new instance of Filter. + public Filter() { } - /// Initializes a new instance of SelfHelpFilter. + /// Initializes a new instance of Filter. /// Filter name. /// Filter values. /// Filter operator. - internal SelfHelpFilter(string name, string values, string @operator) + internal Filter(string name, string values, string @operator) { Name = name; Values = values; diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilterGroup.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.Serialization.cs similarity index 75% rename from sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilterGroup.Serialization.cs rename to sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.Serialization.cs index 42ff02cbc22b7..1ef96199f48e4 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilterGroup.Serialization.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.Serialization.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.SelfHelp.Models { - internal partial class SelfHelpFilterGroup : IUtf8JsonSerializable + internal partial class FilterGroup : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -29,13 +29,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static SelfHelpFilterGroup DeserializeSelfHelpFilterGroup(JsonElement element) + internal static FilterGroup DeserializeFilterGroup(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional> filter = default; + Optional> filter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("filter"u8)) @@ -44,16 +44,16 @@ internal static SelfHelpFilterGroup DeserializeSelfHelpFilterGroup(JsonElement e { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(SelfHelpFilter.DeserializeSelfHelpFilter(item)); + array.Add(Models.Filter.DeserializeFilter(item)); } filter = array; continue; } } - return new SelfHelpFilterGroup(Optional.ToList(filter)); + return new FilterGroup(Optional.ToList(filter)); } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilterGroup.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.cs similarity index 52% rename from sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilterGroup.cs rename to sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.cs index 3351cb0b6d405..fdbadc51d498c 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/SelfHelpFilterGroup.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/FilterGroup.cs @@ -11,22 +11,22 @@ namespace Azure.ResourceManager.SelfHelp.Models { /// Filter group. - internal partial class SelfHelpFilterGroup + internal partial class FilterGroup { - /// Initializes a new instance of SelfHelpFilterGroup. - public SelfHelpFilterGroup() + /// Initializes a new instance of FilterGroup. + public FilterGroup() { - Filter = new ChangeTrackingList(); + Filter = new ChangeTrackingList(); } - /// Initializes a new instance of SelfHelpFilterGroup. + /// Initializes a new instance of FilterGroup. /// List of filters. - internal SelfHelpFilterGroup(IList filter) + internal FilterGroup(IList filter) { Filter = filter; } /// List of filters. - public IList Filter { get; } + public IList Filter { get; } } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.Serialization.cs index 788576a64710f..3ae41aa753842 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.Serialization.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.Serialization.cs @@ -59,7 +59,7 @@ internal static MetricsBasedChart DeserializeMetricsBasedChart(JsonElement eleme Optional aggregationType = default; Optional timeSpanDuration = default; Optional title = default; - Optional filterGroup = default; + Optional filterGroup = default; Optional replacementKey = default; foreach (var property in element.EnumerateObject()) { @@ -97,7 +97,7 @@ internal static MetricsBasedChart DeserializeMetricsBasedChart(JsonElement eleme { continue; } - filterGroup = SelfHelpFilterGroup.DeserializeSelfHelpFilterGroup(property.Value); + filterGroup = FilterGroup.DeserializeFilterGroup(property.Value); continue; } if (property.NameEquals("replacementKey"u8)) diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.cs index 076a8ed8db098..182ffd2e7d254 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/MetricsBasedChart.cs @@ -25,7 +25,7 @@ public MetricsBasedChart() /// Chart title. /// Filter group. /// Place holder used in HTML Content replace control with the content. - internal MetricsBasedChart(string name, AggregationType? aggregationType, TimeSpan? timeSpanDuration, string title, SelfHelpFilterGroup filterGroup, string replacementKey) + internal MetricsBasedChart(string name, AggregationType? aggregationType, TimeSpan? timeSpanDuration, string title, FilterGroup filterGroup, string replacementKey) { Name = name; AggregationType = aggregationType; @@ -44,14 +44,14 @@ internal MetricsBasedChart(string name, AggregationType? aggregationType, TimeSp /// Chart title. public string Title { get; set; } /// Filter group. - internal SelfHelpFilterGroup FilterGroup { get; set; } + internal FilterGroup FilterGroup { get; set; } /// List of filters. - public IList Filter + public IList Filter { get { if (FilterGroup is null) - FilterGroup = new SelfHelpFilterGroup(); + FilterGroup = new FilterGroup(); return FilterGroup.Filter; } } diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Name.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Name.cs new file mode 100644 index 0000000000000..0c1ba8048c652 --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/Name.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.SelfHelp.Models +{ + /// Trigger criterion name. + public readonly partial struct Name : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Name(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SolutionIdValue = "SolutionId"; + private const string ProblemClassificationIdValue = "ProblemClassificationId"; + private const string ReplacementKeyValue = "ReplacementKey"; + + /// SolutionId. + public static Name SolutionId { get; } = new Name(SolutionIdValue); + /// ProblemClassificationId. + public static Name ProblemClassificationId { get; } = new Name(ProblemClassificationIdValue); + /// ReplacementKey. + public static Name ReplacementKey { get; } = new Name(ReplacementKeyValue); + /// Determines if two values are the same. + public static bool operator ==(Name left, Name right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Name left, Name right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator Name(string value) => new Name(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Name other && Equals(other); + /// + public bool Equals(Name other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.Serialization.cs b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.Serialization.cs index 302cd665ebe61..40fa5284c77ed 100644 --- a/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.Serialization.cs +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Models/ReplacementMaps.Serialization.cs @@ -89,8 +89,8 @@ internal static ReplacementMaps DeserializeReplacementMaps(JsonElement element) Optional> diagnostics = default; Optional> troubleshooters = default; Optional> metricsBasedCharts = default; - Optional> videos = default; - Optional> videoGroups = default; + Optional> videos = default; + Optional> videoGroups = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("webResults"u8)) @@ -155,10 +155,10 @@ internal static ReplacementMaps DeserializeReplacementMaps(JsonElement element) { continue; } - List array = new List(); + List