diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/CHANGELOG.md b/sdk/privatedns/Azure.ResourceManager.PrivateDns/CHANGELOG.md index 2519ccfed1667..4ad01aa7f6f2c 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/CHANGELOG.md +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/CHANGELOG.md @@ -4,6 +4,8 @@ ### Features Added +- Exposed `JsonModelWriteCore` for model serialization procedure. + ### Breaking Changes ### Bugs Fixed diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs index 251c076d80ce6..102cab18e2161 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/api/Azure.ResourceManager.PrivateDns.netstandard2.0.cs @@ -388,6 +388,7 @@ public PrivateDnsZoneData(Azure.Core.AzureLocation location) { } public long? NumberOfVirtualNetworkLinks { get { throw null; } } public long? NumberOfVirtualNetworkLinksWithRegistration { get { throw null; } } public Azure.ResourceManager.PrivateDns.Models.PrivateDnsProvisioningState? PrivateDnsProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.PrivateDnsZoneData 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.ResourceManager.PrivateDns.PrivateDnsZoneData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -469,6 +470,7 @@ public VirtualNetworkLinkData(Azure.Core.AzureLocation location) { } public bool? RegistrationEnabled { get { throw null; } set { } } public Azure.Core.ResourceIdentifier VirtualNetworkId { get { throw null; } set { } } public Azure.ResourceManager.PrivateDns.Models.VirtualNetworkLinkState? VirtualNetworkLinkState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.VirtualNetworkLinkData 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.ResourceManager.PrivateDns.VirtualNetworkLinkData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -544,6 +546,7 @@ public partial class PrivateDnsAaaaRecordInfo : System.ClientModel.Primitives.IJ { public PrivateDnsAaaaRecordInfo() { } public System.Net.IPAddress IPv6Address { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.Models.PrivateDnsAaaaRecordInfo 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.ResourceManager.PrivateDns.Models.PrivateDnsAaaaRecordInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -554,6 +557,7 @@ public partial class PrivateDnsARecordInfo : System.ClientModel.Primitives.IJson { public PrivateDnsARecordInfo() { } public System.Net.IPAddress IPv4Address { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.Models.PrivateDnsARecordInfo 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.ResourceManager.PrivateDns.Models.PrivateDnsARecordInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -565,6 +569,7 @@ public partial class PrivateDnsMXRecordInfo : System.ClientModel.Primitives.IJso public PrivateDnsMXRecordInfo() { } public string Exchange { get { throw null; } set { } } public int? Preference { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.Models.PrivateDnsMXRecordInfo 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.ResourceManager.PrivateDns.Models.PrivateDnsMXRecordInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -597,6 +602,7 @@ public partial class PrivateDnsPtrRecordInfo : System.ClientModel.Primitives.IJs { public PrivateDnsPtrRecordInfo() { } public string PtrDomainName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.Models.PrivateDnsPtrRecordInfo 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.ResourceManager.PrivateDns.Models.PrivateDnsPtrRecordInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -631,6 +637,7 @@ public PrivateDnsSoaRecordInfo() { } public long? RefreshTimeInSeconds { get { throw null; } set { } } public long? RetryTimeInSeconds { get { throw null; } set { } } public long? SerialNumber { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.Models.PrivateDnsSoaRecordInfo 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.ResourceManager.PrivateDns.Models.PrivateDnsSoaRecordInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -644,6 +651,7 @@ public PrivateDnsSrvRecordInfo() { } public int? Priority { get { throw null; } set { } } public string Target { get { throw null; } set { } } public int? Weight { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.Models.PrivateDnsSrvRecordInfo 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.ResourceManager.PrivateDns.Models.PrivateDnsSrvRecordInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -654,6 +662,7 @@ public partial class PrivateDnsTxtRecordInfo : System.ClientModel.Primitives.IJs { public PrivateDnsTxtRecordInfo() { } public System.Collections.Generic.IList Values { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.PrivateDns.Models.PrivateDnsTxtRecordInfo 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.ResourceManager.PrivateDns.Models.PrivateDnsTxtRecordInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/assets.json b/sdk/privatedns/Azure.ResourceManager.PrivateDns/assets.json index e18e119f03a60..6116559b391e6 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/assets.json +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/privatedns/Azure.ResourceManager.PrivateDns", - "Tag": "net/privatedns/Azure.ResourceManager.PrivateDns_07db91e484" + "Tag": "net/privatedns/Azure.ResourceManager.PrivateDns_cf27f609fe" } diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsARecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsARecordInfo.Serialization.cs index 7819d9ff25f6d..0ee252aae0551 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsARecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsARecordInfo.Serialization.cs @@ -20,6 +20,15 @@ public partial class PrivateDnsARecordInfo : IUtf8JsonSerializable, IJsonModel

((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") @@ -27,7 +36,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(PrivateDnsARecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(IPv4Address)) { writer.WritePropertyName("ipv4Address"u8); @@ -48,7 +56,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW #endif } } - writer.WriteEndObject(); } PrivateDnsARecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsAaaaRecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsAaaaRecordInfo.Serialization.cs index 220e9c12ee94c..42408eb03521f 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsAaaaRecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsAaaaRecordInfo.Serialization.cs @@ -20,6 +20,15 @@ public partial class PrivateDnsAaaaRecordInfo : IUtf8JsonSerializable, IJsonMode 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") @@ -27,7 +36,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(PrivateDnsAaaaRecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(IPv6Address)) { writer.WritePropertyName("ipv6Address"u8); @@ -48,7 +56,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead #endif } } - writer.WriteEndObject(); } PrivateDnsAaaaRecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsCnameRecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsCnameRecordInfo.Serialization.cs index de8a0a153aa4a..019d68e347002 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsCnameRecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsCnameRecordInfo.Serialization.cs @@ -19,6 +19,15 @@ internal partial class PrivateDnsCnameRecordInfo : IUtf8JsonSerializable, IJsonM 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") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(PrivateDnsCnameRecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Cname)) { writer.WritePropertyName("cname"u8); @@ -47,7 +55,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea #endif } } - writer.WriteEndObject(); } PrivateDnsCnameRecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsMXRecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsMXRecordInfo.Serialization.cs index 37cc341f4c0f1..d8c64f2009a4e 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsMXRecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsMXRecordInfo.Serialization.cs @@ -19,6 +19,15 @@ public partial class PrivateDnsMXRecordInfo : 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") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader throw new FormatException($"The model {nameof(PrivateDnsMXRecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Preference)) { writer.WritePropertyName("preference"u8); @@ -52,7 +60,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader #endif } } - writer.WriteEndObject(); } PrivateDnsMXRecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsPtrRecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsPtrRecordInfo.Serialization.cs index 7a25a41d3e64a..e0ff88fdca3ca 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsPtrRecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsPtrRecordInfo.Serialization.cs @@ -19,6 +19,15 @@ public partial class PrivateDnsPtrRecordInfo : 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") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(PrivateDnsPtrRecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(PtrDomainName)) { writer.WritePropertyName("ptrdname"u8); @@ -47,7 +55,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } PrivateDnsPtrRecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsRecordListResult.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsRecordListResult.Serialization.cs index b84e66471c24b..4655c33530a4a 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsRecordListResult.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsRecordListResult.Serialization.cs @@ -20,6 +20,15 @@ internal partial class PrivateDnsRecordListResult : IUtf8JsonSerializable, IJson 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") @@ -27,7 +36,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe throw new FormatException($"The model {nameof(PrivateDnsRecordListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -58,7 +66,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe #endif } } - writer.WriteEndObject(); } PrivateDnsRecordListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSoaRecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSoaRecordInfo.Serialization.cs index 342abb4275d79..260648b49651b 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSoaRecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSoaRecordInfo.Serialization.cs @@ -19,6 +19,15 @@ public partial class PrivateDnsSoaRecordInfo : 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") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(PrivateDnsSoaRecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Host)) { writer.WritePropertyName("host"u8); @@ -77,7 +85,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } PrivateDnsSoaRecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSrvRecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSrvRecordInfo.Serialization.cs index 3121ec46f32e8..74d0a70fdfb88 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSrvRecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsSrvRecordInfo.Serialization.cs @@ -19,6 +19,15 @@ public partial class PrivateDnsSrvRecordInfo : 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") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(PrivateDnsSrvRecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Priority)) { writer.WritePropertyName("priority"u8); @@ -62,7 +70,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } PrivateDnsSrvRecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsTxtRecordInfo.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsTxtRecordInfo.Serialization.cs index d7ddc39816dc7..9b1b0b5ba7c5a 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsTxtRecordInfo.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateDnsTxtRecordInfo.Serialization.cs @@ -20,6 +20,15 @@ public partial class PrivateDnsTxtRecordInfo : 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") @@ -27,7 +36,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(PrivateDnsTxtRecordInfo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Values)) { writer.WritePropertyName("value"u8); @@ -53,7 +61,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } PrivateDnsTxtRecordInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateZoneListResult.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateZoneListResult.Serialization.cs index d24bb406f940d..b0c6fcc77d105 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateZoneListResult.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/PrivateZoneListResult.Serialization.cs @@ -20,6 +20,15 @@ internal partial class PrivateZoneListResult : 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") @@ -27,7 +36,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(PrivateZoneListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -58,7 +66,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW #endif } } - writer.WriteEndObject(); } PrivateZoneListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/VirtualNetworkLinkListResult.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/VirtualNetworkLinkListResult.Serialization.cs index 3ee49705d687b..5d2bee8b7012a 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/VirtualNetworkLinkListResult.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Models/VirtualNetworkLinkListResult.Serialization.cs @@ -20,6 +20,15 @@ internal partial class VirtualNetworkLinkListResult : IUtf8JsonSerializable, IJs 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") @@ -27,7 +36,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model throw new FormatException($"The model {nameof(VirtualNetworkLinkListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -58,7 +66,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model #endif } } - writer.WriteEndObject(); } VirtualNetworkLinkListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneData.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneData.Serialization.cs index 4e4b4afaccadf..0b43055ed1670 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneData.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/PrivateDnsZoneData.Serialization.cs @@ -22,6 +22,15 @@ public partial class PrivateDnsZoneData : IUtf8JsonSerializable, IJsonModel ((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 override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -29,45 +38,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(PrivateDnsZoneData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(MaxNumberOfRecords)) @@ -111,22 +87,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WriteStringValue(InternalId); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } PrivateDnsZoneData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkData.Serialization.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkData.Serialization.cs index 3d411c2255d22..f9d612f9894f2 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkData.Serialization.cs +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/VirtualNetworkLinkData.Serialization.cs @@ -23,6 +23,15 @@ public partial class VirtualNetworkLinkData : 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 override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -30,45 +39,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader throw new FormatException($"The model {nameof(VirtualNetworkLinkData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(ETag)) { writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(VirtualNetwork)) @@ -97,22 +73,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader writer.WriteStringValue(PrivateDnsProvisioningState.Value.ToString()); } writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } VirtualNetworkLinkData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md index c7043f5f2cd2d..6d2b59ee3af7c 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md @@ -20,6 +20,7 @@ skip-csproj: true modelerfour: flatten-payloads: false use-model-reader-writer: true +use-write-core: true enable-bicep-serialization: true #mgmt-debug: