-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MetricsAdvisor] Overwriting patch serialization methods to support sending null (3) #22464
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.Json; | ||
using Azure.Core; | ||
|
||
namespace Azure.AI.MetricsAdvisor.Models | ||
{ | ||
/// <summary> The AnomalyAlertingConfigurationPatch. </summary> | ||
internal partial class AnomalyAlertingConfigurationPatch | ||
{ | ||
/// <summary> hook unique ids. </summary> | ||
public IList<Guid> HookIds { get; internal set; } | ||
|
||
/// <summary> Anomaly alerting configurations. </summary> | ||
public IList<MetricAlertConfiguration> MetricAlertingConfigurations { get; internal set; } | ||
|
||
/// <summary> dimensions used to split alert. </summary> | ||
public IList<string> SplitAlertByDimensions { get; internal set; } | ||
|
||
// Full qualification must be used so CodeGen skips the generation of this method. | ||
// See: https://github.com/Azure/autorest.csharp/issues/793 | ||
void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) | ||
{ | ||
writer.WriteStartObject(); | ||
writer.WriteNullStringValue("name", Name); | ||
writer.WriteNullStringValue("description", Description); | ||
if (Optional.IsDefined(CrossMetricsOperator)) | ||
{ | ||
writer.WritePropertyName("crossMetricsOperator"); | ||
writer.WriteStringValue(CrossMetricsOperator.Value.ToString()); | ||
} | ||
if (Optional.IsCollectionDefined(SplitAlertByDimensions)) | ||
{ | ||
writer.WritePropertyName("splitAlertByDimensions"); | ||
writer.WriteStartArray(); | ||
foreach (var item in SplitAlertByDimensions) | ||
{ | ||
writer.WriteStringValue(item); | ||
} | ||
writer.WriteEndArray(); | ||
} | ||
if (Optional.IsCollectionDefined(HookIds)) | ||
{ | ||
writer.WritePropertyName("hookIds"); | ||
writer.WriteStartArray(); | ||
foreach (var item in HookIds) | ||
{ | ||
writer.WriteStringValue(item); | ||
} | ||
writer.WriteEndArray(); | ||
} | ||
if (Optional.IsCollectionDefined(MetricAlertingConfigurations)) | ||
{ | ||
writer.WritePropertyName("metricAlertingConfigurations"); | ||
writer.WriteStartArray(); | ||
foreach (var item in MetricAlertingConfigurations) | ||
{ | ||
writer.WriteObjectValue(item); | ||
} | ||
writer.WriteEndArray(); | ||
} | ||
writer.WriteEndObject(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Text.Json; | ||
using Azure.Core; | ||
|
||
namespace Azure.AI.MetricsAdvisor.Models | ||
{ | ||
internal partial class EmailHookInfoPatch : IUtf8JsonSerializable | ||
{ | ||
// Full qualification must be used so CodeGen skips the generation of this method. | ||
// See: https://github.com/Azure/autorest.csharp/issues/793 | ||
void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) | ||
{ | ||
writer.WriteStartObject(); | ||
writer.WriteNullObjectValue("hookParameter", HookParameter); | ||
SerializeCommonProperties(writer); | ||
writer.WriteEndObject(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
using System.Text.Json; | ||
using Azure.Core; | ||
|
||
namespace Azure.AI.MetricsAdvisor.Models | ||
{ | ||
/// <summary> The HookInfoPatch. </summary> | ||
internal partial class HookInfoPatch | ||
{ | ||
/// <summary> hook administrators. </summary> | ||
public IList<string> Admins { get; internal set; } | ||
|
||
protected void SerializeCommonProperties(Utf8JsonWriter writer) | ||
{ | ||
writer.WritePropertyName("hookType"); | ||
writer.WriteStringValue(HookType.ToString()); | ||
writer.WriteNullStringValue("hookName", HookName); | ||
writer.WriteNullStringValue("description", Description); | ||
writer.WriteNullStringValue("externalLink", ExternalLink); | ||
if (Optional.IsCollectionDefined(Admins)) | ||
{ | ||
writer.WritePropertyName("admins"); | ||
writer.WriteStartArray(); | ||
foreach (var item in Admins) | ||
{ | ||
writer.WriteStringValue(item); | ||
} | ||
writer.WriteEndArray(); | ||
} | ||
} | ||
|
||
// Full qualification must be used so CodeGen skips the generation of this method. | ||
// See: https://github.com/Azure/autorest.csharp/issues/793 | ||
void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) | ||
{ | ||
writer.WriteStartObject(); | ||
SerializeCommonProperties(writer); | ||
writer.WriteEndObject(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sending null on this one because the service does not support this scenario. They only accept "send value" / "not send" for this property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plop. so weird