From 2eda98546496acc98cbc1daeba05796917f21418 Mon Sep 17 00:00:00 2001 From: Xinni Tong Date: Thu, 12 Sep 2024 17:03:23 +0800 Subject: [PATCH] Enable WriteCore feature for attestation (#45928) --- ...ourceManager.Attestation.netstandard2.0.cs | 8 +++ ...ateEndpointConnectionData.Serialization.cs | 47 ++++----------- .../AttestationProviderData.Serialization.cs | 60 ++++--------------- ...pointConnectionListResult.Serialization.cs | 11 +++- ...tationPrivateLinkResource.Serialization.cs | 47 ++++----------- ...ateLinkResourceListResult.Serialization.cs | 11 +++- ...inkServiceConnectionState.Serialization.cs | 11 +++- ...iderCreateOrUpdateContent.Serialization.cs | 11 +++- ...stationProviderListResult.Serialization.cs | 11 +++- .../AttestationProviderPatch.Serialization.cs | 11 +++- ...iceCreationSpecificParams.Serialization.cs | 11 +++- ...ervicePatchSpecificParams.Serialization.cs | 11 +++- .../Models/JsonWebKey.Serialization.cs | 11 +++- .../Models/JsonWebKeySet.Serialization.cs | 11 +++- .../Models/PrivateEndpoint.Serialization.cs | 11 +++- .../src/autorest.md | 1 + 16 files changed, 138 insertions(+), 146 deletions(-) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs index 6dd0817a5b946..2636b94c16873 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/api/Azure.ResourceManager.Attestation.netstandard2.0.cs @@ -37,6 +37,7 @@ public AttestationPrivateEndpointConnectionData() { } public Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState ConnectionState { get { throw null; } set { } } public string PrivateEndpointStringId { get { throw null; } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationPrivateEndpointConnectionData 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.Attestation.AttestationPrivateEndpointConnectionData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -87,6 +88,7 @@ public AttestationProviderData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationServiceStatus? Status { get { throw null; } set { } } public string TrustModel { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.AttestationProviderData 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.Attestation.AttestationProviderData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -205,6 +207,7 @@ public AttestationPrivateLinkResource() { } public string GroupId { get { throw null; } } public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkResource 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.Attestation.Models.AttestationPrivateLinkResource System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -217,6 +220,7 @@ public AttestationPrivateLinkServiceConnectionState() { } public string ActionsRequired { get { throw null; } set { } } public string Description { get { throw null; } set { } } public Azure.ResourceManager.Attestation.Models.AttestationPrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationPrivateLinkServiceConnectionState 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.Attestation.Models.AttestationPrivateLinkServiceConnectionState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -229,6 +233,7 @@ public AttestationProviderCreateOrUpdateContent(Azure.Core.AzureLocation locatio public Azure.Core.AzureLocation Location { get { throw null; } } public Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams Properties { get { throw null; } } 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.Attestation.Models.AttestationProviderCreateOrUpdateContent 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.Attestation.Models.AttestationProviderCreateOrUpdateContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -240,6 +245,7 @@ public partial class AttestationProviderPatch : System.ClientModel.Primitives.IJ public AttestationProviderPatch() { } public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? AttestationServicePatchSpecificParamsPublicNetworkAccess { get { throw null; } set { } } 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.Attestation.Models.AttestationProviderPatch 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.Attestation.Models.AttestationProviderPatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -251,6 +257,7 @@ public partial class AttestationServiceCreationSpecificParams : System.ClientMod public AttestationServiceCreationSpecificParams() { } public System.Collections.Generic.IList PolicySigningCertificatesKeys { get { throw null; } } public Azure.ResourceManager.Attestation.Models.PublicNetworkAccessType? PublicNetworkAccess { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.AttestationServiceCreationSpecificParams 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.Attestation.Models.AttestationServiceCreationSpecificParams System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -296,6 +303,7 @@ public JsonWebKey(string kty) { } public string X { get { throw null; } set { } } public System.Collections.Generic.IList X5C { get { throw null; } } public string Y { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Attestation.Models.JsonWebKey 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.Attestation.Models.JsonWebKey System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs index c8d81fc405553..a1716faec0a2d 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationPrivateEndpointConnectionData.Serialization.cs @@ -20,6 +20,15 @@ public partial class AttestationPrivateEndpointConnectionData : IUtf8JsonSeriali 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,27 +36,7 @@ void IJsonModel.Write(Utf8JsonWriter w throw new FormatException($"The model {nameof(AttestationPrivateEndpointConnectionData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - 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); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(PrivateEndpoint)) @@ -66,22 +55,6 @@ void IJsonModel.Write(Utf8JsonWriter w writer.WriteStringValue(ProvisioningState.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(); } AttestationPrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs index 553ada8ea8919..5636f5a9ecaec 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderData.Serialization.cs @@ -20,6 +20,15 @@ public partial class AttestationProviderData : 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") @@ -27,40 +36,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(AttestationProviderData)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - 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); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(TrustModel)) @@ -94,22 +70,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade writer.WriteEndArray(); } 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(); } AttestationProviderData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs index 1aa4c4cdcfe57..343d528051a18 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateEndpointConnectionListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class AttestationPrivateEndpointConnectionListResult : IUtf8Jso 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(Utf8JsonWr throw new FormatException($"The model {nameof(AttestationPrivateEndpointConnectionListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWr #endif } } - writer.WriteEndObject(); } AttestationPrivateEndpointConnectionListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs index 8be5f591b7d1e..fd243d49fc0bf 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResource.Serialization.cs @@ -19,6 +19,15 @@ public partial class AttestationPrivateLinkResource : 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") @@ -26,27 +35,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod throw new FormatException($"The model {nameof(AttestationPrivateLinkResource)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - 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); - } + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(GroupId)) @@ -75,22 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod writer.WriteEndArray(); } 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(); } AttestationPrivateLinkResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs index c71532b8ea65c..93007b0e6c229 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkResourceListResult.Serialization.cs @@ -18,6 +18,15 @@ internal partial class AttestationPrivateLinkResourceListResult : IUtf8JsonSeria 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 w throw new FormatException($"The model {nameof(AttestationPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Value)) { writer.WritePropertyName("value"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter w #endif } } - writer.WriteEndObject(); } AttestationPrivateLinkResourceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs index 4a1ce1c5457b7..2297305aaa7b3 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationPrivateLinkServiceConnectionState.Serialization.cs @@ -18,6 +18,15 @@ public partial class AttestationPrivateLinkServiceConnectionState : IUtf8JsonSer 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(Utf8JsonWrit throw new FormatException($"The model {nameof(AttestationPrivateLinkServiceConnectionState)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Status)) { writer.WritePropertyName("status"u8); @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWrit #endif } } - writer.WriteEndObject(); } AttestationPrivateLinkServiceConnectionState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs index d5a011b72baa6..35c97e1c808c8 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderCreateOrUpdateContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class AttestationProviderCreateOrUpdateContent : IUtf8JsonSeriali 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 w throw new FormatException($"The model {nameof(AttestationProviderCreateOrUpdateContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("location"u8); writer.WriteStringValue(Location); if (Optional.IsCollectionDefined(Tags)) @@ -56,7 +64,6 @@ void IJsonModel.Write(Utf8JsonWriter w #endif } } - writer.WriteEndObject(); } AttestationProviderCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs index c8a22d460a7cd..0a2ee09f92255 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderListResult.Serialization.cs @@ -19,6 +19,15 @@ internal partial class AttestationProviderListResult : 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") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode throw new FormatException($"The model {nameof(AttestationProviderListResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(SystemData)) { writer.WritePropertyName("systemData"u8); @@ -57,7 +65,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode #endif } } - writer.WriteEndObject(); } AttestationProviderListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs index 0d218ec0df98b..3ef862891037a 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationProviderPatch.Serialization.cs @@ -18,6 +18,15 @@ public partial class AttestationProviderPatch : 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(AttestationProviderPatch)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Tags)) { writer.WritePropertyName("tags"u8); @@ -57,7 +65,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead #endif } } - writer.WriteEndObject(); } AttestationProviderPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs index 55235dbb7be3c..2c62194b33b41 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServiceCreationSpecificParams.Serialization.cs @@ -18,6 +18,15 @@ public partial class AttestationServiceCreationSpecificParams : IUtf8JsonSeriali 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 w throw new FormatException($"The model {nameof(AttestationServiceCreationSpecificParams)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter w #endif } } - writer.WriteEndObject(); } AttestationServiceCreationSpecificParams IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.Serialization.cs index 1a76486f237b4..4be6865c0776f 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/AttestationServicePatchSpecificParams.Serialization.cs @@ -18,6 +18,15 @@ internal partial class AttestationServicePatchSpecificParams : 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 writ throw new FormatException($"The model {nameof(AttestationServicePatchSpecificParams)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); @@ -46,7 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writ #endif } } - writer.WriteEndObject(); } AttestationServicePatchSpecificParams IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs index b23a1f7b0d1e5..9c2c721fb625d 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKey.Serialization.cs @@ -18,6 +18,15 @@ public partial class JsonWebKey : 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, ModelReaderWriterOption throw new FormatException($"The model {nameof(JsonWebKey)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsDefined(Alg)) { writer.WritePropertyName("alg"u8); @@ -128,7 +136,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption #endif } } - writer.WriteEndObject(); } JsonWebKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs index 2df0188b705da..e848f8306f355 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/JsonWebKeySet.Serialization.cs @@ -18,6 +18,15 @@ internal partial class JsonWebKeySet : 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, ModelReaderWriterOpt throw new FormatException($"The model {nameof(JsonWebKeySet)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (Optional.IsCollectionDefined(Keys)) { writer.WritePropertyName("keys"u8); @@ -51,7 +59,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt #endif } } - writer.WriteEndObject(); } JsonWebKeySet IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs index 274e16a669a88..342c877d6572f 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/Models/PrivateEndpoint.Serialization.cs @@ -18,6 +18,15 @@ internal partial class PrivateEndpoint : 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(PrivateEndpoint)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(StringId)) { writer.WritePropertyName("id"u8); @@ -46,7 +54,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO #endif } } - writer.WriteEndObject(); } PrivateEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md b/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md index 01e49a1f66020..ea6b3ec3ea21c 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md @@ -20,6 +20,7 @@ skip-csproj: true modelerfour: flatten-payloads: false use-model-reader-writer: true +use-write-core: true no-property-type-replacement: PrivateEndpoint format-by-name-rules: