From 64cec6c4c2da77f37de77f0ff504113be6a8cd7e Mon Sep 17 00:00:00 2001 From: Wenming Liu Date: Wed, 25 Sep 2024 16:34:27 +0800 Subject: [PATCH] Enable-WriteCore-feature-for-resourceconnector (#46250) --- .../CHANGELOG.md | 2 +- ...anager.ResourceConnector.netstandard2.0.cs | 14 +++++ .../assets.json | 2 +- .../ApplianceArtifactProfile.Serialization.cs | 11 +++- ...usterUserCredentialResult.Serialization.cs | 11 +++- ...anceClusterUserKeysResult.Serialization.cs | 11 +++- ...ianceCredentialKubeconfig.Serialization.cs | 11 +++- .../ApplianceListResult.Serialization.cs | 11 +++- ...rtiesInfrastructureConfig.Serialization.cs | 11 +++- .../Models/ApplianceSshKey.Serialization.cs | 11 +++- ...ApplianceSupportedVersion.Serialization.cs | 11 +++- ...rtedVersionCatalogVersion.Serialization.cs | 11 +++- ...nCatalogVersionProperties.Serialization.cs | 11 +++- ...eSupportedVersionMetadata.Serialization.cs | 11 +++- ...anceTelemetryConfigResult.Serialization.cs | 11 +++- .../ApplianceUpgradeGraph.Serialization.cs | 11 +++- ...nceUpgradeGraphProperties.Serialization.cs | 11 +++- .../HybridConnectionConfig.Serialization.cs | 11 +++- ...ceConnectorAppliancePatch.Serialization.cs | 11 +++- ...rceConnectorApplianceData.Serialization.cs | 60 ++++--------------- .../src/autorest.md | 1 + 21 files changed, 171 insertions(+), 84 deletions(-) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/CHANGELOG.md b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/CHANGELOG.md index e741de8a0b465..26a625844bb11 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/CHANGELOG.md +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/CHANGELOG.md @@ -4,8 +4,8 @@ ### Features Added - - Enable the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. +- Exposed `JsonModelWriteCore` for model serialization procedure. ### Breaking Changes diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs index b9481a1f70b68..89e18a3522635 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/api/Azure.ResourceManager.ResourceConnector.netstandard2.0.cs @@ -27,6 +27,7 @@ public ResourceConnectorApplianceData(Azure.Core.AzureLocation location) { } public string PublicKey { get { throw null; } set { } } public Azure.ResourceManager.ResourceConnector.Models.ResourceConnectorStatus? Status { get { throw null; } } public string Version { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.ResourceConnectorApplianceData 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.ResourceConnector.ResourceConnectorApplianceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -123,6 +124,7 @@ public partial class ApplianceArtifactProfile : System.ClientModel.Primitives.IJ { internal ApplianceArtifactProfile() { } public string Endpoint { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceArtifactProfile 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.ResourceConnector.Models.ApplianceArtifactProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -134,6 +136,7 @@ public partial class ApplianceClusterUserCredentialResult : System.ClientModel.P internal ApplianceClusterUserCredentialResult() { } public Azure.ResourceManager.ResourceConnector.Models.HybridConnectionConfig HybridConnectionConfig { get { throw null; } } public System.Collections.Generic.IReadOnlyList Kubeconfigs { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceClusterUserCredentialResult 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.ResourceConnector.Models.ApplianceClusterUserCredentialResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -146,6 +149,7 @@ internal ApplianceClusterUserKeysResult() { } public System.Collections.Generic.IReadOnlyDictionary ArtifactProfiles { get { throw null; } } public System.Collections.Generic.IReadOnlyList Kubeconfigs { get { throw null; } } public System.Collections.Generic.IReadOnlyDictionary SshKeys { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceClusterUserKeysResult 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.ResourceConnector.Models.ApplianceClusterUserKeysResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -157,6 +161,7 @@ public partial class ApplianceCredentialKubeconfig : System.ClientModel.Primitiv internal ApplianceCredentialKubeconfig() { } public Azure.ResourceManager.ResourceConnector.Models.AccessProfileType? Name { get { throw null; } } public string Value { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceCredentialKubeconfig 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.ResourceConnector.Models.ApplianceCredentialKubeconfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -190,6 +195,7 @@ internal ApplianceSshKey() { } public long? ExpirationTimeStamp { get { throw null; } } public string PrivateKey { get { throw null; } } public string PublicKey { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceSshKey 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.ResourceConnector.Models.ApplianceSshKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -201,6 +207,7 @@ public partial class ApplianceSupportedVersion : System.ClientModel.Primitives.I internal ApplianceSupportedVersion() { } public Azure.ResourceManager.ResourceConnector.Models.ApplianceSupportedVersionCatalogVersion MetadataCatalogVersion { get { throw null; } } public string Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceSupportedVersion 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.ResourceConnector.Models.ApplianceSupportedVersion System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -213,6 +220,7 @@ internal ApplianceSupportedVersionCatalogVersion() { } public Azure.ResourceManager.ResourceConnector.Models.ApplianceSupportedVersionCatalogVersionProperties Data { get { throw null; } } public string Name { get { throw null; } } public string Namespace { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceSupportedVersionCatalogVersion 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.ResourceConnector.Models.ApplianceSupportedVersionCatalogVersion System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -226,6 +234,7 @@ internal ApplianceSupportedVersionCatalogVersionProperties() { } public string Catalog { get { throw null; } } public string Offer { get { throw null; } } public string Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceSupportedVersionCatalogVersionProperties 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.ResourceConnector.Models.ApplianceSupportedVersionCatalogVersionProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -236,6 +245,7 @@ public partial class ApplianceTelemetryConfigResult : System.ClientModel.Primiti { internal ApplianceTelemetryConfigResult() { } public string TelemetryInstrumentationKey { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceTelemetryConfigResult 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.ResourceConnector.Models.ApplianceTelemetryConfigResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -248,6 +258,7 @@ internal ApplianceUpgradeGraph() { } public string Id { get { throw null; } } public string Name { get { throw null; } } public Azure.ResourceManager.ResourceConnector.Models.ApplianceUpgradeGraphProperties Properties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceUpgradeGraph 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.ResourceConnector.Models.ApplianceUpgradeGraph System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -259,6 +270,7 @@ public partial class ApplianceUpgradeGraphProperties : System.ClientModel.Primit internal ApplianceUpgradeGraphProperties() { } public string ApplianceVersion { get { throw null; } } public System.Collections.Generic.IReadOnlyList SupportedVersions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ApplianceUpgradeGraphProperties 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.ResourceConnector.Models.ApplianceUpgradeGraphProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -288,6 +300,7 @@ internal HybridConnectionConfig() { } public string HybridConnectionName { get { throw null; } } public string Relay { get { throw null; } } public string Token { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.HybridConnectionConfig 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.ResourceConnector.Models.HybridConnectionConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -298,6 +311,7 @@ public partial class ResourceConnectorAppliancePatch : System.ClientModel.Primit { public ResourceConnectorAppliancePatch() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.ResourceConnector.Models.ResourceConnectorAppliancePatch 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.ResourceConnector.Models.ResourceConnectorAppliancePatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/assets.json b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/assets.json index b19e7eb7515ee..41afa01c1698f 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/assets.json +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/resourceconnector/Azure.ResourceManager.ResourceConnector", - "Tag": "net/resourceconnector/Azure.ResourceManager.ResourceConnector_9ff003c485" + "Tag": "net/resourceconnector/Azure.ResourceManager.ResourceConnector_3da3ba8a14" } diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceArtifactProfile.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceArtifactProfile.Serialization.cs index 05d8b89263d37..25a9881ce00ee 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceArtifactProfile.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceArtifactProfile.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceArtifactProfile : 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(ApplianceArtifactProfile)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Endpoint)) { writer.WritePropertyName("endpoint"u8); @@ -46,7 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead #endif } } - writer.WriteEndObject(); } ApplianceArtifactProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserCredentialResult.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserCredentialResult.Serialization.cs index 453597c3079cc..503b558f16202 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserCredentialResult.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserCredentialResult.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceClusterUserCredentialResult : IUtf8JsonSerializabl 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter write throw new FormatException($"The model {nameof(ApplianceClusterUserCredentialResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(HybridConnectionConfig)) { writer.WritePropertyName("hybridConnectionConfig"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter write #endif } } - writer.WriteEndObject(); } ApplianceClusterUserCredentialResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserKeysResult.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserKeysResult.Serialization.cs index 7ce8f704100d5..893839ca3a053 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserKeysResult.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceClusterUserKeysResult.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceClusterUserKeysResult : 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod throw new FormatException($"The model {nameof(ApplianceClusterUserKeysResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsCollectionDefined(ArtifactProfiles)) { writer.WritePropertyName("artifactProfiles"u8); @@ -73,7 +81,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod #endif } } - writer.WriteEndObject(); } ApplianceClusterUserKeysResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceCredentialKubeconfig.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceCredentialKubeconfig.Serialization.cs index a131edf366f4e..b6d1195010958 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceCredentialKubeconfig.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceCredentialKubeconfig.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceCredentialKubeconfig : IUtf8JsonSerializable, IJso 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode throw new FormatException($"The model {nameof(ApplianceCredentialKubeconfig)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode #endif } } - writer.WriteEndObject(); } ApplianceCredentialKubeconfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceListResult.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceListResult.Serialization.cs index c620428d468bf..1adae1cc70b9b 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceListResult.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class ApplianceListResult : 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(ApplianceListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri #endif } } - writer.WriteEndObject(); } ApplianceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/AppliancePropertiesInfrastructureConfig.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/AppliancePropertiesInfrastructureConfig.Serialization.cs index 2bdcd1b3f41fa..1b8ebd4ef14b1 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/AppliancePropertiesInfrastructureConfig.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/AppliancePropertiesInfrastructureConfig.Serialization.cs @@ -18,6 +18,15 @@ internal partial class AppliancePropertiesInfrastructureConfig : IUtf8JsonSerial 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter wr throw new FormatException($"The model {nameof(AppliancePropertiesInfrastructureConfig)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Provider)) { writer.WritePropertyName("provider"u8); @@ -46,7 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter wr #endif } } - writer.WriteEndObject(); } AppliancePropertiesInfrastructureConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSshKey.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSshKey.Serialization.cs index 72a6344f37a46..2b4dd32a511a9 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSshKey.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSshKey.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceSshKey : 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO throw new FormatException($"The model {nameof(ApplianceSshKey)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Certificate)) { writer.WritePropertyName("certificate"u8); @@ -66,7 +74,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO #endif } } - writer.WriteEndObject(); } ApplianceSshKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersion.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersion.Serialization.cs index 16b6546702593..7b5bba8947a8c 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersion.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersion.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceSupportedVersion : IUtf8JsonSerializable, IJsonMod 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea throw new FormatException($"The model {nameof(ApplianceSupportedVersion)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Metadata)) { writer.WritePropertyName("metadata"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea #endif } } - writer.WriteEndObject(); } ApplianceSupportedVersion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersion.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersion.Serialization.cs index 10e74cd4eda78..d03a1fb3d0530 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersion.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersion.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceSupportedVersionCatalogVersion : IUtf8JsonSerializ 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter wr throw new FormatException($"The model {nameof(ApplianceSupportedVersionCatalogVersion)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Data)) { writer.WritePropertyName("data"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter wr #endif } } - writer.WriteEndObject(); } ApplianceSupportedVersionCatalogVersion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersionProperties.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersionProperties.Serialization.cs index 3b2ea9e173c84..59fdfd3dec11a 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersionProperties.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionCatalogVersionProperties.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceSupportedVersionCatalogVersionProperties : IUtf8Js 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8Jso throw new FormatException($"The model {nameof(ApplianceSupportedVersionCatalogVersionProperties)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Audience)) { writer.WritePropertyName("audience"u8); @@ -61,7 +69,6 @@ void IJsonModel.Write(Utf8Jso #endif } } - writer.WriteEndObject(); } ApplianceSupportedVersionCatalogVersionProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionMetadata.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionMetadata.Serialization.cs index 9c650362380d3..a51a58e3b789e 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionMetadata.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceSupportedVersionMetadata.Serialization.cs @@ -18,6 +18,15 @@ internal partial class ApplianceSupportedVersionMetadata : IUtf8JsonSerializable 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, throw new FormatException($"The model {nameof(ApplianceSupportedVersionMetadata)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(CatalogVersion)) { writer.WritePropertyName("catalogVersion"u8); @@ -46,7 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, #endif } } - writer.WriteEndObject(); } ApplianceSupportedVersionMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceTelemetryConfigResult.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceTelemetryConfigResult.Serialization.cs index c30d289008da6..4be757fe0584b 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceTelemetryConfigResult.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceTelemetryConfigResult.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceTelemetryConfigResult : 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod throw new FormatException($"The model {nameof(ApplianceTelemetryConfigResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(TelemetryInstrumentationKey)) { writer.WritePropertyName("telemetryInstrumentationKey"u8); @@ -46,7 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod #endif } } - writer.WriteEndObject(); } ApplianceTelemetryConfigResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraph.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraph.Serialization.cs index 0de8ebb3c0f82..8859f209c6d9f 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraph.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraph.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceUpgradeGraph : 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW throw new FormatException($"The model {nameof(ApplianceUpgradeGraph)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(Id)) { writer.WritePropertyName("id"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW #endif } } - writer.WriteEndObject(); } ApplianceUpgradeGraph IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraphProperties.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraphProperties.Serialization.cs index fce5d998092c0..3bb59ff27f570 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraphProperties.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ApplianceUpgradeGraphProperties.Serialization.cs @@ -18,6 +18,15 @@ public partial class ApplianceUpgradeGraphProperties : IUtf8JsonSerializable, IJ 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo throw new FormatException($"The model {nameof(ApplianceUpgradeGraphProperties)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ApplianceVersion)) { writer.WritePropertyName("applianceVersion"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo #endif } } - writer.WriteEndObject(); } ApplianceUpgradeGraphProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/HybridConnectionConfig.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/HybridConnectionConfig.Serialization.cs index 5f6b376015df0..21bb99d69ed9b 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/HybridConnectionConfig.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/HybridConnectionConfig.Serialization.cs @@ -18,6 +18,15 @@ public partial class HybridConnectionConfig : 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader throw new FormatException($"The model {nameof(HybridConnectionConfig)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ExpirationTime)) { writer.WritePropertyName("expirationTime"u8); @@ -61,7 +69,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader #endif } } - writer.WriteEndObject(); } HybridConnectionConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ResourceConnectorAppliancePatch.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ResourceConnectorAppliancePatch.Serialization.cs index 21dcfb0e50646..39e955689260c 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ResourceConnectorAppliancePatch.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/Models/ResourceConnectorAppliancePatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class ResourceConnectorAppliancePatch : IUtf8JsonSerializable, IJ 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") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo throw new FormatException($"The model {nameof(ResourceConnectorAppliancePatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -52,7 +60,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo #endif } } - writer.WriteEndObject(); } ResourceConnectorAppliancePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceData.Serialization.cs b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceData.Serialization.cs index 53a19e21b57ec..9a46ee408c359 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceData.Serialization.cs +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/Generated/ResourceConnectorApplianceData.Serialization.cs @@ -20,6 +20,15 @@ public partial class ResourceConnectorApplianceData : 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 override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -27,45 +36,12 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod throw new FormatException($"The model {nameof(ResourceConnectorApplianceData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Identity)) { writer.WritePropertyName("identity"u8); JsonSerializer.Serialize(writer, Identity); } - 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(Distro)) @@ -99,22 +75,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod writer.WriteStringValue(Version); } 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(); } ResourceConnectorApplianceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/autorest.md b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/autorest.md index bd39464e4291e..e0c546bf7768b 100644 --- a/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/autorest.md +++ b/sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/src/autorest.md @@ -18,6 +18,7 @@ skip-csproj: true modelerfour: flatten-payloads: false use-model-reader-writer: true +use-write-core: true #mgmt-debug: # show-serialized-names: true